From 9bbed805db2e2cdadf553fa5b6751bac5f3b97d2 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Mon, 21 Aug 2023 16:26:43 +0930 Subject: [PATCH] variantgrid_private#3497 - Convert c. HGVS to n. if they are non-coding transcripts --- genes/hgvs/biocommons_hgvs/hgvs_converter_biocommons.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/genes/hgvs/biocommons_hgvs/hgvs_converter_biocommons.py b/genes/hgvs/biocommons_hgvs/hgvs_converter_biocommons.py index d57064dbd..ffc471b07 100644 --- a/genes/hgvs/biocommons_hgvs/hgvs_converter_biocommons.py +++ b/genes/hgvs/biocommons_hgvs/hgvs_converter_biocommons.py @@ -20,7 +20,7 @@ from genes.hgvs.biocommons_hgvs.data_provider import DjangoTranscriptDataProvider from genes.hgvs.hgvs_converter import HGVSConverter, HgvsMatchRefAllele from genes.models import TranscriptVersion -from genes.transcripts_utils import looks_like_transcript +from genes.transcripts_utils import looks_like_transcript, get_refseq_type from snpdb.models import GenomeBuild, VariantCoordinate, Contig @@ -205,6 +205,11 @@ def _hgvs_to_g_hgvs(self, hgvs_string: str) -> Tuple[SequenceVariant, HgvsMatchR } var_x = self._parser_hgvs(hgvs_string) + # We are occasionally passed c. HGVS for non-coding transcripts - convert them to n. + if var_x.type == 'c': + transcript_accession = self.get_transcript_accession(hgvs_string) + if get_refseq_type(transcript_accession) == 'RNA': + var_x.type = 'n' matches_reference = None try: