Hello all,
I have a column of variants and want to convert them all to genomic co-ordinates. I'm using the following code
def c2g(hgvs_c):
var_c = hp.parse_hgvs_variant(hgvs_c)
g = am.c_to_g(var_c)
return g.posedit.pos.end.base
known['Variant1_pos'] = known.apply(lambda row: c2g(row.Variant1) if 'NM' in row.Variant1 else '', axis=1)
Error:
HGVSInvalidIntervalError: ('The given coordinate is outside the bounds of the reference sequence.', 'occurred at index 6')
As expected, some of the variants are not formatted well, maybe cause of human error or something. I want to ignore those and print all others in the column. Is there a way to do that? I really hate using loops. Please help!
Thank you,