[Bioperl-l] Bio::Tools::Run::Alignment::ClustalW output redirect?

Sendu Bala bix at sendu.me.uk
Sun Jun 25 11:33:58 UTC 2006


Ryan Golhar wrote:
> I'm using Bio::Tools::Run::Alignment::ClustalW to generate some
> alignments and parsing the resulting alignments.
> 
> The ClustalW output is being sent to STDOUT.  Is there a way I can
> redirect the output to STDERR instead?
> 
> Here's how I'm using it:
> 
> my $aln_factory = Bio::Tools::Run::Alignment::Clustalw->new();
> my $aa_aln = $aln_factory->align(\@aa_seq);

You can suppress the output completely using
$aln_factory->quiet(1);

(supplying quiet => 1 to new() should also work according to the docs, 
but doesn't seem to be implemented, though I could be wrong)

If you really want the messages on STDERR you could try redirecting 
STDOUT to STDERR before calling align():
open(OLDOUT, ">&STDOUT");
open(STDOUT, ">&STDERR");
my $aa_aln = $aln_factory->align(\@aa_seq);
open(STDOUT, ">&OLDOUT");

I haven't tested either of these ideas, but I think they should both 
work - try them out and let us know.

Ideally there would be a saner way of doing this, but it isn't readily 
apparent to me.








More information about the Bioperl-l mailing list