Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def canonisch(codon):
- codon2 = codon[::-1]
- if codon[1] == "T":
- codon1 = codon[0] + "A" + codon[2]
- elif codon[1] == "A":
- codon1 = codon[0] + "T" + codon[2]
- elif codon[1] == "C":
- codon1 = codon[0] + "G" + codon[2]
- elif codon[1] == "G":
- codon1 = codon[0] + "C" + codon[2]
- codon3 = codon1[::-1]
- L = [codon,codon1,codon2,codon3]
- L.sort()
- return L[0]
- def codon2aa(codon):
- #stap1
- c = canonisch(codon)
- #stap2
- n = c.replace("G","0").replace("T","1").replace("C","2").replace("A","3")
- w1 = n[0]
- w2 = n[1]
- w3 = n[2]
- p = (int(w1) + 4 * int(w2) + 16 * int(w3)) % 25
- #stap3
- alfabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- return alfabet[p]
- def dna2eiwit(DNA):
- # codon bepalen
- str=""
- l = int(len(DNA))
- for i in range(0,l- 2):
- codon = DNA[i:i + 3]
- letter = codon2aa(codon)
- str += letter
- return str
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement