From 6c2076e87905af863d6d48c27cc0ccf187eba2ba Mon Sep 17 00:00:00 2001 From: Peter Cock Date: Fri, 13 Apr 2012 15:07:12 +0100 Subject: [PATCH 1/3] Correct comment in NCBI BLAST+ wrappers --- tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml | 2 +- tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml | 2 +- tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml | 2 +- tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml | 2 +- tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml index dbefac05d6e..6b942380403 100644 --- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml +++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml @@ -1,6 +1,6 @@ Search nucleotide database with nucleotide query sequence(s) - + blastn -version hide_stderr.py diff --git a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml index 0f7d0a7c8ee..17dda06e5e1 100644 --- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml +++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml @@ -1,6 +1,6 @@ Search protein database with protein query sequence(s) - + blastp -version hide_stderr.py diff --git a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml index cda16a5f34f..487c433ee1b 100644 --- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml +++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml @@ -1,6 +1,6 @@ Search protein database with translated nucleotide query sequence(s) - + blastx -version hide_stderr.py diff --git a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml index 2d6ece29b92..73cead395d8 100644 --- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml +++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml @@ -1,6 +1,6 @@ Search translated nucleotide database with protein query sequence(s) - + tblastn -version hide_stderr.py diff --git a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml index e65ed289bd4..bb96f972a9c 100644 --- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml +++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml @@ -1,6 +1,6 @@ Search translated nucleotide database with translated nucleotide query sequence(s) - + tblastx -version hide_stderr.py From e6628b9b66f8f9a9ca6eb7e3cc0c88831ddb2e4c Mon Sep 17 00:00:00 2001 From: Peter Cock Date: Tue, 17 Apr 2012 13:48:51 +0100 Subject: [PATCH 2/3] Update scripts/check_python.py (Python 2.4 not supported) --- scripts/check_python.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/check_python.py b/scripts/check_python.py index 15017c9d2c0..e6fdc00a7c0 100644 --- a/scripts/check_python.py +++ b/scripts/check_python.py @@ -1,14 +1,14 @@ import os, sys msg = """ERROR: Your Python version is: %s -Galaxy is currently supported on Python 2.4, 2.5 and 2.6. To run Galaxy, +Galaxy is currently supported on Python 2.5, 2.6 and 2.7. To run Galaxy, please download and install a supported version from python.org. If a supported version is installed but is not your default, getgalaxy.org contains instructions on how to force Galaxy to use a different version.""" % sys.version[:3] def check_python(): try: - assert sys.version_info[:2] >= ( 2, 4 ) and sys.version_info[:2] <= ( 2, 7 ) + assert sys.version_info[:2] >= ( 2, 5 ) and sys.version_info[:2] <= ( 2, 7 ) except AssertionError: print >>sys.stderr, msg raise From a361e7d9cf7d571bfe19144a011f39bb02bdad63 Mon Sep 17 00:00:00 2001 From: Peter Cock Date: Wed, 18 Apr 2012 10:36:23 +0100 Subject: [PATCH 3/3] Handle merging bad BLAST XML files better --- lib/galaxy/datatypes/xml.py | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/datatypes/xml.py b/lib/galaxy/datatypes/xml.py index d9e659bd70c..ef1f1623e28 100644 --- a/lib/galaxy/datatypes/xml.py +++ b/lib/galaxy/datatypes/xml.py @@ -104,13 +104,41 @@ class BlastXml( GenericXml ): for f in split_files: h = open(f) body = False - header = [] + header = h.readline() + if not header: + out.close() + h.close() + raise ValueError("BLAST XML file %s was empty" % f) + if header.strip() != '': + out.write(header) #for diagnosis + out.close() + h.close() + raise ValueError("%s is not an XML file!" % f) + line = h.readline() + header += line + if line.strip() not in ['', + '']: + out.write(header) #for diagnosis + out.close() + h.close() + raise ValueError("%s is not a BLAST XML file!" % f) while True: line = h.readline() - header.append(line) + if not line: + out.write(header) #for diagnosis + out.close() + h.close() + raise ValueError("BLAST XML file %s ended prematurely" % f) + header += line if "" in line: break - header = "".join(header) + if len(header) > 10000: + #Something has gone wrong, don't load too much into memory! + #Write what we have to the merged file for diagnostics + out.write(header) + out.close() + h.close() + raise ValueError("BLAST XML file %s has too long a header!" % f) if "" not in header: out.close() h.close()