aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-01-03 10:21:18 +0300
committerFrederick Muriuki Muriithi2024-01-03 10:21:18 +0300
commite713b566a873424709300110a78801fd49a74ea1 (patch)
treede8c765ef5eb8fa87485e9bbb9e0c60e0bdbf7e3 /tests
parent4bf51a31c251f3d788325c58c8a78f534409f90f (diff)
downloadgn-uploader-e713b566a873424709300110a78801fd49a74ea1.tar.gz
Add tests for `founder_geno` parsing.
Diffstat (limited to 'tests')
-rw-r--r--tests/r_qtl/test_r_qtl2_geno.py27
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/r_qtl/test_r_qtl2_geno.py b/tests/r_qtl/test_r_qtl2_geno.py
index 7b660a6..d323c4b 100644
--- a/tests/r_qtl/test_r_qtl2_geno.py
+++ b/tests/r_qtl/test_r_qtl2_geno.py
@@ -163,11 +163,32 @@ from r_qtl import r_qtl2 as rqtl2
"EC.480C": 2,
"EC.66C": 2
}))))
-def test_parse_geno_files(relpath,expected):
- """
+def test_parse_geno_files(relpath, expected):
+ """Test parsing of geno files from the R/qtl2 bundle.
+
GIVEN: Path to a zip file with R/qtl2 data
WHEN: we parse the geno file
THEN: ensure that the data we get is as expected
"""
with ZipFile(Path(relpath).absolute(), "r") as zfile:
- assert tuple(rqtl2.genotype_data(zfile, rqtl2.control_data(zfile))) == expected
+ assert tuple(
+ rqtl2.genotype_data(zfile, rqtl2.control_data(zfile))) == expected
+
+@pytest.mark.unit_test
+@pytest.mark.parametrize(
+ "relpath,expected",
+ (
+ ("tests/r_qtl/test_files/test_founder_geno.zip",
+ ()),
+ ("tests/r_qtl/test_files/test_founder_geno_transposed.zip",
+ ())))
+def test_parse_founder_geno_files(relpath, expected):
+ """Test parsing of founder_geno files from the R/qtl2 bundle.
+
+ GIVEN: Path to a zip file with R/qtl2 data
+ WHEN: we parse the founder_geno file
+ THEN: ensure that the data we get is as expected
+ """
+ with ZipFile(Path(relpath).absolute(), "r") as zfile:
+ assert tuple(rqtl2.founder_genotype_data(
+ zfile, rqtl2.control_data(zfile))) == expected