if you have a list of values:
values=['130','90','150','123','133','120','160','45','67','55','34','130','120','180','130','10']
and wanted to scan through with a window size of 6 and if 4 out of the 6 were >= 100 then keep scanning until there were 3 in a row that were < 100 and then not include those in the list
so for example with an empty list called results:
results=[]
i would like to append those values that satisfied the criteria into the empty list to get
results=[('130','90','150','123','133','120','160'),('55','34','130','120','180','130','10')]
i know i have convert all the strings into integers with int() but that's not the part that i'm having trouble with. i'm having trouble finding the 4 out of the window size 6 that are >= 100, adding that to a list, AND THEN going from where i left off in the window
In the Chou Fasman Algorithm each window size is 6 and if 4 are greater than 100 then all 6 are included and its extended until 4 consecutive values (i'm going to do 3 instead) are less than 100 (those 4 (or 3) are not included) and then the window starts again from that spot making a new list.
so first window would be:
['130','90','150','123','133,'120'] #and more than 4 are greater than 100 so that starting point is stored and the next window is checked
['90','150','123','133','120','160'] #again there are 4 greater than 100 so the next window is checked
['150','123','133','120','160','45'] #again
['123','133','120','160','45','67'] #again
['133','120','160','45','67','55'] #stop and assign values '130' to '160' into a list and then start the new window from where it left off
Results=[('130','90','150','123','133','120','160')]
['120','160','45','67','55','34'] # skips
['160','45','67','55','34','130'] # skips
['45','67','55','34','130','120'] # skips
['67','55','34','130','120','180'] # skips
['55','34','130','120','180','130'] # new list in Results starts with '55'
['34','130','120','180','130','10'] # sequence ends and this window still fits criteria so include these into the list so the results would now be
Results=[('130','90','150','123','133','120','160'),('55','34','130','120','180','130','10')]
I'd really like stay clear of yields and generators if possible
For questions related to programming you should consider them posting at stackoverflow.
Can you give the question some biological relevance? I suspect there is some application, but you can see that without mentioning it our edification suffers, and the moderators get pissed off (and close your question).
Albeit not very prominently, the question does mention the Chou-Fasman method, so I don't see it as being particularly off topic.
@xenophiliuslovegood: In that case we should open a new forum to discuss programming issues related to bioinformatics. ;)