Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception in g_to_c mapping #765

Merged
merged 2 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/hgvs/variantmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ def g_to_c(self, var_g, tx_ac, alt_aln_method=hgvs.global_config.mapping.alt_aln
edit_c.type == "ins"
and pos_c.start.offset == 0
and pos_c.end.offset == 0
and pos_c.start.datum == pos_c.end.datum
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!

and pos_c.end - pos_c.start > 1
):
pos_c.start.base += 1
Expand Down
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ def parser():
return hgvs.easy.parser


@pytest.fixture(scope="session")
def vm():
return hgvs.easy.vm


@pytest.fixture(scope="session")
def am37():
return hgvs.easy.am37
Expand Down
Binary file modified tests/data/cache-py3.hdp
Binary file not shown.
10 changes: 10 additions & 0 deletions tests/issues/test_764.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def test_vm_g_to_c(parser, vm):
var_g = parser.parse("NC_000007.13:g.106545832_106545833insAG")
var_c = vm.g_to_c(var_g, "NM_002649.2")
assert str(var_c) == "NM_002649.2:c.3309_*1insAG"


def test_am37_g_to_c(parser, am37):
var_g = parser.parse("NC_000007.13:g.106545832_106545833insAG")
var_c = am37.g_to_c(var_g, "NM_002649.2")
assert str(var_c) == "NM_002649.2:c.3309_*1insAG"