| 1 | package GO::OntologyProvider; | ||
| 2 | |||
| 3 | # File : OntologyProvider.pm | ||
| 4 | # Author : Gavin Sherlock | ||
| 5 | # Date Begun : September 23rd 2002 | ||
| 6 | |||
| 7 | # $Id: OntologyProvider.pm,v 1.7 2004/05/05 22:12:33 sherlock Exp $ | ||
| 8 | |||
| 9 | # License information (the MIT license) | ||
| 10 | |||
| 11 | # Copyright (c) 2003 Gavin Sherlock; Stanford University | ||
| 12 | |||
| 13 | # Permission is hereby granted, free of charge, to any person | ||
| 14 | # obtaining a copy of this software and associated documentation files | ||
| 15 | # (the "Software"), to deal in the Software without restriction, | ||
| 16 | # including without limitation the rights to use, copy, modify, merge, | ||
| 17 | # publish, distribute, sublicense, and/or sell copies of the Software, | ||
| 18 | # and to permit persons to whom the Software is furnished to do so, | ||
| 19 | # subject to the following conditions: | ||
| 20 | |||
| 21 | # The above copyright notice and this permission notice shall be | ||
| 22 | # included in all copies or substantial portions of the Software. | ||
| 23 | |||
| 24 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 25 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 26 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 27 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
| 28 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
| 29 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 30 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 31 | # SOFTWARE. | ||
| 32 | |||
| 33 | =pod | ||
| 34 | |||
| 35 | =head1 NAME | ||
| 36 | |||
| 37 | GO::OntologyProvider - abstract base class providing API for the provision on Gene Ontology information | ||
| 38 | |||
| 39 | =head1 DESCRIPTION | ||
| 40 | |||
| 41 | GO::OntologyProvider is an abstract class that defines an | ||
| 42 | interface that should be implemented by specific subclasses, which may | ||
| 43 | read ontology information from databases, flatfiles, XML files etc. | ||
| 44 | |||
| 45 | All of the methods return either one or many GO::Node(s), and any | ||
| 46 | concrete subclass is expected to fully flesh out the such Node objects | ||
| 47 | with all the parents, children and paths to the root, such that any | ||
| 48 | node should return a true value when the isValid method is invoked on | ||
| 49 | it. | ||
| 50 | |||
| 51 | =head1 Constructor | ||
| 52 | |||
| 53 | Because this is an abstract class, there is no constructor. A | ||
| 54 | constructor must be implemented by concrete subclasses. | ||
| 55 | |||
| 56 | =head1 Public instance methods | ||
| 57 | |||
| 58 | All of these public instance methods must be implemented by concrete | ||
| 59 | subclasses. | ||
| 60 | |||
| 61 | =cut | ||
| 62 | |||
| 63 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 64 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 65 | 2 | ▶ | use diagnostics; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 66 | |||
| 67 | 2 | ▶ | use vars qw ($VERSION); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 68 | |||
| 69 | 2 | $VERSION = 0.12; | |
| 70 | |||
| 71 | ############################################################################ | ||
| 72 | 0 | ▶ | sub allNodes{ |
|
Subroutine
allNodes: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 73 | ############################################################################ | ||
| 74 | =pod | ||
| 75 | |||
| 76 | =head2 allNodes | ||
| 77 | |||
| 78 | This method returns an array of all the GO::Nodes that have been | ||
| 79 | created. | ||
| 80 | |||
| 81 | Usage: | ||
| 82 | |||
| 83 | my @nodes = $ontologyProvider->allNodes; | ||
| 84 | |||
| 85 | =cut | ||
| 86 | ############################################################################ | ||
| 87 | |||
| 88 | 0 | $_[0]->__complainStubMethod; | |
| 89 | |||
| 90 | } | ||
| 91 | |||
| 92 | ############################################################################ | ||
| 93 | 0 | ▶ | sub rootNode{ |
|
Subroutine
rootNode: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 94 | ############################################################################ | ||
| 95 | =pod | ||
| 96 | |||
| 97 | =head2 rootNode | ||
| 98 | |||
| 99 | This method returns the root node in the ontology. | ||
| 100 | |||
| 101 | Usage: | ||
| 102 | |||
| 103 | my $rootNode = $ontologyProvider->rootNode; | ||
| 104 | |||
| 105 | =cut | ||
| 106 | ############################################################################ | ||
| 107 | |||
| 108 | 0 | $_[0]->__complainStubMethod; | |
| 109 | |||
| 110 | } | ||
| 111 | |||
| 112 | ############################################################################ | ||
| 113 | 0 | ▶ | sub nodeFromId{ |
|
Subroutine
nodeFromId: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 114 | ############################################################################ | ||
| 115 | =pod | ||
| 116 | |||
| 117 | =head2 nodeFromId | ||
| 118 | |||
| 119 | This method returns a GO::Node corresponding to the provided | ||
| 120 | GOID, should one exist. Otherwise it returns undef. | ||
| 121 | |||
| 122 | Usage: | ||
| 123 | |||
| 124 | my $node = $ontologyProvider->nodeFromId("GO:0003673"); | ||
| 125 | |||
| 126 | =cut | ||
| 127 | ############################################################################ | ||
| 128 | |||
| 129 | 0 | $_[0]->__complainStubMethod; | |
| 130 | |||
| 131 | } | ||
| 132 | |||
| 133 | ############################################################################ | ||
| 134 | 0 | ▶ | sub numNodes{ |
|
Subroutine
numNodes: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 135 | ############################################################################ | ||
| 136 | =pod | ||
| 137 | |||
| 138 | =head2 numNodes | ||
| 139 | |||
| 140 | This method returns the number of nodes that exist within the | ||
| 141 | ontology. | ||
| 142 | |||
| 143 | Usage: | ||
| 144 | |||
| 145 | my $numNodes = $ontologyProvider->numNodes; | ||
| 146 | |||
| 147 | =cut | ||
| 148 | |||
| 149 | ############################################################################ | ||
| 150 | |||
| 151 | 0 | $_[0]->__complainStubMethod; | |
| 152 | |||
| 153 | } | ||
| 154 | |||
| 155 | ############################################################################ | ||
| 156 | 0 | ▶ | sub __complainStubMethod{ |
|
Subroutine
__complainStubMethod: not called CC=1 SCAR=6.9
| |||
| 157 | ############################################################################ | ||
| 158 | |||
| 159 | 0 | my ($self) = @_; | |
| 160 | |||
| 161 | 0 | my $subroutine = (caller(1))[3]; | |
| 162 | |||
| 163 | 0 | $subroutine =~ s/.+:://; | |
| 164 | |||
| 165 | 0 | my $package = ref $self; | |
| 166 | |||
| 167 | 0 | die "The package $package has not implemented the required method $subroutine().\n"; | |
| 168 | |||
| 169 | } | ||
| 170 | |||
| 171 | 2 | 1; # to keep Perl happy | |
| 172 | |||
| 173 | =pod | ||
| 174 | |||
| 175 | =head1 AUTHOR | ||
| 176 | |||
| 177 | Gavin Sherlock, sherlock@genome.stanford.edu | ||
| 178 | |||
| 179 | =cut | ||