[Bioperl-l] capturing AlignIO output

Jason Stajich jason@cgt.mc.duke.edu
Mon, 2 Dec 2002 13:35:48 -0500 (EST)


#!/usr/bin/perl -w
use IO::String;
use Bio::AlignIO;

my $in = new Bio::AlignIO(-file => 'msa_seqs.aln',
			  -format => 'clustalw');

my $iostr = new IO::String;
my $out = new  Bio::AlignIO(-fh => $iostr,
			    -format => 'msf');

$out->write_aln($in->next_aln);

print "str is ", ${$iostr->string_ref}, "\n";


Jason Stajich
Duke University
jason at cgt.mc.duke.edu

On Mon, 2 Dec 2002, James Wasmuth wrote:

> Hi all,
>
> not sure this is specifically a bioperl question or more general Perl.
>  Anyway, I am trying to capture the text output from
> $stream->write_aln($alignment) into a string, so that I can pattern
> search it
>
> I've tried all sorts of avenues, but not the correct one.
>
> Any ideas?
> Many Thanks
>
> James
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>