[Biojava-l] Run blast on multiple databases
Patrick McConnell
MCCon012 at mc.duke.edu
Wed Feb 4 11:06:35 EST 2004
Pass a String array to the exec function instead of one string. The first
element of the array is the executable, the rest are the parameters. For
example:
Runtime.getRuntime().exec(new String[] {
"/usr/bin/blast/blastall",
"-p", "blastn",
"-d", "nt human mouse",
"-i", "/home/me/in.fasta",
"-o", "/home/me/out.txt"
});
This way, java handles sending the parameter with spaces correctly.
-Patrick McConnell
Duke Binformatics Shared Resource
Duke University
mccon012 at mc.duke.edu
Laurence Hummel
<lhummel at pasteur.fr> To: biojava-l at biojava.org
Sent by: cc:
biojava-l-bounces at portal.o Subject: [Biojava-l] Run blast on multiple databases
pen-bio.org
02/03/2004 01:09 PM
Hi,
I want to run blastall on several databases, so I run it with -d
"dbName1 dbName2"...
This work well if I launch the command line in a terminal, but not if I
launch it from my java program...
It seems like the "" are not reconized.
Here is what I've done :
Process blastRun;
String pOption, dOption, oOption, iOption, eOption, tOption,
blastCommandLine, line;
BufferedReader errorBuff;
File outFile;
try {
pOption = " -p " + program;
tOption = " -T"; // out file in html format
dOption = " -d \"" + db + "\"";
iOption = " -i " + query;
eOption = " -e " + eValue;
oOption = " -o " + outFilePath;
blastCommandLine = exePath + pOption + dOption + tOption +
iOption + eOption + oOption;
System.out.println("\nblastcommandLine = " +
blastCommandLine);
// Call external blastall programm
blastRun = Runtime.getRuntime().exec(blastCommandLine);
// Catch blast error
System.out.println("\nErrorStream = " +
blastRun.getErrorStream().read());
errorBuff = new BufferedReader(new
InputStreamReader(blastRun.getErrorStream()));
System.out.println("\nerrorBuff = ");
while ((line = errorBuff.readLine()) != null) {
System.out.println(line);
}
System.out.println("\nOutputStream = " +
blastRun.getOutputStream());
} catch (IOException ex) {
System.out.println("BLAST NOT RUN");
System.out.println("IOException : " + ex.toString());
}
And here is the error :
blastcommandLine = /Applications/blast/blastall -p blastp -d "db1 db2"
-T -i query.faa -e 10.0 -o /out.html
ErrorStream = 91
errorBuff =
blastall] ERROR: Arguments must start with '-' (the offending argument
#5 was: db2"')
OutputStream = java.io.BufferedOutputStream at 629355
The exactly same command line copy/pasted in a terminal works very
well...
Is someone has an idea?
Laurence
--
Laurence HUMMEL
Génopole - Plate-Forme 4 "Intégration et Analyse Génomiques"
Institut Pasteur
28 rue du docteur Roux - 75015 PARIS
Tel : 01.44.38.95.36
_______________________________________________
Biojava-l mailing list - Biojava-l at biojava.org
http://biojava.org/mailman/listinfo/biojava-l
More information about the Biojava-l
mailing list