Created
February 15, 2015 23:56
-
-
Save wenliangz/6a7391d8d09ea79f75ae to your computer and use it in GitHub Desktop.
wenliangz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| seq=[] | |
| with open('rosalind_hamm.txt') as f: | |
| for each in f: | |
| each=each.strip() | |
| seq.append(each) | |
| seq1=seq[0] | |
| seq2=seq[1] | |
| seq1_dict={} | |
| seq2_dict={} | |
| for position,base in enumerate(seq1): | |
| seq1_dict[position]=base | |
| for position,base in enumerate(seq2): | |
| seq2_dict[position]=base | |
| Hamm=set(seq1_dict.iteritems())-set(seq2_dict.iteritems()) | |
| dH=len(Hamm) | |
| print dH | |
| seq1 ="ABCD" | |
| seq2 = "ABXD" | |
| dist = 0 | |
| for i in range(0, min(len(seq1), len(seq2))): | |
| if seq1[i] != seq2[i]: | |
| dist += 1 | |
| dist += abs(len(seq1) - len(seq2)) | |
| #what the hell is going on | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment