Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python DNA carries genetic instructions for the development, functioning, growth, and reproduction of all known organisms and many viruses. In this homework, you will perform
python
DNA carries genetic instructions for the development, functioning, growth, and reproduction 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 nuc 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 refurns 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 list, 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 randem.seed(199) in your code): How many random codorili do you want to generateli 25 'TTC", "CCT', +TCCHI Do you want to remove invadid codonn? fif there in anyit yes 4 Invalid todona are remoyed Which nucleotide(a) do you want to sesrebt anc Index(es) of the codon that you searched = 16 How nany random codofia do yay want. to genesatezis 20 Do you want to tenove invalid codona) (If therw in asyyit mo Which nueleatide(a) do you want to skarcht Indexien of the nuelectide (a) yea nearebed - [14,15) Step 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