aboutsummaryrefslogtreecommitdiff
path: root/tests/r_qtl
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-12-27 08:26:27 +0300
committerFrederick Muriuki Muriithi2023-12-27 08:28:12 +0300
commit3294adc11ada56046ff748c08b97faf0eeed11b2 (patch)
tree2459be4b0bb67028683b9d94ec23498b6872a619 /tests/r_qtl
parent46410163ca402660434b09a8fc8ec7b12b89d8a1 (diff)
downloadgn-uploader-3294adc11ada56046ff748c08b97faf0eeed11b2.tar.gz
Tests: Test parsing of pmap files. Merge testing of map files.
Diffstat (limited to 'tests/r_qtl')
-rw-r--r--tests/r_qtl/test_files/test_pmap.zipbin0 -> 531 bytes
-rw-r--r--tests/r_qtl/test_files/test_pmap_transposed.zipbin0 -> 583 bytes
-rw-r--r--tests/r_qtl/test_r_qtl2.py43
3 files changed, 22 insertions, 21 deletions
diff --git a/tests/r_qtl/test_files/test_pmap.zip b/tests/r_qtl/test_files/test_pmap.zip
new file mode 100644
index 0000000..a3fadd5
--- /dev/null
+++ b/tests/r_qtl/test_files/test_pmap.zip
Binary files differ
diff --git a/tests/r_qtl/test_files/test_pmap_transposed.zip b/tests/r_qtl/test_files/test_pmap_transposed.zip
new file mode 100644
index 0000000..5d9f51b
--- /dev/null
+++ b/tests/r_qtl/test_files/test_pmap_transposed.zip
Binary files differ
diff --git a/tests/r_qtl/test_r_qtl2.py b/tests/r_qtl/test_r_qtl2.py
index a72b300..33ff5e5 100644
--- a/tests/r_qtl/test_r_qtl2.py
+++ b/tests/r_qtl/test_r_qtl2.py
@@ -8,40 +8,41 @@ from r_qtl import r_qtl2 as rqtl2
@pytest.mark.unit_test
@pytest.mark.parametrize(
- "relpath,expected",
+ "relpath,mapfiletype,expected",
(("tests/r_qtl/test_files/test_gmap.zip",
+ "genetic-map",
({"marker": "PVV4", "chr": "1", "pos": "0.000000"},
{"marker": "AXR-1", "chr": "1", "pos": "6.250674"},
{"marker": "HH.335C-Col/PhyA", "chr": "1", "pos": "9.303868"},
{"marker": "EC.480C", "chr": "1", "pos": "12.577629"},
{"marker": "EC.66C", "chr": "1", "pos": "18.392830"})),
("tests/r_qtl/test_files/test_gmap_transposed.zip",
+ "genetic-map",
({"marker": "PVV4", "chr": "1", "pos": "0.000000"},
{"marker": "AXR-1", "chr": "1", "pos": "6.250674"},
{"marker": "HH.335C-Col/PhyA", "chr": "1", "pos": "9.303868"},
{"marker": "EC.480C", "chr": "1", "pos": "12.577629"},
- {"marker": "EC.66C", "chr": "1", "pos": "18.392830"}))))
-def test_parse_gmap_files(relpath, expected):
+ {"marker": "EC.66C", "chr": "1", "pos": "18.392830"})),
+ ("tests/r_qtl/test_files/test_pmap.zip",
+ "physical-map",
+ ({"marker": "D1Mit18", "chr": "1", "pos": "52.418656"},
+ {"marker": "D1Mit80", "chr": "1", "pos": "86.377953"},
+ {"marker": "D1Mit17", "chr": "1", "pos": "189.571337"},
+ {"marker": "D2Mit379", "chr": "2", "pos": "37.451062"},
+ {"marker": "D2Mit75", "chr": "2", "pos": "80.584782"})),
+ ("tests/r_qtl/test_files/test_pmap_transposed.zip",
+ "physical-map",
+ ({"marker": "D1Mit18", "chr": "1", "pos": "52.418656"},
+ {"marker": "D1Mit80", "chr": "1", "pos": "86.377953"},
+ {"marker": "D1Mit17", "chr": "1", "pos": "189.571337"},
+ {"marker": "D2Mit379", "chr": "2", "pos": "37.451062"},
+ {"marker": "D2Mit75", "chr": "2", "pos": "80.584782"}))))
+def test_parse_map_files(relpath, mapfiletype, expected):
"""
- GIVEN: A path to a zip file, `relpath`
- WHEN: we parse a gmap file
+ GIVEN: A path to a zip file, `relpath` and the type of the map file,
+ WHEN: we parse the R/qtl2 map file,
THEN: ensure the parsed data is as expected.
"""
with ZipFile(Path(relpath).absolute(), "r") as zfile:
assert rqtl2.map_data(
- zfile, "genetic-map", rqtl2.control_data(zfile)) == expected
-
-@pytest.mark.skip(reason="Test not implemented yet.")
-@pytest.mark.unit_test
-@pytest.mark.parametrize(
- "relpath,expected",
- (("tests/r_qtl/test_files/test_pmap.zip",
- ()),
- ("tests/r_qtl/test_files/test_pmap_transposed.zip",
- ())))
-def test_parse_pmap_files(relpath, expected):
- """
- GIVEN: A path to a zip file, `relpath`
- WHEN: we parse a pmap file
- THEN: ensure the parsed data is as expected.
- """
+ zfile, mapfiletype, rqtl2.control_data(zfile)) == expected