aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-01-04 17:35:48 +0300
committerFrederick Muriuki Muriithi2024-01-04 17:35:48 +0300
commit5f5cc8503ec10319ee4d9e7d6bd739cc6190561c (patch)
tree8d92b71cd7e4870693f696e97d5dad82651c8a76 /tests
parent6b2002f236188e3c2571af18642527b156ed60e0 (diff)
downloadgn-uploader-5f5cc8503ec10319ee4d9e7d6bd739cc6190561c.tar.gz
Parse sex information from R/qtl bundle.
Diffstat (limited to 'tests')
-rw-r--r--tests/r_qtl/test_files/test_cross_info_01.zipbin597 -> 594 bytes
-rw-r--r--tests/r_qtl/test_files/test_cross_info_02.zipbin778 -> 775 bytes
-rw-r--r--tests/r_qtl/test_files/test_sex_info_01.zipbin0 -> 589 bytes
-rw-r--r--tests/r_qtl/test_files/test_sex_info_02.zipbin0 -> 773 bytes
-rw-r--r--tests/r_qtl/test_r_qtl2_sex_information.py35
5 files changed, 35 insertions, 0 deletions
diff --git a/tests/r_qtl/test_files/test_cross_info_01.zip b/tests/r_qtl/test_files/test_cross_info_01.zip
index 1211f96..6143a9f 100644
--- a/tests/r_qtl/test_files/test_cross_info_01.zip
+++ b/tests/r_qtl/test_files/test_cross_info_01.zip
Binary files differ
diff --git a/tests/r_qtl/test_files/test_cross_info_02.zip b/tests/r_qtl/test_files/test_cross_info_02.zip
index dddd281..7e23fc4 100644
--- a/tests/r_qtl/test_files/test_cross_info_02.zip
+++ b/tests/r_qtl/test_files/test_cross_info_02.zip
Binary files differ
diff --git a/tests/r_qtl/test_files/test_sex_info_01.zip b/tests/r_qtl/test_files/test_sex_info_01.zip
new file mode 100644
index 0000000..bc60d84
--- /dev/null
+++ b/tests/r_qtl/test_files/test_sex_info_01.zip
Binary files differ
diff --git a/tests/r_qtl/test_files/test_sex_info_02.zip b/tests/r_qtl/test_files/test_sex_info_02.zip
new file mode 100644
index 0000000..c862b73
--- /dev/null
+++ b/tests/r_qtl/test_files/test_sex_info_02.zip
Binary files differ
diff --git a/tests/r_qtl/test_r_qtl2_sex_information.py b/tests/r_qtl/test_r_qtl2_sex_information.py
new file mode 100644
index 0000000..90eae8d
--- /dev/null
+++ b/tests/r_qtl/test_r_qtl2_sex_information.py
@@ -0,0 +1,35 @@
+"""Test loading of sex information."""
+
+from pathlib import Path
+
+import pytest
+from zipfile import ZipFile
+
+from r_qtl import r_qtl2 as rqtl2
+
+@pytest.mark.unit_test
+@pytest.mark.parametrize(
+ "filepath,expected",
+ (("tests/r_qtl/test_files/test_sex_info_01.zip",
+ ({"id": "1", "sex": "male"},
+ {"id": "2", "sex": "male"},
+ {"id": "3", "sex": "male"},
+ {"id": "71", "sex": "male"},
+ {"id": "72", "sex": "male"},
+ {"id": "146", "sex": "female"},
+ {"id": "147", "sex": "female"},
+ {"id": "148", "sex": "female"})),
+ ("tests/r_qtl/test_files/test_sex_info_02.zip",
+ ({"id": "1", "sex": "male"},
+ {"id": "2", "sex": "male"},
+ {"id": "3", "sex": "male"},
+ {"id": "71", "sex": "male"},
+ {"id": "72", "sex": "male"},
+ {"id": "146", "sex": "female"},
+ {"id": "147", "sex": "female"},
+ {"id": "148", "sex": "female"}))))
+def test_parse_sex_info(filepath, expected):
+ """Test parsing of sex information."""
+ with ZipFile(Path(filepath).absolute(), "r") as zfile:
+ assert tuple(rqtl2.sex_information(
+ zfile, rqtl2.control_data(zfile))) == expected