[Biopython] Piping in and out of clustal

Peter Cock p.j.a.cock at googlemail.com
Thu Mar 28 16:28:37 UTC 2013


On Thu, Mar 28, 2013 at 4:13 PM, Ivan Gregoretti <ivangreg at gmail.com> wrote:
> Indeed, from the command line I pipe in and out of clustal regularly.
> I do it like this:
>
> zcat input_big.fa.gz | clustalo -i /dev/stdin -o /dev/stdout | pigz -9
>> output_big.fa.gz
>
> This suggestion of yours "stdout,stderr = clustalo_cline(stdin)" is
> what I am looking for.
>
> Would some good-hearted Biopythonian around the world share a code
> snippet using this strategy? I'm curious to see how people pass one by
> one their SeqRecords to properly formatted strings in memory. I'm
> guessing that it is a very common task.
>
> Anyone?

You will probably want/need the StringIO module for preparing input
or using the output (i.e. going between strings and handles).

There are some more complicated examples using alignment tools
via the subprocess module in the Tutorial - trying to avoid temp
files and large strings in memory.

Peter



More information about the Biopython mailing list