Skip to content

Commit ac552ec

Browse files
author
Peter J. Freeman
authored
Merge pull request #320 from openvar/update_to_vvta
Add tests for and get p. variant descriptions working again and now a…
2 parents 1f77598 + 1dbb952 commit ac552ec

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

VariantValidator/modules/format_converters.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ def allele_parser(variant, validation, validator):
667667
if refseqtranscript_reference != 'none':
668668
variant.quibble = refseqtranscript_reference + ':' + variation
669669
if caution == '':
670-
caution = lrg_reference + ':' + variation + ' automapped to equivalent RefSeq record' + \
670+
caution = lrg_reference + ':' + variation + ' automapped to equivalent RefSeq record ' + \
671671
refseqtranscript_reference + ':' + variation
672672
else:
673673
caution = caution + ': ' + lrg_reference + ':' + variation + ' automapped to equivalent RefSeq ' \
@@ -729,17 +729,29 @@ def lrg_to_refseq(variant, validator):
729729
if refseqtrans_reference != 'none':
730730
variant.hgvs_formatted.ac = refseqtrans_reference
731731
variant.set_quibble(str(variant.hgvs_formatted))
732-
caution += lrg_reference + ':' + variation + ' automapped to equivalent RefSeq record' \
732+
caution += lrg_reference + ':' + variation + ' automapped to equivalent RefSeq record ' \
733733
'' + refseqtrans_reference + ':' + variation
734734
variant.warnings.append(caution)
735735
logger.info(caution)
736+
737+
elif re.match(r'^LRG_\d+p\d+:', variant.quibble):
738+
lrg_reference, variation = variant.quibble.split(':')
739+
refseqprot_reference = validator.db.get_refseq_protein_id_from_lrg_protein_id(lrg_reference)
740+
if refseqprot_reference != 'none':
741+
variant.hgvs_formatted.ac = refseqprot_reference
742+
variant.set_quibble(str(variant.hgvs_formatted))
743+
caution += lrg_reference + ':' + variation + ' automapped to equivalent RefSeq record ' \
744+
'' + refseqprot_reference + ':' + variation
745+
variant.warnings.append(caution)
746+
logger.info(caution)
747+
736748
elif re.match(r'^LRG_\d+:', variant.quibble):
737749
lrg_reference, variation = variant.quibble.split(':')
738750
refseqgene_reference = validator.db.get_refseq_id_from_lrg_id(lrg_reference)
739751
if refseqgene_reference != 'none':
740752
variant.hgvs_formatted.ac = refseqgene_reference
741753
variant.set_quibble(str(variant.hgvs_formatted))
742-
caution += lrg_reference + ':' + variation + ' automapped to equivalent RefSeq record' \
754+
caution += lrg_reference + ':' + variation + ' automapped to equivalent RefSeq record ' \
743755
'' + refseqgene_reference + ':' + variation
744756
variant.warnings.append(caution)
745757
logger.info(caution)

tests/test_inputs.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30459,7 +30459,6 @@ def test_issue_281(self):
3045930459
assert 'NP_003127.1:p.(V27delinsSSS*)' in \
3046030460
results['NM_003136.3:c.-33_78dup']['hgvs_predicted_protein_consequence']['slr']
3046130461

30462-
3046330462
def test_issue_add_protein_variant_tlc_a(self):
3046430463
variant = 'NP_000079.2:p.(Gly197Cys)'
3046530464
results = self.vv.validate(variant, 'GRCh37', 'all').format_as_dict(test=True)
@@ -30478,6 +30477,24 @@ def test_issue_add_protein_variant_slc_a(self):
3047830477
assert 'NP_000079.2:p.(G197C)' in \
3047930478
results['validation_warning_1']['hgvs_predicted_protein_consequence']['slr']
3048030479

30480+
def test_issue_add_protein_variant_tlc_b(self):
30481+
variant = 'LRG_1p1:p.(Gly197Cys)'
30482+
results = self.vv.validate(variant, 'GRCh37', 'all').format_as_dict(test=True)
30483+
print(results)
30484+
assert 'NP_000079.2:p.(Gly197Cys)' in \
30485+
results['validation_warning_1']['hgvs_predicted_protein_consequence']['tlr']
30486+
assert 'NP_000079.2:p.(G197C)' in \
30487+
results['validation_warning_1']['hgvs_predicted_protein_consequence']['slr']
30488+
30489+
def test_issue_add_protein_variant_slc_b(self):
30490+
variant = 'LRG_1p1:p.(G197C)'
30491+
results = self.vv.validate(variant, 'GRCh37', 'all').format_as_dict(test=True)
30492+
print(results)
30493+
assert 'NP_000079.2:p.(Gly197Cys)' in \
30494+
results['validation_warning_1']['hgvs_predicted_protein_consequence']['tlr']
30495+
assert 'NP_000079.2:p.(G197C)' in \
30496+
results['validation_warning_1']['hgvs_predicted_protein_consequence']['slr']
30497+
3048130498

3048230499

3048330500

0 commit comments

Comments
 (0)