aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/computations
diff options
context:
space:
mode:
authorAlexander Kabui2021-06-20 09:11:03 +0300
committerAlexander Kabui2021-06-20 09:11:03 +0300
commit123ad47af288d6b94f0354a0abd5bc669bc988d4 (patch)
tree999eb41c1fab3d443215c0e4a8533abecf64f9af /tests/unit/computations
parent75801d83c8302b48051d413490e6ce2a0b8ff01f (diff)
parentd653a635d0efd2291754c18f51d31f91a1c0a25c (diff)
downloadgenenetwork3-123ad47af288d6b94f0354a0abd5bc669bc988d4.tar.gz
merge main
Diffstat (limited to 'tests/unit/computations')
-rw-r--r--tests/unit/computations/test_rqtl.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/unit/computations/test_rqtl.py b/tests/unit/computations/test_rqtl.py
new file mode 100644
index 0000000..955d0ab
--- /dev/null
+++ b/tests/unit/computations/test_rqtl.py
@@ -0,0 +1,42 @@
+"""Test cases for procedures defined in computations.rqtl"""
+import unittest
+
+from unittest import mock
+from gn3.computations.rqtl import generate_rqtl_cmd
+
+class TestRqtl(unittest.TestCase):
+ """Test cases for computations.rqtl module"""
+ @mock.patch("gn3.computations.rqtl.generate_hash_of_string")
+ @mock.patch("gn3.computations.rqtl.get_hash_of_files")
+ def test_generate_rqtl_command(self, mock_get_hash_files, mock_generate_hash_string):
+ """Test computing mapping results with R/qtl"""
+ mock_get_hash_files.return_value = "my-hash1"
+ mock_generate_hash_string.return_value = "my-hash2"
+
+ self.assertEqual(
+ generate_rqtl_cmd(rqtl_wrapper_cmd="rqtl-wrapper",
+ rqtl_wrapper_kwargs={
+ "g": "genofile",
+ "p": "phenofile",
+ "model": "normal",
+ "method": "hk",
+ "nperm": 1000,
+ "scale": "Mb",
+ "control": "rs123456"
+ },
+ rqtl_wrapper_bool_kwargs=[
+ "addcovar",
+ "interval"
+ ]), {
+ "output_file":
+ "my-hash1my-hash2my-hash2-output.csv",
+ "rqtl_cmd": (
+ "Rscript rqtl-wrapper "
+ "--g genofile --p phenofile "
+ "--model normal --method hk "
+ "--nperm 1000 --scale Mb "
+ "--control rs123456 "
+ "--filename my-hash1my-hash2my-hash2-output.csv "
+ "--addcovar --interval"
+ )
+ })