[Biopython] Mafft Alignment Output file

Peter biopython at maubp.freeserve.co.uk
Mon Nov 29 21:35:19 UTC 2010


On Mon, Nov 29, 2010 at 8:51 PM, Ömer AN <bounlu at gmail.com> wrote:
>
> How can i write alignment output to a file?
> I can actually see the alignment when i use the command
>
> print stdout
>
> on the shell, but how can i make it write on a file?
>
> Thanks in advance

If you have the alignment in the string stdout, you can save it
to a file just like saving any data to a text file in Python:

handle = open("output.txt", "w")
handle.write(stdout)
handle.close()

Most command line tools will write the file themselves rather
than printing the output to screen (stdout), or give you the
choice. It looks like MAFFT only writes to stdout - which
could be redirected to a file, but I think the above is clearer.

Peter




More information about the Biopython mailing list