aboutsummaryrefslogtreecommitdiff
path: root/r_qtl
diff options
context:
space:
mode:
Diffstat (limited to 'r_qtl')
-rw-r--r--r_qtl/r_qtl2.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py
index 0241458..93ce56c 100644
--- a/r_qtl/r_qtl2.py
+++ b/r_qtl/r_qtl2.py
@@ -2,6 +2,7 @@
import io
import csv
import json
+from pathlib import Path
from zipfile import ZipFile
from functools import reduce, partial
from typing import Iterator, Iterable, Callable, Optional
@@ -292,3 +293,12 @@ def genotype_data(zfile: ZipFile):
"""Convenience function to genotype data from R/qtl2 bundle."""
cdata = control_data(zfile)
return file_data(zfile, "geno", cdata, *make_process_data_geno(cdata))
+
+def raw_file_data(zipfilepath: Union[str, Path],
+ memberfilename: str) -> Iterator[str]:
+ """Read the raw text from a file in the R/qtl2 bundle."""
+ with (ZipFile(str(zipfilepath), "r") as zfile,
+ zfile.open(memberfilename) as innerfile):
+ wrappedfile = io.TextIOWrapper(innerfile)
+ for line in wrappedfile:
+ yield line.strip()