From aefa19252cf0dfe1cc02b2f87a4f66dc807f4f74 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 16 Feb 2024 16:45:32 +0300 Subject: Replace genotype codes with values in control file. --- r_qtl/r_qtl2.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'r_qtl/r_qtl2.py') 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) -- cgit v1.2.3