Question: Fail running blastdb and blastn on my own computer
0
gravatar for annette440
11 days ago by
annette4400
annette4400 wrote:

I have downloaded blast to my own computer and I am trying first to make a blast database using makeblastdb program and then make a blastn using the blastn program. My code looks like this:

makedb_path = '\"C:/Program Files/NCBI/blastn-2.6.0+/bin/makeblastdb.exe"\ '
blastn_path = '\"C:/Program Files/NCBI/blastn-2.6.0+/bin/blastn.exe"\ '

make_db_command = makedb_path + "-in " + Ref_file + " -dbtype nucl -parse_seqids -out 
Blastdatabase.out"
process = subprocess.call(make_db_command, shell=True)

blastn_command = blastn_path + "-query" + Que_file + " -task megablast -db Blastdatabase.out    -outfmt 6 -out blastn.out -min_cov=0.6 -perc_identity=0.9"
process2 = subprocess.call(blastn_command, shell=True)

After running the processes I do not have Blastdatabase.out or blastn.out, indicating it did not run the programs. What am I doing wrong?

blast • 181 views
ADD COMMENTlink modified 11 days ago • written 11 days ago by annette4400

This is on windows? Have you tried those command out on the command line first before putting them in this code? I assume Ref_file is coming from some other part of the code we do not see above.

ADD REPLYlink modified 11 days ago • written 11 days ago by genomax37k

Yes, Ref_file and Que_file are both files coming from other parts of the code, which you cannot see. When I run the make_db_command on the command line I get an error that looks like: bash: \"C:/Program Files/NCBI/blastn-2.6.0+/bin/makeblastdb.exe\" does not exist.

ADD REPLYlink written 11 days ago by annette4400

Does that file exist or not? Is the error coming from those extra \ you have at the beginning and end? Are you working in bash shell in Win 10 or just python interpreter in Windows?

ADD REPLYlink modified 11 days ago • written 11 days ago by genomax37k

The file exists in the same folder as I run my script and I removed the extra \ or else I could not get it to work. I work in Spyder with python3 in Windows 10.

ADD REPLYlink written 11 days ago by annette4400

I recommend to use the WSL in Win10, it works wonderfully.

ADD REPLYlink written 11 days ago by JC6.3k

I tried to use it a bit, but I cannot acces the folder called "program files" and it thinks "program" is a file. How to solve this in WSL?

ADD REPLYlink written 11 days ago by annette4400

use something like "program\ files"

ADD REPLYlink written 11 days ago by JC6.3k

What happens when you run it like this, and don't break up the code:

import subprocess

subprocess.call("C:/Program Files/NCBI/blastn-2.6.0+/bin/makeblastdb.exe -in " + Ref_file + "  -dbtype nucl -parse_seqids -out Blastdatabase.out", shell=True)

subprocess.call("C:/Program Files/NCBI/blastn-2.6.0+/bin/blastn.exe  -query " + Que_file + "  -task megablast -db Blastdatabase.out -outfmt 6 -out blastn.out -min_cov=0.6 -perc_identity=0.9", shell=True)
ADD REPLYlink modified 11 days ago • written 11 days ago by st.ph.n1.9k

Then I do not get the output files "Blastdatabase.out" and "blastn.out" in my folder, but it does not give me an error.

ADD REPLYlink written 11 days ago by annette4400

Ceck in the folder where Ref_file is

ADD REPLYlink modified 11 days ago • written 11 days ago by st.ph.n1.9k

That is the folder I am checking. Ref_file, Que_file and the program that I run are all in the same folder, and this is the folder I expect the out files to be.

ADD REPLYlink written 11 days ago by annette4400

Try without -out flag, makeblastdb will automake the necessary files with extensions to your ref_file.

ADD REPLYlink written 11 days ago by st.ph.n1.9k

I still get the error: /bin/sh: 1: C:/Program Files/NCBI/blastn-2.6.0+/bin/makeblastdb.exe-in: not found.

ADD REPLYlink written 8 days ago by annette4400
C:/Program Files/NCBI/blastn-2.6.0+/bin/makeblastdb.exe-in

Must be copy/paste error. There needs to be a space before -in

ADD REPLYlink written 8 days ago by st.ph.n1.9k

You also need to account for the space in Program Files name by escaping it as noted by @JC above.

ADD REPLYlink written 8 days ago by genomax37k

I tried to print the two processes I am running and it looks like both of them did run, because both of them are assigned with a 1. But the output files are not there. What could be the problem? I did account for the space in Program files.

ADD REPLYlink written 7 days ago by annette4400

Post the commands exactly as you're running them. Alternatively, try your commands in the windows shell, and see if they work, you might be able to see the error, if there is one. Also, try '\' or '\' instead of '/' in your path.

ADD REPLYlink written 7 days ago by st.ph.n1.9k
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: 851 users visited in the last hour