diff options
author | Alexander Kabui | 2021-09-16 14:03:25 +0300 |
---|---|---|
committer | Alexander Kabui | 2021-09-16 14:03:25 +0300 |
commit | ce045ec96bf965eaba077fdba99847a483281aba (patch) | |
tree | e4b22a0b7616895e224d04bf47f08dbe385021fc /tests/unit/computations | |
parent | f53a8a98206b4e8aedbf4b86e49f41ea140c9c6a (diff) | |
download | genenetwork3-ce045ec96bf965eaba077fdba99847a483281aba.tar.gz |
init tests for wgcna
Diffstat (limited to 'tests/unit/computations')
-rw-r--r-- | tests/unit/computations/test_wgcna.py | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/tests/unit/computations/test_wgcna.py b/tests/unit/computations/test_wgcna.py index 1ce69a1..8a68985 100644 --- a/tests/unit/computations/test_wgcna.py +++ b/tests/unit/computations/test_wgcna.py @@ -1,15 +1,35 @@ """module contains python code for wgcna""" from unittest import TestCase - - -def compute_sum(rhs_val, lhs_val): - """function to compute sum of two numbers""" - return rhs_val+lhs_val +from gn3.computations.wgcna import dump_wgcna_data +from gn3.computations.wgcna import compose_wgcna_cmd class TestWgcna(TestCase): """test class for wgcna""" - def test_compute_sum(self): - """test for compute sum function""" - self.assertEqual(compute_sum(1, 2), 3) + def test_compose_wgcna_cmd(self): + """test for composing wgcna cmd""" + wgcna_cmd = compose_wgcna_cmd("/wgcna.r", "/tmp/wgcna.json") + self.assertEqual(wgcna_cmd, f"Rscript /wgcna.r /tmp/wgcna.json") + + def test_create_json_data(self): + """test for writing the data to a csv file""" + # # All the traits we have data for (should not contain duplicates) + # All the strains we have data for (contains duplicates) + + trait_sample_data = {"1425642_at": {"129S1/SvImJ": 7.142, "A/J": 7.31, "AKR/J": 7.49, + "B6D2F1": 6.899, "BALB/cByJ": 7.172, "BALB/cJ": 7.396}, + "1457784_at": {"129S1/SvImJ": 7.071, "A/J": 7.05, "AKR/J": 7.313, + "B6D2F1": 6.999, "BALB/cByJ": 7.293, "BALB/cJ": 7.117}, + "1444351_at": {"129S1/SvImJ": 7.221, "A/J": 7.246, "AKR/J": 7.754, + "B6D2F1": 6.866, "BALB/cByJ": 6.752, "BALB/cJ": 7.269} + + } + + expected_input = { + "trait_sample_data": trait_sample_data, + "TOMtype": "unsigned", + "minModuleSize": 30 + } + + _results = dump_wgcna_data(expected_input) |