diff --git a/mutalyzer/util.py b/mutalyzer/util.py index 1ef1987f2c9747b2ac25ad6b31b8344fbf50b0de..ae709477bbb789b625014046f8c1f4c336981417 100644 --- a/mutalyzer/util.py +++ b/mutalyzer/util.py @@ -392,7 +392,8 @@ def read_dna(handle): Read the first record in an NGS data file. If the format is not recognised as FASTA or FASTQ, we assume that the input - is in plain text. In this case, all non-DNA characters are removed. + is in plain text. In this case, DNA is converted to uppercase and all + non-DNA characters are removed. :arg stream handle: Open readable handle to an NGS data file. @@ -403,7 +404,7 @@ def read_dna(handle): if file_format != 'text': return unicode(SeqIO.parse(handle, file_format).next().seq) - return ''.join(x for x in unicode(handle.read()) if x in 'ATCG') + return ''.join(x for x in unicode(handle.read()).upper() if x in 'ATCG') def in_frame_description(s1, s2) : diff --git a/tests/test_website.py b/tests/test_website.py index 3392d1faa4ec1391797627f881a46003f7f590dc..faf336ba89b84ea96dee1ac7d472fc28429b86a8 100644 --- a/tests/test_website.py +++ b/tests/test_website.py @@ -207,6 +207,18 @@ class TestWebsite(MutalyzerTest): assert 'Input sequences are restricted to ' in r.data assert '1 Error, 0 Warnings.' in r.data + def test_description_extractor_lowercase(self): + """ + Submit a sample sequence with a base in lowercase to the variant + description extractor. + """ + r = self.app.post('/description-extractor', data={ + 'reference_method': 'raw_method', + 'sample_method': 'raw_method', + 'reference_sequence': 'TTT', + 'sample_sequence': 'TaT'}) + assert '<pre class="description">2T>A</pre>' in r.data + def test_checksyntax_valid(self): """ Submit the check syntax form with a valid variant.