Skip to content

Commit

Permalink
#744 - babelfish vcf conversion accept contig accessions as chrom names
Browse files Browse the repository at this point in the history
  • Loading branch information
davmlaw committed Jun 22, 2024
1 parent 575fa97 commit c1dd96d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/hgvs/extras/babelfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ 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
accessions = list(self.name_to_ac_map.values())
self.name_to_ac_map.update({ac: ac for ac in accessions})


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 c1dd96d

Please sign in to comment.