Generate XGR Objects
Generate_XGR_list <- function(data, contrast, mygo , tree = F, l2fc ,background){
mysymbol <- data %>% dplyr::filter(FDR < 0.1, abs(L2FC) > l2fc, Treatment == contrast) %>%
dplyr::select(Symbol, FDR) %>% mutate(symbol = toupper(Symbol)) %>%
pull(symbol)
myxgr <- xEnricherGenes(data = mysymbol, ontology = mygo, background = background,ontology.algorithm = ifelse(tree == F,"none","lea"))
if(tree == F){myxgr <- try(xEnrichConciser(myxgr))}
}
xgr_list <- list(
Generate_XGR_list(contrast = mycontrasts[1], mygo = "MsigdbH", data = contrasts, l2fc = 0,background = background),
Generate_XGR_list(contrast = mycontrasts[2], mygo = "MsigdbH", data = contrasts, l2fc = 0,background = background),
Generate_XGR_list(contrast = mycontrasts[3], mygo = "MsigdbH", data = contrasts, l2fc = 0,background = background)
)
## Start at 2022-07-26 21:54:28
##
## Load the ontology MsigdbH and its gene annotations (2022-07-26 21:54:28) ...
## Start at 2022-07-26 21:54:28
##
## 'org.Hs.egMsigdbH' (from http://galahad.well.ox.ac.uk/bigdata/org.Hs.egMsigdbH.RData) has been loaded into the working environment (at 2022-07-26 21:54:29)
##
## End at 2022-07-26 21:54:29
## Runtime in total is: 1 secs
## Do gene mapping from Symbols to EntrezIDs (2022-07-26 21:54:29) ...
## Start at 2022-07-26 21:54:29
##
## 'org.Hs.eg' (from http://galahad.well.ox.ac.uk/bigdata/org.Hs.eg.RData) has been loaded into the working environment (at 2022-07-26 21:54:30)
##
## End at 2022-07-26 21:54:30
## Runtime in total is: 1 secs
## human organism (2022-07-26 21:54:30)
## Among 4754 symbols of input data, there are 3886 mappable via official gene symbols but 868 left unmappable
## Start at 2022-07-26 21:54:30
##
## 'org.Hs.eg' (from http://galahad.well.ox.ac.uk/bigdata/org.Hs.eg.RData) has been loaded into the working environment (at 2022-07-26 21:54:32)
##
## End at 2022-07-26 21:54:32
## Runtime in total is: 2 secs
## human organism (2022-07-26 21:54:32)
## Among 8688 symbols of input data, there are 6933 mappable via official gene symbols but 1755 left unmappable
##
## #######################################################
## 'xEnricher' is being called (2022-07-26 21:54:32):
## #######################################################
## First, generate a subgraph induced (via 'all_paths' mode) by the annotation data (2022-07-26 21:54:32) ...
## Next, prepare enrichment analysis (2022-07-26 21:54:32) ...
## There are 3886 genes/SNPs of interest tested against 6933 genes/SNPs as the background (annotatable only? FALSE) (2022-07-26 21:54:32)
## Third, perform enrichment analysis using 'fisher' test (2022-07-26 21:54:32) ...
## There are 49 terms being used, each restricted within [10,2000] annotations
## Last, adjust the p-values for 48 terms (with 5 minimum overlaps) using the BH method (2022-07-26 21:54:32) ...
## Start at 2022-07-26 21:54:32
##
## 'org.Hs.eg' (from http://galahad.well.ox.ac.uk/bigdata/org.Hs.eg.RData) has been loaded into the working environment (at 2022-07-26 21:54:34)
##
## End at 2022-07-26 21:54:34
## Runtime in total is: 2 secs
## #######################################################
## 'xEnricher' has been finished (2022-07-26 21:54:34)!
## #######################################################
##
## End at 2022-07-26 21:54:34
## Runtime in total (xEnricherGenes): 6 secs
## Among 48 terms, there are 48 non-redundant terms
## Start at 2022-07-26 21:54:35
##
## Load the ontology MsigdbH and its gene annotations (2022-07-26 21:54:35) ...
## Start at 2022-07-26 21:54:35
##
## 'org.Hs.egMsigdbH' (from http://galahad.well.ox.ac.uk/bigdata/org.Hs.egMsigdbH.RData) has been loaded into the working environment (at 2022-07-26 21:54:35)
##
## End at 2022-07-26 21:54:35
## Runtime in total is: 0 secs
## Do gene mapping from Symbols to EntrezIDs (2022-07-26 21:54:35) ...
## Start at 2022-07-26 21:54:35
##
## 'org.Hs.eg' (from http://galahad.well.ox.ac.uk/bigdata/org.Hs.eg.RData) has been loaded into the working environment (at 2022-07-26 21:54:36)
##
## End at 2022-07-26 21:54:36
## Runtime in total is: 1 secs
## human organism (2022-07-26 21:54:36)
## Among 5019 symbols of input data, there are 4117 mappable via official gene symbols but 902 left unmappable
## Start at 2022-07-26 21:54:36
##
## 'org.Hs.eg' (from http://galahad.well.ox.ac.uk/bigdata/org.Hs.eg.RData) has been loaded into the working environment (at 2022-07-26 21:54:38)
##
## End at 2022-07-26 21:54:38
## Runtime in total is: 2 secs
## human organism (2022-07-26 21:54:38)
## Among 8688 symbols of input data, there are 6933 mappable via official gene symbols but 1755 left unmappable
##
## #######################################################
## 'xEnricher' is being called (2022-07-26 21:54:38):
## #######################################################
## First, generate a subgraph induced (via 'all_paths' mode) by the annotation data (2022-07-26 21:54:38) ...
## Next, prepare enrichment analysis (2022-07-26 21:54:38) ...
## There are 4117 genes/SNPs of interest tested against 6933 genes/SNPs as the background (annotatable only? FALSE) (2022-07-26 21:54:38)
## Third, perform enrichment analysis using 'fisher' test (2022-07-26 21:54:38) ...
## There are 49 terms being used, each restricted within [10,2000] annotations
## Last, adjust the p-values for 48 terms (with 5 minimum overlaps) using the BH method (2022-07-26 21:54:38) ...
## Start at 2022-07-26 21:54:38
##
## 'org.Hs.eg' (from http://galahad.well.ox.ac.uk/bigdata/org.Hs.eg.RData) has been loaded into the working environment (at 2022-07-26 21:54:40)
##
## End at 2022-07-26 21:54:40
## Runtime in total is: 2 secs
## #######################################################
## 'xEnricher' has been finished (2022-07-26 21:54:41)!
## #######################################################
##
## End at 2022-07-26 21:54:41
## Runtime in total (xEnricherGenes): 6 secs
## Among 48 terms, there are 48 non-redundant terms
## Start at 2022-07-26 21:54:41
##
## Load the ontology MsigdbH and its gene annotations (2022-07-26 21:54:41) ...
## Start at 2022-07-26 21:54:41
##
## 'org.Hs.egMsigdbH' (from http://galahad.well.ox.ac.uk/bigdata/org.Hs.egMsigdbH.RData) has been loaded into the working environment (at 2022-07-26 21:54:41)
##
## End at 2022-07-26 21:54:41
## Runtime in total is: 0 secs
## Do gene mapping from Symbols to EntrezIDs (2022-07-26 21:54:41) ...
## Start at 2022-07-26 21:54:41
##
## 'org.Hs.eg' (from http://galahad.well.ox.ac.uk/bigdata/org.Hs.eg.RData) has been loaded into the working environment (at 2022-07-26 21:54:42)
##
## End at 2022-07-26 21:54:42
## Runtime in total is: 1 secs
## human organism (2022-07-26 21:54:42)
## Among 4741 symbols of input data, there are 3519 mappable via official gene symbols but 1222 left unmappable
## Start at 2022-07-26 21:54:42
##
## 'org.Hs.eg' (from http://galahad.well.ox.ac.uk/bigdata/org.Hs.eg.RData) has been loaded into the working environment (at 2022-07-26 21:54:44)
##
## End at 2022-07-26 21:54:44
## Runtime in total is: 2 secs
## human organism (2022-07-26 21:54:44)
## Among 8688 symbols of input data, there are 6933 mappable via official gene symbols but 1755 left unmappable
##
## #######################################################
## 'xEnricher' is being called (2022-07-26 21:54:44):
## #######################################################
## First, generate a subgraph induced (via 'all_paths' mode) by the annotation data (2022-07-26 21:54:44) ...
## Next, prepare enrichment analysis (2022-07-26 21:54:44) ...
## There are 3519 genes/SNPs of interest tested against 6933 genes/SNPs as the background (annotatable only? FALSE) (2022-07-26 21:54:44)
## Third, perform enrichment analysis using 'fisher' test (2022-07-26 21:54:44) ...
## There are 49 terms being used, each restricted within [10,2000] annotations
## Last, adjust the p-values for 49 terms (with 5 minimum overlaps) using the BH method (2022-07-26 21:54:44) ...
## Start at 2022-07-26 21:54:44
##
## 'org.Hs.eg' (from http://galahad.well.ox.ac.uk/bigdata/org.Hs.eg.RData) has been loaded into the working environment (at 2022-07-26 21:54:46)
##
## End at 2022-07-26 21:54:46
## Runtime in total is: 2 secs
## #######################################################
## 'xEnricher' has been finished (2022-07-26 21:54:47)!
## #######################################################
##
## End at 2022-07-26 21:54:47
## Runtime in total (xEnricherGenes): 6 secs
## Among 49 terms, there are 49 non-redundant terms
names(xgr_list) <- mycontrasts