3 # BioPerl module for Bio::Ontology::Term
5 # Cared for by Christian M. Zmasek <czmasek@gnf.org> or <cmzmasek@yahoo.com>
7 # (c) Christian M. Zmasek, czmasek@gnf.org, 2002.
8 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002.
10 # You may distribute this module under the same terms as perl itself.
11 # Refer to the Perl Artistic License (see the license accompanying this
12 # software package, or see http://www.perl.com/language/misc/Artistic.html)
13 # for the terms under which you may use, modify, and redistribute this module.
15 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
16 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
17 # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 # You may distribute this module under the same terms as perl itself
21 # POD documentation - main docs before the code
25 Bio::Ontology::TermI - interface for ontology terms
29 #get Bio::Ontology::TermI somehow.
31 print $term->identifier(), "\n";
32 print $term->name(), "\n";
33 print $term->definition(), "\n";
34 print $term->is_obsolete(), "\n";
35 print $term->comment(), "\n";
37 foreach my $synonym ( $term->get_synonyms() ) {
44 This is "dumb" interface for ontology terms providing basic methods
45 (it provides no functionality related to graphs).
51 User feedback is an integral part of the evolution of this and other
52 Bioperl modules. Send your comments and suggestions preferably to one
53 of the Bioperl mailing lists. Your participation is much appreciated.
55 bioperl-l@bioperl.org - General discussion
56 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
60 Report bugs to the Bioperl bug tracking system to help us keep track
61 the bugs and their resolution. Bug reports can be submitted via
64 http://bugzilla.open-bio.org/
70 Email: czmasek@gnf.org or cmzmasek@yahoo.com
72 WWW: http://www.genetics.wustl.edu/eddy/people/zmasek/
76 Genomics Institute of the Novartis Research Foundation
77 10675 John Jay Hopkins Drive
82 The rest of the documentation details each of the object
88 # Let the code begin...
90 package Bio
::Ontology
::TermI
;
93 use base
qw(Bio::Root::RootI);
100 Usage : $term->identifier( "0003947" );
102 print $term->identifier();
103 Function: Set/get for the identifier of this Term.
104 Returns : The identifier [scalar].
105 Args : The identifier [scalar] (optional).
110 shift->throw_not_implemented();
119 Usage : $term->name( "N-acetylgalactosaminyltransferase" );
122 Function: Set/get for the name of this Term.
123 Returns : The name [scalar].
124 Args : The name [scalar] (optional).
129 shift->throw_not_implemented();
139 Usage : $term->definition( "Catalysis of ..." );
141 print $term->definition();
142 Function: Set/get for the definition of this Term.
143 Returns : The definition [scalar].
144 Args : The definition [scalar] (optional).
149 shift->throw_not_implemented();
157 Usage : $ont = $term->ontology();
159 $term->ontology( $ont );
160 Function: Get the ontology this term is in.
162 An implementation may not permit the value of this
163 attribute to be changed once it is set, since that may have
164 serious consequences (note that with the ontology in hand
165 you can query for all related terms etc).
167 Note for implementors: you will almost certainly have to
168 take special precaution in order not to create cyclical
169 references in memory.
171 Returns : The ontology of this Term as a Bio::Ontology::OntologyI
173 Args : On set, the ontology of this Term as a Bio::Ontology::OntologyI
174 implementing object or a string representing its name.
176 See L<Bio::Ontology::OntologyI>.
181 shift->throw_not_implemented();
189 Usage : $term->version( "1.00" );
191 print $term->version();
192 Function: Set/get for version information.
193 Returns : The version [scalar].
194 Args : The version [scalar] (optional).
199 shift->throw_not_implemented();
208 Usage : $term->is_obsolete( 1 );
210 if ( $term->is_obsolete() )
211 Function: Set/get for the obsoleteness of this Term.
212 Returns : the obsoleteness [0 or 1].
213 Args : the obsoleteness [0 or 1] (optional).
218 shift->throw_not_implemented();
226 Usage : $term->comment( "Consider the term ..." );
228 print $term->comment();
229 Function: Set/get for an arbitrary comment about this Term.
231 Args : A comment (optional).
236 shift->throw_not_implemented();
245 Usage : @aliases = $term->get_synonyms();
246 Function: Returns a list of aliases of this Term.
248 If an implementor of this interface permits modification of
249 this array property, the class should define at least
250 methods add_synonym() and remove_synonyms(), with obvious
253 Returns : A list of aliases [array of [scalar]].
259 shift->throw_not_implemented();
264 Title : get_dblinks()
265 Usage : @ds = $term->get_dblinks();
266 Function: Returns a list of each dblink of this term.
268 If an implementor of this interface permits modification of
269 this array property, the class should define at least
270 methods add_dblink() and remove_dblinks(), with obvious
273 Returns : A list of dblinks [array of [scalars]].
275 Note : This has been deprecated in favor of get_dbxrefs()
280 shift->throw('get_dblinks() is deprecated, use get_dbxrefs() instead');
285 Title : get_dbxrefs()
286 Usage : @ds = $term->get_dbxrefs();
287 Function: Returns a list of each link for this term.
289 If an implementor of this interface permits modification of
290 this array property, the class should define at least
291 methods add_dbxref() and remove_dbxrefs(), with obvious
294 Returns : A list of dblinks. This can return a mixed 'bag' of scalars and
295 L<Bio::Annotation::DBLink> instances, or specific subgroups
296 can be returned based on passed arguments
297 Args : implementation-specific
302 shift->throw_not_implemented();
305 =head2 get_secondary_ids
307 Title : get_secondary_ids
308 Usage : @ids = $term->get_secondary_ids();
309 Function: Returns a list of secondary identifiers of this Term.
311 Secondary identifiers mostly originate from merging terms,
312 or possibly also from splitting terms.
314 If an implementor of this interface permits modification of
315 this array property, the class should define at least
316 methods add_secondary_id() and remove_secondary_ids(), with
317 obvious functionality.
319 Returns : A list of secondary identifiers [array of [scalar]]
324 sub get_secondary_ids
{
325 shift->throw_not_implemented();
326 } # get_secondary_ids
329 =head1 Deprecated methods
331 Used for looking up the methods that supercedes them.
339 Function: This method is deprecated. Use ontology() instead. We provide
340 an implementation here that preserves backwards compatibility,
341 but if you do not have legacy code using it you should not be
352 $self->warn("TermI::category is deprecated and being phased out. ".
353 "Use TermI::ontology instead.");
355 # called in set mode?
357 # yes; what is incompatible with ontology() is if we were given
360 $arg = $arg->name() if ref($arg) && $arg->isa("Bio::Ontology::TermI");
361 return $self->ontology($arg,@_);
363 # No, called in get mode. This is always incompatible with ontology()
364 # since category is supposed to return a TermI.
365 my $ont = $self->ontology();
368 $term = Bio
::Ontology
::Term
->new(-name
=> $ont->name(),
369 -identifier
=>$ont->identifier());