diff options
author | Frederick Muriuki Muriithi | 2024-01-04 11:50:04 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-01-04 11:50:04 +0300 |
commit | 9eab14f7f6c40c401c29d11d69ac54303415ab87 (patch) | |
tree | 7f50a11edfec1c498f5a2b48b0d3f497c405c73f /tests | |
parent | 9963d0c3318caa931061d4e9b8c9f129f8860cce (diff) | |
download | gn-uploader-9eab14f7f6c40c401c29d11d69ac54303415ab87.tar.gz |
Process sex and cross information data in "covar" files.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/r_qtl/test_files/test_covar.zip | bin | 490 -> 562 bytes | |||
-rw-r--r-- | tests/r_qtl/test_files/test_covar_transposed.zip | bin | 541 -> 594 bytes | |||
-rw-r--r-- | tests/r_qtl/test_r_qtl2_covar.py | 30 |
3 files changed, 17 insertions, 13 deletions
diff --git a/tests/r_qtl/test_files/test_covar.zip b/tests/r_qtl/test_files/test_covar.zip Binary files differindex 6fbb5e9..61961a0 100644 --- a/tests/r_qtl/test_files/test_covar.zip +++ b/tests/r_qtl/test_files/test_covar.zip diff --git a/tests/r_qtl/test_files/test_covar_transposed.zip b/tests/r_qtl/test_files/test_covar_transposed.zip Binary files differindex 5e933cc..c0758a3 100644 --- a/tests/r_qtl/test_files/test_covar_transposed.zip +++ b/tests/r_qtl/test_files/test_covar_transposed.zip 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 |