diff options
author | Frederick Muriuki Muriithi | 2024-02-16 16:45:32 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-02-16 16:48:40 +0300 |
commit | aefa19252cf0dfe1cc02b2f87a4f66dc807f4f74 (patch) | |
tree | 250de255bb731c6dd6e1a8301be9c3415f2fe24a | |
parent | 7a3e0fdac498a9d22c6ea8789b42c5c882120e00 (diff) | |
download | gn-uploader-aefa19252cf0dfe1cc02b2f87a4f66dc807f4f74.tar.gz |
Replace genotype codes with values in control file.
-rw-r--r-- | r_qtl/r_qtl2.py | 7 |
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) |