diff options
-rw-r--r-- | gn3/computations/correlations.py | 4 | ||||
-rw-r--r-- | tests/unit/computations/test_correlation.py | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/gn3/computations/correlations.py b/gn3/computations/correlations.py index 804716c..1e95800 100644 --- a/gn3/computations/correlations.py +++ b/gn3/computations/correlations.py @@ -150,10 +150,9 @@ def compute_all_sample_correlation(this_trait, corr_results.append({"trait_name_key": corr_result}) - sorted_corr_results = sorted( + return sorted( corr_results, key=lambda trait_name: -abs(list(trait_name.values())[0]["corr_coeffient"])) - return sorted_corr_results def benchmark_compute_all_sample(this_trait, @@ -295,7 +294,6 @@ def lit_correlation_for_trait_list( species=species, gene_id=trait_gene_id) - for (trait_name, target_trait_gene_id) in target_trait_lists: corr_results = {} if target_trait_gene_id: diff --git a/tests/unit/computations/test_correlation.py b/tests/unit/computations/test_correlation.py index a8d199d..9f3feab 100644 --- a/tests/unit/computations/test_correlation.py +++ b/tests/unit/computations/test_correlation.py @@ -417,8 +417,10 @@ class TestCorrelation(TestCase): mock_tissue_corr.side_effect = [{"tissue_corr": -0.5, "p_value": 0.9, "tissue_number": 3}, {"tissue_corr": 1.11, "p_value": 0.2, "tissue_number": 3}] - expected_results = [{"1412_at": {"tissue_corr": 1.11, "p_value": 0.2, "tissue_number": 3}}, - {"1418702_a_at": {"tissue_corr": -0.5, "p_value": 0.9, "tissue_number": 3}}] + expected_results = [{"1412_at": + {"tissue_corr": 1.11, "p_value": 0.2, "tissue_number": 3}}, + {"1418702_a_at": + {"tissue_corr": -0.5, "p_value": 0.9, "tissue_number": 3}}] results = compute_all_tissue_correlation( primary_tissue_dict=primary_tissue_dict, |