Skip to content

Commit

Permalink
Add variant region condition for dups ending in UTR
Browse files Browse the repository at this point in the history
  • Loading branch information
b0d0nne11 committed Jan 4, 2024
1 parent 2781a4b commit a1dfa2d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/hgvs/utils/altseqbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,13 @@ def _get_variant_region(self):
:rtype str
"""
if (
self._var_c.posedit.pos.start.datum == Datum.CDS_END
self._var_c.posedit.edit.type in ["ins", "sub"]
and self._var_c.posedit.pos.start.datum == Datum.CDS_END
and self._var_c.posedit.pos.end.datum == Datum.CDS_END
):
result = self.T_UTR
elif (
self._var_c.posedit.edit.type == "dup"
and self._var_c.posedit.pos.end.datum == Datum.CDS_END
):
result = self.T_UTR
Expand Down
Binary file modified tests/data/cache-py3.hdp
Binary file not shown.
6 changes: 6 additions & 0 deletions tests/test_hgvs_variantmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ def test_map_of_c_out_of_reference_bound(self):
with pytest.raises(HGVSError, match="coordinate is out of bounds"):
self.vm.c_to_p(var_c)

def test_map_of_dup_three_prime_utr(self):
hgvs_c = "NM_153223.3:c.2959_*1dup"
var_c = self.hp.parse_hgvs_variant(hgvs_c)
var_p = self.vm.c_to_p(var_c)
self.assertEqual(str(var_p), "NP_694955.2:p.?")


if __name__ == "__main__":
unittest.main()
Expand Down
5 changes: 5 additions & 0 deletions tests/test_hgvs_variantmapper_cp_sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ def test_three_prime_utr(self):
hgvsp_expected = "MOCK:p.?"
self._run_conversion(hgvsc, hgvsp_expected)

def test_dup_three_prime_utr(self):
hgvsc = "NM_999999.1:c.12_*1dup"
hgvsp_expected = "MOCK:p.?"
self._run_conversion(hgvsc, hgvsp_expected)

def test_deletion_into_three_prime_utr_frameshift(self):
hgvsc = "NM_999999.1:c.27_*3del"
hgvsp_expected = "MOCK:p.(Lys9XaafsTer?)"
Expand Down

0 comments on commit a1dfa2d

Please sign in to comment.