Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python 2. Write a function called list_codons which takes a single argument called orf (expected to be a string representing an ORF sequence). The purpose
Python
2. Write a function called list_codons which takes a single argument called orf (expected to be a string representing an ORF sequence). The purpose of this function is to produce a list of codons in the ORF. The function should perform the following tasks: a. Check if the provided string meets the minimum requirements of an ORF sequence. Specifically, call the possibly_orf function to perform this check. If possibly_orf function returns True, the function should continue to the next step, otherwise the function should return an empty list. b. Use a for loop with the help of Python's built-in range function to produce a list of codons in the orf. You will first need to create an empty list: codon_list = [] which will then be populated during the execution of the for loop. c. The function should return the populated codon_list. You can check if your function works correctly by running the following test cases. Notice the expected output. Your function should perform identically: In [1] : list_codons ('AGUAGGAUAAGAAGU') The first codon is not AUG. Out[1] : [] In [2] : list_codons ('AUGAGGAUAAGAUGA) The sequence is possibly an ORF. Out[2] : ['AUG', 'AGG', 'AUA', 'AGA', 'UGA'] 1. An RNA string is called an "open reading frame" (ORF) if it begins with the three-base codon AUG, ends with stop codons UGA, UAG, or UAA (remember, U replaces T in RNA), and has a length that is a multiple of three. ORFs are interesting because they can encode proteins. Write a function called possibly_orf which takes a single argument called rna (expected to be a string representing an RNA sequence). The purpose of this function is to determine if the provided RNA sequence is a valid ORF. The function should perform the following tasks: a. Check if the first three letters are AUG. If so, the function should continue to the next step, otherwise the function should print The first codon is not AUG. and return false. b. Check if the string ends with UGA, UAG, or UAA. If so, the function should continue to the next step, otherwise the function should print The last codon is not a stop codon. and return False. c. Check if the length of the string is a multiple of three. If so, the function should continue to the next step, otherwise the function should print The length of the sequence is not a multiple of three. and return false. d. If all three previous checks succeeded, the function should print The sequence is possibly an ORF. and return True. Note: the reason we do not say that the sequence is definitely an ORF is because there may be an additional stop codon that occurs before the very last codon. We are not checking for that here, but we will later in the course. You can check if your function works correctly by running the following test cases. Notice the expected output. Your function should perform identically: In [1] : possibly_orf ('AGUAGGAAGU') The first codon is not AUG. Out[1]: False In [2] : possibly_orf ('AUGAGGAAGU') The last codon is not a stop codon. Out [2] : False In [3] : possibly_orf ('AUGAGGAUAA') The length of the sequence is not a multiple of three. Out [3] : FalseStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started