aboutsummaryrefslogtreecommitdiff
path: root/tests/integration/test_gemma.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/test_gemma.py')
-rw-r--r--tests/integration/test_gemma.py109
1 files changed, 0 insertions, 109 deletions
diff --git a/tests/integration/test_gemma.py b/tests/integration/test_gemma.py
index bfce37a..7a7f520 100644
--- a/tests/integration/test_gemma.py
+++ b/tests/integration/test_gemma.py
@@ -39,115 +39,6 @@ class GemmaAPITest(unittest.TestCase):
self.assertEqual(response.status_code, 200)
@mock.patch("gn3.api.gemma.redis.Redis")
- @mock.patch("gn3.api.gemma.queue_cmd")
- @mock.patch("gn3.api.gemma.generate_gemma_computation_cmd")
- def test_run_gemma_no_loco(self, mock_gemma_computation_cmd,
- mock_queue_cmd, mock_redis):
- """Test that gemma composes the command correctly without loco"""
- _redis_conn = MockRedis(redis=mock.MagicMock(), hget=mock.MagicMock())
- mock_redis.return_value = _redis_conn
- mock_gemma_computation_cmd.side_effect = [
- ("gemma-wrapper --json -- "
- "-g genofile.txt -p "
- "test.txt -a genofile_snps.txt "
- "-gk > /tmp/gn2/"
- "bxd_K_gUFhGu4rLG7k+CXLPk1OUg.txt"),
- ("gemma-wrapper --json --input /tmp/gn2/"
- "bxd_K_gUFhGu4rLG7k+CXLPk1OUg.txt -- "
- "-a genofile_snps.txt -lmm 9 "
- "-g genofile.txt -p "
- "test.txt -a genofile_snps.txt "
- "-gk > /tmp/gn2/"
- "bxd_GWA_gUFhGu4rLG7k+CXLPk1OUg.txt")
- ]
- mock_queue_cmd.return_value = "my-unique-id"
- response = self.app.post("/api/gemma/k-gwa-computation",
- json={
- "trait_filename": "BXD.txt",
- "geno_filename": "BXD_geno",
- "values": ["X", "N/A", "X"],
- "dataset_groupname": "BXD",
- "trait_name": "Height",
- "email": "me@me.com",
- "dataset_name": "BXD"
- })
- mock_queue_cmd.assert_has_calls([
- mock.call(conn=_redis_conn,
- email="me@me.com",
- job_queue="GN3::job-queue",
- cmd=("gemma-wrapper --json -- -g "
- "genofile.txt -p test.txt "
- "-a genofile_snps.txt -gk > "
- "/tmp/gn2/bxd_K_gUFhGu4rLG7k+CXLPk1OUg.txt "
- "&& gemma-wrapper --json --input "
- "/tmp/gn2/bxd_K_gUFhGu4rLG7k+CXLPk1OUg.txt"
- " -- -a genofile_snps.txt -lmm 9 -g "
- "genofile.txt -p test.txt "
- "-a genofile_snps.txt "
- "-gk > "
- "/tmp/gn2/"
- "bxd_GWA_gUFhGu4rLG7k+CXLPk1OUg.txt"))
- ])
- # mock_pheno_txt_file.return_value = "/tmp/gn2/BXD_6OBEPW."
- self.assertEqual(
- response.get_json(), {
- "unique_id": 'my-unique-id',
- "status": "queued",
- "output_file": "BXD_GWA_WzxVcfhKAn4fJnSWpsBq0g.txt"
- })
-
- @mock.patch("gn3.api.gemma.redis.Redis")
- @mock.patch("gn3.api.gemma.queue_cmd")
- def test_run_gemma_with_loco(self, mock_queue_cmd, mock_redis):
- """Test that gemma composes the command correctly with loco"""
- _redis_conn = MockRedis(redis=mock.MagicMock(), hget=mock.MagicMock())
- mock_redis.return_value = _redis_conn
- mock_queue_cmd.return_value = "my-unique-id"
- response = self.app.post("/api/gemma/k-gwa-computation",
- json={
- "trait_filename":
- os.path.abspath(
- os.path.join(
- os.path.dirname(__file__),
- "test_data/")),
- "geno_filename":
- "BXD_geno.txt.gz",
- "values": ["X", "N/A", "X"],
- "dataset_groupname":
- "BXD",
- "trait_name":
- "Height",
- "email":
- "me@me.com",
- "dataset_name":
- "BXD",
- "loco":
- "1,2,3,4,5,6"
- })
- mock_queue_cmd.called_with(
- conn=_redis_conn,
- email="me@me.com",
- job_queue="GN3::job-queue",
- cmd=("gemma-wrapper --json -- -g "
- "genofile.txt -p test.txt "
- "-a genofile_snps.txt -gk > "
- "/tmp/gn2/bxd_K_gUFhGu4rLG7k+CXLPk1OUg.txt "
- "&& gemma-wrapper --json --input "
- "/tmp/gn2/bxd_K_gUFhGu4rLG7k+CXLPk1OUg.txt"
- " -- -a genofile_snps.txt -lmm 9 -g "
- "genofile.txt -p test.txt "
- "-a genofile_snps.txt "
- "-gk > "
- "/tmp/gn2/"
- "bxd_GWA_gUFhGu4rLG7k+CXLPk1OUg.txt"))
- self.assertEqual(
- response.get_json(), {
- "unique_id": 'my-unique-id',
- "status": "queued",
- "output_file": "BXD_GWA_WzxVcfhKAn4fJnSWpsBq0g.txt"
- })
-
- @mock.patch("gn3.api.gemma.redis.Redis")
def test_check_cmd_status(self, mock_redis):
"""Test that you can check the status of a given command"""
mock_hget = mock.MagicMock()