aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-02-16 16:45:32 +0300
committerFrederick Muriuki Muriithi2024-02-16 16:48:40 +0300
commitaefa19252cf0dfe1cc02b2f87a4f66dc807f4f74 (patch)
tree250de255bb731c6dd6e1a8301be9c3415f2fe24a
parent7a3e0fdac498a9d22c6ea8789b42c5c882120e00 (diff)
downloadgn-uploader-aefa19252cf0dfe1cc02b2f87a4f66dc807f4f74.tar.gz
Replace genotype codes with values in control file.
-rw-r--r--r_qtl/r_qtl2.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/r_qtl/r_qtl2.py b/r_qtl/r_qtl2.py
index 4f0ab2a..96776b7 100644
--- a/r_qtl/r_qtl2.py
+++ b/r_qtl/r_qtl2.py
@@ -146,7 +146,8 @@ def make_process_data_geno(cdata) -> tuple[
Callable[[str, tuple[str, ...], tuple[str, ...]],
tuple[dict, ...]]]:
"""Build functions to process genotype data."""
- def replace_genotype_codes(val):
+ def replace_genotype_codes(val):#pylint: disable=[redefined-outer-name]
+ # The rewrite will probably make this obsolete.
return cdata["genotypes"].get(val, val)
def __non_transposed__(row: dict) -> dict:
@@ -313,3 +314,7 @@ def missing_value_codes_to_none(value: str,
If 'value' is a missing value code, return `None`, otherwise return 'value'.
"""
return value if value not in nastrings else None
+
+def replace_genotype_codes(value: str, genocodes: dict):
+ """Convert genotype codes into values specified in control file."""
+ return genocodes.get(value, value)