[Bioperl-l] seq to fasta
Hilmar Lapp
hlapp at gmx.net
Sun May 23 18:24:03 EDT 2004
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
>
>
--
-------------------------------------------------------------
Hilmar Lapp email: lapp at gnf.org
GNF, San Diego, Ca. 92121 phone: +1-858-812-1757
-------------------------------------------------------------
More information about the Bioperl-l
mailing list