2012-05-21 107 views
3

我試圖用Biopython的NcbiblastxCommandline工具中的「nr」數據庫中本地運行的blastx,但我總能得到關於蛋白質數據庫搜索路徑以下錯誤:Biopython本地BLAST數據庫錯誤

>>> from Bio.Blast.Applications import NcbiblastxCommandline 
>>> nr = "/Users/Priya/Documents/Python/ncbi-blast-2.2.26+/bin/nr.pal" 
>>> infile = "/Users/Priya/Documents/Python/Tutorials/opuntia.txt" 
>>> blastx = "/Users/Priya/Documents/Python/ncbi-blast-2.2.26+/bin/blastx" 
>>> outfile = "/Users/Priya/Documents/Python/Tutorials/opuntia_python_local.xml" 
>>> blastx_cline = NcbiblastxCommandline(blastx, query = infile, db = nr, evalue = 0.001, out = outfile) 
>>> stdout, stderr = blastx_cline() 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File  "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/Application/__init__.py", line 443, in __call__ 
stdout_str, stderr_str) 
Bio.Application.ApplicationError: Command '/Users/Priya/Documents/Python/ncbi-blast-2.2.26+/bin/blastx -out /Users/Priya/Documents/Python/Tutorials/opuntia_python_local.xml -query /Users/Priya/Documents/Python/Tutorials/opuntia.txt -db /Users/Priya/Documents/Python/ncbi-blast-2.2.26+/bin/nr.pal -evalue 0.001' returned non-zero exit status 2, 'BLAST Database error: No alias or index file found for protein database [/Users/Priya/Documents/Python/ncbi-blast-2.2.26+/bin/nr.pal] in search path [/Users/Priya::]' 

我不知道如何更改路徑指向我下載了NR數據庫,但我想我指着它正確,因爲我可以運行沒有任何問題命令行下面的代碼:

Priyas-iMac:~ Priya$ /Users/priya/Documents/Python/ncbi-blast-2.2.26+/bin/blastx -query /Users/priya/Documents/Python/Tutorials/opuntia.txt -db /Users/priya/Documents/Python/ncbi-blast-2.2.26+/bin/nr -out /Users/priya/Documents/Python/Tutorials/opuntia_local.xml -evalue 0.001 -outfmt 5 

上面的命令行代碼創建爆炸結果的XML文件,如我所願期望。

任何幫助解決與Biopython NCBI命令行工具的這個問題將不勝感激!

回答

5

您的nr變量以nr.pal結尾。 nr(沒有.pal)應該沒問題。如果刪除pal不起作用。你可以嘗試建立一個.ncbirc文件中有這樣的主目錄:

[BLAST] 
BLASTDB=/directory/path/to/blast/databases 

它基本上建立了高爐數據庫查詢的環境變量。之後,您可以在nr變量中簡單使用nr(無需路徑)。

順便說一下,您可以使用print blastx_cline來檢查由NcbiblastxCommandline構建的命令行。我的猜測是和你手動輸入的不一樣。

編輯:查看http://www.biostars.org/查看與StackExchange格式類似的生物信息學特定問題。

+0

是的,這個工程!感謝您收到我的錯字!並感謝biostar的建議! – priyasshah

1

看來,工程列出了不同的分貝比一個命令正在從代碼示例中調用:

# In the code 
-db /Users/Priya/Documents/Python/ncbi-blast-2.2.26+/bin/nr.pal 

# From the command line 
-db /Users/priya/Documents/Python/ncbi-blast-2.2.26+/bin/nr 

嘗試改變該路徑的分配nr在第2行中,以便它反映沒有使用'.pal'的命令行路徑。

+0

是的,這個工程!非常感謝! – priyasshah