i want locations of the substring given by the recognition sequence in the genome. wrote a function which pass through the sequence and store the indices where we match the recognition sequence but its returning empty conatiner. the sequence looks like
ATCGGCGCGCGCGCGTATATATATATATATAGGCGCGCGCGCGCGTATATATATATATAGCGGCGCGCGCGCG
def restriction_sites(seq, recog_seq):
"""Find the indices of all restriction sites in a sequence."""
#here variable "seq" contains fasta sequence and "recog_seq" contains recognition sequence
# Initialize list of restriction sites
sites = []
# Check every substring for a match
for i in range(len(seq) - len(recog_seq)):
if seq[i:i+len(recog_seq)] == recog_seq:
sites.append(i)
return sites
when i run it like this:
print('HindIII:', restriction_sites(seq, 'AAGCTT'))
it shows me empty:
[]
i want output like this
HindIII: [23129, 25156, 27478, 36894, 37458, 37583, 44140]