[Bioperl-l] Retrieving Comments field from GenBank file usin SeqIO?

Jamie Hatfield jamie@genome.arizona.edu
Tue, 5 Nov 2002 13:06:10 -0700

> [mailto:bioperl-l-admin@bioperl.org] On Behalf Of Dere, Ed
> Is there a method to retrieve the Comments field from a GenBank file?

use Bio::SeqIO;

my $in     = Bio::SeqIO->new(-file=>"yourfile.gb", -format=>"genbank");
my $seq    = $in->next_seq();
my @values = $seq->annotation()->get_Annotations('comment');
print "Comment = ", $values[0]->as_text(), "\n";

$seq is a Bio::Seq.  $seq->annotation is a Bio::Annotation::Collection.
Bio::Annotation::Collection->get_Annotations('comment') returns a list
of Bio::Annotation::SimpleValue objects, which have ->as_text() methods.

Jamie Hatfield                              Room 541H, Marley Building
Systems Programmer                          University of Arizona
Arizona Genomics Computational              Tucson, AZ  85721
  Laboratory (AGCoL)                        (520) 626-9598