[Bioperl-l] seq to fasta

tex at biosysadmin.com tex at biosysadmin.com
Sun May 23 19:33:32 EDT 2004


Dear Stephan,

Instead of this:
   my $out = Bio::SeqIO->new(-fh => ">$io",
                             -format => 'Fasta');

Try this:

   my $out = Bio::SeqIO->new(-fh => $io,
                             -format => 'Fasta');

See Question 2.4 on the FAQ at http://bioperl.org for more information.

Tex Thompson
RIT Bioinformatics

> Hi,
> thx Hilmar but no luck for me.
> I made somthing wrong...?
>
>
> sub test($)
> {
>          use Bio::SeqIO;
>          use IO::String;
>          my $io = IO::String->new();
>          my $out = Bio::SeqIO->new(-fh => ">$io",
>                                   -format => 'Fasta');
>          $out->write_seq($_);
>          my $erg = $io;
> }
>
> result:
> Can't use string (">IO::String=GLOB(0x106c2018)") as a symbol ref while
> "strict refs" in use at
> /xprog/perl/perl-5.9.1_inst/lib/site_perl/5.9.1/IP27-irix/Bio/Root/IO.pm
> line 407.
>
> sorry... i'm a newbie -
>
> regards,
> stephan
>
>
>
>
> Hilmar Lapp wrote:
>  > Use IO::String to create a stream that writes to a string, pass it to
>  > SeqIO using -fh, call $out->write_seq($seq), and then print the string
>  > used for creating the stream.
>  >
>  >     -hilmar
>  >
>  > On Sunday, May 23, 2004, at 03:17  PM, stephan rosecker wrote:
>  >
>  >> Hi,
>  >> is it possible to get the fasta format from a seqobject-sequence in a
>  >> variable without using filhandles like below ?
>  >>
>  >> use Bio::SeqIO;
>  >>   $in  = Bio::SeqIO->new(-file => "inputfilename",
>  >>                          -format => 'EMBL');
>  >>   $out = Bio::SeqIO->new(-file => ">outputfilename",
>  >>                          -format => 'Fasta');
>  >>   while ( my $seq = $in->next_seq() ) {$out->write_seq($seq); }
>  >>
>  >> e.g:
>  >> I've a seqobject ($seq).
>  >> and this is what i want:
>  >>
>  >> my $fastavar = $seq->seq_fastaformat();
>  >> print $fastavar;
>  >>
>  >> result:
>  >> >sp|P32234|128U_DROME GTP-binding protein 128UP - Drosophila
>  >> melanogaster (Fruit fly).
>  >> MITILEKISAIESEMARTQKNKATSAHLGLLKANVAKLRRELISPKGGGGGTGEAGFEVA
>  >> KTGDARVGFVGFPSVGKSTLLSNLAGVYSEVAAYEFTTLTTVPGCIKYKGAKIQLLDLPG
>  >> IIEGAKDGKGRGRQVIAVARTCNLIFMVLDCLKPLGHKKLLEHELEGFGIRLNKKPPNIY
>  >> YKRKDKGGINLNSMVPQSELDTDLVKTILSEYKIHNADITLRYDATSDDLIDVIEGNRIY
>  >> IPCIYLLNKIDQISIEELDVIYKIPHCVPISAHHHWNFDDLLELMWEYLRLQRIYTKPKG
>  >> QLPDYNSPVVLHNERTSIEDFCNKLHRSIAKEFKYALVWGSSVKHQPQKVGIEHVLNDED
>  >> VVQIVKKV
>  >>
>  >> regards,
>  >> stephan
>  >> _______________________________________________
>  >> Bioperl-l mailing list
>  >> Bioperl-l at portal.open-bio.org
>  >> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>  >>
>  >>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>



More information about the Bioperl-l mailing list