Question: A DNA sequence is formed by the nucleotides A , T , G , and C . A triplet of nucleotides in such a sequence

A DNA sequence is formed by the nucleotides A,T,G, and C. A triplet of
nucleotides in such a sequence is called a codon.
(a) Write a program that takes a DNA string as input and prints the codons present in
the sequence. For example, for the sequence given below:
Input sequence: ATGGGTAACGTAAGCTAGTAACG
Output Codons: ATG, GGT, AAC, GTA, AGC, TAG
(b) Write a program that calculates the frequency of each codon in a DNA sequence.
[Hint: The program creates a list of codons by slicing the DNA sequence into triplets
(every 3 characters) using a list comprehension. The range is set to len(dna_sequence)
-2 to ensure that only complete triplets are extracted. Each codons frequency is then
computed as its count divided by the total number of codons.]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!