当我运行以下代码时,我甚至没有得到一个blast结果。有没有人能告诉我如果他们发现了bug?
from Bio.Blast import NCBIWWW
from Bio import SeqIO
from Bio.Blast import NCBIXML
from multiprocessing import Pool
import time
def blast_sequences_parallel(seq_record):
result_handle = NCBIWWW.qblast("blastn", "nt", seq_record.seq, entrez_query='txid10239[viruses]')
blast_records = NCBIXML.parse(result_handle)
return blast_records
if __name__ == "__main__":
file = "file.fa"
get_number_of_seqs(file)
seq_records = SeqIO.parse(file, "fasta")
t1 = time.time()
p = Pool()
results = p.map(blast_sequences_parallel, seq_records)
p.close()
p.join()
print("Pool took:", time.time() - t1)
print(results)我有73,000个序列要运行,所以我试图让它更快。我在一台超级计算机上运行它。对于我需要多少内存和多少核心/节点,有什么建议吗?我还在shell中尝试了以下命令:
blastn -query file.fa -remote但是我收到一条错误消息,提示我需要下载数据库?有没有办法使用在线服务器进行搜索?如果有办法,我可以只针对病毒基因组进行搜索吗?
发布于 2021-03-11 03:25:50
对于73K序列,您应该下载适当的数据库并在本地运行BLAST,而不是尝试在线运行它。Biopython还为这个from Bio.Blast.Applications import NcbiblastxCommandline提供了一个包装器,但是只需从命令行运行BLAST就可以更简单。另请参阅相关的biopython docs。
NCBI提供了一组预制的数据库(或者您可以通过makeblastdb从FASTA文件构建自己的数据库):https://ftp.ncbi.nlm.nih.gov/blast/db/
https://stackoverflow.com/questions/66558554
复制相似问题