Skip to content
Snippets Groups Projects
Commit 0c6a1ed8 authored by Aurelien Brionne's avatar Aurelien Brionne
Browse files

merge_enrich_terms_upgrade

parent bddff533
No related branches found
No related tags found
No related merge requests found
Package: ViSEAGO Package: ViSEAGO
Version: 1.3.6 Version: 1.3.7
Title: ViSEAGO: a Bioconductor package for clustering biological functions using Gene Ontology and semantic similarity Title: ViSEAGO: a Bioconductor package for clustering biological functions using Gene Ontology and semantic similarity
Author: Aurelien Brionne [aut, cre], Author: Aurelien Brionne [aut, cre],
Amelie Juanchich [aut], Amelie Juanchich [aut],
......
...@@ -72,4 +72,5 @@ CHANGES IN VERSION 1.3 ...@@ -72,4 +72,5 @@ CHANGES IN VERSION 1.3
o show_heatmap() upgrade o show_heatmap() upgrade
o upset print update o upset print update
o merge_enrich_terms upgrade pvalue cutoff o merge_enrich_terms upgrade pvalue cutoff
o merge_enrich_terms globale upgrade
...@@ -151,7 +151,7 @@ setMethod( ...@@ -151,7 +151,7 @@ setMethod(
unlist( unlist(
lapply(seq_along(Input),function(x){ lapply(seq_along(Input),function(x){
# extract quering objects names # extract quering objects names
x=Input[[x]] x=Input[[x]]
# check existence # check existence
...@@ -160,7 +160,7 @@ setMethod( ...@@ -160,7 +160,7 @@ setMethod(
# check if available # check if available
available<-x%in%values available<-x%in%values
# stop if not # stop if not found
if(!all(available)){ if(!all(available)){
stop(paste("objects not found:",paste(x[!available],collapse=", "),sep="\n")) stop(paste("objects not found:",paste(x[!available],collapse=", "),sep="\n"))
} }
...@@ -193,7 +193,7 @@ setMethod( ...@@ -193,7 +193,7 @@ setMethod(
# check ontology # check ontology
if(length(check.onto)>1){ if(length(check.onto)>1){
# stop if more than one godata by list # stop if more than one topGOdata by list
stop("Only one ontology supported") stop("Only one ontology supported")
} }
...@@ -312,34 +312,25 @@ setMethod( ...@@ -312,34 +312,25 @@ setMethod(
} }
# objects type # objects type
if(sum(obj.type%in%"topGOresult")<1){ if(sum(obj.type%in%"topGOresult")>1){
# stop if more than one godata by list # stop if more than one godata by list
stop("At least one topGOresult object needed by list") stop("Only one topGOresult object is supported by list")
} }
## find and extract pvalues ## find and extract pvalues
# load GOdata # find topGOresult
pos=which(obj.type=="topGOresult") pos=which(obj.type=="topGOresult")
# tested algorithm # extract scores
algorithms<-Data[pos] pvalues<-topGO::score(Data[[pos]])
# extract significant pvalues results # extract names of enrich terms
unlist( as.vector(
lapply(algorithms,function(y){ names(
pvalues[pvalues<as.numeric(sub("^.+[[:space:]]","",slot(Data[[pos]],"testName")))]
# extract scores )
pvalues<-topGO::score(y)
# extract names of enrich terms
as.vector(
names(
pvalues[pvalues<as.numeric(sub("^.+[[:space:]]","",slot(y,"testName")))]
)
)
})
) )
}) })
...@@ -400,7 +391,7 @@ setMethod( ...@@ -400,7 +391,7 @@ setMethod(
GOdata=Data[[pos]] GOdata=Data[[pos]]
# tested algorithm # tested algorithm
algorithms<-Data[-pos] algorithm<-Data[-pos]
## extract some statistics from initial GOdata object (before enrichment test) ## extract some statistics from initial GOdata object (before enrichment test)
...@@ -680,47 +671,21 @@ setMethod( ...@@ -680,47 +671,21 @@ setMethod(
## extract pvalue according the algorithm results ## extract pvalue according the algorithm results
# extract pvalues results # extract all pvalues from topGOresult
pvalues<-lapply(seq_along(algorithms),function(y){ pvalue<-topGO::score(algorithm[[1]])
# extract all pvalues from topGOresult # select pvalues from topGOresult
pvalue<-topGO::score(algorithms[[y]]) pvalue<-pvalue[GOs]
# select pvalues from topGOresult # extract pvalue in data.table
pvalue<-pvalue[GOs] pvalues<-data.table(
GO.ID=names(pvalue),
# extract pvalue in data.table pvalue=as.numeric(format(pvalue,scientific = T)),
pvalue<-data.table( `-log10_pvalue`=round(-log10(pvalue),digits=2)
GO.ID=names(pvalue), )
pvalue=as.numeric(format(pvalue,scientific = T)),
round(-log10(pvalue),digits=2)
)
# ordering pvalue by go term
names(pvalue)[ncol(pvalue)]="-log10_pvalue"
if(y>1){
# remove GO.ID
pvalue[,"GO.ID":=NULL]
}
# return
pvalue
})
# convert to data.table
pvalues=data.table(do.call("cbind",pvalues))
# algoritms
algo=vapply(algorithms,function(x){slot(x,"algorithm")},"")
# if use of different algorithms
if(length(algo)>1){
# add names # algorithm
names(pvalues)[-1]<-paste(rep(algo,each=2),names(pvalues)[-1],sep=".") algo=slot(algorithm[[1]],"algorithm")
}
# return input params # return input params
assign( assign(
...@@ -756,29 +721,19 @@ setMethod( ...@@ -756,29 +721,19 @@ setMethod(
Results<-Results[!is.na(Results$GO.ID)] Results<-Results[!is.na(Results$GO.ID)]
# extract pvalue threshold # extract pvalue threshold
p<-unique(vapply(algorithms,function(x){ as.numeric(sub("^.+[[:space:]]","",slot(x,"testName")))},0)) p<-as.numeric(sub("^.+[[:space:]]","",slot(algorithm[[1]],"testName")))
# stop if more than one pvalue threshold among comparison
if(length(p)>1){stop("Only one pvalue theshold is allowed by list element.")}
# Remove gene ID and symbol if GO term not significant # Remove gene ID and symbol if GO term not significant
Results[Results$pvalue>=p,`:=`(Significant_genes=NA,Significant_genes_symbol=NA)] Results[Results$pvalue>=p,`:=`(Significant_genes=NA,Significant_genes_symbol=NA)]
if(!is.null(names(Input))){ if(!is.null(names(Input))){
# add GOdata name # add GOdata name in the header
if(x==1){ names(Results)[-1]<-paste(
names(Input)[x],
# add GOdata name in the header names(Results)[-1],
names(Results)[-1]<-paste(names(Input)[x], sep="."
names(Results)[-1],sep=".") )
}else{
# add GOdata name in the header
names(Results)[-1]<-paste(names(Input)[x],
names(Results)[-1],sep=".")
}
} }
# return Results # return Results
......
...@@ -27,7 +27,7 @@ remotes::install_gitlab( ...@@ -27,7 +27,7 @@ remotes::install_gitlab(
devtools::build("ViSEAGO") devtools::build("ViSEAGO")
# install package (from R console) # install package (from R console)
install.packages("ViSEAGO_1.3.6.tar.gz", repos = NULL, type = "source") install.packages("ViSEAGO_1.3.7.tar.gz", repos = NULL, type = "source")
``` ```
## Citation ## Citation
......
...@@ -174,7 +174,7 @@ BP_VirginvsPregnant<-ViSEAGO::create_topGOdata( ...@@ -174,7 +174,7 @@ BP_VirginvsPregnant<-ViSEAGO::create_topGOdata(
) )
``` ```
Now, we perform the GO enrichment tests for BP category with Fisher's exact test and *elim* algorithm using `topGO::runTest` method. Now, we perform the GO enrichment tests for BP category with Fisher's exact test and *elim* algorithm using `topGO::runTest` method.
<u>NB</u>: p-values of enriched GO terms are not adjusted and considered significant if below 0.01. <u>NB</u>: p-values of enriched GO terms are not adjusted and considered significant if below 0.01.
...@@ -209,8 +209,7 @@ The printed table contains for each enriched GO terms, additional columns includ ...@@ -209,8 +209,7 @@ The printed table contains for each enriched GO terms, additional columns includ
```{r Enrichment_merge} ```{r Enrichment_merge}
# merge topGO results # merge topGO results
ViSEAGO:: BP_sResults<-ViSEAGO::merge_enrich_terms(
BP_sResults<-merge_enrich_terms(
Input=list( Input=list(
PregnantvsLactate=c( PregnantvsLactate=c(
"BP_PregnantvsLactate", "BP_PregnantvsLactate",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment