From 66779aba032b6dd3f44c990601667f1e9edb2e14 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 4 Jan 2024 03:09:12 +0300 Subject: Parse multiple files with same file key. --- r_qtl/r_qtl2.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'r_qtl') 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 -- cgit v1.2.3