Bio/Ontology/TermI.pm

filter: Statementstmt 26.6% 8 / 30 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 14.2% 2 / 14 Podpod 100% 12 / 12 totaltotal 32.8% 22 / 67 CC 5 SCAR 22.7
CC
5
Cov
21%
category
30.0
identifier
2.0
name
2.0
CRAP 9.7
« Bio/SearchIO/axt.pm ↑ Summary Bio/Matrix/PSM/IO.pm »
1 #
2 # BioPerl module for Bio::Ontology::Term
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Christian M. Zmasek <czmasek-at-burnham.org> or <cmzmasek@yahoo.com>
7 #
8 # (c) Christian M. Zmasek, czmasek-at-burnham.org, 2002.
9 # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002.
10 #
11 # You may distribute this module under the same terms as perl itself.
12 # Refer to the Perl Artistic License (see the license accompanying this
13 # software package, or see http://www.perl.com/language/misc/Artistic.html)
14 # for the terms under which you may use, modify, and redistribute this module.
15 #
16 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
17 # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18 # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 #
20 # You may distribute this module under the same terms as perl itself
21  
22 # POD documentation - main docs before the code
23  
24 =head1 NAME
25  
26 Bio::Ontology::TermI - interface for ontology terms
27  
28 =head1 SYNOPSIS
29  
30 #get Bio::Ontology::TermI somehow.
31  
32 print $term->identifier(), "\n";
33 print $term->name(), "\n";
34 print $term->definition(), "\n";
35 print $term->is_obsolete(), "\n";
36 print $term->comment(), "\n";
37  
38 foreach my $synonym ( $term->get_synonyms() ) {
39 print $synonym, "\n";
40 }
41  
42  
43 =head1 DESCRIPTION
44  
45 This is "dumb" interface for ontology terms providing basic methods
46 (it provides no functionality related to graphs).
47  
48 =head1 FEEDBACK
49  
50 =head2 Mailing Lists
51  
52 User feedback is an integral part of the evolution of this and other
53 Bioperl modules. Send your comments and suggestions preferably to one
54 of the Bioperl mailing lists. Your participation is much appreciated.
55  
56 bioperl-l@bioperl.org - General discussion
57 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
58  
59 =head2 Support
60  
61 Please direct usage questions or support issues to the mailing list:
62  
63 I<bioperl-l@bioperl.org>
64  
65 rather than to the module maintainer directly. Many experienced and
66 reponsive experts will be able look at the problem and quickly
67 address it. Please include a thorough description of the problem
68 with code and data examples if at all possible.
69  
70 =head2 Reporting Bugs
71  
72 Report bugs to the Bioperl bug tracking system to help us keep track
73 the bugs and their resolution. Bug reports can be submitted via
74 the web:
75  
76 https://github.com/bioperl/bioperl-live/issues
77  
78 =head1 AUTHOR
79  
80 Christian M. Zmasek
81  
82 Email: czmasek-at-burnham.org or cmzmasek@yahoo.com
83  
84 WWW: http://monochrome-effect.net/
85  
86 Address:
87  
88 Genomics Institute of the Novartis Research Foundation
89 10675 John Jay Hopkins Drive
90 San Diego, CA 92121
91  
92 =head1 APPENDIX
93  
94 The rest of the documentation details each of the object
95 methods.
96  
97 =cut
98  
99  
100 # Let the code begin...
101  
102 package Bio::Ontology::TermI;
103 29 $Bio::Ontology::TermI::VERSION = '1.7.8';
104 29 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
105  
106 29 ▶use base qw(Bio::Root::RootI);
Subroutine BEGIN: called CC=1 SCAR=0.0
107  
108  
109  
110 =head2 identifier
111  
112 Title : identifier
113 Usage : $term->identifier( "0003947" );
114 or
115 print $term->identifier();
116 Function: Set/get for the identifier of this Term.
117 Returns : The identifier [scalar].
118 Args : The identifier [scalar] (optional).
119  
120 =cut
121  
122 0 ▶sub identifier {
Subroutine identifier: not called CC=1 SCAR=6.9
Pod documented
123 0 shift->throw_not_implemented();
124 } # identifier
125  
126  
127  
128  
129 =head2 name
130  
131 Title : name
132 Usage : $term->name( "N-acetylgalactosaminyltransferase" );
133 or
134 print $term->name();
135 Function: Set/get for the name of this Term.
136 Returns : The name [scalar].
137 Args : The name [scalar] (optional).
138  
139 =cut
140  
141 0 ▶sub name {
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
142 0 shift->throw_not_implemented();
143 } # name
144  
145  
146  
147  
148  
149 =head2 definition
150  
151 Title : definition
152 Usage : $term->definition( "Catalysis of ..." );
153 or
154 print $term->definition();
155 Function: Set/get for the definition of this Term.
156 Returns : The definition [scalar].
157 Args : The definition [scalar] (optional).
158  
159 =cut
160  
161 0 ▶sub definition {
Subroutine definition: not called CC=1 SCAR=6.9
Pod documented
162 0 shift->throw_not_implemented();
163 } # definition
164  
165  
166  
167 =head2 ontology
168  
169 Title : ontology
170 Usage : $ont = $term->ontology();
171 or
172 $term->ontology( $ont );
173 Function: Get the ontology this term is in.
174  
175 An implementation may not permit the value of this
176 attribute to be changed once it is set, since that may have
177 serious consequences (note that with the ontology in hand
178 you can query for all related terms etc).
179  
180 Note for implementors: you will almost certainly have to
181 take special precaution in order not to create cyclical
182 references in memory.
183  
184 Returns : The ontology of this Term as a Bio::Ontology::OntologyI
185 implementing object.
186 Args : On set, the ontology of this Term as a Bio::Ontology::OntologyI
187 implementing object or a string representing its name.
188  
189 See L<Bio::Ontology::OntologyI>.
190  
191 =cut
192  
193 0 ▶sub ontology {
Subroutine ontology: not called CC=1 SCAR=6.9
Pod documented
194 0 shift->throw_not_implemented();
195 } # ontology
196  
197  
198  
199 =head2 version
200  
201 Title : version
202 Usage : $term->version( "1.00" );
203 or
204 print $term->version();
205 Function: Set/get for version information.
206 Returns : The version [scalar].
207 Args : The version [scalar] (optional).
208  
209 =cut
210  
211 0 ▶sub version {
Subroutine version: not called CC=1 SCAR=6.9
Pod documented
212 0 shift->throw_not_implemented();
213 } # version
214  
215  
216  
217  
218 =head2 is_obsolete
219  
220 Title : is_obsolete
221 Usage : $term->is_obsolete( 1 );
222 or
223 if ( $term->is_obsolete() )
224 Function: Set/get for the obsoleteness of this Term.
225 Returns : the obsoleteness [0 or 1].
226 Args : the obsoleteness [0 or 1] (optional).
227  
228 =cut
229  
230 0 ▶sub is_obsolete {
Subroutine is_obsolete: not called CC=1 SCAR=6.9
Pod documented
231 0 shift->throw_not_implemented();
232 } # is_obsolete
233  
234  
235  
236 =head2 comment
237  
238 Title : comment
239 Usage : $term->comment( "Consider the term ..." );
240 or
241 print $term->comment();
242 Function: Set/get for an arbitrary comment about this Term.
243 Returns : A comment.
244 Args : A comment (optional).
245  
246 =cut
247  
248 0 ▶sub comment {
Subroutine comment: not called CC=1 SCAR=6.9
Pod documented
249 0 shift->throw_not_implemented();
250 } # comment
251  
252  
253  
254  
255 =head2 get_synonyms
256  
257 Title : get_synonyms
258 Usage : @aliases = $term->get_synonyms();
259 Function: Returns a list of aliases of this Term.
260  
261 If an implementor of this interface permits modification of
262 this array property, the class should define at least
263 methods add_synonym() and remove_synonyms(), with obvious
264 functionality.
265  
266 Returns : A list of aliases [array of [scalar]].
267 Args :
268  
269 =cut
270  
271 0 ▶sub get_synonyms {
Subroutine get_synonyms: not called CC=1 SCAR=6.9
Pod documented
272 0 shift->throw_not_implemented();
273 } # get_synonyms
274  
275 =head2 get_dblinks
276  
277 Title : get_dblinks()
278 Usage : @ds = $term->get_dblinks();
279 Function: Returns a list of each dblink of this term.
280  
281 If an implementor of this interface permits modification of
282 this array property, the class should define at least
283 methods add_dblink() and remove_dblinks(), with obvious
284 functionality.
285  
286 Returns : A list of dblinks [array of [scalars]].
287 Args :
288 Note : This has been deprecated in favor of get_dbxrefs()
289  
290 =cut
291  
292 0 ▶sub get_dblinks {
Subroutine get_dblinks: not called CC=1 SCAR=6.9
Pod documented
293 0 shift->throw('get_dblinks() is deprecated, use get_dbxrefs() instead');
294 } # get_dblinks
295  
296 =head2 get_dbxrefs
297  
298 Title : get_dbxrefs()
299 Usage : @ds = $term->get_dbxrefs();
300 Function: Returns a list of each link for this term.
301  
302 If an implementor of this interface permits modification of
303 this array property, the class should define at least
304 methods add_dbxref() and remove_dbxrefs(), with obvious
305 functionality.
306  
307 Returns : A list of dblinks. This can return a mixed 'bag' of scalars and
308 L<Bio::Annotation::DBLink> instances, or specific subgroups
309 can be returned based on passed arguments
310 Args : implementation-specific
311  
312 =cut
313  
314 0 ▶sub get_dbxrefs {
Subroutine get_dbxrefs: not called CC=1 SCAR=6.9
Pod documented
315 0 shift->throw_not_implemented();
316 } # get_dblinks
317  
318 =head2 get_secondary_ids
319  
320 Title : get_secondary_ids
321 Usage : @ids = $term->get_secondary_ids();
322 Function: Returns a list of secondary identifiers of this Term.
323  
324 Secondary identifiers mostly originate from merging terms,
325 or possibly also from splitting terms.
326  
327 If an implementor of this interface permits modification of
328 this array property, the class should define at least
329 methods add_secondary_id() and remove_secondary_ids(), with
330 obvious functionality.
331  
332 Returns : A list of secondary identifiers [array of [scalar]]
333 Args :
334  
335 =cut
336  
337 0 ▶sub get_secondary_ids {
Subroutine get_secondary_ids: not called CC=1 SCAR=6.9
Pod documented
338 0 shift->throw_not_implemented();
339 } # get_secondary_ids
340  
341  
342 =head1 Deprecated methods
343  
344 Used for looking up the methods that supersedes them.
345  
346 =cut
347  
348 =head2 category
349  
350 Title : category
351 Usage :
352 Function: This method is deprecated. Use ontology() instead. We provide
353 an implementation here that preserves backwards compatibility,
354 but if you do not have legacy code using it you should not be
355 calling this method.
356 Example :
357 Returns :
358 Args :
359  
360 =cut
361  
362 0 ▶sub category {
Subroutine category: not called CC=5 SCAR=34.0
Pod documented
363 0 my $self = shift;
364  
365 0 $self->warn("TermI::category is deprecated and being phased out. ".
366 "Use TermI::ontology instead.");
367  
368 # called in set mode?
369 0 ▶ if(@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
370 # yes; what is incompatible with ontology() is if we were given
371 # a TermI object
372 0 my $arg = shift;
373 0 ▶ $arg = $arg->name() if ref($arg) && $arg->isa("Bio::Ontology::TermI");
Branch: 1 branch
BranchTrueFalseTotal
if ref $arg and $arg->isa("Bio::Ontology::TermI") 0 0 0
Condition0%0/3
ref $arg and $arg->isa("Bio::Ontology::TermI")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $arg and $arg->isa("Bio::Ontology::TermI")
ref $arg $arg->isa("Bio::Ontology::TermI")
Truth table0%0/3
A and B
A= ref $argB= $arg->isa("Bio::Ontology::TermI")
ABresult
0X0
100
111
374 0 return $self->ontology($arg,@_);
375 } else {
376 # No, called in get mode. This is always incompatible with ontology()
377 # since category is supposed to return a TermI.
378 0 my $ont = $self->ontology();
379 0 my $term;
380 0 ▶ if(defined($ont)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ont) 0 0 0
381 0 $term = Bio::Ontology::Term->new(-name => $ont->name(),
382 -identifier =>$ont->identifier());
383 }
384 0 return $term;
385 }
386 } # category
387  
388 29 1;
« Bio/SearchIO/axt.pm ↑ Summary Bio/Matrix/PSM/IO.pm »