aboutsummaryrefslogtreecommitdiff
path: root/r_qtl
diff options
context:
space:
mode:
Diffstat (limited to 'r_qtl')
-rw-r--r--r_qtl/r_qtl2.py72
1 files changed, 0 insertions, 72 deletions
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py
index 4dac24b..da7db22 100644
--- a/r_qtl/r_qtl2.py
+++ b/r_qtl/r_qtl2.py
@@ -134,78 +134,6 @@ def make_process_data_geno(cdata) -> tuple[
for items in zip(ids, vals[1:]))
return (__non_transposed__, __transposed__)
-def genotype_data(zfile: ZipFile, cdata: dict) -> Iterator[dict]:
- """Load the genotype file, making use of the control data."""
- def replace_genotype_codes(val):
- return cdata["genotypes"].get(val, val)
-
- def replace_na_strings(val):
- nastrings = cdata.get("na.strings")
- if bool(nastrings):
- return (None if val in nastrings else val)
- return val
-
- if not cdata.get("geno_transposed", False):
- for line in with_non_transposed(
- zfile,
- "geno",
- cdata,
- lambda row: {
- key: thread_op(value, replace_genotype_codes, replace_na_strings)
- for key,value in row.items()
- }):
- yield line
- return None
-
- def __merge__(key, samples, line):
- marker = line[0]
- return tuple(
- dict(zip(
- [key, marker],
- (thread_op(item, replace_genotype_codes, replace_na_strings)
- for item in items)))
- for items in zip(samples, line[1:]))
-
- for row in with_transposed(zfile, "geno", cdata, __merge__):
- yield row
-
-def map_data(zfile: ZipFile, map_type: str, cdata: dict) -> Iterator[dict]:
- """Read gmap files to get the genome mapping data"""
- assert map_type in ("genetic-map", "physical-map"), "Invalid map type"
- map_file_key = {
- "genetic-map": "gmap",
- "physical-map": "pmap"
- }[map_type]
- transposed_dict = {
- "genetic-map": "gmap_transposed",
- "physical-map": "pmap_transposed"
- }
- if not cdata.get(transposed_dict[map_type], False):
- for row in with_non_transposed(zfile, map_file_key, cdata):
- yield row
- return None
-
- def __merge__(key, samples, line):
- marker = line[0]
- return tuple(dict(zip([key, marker], items))
- for items in zip(samples, line[1:]))
-
- for row in with_transposed(zfile, map_file_key, cdata, __merge__):
- yield row
-
-def phenotype_data(zfile: ZipFile, cdata: dict) -> Iterator[dict]:
- """Load phenotype file data."""
- if not cdata.get("pheno_transposed", False):
- for row in with_non_transposed(zfile, "pheno", cdata, lambda val: val):
- yield row
- return
-
- def __merge__(id_key, ids, vals):
- return tuple(dict(zip([id_key, vals[0]], items))
- for items in zip(ids, vals[1:]))
- for row in with_transposed(zfile, "pheno", cdata, __merge__):
- yield row
-
def __default_process_value_transposed__(
id_key: str,
ids: tuple[str, ...],