Fields, Christopher J | 8 Nov 03:00 2013

Re: Parsing multi-record genbank file

A lot of problems in this one; try:

use Bio::SeqIO;
use Bio::Seq;

my $seqio_in = Bio::SeqIO->new(-file => "ls_orchid.gbk" , '-format' => 'genbank');
my $seqio_out = Bio::SeqIO->new(-file => '>sequence.fasta', -format => 'genbank' );

while ( my $seq = $seqio_in->next_seq ) {
    $seqio_out->write_seq($seq);
}

chris

On Nov 7, 2013, at 3:23 PM, Robert Johnson <robjohn7000 <at> gmail.com> wrote:

> Hi,
> 
> I would be happy if someone could help me get the following code to output
> the sequences (including the ids)  of all records in the input file (
> http://biopython.org/DIST/docs/tutorial/examples/ls_orchid.gbk):
> 
> use Bio::SeqIO;
> use Bio::Seq;
> use Bio::DB::GenBank;
> 
> $seq_obj = Bio::SeqIO->new(-file => "ls_orchid.gbk" , '-format' =>
> 'genbank');
> $seqio_obj2 = Bio::SeqIO->new(-file => '>sequence.fasta', -format =>
> 'genbank' );
> 
> while ( my $seq = $seq_obj->next_seq() ) {
> print "Sequence ",$seq->id ($seq_obj)"\n";
>  #print $seq_obj->seq,"\n";
> $seqio_obj2->write_seq($seq_obj);
> }
> 
> Thank you
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l <at> lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

Gmane