source: trunk/ontoCAT/src/uk/ac/ebi/ontocat/examples/R/Example3.R @ 462

Revision 462, 2.2 KB checked in by nata_courby, 4 years ago (diff)

R examples

Line 
1#   Copyright (c) 2010 - 2011 European Molecular Biology Laboratory
2#
3#   Licensed under the Apache License, Version 2.0 (the "License");
4#   you may not use this file except in compliance with the License.
5#   You may obtain a copy of the License at
6#
7#       http://www.apache.org/licenses/LICENSE-2.0
8#
9#   Unless required by applicable law or agreed to in writing, software
10#   distributed under the License is distributed on an "AS IS" BASIS,
11#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12#   See the License for the specific language governing permissions and
13#   limitations under the License.
14
15##########################################################
16# Operations with relationships
17# Please use the full version of ontoCAT R package: https://sourceforge.net/projects/ontocat/files/ontoCAT/ontoCAT_R/ontoCAT_1.1.5.tar.gz
18##########################################################
19
20#Java Heap size needed to reason over GO ontology (more than 20 MB in size) is 512MB.
21#Here are the instructions how to increase Java Heap Size in R:
22
23library(rJava)
24options(java.parameters="-Xmx512")
25.jinit()
26
27#To check the result:
28.jcall(.jnew("java/lang/Runtime"), "J", "maxMemory")
29#Now it is possible to work with large ontologies like GO
30
31library(ontoCAT)
32
33#Example with OBO ontology
34
35# Obtain GO ontology without reasoning over it
36go_wr <- getOntologyNoReasoning("http://www.geneontology.org/ontology/obo_format_1_2/gene_ontology_ext.obo")
37
38getOntologyRelationNames(go_wr)
39
40# Obtain GO ontology with reasoning over it
41go <- getOntology("http://www.geneontology.org/ontology/obo_format_1_2/gene_ontology_ext.obo")
42
43getOntologyRelationNames(go)
44
45
46#Example with OWL ontology
47
48# Obtain EFO ontology with reasoning over it
49
50efo_wr <- getOntologyNoReasoning("http://rest.bioontology.org/bioportal/ontologies/download/45781?applicationid=4ea81d74-8960-4525-810b-fa1baab576ff");
51
52getOntologyRelationNames(efo_wr)
53
54# Obtain EFO ontology with reasoning over it
55efo <- getOntology("http://rest.bioontology.org/bioportal/ontologies/download/45781?applicationid=4ea81d74-8960-4525-810b-fa1baab576ff")
56
57getOntologyRelationNames(efo)
58
59term <- getTermById(efo,"EFO_0000815")
60getTermRelations(efo,term,"has_part")
Note: See TracBrowser for help on using the repository browser.