TATA-Pribnow box: Motifs TATAAA or TATAAT of six nucleotides, known as TATA boxes, are an essential part of a promoter site on DNA for transcription to occur. Write a Python program that finds all the TATA boxes in a DNA sequence and reports their types and locations. If there is no such a box, your program should report that as well. Test your program on several DNA sequences with none, and with several TATA boxes of both types. Please use input for DNA sequence and use while and if-else statements.
#function which prints occurence of TATA boxes of both types if
found as list of indices(starting index) where found
def find(DNA):
#list of TATA boxes
l=['TATAAA', 'TATAAT']
#create empty list for both tata boxes to store indices of
occurence
ans=[[], []]
#for all kind of TATA boxes
#traverse the DNA sequence
i=0
while i<len(l):
j=0
#traverse the sequence
while j<(len(DNA)-5):
#sequence starting from i of length 6
sub=DNA[j:j+6]
if sub==l[i]:
ans[i].append(j)
j+=1
i+=1
#if not found any
if(len(ans[0])==0 and len(ans[1])==0):
print("No tata boxes found in the DNA sequence!")
#otherwise
else:
k=0
while k<len(l):
if len(ans[k])>0:
print(l[k]+" found at : ",*ans[k])
k+=1
#return
return
#test DNA sequence
DNA=input()
find(DNA)
TACAAAAG No tata boxes found in the DNA sequence!
TATAATTATATA TATAAT found at : 0
TATAAAATATAAAGTATAAT TATAAA found at : 0 7 TATAAT found at : 14
CODE
INPUT/OUTPUT
So if you have any dobt rgearding this explanation please feel free to ask it in the comment section below and if it is helpful then please upvote this solution, THANK YOU.
Get Answers For Free
Most questions answered within 1 hours.