I am trying to adjust how far the window slides in a sliding window. I see that there are a lot of posts about sliding windows on SO, however, I can’t seem to find a post that explains how to adjust how far the distance the sliding window slides. I am also not necessarily interested in chunking or only adjusting window size (1,2).
As an example If I had a string of six characters
seq = 'ATCGAC'
If I set the window size to 1 and I want the window to slide over 2 characters per step. I would want the following output:
Expected output:
['A', 'C', 'A']
Another example, if I have the same string and want to set the window size to 3 and the window to slide over 3 characters at a time. I would want the following output:
Expected output:
['ATC', 'GAC']
As a final example, a window size with a long string. With a sliding window size of 3 and adjusting the slide to slide over 6 characters at a time:
seq = 'ATCGACATCGACATCGAC'
Expected output:
['ATC', 'ATC', 'ATC']