Question: Trying to run blastp in a java program, says that the directory cannot be found
0
gravatar for adityagudibanda1995
3.9 years ago by
United States
adityagudibanda199510 wrote:

I am trying to run the program here:

http://dasan.sejong.ac.kr/~wikim/notice.html

 

In one of the .java files, it makes a call to the blastp function in the NCBI blast+ package.

 


 public ArrayList runBlast(String query, String subject) {
    ArrayList scoreList = new ArrayList();
    Runtime rt = Runtime.getRuntime();   
    subject = ParaNames.Species+subject;
    try { 
    Process proc = rt.exec(new String[] {"~/Downloads/ncbi-blast-2.2.30+/bin/blastp", "-query", query, "-subject", subject, "-num_threads", "4", "-matrix", matrix, "-outfmt", "10 qseqid sseqid score"});
       InputStream is = proc.getInputStream();
       InputStream es = proc.getErrorStream();
       BufferedReader reader = new BufferedReader(new InputStreamReader(is));   
       BufferedReader readerError = new BufferedReader(new InputStreamReader(es));
       String line; 
       while ((line = reader.readLine()) != null) {
        scoreList.add(line);  
       }
       if (proc.waitFor() != 0) {
         System.err.println("Process exited with (normal termination: 0) "+proc.exitValue());
         System.err.println("Error: "+readerError.readLine());
       }
       is.close(); is = null;
       es.close(); es = null;
       reader.close(); reader = null;
       readerError.close(); readerError = null;
       proc.destroy(); proc = null;
    } 
    catch (InterruptedException e) {   
         System.err.println("Error: "+e.getMessage());   
    }
    catch (IOException ioe) {
    System.err.println("Failed to execute: "+ioe.getMessage());
    }

    return scoreList;
  }


I have downloaded ncbi-blast-2.2.30+ and it is in the Downloads folder.

When I run this however, I am getting the following error:

May 20, 2015 1:40:33 PM ReMark.RecursiveClustering <init>

INFO: Trying to run BLAST now - this may take several hours ... or days!

May 20, 2015 1:40:33 PM ReMark.RecursiveClustering <init>

INFO: Starting ortholog detection...................................

 

Failed to execute: Cannot run program "~/Downloads/ncbi-blast-2.2.30+/bin/blast": error=2, No such file or directory

Failed to execute: Cannot run program "~/Downloads/ncbi-blast-2.2.30+/bin/blast": error=2, No such file or directory

Failed to execute: Cannot run program "~/Downloads/ncbi-blast-2.2.30+/bin/blast": error=2, No such file or directory

Failed to execute: Cannot run program "~/Downloads/ncbi-blast-2.2.30+/bin/blast": error=2, No such file or directory

Failed to execute: Cannot run program "~/Downloads/ncbi-blast-2.2.30+/bin/blast": error=2, No such file or directory


Could someone explain what I need to do to fix this? I can provide any other information you need. Thank you very much.

blast sequence software error • 1.4k views
ADD COMMENTlink modified 3.9 years ago • written 3.9 years ago by adityagudibanda199510
1

Looks like it is looking for blast executable instead of blastp. Does that program requires legacy blast  (non-plus version)?

 

ADD REPLYlink modified 3.9 years ago • written 3.9 years ago by arnstrm1.7k

I don't think so, because originally it just said "blastp" where it is currently written "~/Downloads/ncbi-blast-2.2.30+/bin/blastp"

 

 

ADD REPLYlink written 3.9 years ago by adityagudibanda199510
1
gravatar for mikhail.shugay
3.9 years ago by
mikhail.shugay3.3k
Czech Republic, Brno, CEITEC
mikhail.shugay3.3k wrote:

First it the code reads "blastp", while the error message reads "blast". Next, it is very strange that the path is hard-linked into the code. Are you sure that the blastp binary is there and is compiled for macos? I would also recommend to substitute ~/ with /user/... Just do cd ~/Downloads/ncbi-blast-2.2.30+/bin/ and type pwd to get the full path.

ADD COMMENTlink modified 3.9 years ago • written 3.9 years ago by mikhail.shugay3.3k

Ah, thank you. I tried this but now I am getting a new error, for which I believe you need to see the whole Java file in order to figure out.

It is now saying the following:


May 20, 2015 2:08:01 PM ReMark.RecursiveClustering <init>

INFO: Trying to run BLAST now - this may take several hours ... or days!

May 20, 2015 2:08:01 PM ReMark.RecursiveClustering <init>

INFO: Starting ortholog detection...................................

 

 

Wrong typing! Try again!


 

How do I attach .java files here?

ADD REPLYlink written 3.9 years ago by adityagudibanda199510
1

Generally one puts open-source projects to a public repository. You can put the code in question to gist (https://gist.github.com/) and link it in the post here.

PS. Although the better way may be to write Sunshin Kim (the author)

ADD REPLYlink modified 3.9 years ago • written 3.9 years ago by mikhail.shugay3.3k

Here is the file: 

I tried emailing a while back, but I haven't received a response yet.

Here is my input:


zimings-mac-pro:Linux guest$ bash runRecursiveClustering.sh 

 

>>> Select genomes to detect orthologs: (e.g. 1 2 3 TESTTEST 4 5 or 1-5)

1. AAE

2. CAC

3. ECO

4. ECU

5. HIN

6. LLA

7. SCE

8. SPO

9. SPY

10. SYN

11. TMA

12. YPE

 

1-3

 

Selected genomes: AAE CAC ECO 

 

 

 

>>>>> Enter a number:

1. [ RUN ] ortholog detection [ Using ] pre-calculated blast results [ for efficiency ]

2. [ RUN ] ortholog detection [ Not Using ] pre-calculated blast results

3. [ Exit ] ortholog detection.......

 

2

 

>>>>> Enter a matrix number:

1. BLOSUM45

2. BLOSUM62

3. BLOSUM80

 

1

 

Matrix number is : BLOSUM45

 

May 20, 2015 2:16:48 PM ReMark.RecursiveClustering <init>

INFO: Trying to run BLAST now - this may take several hours ... or days!

May 20, 2015 2:16:48 PM ReMark.RecursiveClustering <init>

INFO: Starting ortholog detection...................................

 

 

Wrong typing! Try again!


 

ADD REPLYlink written 3.9 years ago by adityagudibanda199510

Sorry, but it looks like it is some problem with CLI IO which will be really difficult to figure out from the code you've provided. PS Moving this to answer as it seems that the problem with BLAST executable path is fixed

ADD REPLYlink modified 3.9 years ago • written 3.9 years ago by mikhail.shugay3.3k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1443 users visited in the last hour