| 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.2.1.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 | |
|---|
| 23 | library(rJava) |
|---|
| 24 | options(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 | |
|---|
| 31 | library(ontoCAT) |
|---|
| 32 | |
|---|
| 33 | #Example with OBO ontology |
|---|
| 34 | |
|---|
| 35 | # Obtain GO ontology without reasoning over it |
|---|
| 36 | go_wr <- getOntologyNoReasoning("http://www.geneontology.org/ontology/obo_format_1_2/gene_ontology_ext.obo") |
|---|
| 37 | |
|---|
| 38 | getOntologyRelationNames(go_wr) |
|---|
| 39 | |
|---|
| 40 | # Obtain GO ontology with reasoning over it |
|---|
| 41 | go <- getOntology("http://www.geneontology.org/ontology/obo_format_1_2/gene_ontology_ext.obo") |
|---|
| 42 | |
|---|
| 43 | getOntologyRelationNames(go) |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | #Example with OWL ontology |
|---|
| 47 | |
|---|
| 48 | # Obtain EFO ontology with reasoning over it |
|---|
| 49 | |
|---|
| 50 | efo_wr <- getOntologyNoReasoning("http://rest.bioontology.org/bioportal/ontologies/download/45781?applicationid=4ea81d74-8960-4525-810b-fa1baab576ff"); |
|---|
| 51 | |
|---|
| 52 | getOntologyRelationNames(efo_wr) |
|---|
| 53 | |
|---|
| 54 | # Obtain EFO ontology with reasoning over it |
|---|
| 55 | efo <- getOntology("http://rest.bioontology.org/bioportal/ontologies/download/45781?applicationid=4ea81d74-8960-4525-810b-fa1baab576ff") |
|---|
| 56 | |
|---|
| 57 | getOntologyRelationNames(efo) |
|---|
| 58 | |
|---|
| 59 | term <- getTermById(efo,"EFO_0000815") |
|---|
| 60 | getTermRelations(efo,term,"has_part") |
|---|