Fail running blastdb and blastn on my own computer
0
0
Entering edit mode
7.1 years ago
annette440 • 0

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 • 3.1k views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

use something like "program\ files"

ADD REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

Ceck in the folder where Ref_file is

ADD REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
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 REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 1661 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6