aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--r_qtl/r_qtl2.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py
index fc6feb5..9da4081 100644
--- a/r_qtl/r_qtl2.py
+++ b/r_qtl/r_qtl2.py
@@ -181,13 +181,24 @@ def control_data(control_src: Union[Path, ZipFile]) -> dict:
------
r_qtl.exceptions.InvalidFormat
"""
+ def __cleanup__(cdata):
+ return {
+ **cdata,
+ **dict((filetype,
+ ([cdata[filetype]] if isinstance(cdata[filetype], str)
+ else cdata[filetype])
+ ) for filetype in
+ (typ for typ in cdata.keys() if typ in FILE_TYPES))
+ }
+
if isinstance(control_src, ZipFile):
- return __control_data_from_zipfile__(control_src)
+ return __cleanup__(__control_data_from_zipfile__(control_src))
if isinstance(control_src, Path):
if is_zipfile(control_src):
- return __control_data_from_zipfile__(ZipFile(control_src))
+ return __cleanup__(
+ __control_data_from_zipfile__(ZipFile(control_src)))
if control_src.is_dir():
- return __control_data_from_dirpath__(control_src)
+ return __cleanup__(__control_data_from_dirpath__(control_src))
raise InvalidFormat(
"Expects either a zipfile.ZipFile object or a pathlib.Path object "
"pointing to a directory containing the R/qtl2 bundle.")