这是我第一次在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")
但是我收到了这个错误:
> 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:]'
所以我尝试将/home/User/Documents/python/fasta-files
生成的文件复制到/usr/share/ncbi/blastdb
,但它说我没有权限。
的 的 *编辑*
当我使用时:os.system("blastn -db newtest.db -query "fastafile.fas" + " -out test.txt")
它通常会生成一个输出文件。但不是相反 **
所以我被困在这里,我不知道如何解决这个问题。
任何帮助将不胜感激
答案 0 :(得分: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")