Skip to content

Commit

Permalink
Merge pull request #745 from davmlaw/issue_744_babelfish_vcf_contig_a…
Browse files Browse the repository at this point in the history
…ccessions

#744 - babelfish vcf conversion accept contig accessions as chrom names
  • Loading branch information
davmlaw authored Jun 25, 2024
2 parents 575fa97 + 5fe54d2 commit f30be1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hgvs/extras/babelfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def __init__(self, hdp, assembly_name):
)
self.ac_to_name_map = make_ac_name_map(assembly_name)
self.name_to_ac_map = make_name_ac_map(assembly_name)
# We need to accept accessions as chromosome names, so add them pointing at themselves
self.name_to_ac_map.update({ac: ac for ac in self.name_to_ac_map.values()})

def hgvs_to_vcf(self, var_g):
"""**EXPERIMENTAL**
Expand Down
5 changes: 5 additions & 0 deletions tests/test_hgvs_extras_babelfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,8 @@ def _v2h(*v):
hgvs_g = _v2h(*v)
hgvs_string = hgvs_g.format()
assert hgvs_string == expected_hgvs_string


def test_vcf_to_hgvs_contig_chrom(parser, babelfish38):
hgvs_g = babelfish38.vcf_to_g_hgvs("NC_000006.12", 49949409, "GAA", "G")
assert hgvs_g.format() == "NC_000006.12:g.49949413_49949414del"

0 comments on commit f30be1f

Please sign in to comment.