diff options
| author | Alexander <alexanderkabua@gmail.com> | 2022-05-19 14:28:14 +0300 |
|---|---|---|
| committer | Alexander <alexanderkabua@gmail.com> | 2022-05-19 14:28:14 +0300 |
| commit | 5fcda38871c7b077c688f44f064dc7a9c243ce9d (patch) | |
| tree | 4c6207a32d3968e6d7e907e187bd1ef71dd6ff2a /src | |
| parent | 4adac6e6363e850c37e5f8f3e8d4424fffd8511d (diff) | |
| download | correlation_rust-5fcda38871c7b077c688f44f064dc7a9c243ce9d.tar.gz | |
update json object
Diffstat (limited to 'src')
| -rw-r--r-- | src/analysis.rs | 4 | ||||
| -rw-r--r-- | src/parser.rs | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/analysis.rs b/src/analysis.rs index 37b80dd..3b872e2 100644 --- a/src/analysis.rs +++ b/src/analysis.rs @@ -12,8 +12,8 @@ impl Analysis { let x_vals:Vec<f64>= json_results.x_vals.split(",").map(|f|f.trim().parse::<f64>().unwrap()).collect(); let computation = correlations::Compute::new( - ',', - "pearson", + json_results.file_delimiter, + &json_results.method, &json_results.file_path, &x_vals diff --git a/src/parser.rs b/src/parser.rs index 2d0be8e..ef2c62c 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -8,6 +8,8 @@ pub struct JsonData { pub file_path:String, pub x_vals: String, pub sample_values:String, + pub method: String, + pub file_delimiter:char } @@ -180,7 +182,7 @@ mod tests{ fn test_json_file_read(){ let json_struct = JsonData::new("/home/kabui/correlation_rust/tests/data/sample_json_file.json"); - let k = JsonData { file_path: String::from("/home/kabui/correlation_rust/tests/data/matrix_80.txt"), x_vals: String::from("25.08439, 72.02225, 47.56293, 22.87893, 14.28721, 71.84655, 87.81991, 84.86824, 6.72478, 5.72373, 73.47078, 63.74703"), sample_values: String::from("bxd1") }; + let k = JsonData { file_path: String::from("/home/kabui/correlation_rust/tests/data/matrix_80.txt"), x_vals: String::from("25.08439, 72.02225, 47.56293, 22.87893, 14.28721, 71.84655, 87.81991, 84.86824, 6.72478, 5.72373, 73.47078, 63.74703"), sample_values: String::from("bxd1"),method:String::from("pearson"),file_delimiter:','}; assert_eq!(k,json_struct) } |
