From 9647226ea4c85449581df713c2bb583aeed6940f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 4 Nov 2021 12:43:28 +0300 Subject: Partially implement `partial_correlation_recursive` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: Implement one path for the `gn3.computations.partial_correlations.partial_correlation_recursive` function. * gn3/settings.py: Add a setting for how many decimal places to round to * tests/unit/computations/test_partial_correlations.py: Update test to take the number of decimal places into consideration Implement a single path (where the z value is a vector and not a matrix) for the `partial_correlation_recursive` function. --- tests/unit/computations/test_partial_correlations.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index b22bc62..981801a 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -4,6 +4,8 @@ import csv from unittest import TestCase import pandas + +from gn3.settings import ROUND_TO from gn3.computations.partial_correlations import ( fix_samples, control_samples, @@ -115,7 +117,7 @@ def parse_test_data_csv(filename): "z": __str__to_tuple(line, "z"), "method": methods[line["method"]], "rm": line["rm"] == "TRUE", - "result": float(line["result"]) + "result": round(float(line["result"]), ROUND_TO) } for line in lines) class TestPartialCorrelations(TestCase): -- cgit v1.2.3