Skip to content
Snippets Groups Projects
Commit bcef1633 authored by Vermaat's avatar Vermaat
Browse files

Fix several error cases in LOVD2 getGS call

The `getGS` website view for LOVD2 would report "transcript not found" if
the genomic reference has multiple transcripts annotated or if the variant
description raises an error in the variant checker.
parent ea86a42c
No related branches found
No related tags found
No related merge requests found
......@@ -1702,22 +1702,6 @@ def check_variant(description, output):
record = GenRecord.GenRecord(output)
record.record = retrieved_record
# Note: The GenRecord instance is carrying the sequence in .record.seq.
# So is the Mutator instance in .mutator.orig.
mutator = Mutator(record.record.seq, output)
# Todo: If processing of the variant fails, we might still want to show
# information about the record, gene, transcript.
try:
process_variant(mutator, parsed_description, record, output)
except _VariantError:
return
output.addOutput('original', str(mutator.orig))
output.addOutput('mutated', str(mutator.mutated))
# Create the legend.
for gene in record.record.geneList:
for transcript in sorted(gene.transcriptList, key=attrgetter('name')):
......@@ -1735,6 +1719,22 @@ def check_variant(description, output):
transcript.proteinProduct,
transcript.linkMethod])
# Note: The GenRecord instance is carrying the sequence in .record.seq.
# So is the Mutator instance in .mutator.orig.
mutator = Mutator(record.record.seq, output)
# Todo: If processing of the variant fails, we might still want to show
# information about the record, gene, transcript.
try:
process_variant(mutator, parsed_description, record, output)
except _VariantError:
return
output.addOutput('original', str(mutator.orig))
output.addOutput('mutated', str(mutator.mutated))
# Chromosomal region (only for GenBank human transcript references).
# This is still quite ugly code, and should be cleaned up once we have
# a refactored mapping module.
......
......@@ -553,6 +553,34 @@ class TestWebsite(MutalyzerTest):
assert 'go to bottom' not in r.data
assert '<input' not in r.data
@fix(database, cache('NG_012337.1'))
def test_getgs_coding_multiple_transcripts(self):
"""
Test the /getGS interface on a coding description and genomic
reference with multiple transcripts.
"""
r = self.app.get('/getGS',
query_string={'variantRecord': 'NM_003002.2',
'forward': '1',
'mutationName': 'NG_012337.1:c.45A>T'},
follow_redirects=False)
assert '/name-checker?' in r.location
assert 'description=NG_012337.1' in r.location
@fix(database, cache('NG_008939.1'))
def test_getgs_variant_error(self):
"""
Test the /getGS interface on a variant description with an error.
"""
# The error is that position c.45 is a C, not an A.
r = self.app.get('/getGS',
query_string={'variantRecord': 'NM_000532.4',
'forward': '1',
'mutationName': 'NG_008939.1:c.45A>T'},
follow_redirects=False)
assert '/name-checker?' in r.location
assert 'description=NG_008939.1' in r.location
@fix(database, hg19, hg19_transcript_mappings)
def test_variantinfo_g2c(self):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment