aboutsummaryrefslogtreecommitdiff
path: root/r_qtl
diff options
context:
space:
mode:
Diffstat (limited to 'r_qtl')
-rw-r--r--r_qtl/r_qtl2.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py
index 13ac355..1755a05 100644
--- a/r_qtl/r_qtl2.py
+++ b/r_qtl/r_qtl2.py
@@ -24,16 +24,18 @@ def control_data(zfile: ZipFile) -> dict:
if num_files > 1:
raise InvalidFormat("Found more than one possible control file.")
- return (json.loads(zfile.read(files[0]))
+ return {
+ "na.strings": ["NA"],
+ "comment.char": "#",
+ "sep": ",",
+ **(json.loads(zfile.read(files[0]))
if files[0].endswith(".json")
else yaml.safe_load(zfile.read(files[0])))
+ }
def replace_na_strings(cdata, val):
"""Replace values indicated in `na.strings` with `None`."""
- nastrings = cdata.get("na.strings")
- if bool(nastrings):
- return (None if val in nastrings else val)
- return val
+ return (None if val in cdata.get("na.strings", ["NA"]) else val)
def with_non_transposed(zfile: ZipFile,
member_key: str,