about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorBonfaceKilz2021-02-24 10:36:04 +0300
committerBonfaceKilz2021-02-24 14:20:29 +0300
commit2125450ffaf93e9500dc6360ecce8d6c7e8e4036 (patch)
treeaefa3fbe569714ae6cf5b9be636b4ae82f07060c /tests
parent0a91d8eee64a47062f03c3e04a015cf3ae96a782 (diff)
downloadgenenetwork3-2125450ffaf93e9500dc6360ecce8d6c7e8e4036.tar.gz
Create a new helper function for generating k_values and GWA
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/computations/test_gemma.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/unit/computations/test_gemma.py b/tests/unit/computations/test_gemma.py
index 23707ef..a7884ea 100644
--- a/tests/unit/computations/test_gemma.py
+++ b/tests/unit/computations/test_gemma.py
@@ -4,6 +4,7 @@ import unittest
 from unittest import mock
 from gn3.computations.gemma import generate_hash_of_string
 from gn3.computations.gemma import generate_pheno_txt_file
+from gn3.computations.gemma import generate_gemma_computation_cmd
 
 
 class TestGemma(unittest.TestCase):
@@ -29,3 +30,22 @@ class TestGemma(unittest.TestCase):
         """Test that a string is hashed correctly"""
         self.assertEqual(generate_hash_of_string("I^iQP&TlSR^z"),
                          "hMVRw8kbEp49rOmoIkhMjA")
+
+    @mock.patch("gn3.computations.gemma.do_paths_exist")
+    def test_compose_k_computation_cmd(self, mock_pathsp):
+        """Test that a K computation cmd is constructed properly"""
+        mock_pathsp.return_value = True
+        self.assertEqual(
+            generate_gemma_computation_cmd(
+                gemma_cmd="gemma-wrapper",
+                gemma_kwargs={
+                    "geno_filename": "genofile.txt",
+                    "trait_filename": "test.txt",
+                    "covar_filename": "genofile_snps.txt"},
+                output_file="/tmp/gn2/k_output_gUFhGu4rLG7k+CXLPk1OUg.txt",
+            ),
+            ("gemma-wrapper --json -- "
+             "-g genofile.txt -p "
+             "test.txt -a genofile_snps.txt "
+             "-gk > /tmp/gn2/"
+             "k_output_gUFhGu4rLG7k+CXLPk1OUg.txt"))