00001 from ost.seq.alg import SubstWeightMatrix
00002
00003 def _InitMatrix(data):
00004 """
00005 Initialise a new substitution weight matrix with the weights in data. data
00006 must be a 24x24 array of ints.
00007 """
00008 mat=SubstWeightMatrix()
00009
00010 chars='ABCDEFGHIKLMNPQRSTVWXYZ'
00011 for i, row in enumerate(data):
00012 for j, weight in enumerate(row):
00013 mat.SetWeight(chars[i], chars[j], weight)
00014 return mat
00015
00016
00017 _RAW_BLOSUM62_DATA=(
00018 (4,-2,0,-2,-1,-2,0,-2,-1,-1,-1,-1,-2,-1,-1,-1,1,0,0,-3,-1,-2),
00019 (-2,6,-3,6,2,-3,-1,-1,-3,-1,-4,-3,1,-1,0,-2,0,-1,-3,-4,-1,-3),
00020 (0,-3,9,-3,-4,-2,-3,-3,-1,-3,-1,-1,-3,-3,-3,-3,-1,-1,-1,-2,-1,-2),
00021 (-2,6,-3,6,2,-3,-1,-1,-3,-1,-4,-3,1,-1,0,-2,0,-1,-3,-4,-1,-3),
00022 (-1,2,-4,2,5,-3,-2,0,-3,1,-3,-2,0,-1,2,0,0,-1,-2,-3,-1,-2),
00023 (-2,-3,-2,-3,-3,6,-3,-1,0,-3,0,0,-3,-4,-3,-3,-2,-2,-1,1,-1,3),
00024 (0,-1,-3,-1,-2,-3,6,-2,-4,-2,-4,-3,0,-2,-2,-2,0,-2,-3,-2,-1,-3),
00025 (-2,-1,-3,-1,0,-1,-2,8,-3,-1,-3,-2,1,-2,0,0,-1,-2,-3,-2,-1,2),
00026 (-1,-3,-1,-3,-3,0,-4,-3,4,-3,2,1,-3,-3,-3,-3,-2,-1,3,-3,-1,-1),
00027 (-1,-1,-3,-1,1,-3,-2,-1,-3,5,-2,-1,0,-1,1,2,0,-1,-2,-3,-1,-2),
00028 (-1,-4,-1,-4,-3,0,-4,-3,2,-2,4,2,-3,-3,-2,-2,-2,-1,1,-2,-1,-1),
00029 (-1,-3,-1,-3,-2,0,-3,-2,1,-1,2,5,-2,-2,0,-1,-1,-1,1,-1,-1,-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