Goal: Introduction to pairwise sequence alignment
!curl 'http://histo.ucsf.edu/BMS270/BMS270_2018/code/geneticCode.py' > geneticCode.py
from geneticCode import geneticCode
geneticCode["ATG"]
geneticCode["NNN"]
geneticCode["aaa"]
geneticCode["aaa".upper()]
"asdf".upper()
"this has spaces".replace(" ","")
"".join(i for i in "ATGCNNFGCTAGN NttgC".upper() if(i in "ATGC"))
"hi" in {"hi":"there"}
for (key,val) in geneticCode.items():
print(key,"->",val)
def identity_matrix(alphabet):
d = {}
for i in alphabet:
d[i] = {}
for j in alphabet:
if(i == j):
d[i][j] = 1
else:
d[i][j] = -1
return d
identity_matrix("ATGC")
score = identity_matrix("ATGC")
seq1 = "TGTGGT"
seq2 = "TGAGGT"
score["A"]["T"]