I'm trying to store and update multiple lists at same time. My lists here a positions in a string, i.e. <list-1>
will store the first position, <list_0>
will store the middle position and <list+1>
will store the last position in a three letter word. Since I'm using a rolling window, meaning that each list will store letters from multiple words in a sequence, it's really difficult to hard code everything, specially if the window length needs to be variable.
Essentially, what I want is something like this <for list0...listn>:<store/append character to list0 in string[0].....store/append character to listn in string s[n]>
Here is my code:
#http://stackoverflow.com/questions/6822725/rolling-or-sliding-window-iterator-in-python
def window(iterable, size):
iters = tee(iterable, size)
for i in range(1, size):
for each in iters[i:]:
next(each, None)
return zip(*iters)
if(wordlength == 3):
for each in window(temporary_string, wordlength):
temp = ''.join(each)
k = temp[0]
k = damino[k]
p_1.append(k)
t = temp[0]
p_1w.append(t)
k = temp[1]
k = damino[k]
p.append(k)
t = temp[1]
pw.append(t)
k = temp[2]
k = damino[k]
p1.append(k)
t = temp[2]
p1w.append(t)
word_list.append(temp)
For example, input string will be: ATGGAAE
Window size : 3
The output will be three arrays,
p-1|p|p+1
*|A|T
A|T|G
T|G|G
G|G|A
G|A|A
A|A|E
A|E|*