How To Convert A Set Of Dna Sequences Into Protein Sequences Using Python Programming?
I am using python to create a program that converts a set of DNA sequences into amino acid (protein) sequences. I then need to find a specific subsequence, and count the number of
Solution 1:
You should read about Biopython
. It comes with handy functions and classes related to Biology and Bioinformatics.
It has a function that does what you are looking for: Bio.Seq.translate
Here you have code example:
>>>coding_dna = "GTGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG">>>translate(coding_dna)
'VAIVMGR*KGAR*'
>>>translate(coding_dna, stop_symbol="@")
'VAIVMGR@KGAR@'
>>>translate(coding_dna, to_stop=True)
'VAIVMGR'
Solution 2:
Using your codon chart and also accounting for stop codon. Here is a python one-liner:
print([gencode[i] for i in re.findall(r"[A-Z]{3}", re.sub("AUG(.+)","", input("DNA: ").translate(str().maketrans({"A":"U","T":"A","C":"G","G":"C"}))))])
Post a Comment for "How To Convert A Set Of Dna Sequences Into Protein Sequences Using Python Programming?"