Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

programming pyhton DNA carries genetic instructions for the development, functioning, growth, and refroduction of all known organisms and many viruses. In this homework, you will

programming pyhton
image text in transcribed
image text in transcribed
image text in transcribed
DNA carries genetic instructions for the development, functioning, growth, and refroduction of all known organisms and many viruses. In this homework, you will perform basic operations on DNA codons, such as generating random DNA sequences, extracting index(es) of the desired nucleotide(s), and removing the invalid ones. Below are the detailed instructions for the functions you should write. 1. generate_random_codons ( n, nuc_list) This function requires two parameters: n : The number of codons to randomly generate nuc_list: A nucleotide list that contains characters of nucleotides desired, such as ['A','C','T','G'] This function will randomly select the characters in the muc_list to construct DNA codons (length =3 ) n times, store them in the list, and return the list. 2. remove_invalid (codon_list, invalid_codons) This function requires two parameters: codon_list: A list of codons that the invalid codons will be removed from invalid_codons: This is a list which includes invalid codons. While writing your program, use the following invalid codon list: invalid_codons = ['GGA',GGT,'GGG,'GGC',GCA',GCT, 'GCC,'GCG'] The function first asks to the user if (s)he wants to remove the invalid codons. If the answer's first letter is " y " or " Y ", the function removes the invalid codons from the list (if there is any). If there is no invalid codon in the list, print a message accordingly. The function also shows how many codons are removed. Then, the updated list must be returned by the function. 3. extract_seq_index (codon_list, desired_seq) This function requires two parameters: codon_list: A list of codons that a desired codon's index is extracted from desired_seq: Nucleotide(s) that will be searched in the codon list This function takes a list of codons and returns the list of index(es) of the desired nucleotide(s). 4. main 0 - Firstly, nucleotide list must be defined ([A;, C;T,G]). - Get from the user an integer input: the number of random codons. - Generate the random codon list by calling generate_random_codons function. - Ask if the user wants to remove the invalid codons. If invalid codons exist and the user wants to remove them, they are removed from randomly created list. And the number of codons removed is printed. - Then, the desired nucleotide sequence is asked to the user and if it is found in the hist, the function prints the list of index(es). Here you need to use updated list (the list after you remove the invalid ones). Sample Outputs (to get the same outputs, use random.seed(199) in your code): How many random codons do you want to generate?: 25 'ACC', 'CAN', 'AGA', 'ARC', 'CAC', 'ACA', 'GFC', 'OOS', 'GAC', 'AAC', 'TIT', 'OZA', 'TTC', 'GCT', 'TOC'I Do you vant to renove invalid eodons? (If there is any) I yes 4 invalid codons are renoved Current codon 11st - I'TOY', 'TAG', "TTC\%, 'TCA', 'GTC', 'TAG', "CTT', 'TAR', 'ACC', 'GAA', 'AGA', 'ATC', 'CAG', 'ACA', 'CTC', 'CAC', 'AAC', 'TTI', 'CTA', 'TTC', 'TOC'' which nueleotide(s) do you want to search: AMG Index (es) of the codon that you searched - [16] How many random codons do you want to generate?: 12 Codon list = ['TGT', 'TAG', 'TTC', 'TGA', 'GGC', 'GCT', 'GTG', 'TAG', 'CTT', 'TAA', 'ACC', 'GAA'] Do you want to remove invalid codons? (If there is any) : YEs 2 invalid codons are removed Current codon list = ''TGG', 'TAG', 'TTC', 'TGA', 'GTG', 'TAG', 'CTT', 'TAA', 'ACC', 'GAA'] Which nucleotide (s) do you want to search: GCTT There is no such codon in the list! How many random codons do you want to generate?: 4 Codon 1ist = ['TGT', 'TAG', 'TTC', 'TGA') Do you want to remove invalid codone? (If there is any) : yes There is no invalid codon in the listl Current codon 11st=[ 'TGT', 'TAG', 'TTC', 'TGA'] Which nucleotide (s) do you want to search: G Index (es) of the codon that you searched =[0,1,3] Save your program as hw07yoursurname.py. Upload your file to Blackboard at "Homework 7. Make sure you place comments in your program. Place your name, ID as comments at the top. You should only use the features and commands you have learnt until this homework was given. You are especially not allowed to use BREAK, CONTINIUE, QUIT or any other statement that prematurely stops a loop or your program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions