diff options
author | Frederick Muriuki Muriithi | 2024-12-09 15:31:48 -0600 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-12-09 15:31:48 -0600 |
commit | 7904610f4f66da33e9ced1eb5f11365ec11d6472 (patch) | |
tree | 7a23ebbda73a2562a165a2cbfc57ced7a7ee8433 /r_qtl | |
parent | 70e626514fe205ca85a03adf60e4211e140ac7e4 (diff) | |
download | gn-uploader-7904610f4f66da33e9ced1eb5f11365ec11d6472.tar.gz |
Handle common typo likely to exist in control files.
Diffstat (limited to 'r_qtl')
-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)) |