title: Python: How to print out sequences with length n from sliding window in FASTA file?
body: <p>I have a fasta file with few sequences and I would like to perform sliding windows of window size 5 and extract the sequences whenever it sweeps through the sequence.<br><br> For example ( test1.fasta ):     <br>     >human1
  <br>ATCGCGTC<BR>>human2<br>ATTTTCGCGA<br><br>Expected output ( test1_out.txt ):<br>>human1<br>ATCGC<br>>human1<br>TCGCG<br>>human1<br>CGCGT<br>>human1<br>GCGTC<br>>human2<br>ATTTT<br>>human2<br>TTTTC<br>>human2<br>TTTCG<br>>human2<br>TTCGC<br>>human2<br>TCGCG<br>>human2<br>CGCGA<br><br>My following code only able to extract the first five base pairs. How can I shift the window to extract 5 bp for every step size of 1 with window size 5?</p>
  
  <pre><code>from Bio import SeqIO
  
  with open("test1_out.txt","w") as f:
              for seq_record in SeqIO.parse("test1.fasta", "fasta"):
  
              f.write(str(seq_record.id) + "\n")
              f.write(str(seq_record.seq[:5]) + "\n")  #first 5 base positions
  </code></pre>
  
  <p>Above code I got it from other example in stackoverflow*</p>