[Bioperl-l] Bio::Annotations::Collection confusion

Jason Stajich jason at bioperl.org
Thu Apr 30 20:24:25 UTC 2009


Seems like you just want $annotation->value ?


=head2 as_text

  Title   : as_text
  Usage   : my $text = $obj->as_text
  Function: return the string "Value: $v" where $v is the value
  Returns : string
  Args    : none


=cut

=head2 display_text

  Title   : display_text
  Usage   : my $str = $ann->display_text();
  Function: returns a string. Unlike as_text(), this method returns a  
string
            formatted as would be expected for te specific  
implementation.

            One can pass a callback as an argument which allows custom  
text
            generation; the callback is passed the current instance  
and any text
            returned
  Example :
  Returns : a string
  Args    : [optional] callback

=cut

=head2 value

  Title   : value
  Usage   : $obj->value($newval)
  Function: Get/Set the value for simplevalue
  Returns : value of value
  Args    : newvalue (optional)


=cut

On Apr 30, 2009, at 1:01 PM, Kevin Brown wrote:

> That's nice in some regards, but makes it hard to use the function in
> code without having to always process the result, which seems to be
> counter to what one would expect.
>
> E.g. Bio::Seq->seq returns the sequence, not "Seq: sequence".
>
> Is there a better way to get the number directly without having to  
> strip
> off the text that never existed in the first place?
>
>> -----Original Message-----
>> From: Scott Markel [mailto:SMarkel at accelrys.com]
>> Sent: Thursday, April 30, 2009 12:57 PM
>> To: Kevin Brown; BioPerl List
>> Subject: RE: Bio::Annotations::Collection confusion
>>
>> Kevin,
>>
>> I believe the extra text was added for readability when printing
>> to the console.  In our code we just add the following post-
>> processing step.
>>
>>        (my $text = $annotation->as_text()) =~ s/(Comment|Value): //;
>>
>> Scott
>>
>> Scott Markel, Ph.D.
>> Principal Bioinformatics Architect  email:  smarkel at accelrys.com
>> Accelrys (SciTegic R&D)             mobile: +1 858 205 3653
>> 10188 Telesis Court, Suite 100      voice:  +1 858 799 5603
>> San Diego, CA 92121                 fax:    +1 858 799 5222
>> USA                                 web:    http://www.accelrys.com
>>
>> http://www.linkedin.com/in/smarkel
>> Vice President, Board of Directors:
>>    International Society for Computational Biology
>> Co-chair: ISCB Publications Committee
>> Associate Editor: PLoS Computational Biology
>> Editorial Board: Briefings in Bioinformatics
>>
>>
>>> -----Original Message-----
>>> From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-
>>> bounces at lists.open-bio.org] On Behalf Of Kevin Brown
>>> Sent: Thursday, 30 April 2009 12:27 PM
>>> To: BioPerl List
>>> Subject: [Bioperl-l] Bio::Annotations::Collection confusion
>>>
>>> So, I'm parsing Genbank sequences to pull out the various
>> exons. I found
>>> the way to get the NCBI Exon number from each feature, but
>> am confused
>>> about one of the methods. When I do annotation->as_text I'm
>> expecting to
>>> get back 1 from the feature, but instead get back Value: 1
>> ??!? Why is
>>> the value from the NCBI file getting that text tagged onto it?
>>>
>>> http://www.ncbi.nlm.nih.gov/nuccore/73622129
>>> exon            1..774
>>>                /gene="BOLA2"
>>>                /gene_synonym="BOLA2A; My016"
>>>                /inference="alignment:Splign"
>>>                /number=1
>>>
>>> print ($f->annotation->get_Annotations('number'))[0]->as_text;
>>> Value: 1
>>>
>>> _______________________________________________
>>> Bioperl-l mailing list
>>> Bioperl-l at lists.open-bio.org
>>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

Jason Stajich
jason at bioperl.org






More information about the Bioperl-l mailing list