aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-01-04 03:09:12 +0300
committerFrederick Muriuki Muriithi2024-01-04 03:09:12 +0300
commit66779aba032b6dd3f44c990601667f1e9edb2e14 (patch)
tree52c3b9451a26fc624dfbb2e2a12ba1cd6bfa4077
parentdee8cba1412374fff63f296283bbe35aff7532f0 (diff)
downloadgn-uploader-66779aba032b6dd3f44c990601667f1e9edb2e14.tar.gz
Parse multiple files with same file key.
-rw-r--r--r_qtl/r_qtl2.py9
-rw-r--r--tests/r_qtl/test_files/test_geno_multiple.zipbin0 -> 933 bytes
2 files changed, 9 insertions, 0 deletions
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py
index da7db22..26e8c76 100644
--- a/r_qtl/r_qtl2.py
+++ b/r_qtl/r_qtl2.py
@@ -150,6 +150,15 @@ def file_data(zfile: ZipFile,
[str, tuple[str, ...], tuple[str, ...]],
tuple[dict, ...]] = __default_process_value_transposed__) -> Iterator[dict]:
"""Load data from files in R/qtl2 zip bundle."""
+ if isinstance(cdata[member_key], list):
+ for row in (line for lines in
+ (file_data(
+ zfile, member_key, {**cdata, member_key: innerfile},
+ process_value, process_transposed_value)
+ for innerfile in cdata[member_key])
+ for line in lines):
+ yield row
+ return
if not cdata.get(f"{member_key}_transposed", False):
for row in with_non_transposed(zfile, member_key, cdata, process_value):
yield row
diff --git a/tests/r_qtl/test_files/test_geno_multiple.zip b/tests/r_qtl/test_files/test_geno_multiple.zip
new file mode 100644
index 0000000..7782c88
--- /dev/null
+++ b/tests/r_qtl/test_files/test_geno_multiple.zip
Binary files differ