Skip to content

Commit

Permalink
Update boundary conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
b0d0nne11 committed Dec 19, 2023
1 parent 79998d8 commit 43b08ec
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 32 deletions.
5 changes: 4 additions & 1 deletion src/hgvs/utils/altseqbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified tests/data/cache-py3.hdp
Binary file not shown.
27 changes: 10 additions & 17 deletions tests/test_hgvs_assemblymapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)"

Expand All @@ -217,34 +209,35 @@ 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)

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)
Expand Down
22 changes: 9 additions & 13 deletions tests/test_hgvs_variantmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_hgvs_variantmapper_cp_sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 43b08ec

Please sign in to comment.