View Single Post
Old 01-24-2017, 11:26 PM   #3
wdecoster
Member
 
Location: Antwerp, Belgium

Join Date: Oct 2015
Posts: 97
Default

Now you are writing here a literal "fasta" string on the end of every line. I doubt whether that's what you have in mind. What about this?


Code:
from Bio import SeqIO

out = open("try_out.fasta", "a")
for seq_record in SeqIO.parse("try.fasta", "fasta"):
    out.write(seq_record[5:-6].format("fasta"))
out.close()
Note that I changed the "w" in open() to "a" (for append) because you don't want to overwrite the previous record every time again in the loop, right?
wdecoster is offline   Reply With Quote