diff options
author | Frederick Muriuki Muriithi | 2023-12-27 12:12:33 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-12-27 12:14:53 +0300 |
commit | c687f9460ca071c714cdc9cba62449b59b001de8 (patch) | |
tree | 48ad3343cbea9dddaa0e374a38cd11cb38c26fe5 /r_qtl | |
parent | 3294adc11ada56046ff748c08b97faf0eeed11b2 (diff) | |
download | gn-uploader-c687f9460ca071c714cdc9cba62449b59b001de8.tar.gz |
Tests: Test parsing of non-transposed geno files.
Check that the parsing of non-transposed geno files.
Leave in failing test for transposed geno files.
Diffstat (limited to 'r_qtl')
-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""" |