In [1]:
import hgvs
hgvs.__version__
Out[1]:
In [2]:
import hgvs.parser
hp = hgvs.parser.Parser()
var_c1 = hp.parse_hgvs_variant('NM_182763.2:c.688+403C>T')
var_c1, var_c1.posedit.pos.start
Out[2]:
In [3]:
import hgvs.dataproviders.uta
hdp = hgvs.dataproviders.uta.connect()
In [4]:
import hgvs.variantmapper
vm = hgvs.variantmapper.AssemblyMapper(
hdp, assembly_name='GRCh37', alt_aln_method='splign')
var_g = vm.c_to_g(var_c1)
var_g
Out[4]:
In [5]:
vm.relevant_transcripts(var_g)
Out[5]:
In [6]:
var_c2 = vm.g_to_c(var_g,'NM_001197320.1')
var_c2
Out[6]:
In [7]:
var_p1 = vm.c_to_p(var_c1)
var_p2 = vm.c_to_p(var_c2)
var_p1, var_p2
Out[7]:
In [8]:
print("""mapped {var_c1} ({var_p1})
to {var_c2} ({var_p2})
via {var_g}""".format(
var_c1=var_c1, var_p1=var_p1,
var_c2=var_c2, var_p2=var_p2,
var_g=var_g))
In [9]:
import hgvs.validator
import hgvs.exceptions
vr = hgvs.validator.Validator(hdp=hdp)
try:
vr.validate( hp.parse_hgvs_variant('NM_001197320.1:c.281C>T') )
vr.validate( hp.parse_hgvs_variant('NM_001197320.1:c.281A>T') )
except hgvs.exceptions.HGVSError as e:
print(e)