Skip to content

Commit

Permalink
variantgrid_private#3500 - Biocommons HGVS handle c. outside coding s…
Browse files Browse the repository at this point in the history
…equence
  • Loading branch information
davmlaw committed Aug 21, 2023
1 parent e3c7dd3 commit 3f9090f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions genes/hgvs/biocommons_hgvs/hgvs_converter_biocommons.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from hgvs.parser import Parser
from hgvs.sequencevariant import SequenceVariant
from hgvs.validator import ExtrinsicValidator
from hgvs.variantmapper import VariantMapper

from genes.hgvs import HGVSVariant, HGVSException
from genes.hgvs.biocommons_hgvs.data_provider import DjangoTranscriptDataProvider
Expand Down Expand Up @@ -100,6 +101,8 @@ def __init__(self, genome_build: GenomeBuild):
replace_reference=True)
self.ev = ExtrinsicValidator(self.hdp)
self.norm_5p = Normalizer(self.hdp, shuffle_direction=5)
self.no_validate_normalizer = Normalizer(self.hdp, validate=False,
variantmapper=VariantMapper(self.hdp, prevalidation_level="NONE"))

@staticmethod
def _parser_hgvs(hgvs_string: str) -> SequenceVariant:
Expand Down Expand Up @@ -228,6 +231,9 @@ def _hgvs_to_g_hgvs(self, hgvs_string: str) -> Tuple[SequenceVariant, HgvsMatchR
provided_g_ref = reverse_complement(provided_ref)
calculated_g_ref = reverse_complement(calculated_ref)
matches_reference = HgvsMatchRefAllele(provided_ref=provided_g_ref, calculated_ref=calculated_g_ref)
elif "Variant is outside CDS bounds" in exception_str:
var_x = self.no_validate_normalizer.normalize(var_x)
ok = True
else:
for msg in ACCEPTABLE_VALIDATION_MESSAGES:
if msg in exception_str:
Expand Down

0 comments on commit 3f9090f

Please sign in to comment.