Skip to content

Commit

Permalink
HGVS issue counsyl#61 - Reference HGVS without reference base leads t…
Browse files Browse the repository at this point in the history
…o wrong coordinates and reference allele as it treats last digit as ref digit multiplying N that many times
  • Loading branch information
davmlaw committed Dec 9, 2021
1 parent a0a8edd commit 12924f0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyhgvs/models/hgvs_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class HGVSRegex(object):
# cDNA allele syntax
CDNA_ALLELE = [
# No change
CDNA_START + EQUAL,
CDNA_START + DNA_REF + EQUAL,

# Substitution
Expand Down Expand Up @@ -189,6 +190,7 @@ class HGVSRegex(object):
# Genomic allele syntax
GENOMIC_ALLELE = [
# No change
COORD_START + EQUAL,
COORD_START + DNA_REF + EQUAL,

# Substitution
Expand Down
24 changes: 24 additions & 0 deletions pyhgvs/tests/test_hgvs_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,18 @@ def test_invalid_coordinates():
'mutation_type': '=',
}),

# cDNA no change, no provided base
('BRCA1:c.101=', True,
{
'gene': 'BRCA1',
'kind': 'c',
'cdna_start': CDNACoord(101),
'cdna_end': CDNACoord(101),
'ref_allele': '',
'alt_allele': '',
'mutation_type': '=',
}),

# cDNA 1bp mutations.
('BRCA1:c.101A>C', True,
{
Expand Down Expand Up @@ -542,6 +554,18 @@ def test_invalid_coordinates():
'mutation_type': '=',
}),

# Genomic no change + no ref base
('BRCA1:g.101=', True,
{
'gene': 'BRCA1',
'kind': 'g',
'start': 101,
'end': 101,
'ref_allele': '',
'alt_allele': '',
'mutation_type': '=',
}),

# Genomic 1bp mutations.
('BRCA1:g.101A>C', True,
{
Expand Down

0 comments on commit 12924f0

Please sign in to comment.