与您从 pycogent 中的实现获得的结果相比,skbio 中的实现给出了一个奇怪的结果。
from cogent.align.algorithm import nw_align as nw_align_cogent
from skbio.alignment import global_pairwise_align_nucleotide as nw_align_scikit
seq_1 = 'ATCGATCGATCG'
seq_2 = 'ATCGATATCGATCG'
print "Sequences: "
print " %s" % seq_1
print " %s" % seq_2
print
alignment = nw_align_scikit(seq_1, seq_2)
al_1, al_2 = [alignment.get_seq(_id).__str__() for _id in alignment.ids()]
print " nw alignment using scikit:"
print " %s" % al_1
print " %s" % al_2
print
al_1, al_2 = nw_align_cogent(seq_1, seq_2)
print " nw alignment using cogent:"
print " %s" % al_1
print " %s" % al_2
print
输出如下所示:
nw alignment using scikit:
------ATCGATCGATCG
ATCGATATCGATCG----
nw alignment using cogent:
ATCGAT--CGATCG
ATCGATATCGATCG