Bio::Annotation TypeManager
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::Annotation::TypeManager - Manages types for annotation collections
Package variables
No package variables defined.
Included modules
Bio::Root::Root
Inherit
Bio::Root::Root
Synopsis
    # default type manager
$tm = Bio::Annotation::TypeManager->new(); # $key is a string or a Bio::Ontology::TermI compliant object print "The type for $key is ",$tm->type_for_key($key),"\n"; if( !$tm->is_valid($key,$object) ) { $self->throw("Invalid object for key $key"); }
Description
Manages types for annotation collections.
Methods
_add_type_mapDescriptionCode
is_validDescriptionCode
newDescriptionCode
type_for_keyDescriptionCode
Methods description
_add_type_mapcode    nextTop
 Title   : _add_type_map
Usage :
Function:
Example :
Returns :
Args :
is_validcodeprevnextTop
 Title   : is_valid
Usage :
Function:
Example :
Returns :
Args :
newcodeprevnextTop
 Title   : new
Usage :
Function:
Example :
Returns :
Args :
type_for_keycodeprevnextTop
 Title   : type_for_key
Usage :
Function:
Example :
Returns :
Args :
Methods code
_add_type_mapdescriptionprevnextTop
sub _add_type_map {
   my ($self,$key,$type) = @_;
   
   $key = $key->name() if ref($key) && $key->isa("Bio::Ontology::TermI");
   $self->{'_type'}->{$key} = $type;
}
is_validdescriptionprevnextTop
sub is_valid {
   my ($self,$key,$object) = @_;

   if( !defined $object || !ref $object ) {
       $self->throw("Cannot type an object [$object]!");
   }

   if( !$object->isa($self->type_for_key($key)) ) {
       return 0;
   } else {
       return 1;
   }
}
newdescriptionprevnextTop
sub new {
   my ($class,@args) = @_;

   my $self = $class->SUPER::new(@args);

   $self->{'_type'} = {};

   $self->_add_type_map('reference',"Bio::Annotation::Reference");
   $self->_add_type_map('comment',"Bio::Annotation::Comment");
   $self->_add_type_map('dblink',"Bio::Annotation::DBLink");

   return $self;
}
type_for_keydescriptionprevnextTop
sub type_for_key {
   my ($self,$key) = @_;

   $key = $key->name() if ref($key) && $key->isa("Bio::Ontology::TermI");
   return $self->{'_type'}->{$key};
}
General documentation
FEEDBACKTop
Mailing ListsTop
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.
  bioperl-l@bio.perl.org
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution.
Bug reports can be submitted via email or the web:
  bioperl-bugs@bio.perl.org
http://bugzilla.bioperl.org/
AUTHOR - Ewan BirneyTop
Email birney@ebi.ac.uk
Describe contact details here
APPENDIXTop
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _