1GO::Node(3) User Contributed Perl Documentation GO::Node(3)
2
3
4
6 GO::Node - provides information about a node in the Gene Ontology
7
9 The GO::Node package is intended to be used as a container for
10 information about a node in one of the three Gene Ontologies. It
11 allows the storage of the goid, and immediate parents and children, as
12 well as paths to the top of the ontology. This package provides
13 methods to both store and retrieve that information.
14
15 It should be strongly noted that clients are not expected to create
16 individual Node objects themselves, but instead should rely in a Node
17 Factory to create nodes and return them. Such a factory would be a
18 concrete subclass of the abstract GO::OntologyProvider package.
19
21 The following items needs to be done at some point to make the Node
22 class more flexible, and for it to better model the data.
23
24 Add in methods to deal with secondary GOIDs
25
26 Add in methods to allow definitions to be associated with, and
27 retrieved from Nodes.
28
29 Add in methods to allow dbxrefs to be included.
30
31 Not require Factories to add the paths to the root, but instead
32 have this class generate those paths from the inherent structure
33 of the graph in which the Nodes sit. This will also be useful to
34 generate paths to leaves/descendants.
35
37 _handleMissingArgument
38 This protected method simply provides a simple way for concrete
39 subclasses to deal with missing arguments from method calls. It will
40 die with an appropriate error message.
41
42 Usage:
43
44 $self->_handleMissingArgument(argument=>'blah');
45
47 new
48 This is the constructor for the Node object At a minimum, the
49 constructor expects, as named arguments, a GOID and a GO term, with
50 which to create the node object.
51
52 Usage:
53
54 my $node = GO::Node->new(goid => $goid,
55 term => $term);
56
58 addChildNodes
59 The public setter method allows a client to indicate that an array of
60 nodes are children of the 'self' node. Only one node per child goid
61 will get stored.
62
63 Usage:
64
65 $node->addChildNodes(@childNodes);
66
67 addParentNodes
68 The public setter method allows a client to indicate that an array of
69 nodes are parents of the 'self' node. Only one node per parent goid
70 will get stored.
71
72 Usage:
73
74 $node->addParentNodes(@parentNodes);
75
76 addPathToRoot
77 This public setter method expects an array of nodes, that indicates a
78 direct path to the root of the ontology. The array should not contain
79 the self node, but should contain the root node. The last entry in the
80 array is expected to be an immediate parent of the self node, while the
81 first entry is expected to be the root node itself. This method will
82 NOT check to see if the supplied path has not already been added. It
83 is the Node Factory's responsibility to only add a unique path once.
84 Furthermore, it will not check whether there is consistency between
85 addedPaths and addedParents (this can be done using the isValid method
86 though).
87
88 Usage:
89
90 $node->addPathToRoot(@nodes);
91
92 goid
93 This public method returns the goid associated with the node.
94
95 Usage:
96
97 my $goid = $node->goid;
98
99 term
100 This public method returns the term associated with the node.
101
102 Usage:
103
104 my $goid = $node->term;
105
106 childNodes
107 This public method returns an array of child nodes for the self node.
108
109 Usage:
110
111 my @childNodes = $node->childNodes;
112
113 parentNodes
114 This public method returns an array of parent nodes for the self node.
115
116 Usage:
117
118 my @parentNodes = $node->parentNodes;
119
120 pathsToRoot
121 This public method returns an array of references to arrays, each of
122 which contains the nodes in a path between the self node and the root.
123 The self node is not included in the paths, but the root node is. The
124 first node in each array is the most distant ancestor (the root), the
125 last node is an immediate parent. If there are no paths to the root
126 (i.e. it is the root node) then an empty array will be returned.
127
128 Usage:
129
130 my @pathsToRoot = $node->pathsToRoot;
131
132 pathsToAncestor
133 This public method returns an array of references to arrays, each of
134 which contains the nodes in a path between the self node and the
135 specified ancestor. The self node is not included paths, but the
136 specified ancestor node is. The first node in each array is the
137 specified ancestor, the last node is an immediate parent. If there are
138 no paths to the ancestor then an empty array will be returned.
139
140 Usage:
141
142 my @pathsToAncestor = $node->pathsToAncestor($ancestorNode);
143
144 ancestors
145 This public method returns an array of unique GO::Nodes which are the
146 unique ancestors that a node has. These ancestors will be derived from
147 the paths to the root node that have been added to the node.
148
149 Usage:
150
151 my @ancestors = $node->ancestors;
152
153 lengthOfLongestPathToRoot
154 This public method returns the length of the longest path to the root
155 of the ontology from the node. If the node is in fact the root, then a
156 value of zero will be returned.
157
158 Usage:
159
160 my $length = $node->lengthOfLongestPathToRoot;
161
162 lengthOfShortestPathToRoot
163 This public method returns the length of the shortest path to the root
164 of the ontology from the node. If the node is in fact the root, then a
165 value of zero will be returned.
166
167 Usage:
168
169 my $length = $node->lengthOfShortestPathToRoot;
170
171 meanLengthOfPathsToRoot
172 This public method returns the mean length of all paths to the root
173 node. If the node is in fact the root, then a value of zero will be
174 returned.
175
176 Usage:
177
178 my $length = $node->meanLengthOfPathsToRoot;
179
180 isValid
181 This method can be used to check that a node has been constructed
182 correctly. It checks that it is a child of all its parents, and a
183 parent of all of its children. In addition, it checks that parents
184 exist as the most recent ancestors of the node in its paths to the root
185 node, and vice versa. It returns a boolean.
186
187 Usage:
188
189 if ($node->isValid){
190
191 # do something
192
193 }
194
195 isAParentOf
196 This public method returns a boolean to indicate whether a node has the
197 supplied node as a child.
198
199 Usage :
200
201 if ($node->isAParentOf($anotherNode)){
202
203 # blah
204
205 }
206
207 isAChildOf
208 This public method returns a boolean to indicate whether a node has the
209 supplied node as a parent.
210
211 Usage :
212
213 if ($node->isAChildOf($anotherNode)){
214
215 # blah
216
217 }
218
219 isAnAncestorOf
220 This method returns a boolean to indicate whether a node is an ancestor
221 of another.
222
223 Usage:
224
225 if ($node->isAnAncestorOf($anotherNode)){
226
227 # blah
228
229 }
230
231 isADescendantOf
232 This method returns a boolean to indicate whether a node is a
233 descendant of another.
234
235 Usage:
236
237 if ($node->isADescendantOf($anotherNode)){
238
239 # blah
240
241 }
242
243 isLeaf
244 This method returns a boolean to indicate whether a node is a leaf in
245 the ontology (i.e. it has no children).
246
247 Usage:
248
249 if ($node->isLeaf){
250
251 # blah
252
253 }
254
255 isRoot
256 This method returns a boolean to indicate whether a node is the root in
257 the ontology (i.e. it has no parents).
258
259 Usage:
260
261 if ($node->isRoot){
262
263 # blah
264
265 }
266
268 Gavin Sherlock; sherlock@genome.stanford.edu
269
270
271
272perl v5.28.0 2007-11-15 GO::Node(3)