Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PYTHON Biologists use a sequence of lettersA, C, T, and G to model a genome. A g

ID: 3704743 • Letter: P

Question

PYTHON

Biologists use a sequence of lettersA, C, T, and G to model a genome. A gene is a substring of a genome that starts after a triplet ATG and ends before a triplet TAG, TAA, or TGA . Furthermore, the length of a gene string is a multiple of 3 and the gene does not conta in any of the triplets ATG, TAG, TAA, and TGA.

Write a program that prompts the user to enter a genome and displays all genes in the genome. If no gene is found in the input sequence, the program displays no gene is found. Here are the sample runs:

>>>

========== RESTART: E:/HW3/HW3_4_genes.py ==========

Enter a genome string: TTATGTTTTAAGGATGGGGCGTTAGTT

TTT

GGGCGT

Enter a genome string: TGTGTGTATAT

no gene is found

>>>

Test with 4 more genome strings.

TGATGCTCTAAGGATGCGCCGTTGATT

TGATGCTCTAGAGATGCGCCGTTGAATAT

TGATGCGTCTAAGAGACTGCTCGCCGGTTGAATAT

TGATGGCTCCTATGAGAATGGCGCCCGTTTCGAAATAT

Explanation / Answer

Please find the Python code snippet under below ..............just run the python file ........

/////////////////////////////////////////////////////////////////////HW3_4_genes.py//////////////////////////////////////////////////////////////////////////////////

def main():
print("Please Enter The Required genome string : ")
InputString=input();

i=0
found=0
start=-1
num=len(InputString)
for i in range(num-2):
triplet=InputString[i:i+3]
if triplet=="ATG":
start=i+3
elif triplet=="TAG" or triplet=="TAA" or triplet=="TGA" and start!=-1:
gene=InputString[start:i]
if len(gene)%3==0:
found=1

print(gene)
start=-1

if found==0:
print("no gene is found")
main()

If any Queires or doubts juss ping me.......Happy Coding!!