biocommons/hgvs

AssemblyMapper confusion

LeoWelter opened this issue · 1 comments

I'm trying to follow the examples but stumble upon something I don't understand.

import hgvs.dataproviders.uta
hdp = hgvs.dataproviders.uta.connect()

import hgvs.variantmapper
#vm = variantmapper = hgvs.variantmapper.VariantMapper(hdp)
am37 = easyvariantmapper = hgvs.variantmapper.AssemblyMapper(hdp, assembly_name='GRCh37')

gives me:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_1535/4195112627.py in <module>
      4 import hgvs.variantmapper
      5 #vm = variantmapper = hgvs.variantmapper.VariantMapper(hdp)
----> 6 am37 = easyvariantmapper = hgvs.variantmapper.AssemblyMapper(hdp, assembly_name='GRCh37')

AttributeError: module 'hgvs.variantmapper' has no attribute 'AssemblyMapper'

How should I map for example NC_000005.10:g.131741696A>G to any transcript on that position
I wanted to use am37.relevant_transcripts(var_g)

You have the wrong package, the correct path is hgvs.assemblymapper.AssemblyMapper

Fixing this, the code is:

import hgvs.dataproviders.uta
from hgvs.assemblymapper import AssemblyMapper

hdp = hgvs.dataproviders.uta.connect()
am37 = AssemblyMapper(hdp, assembly_name='GRCh37')
hp = hgvs.parser.Parser()

var_g = hp.parse_hgvs_variant("NC_000005.10:g.131741696A>G")
am37.relevant_transcripts(var_g)

Output:

Out[1]: ['NM_001346114.1', 'NM_001346113.1', 'NM_133372.2', 'NM_001008738.2']