diff options
author | Frederick Muriuki Muriithi | 2024-01-04 17:35:48 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-01-04 17:35:48 +0300 |
commit | 5f5cc8503ec10319ee4d9e7d6bd739cc6190561c (patch) | |
tree | 8d92b71cd7e4870693f696e97d5dad82651c8a76 /tests/r_qtl | |
parent | 6b2002f236188e3c2571af18642527b156ed60e0 (diff) | |
download | gn-uploader-5f5cc8503ec10319ee4d9e7d6bd739cc6190561c.tar.gz |
Parse sex information from R/qtl bundle.
Diffstat (limited to 'tests/r_qtl')
-rw-r--r-- | tests/r_qtl/test_files/test_cross_info_01.zip | bin | 597 -> 594 bytes | |||
-rw-r--r-- | tests/r_qtl/test_files/test_cross_info_02.zip | bin | 778 -> 775 bytes | |||
-rw-r--r-- | tests/r_qtl/test_files/test_sex_info_01.zip | bin | 0 -> 589 bytes | |||
-rw-r--r-- | tests/r_qtl/test_files/test_sex_info_02.zip | bin | 0 -> 773 bytes | |||
-rw-r--r-- | tests/r_qtl/test_r_qtl2_sex_information.py | 35 |
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 Binary files differindex 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 diff --git a/tests/r_qtl/test_files/test_cross_info_02.zip b/tests/r_qtl/test_files/test_cross_info_02.zip Binary files differindex 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 diff --git a/tests/r_qtl/test_files/test_sex_info_01.zip b/tests/r_qtl/test_files/test_sex_info_01.zip Binary files differnew file mode 100644 index 0000000..bc60d84 --- /dev/null +++ b/tests/r_qtl/test_files/test_sex_info_01.zip diff --git a/tests/r_qtl/test_files/test_sex_info_02.zip b/tests/r_qtl/test_files/test_sex_info_02.zip Binary files differnew file mode 100644 index 0000000..c862b73 --- /dev/null +++ b/tests/r_qtl/test_files/test_sex_info_02.zip 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 |