是否有人知道BLAST对齐的纯python实现?我正在尝试研究这个算法......
当我尝试运行 Biopython 提供的用于 NCBIWWW.qblast 在线搜索的测试文件时,它只是一直挂着,从不响应。当我尝试自己运行任何包含 NCBIWWW.qblast 的脚本时,也会发生同样的情况:它刚刚到达此行并停止。不会发出任何错误消息,不会收到任何结果,并且该过程永远不会以任何方式结束。
产生问题的脚本之一是:
from Bio.Blast import NCBIWWW
result_handle=qblast('blastn', 'nt', 'AGAAAGGGTATATAAAATCAAGAATCTGGGGTGTTTGTGTTGACTTGTATAATTCTTGATTTTTTCAGGTAGTTGAAAAGGTGGGAGAAAAGTGGAGAAGCCTAAGCTGATATTGAAATTCATATGGATGGAAGAACATTGGTTTAGGATTGGATCAAAAAATAGGTGGACATGGAACTGTA')
Run Code Online (Sandbox Code Playgroud)
可能是什么问题?
我正在编写一个 python 脚本,并且希望将查询序列信息作为字符串变量而不是 FASTA 格式文件传递到blastn(如果可能)。
我使用 Biopython 的 SeqIO 将多个转录本名称存储为键,并将其序列存储为关联值。
所以它看起来像这样
transcripts = dict()
for record in SeqIO.parse("transcript_sequences.fasta", "fasta"):
transcripts[record.name] = record.seq
print transcripts
Run Code Online (Sandbox Code Playgroud)
所以字典看起来像这样
{'var_F': Seq('CTTCATTCTCGTTTAGCGGCTGCTCGTGGAAATTTCGAAAAAATCTGAAACTAG...TGC', SingleLetterAlphabet())}
Run Code Online (Sandbox Code Playgroud)
现在我想将字典中的序列信息解析为爆炸查询和主题。
subprocess.call("blastn -query " + transcript['var_F'] + ".txt" + " -subject " + transcript['var_B'] + " -outfmt 6 > tmp_blast.txt", shell=True)
Run Code Online (Sandbox Code Playgroud)
我知道blast只接受文件名或字符串作为文件位置,但我只是想知道是否有解决方法。
预先感谢您阅读我的第一个问题:P
我正在尝试运行blastn,然后独立运行SIFT。但是,我遇到了数据库配置问题,因为我收到以下信息:
arron@arron-Ideapad-Z570 ~/Phd/programs/sift4.0.3b $ blastn -query test/lacI.fasta -db db/swissprot/
BLAST Database error: No alias or index file found for nucleotide database [db/swissprot/] in search path [/home/arron/Phd/programs/sift4.0.3b:::]
Run Code Online (Sandbox Code Playgroud)
在其他线程的一些建议之后,我下载了一个蛋白质数据库,例如 swissprot:
wget ftp://ftp.ebi.ac.uk/pub/databases/fastafiles/uniprot/uniprotkb_swissprot.gz
zcat uniprotkb_swissprot.gz | awk '{if (/^>/) { print ">" $2} else { print $_}}' > swissprot.fa
Run Code Online (Sandbox Code Playgroud)
然后使用 makeblastdb 创建一个blast 数据库:
arron@arron-Ideapad-Z570 ~/Phd/programs/sift4.0.3b/db/swissprot $ makeblastdb -in swissprot.fa -dbtype prot
Building a new DB, current time: 10/27/2014 13:18:57
New DB name: swissprot.fa
New DB title: swissprot.fa
Sequence type: Protein
Keep Linkouts: T …Run Code Online (Sandbox Code Playgroud) 我试图使用Biopython的NcbiblastxCommandline工具在"nr"数据库本地运行blastx但是我总是得到关于蛋白质数据库搜索路径的以下错误:
>>> 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 …Run Code Online (Sandbox Code Playgroud) 这是我第一次在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")
它正常生成一个输出文件.但不是相反**
所以我被困在这里,我不知道如何解决这个问题.
任何帮助,将不胜感激
我正在尝试查看是否可以从 NCBI 的 BLAST 中shutil.which()查找命令。blastn在我的终端上运行which blastn会产生/usr/local/bin/blastn. 但是,如果我这样做shutil.which("blastn"),它只会返回None。搜索 Python 工作正常,shutil.which("python")返回/usr/bin/python。为什么会发生这种情况?
我想要
我怎么能在BioPython中做到这一点?
我正在尝试运行一个名为 BLASTP 的生物程序,它接收两个字符串(代码中的 fasta_GWIDD 和 fasta_UNIPROT)并比较它们。我遇到的问题是在代码中使用了 echo/system。谁能建议我错过了什么?
for(i=0;i<index1;i++)
{
sprintf(fasta_GWIDD,">%s\\n%s\n",fasta_name1[i],fasta_seq1[i]);
setenv("GwiddVar", fasta_GWIDD, 1) ;
sprintf(fasta_UNIPROT,">%s\\n%s\n",fasta_name2[i],fasta_seq2[i]);
setenv("UniprotVar", fasta_UNIPROT, 1) ;
system("blastp -query <(echo -e $GwiddVar) -subject<(echo -e $UniprotVar)");
}
Run Code Online (Sandbox Code Playgroud)
错误是:
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `blastp -query <(echo -e $GwiddVar) -subject<(echo -e $UniprotVar)'
Run Code Online (Sandbox Code Playgroud) 我正在处理一个大型BLAST文件和一个大型FASTA文件,我需要为一个BLAST块加载几行FASTA(假设它是一行).
我希望在BLAST的第二个循环(行)中,它将继续在最后处理的FASTA行的下一行,但它正在加载所有相同的FASTA行.为什么?我怎样才能加载下一行?是否真的有必要添加一些索引?
with open(fastaname,'r') as fastafile:
with open(blastfilename,'r') as blastfile:
for line in blastfile:
while True:
fastaline = fastafile.readline()[:-1]
if fastaline[0]=='>':
break
fastaseq += fastaline
somefunction(line,fastaseq)
Run Code Online (Sandbox Code Playgroud)
FASTA有典型的格式:
>name_of_seqence\n
ACGATCATCGTAGCTGCATGACTGCA\n
GATCGATCTGATCGATGCAGTCAGTA\n
>name_of_seqence\n
GCACGCGACCACGATCATTGACTGCA\n
CAAAAGATCTGATCGATGCAGTCAGT\n
CAGTCGATGCTAGTCGATGCTCGATA\n
etc.
Run Code Online (Sandbox Code Playgroud)
我需要每个序列用于下一个BLAST序列的每一行.