使用NcbiblastxCommandline自定义blast db

ifr*_*eak 3 python biopython blast

这是我第一次在biopython中使用blast,我遇到了问题.

我从fasta文件创建了一个自定义blast数据库,其中包含20个序列,使用:

os.system('makeblastdb -in newtest.fasta -dbtype nucl -out newtest.db')

这确实在我当前工作的当前目录中生成了一些文件(newtest.db.nhr,newtest.db.nin,newtest.db.nsq):( /home/User/Documents/python/fasta-files)

现在我正在尝试使用以下方法在biopython中查询此数据库:

blastx_cline = NcbiblastxCommandline(query="queryfile.fas", db="newtest.db", evalue=0.00000001, outfmt=5, out="opuntia.xml")
Run Code Online (Sandbox Code Playgroud)

但是我收到了这个错误:

> 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:]'
Run Code Online (Sandbox Code Playgroud)

所以我尝试复制从生成的文件/home/User/Documents/python/fasta-files,/usr/share/ncbi/blastdb但它说我没有权限.

*编辑*

当我使用:os.system("blastn -db newtest.db -query "fastafile.fas" + " -out test.txt") 它正常生成一个输出文件.但不是相反**

所以我被困在这里,我不知道如何解决这个问题.

任何帮助,将不胜感激

bio*_*man 5

当newtest.db是nucl数据库时,请注意错误消息中的短语蛋白质数据库.

在搜索路径中找到蛋白质数据库 [newtest.db]的索引文件

因此,blastx期待一个蛋白质数据库.那不是很明显吗?:-)

如果你没有按目的去做,你应该通过添加"cmd ='blastn'"指定要使用的BLAST程序.所以,这更好:

blastx_cline = NcbiblastxCommandline(cmd='blastn', query="queryfile.fas", db="newtest.db", evalue=0.00000001, outfmt=5, out="opuntia.xml")
Run Code Online (Sandbox Code Playgroud)