[BioPython] SeqIO.write() Multiple Calls for fasta

Peter biopython at maubp.freeserve.co.uk
Sun Dec 14 18:58:01 EST 2008


Hi Matthew,

I've CC'ed your replay back to the mailing list.

On Sun, Dec 14, 2008 at 10:39 PM, Matthew Strand <stran104 at chapman.edu> wrote:
> I see, you both are right, this is not a SeqIO.write() issue. I should have
> created the empty files and then used the append ('a') mode instead of the
> write ('w') mode to add records to the file since the 'w' mode will
> overwrite the file.

I think using "a" for append will create the file if it does not
already exist.  Be careful if you run your script more than once - you
may get multiple entries in each output file!

> The way I interpreted the documentation was that it was safe to call
> SeqIO.write() multiple times on the same file without overwriting it. And as
> you both have shown, this is safe, as long as the right mode is used.
>
> Thank you for your responses and your time.

I hope it helped :)

Good night.

Peter


More information about the BioPython mailing list