Hello pythoners, I have a string that I want to read in fixed-length windows.
In [68]: SEQ Out[68]: 'MKAAVLTLAVLFLTGSQARHFWQQDEPPQSPWDRVKDLATVYVDVLKDSGRDYVSQFEGSALGKQLNLKLLDNWDSVTSTFSKLREQLGPVTQEFWDNLEKETEGLRQEMSKDLEEVKAKVQPYLDDFQKKWQEEMELYRQKVEPLRAELQEGARQKLHELQEKLSPLGEEMRDRARAHVDALRTHLAPYSDELRQRLAARLEALKENGGARLAEYHAKATEHLSTLSEKAKPALEDLRQ' I would like a function that reads the above string, 21 characters at a time, and checks for certain conditions, i.e. whether characters co-occur in other lists I have made. For example: x = 21 # WINDOW LENGTH In [70]: SEQ[0:x] Out[70]: 'MKAAVLTLAVLFLTGSQARHF' In [71]: SEQ[x:2*x] Out[71]: 'WQQDEPPQSPWDRVKDLATVY' In [72]: SEQ[2*x:3*x] Out[72]: 'VDVLKDSGRDYVSQFEGSALG' How could I write a function to automate this so that it does this from SEQ[0] throughout the entire sequence, i.e. until len(SEQ)? Many thanks for your time, Spyros
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor