From d05cf3636239456a0e258c6771f6282954acaa69 Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Thu, 21 Jul 2022 23:43:03 +0300 Subject: linting and tests fixes --- gn3/computations/rust_correlation.py | 3 ++- .../computations/data/correlation/sorted_results.txt | 10 +++++----- tests/unit/computations/test_rust_correlation.py | 16 +++++++++------- 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", -- cgit v1.2.3