aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorBonfaceKilz2021-03-05 12:06:54 +0300
committerBonfaceKilz2021-03-08 21:09:58 +0300
commit8752937bc1e3cea84eefd3e363b429157f25acb5 (patch)
tree57ce328b6f0ac10adbb90f09e72962343fb83d49 /tests/unit
parent5c56425d51ab6a6b4ffd6ec8f86121bd91ff5e63 (diff)
downloadgenenetwork3-8752937bc1e3cea84eefd3e363b429157f25acb5.tar.gz
Add generic fn for computing k and gwa values
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/computations/test_gemma.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/unit/computations/test_gemma.py b/tests/unit/computations/test_gemma.py
index 2d2fbf9..d3fb7aa 100644
--- a/tests/unit/computations/test_gemma.py
+++ b/tests/unit/computations/test_gemma.py
@@ -2,6 +2,7 @@
import unittest
from unittest import mock
+from gn3.computations.gemma import compute_k_values
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
@@ -50,3 +51,48 @@ class TestGemma(unittest.TestCase):
"test.txt -a genofile_snps.txt "
"-gk > /tmp/gn2/"
"k_output_gUFhGu4rLG7k+CXLPk1OUg.txt"))
+
+ @mock.patch("gn3.computations.gemma.get_hash_of_files")
+ def test_compute_k_values_without_loco(self, mock_get_hash):
+ """Test computing k valuse without loco"""
+ mock_get_hash.return_value = "my-hash"
+ self.assertEqual(
+ compute_k_values(gemma_cmd="gemma-wrapper",
+ output_dir="/tmp",
+ token="my-token",
+ gemma_kwargs={
+ "g": "genofile",
+ "p": "phenofile",
+ "a": "snpsfile"
+ }), {
+ "output_file":
+ "my-hash-k-output.json",
+ "gemma_cmd":
+ ("gemma-wrapper --json -- -g genofile "
+ "-p phenofile -a snpsfile "
+ "-gk > /tmp/my-token/my-hash-k-output.json")
+ })
+
+ @mock.patch("gn3.computations.gemma.get_hash_of_files")
+ def test_compute_k_values_with_loco(self, mock_get_hash):
+ """Test computing k valuse with loco"""
+ mock_get_hash.return_value = "my-hash"
+ self.assertEqual(
+ compute_k_values(gemma_cmd="gemma-wrapper",
+ output_dir="/tmp",
+ token="my-token",
+ chromosomes="1,2,3,4,5",
+ gemma_kwargs={
+ "g": "genofile",
+ "p": "phenofile",
+ "a": "snpsfile"
+ }), {
+ "output_file":
+ "my-hash-r+gF5a-k-output.json",
+ "gemma_cmd": ("gemma-wrapper --json "
+ "--loco --input 1,2,3,4,5 "
+ "-- -g genofile "
+ "-p phenofile -a snpsfile "
+ "-gk > /tmp/my-token/"
+ "my-hash-r+gF5a-k-output.json")
+ })