How to use the biothings.utils.dataload.value_convert_to_number function in biothings

To help you get started, we’ve selected a few biothings examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github biothings / myvariant.info / src / dataload / sources / dbnsfp / dbnsfp_parser.py View on Github external
"fin_ac": fields[170],
                "fin_af": fields[171],
                "nfe_ac": fields[172],
                "nfe_af": fields[173]
            },
            "clinvar": {
                "rs": fields[176],
                "clinsig": fields[177],
                "trait": fields[178],
                "golden_stars": fields[179]
            },
            "gtex": gtex
        }
    }

    one_snp_json = list_split(dict_sweep(unlist(value_convert_to_number(one_snp_json)), vals=["."]), ";")
    one_snp_json["dbnsfp"]["chrom"] = str(one_snp_json["dbnsfp"]["chrom"])
    return one_snp_json
github biothings / myvariant.info / src / hub / dataload / sources / dbnsfp / dbnsfp_parser.py View on Github external
"hgvs": [i for i in df["clinvar_hgvs"].split("|") if i != "."],
                "omim": [i for i in df["clinvar_OMIM_id"].split("|") if i != "."],
                "medgen": [i for i in df["clinvar_MedGen_id"].split("|") if i != "."],
                "orphanet": [i for i in df["clinvar_Orphanet_id"].split("|") if i != "."],
                "var_source": [i for i in df["clinvar_var_source"].split("|") if i != "."]

            },
            "hgvsc": list(set(df["HGVSc_ANNOVAR"].split(';') + df["HGVSc_snpEff"].split(';') + df["HGVSc_VEP"].split(';'))),
            "hgvsp": list(set(df["HGVSp_ANNOVAR"].split(';') + df["HGVSp_snpEff"].split(';') + df["HGVSp_VEP"].split(';'))),
            "gtex": list(gtex),
            "geuvadis_eqtl_target_gene": df["Geuvadis_eQTL_target_gene"]
        }
    }
    if include_gnomad:
        one_snp_json['dbnsfp'].update(gnomad)
    one_snp_json = list_split(dict_sweep(unlist(value_convert_to_number(one_snp_json)), vals=[".", '-', "NA", None], remove_invalid_list=True), ";")
    one_snp_json["dbnsfp"]["chrom"] = str(one_snp_json["dbnsfp"]["chrom"])
    return one_snp_json
github biothings / myvariant.info / src / dataload / contrib / dbnsfp / dbnsfp_parser.py View on Github external
"fin_ac": fields[122],
                "fin_af": fields[123],
                "nfe_ac": fields[124],
                "nfe_af": fields[125],
                "sas_ac": fields[126],
                "sas_af": fields[127]
            },
            "clinvar": {
                "rs": fields[128],
                "clinsig": fields[129],
                "trait": fields[130]
            }
        }
    }

    one_snp_json = list_split(dict_sweep(unlist(value_convert_to_number(one_snp_json)), vals=["."]), ";")
    one_snp_json["dbnsfp"]["chrom"] = str(one_snp_json["dbnsfp"]["chrom"])
    return one_snp_json
github biothings / myvariant.info / src / hub / dataload / sources / dbsnp / dbsnp_json_parser.py View on Github external
try:
                if doc["vartype"] != "snv":
                    ref = "T" + doc["ref"]
                    alt = "T" + doc["alt"]
                else:
                    ref = doc["ref"]
                    alt = doc["alt"]
                if doc["vartype"] in ["ins", "del", "delins"]:
                    doc[assembly]['start'], doc[assembly]['end'] = get_pos_start_end(doc["chrom"], pos - 1, ref, alt)
                else:
                    doc[assembly]['start'], doc[assembly]['end'] = get_pos_start_end(doc["chrom"], pos, ref, alt)
            except (ValueError, AssertionError):
                doc[assembly] = {}
        if hgvs:
            doc["_id"] = hgvs.replace('chr23', 'chrX').replace('chr24', 'chrY')
            yield dict_sweep(unlist(value_convert_to_number(doc, skipped_keys=['chrom', 'ref', 'alt', 'allele', 'deleted_sequence', 'inserted_sequence'])), vals=[[], {}, None])
github biothings / myvariant.info / src / hub / dataload / sources / geno2mp / geno2mp_parser.py View on Github external
ref = item.REF
    info = item.INFO
    hpo_count=item.INFO['HPO_CT']
    for alt in item.ALT:
        alt = str(alt)
        (HGVS, var_type) = get_hgvs_from_vcf(chrom, chromStart, ref, alt, mutant_type=True)
        if HGVS is None:
            return
        one_snp_json = {
            "_id": HGVS,
            "geno2mp": {
                "hpo_count": hpo_count,

            }
        }
        obj = (dict_sweep(unlist(value_convert_to_number(one_snp_json)), [None]))
        yield obj
github biothings / myvariant.info / src / hub / dataload / sources / gnomad / gnomad_parser_genomes.py View on Github external
for _start in key_start:
            one_snp_json['gnomad_genome'][_start.lower()] = {}
        # loop through each available key
        for _key in keys:
            if _key in info:
                # loop through each prefix
                for _start in key_start_new:
                    # "ac", "af" value is related to multi-allelic, need to deal with separately
                    if _key.startswith(_start):
                        if _start == 'nhomalt':
                            one_snp_json['gnomad_genome']['hom'][_key.replace('nhomalt', 'hom')] = info[_key][i]
                        elif _start in ['AC', 'AF', 'Hemi']:
                            one_snp_json['gnomad_genome'][_start.lower()][_key.lower()] = info[_key][i]
                        else:
                            one_snp_json['gnomad_genome'][_start.lower()][_key.lower()] = info[_key]
        obj = (dict_sweep(unlist(value_convert_to_number(one_snp_json, skipped_keys=['chrom'])), [None]))
        yield obj
github biothings / myvariant.info / src / dataload / contrib / exac / exac_parser.py View on Github external
"hom_sas": info['Hom_SAS']
                },
                "inbreedingcoeff": inbreedingcoeff,
                "mq": {
                    "mq": info['MQ'],
                    "mq0": info['MQ0'],
                    "mqranksum": mqranksum
                },
                "ncc": info['NCC'],
                "qd": qd,
                "readposranksum": readposranksum,
                "vqslod": info['VQSLOD'],
                "culprit": info['culprit']
            }
        }
        obj = (dict_sweep(unlist(value_convert_to_number(one_snp_json)), [None]))
        yield obj
github biothings / myvariant.info / src / hub / dataload / sources / gnomad / gnomad_parser_exomes.py View on Github external
for _start in key_start:
            one_snp_json['gnomad_exome'][_start.lower()] = {}
        # loop through each available key
        for _key in keys:
            if _key in info:
                # loop through each prefix
                for _start in key_start_new:
                    # "ac", "af" value is related to multi-allelic, need to deal with separately
                    if _key.startswith(_start):
                        if _start == 'nhomalt':
                            one_snp_json['gnomad_exome']['hom'][_key.replace('nhomalt', 'hom')] = info[_key][i]
                        elif _start in ['AC', 'AF', 'Hemi']:
                            one_snp_json['gnomad_exome'][_start.lower()][_key.lower()] = info[_key][i]
                        else:
                            one_snp_json['gnomad_exome'][_start.lower()][_key.lower()] = info[_key]
        obj = (dict_sweep(unlist(value_convert_to_number(one_snp_json, skipped_keys=['chrom'])), [None]))
        yield obj
github biothings / myvariant.info / src / hub / dataload / sources / exac / exac_parser.py View on Github external
"hom_sas": info['Hom_SAS']
                },
                "inbreedingcoeff": inbreedingcoeff,
                "mq": {
                    "mq": info['MQ'],
                    "mq0": info['MQ0'],
                    "mqranksum": mqranksum
                },
                "ncc": info['NCC'],
                "qd": qd,
                "readposranksum": readposranksum,
                "vqslod": info['VQSLOD'],
                "culprit": info['culprit']
            }
        }
        obj = (dict_sweep(unlist(value_convert_to_number(one_snp_json)), [None]))
        yield obj