From 85e369311b60faa2490f25c88a2ef87042b91738 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 30 May 2022 09:41:33 +0300 Subject: Pass trait data as args to `fix_strains` and fix some bugs The `fix_strains` function works on the trait data, not the basic trait info. This commit fixes the arguments passed to the function, and also some bugs in the function. --- .../unit/computations/test_partial_correlations.py | 44 ++++++++++++---------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'tests/unit/computations') diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index 81ddbcc..20cd6bc 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -81,19 +81,24 @@ control_traits = ( "ndata": None}}}) dictified_control_samples = ( - {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, - "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, - "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, - "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, - {"BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, - "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, - "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, - {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}) + {"data": { + "B6cC3-1": { + "sample_name": "B6cC3-1", "value": 7.51879,"variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}}, + {"data": { + "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}}, + {"data": { + "B6cC3-1": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}}) class TestPartialCorrelations(TestCase): """Class for testing partial correlations computation functions""" @@ -145,12 +150,13 @@ class TestPartialCorrelations(TestCase): """ self.assertEqual( fix_samples( - {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, - "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, - "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, - "variance": None}}, + {"data": {"B6cC3-1": {"sample_name": "B6cC3-1", + "value": 7.51879, + "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, + "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, + "variance": None}}}, dictified_control_samples), (("BXD2",), (7.80944,), (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944, 8.39265, -- cgit v1.2.3