def read_words(filename): """ Load word list from the file named filename. Returns a list of strings. """ # load assets word_file = urllib2.urlopen(filename) # read in files as string words = word_file.read() # template lines and solution lines list of line string word_list = words.split('\n') print "Loaded a dictionary with", len(word_list), "words" return word_list human = read_protein(HUMAN_EYELESS_URL) fruitfly = read_protein(FRUITFLY_EYELESS_URL) s_m = read_scoring_matrix(PAM50_URL) a_m = student.compute_alignment_matrix(human, fruitfly, s_m, False) alignment = student.compute_local_alignment(human, fruitfly, s_m, a_m) print alignment[0] print "Human :", alignment[1] print "Fruitfly:", alignment[2]
return protein_seq def read_words(filename): """ Load word list from the file named filename. Returns a list of strings. """ # load assets word_file = urllib2.urlopen(filename) # read in files as string words = word_file.read() # template lines and solution lines list of line string word_list = words.split('\n') print "Loaded a dictionary with", len(word_list), "words" return word_list human = read_protein(HUMAN_EYELESS_URL) fruitfly = read_protein(FRUITFLY_EYELESS_URL) s_m = read_scoring_matrix(PAM50_URL) a_m = student.compute_alignment_matrix(human, fruitfly, s_m, False) alignment = student.compute_local_alignment(human, fruitfly, s_m, a_m) print alignment[0] print "Human :", alignment[1] print "Fruitfly:", alignment[2]
word_file = urllib2.urlopen(filename) # read in files as string words = word_file.read() # template lines and solution lines list of line string word_list = words.split('\n') print "Loaded a dictionary with", len(word_list), "words" return word_list human = "HSGVNQLGGVFVNGRPLPDSTRQKIVELAHSGARPCDISRILQVSNGCVSKILGRYYETGSIRPRAIGGSKPRVATPEVVSKIAQYKRECPSIFAWEIRDRLLSEGVCTNDNIPSVSSINRVLRNLASEKQQ" fruitfly = "HSGVNQLGGVFVGGRPLPDSTRQKIVELAHSGARPCDISRILQVSNGCVSKILGRYYETGSIRPRAIGGSKPRVATAEVVSKISQYKRECPSIFAWEIRDRLLQENVCTNDNIPSVSSINRVLRNLAAQKEQQ" s_m = read_scoring_matrix(PAM50_URL) consensus = read_protein(CONSENSUS_PAX_URL) a_m = student.compute_alignment_matrix(human, consensus, s_m, True) alignment = student.compute_global_alignment(human, consensus, s_m, a_m) print "Score :", alignment[0] print "Human :", alignment[1] print "Consensus:", alignment[2] percent = 0 for i in xrange(len(alignment[1])): if alignment[1][i] == alignment[2][i]: percent += 1 print "Percent :", 100.0 * percent / len(alignment[1]) a_m = student.compute_alignment_matrix(fruitfly, consensus, s_m, True) alignment = student.compute_global_alignment(fruitfly, consensus, s_m, a_m) print "Score :", alignment[0] print "Fruitfly :", alignment[1] print "Consensus:", alignment[2]