it's the first time that i use blast inside biopython, and i'm having a problem.
i created a custom blast database from a fasta file which contain 20 sequence using :
os.system('makeblastdb -in newtest.fasta -dbtype nucl -out newtest.db')
and this did generate few files (newtest.db.nhr, newtest.db.nin, newtest.db.nsq) inside the current directory that i'm currently working in : (/home/User/Documents/python/fasta-files
)
and now i'm trying to query this database inside biopython using :
blastx_cline = NcbiblastxCommandline(query="queryfile.fas", db="newtest.db", evalue=0.00000001, outfmt=5, out="opuntia.xml")
but i'm getting this error :
> Bio.Application.ApplicationError: Command 'blastx -out opuntia.xml
> -outfmt 5 -query queryfile.fas -db newtest.db -evalue 1e-08' returned non-zero exit status 2, 'BLAST Database error: No alias or
> index file found for protein database [newtest.db] in search path
> [/home/User/Documents/python/fasta-files:/usr/share/ncbi/blastdb:]'
so i tried copying the files generated from the /home/User/Documents/python/fasta-files
to /usr/share/ncbi/blastdb
but it says that i don't have permission.
*EDIT*
when i use : os.system("blastn -db newtest.db -query "fastafile.fas" + " -out test.txt")
it works normally generating an output file. but not the other way around**
so i'm stuck here and i don't know how to solve this.
any help would be appreciated
Pay attention to phrase protein database in the error message while newtest.db is a nucl database.
index file found for protein database [newtest.db] in search path
So blastx is expecting a protein database. Isn't that obvious? :-)
In case you did not do it by purpose, you should specify BLAST program to use by adding "cmd='blastn'". So, this is better:
blastx_cline = NcbiblastxCommandline(cmd='blastn', query="queryfile.fas", db="newtest.db", evalue=0.00000001, outfmt=5, out="opuntia.xml")