[Python] Iterare una sequenza

Giuseppe Costanzi giuseppecostanzi a gmail.com
Dom 26 Nov 2017 11:41:43 CET


ciao Christian,
che dire... spettacolare!!!!;

On Sun, Nov 26, 2017 at 11:25 AM, Christian Barra <barrachri a gmail.com>
wrote:

> In pseudo code
>
> seq = "ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT"
>     ...:
>     ...: def finder(seq, target):
>     ...:     len_target = len(target)
>     ...:     i = 0
>     ...:     while i+len_target < len(seq):
>     ...:         yield seq[i:i+len_target], i
>     ...:         i += 1
> Il check per == lo puoi inserire all’interno del finder o fuori.
>
> ——
> Christian Barra
> Python Freelancer // Consultant // Trainer
> Board member of the EuroPython Society
> www.chrisbarra.xyz
>
> On 26 Nov 2017, at 10:42, Giuseppe Costanzi <giuseppecostanzi a gmail.com>
> wrote:
>
> ciao carlo,
>
> si, interessante ma vorrei iterare la sequenza mano a mano,
>
> stavo pensando a qualcosa tipo
>
> next(iterator, default)
>
> grazie comunque
>
>
>
> On Sun, Nov 26, 2017 at 10:30 AM, Carlo Miron <miron a python.it> wrote:
>
> On Sun, Nov 26, 2017 at 10:20 AM, Giuseppe Costanzi
> <giuseppecostanzi a gmail.com> wrote:
>
> 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
>
>
> qualcosa tipo
>
> seq = "ACTGATCGATTACGTATAGTAGAATTCTATCATACATATATATCGATGCGTTCAT"
> target = "GAATTCT"
> first, second = seq.split(target, 1)
> first += target[1]
> second = target[1:] + second
> len(first), len(second)
>
> (22, 33)
>
> ?
>>
> --
> |:**THE 🍺-WARE LICENSE** *(Revision ㊷)*:
> | <miron@🐍.it <miron a xn--4n8h.it>> wrote this mail. As long as you
> retain this
> | notice you can do whatever you want with this stuff.
> | If we meet some day, and you think this stuff is worth it,
> | you can buy me a 🍺 in return. —㎝
> _______________________________________________
> Python mailing list
> Python a lists.python.it
> https://lists.python.it/mailman/listinfo/python
>
> _______________________________________________
> Python mailing list
> Python a lists.python.it
> https://lists.python.it/mailman/listinfo/python
>
>
>
> _______________________________________________
> Python mailing list
> Python a lists.python.it
> https://lists.python.it/mailman/listinfo/python
>
>
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.python.it/pipermail/python/attachments/20171126/3ad3948e/attachment-0001.html>


Maggiori informazioni sulla lista Python