[Bioperl-l] capture of STDOUT from write_seq?

Neil Saunders neil.saunders at unsw.edu.au
Tue Feb 8 20:47:54 EST 2005


dear all,

I'm using Bio::SeqIO to pipe fasta sequences to an external program 
(hmmtop), as follows:

while(my $seqin = $seqio->next_seq) {
my $seqout = Bio::SeqIO->new('-file' => "| hmmtop -if=-- -sf=FAS -pi=spred -is=pseudo", '-format' => 'Fasta');
$seqout->write_seq($seqin);


This works nicely and spits out the 1 line STDOUT from hmmtop for each 
sequence.  What I would really like to do is capture the STDOUT as a 
variable in my Perl script.  I've read numerous Perl docs (e.g. the FAQ 
on capturing STDERR/STDOUT, perlipc, use of backticks versus open versus 
system and so on), but I'm unclear on how these relate to the example 
above.  Is there some cunning bioperl-specific way of directing STDOUT 
from an external call to a perl variable, perhaps via a filehandle?

your help much appreciated,
Neil
-- 
 School of Biotechnology and Biomolecular Sciences,
 The University of New South Wales,
 Sydney 2052,
 Australia

http://psychro.bioinformatics.unsw.edu.au/neil/index.php


More information about the Bioperl-l mailing list