aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--r_qtl/r_qtl2.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py
index 94fa842..26d6dd4 100644
--- a/r_qtl/r_qtl2.py
+++ b/r_qtl/r_qtl2.py
@@ -62,10 +62,12 @@ def genotype_data(zfile: ZipFile, cdata: dict) -> Iterator[dict]:
in row.items()
}
-def genetic_map_data(zfile: ZipFile, cdata: dict) -> dict:
+def map_data(zfile: ZipFile, map_type: str, cdata: dict) -> dict:
"""Read gmap files to get the genome mapping data"""
+ assert map_type in ("genetic-map", "physical-map"), "Invalid map type"
+ map_key = {"genetic-map": "gmap", "physical-map": "pmap"}[map_type]
if not cdata.get("geno_transposed", False):
- with zfile.open(cdata["gmap"]) as gmapfile:
+ with zfile.open(cdata[map_key]) as gmapfile:
reader = csv.DictReader(
filter(lambda line: not line.startswith("#"),
io.TextIOWrapper(gmapfile)),