如何解决并行 BLAST 程序耗时太长
当我运行以下代码时,我什至没有得到一个爆炸结果。有人可以让我知道他们是否发现了错误?
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
但我收到一条错误消息,提示我需要下载数据库?有没有办法使用在线服务器进行搜索?如果有办法,可以只搜索病毒基因组吗?
解决方法
对于 73K 序列,您应该下载适当的数据库并在本地运行 BLAST,而不是尝试在线运行。 Biopython 也有这个 from Bio.Blast.Applications import NcbiblastxCommandline
的包装器,但从命令行运行 BLAST 会更容易。另请参阅相关的 biopython docs。
NCBI 提供一组预制的 dbs(或者您可以通过 makeblastdb
从 FASTA 文件构建您自己的数据库):https://ftp.ncbi.nlm.nih.gov/blast/db/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。