diff options
-rw-r--r-- | r_qtl/r_qtl2.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py index c6307f5..dfa84ba 100644 --- a/r_qtl/r_qtl2.py +++ b/r_qtl/r_qtl2.py @@ -187,7 +187,7 @@ def control_data(control_src: Union[Path, ZipFile]) -> dict: r_qtl.exceptions.InvalidFormat """ def __cleanup__(cdata): - return { + _cdata = { **cdata, **dict((filetype, ([cdata[filetype]] if isinstance(cdata[filetype], str) @@ -195,6 +195,14 @@ def control_data(control_src: Union[Path, ZipFile]) -> dict: ) for filetype in (typ for typ in cdata.keys() if typ in FILE_TYPES)) } + if "na.string" in _cdata:# handle common error in file. + _cdata = { + **cdata, + "na.strings": list(set( + _cdata["na.string"] + _cdata["na.strings"])) + } + + return _cdata if isinstance(control_src, ZipFile): return __cleanup__(__control_data_from_zipfile__(control_src)) |