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

Give an error on protein reference sequences

Until protein reference sequences are supported, give an error with a message
instead of crashing. Fixes #62.


git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/trunk@388 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1
parent 302ba055
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@ import StringIO # StringIO()
from Bio import SeqIO # read()
from Bio import Entrez # efetch(), read(), esearch(), esummary()
from Bio.Seq import UnknownSeq
from Bio.Alphabet import ProteinAlphabet
from xml.dom import DOMException, minidom
from xml.parsers import expat
......@@ -734,7 +735,15 @@ class GenBankRetriever(Retriever):
# Now we have the file, so we can parse it.
GenBankParser = genbank.GBparser()
return GenBankParser.create_record(filename)
record = GenBankParser.create_record(filename)
# Todo: This will change once we support protein references
if isinstance(record.seq.alphabet, ProteinAlphabet):
self._output.addMessage(__file__, 4, 'EPROTEINREF',
'Protein reference sequences are not supported.')
return None
return record
#loadrecord
#GenBankRetriever
......
......@@ -6,6 +6,7 @@ mutalyzer GenRecord. Record populated with data from a GenBank file.
import bz2
from Bio import SeqIO, Entrez
from Bio.Alphabet import ProteinAlphabet
from mutalyzer.config import Config
from mutalyzer import Db
......@@ -455,6 +456,10 @@ class GBparser():
record.version = biorecord.id.split('.')[1]
# Todo: This will change once we support protein references
if isinstance(biorecord.seq.alphabet, ProteinAlphabet):
return record
exonList = []
geneDict = {}
......
......@@ -175,6 +175,19 @@ class TestWSGI():
'0 Warnings',
'Details of the parse error')
def test_check_protein_reference(self):
"""
Submit the name checker form with a protein reference sequence (not
supported).
"""
r = self.app.get('/check')
form = r.forms[0]
form['mutationName'] = 'BAA81889.1:c.274G>T'
r = form.submit()
r.mustcontain('1 Error',
'0 Warnings',
'Protein reference sequences are not supported')
def test_check_noninteractive(self):
"""
Submit the name checker form non-interactively.
......
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