source: trunk/ontoCAT/src/uk/ac/ebi/ontocat/examples/R/Example2.R @ 464

Revision 464, 1.9 KB checked in by nata_courby, 4 years ago (diff)

New R package version in 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# Search and re-annotation of free-text to ontology
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
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
31# Table of results of experiments concering morphogenesis, where terms are in free-text form
32results<-data.frame(term=c("sorocarp","endocardium","paraxial mesoderm","embryonic arm","post-embryonic medial fin","mesonephric glomerulus","mesonephric mesenchyme","membranous septum","post-embryonic hindlimb","bronchiole"),value=rnorm(10))
33
34library(ontoCAT)
35
36# Obtain GO ontology
37go <- getOntology("http://www.geneontology.org/ontology/obo_format_1_2/gene_ontology_ext.obo")
38
39# Re-annotation example using GO ontology
40annotations<-c(lapply(results$term,function(x) searchTerm(go, paste(x, "morphogenesis", sep=" "))),recursive = TRUE)
41
42results$GOID <- annotations
Note: See TracBrowser for help on using the repository browser.