aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/tests/unit')
-rw-r--r--wqflask/tests/unit/wqflask/marker_regression/test_run_mapping.py33
-rw-r--r--wqflask/tests/unit/wqflask/wgcna/__init__.py0
-rw-r--r--wqflask/tests/unit/wqflask/wgcna/test_wgcna.py50
3 files changed, 66 insertions, 17 deletions
diff --git a/wqflask/tests/unit/wqflask/marker_regression/test_run_mapping.py b/wqflask/tests/unit/wqflask/marker_regression/test_run_mapping.py
index 3747aeb8..868b0b0b 100644
--- a/wqflask/tests/unit/wqflask/marker_regression/test_run_mapping.py
+++ b/wqflask/tests/unit/wqflask/marker_regression/test_run_mapping.py
@@ -43,7 +43,7 @@ class TestRunMapping(unittest.TestCase):
})
}
self.dataset = AttributeSetter(
- {"fullname": "dataser_1", "group": self.group, "type": "ProbeSet"})
+ {"fullname": "dataset_1", "group": self.group, "type": "ProbeSet"})
self.chromosomes = AttributeSetter({"chromosomes": chromosomes})
self.trait = AttributeSetter(
@@ -180,37 +180,36 @@ class TestRunMapping(unittest.TestCase):
with mock.patch("wqflask.marker_regression.run_mapping.datetime.datetime", new=datetime_mock):
export_mapping_results(dataset=self.dataset, trait=self.trait, markers=markers,
- results_path="~/results", mapping_scale="physic", score_type="-log(p)",
- transform="qnorm", covariates="Dataset1:Trait1,Dataset2:Trait2", n_samples="100",
- vals_hash="")
+ results_path="~/results", mapping_method="gemma", mapping_scale="physic",
+ score_type="-logP", transform="qnorm",
+ covariates="Dataset1:Trait1,Dataset2:Trait2",
+ n_samples="100", vals_hash="")
write_calls = [
mock.call('Time/Date: 09/01/19 / 10:12:12\n'),
mock.call('Population: Human GP1_\n'), mock.call(
- 'Data Set: dataser_1\n'),
+ 'Data Set: dataset_1\n'),
mock.call('Trait: Test Name\n'),
mock.call('Trait Hash: \n'),
- mock.call('N Samples: 100\n'), mock.call(
- 'Transform - Quantile Normalized\n'),
+ mock.call('N Samples: 100\n'),
+ mock.call('Mapping Tool: gemma\n'),
+ mock.call('Transform - Quantile Normalized\n'),
mock.call('Gene Symbol: IGFI\n'), mock.call(
'Location: X1 @ 123313 Mb\n'),
mock.call('Cofactors (dataset - trait):\n'),
mock.call('Trait1 - Dataset1\n'),
mock.call('Trait2 - Dataset2\n'),
mock.call('\n'), mock.call('Name,Chr,'),
- mock.call('Mb,-log(p)'), mock.call('Cm,-log(p)'),
+ mock.call('Mb,-logP'),
mock.call(',Additive'), mock.call(',Dominance'),
mock.call('\n'), mock.call('MK1,C1,'),
- mock.call('12000,'), mock.call('1,'),
- mock.call('3'), mock.call(',VA'),
- mock.call(',TT'), mock.call('\n'),
- mock.call('MK2,C2,'), mock.call('10000,'),
- mock.call('15,'), mock.call('7'),
+ mock.call('12000,'), mock.call('3'),
+ mock.call(',VA'), mock.call(',TT'),
+ mock.call('\n'), mock.call('MK2,C2,'),
+ mock.call('10000,'), mock.call('7'),
mock.call('\n'), mock.call('MK1,C3,'),
- mock.call('1,'), mock.call('45,'),
- mock.call('7'), mock.call(',VE'),
- mock.call(',Tt')
-
+ mock.call('1,'), mock.call('7'),
+ mock.call(',VE'), mock.call(',Tt')
]
mock_open.assert_called_once_with("~/results", "w+")
filehandler = mock_open()
diff --git a/wqflask/tests/unit/wqflask/wgcna/__init__.py b/wqflask/tests/unit/wqflask/wgcna/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/wqflask/tests/unit/wqflask/wgcna/__init__.py
diff --git a/wqflask/tests/unit/wqflask/wgcna/test_wgcna.py b/wqflask/tests/unit/wqflask/wgcna/test_wgcna.py
new file mode 100644
index 00000000..8e947e2f
--- /dev/null
+++ b/wqflask/tests/unit/wqflask/wgcna/test_wgcna.py
@@ -0,0 +1,50 @@
+
+"""module contains for processing gn3 wgcna data"""
+from unittest import TestCase
+
+from wqflask.wgcna.gn3_wgcna import process_wgcna_data
+
+
+class DataProcessingTests(TestCase):
+ """class contains data processing tests"""
+
+ def test_data_processing(self):
+ """test for parsing data for datatable"""
+ output = {
+ "input": {
+ "sample_names": ["BXD1", "BXD2", "BXD3", "BXD4", "BXD5", "BXD6"],
+
+ },
+ "output": {
+ "ModEigens": {
+ "MEturquoise": [
+ 0.0646677768085351,
+ 0.137200224277058,
+ 0.63451113720732,
+ -0.544002665501479,
+ -0.489487590361863,
+ 0.197111117570427
+ ],
+ "MEgrey": [
+ 0.213,
+ 0.214,
+ 0.3141,
+ -0.545,
+ -0.423,
+ 0.156,
+ ]
+ }}}
+
+ row_data = [['BXD1', 0.065, 0.213],
+ ['BXD2', 0.137, 0.214],
+ ['BXD3', 0.635, 0.314],
+ ['BXD4', -0.544, -0.545],
+ ['BXD5', -0.489, -0.423],
+ ['BXD6', 0.197, 0.156]]
+
+ expected_results = {
+ "col_names": ["sample_names", "MEturquoise", "MEgrey"],
+ "mod_dataset": row_data
+ }
+
+ self.assertEqual(process_wgcna_data(output), expected_results)