ciao giorgio, temo che a breve dovro' studiarmelo.... grazie per la segnalazione
On Sun, Nov 26, 2017 at 11:34 AM, Giorgio Zoppi <giorgio.zo...@gmail.com> wrote: > Io userei el automa di aho corasick. > In Bioinformatics si usa tanto. > http://carshen.github.io/data-structures/algorithms/2014/04/07/aho-corasick-implementation-in-python.html > > > 2017-11-26 10:20 GMT+01:00 Giuseppe Costanzi <giuseppecosta...@gmail.com>: >> >> salve a tutti, >> >> ho una sequenza del tipo >> >> ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT >> >> scorrendola devo trovare una sequenza target GAATTC >> >> ACTGATCGATTACGTATAGTA "GAATTC" TATCATACATATATATCGATGCGTTCAT >> >> >> quindi dividere la sequenza da G, la prima lettera della sequenza target, >> e calcolarmi la lunghezza dei due frammenti risultanti >> >> ACTGATCGATTACGTATAGTAG >> >> e di questa >> >> GAATTCTATCATACATATATATCGATGCGTTCAT >> >> io avrei fatto >> >> seq = "ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT" >> target = "GAATTCT" >> >> s = [] >> >> for i,base in enumerate(seq): >> >> s.append(base) >> >> if len(s)==8: >> >> s.pop(0) >> >> if ''.join(s) == target: >> print i-5 >> print len(seq)-(i-5) >> break >> >> funziona ma non e' che ne sia proprio convinto, >> avete suggerimenti su come iterare la sequenza? >> >> saluti >> beppe >> >> >> p.s. >> >> e' un esercizio che ho trovato su p4b, python for biologist >> >> >> "Let's start this exercise by solving the problem manually. If we look >> through the >> DNA sequence we can spot the EcoRI site at position 21. Here's the >> sequence with >> the base positions labelled above and the EcoRI motif in bold: >> >> in bold sarebbe questa GAATTCT >> >> 0123456789012345678901234567890123456789012345678901234 >> ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT >> Since the EcoRI enzyme cuts the DNA between the G and first A, we can >> figure out >> that the first fragment will run from position 0 to position 21, and the >> second >> fragment from position 22 to the last position, 54. Therefore the >> lengths of the two >> fragments are 22 and 33." >> _______________________________________________ >> Python mailing list >> Python@lists.python.it >> https://lists.python.it/mailman/listinfo/python > > > > _______________________________________________ > Python mailing list > Python@lists.python.it > https://lists.python.it/mailman/listinfo/python > _______________________________________________ Python mailing list Python@lists.python.it https://lists.python.it/mailman/listinfo/python