def _create_cdna_variant(self): start = hgvs.location.SimplePosition(118898437) end = hgvs.location.SimplePosition(118898437) iv = hgvs.location.Interval(start=start, end=end) edit = hgvs.edit.NARefAlt(ref="C", alt="T") posedit = hgvs.posedit.PosEdit(pos=iv, edit=edit) genomic_variant = hgvs.sequencevariant.SequenceVariant( ac="NC_000011.9", type="g", posedit=posedit, ) variantmapper = hgvs.variantmapper.VariantMapper(self.hdp) return variantmapper.g_to_c(genomic_variant, "NM_001164277.1")
def getHgvsInfo(pos, var_g_p, txInfoList, chrAc, hdpConnexion): txExonsList = hdpConnexion.get_tx_exons(txInfoList[3], chrAc, 'splign') variantmapper = hgvs.variantmapper.EasyVariantMapper(hdpConnexion, primary_assembly='GRCh37') minDist = None for exonList in txExonsList: dist = min(abs(pos - exonList[8]), abs(pos - exonList[9])) if minDist == None: # initialisation minDist = dist exonNum = int(exonList[5]) + 1 else: if dist < minDist: minDist = dist exonNum = int(exonList[5]) + 1 var_c_p = variantmapper.g_to_c(var_g_p, txInfoList[3]) return var_c_p, exonNum, minDist
replace_reference=True) for var in xrange(len(START)): if variants_table['variant_type'][var] == "snv": # create HGVS_g hgvs_g = assembly + ":" + "g" + "." + str( START[var]) + REF[var] + ">" + ALT[var] print("Converting: " + str(hgvs_g)) #hp = hgvs.parser.Parser() var_g = hp.parse_hgvs_variant(hgvs_g) transcripts = variantmapper.relevant_transcripts(var_g) var_c = variantmapper.g_to_c(var_g, 'NM_000546.5') var_p = variantmapper.c_to_p(var_c) # create final table final_table.loc[var].Chr = "17" final_table.loc[var].Start = START[var] final_table.loc[var].End = END[var] final_table.loc[var].Ref = REF[var] final_table.loc[var].Alt = ALT[var] final_table.loc[var].HGVS_g = var_g final_table.loc[var].HGVS_c = var_c final_table.loc[var].HGVS_p = var_p else: # create HGVS_g variant_type = str(variants_table['variant_type'][var])