1GO::OntologyProvider::OUbsoePrarCsoenrt(r3i)buted Perl DGoOc:u:mOennttoaltoigoynProvider::OboParser(3)
2
3
4
6 GO::OntologyProvider::OboParser - Provides API for retrieving data from
7 Gene Ontology obo file.
8
10 use GO::OntologyProvider::OboParser;
11
12 my $ontology = GO::OntologyProvider::OboParser->new(ontologyFile => "gene_ontology.obo",
13 aspect => [P|F|C]);
14
15 print "The ancestors of GO:0006177 are:\n";
16
17 my $node = $ontology->nodeFromId("GO:0006177");
18
19 foreach my $ancestor ($node->ancestors){
20
21 print $ancestor->goid, " ", $ancestor->term, "\n";
22
23 }
24
25 $ontology->printOntology();
26
28 GO::OntologyProvider::OboParser implements the interface defined by
29 GO::OntologyProvider, and parses the gene ontology obo file (GO) in
30 plain text (not XML) format. These files can be obtained from the Gene
31 Ontology Consortium web site, http://www.geneontology.org/. From the
32 information in the file, it creates a directed acyclic graph (DAG)
33 structure in memory. This means that GO terms are arranged into tree-
34 like structures where each GO node can have multiple parent nodes and
35 multiple child nodes. The file MUST be named with a .obo suffix.
36
37 This data structure can be used in conjunction with files in which
38 certain genes are annotated to corresponding GO nodes.
39
40 Each GO ID (e.g. "GO:1234567") has associated with it a GO node. That
41 GO node contains the name of the GO term, a list of the nodes directly
42 above the node ("parent nodes"), and a list of the nodes directly below
43 the current node ("child nodes"). The "ancestor nodes" of a certain
44 node are all of the nodes that are in a path from the current node to
45 the root of the ontology, with all repetitions removed.
46
47 The example format is as follows:
48
49 [Term] id: GO:0000006 name: high affinity zinc uptake transporter
50 activity namespace: molecular_function def: "Catalysis of the reaction:
51 Zn2+(out) = Zn2+(in), probably powered by proton motive force."
52 [TC:2.A.5.1.1] xref_analog: TC:2.A.5.1.1 is_a: GO:0005385 ! zinc ion
53 transporter activity
54
55 [Term] id: GO:0000005 name: ribosomal chaperone activity namespace:
56 molecular_function def: "OBSOLETE. Assists in the correct assembly of
57 ribosomes or ribosomal subunits in vivo, but is not a component of the
58 assembled ribosome when performing its normal biological function."
59 [GOC:jl, PMID:12150913] comment: This term was made obsolete because it
60 refers to a class of gene products and a biological process rather than
61 a molecular function. To update annotations, consider the molecular
62 function term 'unfolded protein binding ; GO:0051082' and the
63 biological process term 'ribosome biogenesis and assembly ; GO:0042254'
64 and its children. is_obsolete: true
65
67 new
68 This is the constructor for an OboParser object. The constructor
69 expects one of two arguments, either an 'ontologyFile' argument, or an
70 'objectFile' argument. When instantiated with an ontologyFile
71 argument, it expects it to correspond to an obo file created by the GO
72 consortium, according to their file format, and in addition, also
73 requires an 'aspect' argument. When instantiated with an objectFile
74 argument, it expects to open a previously created ontologyParser object
75 that has been serialized to disk (see serializeToDisk).
76
77 Usage:
78
79 my $ontology = GO::OntologyProvider::OboParser->new(ontologyFile => $ontologyFile,
80 aspect => $aspect);
81
82 my $ontology = GO::OntologyProvider::OboParser->new(objectFile => $objectFile);
83
85 printOntology
86 This prints out the ontology, with redundancies, to STDOUT. It does
87 not yet print out all of the ontology information (like relationship
88 type etc). This method will be likely be removed in a future version,
89 so should not be relied upon.
90
91 Usage:
92
93 $ontologyParser->printOntology;
94
95 allNodes
96 This method returns an array of all the GO:Nodes that have been
97 created.
98
99 Usage:
100
101 my @nodes = $ontologyParser->allNodes;
102
103 rootNode
104 This returns the root node in the ontology.
105
106 my $rootNode = $ontologyParser->rootNode;
107
108 nodeFromId
109 This public method takes a GOID and returns the GO::Node that it
110 corresponds to.
111
112 Usage :
113
114 my $node = $ontologyParser->nodeFromId($goid);
115
116 If the GOID does not correspond to a GO node, then undef will be
117 returned. Note if you try to call any methods on an undef, you will
118 get a fatal runtime error, so if you can't guarantee all GOIDs that you
119 supply are good, you should check that the return value from this
120 method is defined.
121
122 numNodes
123 This public method returns the number of nodes that exist with the
124 ontology
125
126 Usage :
127
128 my $numNodes = $ontologyParser->numNodes;
129
130 serializeToDisk
131 Saves the current state of the Ontology Parser Object to a file, using
132 the Storable package. Saves in network order for portability, just in
133 case. Returns the name of the file. If no filename is provided, then
134 the name of the file (and its directory, if one was provided) used for
135 object construction, will be used, with .obj appended. If the object
136 was instantiated from a file with a .obj suffix, then the same filename
137 would be used, if none were provided.
138
139 This method currently causes a segfault on MacOSX (at least 10.1.5 ->
140 10.2.3), with perl 5.6, and Storable 1.0.14, when trying to store the
141 process ontology. This failure occurs using either store, or nstore,
142 and is manifested by a segmentation fault. It has not been
143 investigated whether this is a perl problem, or a Storable problem
144 (which has large amounts of C-code). This does not cause a
145 segmentation on Solaris, using perl 5.6.1 and Storable 1.0.13. This
146 does not make it clear whether it is a MacOSX problem or a perl problem
147 or not. It should be noted that newer versions of both perl and
148 Storable exist, and the code should be tested with those as well.
149
150 Usage:
151
152 my $objectFile = $ontologyParser->serializeToDisk(filename=>$filename);
153
155 Gavin Sherlock; sherlock@genome.stanford.edu
156 Elizabeth Boyle; ell@mit.edu
157 Shuai Weng; shuai@genome.stanford.edu
158
159
160
161perl v5.28.0 2007-11-15GO::OntologyProvider::OboParser(3)