Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "copyright", "credits" or "license()" for more information. **************************************************************** Personal firewall software may warn about the connection IDLE makes to its subprocess using this computer's internal loopback interface. This connection is not visible on any external interface and no data is sent to or received from the Internet. **************************************************************** IDLE 2.6.5 >>> import dp >>> help(dp) Help on module dp: NAME dp - Dynamic programming examples FILE /home/karmic/Projects/Courses/BmsMinicourse/examples2/dp.py FUNCTIONS nw(seq1, seq2, s, e=-1, debug=False) Return an optimal global alignment of seq1 and seq2 given scoring matrix s (a dictionary of dictionaries), and gap extension penalty e. All scores are assumed to be integers. nw_dump(seq1, seq2, m, p) Print a diagnostic dump of the results of nw_fill. nw_fill(seq1, seq2, s, e) Return the score and pointer matrices from the dynamic programming step of Needleman-Wunsch. nw_traceback(seq1, seq2, p) Return the alignment corresponding to the "middle-road" traceback of the given pointer matrix. DATA ident = {'A': {'A': 1, 'C': -1, 'G': -1, 'T': -1}, 'C': {'A': -1, 'C':... >>> s1 = "AGCGGTA" >>> s2 = "GAGCGGA" >>> dp.nw(s1,s2,dp.ident) ('-AGCGGTA', 'GAGCGG-A') >>> aligned = dp.nw(s1,s2,dp.ident) >>> print "\n".join(aligned) -AGCGGTA GAGCGG-A >>> aligned = dp.nw(s1,s2,dp.ident, debug = True) G A G C G G A 0 -1 -2 -3 -4 -5 -6 -7 -1 -1 0 -1 -2 -3 -4 -5 A -2 0 -1 1 0 -1 -2 -3 G -3 -1 -1 0 2 1 0 -1 C -4 -2 -2 0 1 3 2 1 G -5 -3 -3 -1 0 2 4 3 G -6 -4 -4 -2 -1 1 3 3 T -7 -5 -3 -3 -2 0 2 4 A [None, [(0, 0)], [(0, 1)], [(0, 2)], [(0, 3)], [(0, 4)], [(0, 5)], [(0, 6)]] [[(0, 0)], [(0, 0)], [(0, 1)], [(1, 2)], [(1, 3)], [(1, 4)], [(1, 5)], [(0, 6), (1, 6)]] [[(1, 0)], [(1, 0)], [(2, 1), (1, 2)], [(1, 2)], [(2, 3)], [(1, 4), (2, 4)], [(1, 5), (2, 5)], [(2, 6)]] [[(2, 0)], [(2, 1)], [(2, 1)], [(2, 3)], [(2, 3)], [(3, 4)], [(3, 5)], [(3, 6)]] [[(3, 0)], [(3, 0), (3, 1)], [(3, 1), (3, 2)], [(3, 2)], [(3, 4)], [(3, 4)], [(3, 5), (4, 5)], [(4, 6)]] [[(4, 0)], [(4, 0), (4, 1)], [(4, 1), (4, 2)], [(4, 2), (4, 3)], [(4, 4)], [(4, 4), (4, 5)], [(4, 5)], [(5, 6)]] [[(5, 0)], [(5, 1)], [(5, 1), (5, 2)], [(5, 3)], [(5, 4)], [(5, 5)], [(5, 6)], [(5, 6)]] [[(6, 0)], [(6, 1)], [(6, 1)], [(6, 3)], [(6, 4)], [(6, 5)], [(6, 6)], [(6, 6)]] >>>