Bio/Ontology/OBOEngine.pm

filter: Statementstmt 91.4% 266 / 291 Branchbran 70.5% 72 / 102 Conditioncond 53.3% 16 / 30 MC/DCmcdc 0.0% 0 / 15 Subroutinesub 96.2% 51 / 53 Podpod 100% 31 / 31 totaltotal 83.5% 436 / 522 CC 74 SCAR 17.1
CC
74
Cov
84%
_get_id
20.2
find_similar_terms
10.4
_get_child_parent_terms_helper
9.0
CRAP 5.5
« Bio/Tools/SeqPattern/Backtranslate.pm ↑ Summary Bio/Tools/ECnumber.pm »
1 #
2 # BioPerl module for Bio::Ontology::OBOEngine
3 #
4 # POD documentation - main docs before the code
5  
6 =head1 NAME
7  
8 Bio::Ontology::OBOEngine - An Ontology Engine for OBO style flat file
9 format from the Gene Ontology Consortium
10  
11 =head1 SYNOPSIS
12  
13 use Bio::Ontology::OBOEngine;
14  
15 my $parser = Bio::Ontology::OBOEngine->new
16 ( -file => "gene_ontology.obo" );
17  
18 my $engine = $parser->parse();
19  
20 =head1 DESCRIPTION
21  
22 Needs Graph.pm from CPAN.
23  
24 This module replaces SimpleGOEngine.pm, which is deprecated.
25  
26 =head1 FEEDBACK
27  
28 =head2 Mailing Lists
29  
30 User feedback is an integral part of the evolution of this and other
31 Bioperl modules. Send your comments and suggestions preferably to the
32 Bioperl mailing lists Your participation is much appreciated.
33  
34 bioperl-l@bioperl.org - General discussion
35 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
36  
37 =head2 Support
38  
39 Please direct usage questions or support issues to the mailing list:
40  
41 I<bioperl-l@bioperl.org>
42  
43 rather than to the module maintainer directly. Many experienced and
44 reponsive experts will be able look at the problem and quickly
45 address it. Please include a thorough description of the problem
46 with code and data examples if at all possible.
47  
48 =head2 Reporting Bugs
49  
50 Report bugs to the Bioperl bug tracking system to help us keep track
51 the bugs and their resolution. Bug reports can be submitted via
52 the web:
53  
54 https://github.com/bioperl/bioperl-live/issues
55  
56 =head1 AUTHOR
57  
58 Sohel Merchant
59  
60 Email: s-merchant@northwestern.edu
61  
62 Address:
63  
64 Northwestern University
65 Center for Genetic Medicine (CGM), dictyBase
66 Suite 1206,
67 676 St. Clair st
68 Chicago IL 60611
69  
70 =head2 CONTRIBUTOR
71  
72 Hilmar Lapp, hlapp at gmx.net
73 Chris Mungall, cjm at fruitfly.org
74  
75 =head1 APPENDIX
76  
77 The rest of the documentation details each of the object
78 methods. Internal methods are usually preceded with a _
79  
80 =cut
81  
82 package Bio::Ontology::OBOEngine;
83 10 $Bio::Ontology::OBOEngine::VERSION = '1.7.8';
84 10 ▶use Bio::Ontology::SimpleGOEngine::GraphAdaptor;
Subroutine BEGIN: called CC=1 SCAR=0.0
85  
86 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
87 10 ▶use Bio::Ontology::RelationshipType;
Subroutine BEGIN: called CC=1 SCAR=0.0
88 10 ▶use Bio::Ontology::RelationshipFactory;
Subroutine BEGIN: called CC=1 SCAR=0.0
89 10 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
90  
91 10 ▶use constant TRUE => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
92 10 ▶use constant FALSE => 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
93 10 ▶use constant IS_A => "IS_A";
Subroutine BEGIN: called CC=1 SCAR=0.0
94 10 ▶use constant PART_OF => "PART_OF";
Subroutine BEGIN: called CC=1 SCAR=0.0
95 10 ▶use constant RELATED_TO => "RELATED_TO";
Subroutine BEGIN: called CC=1 SCAR=0.0
96 10 ▶use constant TERM => "TERM";
Subroutine BEGIN: called CC=1 SCAR=0.0
97 10 ▶use constant TYPE => "TYPE";
Subroutine BEGIN: called CC=1 SCAR=0.0
98 10 ▶use constant ONTOLOGY => "ONTOLOGY";
Subroutine BEGIN: called CC=1 SCAR=0.0
99 10 ▶use constant REGULATES => "REGULATES";
Subroutine BEGIN: called CC=1 SCAR=0.0
100 10 ▶use constant POSITIVELY_REGULATES => "POSITIVELY_REGULATES";
Subroutine BEGIN: called CC=1 SCAR=0.0
101 10 ▶use constant NEGATIVELY_REGULATES => "NEGATIVELY_REGULATES";
Subroutine BEGIN: called CC=1 SCAR=0.0
102  
103  
104 10 ▶use base qw(Bio::Root::Root Bio::Ontology::OntologyEngineI);
Subroutine BEGIN: called CC=1 SCAR=0.0
105  
106  
107  
108 =head2 new
109  
110 Title : new
111 Usage : $engine = Bio::Ontology::OBOEngine->new()
112 Function: Creates a new OBOEngine
113 Returns : A new OBOEngine object
114 Args :
115  
116 =cut
117  
118 8 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
119 8 my( $class, @args ) = @_;
120  
121 8 my $self = $class->SUPER::new( @args );
122  
123 8 $self->init();
124  
125 8 return $self;
126 } # new
127  
128  
129  
130 =head2 init
131  
132 Title : init()
133 Usage : $engine->init();
134 Function: Initializes this Engine.
135 Returns :
136 Args :
137  
138 =cut
139  
140 8 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod documented
141 8 my ( $self ) = @_;
142  
143 8 $self->{ "_is_a_relationship" } = Bio::Ontology::RelationshipType->get_instance( IS_A );
144 8 $self->{ "_part_of_relationship" } = Bio::Ontology::RelationshipType->get_instance( PART_OF );
145 8 $self->{ "_related_to_relationship" } = Bio::Ontology::RelationshipType->get_instance( RELATED_TO );
146  
147 8 $self->{'_regulates_relationship'} = Bio::Ontology::RelationshipType->get_instance(REGULATES);
148 8 $self->{'_positively_regulate'} = Bio::Ontology::RelationshipType->get_instance(POSITIVELY_REGULATES);
149 8 $self->{'_negatively_regulate'} = Bio::Ontology::RelationshipType->get_instance(NEGATIVELY_REGULATES);
150
151  
152 8 $self->graph( Bio::Ontology::SimpleGOEngine::GraphAdaptor->new() ); # NG 05-02-16
153  
154 # set defaults for the factories
155 8 $self->relationship_factory(Bio::Ontology::RelationshipFactory->new(
156 -type => "Bio::Ontology::Relationship"));
157  
158 } # init
159  
160  
161  
162 =head2 is_a_relationship
163  
164 Title : is_a_relationship()
165 Usage : $IS_A = $engine->is_a_relationship();
166 Function: Returns a Bio::Ontology::RelationshipType object for "is-a"
167 relationships
168 Returns : Bio::Ontology::RelationshipType set to "IS_A"
169 Args :
170  
171 =cut
172  
173 1208 ▶sub is_a_relationship {
Subroutine is_a_relationship: called CC=2 SCAR=7.6
Pod documented
174 1208 my ( $self, $value ) = @_;
175  
176 1208 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 1208 1208
177 0 $self->throw( "Attempted to change immutable field" );
178 }
179  
180 1208 return $self->{ "_is_a_relationship" };
181 } # is_a_relationship
182  
183  
184  
185 =head2 part_of_relationship
186  
187 Title : part_of_relationship()
188 Usage : $PART_OF = $engine->part_of_relationship();
189 Function: Returns a Bio::Ontology::RelationshipType object for "part-of"
190 relationships
191 Returns : Bio::Ontology::RelationshipType set to "PART_OF"
192 Args :
193  
194 =cut
195  
196 58 ▶sub part_of_relationship {
Subroutine part_of_relationship: called CC=2 SCAR=7.6
Pod documented
197 58 my ( $self, $value ) = @_;
198  
199 58 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 58 58
200 0 $self->throw( "Attempted to change immutable field" );
201 }
202  
203 58 return $self->{ "_part_of_relationship" };
204 } # part_of_relationship
205  
206  
207 =head2 related_to_relationship
208  
209 Title : related_to_relationship()
210 Usage : $RELATED_TO = $engine->related_to_relationship();
211 Function: Returns a Bio::Ontology::RelationshipType object for "related-to"
212 relationships
213 Returns : Bio::Ontology::RelationshipType set to "RELATED_TO"
214 Args :
215  
216 =cut
217  
218 11 ▶sub related_to_relationship {
Subroutine related_to_relationship: called CC=2 SCAR=7.6
Pod documented
219 11 my ( $self, $value ) = @_;
220  
221 11 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 11 11
222 0 $self->throw( "Attempted to change immutable field" );
223 }
224  
225 11 return $self->{ "_related_to_relationship" };
226 } # related_to_relationship
227  
228 =head2 regulates_relationship
229  
230 Title : regulates_relationship()
231 Usage : $REGULATES = $engine->regulates_relationship();
232 Function: Returns a Bio::Ontology::RelationshipType object for "regulates"
233 relationships
234 Returns : Bio::Ontology::RelationshipType set to "REGULATES"
235 Args :
236  
237 =cut
238  
239 6 ▶sub regulates_relationship {
Subroutine regulates_relationship: called CC=2 SCAR=7.6
Pod documented
240 6 my ( $self, $value ) = @_;
241  
242 6 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 6 6
243 0 $self->throw( "Attempted to change immutable field" );
244 }
245  
246 6 return $self->{ "_regulates_relationship" };
247 } # is_a_relationship
248  
249 =head2 positively_regulates_relationship
250  
251 Title : positively_regulates_relationship()
252 Usage : $REGULATES = $engine->positively_regulates_relationship();
253 Function: Returns a Bio::Ontology::RelationshipType object for "positively_regulates"
254 relationships
255 Returns : Bio::Ontology::RelationshipType set to "POSITIVELY_REGULATES"
256 Args :
257  
258 =cut
259  
260 6 ▶sub positively_regulates_relationship {
Subroutine positively_regulates_relationship: called CC=2 SCAR=7.6
Pod documented
261 6 my ( $self, $value ) = @_;
262  
263 6 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 6 6
264 0 $self->throw( "Attempted to change immutable field" );
265 }
266  
267 6 return $self->{ "_positively_regulate" };
268 }
269  
270 =head2 negatively_regulates_relationship
271  
272 Title : negatively_regulates_relationship()
273 Usage : $REGULATES = $engine->negatively_regulates_relationship();
274 Function: Returns a Bio::Ontology::RelationshipType object for "negatively_regulates"
275 relationships
276 Returns : Bio::Ontology::RelationshipType set to "POSITIVELY_REGULATES"
277 Args :
278  
279 =cut
280  
281 6 ▶sub negatively_regulates_relationship {
Subroutine negatively_regulates_relationship: called CC=2 SCAR=7.6
Pod documented
282 6 my ( $self, $value ) = @_;
283  
284 6 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 6 6
285 0 $self->throw( "Attempted to change immutable field" );
286 }
287  
288 6 return $self->{ "_negatively_regulate" };
289 }
290  
291  
292 =head2 add_term
293  
294 Title : add_term
295 Usage : $engine->add_term( $term_obj );
296 Function: Adds a Bio::Ontology::TermI to this engine
297 Returns : true if the term was added and false otherwise (e.g., if the
298 term already existed in the ontology engine)
299 Args : Bio::Ontology::TermI`
300  
301 =cut
302  
303 1412 ▶sub add_term {
Subroutine add_term: called CC=2 SCAR=6.9
Pod documented
304 1412 my ( $self, $term ) = @_;
305  
306 1412 ▶ return FALSE if $self->has_term( $term );
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_term($term) 163 1249 1412
307  
308 1249 my $goid = $self->_get_id($term);
309  
310 1249 $self->graph()->add_vertex( $goid );
311 1249 $self->graph()->set_vertex_attribute( $goid, TERM, $term ); # NG 05-02-16
312 1249 return TRUE;
313  
314 } # add_term
315  
316  
317  
318 =head2 has_term
319  
320 Title : has_term
321 Usage : $engine->has_term( $term );
322 Function: Checks whether this engine contains a particular term
323 Returns : true or false
324 Args : Bio::Ontology::TermI
325 or
326 Term identifier (e.g. "GO:0012345")
327  
328 =cut
329  
330 3923 ▶sub has_term {
Subroutine has_term: called CC=2 SCAR=6.9
Pod documented
331 3923 my ( $self, $term ) = @_;
332 3923 $term = $self->_get_id( $term );
333 3923 ▶ if ( $self->graph()->has_vertex( $term ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->graph->has_vertex($term)) { } 1435 2488 3923
334 1435 return TRUE;
335 }
336 else {
337 2488 return FALSE;
338 }
339  
340 } # has_term
341  
342  
343 =head2 add_relationship_type
344  
345 Title : add_relationship_type
346 Usage : $engine->add_relationship_type( $type_name, $ont );
347 Function: Adds a new relationship type to the engine. Use
348 get_relationship_type($type_name) to retrieve.
349 Returns : true if successfully added, false otherwise
350 Args : relationship type name to add (scalar)
351 ontology to which to assign the relationship type
352  
353 =cut
354  
355 9 ▶sub add_relationship_type{
Subroutine add_relationship_type: called CC=2 SCAR=7.1
Pod documented
356 9 my ($self,@args) = @_;
357  
358 9 ▶ if(scalar(@_) == 3){
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_ == 3) 9 0 9
359 9 my $type_name = $args[0];
360 9 my $ont = $args[1];
361 9 $self->{ "_extra_relationship_types" }{$type_name} = Bio::Ontology::RelationshipType->get_instance($type_name,$ont);
362 #warn Dumper($self->{"_extra_relationship_types"}{$type_name});
363 9 return 1;
364 }
365 0 return 0;
366 }
367  
368  
369 =head2 get_relationship_type
370  
371 Title : get_relationship_type
372 Usage : $engine->get_relationship_type( $type_name );
373 Function: Gets a Bio::Ontology::RelationshipI object corresponding
374 to $type_name
375 Returns : a Bio::Ontology::RelationshipI object
376 Args :
377  
378 =cut
379  
380 282 ▶sub get_relationship_type{
Subroutine get_relationship_type: called CC=1 SCAR=0.0
Pod documented
381 282 my ($self,$type_name) = @_;
382 282 return $self->{ "_extra_relationship_types" }{$type_name};
383 }
384  
385 =head2 add_relationship
386  
387 Title : add_relationship
388 Usage : $engine->add_relationship( $relationship );
389 $engine->add_relatioship( $subject_term, $predicate_term,
390 $object_term, $ontology );
391 $engine->add_relatioship( $subject_id, $predicate_id,
392 $object_id, $ontology);
393 Function: Adds a relationship to this engine
394 Returns : true if successfully added, false otherwise
395 Args : The relationship in one of three ways:
396  
397 a) subject (or child) term id, Bio::Ontology::TermI
398 (rel.type), object (or parent) term id, ontology
399  
400 or
401  
402 b) subject Bio::Ontology::TermI, predicate
403 Bio::Ontology::TermI (rel.type), object
404 Bio::Ontology::TermI, ontology
405  
406 or
407  
408 c) Bio::Ontology::RelationshipI-compliant object
409  
410 =cut
411  
412 # term objs or term ids
413 1487 ▶sub add_relationship {
Subroutine add_relationship: called CC=5 SCAR=16.1
Pod documented
414 1487 my ( $self, $child, $type, $parent, $ont ) = @_;
415  
416 1487 ▶ if ( scalar( @_ ) == 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_ == 2) 2 1485 1487
417 2 $self->_check_class( $child, "Bio::Ontology::RelationshipI" );
418 2 $type = $child->predicate_term();
419 2 $parent = $child->object_term();
420 2 $ont = $child->ontology();
421 2 $child = $child->subject_term();
422 }
423  
424  
425 1487 $self->_check_class( $type, "Bio::Ontology::TermI" );
426  
427 1487 my $parentid = $self->_get_id( $parent );
428 1487 my $childid = $self->_get_id( $child );
429  
430 1487 my $g = $self->graph();
431  
432 1487 ▶ $self->add_term($child) unless $g->has_vertex( $childid );
Branch: 1 branch
BranchTrueFalseTotal
unless $g->has_vertex($childid) 0 1487 1487
433 1487 ▶ $self->add_term($parent) unless $g->has_vertex( $parentid );
Branch: 1 branch
BranchTrueFalseTotal
unless $g->has_vertex($parentid) 0 1487 1487
434  
435 # This prevents multi graphs.
436 1487 ▶ if ( $g->has_edge( $parentid, $childid ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($g->has_edge($parentid, $childid)) 15 1472 1487
437 15 return FALSE;
438 }
439  
440 1472 $g->add_edge( $parentid, $childid );
441 1472 $g->set_edge_attribute( $parentid, $childid, TYPE, $type ); # NG 05-02-16
442 1472 $g->set_edge_attribute( $parentid, $childid, ONTOLOGY, $ont ); # NG 05-02-16
443  
444 1472 return TRUE;
445  
446 } # add_relationship
447  
448  
449  
450  
451 =head2 get_relationships
452  
453  
454 Title : get_relationships
455 Usage : $engine->get_relationships( $term );
456 Function: Returns all relationships of a term, or all relationships in
457 the graph if no term is specified.
458 Returns : Relationship
459 Args : term id
460 or
461 Bio::Ontology::TermI
462  
463 =cut
464  
465 7 ▶sub get_relationships {
Subroutine get_relationships: called CC=5 SCAR=16.1
Pod documented
466 7 my ( $self, $term ) = @_;
467  
468 7 my $g = $self->graph();
469  
470 # obtain the ID if term provided
471 7 my $termid;
472 7 ▶ if($term) {
Branch: 1 branch
BranchTrueFalseTotal
if ($term) 3 4 7
473 3 $termid = $self->_get_id( $term );
474 # check for presence in the graph
475 3 ▶ if ( ! $g->has_vertex( $termid ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($g->has_vertex($termid)) 0 3 3
476 0 $self->throw( "no term with identifier \"$termid\" in ontology" );
477 }
478 }
479  
480 # now build the relationships
481 7 my $relfact = $self->relationship_factory();
482 # we'll build the relationships from edges
483 7 my @rels = ();
484 7 ▶ my @edges = $termid ? $g->edges_at( $termid ) : $g->edges(); # NG 05-02-13
Branch: 1 branch
BranchTrueFalseTotal
$termid ? : 3 4 7
485 7 ▶ while(@edges) {
Branch: 1 branch
BranchTrueFalseTotal
if (@edges) 1343 7 1350
486 1343 my ( $startid, $endid ) = @{ shift @edges }; # NG 05-02-16
487 1343 my $rel = $relfact->create_object
488 (-subject_term => $self->get_terms($endid),
489 -object_term => $self->get_terms($startid),
490 -predicate_term => $g->get_edge_attribute($startid, $endid, TYPE),
491 -ontology => $g->get_edge_attribute($startid, $endid, ONTOLOGY));
492 1343 push( @rels, $rel );
493  
494 }
495  
496 7 return @rels;
497  
498 } # get_relationships
499  
500 =head2 get_all_relationships
501  
502  
503 Title : get_all_relationships
504 Usage : @rels = $engine->get_all_relationships();
505 Function: Returns all relationships in the graph.
506 Returns : Relationship
507 Args :
508  
509 =cut
510  
511 0 ▶sub get_all_relationships {
Subroutine get_all_relationships: not called CC=1 SCAR=6.9
Pod documented
512 0 return shift->get_relationships(@_);
513 } # get_all_relationships
514  
515  
516  
517 =head2 get_predicate_terms
518  
519 Title : get_predicate_terms
520 Usage : $engine->get_predicate_terms();
521 Function: Returns the types of relationships this engine contains
522 Returns : Bio::Ontology::RelationshipType
523 Args :
524  
525 =cut
526  
527 3 ▶sub get_predicate_terms {
Subroutine get_predicate_terms: called CC=2 SCAR=6.9
Pod documented
528 3 my ( $self ) = @_;
529  
530 3 my @a = (
531 $self->is_a_relationship(),
532 $self->part_of_relationship(),
533 $self->related_to_relationship(),
534 $self->regulates_relationship(),
535 $self->positively_regulates_relationship(),
536 $self->negatively_regulates_relationship(),
537 );
538  
539 3 foreach my $termname (keys %{$self->{ "_extra_relationship_types" }}){
540 4 push @a, $self->{ "_extra_relationship_types" }{ $termname };
541 }
542  
543 3 return @a;
544 } # get_predicate_terms
545  
546  
547  
548  
549 =head2 get_child_terms
550  
551 Title : get_child_terms
552 Usage : $engine->get_child_terms( $term_obj, @rel_types );
553 $engine->get_child_terms( $term_id, @rel_types );
554 Function: Returns the children of this term
555 Returns : Bio::Ontology::TermI
556 Args : Bio::Ontology::TermI, Bio::Ontology::RelationshipType
557 or
558 term id, Bio::Ontology::RelationshipType
559  
560 if NO Bio::Ontology::RelationshipType is indicated: children
561 of ALL types are returned
562  
563 =cut
564  
565 326 ▶sub get_child_terms {
Subroutine get_child_terms: called CC=1 SCAR=0.0
Pod documented
566 326 my ( $self, $term, @types ) = @_;
567  
568 326 return $self->_get_child_parent_terms_helper( $term, TRUE, @types );
569  
570 } # get_child_terms
571  
572  
573 =head2 get_descendant_terms
574  
575 Title : get_descendant_terms
576 Usage : $engine->get_descendant_terms( $term_obj, @rel_types );
577 $engine->get_descendant_terms( $term_id, @rel_types );
578 Function: Returns the descendants of this term
579 Returns : Bio::Ontology::TermI
580 Args : Bio::Ontology::TermI, Bio::Ontology::RelationshipType
581 or
582 term id, Bio::Ontology::RelationshipType
583  
584 if NO Bio::Ontology::RelationshipType is indicated:
585 descendants of ALL types are returned
586  
587 =cut
588  
589 10 ▶sub get_descendant_terms {
Subroutine get_descendant_terms: called CC=3 SCAR=11.1
Pod documented
590 10 my ( $self, $term, @types ) = @_;
591  
592 10 my %ids = ();
593 10 my @ids = ();
594  
595 10 $term = $self->_get_id( $term );
596  
597 10 ▶ if ( ! $self->graph()->has_vertex( $term ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->graph->has_vertex($term)) 0 10 10
598 0 $self->throw( "Ontology does not contain a term with an identifier of \"$term\"" );
599 }
600  
601 10 $self->_get_descendant_terms_helper( $term, \%ids, \@types );
602  
603 10 ▶ while( ( my $id ) = each ( %ids ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($id) = each %ids) 290 10 300
604 290 push( @ids, $id );
605 }
606  
607 10 return $self->get_terms( @ids );
608  
609 } # get_descendant_terms
610  
611  
612 =head2 get_parent_terms
613  
614 Title : get_parent_terms
615 Usage : $engine->get_parent_terms( $term_obj, @rel_types );
616 $engine->get_parent_terms( $term_id, @rel_types );
617 Function: Returns the parents of this term
618 Returns : Bio::Ontology::TermI
619 Args : Bio::Ontology::TermI, Bio::Ontology::RelationshipType
620 or
621 term id, Bio::Ontology::RelationshipType
622  
623 if NO Bio::Ontology::RelationshipType is indicated:
624 parents of ALL types are returned
625  
626 =cut
627  
628 105 ▶sub get_parent_terms {
Subroutine get_parent_terms: called CC=1 SCAR=0.0
Pod documented
629 105 my ( $self, $term, @types ) = @_;
630  
631 105 return $self->_get_child_parent_terms_helper( $term, FALSE, @types );
632  
633 } # get_parent_terms
634  
635  
636  
637 =head2 get_ancestor_terms
638  
639 Title : get_ancestor_terms
640 Usage : $engine->get_ancestor_terms( $term_obj, @rel_types );
641 $engine->get_ancestor_terms( $term_id, @rel_types );
642 Function: Returns the ancestors of this term
643 Returns : Bio::Ontology::TermI
644 Args : Bio::Ontology::TermI, Bio::Ontology::RelationshipType
645 or
646 term id, Bio::Ontology::RelationshipType
647  
648 if NO Bio::Ontology::RelationshipType is indicated:
649 ancestors of ALL types are returned
650  
651 =cut
652  
653 14 ▶sub get_ancestor_terms {
Subroutine get_ancestor_terms: called CC=3 SCAR=11.1
Pod documented
654 14 my ( $self, $term, @types ) = @_;
655  
656 14 my %ids = ();
657 14 my @ids = ();
658  
659 14 $term = $self->_get_id( $term );
660  
661 14 ▶ if ( ! $self->graph()->has_vertex( $term ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->graph->has_vertex($term)) 0 14 14
662 0 $self->throw( "Ontology does not contain a term with an identifier of \"$term\"" );
663 }
664  
665 14 $self->_get_ancestor_terms_helper( $term, \%ids, \@types );
666  
667 14 ▶ while( ( my $id ) = each ( %ids ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($id) = each %ids) 61 14 75
668 61 push( @ids, $id );
669 }
670  
671 14 return $self->get_terms( @ids );
672  
673 } # get_ancestor_terms
674  
675  
676  
677  
678  
679 =head2 get_leaf_terms
680  
681 Title : get_leaf_terms
682 Usage : $engine->get_leaf_terms();
683 Function: Returns the leaf terms
684 Returns : Bio::Ontology::TermI
685 Args :
686  
687 =cut
688  
689 2 ▶sub get_leaf_terms {
Subroutine get_leaf_terms: called CC=1 SCAR=0.0
Pod documented
690 2 my ( $self ) = @_;
691  
692 2 my @a = $self->graph()->sink_vertices();
693  
694 2 return $self->get_terms( @a );
695  
696 }
697  
698  
699  
700 =head2 get_root_terms()
701  
702 Title : get_root_terms
703 Usage : $engine->get_root_terms();
704 Function: Returns the root terms
705 Returns : Bio::Ontology::TermI
706 Args :
707  
708 =cut
709  
710 7 ▶sub get_root_terms {
Subroutine get_root_terms: called CC=1 SCAR=0.0
Pod documented
711 7 my ( $self ) = @_;
712  
713  
714 7 my @a = $self->graph()->source_vertices();
715  
716 7 return $self->get_terms( @a );
717  
718 }
719  
720  
721 =head2 get_terms
722  
723 Title : get_terms
724 Usage : @terms = $engine->get_terms( "GO:1234567", "GO:2234567" );
725 Function: Returns term objects with given identifiers
726 Returns : Bio::Ontology::TermI, or the term corresponding to the
727 first identifier if called in scalar context
728 Args : term ids
729  
730 =cut
731  
732 3554 ▶sub get_terms {
Subroutine get_terms: called CC=4 SCAR=13.9
Pod documented
733 3554 my ( $self, @ids ) = @_;
734  
735 3554 my @terms = ();
736  
737 3554 foreach my $id ( @ids ) {
738 10025 ▶ if ( $self->graph()->has_vertex( $id ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->graph->has_vertex($id)) 10018 7 10025
739 10018 push( @terms, $self->graph()->get_vertex_attribute( $id, TERM ) ); # NG 05-02-16
740 }
741 }
742  
743 3554 ▶ return wantarray ? @terms : shift(@terms);
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 3164 390 3554
744  
745 } # get_terms
746  
747  
748 =head2 get_all_terms
749  
750 Title : get_all_terms
751 Usage : $engine->get_all_terms();
752 Function: Returns all terms in this engine
753 Returns : Bio::Ontology::TermI
754 Args :
755  
756 =cut
757  
758 8 ▶sub get_all_terms {
Subroutine get_all_terms: called CC=1 SCAR=0.0
Pod documented
759 8 my ( $self ) = @_;
760  
761 8 return( $self->get_terms( $self->graph()->vertices() ) );
762  
763 } # get_all_terms
764  
765  
766 =head2 find_terms
767  
768 Title : find_terms
769 Usage : ($term) = $oe->find_terms(-identifier => "SO:0000263");
770 Function: Find term instances matching queries for their attributes.
771  
772 This implementation can efficiently resolve queries by
773 identifier.
774  
775 Example :
776 Returns : an array of zero or more Bio::Ontology::TermI objects
777 Args : Named parameters. The following parameters should be recognized
778 by any implementations:
779  
780 -identifier query by the given identifier
781 -name query by the given name
782  
783 =cut
784  
785 8 ▶sub find_terms{
Subroutine find_terms: called CC=3 SCAR=11.0
Pod documented
786 8 my ($self,@args) = @_;
787 8 my @terms;
788  
789 8 my ($id,$name) = $self->_rearrange([qw(IDENTIFIER NAME)],@args);
790  
791 8 ▶ if(defined($id)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $id) { } 4 4 8
792 4 @terms = $self->get_terms($id);
793 } else {
794 4 @terms = $self->get_all_terms();
795 }
796 8 ▶ if(defined($name)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $name) 4 4 8
797 4 @terms = grep { $_->name() eq $name; } @terms;
798 }
799 8 return @terms;
800 }
801  
802  
803 =head2 find_identically_named_terms
804  
805 Title : find_identically_named_terms
806 Usage : ($term) = $oe->find_identically_named_terms($term0);
807 Function: Find term instances where names match the query term
808 name exactly
809 Example :
810 Returns : an array of zero or more Bio::Ontology::TermI objects
811 Args : a Bio::Ontology::TermI object
812  
813 =cut
814  
815 1 ▶sub find_identically_named_terms{
Subroutine find_identically_named_terms: called CC=6 SCAR=19.1
Pod documented
816 1 my ($self,$qterm) = @_;
817 1 ▶ $self->throw("Argument doesn't implement Bio::Ontology::TermI. " . "Bummer." )
Branch: 1 branch
BranchTrueFalseTotal
unless defined $qterm and $qterm->isa("Bio::Ontology::TermI") 0 1 1
Condition33%1/3
defined $qterm and $qterm->isa("Bio::Ontology::TermI")
!ll&&!rl&&r
001
MC/DC0%0/2
defined $qterm and $qterm->isa("Bio::Ontology::TermI")
defined $qterm $qterm->isa("Bio::Ontology::TermI")
Truth table33%1/3
A and B
A= defined $qtermB= $qterm->isa("Bio::Ontology::TermI")
ABresult
0X0
100
111
818 unless defined $qterm and $qterm->isa("Bio::Ontology::TermI");
819  
820 1 my %matching_terms;
821  
822 1 foreach my $term ($self->get_all_terms) {
823 1008 ▶ $matching_terms{$term->identifier} = $term and next
Branch: 1 branch
BranchTrueFalseTotal
if $term->name eq $qterm->name 1 1007 1008
Condition60%3/5
$term->name eq $qterm->name && (($matching_terms{$term->identifier} = $term) && (next))
!ll&&!rl&&r
100710
$matching_terms{$term->identifier} = $term and next
!ll
01
MC/DC0%0/2
$term->name eq $qterm->name && (($matching_terms{$term->identifier} = $term) && (next))
$term->name eq $qterm->name $matching_terms{$term->identifier} = $term
Truth table33%1/3
A && B
A= $term->name eq $qterm->nameB= $matching_terms{$term->identifier} = $term
ABresult
0X0
100
111
824 if $term->name eq $qterm->name;
825 }
826 1 return values %matching_terms;
827 }
828  
829  
830 =head2 find_identical_terms
831  
832 Title : find_identical_terms
833 Usage : ($term) = $oe->find_identical_terms($term0);
834 Function: Find term instances where name or synonym
835 matches the query exactly
836 Example :
837 Returns : an array of zero or more Bio::Ontology::TermI objects
838 Args : a Bio::Ontology::TermI object
839  
840 =cut
841  
842 1 ▶sub find_identical_terms{
Subroutine find_identical_terms: called CC=8 SCAR=22.0
Pod documented
843 1 my ($self,$qterm) = @_;
844 1 ▶ $self->throw("Argument doesn't implement Bio::Ontology::TermI. " . "Bummer." )
Branch: 1 branch
BranchTrueFalseTotal
unless defined $qterm and $qterm->isa("Bio::Ontology::TermI") 0 1 1
Condition33%1/3
defined $qterm and $qterm->isa("Bio::Ontology::TermI")
!ll&&!rl&&r
001
MC/DC0%0/2
defined $qterm and $qterm->isa("Bio::Ontology::TermI")
defined $qterm $qterm->isa("Bio::Ontology::TermI")
Truth table33%1/3
A and B
A= defined $qtermB= $qterm->isa("Bio::Ontology::TermI")
ABresult
0X0
100
111
845 unless defined $qterm and $qterm->isa("Bio::Ontology::TermI");
846  
847 1 my %matching_terms;
848  
849 1 foreach my $qstring ($qterm->name, $qterm->each_synonym) {
850 1 foreach my $term ($self->get_all_terms) {
851 1008 foreach my $string ( $term->name, $term->each_synonym() ) {
852 1281 ▶ $matching_terms{$term->identifier} = $term and next
Branch: 1 branch
BranchTrueFalseTotal
if $string eq $qstring 1 1280 1281
Condition60%3/5
$string eq $qstring && (($matching_terms{$term->identifier} = $term) && (next))
!ll&&!rl&&r
128010
$matching_terms{$term->identifier} = $term and next
!ll
01
MC/DC0%0/2
$string eq $qstring && (($matching_terms{$term->identifier} = $term) && (next))
$string eq $qstring $matching_terms{$term->identifier} = $term
Truth table33%1/3
A && B
A= $string eq $qstringB= $matching_terms{$term->identifier} = $term
ABresult
0X0
100
111
853 if $string eq $qstring;
854 }
855 }
856 }
857 1 return values %matching_terms;
858 }
859  
860 =head2 find_similar_terms
861  
862 Title : find_similar_terms
863 Usage : ($term) = $oe->find_similar_terms($term0);
864 Function: Find term instances where name or synonym, or part of one,
865 matches the query.
866 Example :
867 Returns : an array of zero or more Bio::Ontology::TermI objects
868 Args : a Bio::Ontology::TermI object
869  
870 =cut
871  
872 1 ▶sub find_similar_terms{
Subroutine find_similar_terms: called CC=9 SCAR=23.5
Pod documented
873 1 my ($self,$qterm) = @_;
874 1 ▶ $self->throw("Argument doesn't implement Bio::Ontology::TermI. " . "Bummer." )
Branch: 1 branch
BranchTrueFalseTotal
unless defined $qterm and $qterm->isa("Bio::Ontology::TermI") 0 1 1
Condition33%1/3
defined $qterm and $qterm->isa("Bio::Ontology::TermI")
!ll&&!rl&&r
001
MC/DC0%0/2
defined $qterm and $qterm->isa("Bio::Ontology::TermI")
defined $qterm $qterm->isa("Bio::Ontology::TermI")
Truth table33%1/3
A and B
A= defined $qtermB= $qterm->isa("Bio::Ontology::TermI")
ABresult
0X0
100
111
875 unless defined $qterm and $qterm->isa("Bio::Ontology::TermI");
876  
877 1 my %matching_terms;
878  
879 1 foreach my $qstring ($qterm->name, $qterm->each_synonym) {
880 1 foreach my $term ($self->get_all_terms) {
881  
882 1008 foreach my $string ( $term->name, $term->each_synonym() ) {
883 1281 ▶ $matching_terms{$term->identifier} = $term and next
Branch: 1 branch
BranchTrueFalseTotal
if $string =~ /\Q$qstring\E/ or $qstring =~ /\Q$string\E/ 7 1274 1281
Condition62%5/8
($string =~ /\Q$qstring\E/ || $qstring =~ /\Q$string\E/) && (($matching_terms{$term->identifier} = $term) && (next))
!ll&&!rl&&r
127470
$string =~ /\Q$qstring\E/ or $qstring =~ /\Q$string\E/
l!l&&r!l&&!r
701274
$matching_terms{$term->identifier} = $term and next
!ll
07
MC/DC0%0/3
($string =~ /\Q$qstring\E/ || $qstring =~ /\Q$string\E/) && (($matching_terms{$term->identifier} = $term) && (next))
$string =~ /\Q$qstring\E/ $qstring =~ /\Q$string\E/ $matching_terms{$term->identifier} = $term
Truth table20%1/5
A or B && C
A= $string =~ /\Q$qstring\E/B= $qstring =~ /\Q$string\E/C= $matching_terms{$term->identifier} = $term
ABCresult
00X0
1X00
0100
1X11
0111
884 if $string =~ /\Q$qstring\E/ or $qstring =~ /\Q$string\E/;
885 }
886 }
887 }
888 1 return values %matching_terms;
889 }
890  
891  
892 =head2 relationship_factory
893  
894 Title : relationship_factory
895 Usage : $fact = $obj->relationship_factory()
896 Function: Get/set the object factory to be used when relationship
897 objects are created by the implementation on-the-fly.
898  
899 Example :
900 Returns : value of relationship_factory (a Bio::Factory::ObjectFactoryI
901 compliant object)
902 Args : on set, a Bio::Factory::ObjectFactoryI compliant object
903  
904 =cut
905  
906 15 ▶sub relationship_factory{
Subroutine relationship_factory: called CC=2 SCAR=6.9
Pod documented
907 15 my $self = shift;
908  
909 15 ▶ return $self->{'relationship_factory'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 8 7 15
910 7 return $self->{'relationship_factory'};
911 }
912  
913 =head2 term_factory
914  
915 Title : term_factory
916 Usage : $fact = $obj->term_factory()
917 Function: Get/set the object factory to be used when term objects are
918 created by the implementation on-the-fly.
919  
920 Note that this ontology engine implementation does not
921 create term objects on the fly, and therefore setting this
922 attribute is meaningless.
923  
924 Example :
925 Returns : value of term_factory (a Bio::Factory::ObjectFactoryI
926 compliant object)
927 Args : on set, a Bio::Factory::ObjectFactoryI compliant object
928  
929 =cut
930  
931 0 ▶sub term_factory{
Subroutine term_factory: not called CC=2 SCAR=17.9
Pod documented
932 0 my $self = shift;
933  
934 0 ▶ if(@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
935 0 $self->warn("setting term factory, but ".ref($self).
936 " does not create terms on-the-fly");
937 0 return $self->{'term_factory'} = shift;
938 }
939 0 return $self->{'term_factory'};
940 }
941  
942 =head2 graph
943  
944 Title : graph()
945 Usage : $engine->graph();
946 Function: Returns the Graph this engine is based on
947 Returns : Graph
948 Args :
949  
950 =cut
951  
952 29040 ▶sub graph {
Subroutine graph: called CC=2 SCAR=6.9
Pod documented
953 29040 my ( $self, $value ) = @_;
954  
955 29040 ▶ if ( defined $value ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 8 29032 29040
956 8 $self->_check_class( $value, 'Bio::Ontology::SimpleGOEngine::GraphAdaptor' ); # NG 05-02-16
957 8 $self->{ "_graph" } = $value;
958 }
959  
960 29040 return $self->{ "_graph" };
961 } # graph
962  
963  
964 # Internal methods
965 # ----------------
966 # Checks the correct format of a GOBO-formatted id
967 # Gets the id out of a term or id string
968 8979 ▶sub _get_id {
Subroutine _get_id: called CC=9 SCAR=30.1
969 8979 my ( $self, $term ) = @_;
970 8979 my $id = $term;
971  
972 8979 ▶ if ( ref($term) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $term) 7427 1552 8979
973  
974 # use TermI standard API
975 7427 ▶ $self->throw( "Object doesn't implement Bio::Ontology::TermI" )
Branch: 1 branch
BranchTrueFalseTotal
unless $term->isa("Bio::Ontology::TermI") 0 7427 7427
976 unless $term->isa("Bio::Ontology::TermI");
977 7427 $id = $term->identifier();
978  
979 # if there is no ID, we need to fake one from ontology name and name
980 # in order to achieve uniqueness
981 7427 ▶ if ( !$id ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($id) 0 7427 7427
982 0 ▶ $id = $term->ontology->name() if $term->ontology();
Branch: 1 branch
BranchTrueFalseTotal
if $term->ontology 0 0 0
983 0 ▶ $id = $id ? $id . '|' : '';
Branch: 1 branch
BranchTrueFalseTotal
$id ? : 0 0 0
984 0 $id .= $term->name();
985 }
986 }
987  
988 # if $term->isa("Bio::Ontology::GOterm")||($id =~ /^[A-Z_]{1,8}:\d{1,}$/);
989 8979 ▶ return $id if $term->isa("Bio::Ontology::OBOterm") || ( $id =~ /^\w+:\w+$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $term->isa("Bio::Ontology::OBOterm") or $id =~ /^\w+:\w+$/ 8979 0 8979
Condition66%2/3
$term->isa("Bio::Ontology::OBOterm") or $id =~ /^\w+:\w+$/
l!l&&r!l&&!r
693620430
MC/DC0%0/2
$term->isa("Bio::Ontology::OBOterm") or $id =~ /^\w+:\w+$/
$term->isa("Bio::Ontology::OBOterm") $id =~ /^\w+:\w+$/
Truth table66%2/3
A or B
A= $term->isa("Bio::Ontology::OBOterm")B= $id =~ /^\w+:\w+$/
ABresult
1X1
011
000
990  
991 # prefix with something if only numbers
992 # if($id =~ /^\d+$/) {
993 # $self->warn(ref($self).": identifier [$id] is only numbers - ".
994 # "prefixing with 'GO:'");
995 # return "GO:" . $id;
996 # }
997 # we shouldn't have gotten here if it's at least a remotely decent ID
998 0 ▶ $self->throw( ref($self) . ": non-standard identifier '$id'\n" )
Branch: 1 branch
BranchTrueFalseTotal
unless $id =~ /\|/ 0 0 0
999 unless $id =~ /\|/;
1000  
1001 0 return $id;
1002 }
1003  
1004 # Helper for getting children and parent terms
1005 431 ▶sub _get_child_parent_terms_helper {
Subroutine _get_child_parent_terms_helper: called CC=9 SCAR=22.0
1006 431 my ( $self, $term, $do_get_child_terms, @types ) = @_;
1007  
1008 431 foreach my $type ( @types ) {
1009 117 $self->_check_class( $type, "Bio::Ontology::TermI" );
1010 }
1011  
1012 431 my @relative_terms = ();
1013  
1014 431 $term = $self->_get_id( $term );
1015 431 ▶ if ( ! $self->graph()->has_vertex( $term ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->graph->has_vertex($term)) 0 431 431
1016 0 $self->throw( "Ontology does not contain a term with an identifier of \"$term\"" );
1017 }
1018  
1019 431 my @all_relative_terms = ();
1020 431 ▶ if ( $do_get_child_terms ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($do_get_child_terms) { } 326 105 431
1021 326 @all_relative_terms = $self->graph()->successors( $term );
1022 }
1023 else {
1024 105 @all_relative_terms = $self->graph()->predecessors( $term );
1025 }
1026  
1027 431 foreach my $relative ( @all_relative_terms ) {
1028 494 ▶ if ( scalar( @types ) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @types > 0) { } 133 361 494
1029 133 foreach my $type ( @types ) {
1030 170 my $relative_type;
1031 170 ▶ if ( $do_get_child_terms ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($do_get_child_terms) { } 93 77 170
1032 93 $relative_type = $self->graph()->get_edge_attribute ($term, $relative, TYPE ); # NG 05-02-16
1033 }
1034 else {
1035 77 $relative_type = $self->graph()->get_edge_attribute ($relative, $term, TYPE ); # NG 05-02-16
1036 }
1037 170 ▶ if ( $relative_type->equals( $type ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($relative_type->equals($type)) 90 80 170
1038 90 push( @relative_terms, $relative );
1039 }
1040 }
1041 }
1042 else {
1043 361 push( @relative_terms, $relative );
1044 }
1045 }
1046  
1047 431 return $self->get_terms( @relative_terms );
1048  
1049 } # get_child_terms
1050  
1051  
1052 # Recursive helper
1053 309 ▶sub _get_descendant_terms_helper {
Subroutine _get_descendant_terms_helper: called CC=3 SCAR=11.0
1054 309 my ( $self, $term, $ids_ref, $types_ref ) = @_;
1055  
1056 309 my @child_terms = $self->get_child_terms( $term, @$types_ref );
1057  
1058 309 ▶ if ( scalar( @child_terms ) < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @child_terms < 1) 191 118 309
1059 191 return;
1060 }
1061  
1062 118 foreach my $child_term ( @child_terms ) {
1063 299 my $child_term_id = $self->_get_id($child_term->identifier());
1064 299 $ids_ref->{ $child_term_id } = 0;
1065 299 $self->_get_descendant_terms_helper( $child_term_id, $ids_ref, $types_ref );
1066 }
1067  
1068 } # _get_descendant_terms_helper
1069  
1070  
1071 # Recursive helper
1072 90 ▶sub _get_ancestor_terms_helper {
Subroutine _get_ancestor_terms_helper: called CC=3 SCAR=11.0
1073 90 my ( $self, $term, $ids_ref, $types_ref ) = @_;
1074  
1075 90 my @parent_terms = $self->get_parent_terms( $term, @$types_ref );
1076  
1077 90 ▶ if ( scalar( @parent_terms ) < 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @parent_terms < 1) 32 58 90
1078 32 return;
1079 }
1080  
1081 58 foreach my $parent_term ( @parent_terms ) {
1082 76 my $parent_term_id = $self->_get_id($parent_term->identifier());
1083 76 $ids_ref->{ $parent_term_id } = 0;
1084 76 $self->_get_ancestor_terms_helper( $parent_term_id, $ids_ref, $types_ref );
1085 }
1086  
1087 } # get_ancestor_terms_helper
1088  
1089 1614 ▶sub _check_class {
Subroutine _check_class: called CC=4 SCAR=18.9
1090 1614 my ( $self, $value, $expected_class ) = @_;
1091  
1092 1614 ▶ if ( ! defined( $value ) ) {
Branch: 3 branches
BranchTrueFalseTotal
if (not defined $value) { } 0 1614 1614
elsif (not ref $value) { } 0 1614 1614
elsif (not $value->isa($expected_class)) { } 0 1614 1614
1093 0 $self->throw( "Found [undef] where [$expected_class] expected" );
1094 }
1095 elsif ( ! ref( $value ) ) {
1096 0 $self->throw( "Found [scalar] where [$expected_class] expected" );
1097 }
1098 elsif ( ! $value->isa( $expected_class ) ) {
1099 0 $self->throw( "Found [" . ref( $value ) . "] where [$expected_class] expected" );
1100 }
1101  
1102 } # _check_class
1103  
1104 #################################################################
1105 # aliases
1106 #################################################################
1107  
1108 10 *get_relationship_types = \&get_predicate_terms;
1109  
1110  
1111  
1112  
1113 10 1;
« Bio/Tools/SeqPattern/Backtranslate.pm ↑ Summary Bio/Tools/ECnumber.pm »