diff --git a/mutalyzer/Retriever.py b/mutalyzer/Retriever.py index d77f7fa63b00c933ff71d36a520e77822b32fced..ded70bcc034d797cbe7a16ff5f2e6b87c706f288 100644 --- a/mutalyzer/Retriever.py +++ b/mutalyzer/Retriever.py @@ -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 diff --git a/mutalyzer/parsers/genbank.py b/mutalyzer/parsers/genbank.py index 0e5bf2eede5a2b87a24812388a03d3125c18ef4b..060e9a5277c5e35c02cf5667f2daf9366e2de725 100644 --- a/mutalyzer/parsers/genbank.py +++ b/mutalyzer/parsers/genbank.py @@ -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 = {} diff --git a/tests/test_website.py b/tests/test_website.py index 29ba034f9d29fd8e94fdc10fbf6e8322fbd10223..97a67cd5d36950d722d41e0fd0e28039df257316 100644 --- a/tests/test_website.py +++ b/tests/test_website.py @@ -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.