diff --git a/src/hgvs/utils/altseqbuilder.py b/src/hgvs/utils/altseqbuilder.py index 46c388df..679c7d5d 100644 --- a/src/hgvs/utils/altseqbuilder.py +++ b/src/hgvs/utils/altseqbuilder.py @@ -200,9 +200,12 @@ def _get_variant_region(self): elif self._var_c.posedit.edit.type == "ins" and self._var_c.posedit.pos.start.offset == 0 and self._var_c.posedit.pos.end.offset == 1: # ins at exon-intron boundary result = self.EXON - elif self._var_c.posedit.edit.type == "dup" and self._var_c.posedit.pos.start.offset <= -1 and self._var_c.posedit.pos.end.offset >= -1: + elif self._var_c.posedit.edit.type == "dup" and self._var_c.posedit.pos.end.offset == -1: # dup at intron-exon boundary result = self.EXON + elif self._var_c.posedit.edit.type == "dup" and self._var_c.posedit.pos.start.offset == 1: + # dup at exon-intron boundary + result = self.EXON elif self._var_c.posedit.pos.start.offset != 0 or self._var_c.posedit.pos.end.offset != 0: # leave out anything else intronic for now result = self.INTRON diff --git a/tests/data/cache-py3.hdp b/tests/data/cache-py3.hdp index 28fda92f..e9b29e46 100644 Binary files a/tests/data/cache-py3.hdp and b/tests/data/cache-py3.hdp differ diff --git a/tests/test_hgvs_assemblymapper.py b/tests/test_hgvs_assemblymapper.py index 25b7e413..55bb24dd 100644 --- a/tests/test_hgvs_assemblymapper.py +++ b/tests/test_hgvs_assemblymapper.py @@ -201,14 +201,6 @@ def test_c_to_p_with_stop_gain(self): self.assertEqual(str(var_p), hgvs_p) def test_map_of_dup_intron_exon_boundary(self): - hgvs_c = "NM_004380.2:c.3251-1dup" - hgvs_p = "NP_004371.2:p.(Ile1084SerfsTer3)" - - var_c = self.hp.parse_hgvs_variant(hgvs_c) - var_p = self.am.c_to_p(var_c) - - self.assertEqual(str(var_p), hgvs_p) - hgvs_c = "NM_024529.4:c.132-2_132-1dup" hgvs_p = "NP_078805.3:p.(Thr45GlyfsTer65)" @@ -217,16 +209,17 @@ def test_map_of_dup_intron_exon_boundary(self): self.assertEqual(str(var_p), hgvs_p) - hgvs_c = "NM_004985.4:c.112-1_113dup" - hgvs_p = "NP_004976.2:p.(Glu37dup)" + hgvs_c = "NM_004985.4:c.112-8_112-1dup" + hgvs_p = "NP_004976.2:p.(Asp38LeufsTer10)" var_c = self.hp.parse_hgvs_variant(hgvs_c) var_p = self.am.c_to_p(var_c) self.assertEqual(str(var_p), hgvs_p) - hgvs_c = "NM_004380.2:c.3251dup" - hgvs_p = "NP_004371.2:p.(Phe1085LeufsTer2)" + def test_map_of_dup_intron_exon_boundary_rc(self): + hgvs_c = "NM_004380.2:c.3251-1dup" + hgvs_p = "NP_004371.2:p.(Ile1084SerfsTer3)" var_c = self.hp.parse_hgvs_variant(hgvs_c) var_p = self.am.c_to_p(var_c) @@ -234,17 +227,17 @@ def test_map_of_dup_intron_exon_boundary(self): self.assertEqual(str(var_p), hgvs_p) def test_map_of_dup_exon_intron_boundary(self): - hgvs_c = "NM_021140.3:c.619dup" - hgvs_p = "NP_066963.2:p.(Ile207AsnfsTer10)" + hgvs_c = "NM_024529.4:c.131+1_131+3dup" + hgvs_p = "NP_078805.3:p.(Gly44_Thr45insVal)" var_c = self.hp.parse_hgvs_variant(hgvs_c) var_p = self.am.c_to_p(var_c) self.assertEqual(str(var_p), hgvs_p) - def test_map_of_dup_intron_exon_boundary_rc(self): - hgvs_c = "NM_004985.4:c.112-1_112dup" - hgvs_p = "NP_004976.2:p.(Asp38GlyfsTer8)" + def test_map_of_dup_exon_intron_boundary_rc(self): + hgvs_c = "NM_004985.4:c.111+1_111+4dup" + hgvs_p = "NP_004976.2:p.(Asp38GlyfsTer11)" var_c = self.hp.parse_hgvs_variant(hgvs_c) var_p = self.am.c_to_p(var_c) diff --git a/tests/test_hgvs_variantmapper.py b/tests/test_hgvs_variantmapper.py index 588629ab..a28fdfc5 100644 --- a/tests/test_hgvs_variantmapper.py +++ b/tests/test_hgvs_variantmapper.py @@ -131,34 +131,30 @@ def test_map_of_ins_exon_intron_boundary(self): self.assertEqual(str(var_p), "NP_004371.2:p.(Phe1085LeufsTer2)") def test_map_of_dup_intron_exon_boundary(self): - hgvs_c = "NM_004380.2:c.3251-1dup" + hgvs_c = "NM_024529.4:c.132-2_132-1dup" var_c = self.hp.parse_hgvs_variant(hgvs_c) with self.assertRaises(HGVSError): var_p = self.vm.c_to_p(var_c) - hgvs_c = "NM_024529.4:c.132-2_132-1dup" + hgvs_c = "NM_004985.4:c.112-8_112-1dup" var_c = self.hp.parse_hgvs_variant(hgvs_c) with self.assertRaises(HGVSError): var_p = self.vm.c_to_p(var_c) - hgvs_c = "NM_004985.4:c.112-1_113dup" + def test_map_of_dup_intron_exon_boundary_rc(self): + hgvs_c = "NM_004380.2:c.3251-1dup" var_c = self.hp.parse_hgvs_variant(hgvs_c) with self.assertRaises(HGVSError): var_p = self.vm.c_to_p(var_c) - hgvs_c = "NM_004380.2:c.3251dup" - var_c = self.hp.parse_hgvs_variant(hgvs_c) - var_p = self.vm.c_to_p(var_c) - self.assertEqual(str(var_p), "NP_004371.2:p.(Phe1085LeufsTer2)") - def test_map_of_dup_exon_intron_boundary(self): - hgvs_c = "NM_021140.3:c.619dup" + hgvs_c = "NM_024529.4:c.131+1_131+3dup" var_c = self.hp.parse_hgvs_variant(hgvs_c) - var_p = self.vm.c_to_p(var_c) - self.assertEqual(str(var_p), "NP_066963.2:p.(Ile207AsnfsTer10)") + with self.assertRaises(HGVSError): + var_p = self.vm.c_to_p(var_c) - def test_map_of_dup_intron_exon_boundary_rc(self): - hgvs_c = "NM_004985.4:c.112-1_112dup" + def test_map_of_dup_exon_intron_boundary_rc(self): + hgvs_c = "NM_004985.4:c.111+1_111+4dup" var_c = self.hp.parse_hgvs_variant(hgvs_c) with self.assertRaises(HGVSError): var_p = self.vm.c_to_p(var_c) diff --git a/tests/test_hgvs_variantmapper_cp_sanity.py b/tests/test_hgvs_variantmapper_cp_sanity.py index 59837650..90e9a289 100644 --- a/tests/test_hgvs_variantmapper_cp_sanity.py +++ b/tests/test_hgvs_variantmapper_cp_sanity.py @@ -174,7 +174,8 @@ def test_dup_intron_exon_boundary(self): def test_dup_exon_intron_boundary(self): hgvsc = "NM_999999.1:c.39+1dup" hgvsp_expected = "MOCK:p.?" - self._run_conversion(hgvsc, hgvsp_expected) + with self.assertRaises(HGVSError): + self._run_conversion(hgvsc, hgvsp_expected) def test_five_prime_utr(self): hgvsc = "NM_999999.1:c.-2A>G"