Question
[EC1-7] ( gene.py ) Write a program that reads a string from the user. This string represents a DNA molecule as a sequence of letters
[EC1-7] (gene.py) Write a program that reads a string from the user. This string represents a DNA molecule as a sequence of letters A, C, G, and T, each letter representing a different base. Then determine whether it represents a potential gene, if it satisfies the following 4-part codon criteria:
It begins with the start codon ATG.
Its length is a multiple of 3.
It ends with one of the stop codons TAG, TAA, or TGA.
It has no intervening stop codons, anywhere in the codon sequence between the first and last codons.
Do so by defining a Boolean function is_gene(dna) that returns True when dna is valid DNA and it satisfies each of the codon criteria.
Also define a Boolean function is_valid_DNA(seq) that returns True if each character in seq is one of A, C, G, or T. Otherwise return False.
Then complete your program: use your is_valid_DNA(seq) function to validate the input string seq's contents, printing Not valid DNA if it contains any characters other than one of A, C, G, and T. Otherwise, check it via your is_gene() function and print Is potential gene if it satisfies the previous 4-part codon criteria, and Is NOT potential gene otherwise.
Finally, if the input string is not valid DNA or violates the 4-part codon criteria, print out some kind of diagnostic information that describes details on why it's not valid. This information might describe why the contents are invalid DNA, such as which bases are illegal and at what sequence position they occur. For the 4-part codon criteria, it might be a description such as "Doesn't start with ATG" or "Length isn't a multiple of 3", and so forth. I will award additional credit for diagnostic output that is detailed, accurate, and nicely formatted.
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