Commit c2b54871 authored by Vermaat's avatar Vermaat
Browse files

Use WNOMRNA_OTHER when appropriate (fixes #132)

git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/trunk@667 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1
parent 9a993899
......@@ -513,7 +513,8 @@ class GenRecord() :
usableExonList = self.__checkExonList(j.exon, j.CDS)
if not j.exon or not usableExonList :
if self.record.molType == 'g' :
self.__output.addMessage(__file__, 2, "WNOMRNA",
code = 'WNOMRNA' if j.current else 'WNOMRNA_OTHER'
self.__output.addMessage(__file__, 2, code,
"No mRNA field found for gene %s, transcript " \
"variant %s in record, constructing " \
"it from CDS. Please note that descriptions "\
......@@ -521,7 +522,8 @@ class GenRecord() :
i.name, j.name))
if j.exon and j.exon.positionList and \
not usableExonList :
self.__output.addMessage(__file__, 2, "WNOMRNA",
code = 'WNOMRNA' if j.current else 'WNOMRNA_OTHER'
self.__output.addMessage(__file__, 2, code,
"Exons were found for gene %s, transcript " \
"variant %s but were not usable. " \
"Please note that descriptions "\
......
......@@ -1513,13 +1513,16 @@ def process_variant(mutator, description, record, output):
output.addOutput('BatchFlags',
('S2', output.getOutput('preColon')[-1]))
raise _VariantError()
elif not transcript.transcribe:
# Todo: Shouldn't we add some message here?
raise _VariantError()
# Mark this as the current transcript we work with.
transcript.current = True
record.checkRecord()
if transcript and not transcript.transcribe:
# Todo: Shouldn't we add some message here?
raise _VariantError()
if description.RefType == 'p':
# Todo: This is really unimplemented, what follows is just a start to
# support protein level descriptions on transcript references.
......@@ -1668,7 +1671,22 @@ def check_variant(description, output):
record = GenRecord.GenRecord(output)
record.record = retrieved_record
record.checkRecord()
# 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:
......@@ -1687,22 +1705,6 @@ 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.
......
......@@ -808,3 +808,24 @@ class TestVariantchecker():
"""
check_variant('NP_064445.1:p.=', self.output)
assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 1)
def test_wnomrna_other(self):
"""
Warning for no mRNA field on other than currently selected transcript
should give WNOMRNA_OTHER warning.
"""
ud = self._slice_gene('A1BG') # Contains ZNF497 (v1 and v2) with no mRNA
check_variant(ud + '(A1BG_v001):c.13del', self.output)
wnomrna_other = self.output.getMessagesWithErrorCode('WNOMRNA_OTHER')
assert len(wnomrna_other) == 2
def test_wnomrna(self):
"""
Warning for no mRNA field on currently selected transcript should give
WNOMRNA warning.
"""
ud = self._slice_gene('A1BG') # Contains ZNF497 (v1 and v2) with no mRNA
check_variant(ud + '(ZNF497_v001):c.13del', self.output)
wnomrna = self.output.getMessagesWithErrorCode('WNOMRNA')
wnomrna_other = self.output.getMessagesWithErrorCode('WNOMRNA_OTHER')
assert len(wnomrna) == len(wnomrna_other) == 1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment