diff --git a/source/_static/code/restriction.py b/source/_static/code/restriction.py index f946de63bae8c2022c0f5444ed9635ec675a5553..cadc274e3b969b1ef8fbe148769c8d2312004660 100644 --- a/source/_static/code/restriction.py +++ b/source/_static/code/restriction.py @@ -46,12 +46,15 @@ def one_enz_all_binding_sites2(dna, enzyme): pos = dna.find(enzyme[2]) while pos != -1: if positions: - positions.append(pos) - else: - positions = pos + positions[-1] - new_seq = dna[pos + 1:] + # I have to compute the reeal position + # I add the actual position + the previous one + 1 because the new sequence start a 0 + pos = pos + positions[-1] + 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 = pos return positions @@ -75,3 +78,18 @@ def binding_sites(dna, enzymes): positions.sort(key=itemgetter(1)) 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") +