我有成千上万个长度在100到5000 bp之间的DNA序列,需要对指定的序列对进行比对并计算相似度得分。
Biopython pairwise2可以很好地处理短序列,但当序列大小超过2kb时,它会出现严重的内存泄漏,导致'MemoryError'错误,即使使用了'score_only'和'one_alignment_only'选项也无济于事!
whole_coding_scores={}
from Bio import pairwise2
for genes in whole_coding: # whole coding is a <25Mb dict providing DNA sequences
alignment=pairwise2.align.globalxx(whole_coding[genes][3],whole_coding[genes][4],score_only=True,one_alignment_only=True)
whole_coding_scores[genes]=alignment/min(len(whole_coding[genes][3]),len(whole_coding[genes][4]))
超级计算机返回的结果:
Max vmem = 256.114G #Memory usage of the script
failed assumedly after job because:
job 4945543.1 died through signal XCPU (24)
我知道有其他的对齐工具,但它们主要只能在输出文件中写入分数,需要重新读取和解析以检索和使用对齐分数。
是否有任何工具可以在Python环境中对齐序列并返回对齐分数,就像pairwise2一样,但没有内存泄漏?