Python 3 provides a powerful yet easy to use tool to translate DNA sequences to amino acid sequences. below is one of the methods that one can use to translate a DNA sequence to amino-acid sequences:
note: codons are triplets of nucleotides that correspond to amino acids [except for stop codons]
one can find codon tables on-line : LINK
below is an example of 3 codons that code for different amino acids:
ATG codes for Methionine [Met]
GTT codes for Valine [Val]
GCG codes for Alanine [Ala]
So, the idea is that, the user enters a DNA sequence and you would like to see if there is occurrences of any of the three codons above. Once your software encounters anyone of them, directly changes it to the corresponding amino acid.
Example of User entry: "ATGGTTGCG"
In Python 3 IDLE, type the following commands:
>>> DNA = "ATGGTTGCG" # this is a variable that holds user entry
>>> Triplets = ([DNA[start:start+3] for start in range(0,len(DNA),3)]) # a command that changes user entry into arranged codons from codon position one.
>>> for i in Triplets: print(i, end = ',') # press enter, twice to see your codons.
ATG,GTT,GCG,
>>> for i in Triplets: # a for loop to iterate through the previous variable i.e Triplets
if (i == "ATG"): print("MET", end = ',')
elif (i == "GTT"): print("Val", end = ',')
elif (i == "GCG"): print("Ala", end = ',') # press enter, twice
MET,Val,Ala,
___________________________________________________________________________
was this helpful, somehow ??
note: codons are triplets of nucleotides that correspond to amino acids [except for stop codons]
one can find codon tables on-line : LINK
below is an example of 3 codons that code for different amino acids:
ATG codes for Methionine [Met]
GTT codes for Valine [Val]
GCG codes for Alanine [Ala]
So, the idea is that, the user enters a DNA sequence and you would like to see if there is occurrences of any of the three codons above. Once your software encounters anyone of them, directly changes it to the corresponding amino acid.
Example of User entry: "ATGGTTGCG"
In Python 3 IDLE, type the following commands:
>>> DNA = "ATGGTTGCG" # this is a variable that holds user entry
>>> Triplets = ([DNA[start:start+3] for start in range(0,len(DNA),3)]) # a command that changes user entry into arranged codons from codon position one.
>>> for i in Triplets: print(i, end = ',') # press enter, twice to see your codons.
ATG,GTT,GCG,
>>> for i in Triplets: # a for loop to iterate through the previous variable i.e Triplets
if (i == "ATG"): print("MET", end = ',')
elif (i == "GTT"): print("Val", end = ',')
elif (i == "GCG"): print("Ala", end = ',') # press enter, twice
MET,Val,Ala,
___________________________________________________________________________
was this helpful, somehow ??
No comments:
Post a Comment