3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
37 An ontology term object, used in querying
for transcripts, genes,
38 and translations
using the relevant adaptors and methods.
44 package Bio::EnsEMBL::OntologyTerm;
55 Arg [-ACCESSION] : String
58 Arg [-ONTOLOGY] : String
59 The ontology that the term belongs to.
61 Arg [-NAMESPACE] : String
62 The
namespace of the ontology term.
65 The name of the ontology term.
67 Arg [-SUBSETS] : (optional) Listref of strings
68 The subsets within the ontology to which this
71 Arg [-DEFINITION] : (optional) String
72 The definition of the ontology term.
74 Arg [-SYNONYMS] : (optional) Listref of strings
75 The synonyms of this term.
77 Arg : Further arguments required for parent class
80 Description : Creates an ontology term object.
85 '-accession' => 'GO:0021785',
87 '-namespace' => 'biological_process',
88 '-name' => 'branchiomotor neuron axon guidance',
89 '-definition' => 'The process in which a branchiomotor '
90 . 'neuron growth cone is directed to a specific target site. '
91 . 'Branchiomotor neurons are located in the hindbrain and '
92 . 'innervate branchial arch-derived muscles that control jaw '
93 . 'movements, facial expression, the larynx, and the pharynx.',
94 '-synonyms' => [ 'BMN axon guidance',
95 'branchial motor axon guidance',
96 'special visceral motor neuron axon guidance' ]
98 # ... other arguments required by Bio::EnsEMBL::Storable.
106 my $proto = shift(@_);
108 my $this = $proto->SUPER::new(@_);
110 my ( $accession, $ontology, $ontology_version,$namespace, $name, $definition, $is_root, $is_obsolete, $subsets )
111 = rearrange( [
'ACCESSION',
'ONTOLOGY',
'ONTOLOGY_VERSION',
'NAMESPACE',
'NAME',
112 'DEFINITION',
'IS_ROOT',
'IS_OBSOLETE',
'SUBSETS' ],
115 $this->{
'accession'} = $accession;
116 $this->{
'ontology'} = $ontology;
117 $this->{
'ontology_version'} = $ontology_version;
118 $this->{
'namespace'} = $namespace;
119 $this->{
'name'} = $name;
120 $this->{
'definition'} = $definition;
121 $this->{
'is_root'} = $is_root;
122 $this->{
'is_obsolete'}= $is_obsolete;
123 $this->{
'subsets'} = [ @{$subsets} ];
125 $this->{
'child_terms_fetched'} = 0;
126 $this->{
'parent_terms_fetched'} = 0;
135 Description : Returns the
accession for the ontology term in question.
137 Example : my $accession = $term->accession();
145 return $this->{
'accession'};
152 Description : Returns the ontology
for the ontology term in question.
154 Example : my $ontology = $term->ontology();
162 return $this->{
'ontology'};
169 Description : Returns the
namespace for the ontology term in question.
171 Example : my $acc = $term->namespace();
179 return $this->{
'namespace'};
186 Description : Returns the name
for the ontology term in question.
188 Example : my $name = $term->name();
196 return $this->{
'name'};
203 Description : Returns the definition
for the ontology term in question.
205 Example : my $definition = $term->definition();
213 return $this->{
'definition'};
220 Description : Returns
true if the term is root of its ontology
222 Example : my $is_root = $term->is_root();
224 Return type : Boolean (TRUE
if it is a root,
else FALSE)
230 return $this->{
'is_root'};
237 Description : Returns
true if the term is obsolete
239 Example : my $is_obsolete = $term->is_obsolete();
241 Return type : Boolean (TRUE
if it is obsolete,
else FALSE)
247 return $this->{
'is_obsolete'};
256 Description : Returns the list of synonyms defined
for this term
259 Example : my @synonyms = @{ $term->synonyms() };
261 Return type : Listref of strings
268 if ( !exists( $this->{
'synonyms'} ) ) {
269 $this->{
'synonyms'} =
270 $this->adaptor()->_fetch_synonyms_by_dbID( $this->dbID() );
273 return $this->{
'synonyms'};
280 Description : Returns a list of subsets that
this term is part
281 of. The list might be empty.
283 Example : my @subsets = @{ $term->subsets() };
285 Return type : listref of strings
291 return $this->{
'subsets'};
296 Arg : (optional) List of strings
297 The type of relations to retrieve children
for.
299 Description : Returns the children terms of
this ontology term.
301 Example : my @children =
302 @{ $term->children(
'is_a',
'part_of' ) };
309 my ( $this, @relations ) = @_;
311 my @terms = @{ $this->adaptor()->fetch_all_by_parent_term($this) };
315 foreach my $relation (@relations) {
316 if ( exists( $this->{
'children'}{$relation} ) ) {
317 push( @terms, @{ $this->{
'children'}{$relation} } );
329 Description : Returns the complete set of
'is_a' and
'part_of'
330 descendant terms of
this ontology term, down to
331 and including any leaf terms.
333 Example : my @descendants = @{ $term->
descendants() };
341 return $this->adaptor()->fetch_all_by_ancestor_term($this);
346 Arg : (optional) List of strings
347 The type of relations to retrieve parents
for.
349 Description : Returns the parent terms of
this ontology term.
351 Example : my @parents =
352 @{ $term->
parents(
'is_a',
'part_of' ) };
359 my ( $this, @relations ) = @_;
361 my @terms = @{ $this->adaptor()->fetch_all_by_child_term($this) };
365 foreach my $relation (@relations) {
366 if ( exists( $this->{
'parents'}{$relation} ) ) {
367 push( @terms, @{ $this->{
'parents'}{$relation} } );
379 Description : Returns the complete set of
'is_a' and
'part_of'
380 ancestor terms of
this ontology term, up to and
381 including the root term.
383 Example : my @ancestors = @{ $term->
ancestors() };
391 return $this->adaptor()->fetch_all_by_descendant_term($this);
394 =head2 ontology_version
398 Description : Returns the version of the ontology from which
this term
406 sub ontology_version{
408 return $this->{ontology_version};