Write a program that takes as input a DNA sequence from the command line and sea
ID: 3641625 • Letter: W
Question
Write a program that takes as input a DNA sequence from the command line and searches for an Ochre stop codon (TAA) in the sequence . If the subsequence TAA is found , your program should mark it in uppercase . The output of your program should be the same DNA sequence as the input, but with any TAA's (potential stop codons) in uppercase and the remainder of the sequence in lowercase . Make sure your program works correctly regardless of the case of the command line DNA input. You program should find TAA codons in any possible reading frame of the forward strand for the DNA input (you do not need to worry about looking at the reverse complement).Explanation / Answer
import sys
seq = sys.argv[-1]
seq = seq.lower()
seq_list = list(seq)
flag = 0
while flag == 0:
a = seq.find('taa')
if a != -1:
seq_list[a] = seq_list[a].upper()
seq_list[a+1] = seq_list[a+1].upper()
seq_list[a+2] = seq_list[a+2].upper()
seq = seq[a+3:]
else:
flag = 1
print ''.join(seq_list)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.