aboutsummaryrefslogtreecommitdiff
path: root/tests/r_qtl/test_r_qtl2_covar.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/r_qtl/test_r_qtl2_covar.py')
-rw-r--r--tests/r_qtl/test_r_qtl2_covar.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/tests/r_qtl/test_r_qtl2_covar.py b/tests/r_qtl/test_r_qtl2_covar.py
index c18ee74..eef7a33 100644
--- a/tests/r_qtl/test_r_qtl2_covar.py
+++ b/tests/r_qtl/test_r_qtl2_covar.py
@@ -10,19 +10,21 @@ from r_qtl import r_qtl2 as rqtl2
@pytest.mark.parametrize(
"filepath,expected",
(("tests/r_qtl/test_files/test_covar.zip",
- ({"id": "1", "sex": "m", "cross_direction": "(BxS)x(BxS)"},
- {"id": "2", "sex": "m", "cross_direction": "(BxS)x(BxS)"},
- {"id": "3", "sex": "m", "cross_direction": "(BxS)x(BxS)"},
- {"id": "146", "sex": "f", "cross_direction": "(BxS)x(BxS)"},
- {"id": "147", "sex": "f", "cross_direction": "(BxS)x(BxS)"},
- {"id": "148", "sex": "f", "cross_direction": "(BxS)x(BxS)"})),
+ ({"id": "1", "sex": "male", "cross_direction": 1},
+ {"id": "2", "sex": "male", "cross_direction": 1},
+ {"id": "3", "sex": "male", "cross_direction": 1},
+ {"id": "71", "sex": "male", "cross_direction": 0},
+ {"id": "72", "sex": "male", "cross_direction": 0},
+ {"id": "146", "sex": "female", "cross_direction": 1},
+ {"id": "147", "sex": "female", "cross_direction": 1},
+ {"id": "148", "sex": "female", "cross_direction": 1})),
("tests/r_qtl/test_files/test_covar_transposed.zip",
- ({"id": "1", "sex": "m", "cross_direction": "(BxS)x(BxS)"},
- {"id": "2", "sex": "m", "cross_direction": "(BxS)x(BxS)"},
- {"id": "3", "sex": "m", "cross_direction": "(BxS)x(BxS)"},
- {"id": "146", "sex": "f", "cross_direction": "(BxS)x(BxS)"},
- {"id": "147", "sex": "f", "cross_direction": "(BxS)x(BxS)"},
- {"id": "148", "sex": "f", "cross_direction": "(BxS)x(BxS)"})),
+ ({"id": "1", "sex": "male", "cross_direction": 1},
+ {"id": "2", "sex": "male", "cross_direction": 1},
+ {"id": "3", "sex": "male", "cross_direction": 1},
+ {"id": "146", "sex": "female", "cross_direction": 1},
+ {"id": "147", "sex": "female", "cross_direction": 1},
+ {"id": "148", "sex": "female", "cross_direction": 1})),
))
def test_parse_covar_files(filepath, expected):
"""Test parsing of 'covar' files from the R/qtl2 bundle.
@@ -33,4 +35,6 @@ def test_parse_covar_files(filepath, expected):
"""
with ZipFile(Path(filepath).absolute(), "r") as zfile:
cdata = rqtl2.control_data(zfile)
- assert tuple(rqtl2.file_data(zfile, "covar", cdata)) == expected
+ process_fns = rqtl2.make_process_data_covar(cdata)
+ assert tuple(
+ rqtl2.file_data(zfile, "covar", cdata, *process_fns)) == expected