[Biojava-l] Using Java to create BLAST searches

Graham Etherington g.etherington at imb.uq.edu.au
Fri Nov 3 00:23:09 UTC 2006


Hi,
First of all, thanks for the replies and help that everyone sent for my
BLAST query (see below). I figured out what the problems were and thought I
should post the solutions to the forum.
Firstly, as pointed out, when running on Windows the 'sh' and '-c' should be
taken out.
Process runBlast = r.exec (new String[] {cmd});

Secondly, I moved the location of blast to C:/blast/bin/, as to have no
spaces in the path (I didn't try this when everything worked to see if it
had an affect, so I don't know how essential this is)

Thirdly, (and this was one of those real killers that have you kicking
yourself once you realise what the problem was), the location of the
database (ecoli.nt in this case) has to be explicitly set, so
"C:/blast/bin/ecoli.nt"

In the end, I used the org.biojava.utils.ExecRunner 
This handled the query really well and one of the best features is actually
the error reporting. It told me that it couldn't find the ecoli.nt database
which java.lang.Process did not.
My final code looked like this:

String cmd = "C:/blast/bin/blastall -p blastn -d C:/blast/bin/ecoli.nt -i
test.fas -o blast.out";
org.biojava.utils.ExecRunner runner = new org.biojava.utils.ExecRunner ();
runner.exec (cmd);
out.println (runner.getErrString ());


My task for today is working out the best way to display the output/output
file to the current jsp page.
Again, thanks for your help. 


Dr. Graham Etherington
Post-doctoral Research Officer
Bioinformatics Discovery Group,
Institute for Molecular Bioscience,
University of Queensland,
St. Lucia Campus, Brisbane,
QLD 4072 Australia
-----Original Message-----
From: biojava-l-bounces at lists.open-bio.org
[mailto:biojava-l-bounces at lists.open-bio.org] On Behalf Of Graham
Etherington
Sent: Wednesday, 1 November 2006 6:39 PM
To: biojava-l at lists.open-bio.org
Subject: [Biojava-l] Using Java to create BLAST searches

Hi,
I'm developing on Windows (using Apache Tomcat) using jsp's to create BLAST
searches on a local BLAST database. Even though I'm not using BioJava
(intend to use it to parse the results), I thought this formum would be the
best place to ask for help.
Even when I hard code a good BLAST search I keep getting the same error when
I run my search, namely: 
" java.io.IOException: CreateProcess: sh -c "C:/Program Files/Apache
Software Foundation/Tomcat 5.5/blast/bin/blastall -p blastn -d ecoli.nt -i
test.fas -o blast.out" error=2 "

The pertinent bits of code I'm using are...

String cmd = "C:/Program Files/Apache Software Foundation/Tomcat
5.5/blast/bin/blastall -p blastn -d ecoli.nt -i test.fas -o blast.out";

............


Runtime r = Runtime.getRuntime ();
Process runBlast = r.exec (new String[] {"sh","-c",cmd});
                  
runBlast.waitFor ();
out.println ("Waiting for result");

//Write the results
BufferedReader br = new BufferedReader (new FileReader (output));
String line = null;
String results = "";
while ( (line = br.readLine ()) != null )
results = results.concat ("/n" + line);

.............

I'm not sure why it give me an IOException. I've checked that the file input
file exists and that all the paths are correct.
Any ideas?

Many thanks,
Graham


_______________________________________________
Biojava-l mailing list  -  Biojava-l at lists.open-bio.org
http://lists.open-bio.org/mailman/listinfo/biojava-l





More information about the Biojava-l mailing list