aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/r_qtl/test_files/test_phenocovar.zipbin0 -> 516 bytes
-rw-r--r--tests/r_qtl/test_files/test_phenocovar_transposed.zipbin0 -> 567 bytes
-rw-r--r--tests/r_qtl/test_r_qtl2_pheno.py26
3 files changed, 26 insertions, 0 deletions
diff --git a/tests/r_qtl/test_files/test_phenocovar.zip b/tests/r_qtl/test_files/test_phenocovar.zip
new file mode 100644
index 0000000..7b8f079
--- /dev/null
+++ b/tests/r_qtl/test_files/test_phenocovar.zip
Binary files differ
diff --git a/tests/r_qtl/test_files/test_phenocovar_transposed.zip b/tests/r_qtl/test_files/test_phenocovar_transposed.zip
new file mode 100644
index 0000000..e3f9185
--- /dev/null
+++ b/tests/r_qtl/test_files/test_phenocovar_transposed.zip
Binary files differ
diff --git a/tests/r_qtl/test_r_qtl2_pheno.py b/tests/r_qtl/test_r_qtl2_pheno.py
index 46be469..66850a0 100644
--- a/tests/r_qtl/test_r_qtl2_pheno.py
+++ b/tests/r_qtl/test_r_qtl2_pheno.py
@@ -31,3 +31,29 @@ def test_parse_pheno_files(filepath, expected):
with ZipFile(Path(filepath).absolute(), "r") as zfile:
cdata = rqtl2.control_data(zfile)
assert tuple(rqtl2.file_data(zfile, "pheno", cdata)) == expected
+
+@pytest.mark.unit_test
+@pytest.mark.parametrize(
+ "filepath,expected",
+ (("tests/r_qtl/test_files/test_phenocovar.zip",
+ ({"pheno": "T0", "time (hrs)": "0"},
+ {"pheno": "T2", "time (hrs)": "0.0333333333333333"},
+ {"pheno": "T4", "time (hrs)": "0.0666666666666667"},
+ {"pheno": "T6", "time (hrs)": "0.1"},
+ {"pheno": "T8", "time (hrs)": "0.133333333333333"})),
+ ("tests/r_qtl/test_files/test_phenocovar_transposed.zip",
+ ({"pheno": "T0", "time (hrs)": "0"},
+ {"pheno": "T2", "time (hrs)": "0.0333333333333333"},
+ {"pheno": "T4", "time (hrs)": "0.0666666666666667"},
+ {"pheno": "T6", "time (hrs)": "0.1"},
+ {"pheno": "T8", "time (hrs)": "0.133333333333333"}))))
+def test_parse_phenocovar_files(filepath, expected):
+ """Test parsing of 'phenocovar' files from the R/qtl2 bundle.
+
+ GIVEN: path to a R/qtl2 bundle
+ WHEN: the 'phenocovar' file is parsed
+ THEN: verify the parsed data is as expected
+ """
+ with ZipFile(Path(filepath).absolute(), "r") as zfile:
+ cdata = rqtl2.control_data(zfile)
+ assert tuple(rqtl2.file_data(zfile, "phenocovar", cdata)) == expected