Saturday, December 5, 2009

PyCogent 5: Alignment

More on PyCogent here. This is short and sweet.

Two alignments by Needleman-Wunsch (global) and Smith-Waterman (local).


from cogent.align.algorithm import nw_align
from cogent.align.algorithm import sw_align
seq1 = 'TTCATA'
seq2 = 'TGCTCGTA'
print nw_align(seq1,seq2)
print sw_align(seq1,seq2)



('T--TCATA', 'TGCTCGTA')
('TCATA', 'TCGTA')

No comments: