[Biopython-dev] [Bug 2480] Local BLAST fails: Spaces in Windows file-path values
bugzilla-daemon at portal.open-bio.org
bugzilla-daemon at portal.open-bio.org
Tue Sep 30 07:45:14 UTC 2008
http://bugzilla.open-bio.org/show_bug.cgi?id=2480
------- Comment #25 from drpatnaik at yahoo.com 2008-09-30 03:45 EST -------
Using subprocess I am now able to get Biopython to run local BLAST successfully
in Windows when spaces are present in file-path values.
With a conditional statement like the one below, following type of modification
will still let Biopython remain compatible with old versions of Python that
cannot use subprocess:
# replace lines 1680-1682 of CVS 1.78 of Bio/Blast/NCBIStandalone.py with
these
try:
import subprocess
my_process = subprocess.Popen(" ".join([blastcmd] + params),
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=False)
r, e = my_process.communicate('through stdin to stdout')
return r, e
except:
w, r, e = os.popen3(" ".join([blastcmd] + params))
w.close()
return File.UndoHandle(r), File.UndoHandle(e)
The test.py file I tested:
# Note the unusual ways to specify the database, input file, and BLAST
locations
my_blast_db = r'"\"C:\Documents and Settings\patnaik\My
Documents\blast\bin\hairpin.db\""'
my_blast_file = r'"C:\Documents and Settings\patnaik\My
Documents\blast\bin\30a.seq"'
my_blast_exe = r"C:\Documents and Settings\patnaik\My
Documents\blast\bin\blastall.exe"
from Bio.Blast import NCBIStandalone
my_blast_result, my_blast_error = NCBIStandalone.blastall(my_blast_exe,
"blastn", my_blast_db, my_blast_file)
# Note the way the save_file path is specified
save_file = open(r'C:/Documents and Settings/patnaik/My
Documents/blast/bin/my_blast_error', "w")
save_file.write(my_blast_error)
save_file.close()
save_file = open(r'C:/Documents and Settings/patnaik/My
Documents/blast/bin/my_blast_result', "w")
save_file.write(my_blast_result)
save_file.close()
--
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Biopython-dev
mailing list