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

fix the second implenetation of get_all_binding_sites

parent dd840dd8
No related branches found
No related tags found
No related merge requests found
Pipeline #157915 passed
...@@ -46,12 +46,15 @@ def one_enz_all_binding_sites2(dna, enzyme): ...@@ -46,12 +46,15 @@ def one_enz_all_binding_sites2(dna, enzyme):
pos = dna.find(enzyme[2]) pos = dna.find(enzyme[2])
while pos != -1: while pos != -1:
if positions: if positions:
positions.append(pos) # I have to compute the reeal position
else: # I add the actual position + the previous one + 1 because the new sequence start a 0
positions = pos + positions[-1] pos = pos + positions[-1] + 1
new_seq = dna[pos + 1:] positions.append(pos)
# I start to search from the actual position to the end
# i'm searching from the next base
pos = pos + 1
new_seq = dna[pos:]
pos = new_seq.find(enzyme[2]) pos = new_seq.find(enzyme[2])
pos = pos
return positions return positions
...@@ -75,3 +78,18 @@ def binding_sites(dna, enzymes): ...@@ -75,3 +78,18 @@ def binding_sites(dna, enzymes):
positions.sort(key=itemgetter(1)) positions.sort(key=itemgetter(1))
return positions return positions
dna_1 = """tcgcgcaacgtcgcctacatctcaagattcagcgccgagatccccgggggtt
gagcgatccccgtcagttggcgtgaattcagcagcagcgcaccccgggcgtagaattccagtt
gcagataatagctgatttagttaacttggatcacagaagcttccagaccaccgtatggatccc
aacgcactgttacggatccaattcgtacgtttggggtgatttgattcccgctgcctgccagg""".replace('\n', '')
ecor1 = ("EcoRI", "Ecoli restriction enzime I", "gaattc", 1, "sticky")
ecor5 = ("EcoRV", "Ecoli restriction enzime V", "gatatc", 3, "blunt")
bamh1 = ("BamHI", "type II restriction endonuclease from Bacillus amyloliquefaciens", "ggatcc", 1, "sticky")
hind3 = ("HindIII", "type II site-specific nuclease from Haemophilus influenzae", "aagctt", 1, "sticky")
taq1 = ("TaqI", "Thermus aquaticus", "tcga", 1, "sticky")
not1 = ("NotI", "Nocardia otitidis", "gcggccgc", 2, "sticky")
sau3a1 = ("Sau3aI", "Staphylococcus aureus", "gatc", 0, "sticky")
hae3 = ("HaeIII", "Haemophilus aegyptius", "ggcc", 2, "blunt")
sma1 = ("SmaI", "Serratia marcescens", "cccggg", 3, "blunt")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment