NAME
Bio::Annotation::Collection - Default Perl implementation of AnnotationCollectionI
SYNOPSIS
# get an AnnotationCollectionI somehow, eg$ac = $seq->annotation();foreach $key ( $ac->get_all_annotation_keys() ) {@values = $ac->get_Annotations($key);foreach $value ( @values ) {# value is an Bio::AnnotationI, and defines a "as_text" methodprint "Annotation ",$key," stringified value ",$value->as_text,"\n";# also defined hash_tree method, which allows data orientated# access into this object$hash = $value->hash_tree();}}
DESCRIPTION
Bioperl implementation for Bio::AnnotationCollectionI
FEEDBACK
Mailing Lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated.
[email protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web:
https://github.com/bioperl/bioperl-live/issues
AUTHOR - Ewan Birney
Email [email protected]
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : newUsage : $coll = Bio::Annotation::Collection->new()Function: Makes a new Annotation::Collection object.Returns : Bio::Annotation::CollectionArgs : none
Bio::AnnotationCollectionI implementing methods
get_all_annotation_keys
Title : get_all_annotation_keysUsage : $ac->get_all_annotation_keys()Function: gives back a list of annotation keys, which are simple text stringsReturns : list of stringsArgs : none
get_Annotations
Title : get_AnnotationsUsage : my @annotations = $collection->get_Annotations('key')Function: Retrieves all the Bio::AnnotationI objects for one or morespecific key(s).If no key is given, returns all annotation objects.The returned objects will have their tagname() attribute set tothe key under which they were attached, unless the tagname wasalready set.Returns : list of Bio::AnnotationI - empty if no objects stored for a keyArgs : keys (list of strings) for annotations (optional)
get_nested_Annotations
Title : get_nested_AnnotationsUsage : my @annotations = $collection->get_nested_Annotations('-key' => \@keys,'-recursive => 1);Function: Retrieves all the Bio::AnnotationI objects for one or morespecific key(s). If -recursive is set to true, traverses the nestedannotation collections recursively and returns all annotationsmatching the key(s).If no key is given, returns all annotation objects.The returned objects will have their tagname() attribute set tothe key under which they were attached, unless the tagname wasalready set.Returns : list of Bio::AnnotationI - empty if no objects stored for a keyArgs : -keys => arrayref of keys to search for (optional)-recursive => boolean, whether or not to recursively traverse thenested annotations and return annotations with matching keys.
get_all_Annotations
Title : get_all_AnnotationsUsage :Function: Similar to get_Annotations, but traverses and flattens nestedannotation collections. This means that collections in thetree will be replaced by their components.Keys will not be passed on to nested collections. I.e., if thetag name of a nested collection matches the key, it will beflattened in its entirety.Hence, for un-nested annotation collections this will be identicalto get_Annotations.Example :Returns : an array of L<Bio::AnnotationI> compliant objectsArgs : keys (list of strings) for annotations (optional)
get_num_of_annotations
Title : get_num_of_annotationsUsage : my $count = $collection->get_num_of_annotations()Function: Returns the count of all annotations stored in this collectionReturns : integerArgs : none
Implementation specific functions - mainly for adding
add_Annotation
Title : add_AnnotationUsage : $self->add_Annotation('reference',$object);$self->add_Annotation($object,'Bio::MyInterface::DiseaseI');$self->add_Annotation($object);$self->add_Annotation('disease',$object,'Bio::MyInterface::DiseaseI');Function: Adds an annotation for a specific key.If the key is omitted, the object to be added must provide a valuevia its tagname().If the archetype is provided, this and future objects added underthat tag have to comply with the archetype and will be rejectedotherwise.Returns : noneArgs : annotation key ('disease', 'dblink', ...)object to store (must be Bio::AnnotationI compliant)[optional] object archetype to map future storage of objectof these types to
remove_Annotations
Title : remove_AnnotationsUsage :Function: Remove the annotations for the specified key from this collection.Example :Returns : an array Bio::AnnotationI compliant objects which were storedunder the given key(s)Args : the key(s) (tag name(s), one or more strings) for which toremove annotations (optional; if none given, flushes allannotations)
flatten_Annotations
Title : flatten_AnnotationsUsage :Function: Flattens part or all of the annotations in this collection.This is a convenience method for getting the flattenedannotation for the given keys, removing the annotation forthose keys, and adding back the flattened array.This should not change anything for un-nested collections.Example :Returns : an array Bio::AnnotationI compliant objects which were storedunder the given key(s)Args : list of keys (strings) the annotation for which to flatten,defaults to all keys if not given
Bio::AnnotationI methods implementations
This is to allow nested annotation: you can use a collection as anannotation object for an annotation collection.
as_text
Title : as_textUsage :Function: See L<Bio::AnnotationI>Example :Returns : a stringArgs : none
display_text
Title : display_textUsage : my $str = $ann->display_text();Function: returns a string. Unlike as_text(), this method returns a stringformatted as would be expected for te specific implementation.One can pass a callback as an argument which allows custom textgeneration; the callback is passed the current instance and any textreturnedExample :Returns : a stringArgs : [optional] callback
hash_tree
Title : hash_treeUsage :Function: See L<Bio::AnnotationI>Example :Returns : a hash referenceArgs : none
tagname
Title : tagnameUsage : $obj->tagname($newval)Function: Get/set the tagname for this annotation value.Setting this is optional. If set, it obviates the need toprovide a tag to Bio::AnnotationCollectionI when addingthis object. When obtaining an AnnotationI object from thecollection, the collection will set the value to the tagunder which it was stored unless the object has a tagstored already.Example :Returns : value of tagname (a scalar)Args : new value (a scalar, optional)
Backward compatible functions
Functions put in for backward compatibility with old Bio::Annotation.pm stuff
description
Title : descriptionUsage :Function:Example :Returns :Args :
add_gene_name
Title : add_gene_nameUsage :Function:Example :Returns :Args :
each_gene_name
Title : each_gene_nameUsage :Function:Example :Returns :Args :
add_Reference
Title : add_ReferenceUsage :Function:Example :Returns :Args :
each_Reference
Title : each_ReferenceUsage :Function:Example :Returns :Args :
add_Comment
Title : add_CommentUsage :Function:Example :Returns :Args :
each_Comment
Title : each_CommentUsage :Function:Example :Returns :Args :
add_DBLink
Title : add_DBLinkUsage :Function:Example :Returns :Args :
each_DBLink
Title : each_DBLinkUsage :Function:Example :Returns :Args :
Implementation management functions
_typemap
Title : _typemapUsage : $obj->_typemap($newval)Function:Example :Returns : value of _typemapArgs : newvalue (optional)