aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander_Kabui2022-07-21 23:43:03 +0300
committerBonfaceKilz2022-07-22 14:52:08 +0300
commitd05cf3636239456a0e258c6771f6282954acaa69 (patch)
tree0ab42f008a28cc73fd33c5c98e729b9f477a1b2f
parent8a989237b0099467bab9875e250f07085ba48a07 (diff)
downloadgenenetwork3-d05cf3636239456a0e258c6771f6282954acaa69.tar.gz
linting and tests fixes
-rw-r--r--gn3/computations/rust_correlation.py3
-rw-r--r--tests/unit/computations/data/correlation/sorted_results.txt10
-rw-r--r--tests/unit/computations/test_rust_correlation.py16
3 files changed, 16 insertions, 13 deletions
diff --git a/gn3/computations/rust_correlation.py b/gn3/computations/rust_correlation.py
index 086db3b..a8dc256 100644
--- a/gn3/computations/rust_correlation.py
+++ b/gn3/computations/rust_correlation.py
@@ -89,7 +89,8 @@ def parse_correlation_output(result_file: str, top_n: int = 500) -> list[dict]:
lines = [next(file_reader) for x in range(top_n)]
for line in lines:
- (trait_name, corr_coeff, p_val, num_overlap) = line.rstrip().split(",")
+ (trait_name, corr_coeff,
+ p_val, num_overlap) = line.rstrip().split(",")
corr_data = {
"num_overlap": num_overlap,
"corr_coefficient": corr_coeff,
diff --git a/tests/unit/computations/data/correlation/sorted_results.txt b/tests/unit/computations/data/correlation/sorted_results.txt
index f171f5a..57885b5 100644
--- a/tests/unit/computations/data/correlation/sorted_results.txt
+++ b/tests/unit/computations/data/correlation/sorted_results.txt
@@ -1,5 +1,5 @@
-63.62,0.97,0.00
-19,-0.96,0.22
-77.92,-0.94,0.31
-84.04,0.94,0.11
-23,-0.91,0.11 \ No newline at end of file
+63.62,0.97,0.00,12
+19,-0.96,0.22,12
+77.92,-0.94,0.31,12
+84.04,0.94,0.11,12
+23,-0.91,0.11,12 \ No newline at end of file
diff --git a/tests/unit/computations/test_rust_correlation.py b/tests/unit/computations/test_rust_correlation.py
index 0fd8e94..d5a6eb7 100644
--- a/tests/unit/computations/test_rust_correlation.py
+++ b/tests/unit/computations/test_rust_correlation.py
@@ -57,16 +57,18 @@ def test_parse_results():
"""test for parsing file results"""
raw_data = [
- ["63.62", "0.97", "0.00"],
- ["19", "-0.96", "0.22"],
- ["77.92", "-0.94", "0.31"],
- ["84.04", "0.94", "0.11"],
- ["23", "-0.91", "0.11"]
+ ["63.62", "0.97", "0.00", "12"],
+ ["19", "-0.96", "0.22", "12"],
+ ["77.92", "-0.94", "0.31", "12"],
+ ["84.04", "0.94", "0.11", "12"],
+ ["23", "-0.91", "0.11", "12"]
]
raw_dict = [{trait: {
- "num_overlap": 00,
- "p_value": p_val}} for (trait, corr_coeff, p_val) in raw_data]
+ "num_overlap": num_overlap,
+ "corr_coefficient": corr_coeff,
+ "p_value": p_val}} for (trait, corr_coeff,
+ p_val, num_overlap) in raw_data]
assert (parse_correlation_output(
"tests/unit/computations/data/correlation/sorted_results.txt",