Murcia has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Monks (german:Hallo Brüder),
i have a little problem with BioPerl. I want to write a Tk-program that shows a complete swissProt entry in a text widget.
my $gb = new Bio::DB::SwissProt(); my $seq1 = $gb->get_Seq_by_Acc($id); my $seqOut = new Bio::SeqIO(-format=>'swiss'); $seqOut->write_seq($seq1);
The last line prints the swissprot entry in the dos-window, but I want to have the file in one variable, so that I later can insert it in a text-field of Tk?

How to get the stream ($seqOut->write_seq($seq1)) in a variable.

Thanks!
10 pater nostrum for you, if one can help me!

Replies are listed 'Best First'.
Re: bioperl seqIO STDOUT
by broquaint (Abbot) on May 07, 2003 at 16:02 UTC
    Taking a page out of tilly's big ol' book, you can perform some magic with IO::Scalar
    use IO::Scalar; tie *STDOUT, 'IO::Scalar', \my $output; print "foo", "bar", "baz"; warn "got - [$output]\n"; __output__ got - [foobarbaz]
    The above code was inspired by Re (tilly) 1: How to preserve the value of STDIN and bought to you by the sigil $.
    HTH

    _________
    broquaint

Re: bioperl seqIO STDOUT
by Anonymous Monk on May 07, 2003 at 17:30 UTC
    If you have not already done so, you should perhaps subscribe to the bioperl mailing list and post your query there. Subscription details, as well as Web Archives, can be found here.
Re: bioperl seqIO STDOUT
by tucano (Scribe) on Jun 10, 2004 at 14:31 UTC
    BioPerl is a object oriented module so: $qb = new Bio:: ... <- create a new object $seql -> $qb ... <- calling metods $seqOut = new <- this is another object NOW $sequence = $seqOut->method($seql); and you have your sequence in a variable