Thanks a.zielezinski. I'll take a closer look at your suggestion.
I modified the code a bit, using Biopython to read the flie. But it's cuting the file off and I"m not sure at what bp position, but it's not finishing the file. I think it's because the size of the file (in bp) is not divisible by 500. So, I tried to tell it to break when it hits the negative number it would hit (I realize that this is bad practice, but this is for testing purposes at the moment), but it's still not printing it.
from Bio import SeqIO
for record in SeqIO.parse("ex.fasta", "fasta"):
v = record.seq
def sliding_window(sequence, winSize, step):
numOfChunks = ((len(sequence)-winSize)/step)+1
for i in range(0,numOfChunks*step,step):
yield sequence[i:i+winSize]
size = 14820
m = 500
for line in v:
myvect = sliding_window(v, m, m)
for r in myvect:
print(r)
size -= m
if size <= -180:
break
Suggestions on this current piece of code is appreciated.
I really didn't get your question but you can concatenate multiple lines to make a complete sequence. See here:A: multiline fasta to single line fasta
Thanks Ashutosh, but i'm in the middle of learning python. I'd like to stay away from one-liners and perl, and keep it all to a single script.