Skip to content
Snippets Groups Projects
Verified Commit a5c2a361 authored by Bertrand  NÉRON's avatar Bertrand NÉRON
Browse files

add2nd implementation for one_enz_all_binding_sites

parent 779fff97
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,28 @@ def one_enz_all_binding_sites(dna, enzyme):
return positions
def one_enz_all_binding_sites2(dna, enzyme):
"""
:param dna: the dna sequence to search enzyme binding sites
:type dna: str
:param enzyme: the enzyme to looking for
:type enzyme: a namedtuple RestrictEnzyme
:return: all positions of enzyme binding sites in dna
:rtype: list of int
"""
positions = []
pos = dna.find(enzyme.sequence)
while pos != -1:
if positions:
positions.append(pos)
else:
positions = pos + positions[-1]
new_seq = dna[pos + 1:]
pos = new_seq.find(enzyme.sequence)
pos = pos
return positions
def binding_sites(dna, enzymes):
"""
return all positions of all enzymes binding sites present in dna
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment