aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-01-04 17:08:47 +0300
committerFrederick Muriuki Muriithi2024-01-04 17:08:47 +0300
commit6b2002f236188e3c2571af18642527b156ed60e0 (patch)
tree27127f01a2868cb07ea271536d724a840df69ee8 /tests
parent9eab14f7f6c40c401c29d11d69ac54303415ab87 (diff)
downloadgn-uploader-6b2002f236188e3c2571af18642527b156ed60e0.tar.gz
Parse cross information from R/qtl2 bundle.
Diffstat (limited to 'tests')
-rw-r--r--tests/r_qtl/test_files/test_cross_info_01.zipbin0 -> 597 bytes
-rw-r--r--tests/r_qtl/test_files/test_cross_info_02.zipbin0 -> 778 bytes
-rw-r--r--tests/r_qtl/test_r_qtl2_cross_information.py35
3 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
new file mode 100644
index 0000000..1211f96
--- /dev/null
+++ 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
new file mode 100644
index 0000000..dddd281
--- /dev/null
+++ b/tests/r_qtl/test_files/test_cross_info_02.zip
Binary files differ
diff --git a/tests/r_qtl/test_r_qtl2_cross_information.py b/tests/r_qtl/test_r_qtl2_cross_information.py
new file mode 100644
index 0000000..f424267
--- /dev/null
+++ b/tests/r_qtl/test_r_qtl2_cross_information.py
@@ -0,0 +1,35 @@
+"""Test loading of cross 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_cross_info_01.zip",
+ ({"id": "1", "cross_direction": 1},
+ {"id": "2", "cross_direction": 1},
+ {"id": "3", "cross_direction": 1},
+ {"id": "71", "cross_direction": 0},
+ {"id": "72", "cross_direction": 0},
+ {"id": "146", "cross_direction": 1},
+ {"id": "147", "cross_direction": 1},
+ {"id": "148", "cross_direction": 1})),
+ ("tests/r_qtl/test_files/test_cross_info_02.zip",
+ ({"id": "1", "cross_direction": 1},
+ {"id": "2", "cross_direction": 1},
+ {"id": "3", "cross_direction": 1},
+ {"id": "71", "cross_direction": 0},
+ {"id": "72", "cross_direction": 0},
+ {"id": "146", "cross_direction": 1},
+ {"id": "147", "cross_direction": 1},
+ {"id": "148", "cross_direction": 1}))))
+def test_parse_cross_info(filepath, expected):
+ """Test parsing of cross information."""
+ with ZipFile(Path(filepath).absolute(), "r") as zfile:
+ assert tuple(rqtl2.cross_information(
+ zfile, rqtl2.control_data(zfile))) == expected