Skip to content
Browse files

merge Brian Osborne commits from HEAD to 1.5.1 branch

svn path=/bioperl-live/branches/bioperl-branch-1-5-1/; revision=9357
  • Loading branch information...
1 parent 3fb811a commit b9bdd262ac4f5a08383d9005288870d1e496ab2e @hyphaltip hyphaltip committed Oct 13, 2005
View
16 Bio/Ontology/DocumentRegistry.pm
@@ -28,7 +28,7 @@ Allows lookups by name.
=head1 DESCRIPTION
-Don't use this directly, use Bio::Ontology::OntologyStore instead.
+Do not use this directly, use Bio::Ontology::OntologyStore instead.
Bio::Ontology::OntologyStore uses Bio::Ontology::DocumentRegistry to
load and cache ontologies as object graphs, you can just ask it for
what you want by name. See L<Bio::Ontology::OntologyStore> for
@@ -120,15 +120,15 @@ sub new {
=item Usage
- my $singleton = Bio::Ontology::DocumentRegistry->get_instance();
+my $singleton = Bio::Ontology::DocumentRegistry->get_instance();
=item Function
constructor
=item Returns
-the Bio::Ontology::DocumentRegistry singleton.
+The Bio::Ontology::DocumentRegistry singleton.
=item Arguments
@@ -148,23 +148,25 @@ sub get_instance {
=item Usage
- my($ontology_url, $definitions_url, $format) = $obj->documents('Sequence Ontology');
+my($ontology_url, $definitions_url, $format) = $obj->documents('Sequence Ontology');
=item Function
- maps an ontology name to a list of (local or) remote URIs where the files can be located.
+Maps an ontology name to a list of (local or) remote URIs where the files
+can be located.
=item Returns
- a 3-item list:
+A 3-item list:
(1) URI for the ontology file
(2) URI for the ontology definitions file
(3) format of the files (dagedit, obo, etc)
=item Arguments
- name of an ontology, e.g. 'Sequence Ontology', or 'Cellular Component (Gene Ontology)'
+Name of an ontology, e.g. 'Sequence Ontology', or 'Cellular Component
+(Gene Ontology)'
=back
View
15 Bio/Ontology/GOterm.pm
@@ -108,11 +108,12 @@ use constant FALSE => 0;
=head2 new
Title : new
- Usage : $term = Bio::Ontology::GOterm->new( -go_id => "GO:0016847",
- -name => "1-aminocyclopropane-1-carboxylate synthase",
- -definition => "Catalysis of ...",
- -is_obsolete => 0,
- -comment => "" );
+ Usage : $term = Bio::Ontology::GOterm->new(
+ -go_id => "GO:0016847",
+ -name => "1-aminocyclopropane-1-carboxylate synthase",
+ -definition => "Catalysis of ...",
+ -is_obsolete => 0,
+ -comment => "" );
Function: Creates a new Bio::Ontology::GOterm.
Returns : A new Bio::Ontology::GOterm object.
Args : -go_id => the goid of this GO term [GO:nnnnnnn]
@@ -168,8 +169,6 @@ sub init {
} # init
-
-
=head2 GO_id
Title : GO_id
@@ -262,8 +261,6 @@ sub remove_secondary_GO_ids {
} # remove_secondary_GO_ids
-
-
=head2 to_string
Title : to_string()
View
29 Bio/Ontology/Ontology.pm
@@ -294,10 +294,11 @@ sub close{
Function: Get/set the ontology engine to which all the query methods
delegate.
Example :
- Returns : an object implementing L<Bio::Ontology::OntologyEngineI>
+ Returns : an object implementing Bio::Ontology::OntologyEngineI
Args : on set, new value (an object implementing
- L<Bio::Ontology::OntologyEngineI>, or undef)
+ Bio::Ontology::OntologyEngineI, or undef)
+See L<Bio::Ontology::OntologyEngineI>.
=cut
@@ -364,7 +365,7 @@ sub add_term{
Title : add_relationship
Usage : add_relationship(RelationshipI relationship): RelationshipI
- add_relatioship(TermI subject, TermI predicate, TermI object)
+ add_relatioship(TermI subject, TermI predicate, TermI object)
Function: Adds a relationship object to the ontology engine.
Example :
Returns : Its argument.
@@ -425,7 +426,7 @@ sub get_relationships {
=head2 get_predicate_terms
Title : get_predicate_terms
- Usage : get_predicate_terms(): TermI[]
+ Usage : get_predicate_terms(): TermI
Function: Retrieves all relationship types.
Example :
Returns : Array of TermI objects
@@ -444,7 +445,7 @@ sub get_predicate_terms{
=head2 get_child_terms
Title : get_child_terms
- Usage : get_child_terms(TermI term, TermI[] predicate_terms): TermI[]
+ Usage : get_child_terms(TermI term, TermI predicate_terms): TermI
Function: Retrieves all child terms of a given term, that satisfy a
relationship among those that are specified in the second
argument or undef otherwise. get_child_terms is a special
@@ -472,7 +473,7 @@ sub get_child_terms{
=head2 get_descendant_terms
Title : get_descendant_terms
- Usage : get_descendant_terms(TermI term, TermI[] rel_types): TermI[]
+ Usage : get_descendant_terms(TermI term, TermI rel_types): TermI
Function: Retrieves all descendant terms of a given term, that
satisfy a relationship among those that are specified in
the second argument or undef otherwise.
@@ -498,7 +499,7 @@ sub get_descendant_terms{
=head2 get_parent_terms
Title : get_parent_terms
- Usage : get_parent_terms(TermI term, TermI[] predicate_terms): TermI[]
+ Usage : get_parent_terms(TermI term, TermI predicate_terms): TermI
Function: Retrieves all parent terms of a given term, that satisfy a
relationship among those that are specified in the second
argument or undef otherwise. get_parent_terms is a special
@@ -526,7 +527,7 @@ sub get_parent_terms{
=head2 get_ancestor_terms
Title : get_ancestor_terms
- Usage : get_ancestor_terms(TermI term, TermI[] predicate_terms): TermI[]
+ Usage : get_ancestor_terms(TermI term, TermI predicate_terms): TermI
Function: Retrieves all ancestor terms of a given term, that satisfy
a relationship among those that are specified in the second
argument or undef otherwise.
@@ -552,15 +553,14 @@ sub get_ancestor_terms{
=head2 get_leaf_terms
Title : get_leaf_terms
- Usage : get_leaf_terms(): TermI[]
+ Usage : get_leaf_terms(): TermI
Function: Retrieves all leaf terms from the ontology. Leaf term is a
term w/o descendants.
Example : @leaf_terms = $obj->get_leaf_terms()
Returns : Array of TermI objects.
Args :
-
=cut
sub get_leaf_terms{
@@ -577,15 +577,14 @@ sub get_leaf_terms{
=head2 get_root_terms()
Title : get_root_terms
- Usage : get_root_terms(): TermI[]
+ Usage : get_root_terms(): TermI
Function: Retrieves all root terms from the ontology. Root term is a
term w/o descendants.
Example : @root_terms = $obj->get_root_terms()
Returns : Array of TermI objects.
Args :
-
=cut
sub get_root_terms{
@@ -602,7 +601,7 @@ sub get_root_terms{
=head2 get_all_terms
Title : get_all_terms
- Usage : get_all_terms: TermI[]
+ Usage : get_all_terms: TermI
Function: Retrieves all terms from the ontology.
We do not mandate an order here in which the terms are
@@ -613,7 +612,6 @@ sub get_root_terms{
Returns : Array of TermI objects.
Args :
-
=cut
sub get_all_terms{
@@ -646,7 +644,6 @@ sub get_all_terms{
-identifier query by the given identifier
-name query by the given name
-
=cut
sub find_terms{
@@ -672,7 +669,6 @@ sub find_terms{
compliant object)
Args :
-
=cut
sub relationship_factory{
@@ -692,7 +688,6 @@ sub relationship_factory{
compliant object)
Args :
-
=cut
sub term_factory{
View
44 Bio/Ontology/OntologyEngineI.pm
@@ -31,14 +31,14 @@ OntologyEngineI - Interface a minimal Ontology implementation should satisfy
=head1 DESCRIPTION
This describes the minimal interface an ontology query engine should
-provide. It intentionally doesn't make explicit references to the
+provide. It intentionally does not make explicit references to the
ontology being a DAG, nor does it mandate that the ontology be a
vocabulary. Rather, it tries to generically express what should be
accessible (queriable) about an ontology.
The idea is to allow for different implementations for different
purposes, which may then differ as to which operations are efficient
-and which aren't, and how much richer the functionality is on top of
+and which are not, and how much richer the functionality is on top of
this minimalistic set of methods. Check modules in the Bio::Ontology
namespace to find out which implementations exist. At the time of
writing, there is a SimpleOntologyEngine (which does not use
@@ -104,7 +104,6 @@ use Bio::Root::RootI;
Returns : its argument.
Args : object of class TermI.
-
=cut
sub add_term{
@@ -120,7 +119,6 @@ sub add_term{
Returns : Its argument.
Args : A RelationshipI object.
-
=cut
sub add_relationship{
@@ -134,8 +132,8 @@ sub add_relationship{
Function: Adds a relationshiptype object to the ontology engine.
Example :
Returns : 1 on success, undef on failure
- Args : The name(scalar) of the relationshiptype, and the OntologyI it is to be added to.
-
+ Args : The name(scalar) of the relationshiptype, and the OntologyI
+ it is to be added to.
=cut
@@ -152,7 +150,6 @@ sub add_relationship_type{
Returns : A RelationshipTypeI object.
Args : The name (scalar) of the RelationshipTypeI object desired.
-
=cut
sub get_relationship_type{
@@ -162,15 +159,14 @@ sub get_relationship_type{
=head2 get_relationships
Title : get_relationships
- Usage : get_relationships(TermI term): RelationshipI[]
+ Usage : get_relationships(TermI term): RelationshipI
Function: Retrieves all relationship objects from this ontology engine,
or all relationships of a term if a term is supplied.
Example :
Returns : Array of Bio::Ontology::RelationshipI objects
Args : None, or a Bio::Ontology::TermI compliant object for which
to retrieve the relationships.
-
=cut
sub get_relationships{
@@ -180,13 +176,12 @@ sub get_relationships{
=head2 get_predicate_terms
Title : get_predicate_terms
- Usage : get_predicate_terms(): TermI[]
+ Usage : get_predicate_terms(): TermI
Function:
Example :
Returns :
Args :
-
=cut
sub get_predicate_terms{
@@ -196,7 +191,7 @@ sub get_predicate_terms{
=head2 get_child_terms
Title : get_child_terms
- Usage : get_child_terms(TermI term, TermI[] predicate_terms): TermI[]
+ Usage : get_child_terms(TermI term, TermI predicate_terms): TermI
Function: Retrieves all child terms of a given term, that satisfy a
relationship among those that are specified in the second
argument or undef otherwise. get_child_terms is a special
@@ -208,7 +203,6 @@ sub get_predicate_terms{
Args : First argument is the term of interest, second is the list
of relationship type terms.
-
=cut
sub get_child_terms{
@@ -218,7 +212,7 @@ sub get_child_terms{
=head2 get_descendant_terms
Title : get_descendant_terms
- Usage : get_descendant_terms(TermI term, TermI[] rel_types): TermI[]
+ Usage : get_descendant_terms(TermI term, TermI rel_types): TermI
Function: Retrieves all descendant terms of a given term, that
satisfy a relationship among those that are specified in
the second argument or undef otherwise.
@@ -227,7 +221,6 @@ sub get_child_terms{
Args : First argument is the term of interest, second is the list
of relationship type terms.
-
=cut
sub get_descendant_terms{
@@ -237,7 +230,7 @@ sub get_descendant_terms{
=head2 get_parent_terms
Title : get_parent_terms
- Usage : get_parent_terms(TermI term, TermI[] predicate_terms): TermI[]
+ Usage : get_parent_terms(TermI term, TermI predicate_terms): TermI
Function: Retrieves all parent terms of a given term, that satisfy a
relationship among those that are specified in the second
argument or undef otherwise. get_parent_terms is a special
@@ -249,7 +242,6 @@ sub get_descendant_terms{
Args : First argument is the term of interest, second is the list
of relationship type terms.
-
=cut
sub get_parent_terms{
@@ -259,7 +251,7 @@ sub get_parent_terms{
=head2 get_ancestor_terms
Title : get_ancestor_terms
- Usage : get_ancestor_terms(TermI term, TermI[] predicate_terms): TermI[]
+ Usage : get_ancestor_terms(TermI term, TermI predicate_terms): TermI
Function: Retrieves all ancestor terms of a given term, that satisfy
a relationship among those that are specified in the second
argument or undef otherwise.
@@ -269,7 +261,6 @@ sub get_parent_terms{
Args : First argument is the term of interest, second is the list
of relationship type terms.
-
=cut
sub get_ancestor_terms{
@@ -279,15 +270,14 @@ sub get_ancestor_terms{
=head2 get_leaf_terms
Title : get_leaf_terms
- Usage : get_leaf_terms(): TermI[]
+ Usage : get_leaf_terms(): TermI
Function: Retrieves all leaf terms from the ontology. Leaf term is a
term w/o descendants.
Example : @leaf_terms = $obj->get_leaf_terms()
Returns : Array of TermI objects.
Args :
-
=cut
sub get_leaf_terms{
@@ -297,15 +287,14 @@ sub get_leaf_terms{
=head2 get_root_terms
Title : get_root_terms
- Usage : get_root_terms(): TermI[]
+ Usage : get_root_terms(): TermI
Function: Retrieves all root terms from the ontology. Root term is a
term w/o ancestors.
Example : @root_terms = $obj->get_root_terms()
Returns : Array of TermI objects.
Args :
-
=cut
sub get_root_terms{
@@ -329,7 +318,6 @@ sub get_root_terms{
compliant object)
Args :
-
=cut
sub relationship_factory{
@@ -349,7 +337,6 @@ sub relationship_factory{
compliant object)
Args :
-
=cut
sub term_factory{
@@ -368,7 +355,7 @@ sub term_factory{
=head2 get_all_terms
Title : get_all_terms
- Usage : get_all_terms: TermI[]
+ Usage : get_all_terms: TermI
Function: Retrieves all terms from the ontology.
This is more a decorator method. We provide a default
@@ -388,7 +375,6 @@ sub term_factory{
Returns : Array of TermI objects.
Args :
-
=cut
sub get_all_terms{
@@ -424,7 +410,6 @@ sub get_all_terms{
-identifier query by the given identifier
-name query by the given name
-
=cut
sub find_terms{
@@ -443,7 +428,7 @@ sub find_terms{
=head1 Experimental API method proposals
- Ontologies are a very new domain in bioperl, and we aren't sure yet
+ Ontologies are a very new domain in bioperl, and we are not sure yet
what we will want to do on and with ontologies in which
situation. The methods from here on downwards are solely API
descriptions to solicit comment and feedback; the chance of any of
@@ -490,7 +475,6 @@ sub find_terms{
is treated as a boolean that, if TRUE, means that the two paths
must have identical predicates in order to be returned.
-
=cut
sub common_ancestor_path{
View
35 Bio/Ontology/OntologyI.pm
@@ -99,7 +99,6 @@ use Bio::Ontology::OntologyEngineI;
Returns : value of name (a scalar)
Args :
-
=cut
sub name{
@@ -123,7 +122,6 @@ sub name{
Returns : value of authority (a scalar)
Args :
-
=cut
sub authority{
@@ -147,7 +145,6 @@ sub authority{
Returns : value of identifier (a scalar)
Args :
-
=cut
sub identifier{
@@ -163,7 +160,6 @@ sub identifier{
Returns : value of definition (a scalar)
Args :
-
=cut
sub definition{
@@ -183,7 +179,6 @@ sub definition{
Returns : TRUE on success and FALSE otherwise
Args : none
-
=cut
sub close{
@@ -212,7 +207,6 @@ just the name and description ...
Returns : its argument.
Args : object of class TermI.
-
=cut
=head2 add_relationship
@@ -224,21 +218,19 @@ just the name and description ...
Returns : Its argument.
Args : A RelationshipI object.
-
=cut
=head2 get_relationships
Title : get_relationships
- Usage : get_relationships(TermI term): RelationshipI[]
+ Usage : get_relationships(TermI term): RelationshipI
Function: Retrieves all relationship objects from this ontology engine,
or all relationships of a term if a term is supplied.
Example :
Returns : Array of Bio::Ontology::RelationshipI objects
Args : None, or a Bio::Ontology::TermI compliant object for which
to retrieve the relationships.
-
=cut
=head2 get_predicate_terms
@@ -250,13 +242,12 @@ just the name and description ...
Returns :
Args :
-
=cut
=head2 get_child_terms
Title : get_child_terms
- Usage : get_child_terms(TermI term, TermI[] predicate_terms): TermI[]
+ Usage : get_child_terms(TermI term, TermI predicate_terms): TermI
Function: Retrieves all child terms of a given term, that satisfy a
relationship among those that are specified in the second
argument or undef otherwise. get_child_terms is a special
@@ -268,13 +259,12 @@ just the name and description ...
Args : First argument is the term of interest, second is the list
of relationship type terms.
-
=cut
=head2 get_descendant_terms
Title : get_descendant_terms
- Usage : get_descendant_terms(TermI term, TermI[] rel_types): TermI[]
+ Usage : get_descendant_terms(TermI term, TermI rel_types): TermI
Function: Retrieves all descendant terms of a given term, that
satisfy a relationship among those that are specified in
the second argument or undef otherwise.
@@ -283,13 +273,12 @@ just the name and description ...
Args : First argument is the term of interest, second is the list
of relationship type terms.
-
=cut
=head2 get_parent_terms
Title : get_parent_terms
- Usage : get_parent_terms(TermI term, TermI[] predicate_terms): TermI[]
+ Usage : get_parent_terms(TermI term, TermI predicate_terms): TermI
Function: Retrieves all parent terms of a given term, that satisfy a
relationship among those that are specified in the second
argument or undef otherwise. get_parent_terms is a special
@@ -301,13 +290,12 @@ just the name and description ...
Args : First argument is the term of interest, second is the list
of relationship type terms.
-
=cut
=head2 get_ancestor_terms
Title : get_ancestor_terms
- Usage : get_ancestor_terms(TermI term, TermI[] predicate_terms): TermI[]
+ Usage : get_ancestor_terms(TermI term, TermI predicate_terms): TermI
Function: Retrieves all ancestor terms of a given term, that satisfy
a relationship among those that are specified in the second
argument or undef otherwise.
@@ -317,41 +305,38 @@ just the name and description ...
Args : First argument is the term of interest, second is the list
of relationship type terms.
-
=cut
=head2 get_leaf_terms
Title : get_leaf_terms
- Usage : get_leaf_terms(): TermI[]
+ Usage : get_leaf_terms(): TermI
Function: Retrieves all leaf terms from the ontology. Leaf term is a
term w/o descendants.
Example : @leaf_terms = $obj->get_leaf_terms()
Returns : Array of TermI objects.
Args :
-
=cut
=head2 get_root_terms()
Title : get_root_terms
- Usage : get_root_terms(): TermI[]
+ Usage : get_root_terms(): TermI
Function: Retrieves all root terms from the ontology. Root term is a
term w/o descendants.
Example : @root_terms = $obj->get_root_terms()
Returns : Array of TermI objects.
Args :
-
=cut
=head2 get_all_terms
Title : get_all_terms
- Usage : get_all_terms: TermI[]
+ Usage : get_all_terms: TermI
Function: Retrieves all terms from the ontology.
We do not mandate an order here in which the terms are
@@ -362,7 +347,6 @@ just the name and description ...
Returns : Array of TermI objects.
Args :
-
=cut
@@ -385,7 +369,6 @@ just the name and description ...
-identifier query by the given identifier
-name query by the given name
-
=cut
=head1 Factory for relationships and terms
@@ -405,7 +388,6 @@ just the name and description ...
compliant object)
Args :
-
=cut
sub relationship_factory{
@@ -425,7 +407,6 @@ sub relationship_factory{
compliant object)
Args :
-
=cut
sub term_factory{
View
25 Bio/Ontology/OntologyStore.pm
@@ -130,7 +130,6 @@ my $instance = undef;
Returns : an instance of Bio::Ontology::OntologyStore
Args :
-
=cut
sub new {
@@ -154,8 +153,9 @@ sub new {
Returns : an instance of this class
Args : named parameters, if any (currently, there are no
class-specific parameters other than those accepted by
- L<Bio::Root::Root>.
+ Bio::Root::Root.
+See L<Bio::Root::Root>.
=cut
@@ -185,7 +185,7 @@ sub get_instance{
name, without dereferencing an object.
Example :
- Returns : a L<Bio::Ontology::OntologyI> implementing object, or undef
+ Returns : a Bio::Ontology::OntologyI implementing object, or undef
if the query could not be satisfied
Args : Named parameters specifying the query. The following parameters
are recognized:
@@ -194,6 +194,8 @@ sub get_instance{
If both are specified, an implicit AND logical operator is
assumed.
+See L<Bio::Ontology::OntologyI>.
+
=cut
sub get_ontology{
@@ -250,8 +252,9 @@ sub get_ontology{
Example :
Returns : TRUE on success and FALSE otherwise
- Args : the L<Bio::Ontology::OntologyI> object(s) to register
+ Args : the Bio::Ontology::OntologyI object(s) to register
+See L<Bio::Ontology::OntologyI>.
=cut
@@ -293,9 +296,10 @@ sub register_ontology {
Function: Remove the specified ontology from the store.
Example :
Returns : TRUE on success and FALSE otherwise
- Args : the L<Bio::Ontology::OntologyI> implementing object(s)
+ Args : the Bio::Ontology::OntologyI implementing object(s)
to be removed from the store
+See L<Bio::Ontology::OntologyI>.
=cut
@@ -315,14 +319,15 @@ sub remove_ontology{
=head2 guess_ontology()
- Usage : my $ontology = Bio::Ontology::OntologyStore->guess_ontology('GO:0000001');
- Function: tries to guess which ontology a term identifier comes from, loads it as necessary,
+ Usage : my $ontology =
+ Bio::Ontology::OntologyStore->guess_ontology('GO:0000001');
+ Function: tries to guess which ontology a term identifier comes from,
+ loads it as necessary,
and returns it as a Bio::Ontology::Ontology object.
Example :
Returns : a Bio::Ontology::Ontology object, or warns and returns undef
- Args : an ontology term identifier in XXXX:DDDDDDD format. guessing is based on the XXXX
- string before the colon.
-
+ Args : an ontology term identifier in XXXX:DDDDDDD format.
+ Guessing is based on the XXXX string before the colon.
=cut
View
3 Bio/Ontology/Path.pm
@@ -52,7 +52,7 @@ Bioperl mailing lists Your participation is much appreciated.
=head2 Reporting Bugs
-report bugs to the Bioperl bug tracking system to help us keep track
+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:
@@ -156,7 +156,6 @@ sub init {
Returns : value of distance (a scalar)
Args : on set, new value (a scalar or undef, optional)
-
=cut
sub distance{
View
4 Bio/Ontology/PathI.pm
@@ -96,7 +96,6 @@ use Bio::Ontology::RelationshipI;
Returns : value of distance (a scalar)
Args : on set, new value (a scalar or undef, optional)
-
=cut
sub distance{
@@ -160,9 +159,10 @@ sub distance{
Usage : $ont = $obj->ontology()
Function: Get the ontology that defined this relationship.
Example :
- Returns : an object implementing L<Bio::Ontology::OntologyI>
+ Returns : an object implementing Bio::Ontology::OntologyI
Args :
+See L<Bio::Ontology::OntologyI>.
=cut
View
5 Bio/Ontology/Relationship.pm
@@ -64,7 +64,7 @@ Bioperl mailing lists Your participation is much appreciated.
=head2 Reporting Bugs
-report bugs to the Bioperl bug tracking system to help us keep track
+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:
@@ -316,8 +316,9 @@ sub predicate_term {
Example :
Returns : an object implementing L<Bio::Ontology::OntologyI>
Args : on set, undef or an object implementing
- L<Bio::Ontology::OntologyI> (optional)
+ Bio::Ontology::OntologyI (optional)
+See L<Bio::Ontology::OntologyI>.
=cut
View
6 Bio/Ontology/RelationshipFactory.pm
@@ -95,9 +95,11 @@ use Bio::Factory::ObjectFactory;
Usage : my $obj = new Bio::Ontology::RelationshipFactory();
Function: Builds a new Bio::Ontology::RelationshipFactory object
Returns : Bio::Ontology::RelationshipFactory
- Args : -type => string, name of a L<Bio::Ontology::RelationshipI>
+ Args : -type => string, name of a Bio::Ontology::RelationshipI
derived class.
- The default is L<Bio::Ontology::Relationship>.
+ The default is Bio::Ontology::Relationship.
+
+See L<Bio::Ontology::Relationship>, L<Bio::Ontology::RelationshipI>.
=cut
View
3 Bio/Ontology/RelationshipI.pm
@@ -177,9 +177,10 @@ sub predicate_term{
Function: Get the ontology that defined (is the scope for) this
relationship.
Example :
- Returns : an object implementing L<Bio::Ontology::OntologyI>
+ Returns : an object implementing Bio::Ontology::OntologyI
Args :
+See L<Bio::Ontology::OntologyI>.
=cut
View
6 Bio/Ontology/RelationshipType.pm
@@ -50,7 +50,7 @@ Bioperl mailing lists Your participation is much appreciated.
=head2 Reporting Bugs
-report bugs to the Bioperl bug tracking system to help us keep track
+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:
@@ -112,7 +112,8 @@ my %term_name_map = ();
$FOUND_IN = Bio::Ontology::RelationshipType->get_instance( "FOUND_IN" );
Function: Factory method to create instances of RelationshipType
Returns : [Bio::Ontology::RelationshipType]
- Args : "IS_A" or "PART_OF" or "CONTAINS" or "FOUND_IN" or "RELATED_TO" [scalar]
+ Args : "IS_A" or "PART_OF" or "CONTAINS" or "FOUND_IN" or
+ "RELATED_TO" [scalar]
the ontology [Bio::Ontology::OntologyI] (optional)
=cut
@@ -424,7 +425,6 @@ sub _check_class {
Optionally, the old value and the new value for reporting
purposes only.
-
=cut
sub veto_change{
View
74 Bio/Ontology/SimpleGOEngine.pm
@@ -40,7 +40,6 @@ SimpleGOEngine - a Ontology Engine for GO implementing OntologyEngineI
my $PART_OF = Bio::Ontology::RelationshipType->get_instance( "PART_OF" );
my $RELATED_TO = Bio::Ontology::RelationshipType->get_instance( "RELATED_TO" );
-
=head1 DESCRIPTION
Needs Graph.pm from CPAN.
@@ -58,7 +57,7 @@ Bioperl mailing lists Your participation is much appreciated.
=head2 Reporting Bugs
-report bugs to the Bioperl bug tracking system to help us keep track
+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:
@@ -242,7 +241,6 @@ sub related_to_relationship {
term already existed in the ontology engine)
Args : Bio::Ontology::TermI
-
=cut
sub add_term {
@@ -270,7 +268,6 @@ sub add_term {
or
Term identifier (e.g. "GO:0012345")
-
=cut
sub has_term {
@@ -316,11 +313,11 @@ sub add_relationship_type{
Title : get_relationship_type
Usage : $engine->get_relationship_type( $type_name );
- Function: Gets a Bio::Ontology::RelationshipI object corresponding to $type_name
+ Function: Gets a Bio::Ontology::RelationshipI object corresponding
+ to $type_name
Returns : a Bio::Ontology::RelationshipI object
Args :
-
=cut
sub get_relationship_type{
@@ -332,8 +329,10 @@ sub get_relationship_type{
Title : add_relationship
Usage : $engine->add_relationship( $relationship );
- $engine->add_relatioship( $subject_term, $predicate_term, $object_term, $ontology );
- $engine->add_relatioship( $subject_id, $predicate_id, $object_id, $ontology);
+ $engine->add_relatioship( $subject_term, $predicate_term,
+ $object_term, $ontology );
+ $engine->add_relatioship( $subject_id, $predicate_id,
+ $object_id, $ontology);
Function: Adds a relationship to this engine
Returns : true if successfully added, false otherwise
Args : The relationship in one of three ways:
@@ -399,7 +398,7 @@ sub add_relationship {
Usage : $engine->get_relationships( $term );
Function: Returns all relationships of a term, or all relationships in
the graph if no term is specified.
- Returns : Relationship[]
+ Returns : Relationship
Args : term id
or
Bio::Ontology::TermI
@@ -447,7 +446,7 @@ sub get_relationships {
Title : get_all_relationships
Usage : @rels = $engine->get_all_relationships();
Function: Returns all relationships in the graph.
- Returns : Relationship[]
+ Returns : Relationship
Args :
=cut
@@ -463,10 +462,9 @@ sub get_all_relationships {
Title : get_predicate_terms
Usage : $engine->get_predicate_terms();
Function: Returns the types of relationships this engine contains
- Returns : Bio::Ontology::RelationshipType[]
+ Returns : Bio::Ontology::RelationshipType
Args :
-
=cut
sub get_predicate_terms {
@@ -492,12 +490,12 @@ sub get_predicate_terms {
Usage : $engine->get_child_terms( $term_obj, @rel_types );
$engine->get_child_terms( $term_id, @rel_types );
Function: Returns the children of this term
- Returns : Bio::Ontology::TermI[]
- Args : Bio::Ontology::TermI, Bio::Ontology::RelationshipType[]
+ Returns : Bio::Ontology::TermI
+ Args : Bio::Ontology::TermI, Bio::Ontology::RelationshipType
or
- term id, Bio::Ontology::RelationshipType[]
+ term id, Bio::Ontology::RelationshipType
- if NO Bio::Ontology::RelationshipType[] is indicated: children
+ if NO Bio::Ontology::RelationshipType is indicated: children
of ALL types are returned
=cut
@@ -516,13 +514,13 @@ sub get_child_terms {
Usage : $engine->get_descendant_terms( $term_obj, @rel_types );
$engine->get_descendant_terms( $term_id, @rel_types );
Function: Returns the descendants of this term
- Returns : Bio::Ontology::TermI[]
- Args : Bio::Ontology::TermI, Bio::Ontology::RelationshipType[]
+ Returns : Bio::Ontology::TermI
+ Args : Bio::Ontology::TermI, Bio::Ontology::RelationshipType
or
- term id, Bio::Ontology::RelationshipType[]
+ term id, Bio::Ontology::RelationshipType
- if NO Bio::Ontology::RelationshipType[] is indicated: descendants
- of ALL types are returned
+ if NO Bio::Ontology::RelationshipType is indicated:
+ descendants of ALL types are returned
=cut
@@ -557,13 +555,13 @@ sub get_descendant_terms {
Usage : $engine->get_parent_terms( $term_obj, @rel_types );
$engine->get_parent_terms( $term_id, @rel_types );
Function: Returns the parents of this term
- Returns : Bio::Ontology::TermI[]
- Args : Bio::Ontology::TermI, Bio::Ontology::RelationshipType[]
+ Returns : Bio::Ontology::TermI
+ Args : Bio::Ontology::TermI, Bio::Ontology::RelationshipType
or
- term id, Bio::Ontology::RelationshipType[]
+ term id, Bio::Ontology::RelationshipType
- if NO Bio::Ontology::RelationshipType[] is indicated: parents
- of ALL types are returned
+ if NO Bio::Ontology::RelationshipType is indicated:
+ parents of ALL types are returned
=cut
@@ -582,13 +580,13 @@ sub get_parent_terms {
Usage : $engine->get_ancestor_terms( $term_obj, @rel_types );
$engine->get_ancestor_terms( $term_id, @rel_types );
Function: Returns the ancestors of this term
- Returns : Bio::Ontology::TermI[]
- Args : Bio::Ontology::TermI, Bio::Ontology::RelationshipType[]
+ Returns : Bio::Ontology::TermI
+ Args : Bio::Ontology::TermI, Bio::Ontology::RelationshipType
or
- term id, Bio::Ontology::RelationshipType[]
+ term id, Bio::Ontology::RelationshipType
- if NO Bio::Ontology::RelationshipType[] is indicated: ancestors
- of ALL types are returned
+ if NO Bio::Ontology::RelationshipType is indicated:
+ ancestors of ALL types are returned
=cut
@@ -623,7 +621,7 @@ sub get_ancestor_terms {
Title : get_leaf_terms
Usage : $engine->get_leaf_terms();
Function: Returns the leaf terms
- Returns : Bio::Ontology::TermI[]
+ Returns : Bio::Ontology::TermI
Args :
=cut
@@ -644,7 +642,7 @@ sub get_leaf_terms {
Title : get_root_terms
Usage : $engine->get_root_terms();
Function: Returns the root terms
- Returns : Bio::Ontology::TermI[]
+ Returns : Bio::Ontology::TermI
Args :
=cut
@@ -665,10 +663,9 @@ sub get_root_terms {
Title : get_terms
Usage : @terms = $engine->get_terms( "GO:1234567", "GO:2234567" );
Function: Returns term objects with given identifiers
- Returns : Bio::Ontology::TermI[], or the term corresponding to the
+ Returns : Bio::Ontology::TermI, or the term corresponding to the
first identifier if called in scalar context
- Args : term ids[]
-
+ Args : term ids
=cut
@@ -693,7 +690,7 @@ sub get_terms {
Title : get_all_terms
Usage : $engine->get_all_terms();
Function: Returns all terms in this engine
- Returns : Bio::Ontology::TermI[]
+ Returns : Bio::Ontology::TermI
Args :
=cut
@@ -723,7 +720,6 @@ sub get_all_terms {
-identifier query by the given identifier
-name query by the given name
-
=cut
sub find_terms{
@@ -755,7 +751,6 @@ sub find_terms{
compliant object)
Args : on set, a Bio::Factory::ObjectFactoryI compliant object
-
=cut
sub relationship_factory{
@@ -781,7 +776,6 @@ sub relationship_factory{
compliant object)
Args : on set, a Bio::Factory::ObjectFactoryI compliant object
-
=cut
sub term_factory{
View
346 Bio/Ontology/SimpleOntologyEngine.pm
@@ -89,7 +89,6 @@ use Data::Dumper;
Returns : Object of class SimpleOntologyEngine.
Args :
-
=cut
sub new{
@@ -118,29 +117,28 @@ sub new{
Returns : hash
Args : empty hash
-
=cut
sub _instantiated_terms_store{
- my ($self, $value) = @_;
+ my ($self, $value) = @_;
- if( defined $value) {
- $self->{'_instantiated_terms_store'} = $value;
- }
- return $self->{'_instantiated_terms_store'};
+ if( defined $value) {
+ $self->{'_instantiated_terms_store'} = $value;
+ }
+ return $self->{'_instantiated_terms_store'};
}
=head2 mark_instantiated
Title : mark_instantiated
- Usage : $self->mark_instantiated(TermI[] terms): TermI[]
+ Usage : $self->mark_instantiated(TermI terms): TermI
Function: Marks TermI objects as fully instantiated,
- allowing for proper counting of the number of terms in the term store.
-The TermI objects has to be already stored in the term store in order to
- be marked.
+ allowing for proper counting of the number of terms in the term store.
+ The TermI objects has to be already stored in the term store in order
+ to be marked.
Example : $self->mark_instantiated($term);
Returns : its argument or throws an exception if a term is not
- in the term store.
+ in the term store.
Args : array of objects of class TermI.
=cut
@@ -149,9 +147,9 @@ sub mark_instantiated{
my ($self, @terms) = @_;
foreach my $term (@terms) {
- $self->throw( "term ".$term->identifier." not in the term store\n" )
- if !defined $self->_term_store->{$term->identifier};
- $self->_instantiated_terms_store->{$term->identifier} = 1;
+ $self->throw( "term ".$term->identifier." not in the term store\n" )
+ if !defined $self->_term_store->{$term->identifier};
+ $self->_instantiated_terms_store->{$term->identifier} = 1;
}
return @terms;
@@ -160,14 +158,13 @@ sub mark_instantiated{
=head2 mark_uninstantiated
Title : mark_uninstantiated
- Usage : $self->mark_uninstantiated(TermI[] terms): TermI[]
+ Usage : $self->mark_uninstantiated(TermI terms): TermI
Function: Marks TermI objects as not fully instantiated,
Example : $self->mark_uninstantiated($term);
Returns : its argument or throws an exception if a term is not
- in the term store(if the term is not marked it does nothing).
+ in the term store(if the term is not marked it does nothing).
Args : array of objects of class TermI.
-
=cut
sub mark_uninstantiated{
@@ -239,14 +236,13 @@ sub add_term{
=head2 get_term_by_identifier
Title : get_term_by_identifier
- Usage : get_term_by_identifier(String[] id): TermI[]
+ Usage : get_term_by_identifier(String id): TermI
Function: Retrieves terms from the term store by their identifier
field, or undef if not there.
Example : $term = $soe->get_term_by_identifier("IPR000001");
Returns : An array of zero or more Bio::Ontology::TermI objects.
Args : An array of identifier strings
-
=cut
sub get_term_by_identifier{
@@ -270,7 +266,6 @@ sub get_term_by_identifier{
Returns :
Args :
-
=cut
sub _get_number_rels{
@@ -292,7 +287,6 @@ sub _get_number_rels{
Returns :
Args :
-
=cut
sub _get_number_terms{
@@ -311,19 +305,18 @@ sub _get_number_terms{
Returns : reference to an array of Bio::Ontology::TermI objects
Args : reference to an array of Bio::Ontology::TermI objects
-
=cut
sub _relationship_store{
my ($self, $value) = @_;
if( defined $value) {
- if ( defined $self->{'_relationship_store'}) {
- $self->throw("_relationship_store already defined\n");
- }
- else {
- $self->{'_relationship_store'} = $value;
- }
+ if ( defined $self->{'_relationship_store'}) {
+ $self->throw("_relationship_store already defined\n");
+ }
+ else {
+ $self->{'_relationship_store'} = $value;
+ }
}
return $self->{'_relationship_store'};
@@ -338,20 +331,19 @@ sub _relationship_store{
Returns : reference to an array of Bio::Ontology::TermI objects
Args : reference to an array of Bio::Ontology::TermI objects
-
=cut
sub _inverted_relationship_store{
- my ($self, $value) = @_;
+ my ($self, $value) = @_;
- if( defined $value) {
- if ( defined $self->{'_inverted_relationship_store'}) {
- $self->throw("_inverted_relationship_store already defined\n");
- }
- else {
- $self->{'_inverted_relationship_store'} = $value;
- }
- }
+ if( defined $value) {
+ if ( defined $self->{'_inverted_relationship_store'}) {
+ $self->throw("_inverted_relationship_store already defined\n");
+ }
+ else {
+ $self->{'_inverted_relationship_store'} = $value;
+ }
+ }
return $self->{'_inverted_relationship_store'};
}
@@ -365,19 +357,18 @@ sub _inverted_relationship_store{
Returns : reference to an array of Bio::Ontology::RelationshipType objects
Args : reference to an array of Bio::Ontology::RelationshipType objects
-
=cut
sub _relationship_type_store{
my ($self, $value) = @_;
if( defined $value) {
- if ( defined $self->{'_relationship_type_store'}) {
- $self->throw("_relationship_type_store already defined\n");
- }
- else {
- $self->{'_relationship_type_store'} = $value;
- }
+ if ( defined $self->{'_relationship_type_store'}) {
+ $self->throw("_relationship_type_store already defined\n");
+ }
+ else {
+ $self->{'_relationship_type_store'} = $value;
+ }
}
return $self->{'_relationship_type_store'};
@@ -392,7 +383,6 @@ sub _relationship_type_store{
Returns :
Args :
-
=cut
sub _add_relationship_simple{
@@ -401,22 +391,22 @@ sub _add_relationship_simple{
my $child_id;
if ($inverted) {
- $parent_id = $rel->subject_term->identifier;
- $child_id = $rel->object_term->identifier;
+ $parent_id = $rel->subject_term->identifier;
+ $child_id = $rel->object_term->identifier;
}
else {
- $parent_id = $rel->object_term->identifier;
- $child_id = $rel->subject_term->identifier;
+ $parent_id = $rel->object_term->identifier;
+ $child_id = $rel->subject_term->identifier;
}
if((defined $store->{$parent_id}->{$child_id}) &&
($store->{$parent_id}->{$child_id}->name != $rel->predicate_term->name)){
- $self->throw("relationship ".Dumper($rel->predicate_term).
- " between ".$parent_id." and ".$child_id.
- " already defined as ".
- Dumper($store->{$parent_id}->{$child_id})."\n");
+ $self->throw("relationship ".Dumper($rel->predicate_term).
+ " between ".$parent_id." and ".$child_id.
+ " already defined as ".
+ Dumper($store->{$parent_id}->{$child_id})."\n");
}
else {
- $store->{$parent_id}->{$child_id} = $rel->predicate_term;
+ $store->{$parent_id}->{$child_id} = $rel->predicate_term;
}
}
@@ -429,7 +419,6 @@ sub _add_relationship_simple{
Returns : Its argument.
Args : A RelationshipI object.
-
=cut
sub add_relationship{
@@ -448,13 +437,12 @@ sub add_relationship{
=head2 get_relationships
Title : get_relationships
- Usage : get_relationships(): RelationshipI[]
+ Usage : get_relationships(): RelationshipI
Function: Retrieves all relationship objects.
Example :
Returns : Array of RelationshipI objects
Args :
-
=cut
sub get_relationships{
@@ -465,50 +453,50 @@ sub get_relationships{
my $relfact = $self->relationship_factory();
my @parent_ids = $term ?
- # if a term is supplied then only get the term's parents
- (map { $_->identifier(); } $self->get_parent_terms($term)) :
- # otherwise use all parent ids
- (keys %{$store});
+ # if a term is supplied then only get the term's parents
+ (map { $_->identifier(); } $self->get_parent_terms($term)) :
+ # otherwise use all parent ids
+ (keys %{$store});
# add the term as a parent too if one is supplied
push(@parent_ids,$term->identifier) if $term;
foreach my $parent_id (@parent_ids) {
- my $parent_entry = $store->{$parent_id};
-
- # if a term is supplied, add a relationship for the parent to the term
- # except if the parent is the term itself (we added that one before)
- if($term && ($parent_id ne $term->identifier())) {
- my @parent_terms = $self->get_term_by_identifier($parent_id);
- foreach my $parent_term (@parent_terms) {
- push(@rels,
- $relfact->create_object(-object_term => $parent_term,
- -subject_term => $term,
- -predicate_term =>
- $parent_entry->{$term->identifier},
- -ontology => $term->ontology())
- );
- }
+ my $parent_entry = $store->{$parent_id};
+
+ # if a term is supplied, add a relationship for the parent to the term
+ # except if the parent is the term itself (we added that one before)
+ if($term && ($parent_id ne $term->identifier())) {
+ my @parent_terms = $self->get_term_by_identifier($parent_id);
+ foreach my $parent_term (@parent_terms) {
+ push(@rels,
+ $relfact->create_object(-object_term => $parent_term,
+ -subject_term => $term,
+ -predicate_term =>
+ $parent_entry->{$term->identifier},
+ -ontology => $term->ontology())
+ );
+ }
- } else {
- # otherwise, i.e., no term supplied, or the parent equals the
- # supplied term
- my @parent_terms = $term ?
- ($term) : $self->get_term_by_identifier($parent_id);
- foreach my $child_id (keys %$parent_entry) {
- my $rel_info = $parent_entry->{$child_id};
- my ($subj_term) = $self->get_term_by_identifier($child_id);
-
- foreach my $parent_term (@parent_terms) {
- push(@rels,
- $relfact->create_object(-object_term => $parent_term,
- -subject_term => $subj_term,
- -predicate_term => $rel_info,
- -ontology =>$parent_term->ontology
- )
- );
- }
- }
- }
+ } else {
+ # otherwise, i.e., no term supplied, or the parent equals the
+ # supplied term
+ my @parent_terms = $term ?
+ ($term) : $self->get_term_by_identifier($parent_id);
+ foreach my $child_id (keys %$parent_entry) {
+ my $rel_info = $parent_entry->{$child_id};
+ my ($subj_term) = $self->get_term_by_identifier($child_id);
+
+ foreach my $parent_term (@parent_terms) {
+ push(@rels,
+ $relfact->create_object(-object_term => $parent_term,
+ -subject_term => $subj_term,
+ -predicate_term => $rel_info,
+ -ontology =>$parent_term->ontology
+ )
+ );
+ }
+ }
+ }
}
return @rels;
@@ -517,13 +505,12 @@ sub get_relationships{
=head2 get_all_relationships
Title : get_all_relationships
- Usage : get_all_relationships(): RelationshipI[]
+ Usage : get_all_relationships(): RelationshipI
Function: Retrieves all relationship objects.
Example :
Returns : Array of RelationshipI objects
Args :
-
=cut
sub get_all_relationships{
@@ -533,13 +520,12 @@ sub get_all_relationships{
=head2 get_predicate_terms
Title : get_predicate_terms
- Usage : get_predicate_terms(): TermI[]
+ Usage : get_predicate_terms(): TermI
Function: Retrives all relationship types stored in the engine
Example :
Returns : reference to an array of Bio::Ontology::RelationshipType objects
Args :
-
=cut
sub get_predicate_terms{
@@ -557,18 +543,17 @@ sub get_predicate_terms{
Returns :
Args :
-
=cut
sub _is_rel_type{
my ($self, $term, @rel_types) = @_;
foreach my $rel_type (@rel_types) {
- if($rel_type->identifier || $term->identifier) {
- return 1 if $rel_type->identifier eq $term->identifier;
- } else {
- return 1 if $rel_type->name eq $term->name;
- }
+ if($rel_type->identifier || $term->identifier) {
+ return 1 if $rel_type->identifier eq $term->identifier;
+ } else {
+ return 1 if $rel_type->name eq $term->name;
+ }
}
return 0;
@@ -583,70 +568,68 @@ sub _is_rel_type{
Returns :
Args :
-
=cut
sub _typed_traversal{
- my ($self, $rel_store, $level, $term_id, @rel_types) = @_;
- return undef if !defined($rel_store->{$term_id});
- my %parent_entry = %{$rel_store->{$term_id}};
- my @children = keys %parent_entry;
+ my ($self, $rel_store, $level, $term_id, @rel_types) = @_;
+ return undef if !defined($rel_store->{$term_id});
+ my %parent_entry = %{$rel_store->{$term_id}};
+ my @children = keys %parent_entry;
- my @ans;
+ my @ans;
- if (@rel_types > 0) {
- @ans = ();
+ if (@rel_types > 0) {
+ @ans = ();
- foreach my $child_id (@children) {
- push @ans, $child_id
- if $self->_is_rel_type( $rel_store->{$term_id}->{$child_id},
- @rel_types);
- }
- }
- else {
- @ans = @children;
- }
- if ($level < 1) {
- my @ans1 = ();
+ foreach my $child_id (@children) {
+ push @ans, $child_id
+ if $self->_is_rel_type( $rel_store->{$term_id}->{$child_id},
+ @rel_types);
+ }
+ }
+ else {
+ @ans = @children;
+ }
+ if ($level < 1) {
+ my @ans1 = ();
- foreach my $child_id (@ans) {
- push @ans1, $self->_typed_traversal($rel_store,
- $level - 1, $child_id, @rel_types)
- if defined $rel_store->{$child_id};
- }
- push @ans, @ans1;
- }
+ foreach my $child_id (@ans) {
+ push @ans1, $self->_typed_traversal($rel_store,
+ $level - 1, $child_id, @rel_types)
+ if defined $rel_store->{$child_id};
+ }
+ push @ans, @ans1;
+ }
return @ans;
}
=head2 get_child_terms
Title : get_child_terms
- Usage : get_child_terms(TermI term, TermI[] predicate_terms): TermI[]
- get_child_terms(TermI term, RelationshipType[] predicate_terms): TermI[]
+ Usage : get_child_terms(TermI term, TermI predicate_terms): TermI
+ get_child_terms(TermI term, RelationshipType predicate_terms): TermI
Function: Retrieves all child terms of a given term, that satisfy a
relationship among those that are specified in the second
argument or undef otherwise. get_child_terms is a special
case of get_descendant_terms, limiting the search to the
direct descendants.
-
Example :
Returns : Array of TermI objects.
- Args : First argument is the term of interest, second is the list of relationship type terms.
-
+ Args : First argument is the term of interest, second is the list of
+ relationship type terms.
=cut
sub get_child_terms{
- my ($self, $term, @relationship_types) = @_;
+ my ($self, $term, @relationship_types) = @_;
- $self->throw("must provide TermI compliant object")
- unless defined($term) && $term->isa("Bio::Ontology::TermI");
+ $self->throw("must provide TermI compliant object")
+ unless defined($term) && $term->isa("Bio::Ontology::TermI");
- return $self->_filter_unmarked(
- $self->get_term_by_identifier(
- $self->_typed_traversal($self->_relationship_store,
+ return $self->_filter_unmarked(
+ $self->get_term_by_identifier(
+ $self->_typed_traversal($self->_relationship_store,
1,
$term->identifier,
@relationship_types) ) );
@@ -655,17 +638,17 @@ sub get_child_terms{
=head2 get_descendant_terms
Title : get_descendant_terms
- Usage : get_descendant_terms(TermI term, TermI[] rel_types): TermI[]
- get_child_terms(TermI term, RelationshipType[] predicate_terms): TermI[]
+ Usage : get_descendant_terms(TermI term, TermI rel_types): TermI
+ get_child_terms(TermI term, RelationshipType predicate_terms): TermI
Function: Retrieves all descendant terms of a given term, that
satisfy a relationship among those that are specified in
the second argument or undef otherwise. Uses
_typed_traversal to find all descendants.
Example :
Returns : Array of TermI objects.
- Args : First argument is the term of interest, second is the list of relationship type terms.
-
+ Args : First argument is the term of interest, second is the list of
+ relationship type terms.
=cut
@@ -687,8 +670,8 @@ sub get_descendant_terms{
=head2 get_parent_terms
Title : get_parent_terms
- Usage : get_parent_terms(TermI term, TermI[] predicate_terms): TermI[]
- get_child_terms(TermI term, RelationshipType[] predicate_terms): TermI[]
+ Usage : get_parent_terms(TermI term, TermI predicate_terms): TermI
+ get_child_terms(TermI term, RelationshipType predicate_terms): TermI
Function: Retrieves all parent terms of a given term, that satisfy a
relationship among those that are specified in the second
argument or undef otherwise. get_parent_terms is a special
@@ -699,7 +682,6 @@ sub get_descendant_terms{
Returns : Array of TermI objects.
Args : First argument is the term of interest, second is the list of relationship type terms.
-
=cut
sub get_parent_terms{
@@ -717,8 +699,8 @@ sub get_parent_terms{
=head2 get_ancestor_terms
Title : get_ancestor_terms
- Usage : get_ancestor_terms(TermI term, TermI[] predicate_terms): TermI[]
- get_child_terms(TermI term, RelationshipType[] predicate_terms): TermI[]
+ Usage : get_ancestor_terms(TermI term, TermI predicate_terms): TermI
+ get_child_terms(TermI term, RelationshipType predicate_terms): TermI
Function: Retrieves all ancestor terms of a given term, that satisfy
a relationship among those that are specified in the second
argument or undef otherwise. Uses _typed_traversal to find
@@ -729,7 +711,6 @@ sub get_parent_terms{
Args : First argument is the term of interest, second is the list
of relationship type terms.
-
=cut
sub get_ancestor_terms{
@@ -748,23 +729,22 @@ sub get_ancestor_terms{
=head2 get_leaf_terms
Title : get_leaf_terms
- Usage : get_leaf_terms(): TermI[]
+ Usage : get_leaf_terms(): TermI
Function: Retrieves all leaf terms from the ontology. Leaf term is a term w/o descendants.
Example : @leaf_terms = $obj->get_leaf_terms()
Returns : Array of TermI objects.
Args :
-
=cut
sub get_leaf_terms{
my ($self) = @_;
my @leaf_terms;
foreach my $term (values %{$self->_term_store}) {
- push @leaf_terms, $term
- if !defined $self->_relationship_store->{$term->identifier} &&
- defined $self->_instantiated_terms_store->{$term->identifier};
+ push @leaf_terms, $term
+ if !defined $self->_relationship_store->{$term->identifier} &&
+ defined $self->_instantiated_terms_store->{$term->identifier};
}
return @leaf_terms;
@@ -773,13 +753,12 @@ sub get_leaf_terms{
=head2 get_root_terms
Title : get_root_terms
- Usage : get_root_terms(): TermI[]
+ Usage : get_root_terms(): TermI
Function: Retrieves all root terms from the ontology. Root term is a term w/o descendants.
Example : @root_terms = $obj->get_root_terms()
Returns : Array of TermI objects.
Args :
-
=cut
sub get_root_terms{
@@ -789,7 +768,7 @@ sub get_root_terms{
foreach my $term (values %{$self->_term_store}) {
push @root_terms, $term
if !defined $self->_inverted_relationship_store->{$term->identifier} &&
- defined $self->_instantiated_terms_store->{$term->identifier};
+ defined $self->_instantiated_terms_store->{$term->identifier};
}
return @root_terms;
@@ -804,7 +783,6 @@ sub get_root_terms{
Returns : List of unique TermI objects
Args : List of TermI objects
-
=cut
sub _filter_repeated{
@@ -821,13 +799,12 @@ sub _filter_repeated{
=head2 get_all_terms
Title : get_all_terms
- Usage : get_all_terms(): TermI[]
+ Usage : get_all_terms(): TermI
Function: Retrieves all terms currently stored in the ontology.
Example : @all_terms = $obj->get_all_terms()
Returns : Array of TermI objects.
Args :
-
=cut
sub get_all_terms{
@@ -853,7 +830,6 @@ sub get_all_terms{
-identifier query by the given identifier
-name query by the given name
-
=cut
sub find_terms{
@@ -863,12 +839,12 @@ sub find_terms{
my ($id,$name) = $self->_rearrange([qw(IDENTIFIER NAME)],@args);
if(defined($id)) {
- @terms = $self->get_term_by_identifier($id);
+ @terms = $self->get_term_by_identifier($id);
} else {
- @terms = $self->get_all_terms();
+ @terms = $self->get_all_terms();
}
if(defined($name)) {
- @terms = grep { $_->name() eq $name; } @terms;
+ @terms = grep { $_->name() eq $name; } @terms;
}
return @terms;
}
@@ -886,7 +862,6 @@ sub find_terms{
compliant object)
Args : on set, a Bio::Factory::ObjectFactoryI compliant object
-
=cut
sub relationship_factory{
@@ -912,30 +887,28 @@ sub relationship_factory{
compliant object)
Args : on set, a Bio::Factory::ObjectFactoryI compliant object
-
=cut
sub term_factory{
my $self = shift;
if(@_) {
- $self->warn("setting term factory, but ".ref($self).
- " does not create terms on-the-fly");
- return $self->{'term_factory'} = shift;
+ $self->warn("setting term factory, but ".ref($self).
+ " does not create terms on-the-fly");
+ return $self->{'term_factory'} = shift;
}
return $self->{'term_factory'};
}
=head2 _filter_unmarked
Title : _filter_unmarked
- Usage : _filter_unmarked(TermI[] terms): TermI[]
+ Usage : _filter_unmarked(TermI terms): TermI
Function: Removes the uninstantiated terms from the list of terms
Example :
Returns : array of fully instantiated TermI objects
Args : array of TermI objects
-
=cut
sub _filter_unmarked{
@@ -963,20 +936,19 @@ sub _filter_unmarked{
Returns : Object of class TermI or undef if not found.
Args : The string identifier of a term.
-
=cut
sub remove_term_by_id{
my ($self, $id) = @_;
if ( $self->get_term_by_identifier($id) ) {
- my $term = $self->{_term_store}->{$id};
- delete $self->{_term_store}->{$id};
- return $term;
+ my $term = $self->{_term_store}->{$id};
+ delete $self->{_term_store}->{$id};
+ return $term;
}
else {
- $self->warn("Term with id '$id' is not in the term store");
- return undef;
+ $self->warn("Term with id '$id' is not in the term store");
+ return undef;
}
}
@@ -990,7 +962,6 @@ sub remove_term_by_id{
Returns :
Args :
-
=cut
sub to_string{
@@ -1014,7 +985,7 @@ sub to_string{
If the identifier attribute is not set, it uses the
combination of name and ontology name, provided both are
- set. If they aren't, it returns the name alone.
+ set. If they are not, it returns the name alone.
Note that this is a private method. Call from inheriting
classes but not from outside.
@@ -1023,7 +994,6 @@ sub to_string{
Returns : a string
Args : a Bio::Ontology::TermI compliant object
-
=cut
sub _unique_termid{
@@ -1033,9 +1003,9 @@ sub _unique_termid{
return $term->identifier() if $term->identifier();
my $id = $term->ontology->name() if $term->ontology();
if($id) {
- $id .= '|';
+ $id .= '|';
} else {
- $id = '';
+ $id = '';
}
$id .= $term->name();
}
View
25 Bio/Ontology/Term.pm
<
@@ -135,7 +135,8 @@ use constant FALSE => 0;
-references => Bio::Annotation::Reference objects
[reference to array]
-See L<Bio::Ontology::OntologyI>, L<Bio::Annotation::Reference>, L<Bio::Annotation::DBLink>.
+See L<Bio::Ontology::OntologyI>, L<Bio::Annotation::Reference>,
+L<Bio::Annotation::DBLink>.
=cut
@@ -223,8 +224,6 @@ sub identifier {
} # identifier
-
-
=head2 name
Title : name
@@ -245,9 +244,6 @@ sub name {
} # name
-
-
-
=head2 definition
Title : definition
@@ -277,13 +273,15 @@ sub definition {
Function: Get the ontology this term is in.
Note that with the ontology in hand you can query for all
- related terms etc. See L<Bio::Ontology::OntologyI>.
+ related terms etc.
- Returns : The ontology of this Term as a L<Bio::Ontology::OntologyI>
+ Returns : The ontology of this Term as a Bio::Ontology::OntologyI
implementing object.
- Args : On set, the ontology of this Term as a L<Bio::Ontology::OntologyI>
+ Args : On set, the ontology of this Term as a Bio::Ontology::OntologyI
implementing object or a string representing its name.
+See L<Bio::Ontology::OntologyI>.
+
=cut
sub ontology {
@@ -346,9 +344,6 @@ sub is_obsolete{