[Biopython] example request for using stdin and stdout with 'needle' in EMBOSS
Peter
biopython at maubp.freeserve.co.uk
Sat Feb 20 01:20:06 UTC 2010
On Fri, Feb 19, 2010 at 1:58 PM, Brad Chapman <chapmanb at 50mail.com> wrote:
> Li;
>
>> Wonder if anyone can provide an example for using needle but take stdin as
>> input and stdout as output within biopython.
>> I did like this, but it doesn't work.
You are trying to use stdin for two separate inputs - but the way
the command line works, there is only one stdin, and it can't be
used twice. There are named pipes on Unix like systems, but
I'm not sure how they can be used via Python.
Brad wrote:
> For Emboss commandline options that take two different inputs, like
> needle, I don't know of a way to pass them in via standard input.
> My approach would be to write to a temporary file for the input
> sequences. A fully worked example is here ...
Another useful trick for *short* single sequences is the EMBOSS
"asis" file type. You can give a "filename" like "asis:ACGTGGGT"
which means use the sequence "ACGTGGGT" as the input.
i.e. If you want to do one against many, I would try giving the
one single sequence using "asis" and the many via stdin.
Note that long sequences via "asis" may fail, depending on your
OS and its limit for command line strings.
Also note that for an "asis" input sequence, the sequence is
given an ID of just the four letter string "asis" (if I recall
correctly).
Peter
More information about the Biopython
mailing list