[Bioperl-l] Parsing multi-record genbank file

Fields, Christopher J cjfields at illinois.edu
Thu Nov 7 21:00:18 EST 2013


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




More information about the Bioperl-l mailing list