diff options
Diffstat (limited to 'r_qtl/r_qtl2.py')
-rw-r--r-- | r_qtl/r_qtl2.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py index a221f26..e019d99 100644 --- a/r_qtl/r_qtl2.py +++ b/r_qtl/r_qtl2.py @@ -50,17 +50,19 @@ def genotype_data(zfile: ZipFile, cdata: dict) -> Iterator[dict]: reader = csv.DictReader(filter(lambda line: not line.startswith("#"), io.TextIOWrapper(genofile)), delimiter=cdata.get("sep", ",")) - for row in reader: - yield { - key: thread_op( - value, - # replace genotype codes - lambda val: cdata["genotypes"].get(val, val), - # replace N/A strings - lambda val: (None if val in cdata["na.strings"] else val)) - for key,value - in row.items() - } + if not cdata.get("geno_transposed", False): + for row in reader: + yield { + key: thread_op( + value, + # replace genotype codes + lambda val: cdata["genotypes"].get(val, val), + # replace N/A strings + lambda val: ( + None if val in cdata["na.strings"] else val)) + for key,value + in row.items() + } def map_data(zfile: ZipFile, map_type: str, cdata: dict) -> dict: """Read gmap files to get the genome mapping data""" |