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

Hilmar Lapp hlapp@gnf.org
Tue, 5 Nov 2002 17:17:44 -0800


Note that $ann->as_text() is neither required to return the whole information nor to return the correctly formatted one (i.e., there may be text added or cut). The method to call for Bio::Annotation::Comment objects is text().


	-hilmar

> -----Original Message-----
> From: Jamie Hatfield [mailto:jamie@genome.arizona.edu]
> Sent: Tuesday, November 05, 2002 12:06 PM
> To: 'Dere, Ed'; bioperl-l@bioperl.org
> Subject: RE: [Bioperl-l] Retrieving Comments field from GenBank file
> usin SeqIO?
> 
> 
> > [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
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>