| Title: | From functional enrichment results to biological networks |
|---|---|
| Description: | This package enables the visualization of functional enrichment results as network graphs. First the package enables the visualization of enrichment results, in a format corresponding to the one generated by gprofiler2, as a customizable Cytoscape network. In those networks, both gene datasets (GO terms/pathways/protein complexes) and genes associated to the datasets are represented as nodes. While the edges connect each gene to its dataset(s). The package also provides the option to create enrichment maps from functional enrichment results. Enrichment maps enable the visualization of enriched terms into a network with edges connecting overlapping genes. |
| Authors: | Astrid Deschênes [aut, cre] (ORCID: <https://orcid.org/0000-0001-7846-6749>), Pascal Belleau [aut] (ORCID: <https://orcid.org/0000-0002-0802-1071>), Robert L. Faure [aut] (ORCID: <https://orcid.org/0000-0003-1798-4723>), Maria J. Fernandes [aut] (ORCID: <https://orcid.org/0000-0002-3973-025X>), Alexander Krasnitz [aut], David A. Tuveson [aut] (ORCID: <https://orcid.org/0000-0002-8017-2712>) |
| Maintainer: | Astrid Deschênes <[email protected]> |
| License: | Artistic-2.0 |
| Version: | 1.11.0 |
| Built: | 2026-06-04 07:09:18 UTC |
| Source: | https://github.com/bioc/enrichViewNet |
The enrichViewNet package enables the visualization
of enrichment results, in a format corresponding to the one generated
by gprofiler2
(https://cran.r-project.org/web/packages/gprofiler2/index.html)
under the form of Cytoscape network (https://cytoscape.org/).
In those networks, both gene datasets (GO terms/pathways/protein complexes) and genes are represented as nodes. A edge connect a gene to its datasets. In the current version, only genes present in at least one gene dataset are retained.
Astrid Deschênes, Pascal Belleau, Robert L Faure, Maria J Fernandes, David A Tuveson
Maintainer: Astrid Deschênes <[email protected]>
createNetwork for transforming functional
enrichment results from gprofiler2 into a Cytoscape network
createEnrichMap for transforming functional
enrichment results from gprofiler2 into an enrichment map in
ggplot format
createEnrichMapAsIgraph for transforming functional
enrichment results from gprofiler2 into an enrichment map in
igraph format
createEnrichMapMultiComplex for transforming
functional enrichment results from multiple gprofiler2 enrichment
results into an enrichment map in ggplot format
createEnrichMapMultiComplexAsIgraph for transforming
functional enrichment results from multiple gprofiler2 enrichment
results into an enrichment map in igraph format
User selected enrichment terms are used to create an enrichment map. The selection of the term can by specifying by the source of the terms (GO:MF, REAC, TF, etc.) or by listing the selected term IDs. The map is only generated when there is at least on significant term to graph.
createEnrichMap( gostObject, query, source = c("TERM_ID", "GO:MF", "GO:CC", "GO:BP", "KEGG", "REAC", "TF", "MIRNA", "HPA", "CORUM", "HP", "WP"), termIDs = NULL, removeRoot = TRUE, showCategory = 30L, categoryLabel = 1, categoryNode = 1, line = 1, ... )createEnrichMap( gostObject, query, source = c("TERM_ID", "GO:MF", "GO:CC", "GO:BP", "KEGG", "REAC", "TF", "MIRNA", "HPA", "CORUM", "HP", "WP"), termIDs = NULL, removeRoot = TRUE, showCategory = 30L, categoryLabel = 1, categoryNode = 1, line = 1, ... )
gostObject |
a |
query |
a |
source |
a |
termIDs |
a |
removeRoot |
a |
showCategory |
a positive |
categoryLabel |
a positive |
categoryNode |
a positive |
line |
a non-negative |
... |
additional arguments that will be pass to the
|
a ggplot object which is the enrichment map for enrichment
results.
Astrid Deschênes
## Loading dataset containing result from an enrichment analysis done with ## gprofiler2 data(parentalNapaVsDMSOEnrichment) ## Extract query information (only one in this dataset) query <- unique(parentalNapaVsDMSOEnrichment$result$query) ## Create graph for Gene Ontology - Cellular Component related results createEnrichMap(gostObject=parentalNapaVsDMSOEnrichment, query=query, source="GO:CC", removeRoot=TRUE)## Loading dataset containing result from an enrichment analysis done with ## gprofiler2 data(parentalNapaVsDMSOEnrichment) ## Extract query information (only one in this dataset) query <- unique(parentalNapaVsDMSOEnrichment$result$query) ## Create graph for Gene Ontology - Cellular Component related results createEnrichMap(gostObject=parentalNapaVsDMSOEnrichment, query=query, source="GO:CC", removeRoot=TRUE)
User selected enrichment terms are used to create an enrichment
map. The selection of the term can by specifying by the
source of the terms (GO:MF, REAC, TF, etc.) or by listing the selected
term IDs. The map is only generated when there is at least on
significant term to graph. The output is an igraph.
createEnrichMapAsIgraph( gostObject, query, source = c("TERM_ID", "GO:MF", "GO:CC", "GO:BP", "KEGG", "REAC", "TF", "MIRNA", "HPA", "CORUM", "HP", "WP"), termIDs = NULL, removeRoot = TRUE, showCategory = 30L, similarityCutOff = 0.2 )createEnrichMapAsIgraph( gostObject, query, source = c("TERM_ID", "GO:MF", "GO:CC", "GO:BP", "KEGG", "REAC", "TF", "MIRNA", "HPA", "CORUM", "HP", "WP"), termIDs = NULL, removeRoot = TRUE, showCategory = 30L, similarityCutOff = 0.2 )
gostObject |
a |
query |
a |
source |
a |
termIDs |
a |
removeRoot |
a |
showCategory |
a positive |
similarityCutOff |
a positive |
a igraph object which is the enrichment map for enrichment
results. The node have 2 attributes: "name" and "size". The "name"
corresponds to the term description. While the "size" corresponds to the
number of genes found in the specific gene set. The edges have
3 attributes: "similarity", "width", and "weight". All those 3 attributes
correspond to the Jaccard coefficient.
Astrid Deschênes
## Loading dataset containing result from an enrichment analysis done with ## gprofiler2 data(parentalNapaVsDMSOEnrichment) ## Extract query information (only one in this dataset) query <- unique(parentalNapaVsDMSOEnrichment$result$query) ## Create graph for Gene Ontology - Cellular Component related results mapG <- createEnrichMapAsIgraph(gostObject=parentalNapaVsDMSOEnrichment, query=query, source="GO:CC", removeRoot=TRUE, showCategory=30L, similarityCutOff=0.20) ## Required library igraph to show the graph if(requireNamespace("igraph", quietly=TRUE)) { ## Using library igraph to show the graph library(igraph) plot(mapG) } if (requireNamespace("ggplot2", quietly=TRUE) && requireNamespace("igraph", quietly=TRUE) && requireNamespace("ggtangle", quietly=TRUE) && requireNamespace("ggnetwork", quietly=TRUE)) { ## Using more complex set of libraries to display personalized graph library(ggplot2) library(igraph) library(ggnetwork) library(ggtangle) emapG <- ggplot(mapG, layout=layout_with_fr) + geom_edge(color="gray", linewidth=1) + geom_nodes(aes(size=size)) + geom_nodetext(aes(label=name), color="black", size=3) + theme_void() emapG }## Loading dataset containing result from an enrichment analysis done with ## gprofiler2 data(parentalNapaVsDMSOEnrichment) ## Extract query information (only one in this dataset) query <- unique(parentalNapaVsDMSOEnrichment$result$query) ## Create graph for Gene Ontology - Cellular Component related results mapG <- createEnrichMapAsIgraph(gostObject=parentalNapaVsDMSOEnrichment, query=query, source="GO:CC", removeRoot=TRUE, showCategory=30L, similarityCutOff=0.20) ## Required library igraph to show the graph if(requireNamespace("igraph", quietly=TRUE)) { ## Using library igraph to show the graph library(igraph) plot(mapG) } if (requireNamespace("ggplot2", quietly=TRUE) && requireNamespace("igraph", quietly=TRUE) && requireNamespace("ggtangle", quietly=TRUE) && requireNamespace("ggnetwork", quietly=TRUE)) { ## Using more complex set of libraries to display personalized graph library(ggplot2) library(igraph) library(ggnetwork) library(ggtangle) emapG <- ggplot(mapG, layout=layout_with_fr) + geom_edge(color="gray", linewidth=1) + geom_nodes(aes(size=size)) + geom_nodetext(aes(label=name), color="black", size=3) + theme_void() emapG }
User selected enrichment terms are used to create an enrichment map. The selection of the term can by specifying by the source of the terms (GO:MF, REAC, TF, etc.) or by listing the selected term IDs. The map is only generated when there is at least on significant term to graph.
createEnrichMapMultiBasic( gostObjectList, queryList, source = c("TERM_ID", "GO:MF", "GO:CC", "GO:BP", "KEGG", "REAC", "TF", "MIRNA", "HPA", "CORUM", "HP", "WP"), termIDs = NULL, removeRoot = TRUE, showCategory = 30L, categoryLabel = 1, categoryNode = 1, line = 1, ... )createEnrichMapMultiBasic( gostObjectList, queryList, source = c("TERM_ID", "GO:MF", "GO:CC", "GO:BP", "KEGG", "REAC", "TF", "MIRNA", "HPA", "CORUM", "HP", "WP"), termIDs = NULL, removeRoot = TRUE, showCategory = 30L, categoryLabel = 1, categoryNode = 1, line = 1, ... )
gostObjectList |
a |
queryList |
a |
source |
a |
termIDs |
a |
removeRoot |
a |
showCategory |
a positive |
categoryLabel |
a positive |
categoryNode |
a positive |
line |
a non-negative |
... |
additional arguments that will be pass to the
|
a ggplot object which is the enrichment map for enrichment
results.
Astrid Deschênes
## Loading dataset containing results from 2 enrichment analyses done with ## gprofiler2 data(parentalNapaVsDMSOEnrichment) data(rosaNapaVsDMSOEnrichment) ## Extract query information (only one in each dataset) query1 <- unique(parentalNapaVsDMSOEnrichment$result$query)[1] query2 <- unique(rosaNapaVsDMSOEnrichment$result$query)[1] ## Create graph for KEGG related results from ## 2 enrichment analyses createEnrichMapMultiBasic(gostObjectList=list(parentalNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment), queryList=list(query1, query2), source="KEGG", removeRoot=TRUE)## Loading dataset containing results from 2 enrichment analyses done with ## gprofiler2 data(parentalNapaVsDMSOEnrichment) data(rosaNapaVsDMSOEnrichment) ## Extract query information (only one in each dataset) query1 <- unique(parentalNapaVsDMSOEnrichment$result$query)[1] query2 <- unique(rosaNapaVsDMSOEnrichment$result$query)[1] ## Create graph for KEGG related results from ## 2 enrichment analyses createEnrichMapMultiBasic(gostObjectList=list(parentalNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment), queryList=list(query1, query2), source="KEGG", removeRoot=TRUE)
User selected enrichment terms are used to create an enrichment map. The selection of the term can by specifying by the source of the terms (GO:MF, REAC, TF, etc.) or by listing the selected term IDs. The map is only generated when there is at least on significant term to graph. The output is an enrichment map in igraph format.
createEnrichMapMultiBasicAsIgraph( gostObjectList, queryList, source = c("TERM_ID", "GO:MF", "GO:CC", "GO:BP", "KEGG", "REAC", "TF", "MIRNA", "HPA", "CORUM", "HP", "WP"), termIDs = NULL, removeRoot = TRUE, showCategory = 30L, similarityCutOff = 0.2 )createEnrichMapMultiBasicAsIgraph( gostObjectList, queryList, source = c("TERM_ID", "GO:MF", "GO:CC", "GO:BP", "KEGG", "REAC", "TF", "MIRNA", "HPA", "CORUM", "HP", "WP"), termIDs = NULL, removeRoot = TRUE, showCategory = 30L, similarityCutOff = 0.2 )
gostObjectList |
a |
queryList |
a |
source |
a |
termIDs |
a |
removeRoot |
a |
showCategory |
a positive |
similarityCutOff |
a positive |
a igraph object which is the enrichment map for enrichment
results. The node have 5 attributes: "name", "size", "pie", "cluster",
and "pieName". The "name" corresponds to the term description. While the
"size" corresponds to the number of unique genes found in the specific
gene set when looking at all the experiments.
The edges have 3 attributes: "similarity", "width", and
"weight". All those 3 attributes correspond to the Jaccard coefficient.
Astrid Deschênes
## Loading dataset containing results from 2 enrichment analyses done with ## gprofiler2 data(parentalNapaVsDMSOEnrichment) data(rosaNapaVsDMSOEnrichment) ## Extract query information (only one in each dataset) query1 <- unique(parentalNapaVsDMSOEnrichment$result$query)[1] query2 <- unique(rosaNapaVsDMSOEnrichment$result$query)[1] ## Create graph for KEGG related results from ## 2 enrichment analyses emapG <- createEnrichMapMultiBasicAsIgraph(gostObjectList= list(parentalNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment), queryList=list(query1, query2), source="KEGG", removeRoot=TRUE, similarityCutOff=0.3) if (requireNamespace("ggplot2", quietly=TRUE) && requireNamespace("igraph", quietly=TRUE) && requireNamespace("scatterpie", quietly=TRUE) && requireNamespace("ggtangle", quietly=TRUE) && requireNamespace("ggrepel", quietly=TRUE)) { ## Create a visual representation of the enrichment map ## by default library(igraph) plot(emapG) ## Add see to reproduce the same graph set.seed(12) library(ggplot2) library(ggtangle) library(scatterpie) library(ggrepel) emapGraph <- ggplot(emapG, layout=layout_with_fr) + geom_edge(color="gray", linewidth=1) pieInfo <- as.data.frame(do.call(rbind, V(emapG)$pie)) colnames(pieInfo) <- V(emapG)$pieName[[1]] ## Add information about the groups associated with each node in the ## ggplot object so that the node can be colored accordingly for (i in seq_len(ncol(pieInfo))) { emapGraph$data[colnames(pieInfo)[i]] <- pieInfo[, i] } ## Using scatterpie, ggtangle and ggrepel to generate the graph ## geom_scatterpie() allows to have scatter pie plot ## geom_text_repel() allows to have minimum overlying terms ## coord_fixed() forces the plot to have a 1:1 aspect ratio emapGraph + geom_scatterpie(aes(x=x, y=y, r=size/50), cols=c(colnames(pieInfo)), legend_name = "Group", color=NA) + geom_scatterpie_legend(radius=emapGraph$data$size/50, n=4, x=max(emapGraph$data$x), y=min(emapGraph$data$y), labeller=function(x) {round(x*50)}, label_position="right") + geom_text_repel(aes(x=x, y=y, label=label), max.overlaps=20) + coord_fixed() }## Loading dataset containing results from 2 enrichment analyses done with ## gprofiler2 data(parentalNapaVsDMSOEnrichment) data(rosaNapaVsDMSOEnrichment) ## Extract query information (only one in each dataset) query1 <- unique(parentalNapaVsDMSOEnrichment$result$query)[1] query2 <- unique(rosaNapaVsDMSOEnrichment$result$query)[1] ## Create graph for KEGG related results from ## 2 enrichment analyses emapG <- createEnrichMapMultiBasicAsIgraph(gostObjectList= list(parentalNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment), queryList=list(query1, query2), source="KEGG", removeRoot=TRUE, similarityCutOff=0.3) if (requireNamespace("ggplot2", quietly=TRUE) && requireNamespace("igraph", quietly=TRUE) && requireNamespace("scatterpie", quietly=TRUE) && requireNamespace("ggtangle", quietly=TRUE) && requireNamespace("ggrepel", quietly=TRUE)) { ## Create a visual representation of the enrichment map ## by default library(igraph) plot(emapG) ## Add see to reproduce the same graph set.seed(12) library(ggplot2) library(ggtangle) library(scatterpie) library(ggrepel) emapGraph <- ggplot(emapG, layout=layout_with_fr) + geom_edge(color="gray", linewidth=1) pieInfo <- as.data.frame(do.call(rbind, V(emapG)$pie)) colnames(pieInfo) <- V(emapG)$pieName[[1]] ## Add information about the groups associated with each node in the ## ggplot object so that the node can be colored accordingly for (i in seq_len(ncol(pieInfo))) { emapGraph$data[colnames(pieInfo)[i]] <- pieInfo[, i] } ## Using scatterpie, ggtangle and ggrepel to generate the graph ## geom_scatterpie() allows to have scatter pie plot ## geom_text_repel() allows to have minimum overlying terms ## coord_fixed() forces the plot to have a 1:1 aspect ratio emapGraph + geom_scatterpie(aes(x=x, y=y, r=size/50), cols=c(colnames(pieInfo)), legend_name = "Group", color=NA) + geom_scatterpie_legend(radius=emapGraph$data$size/50, n=4, x=max(emapGraph$data$x), y=min(emapGraph$data$y), labeller=function(x) {round(x*50)}, label_position="right") + geom_text_repel(aes(x=x, y=y, label=label), max.overlaps=20) + coord_fixed() }
User selected enrichment terms are used to create an enrichment map. The selection of the term can by specifying by the source of the terms (GO:MF, REAC, TF, etc.) or by listing the selected term IDs. The map is only generated when there is at least on significant term to graph.
createEnrichMapMultiComplex( gostObjectList, queryInfo, showCategory = 30L, categoryLabel = 1, categoryNode = 1, line = 1, ... )createEnrichMapMultiComplex( gostObjectList, queryInfo, showCategory = 30L, categoryLabel = 1, categoryNode = 1, line = 1, ... )
gostObjectList |
a |
queryInfo |
a
|
showCategory |
a positive |
categoryLabel |
a positive |
categoryNode |
a positive |
line |
a non-negative |
... |
additional arguments that will be pass to the
|
a ggplot object which is the enrichment map for enrichment
results.
Astrid Deschênes
## Loading dataset containing results from 2 enrichment analyses done with ## gprofiler2 data(parentalNapaVsDMSOEnrichment) data(rosaNapaVsDMSOEnrichment) ## Create list of enrichment objects required to generate the enrichment map gostObjectList=list(parentalNapaVsDMSOEnrichment, parentalNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment) ## Create data frame containing required information enabling the ## selection of the retained enriched terms for each enrichment analysis. ## One line per enrichment analyses present in the gostObjectList parameter ## With this data frame, the enrichment results will be split in 4 groups: ## 1) KEGG significant terms from parental napa vs DMSO (no root term) ## 2) REACTOME significant terms from parental napa vs DMSO (no root term) ## 3) KEGG significant terms from rosa napa vs DMSO (no root term) ## 4) REACTOME significant terms from rosa napa vs DMSO (no root term) queryDataFrame <- data.frame(queryName=c("parental_napa_vs_DMSO", "parental_napa_vs_DMSO", "rosa_napa_vs_DMSO", "rosa_napa_vs_DMSO"), source=c("KEGG", "REAC", "KEGG", "REAC"), removeRoot=c(TRUE, TRUE, TRUE, TRUE), termIDs=c("", "", "", ""), groupName=c("parental - KEGG", "parental - Reactome", "rosa - KEGG", "rosa - Reactome"), stringsAsFactors=FALSE) ## Create graph for KEGG and REACTOME significant results from ## 2 enrichment analyses createEnrichMapMultiComplex(gostObjectList=gostObjectList, queryInfo=queryDataFrame, line=1.5)## Loading dataset containing results from 2 enrichment analyses done with ## gprofiler2 data(parentalNapaVsDMSOEnrichment) data(rosaNapaVsDMSOEnrichment) ## Create list of enrichment objects required to generate the enrichment map gostObjectList=list(parentalNapaVsDMSOEnrichment, parentalNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment) ## Create data frame containing required information enabling the ## selection of the retained enriched terms for each enrichment analysis. ## One line per enrichment analyses present in the gostObjectList parameter ## With this data frame, the enrichment results will be split in 4 groups: ## 1) KEGG significant terms from parental napa vs DMSO (no root term) ## 2) REACTOME significant terms from parental napa vs DMSO (no root term) ## 3) KEGG significant terms from rosa napa vs DMSO (no root term) ## 4) REACTOME significant terms from rosa napa vs DMSO (no root term) queryDataFrame <- data.frame(queryName=c("parental_napa_vs_DMSO", "parental_napa_vs_DMSO", "rosa_napa_vs_DMSO", "rosa_napa_vs_DMSO"), source=c("KEGG", "REAC", "KEGG", "REAC"), removeRoot=c(TRUE, TRUE, TRUE, TRUE), termIDs=c("", "", "", ""), groupName=c("parental - KEGG", "parental - Reactome", "rosa - KEGG", "rosa - Reactome"), stringsAsFactors=FALSE) ## Create graph for KEGG and REACTOME significant results from ## 2 enrichment analyses createEnrichMapMultiComplex(gostObjectList=gostObjectList, queryInfo=queryDataFrame, line=1.5)
User selected enrichment terms are used to create an enrichment map. The selection of the term can by specifying by the source of the terms (GO:MF, REAC, TF, etc.) or by listing the selected term IDs. The map is only generated when there is at least on significant term to graph.
createEnrichMapMultiComplexAsIgraph( gostObjectList, queryInfo, showCategory = 30L, similarityCutOff = 0.2 )createEnrichMapMultiComplexAsIgraph( gostObjectList, queryInfo, showCategory = 30L, similarityCutOff = 0.2 )
gostObjectList |
a |
queryInfo |
a
|
showCategory |
a positive |
similarityCutOff |
a positive |
a igraph object which is the enrichment map for enrichment
results. The node have 5 attributes: "name", "size", "pie", "cluster",
and "pieName". The "name" corresponds to the term description. While the
"size" corresponds to the number of unique genes found in the specific
gene set when looking at all the experiments.
The edges have 3 attributes: "similarity", "width", and
"weight". All those 3 attributes correspond to the Jaccard coefficient.
Astrid Deschênes
## Loading dataset containing results from 2 enrichment analyses done with ## gprofiler2 queries data(parentalNapaVsDMSOEnrichment) data(rosaNapaVsDMSOEnrichment) ## The graph will be split in 4 groups ## Groups 1 and 2 are using the parental Napa vs DMSO dataset ## Group 3 and 4 are using the rosa Napa vs DMSO dataset gostObjectList=list(parentalNapaVsDMSOEnrichment, parentalNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment) ## Create data frame containing required information enabling the ## selection of the retained enriched terms for each enrichment analysis. ## One line per enrichment analyses present in the gostObjectList parameter ## With this data frame, the enrichment results will be split in 4 groups: ## 1) KEGG significant terms from parental napa vs DMSO (no root term) ## 2) REACTOME significant terms from parental napa vs DMSO (no root term) ## 3) KEGG significant terms from rosa napa vs DMSO (no root term) ## 4) REACTOME significant terms from rosa napa vs DMSO (no root term) queryDataFrame <- data.frame(queryName=c("parental_napa_vs_DMSO", "parental_napa_vs_DMSO", "rosa_napa_vs_DMSO", "rosa_napa_vs_DMSO"), source=c("KEGG", "REAC", "KEGG", "REAC"), removeRoot=c(TRUE, TRUE, TRUE, TRUE), termIDs=c("", "", "", ""), groupName=c("parental - KEGG", "parental - Reactome", "rosa - KEGG", "rosa - Reactome"), stringsAsFactors=FALSE) ## Create graph for KEGG and REACTOME significant results from ## 2 enrichment analyses in an igraph format emap <- createEnrichMapMultiComplexAsIgraph(gostObjectList=gostObjectList, queryInfo=queryDataFrame, showCategory=5) if (requireNamespace("ggplot2", quietly=TRUE) && requireNamespace("igraph", quietly=TRUE) && requireNamespace("scatterpie", quietly=TRUE) && requireNamespace("ggtangle", quietly=TRUE) && requireNamespace("ggrepel", quietly=TRUE)) { ## Create a visual representation of the enrichment map ## by default library(igraph) plot(emap) ## Add see to reproduce the same graph set.seed(12) library(ggplot2) library(ggtangle) library(scatterpie) library(ggrepel) emapG <- ggplot(emap, layout=layout_with_fr) + geom_edge(color="gray", linewidth=1) pieInfo <- as.data.frame(do.call(rbind, V(emap)$pie)) colnames(pieInfo) <- V(emap)$pieName[[1]] ## Add information about the groups associated with each node in the ## ggplot object so that the node can be colored accordingly for (i in seq_len(ncol(pieInfo))) { emapG$data[colnames(pieInfo)[i]] <- pieInfo[, i] } ## Using scatterpie, ggtangle and ggrepel to generate the graph ## geom_scatterpie() allows to have scatter pie plot ## geom_text_repel() allows to have minimum overlying terms ## coord_fixed() forces the plot to have a 1:1 aspect ratio emapG + geom_scatterpie(aes(x=x, y=y, r=size/50), cols=c(colnames(pieInfo)), legend_name = "Group", color=NA) + geom_scatterpie_legend(radius=emapG$data$size/50, n=4, x=max(emapG$data$x), y=max(emapG$data$y), labeller=function(x) {round(x*50)}, label_position="right") + geom_text_repel(aes(x=x, y=y, label=label), max.overlaps=20) + coord_fixed() }## Loading dataset containing results from 2 enrichment analyses done with ## gprofiler2 queries data(parentalNapaVsDMSOEnrichment) data(rosaNapaVsDMSOEnrichment) ## The graph will be split in 4 groups ## Groups 1 and 2 are using the parental Napa vs DMSO dataset ## Group 3 and 4 are using the rosa Napa vs DMSO dataset gostObjectList=list(parentalNapaVsDMSOEnrichment, parentalNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment) ## Create data frame containing required information enabling the ## selection of the retained enriched terms for each enrichment analysis. ## One line per enrichment analyses present in the gostObjectList parameter ## With this data frame, the enrichment results will be split in 4 groups: ## 1) KEGG significant terms from parental napa vs DMSO (no root term) ## 2) REACTOME significant terms from parental napa vs DMSO (no root term) ## 3) KEGG significant terms from rosa napa vs DMSO (no root term) ## 4) REACTOME significant terms from rosa napa vs DMSO (no root term) queryDataFrame <- data.frame(queryName=c("parental_napa_vs_DMSO", "parental_napa_vs_DMSO", "rosa_napa_vs_DMSO", "rosa_napa_vs_DMSO"), source=c("KEGG", "REAC", "KEGG", "REAC"), removeRoot=c(TRUE, TRUE, TRUE, TRUE), termIDs=c("", "", "", ""), groupName=c("parental - KEGG", "parental - Reactome", "rosa - KEGG", "rosa - Reactome"), stringsAsFactors=FALSE) ## Create graph for KEGG and REACTOME significant results from ## 2 enrichment analyses in an igraph format emap <- createEnrichMapMultiComplexAsIgraph(gostObjectList=gostObjectList, queryInfo=queryDataFrame, showCategory=5) if (requireNamespace("ggplot2", quietly=TRUE) && requireNamespace("igraph", quietly=TRUE) && requireNamespace("scatterpie", quietly=TRUE) && requireNamespace("ggtangle", quietly=TRUE) && requireNamespace("ggrepel", quietly=TRUE)) { ## Create a visual representation of the enrichment map ## by default library(igraph) plot(emap) ## Add see to reproduce the same graph set.seed(12) library(ggplot2) library(ggtangle) library(scatterpie) library(ggrepel) emapG <- ggplot(emap, layout=layout_with_fr) + geom_edge(color="gray", linewidth=1) pieInfo <- as.data.frame(do.call(rbind, V(emap)$pie)) colnames(pieInfo) <- V(emap)$pieName[[1]] ## Add information about the groups associated with each node in the ## ggplot object so that the node can be colored accordingly for (i in seq_len(ncol(pieInfo))) { emapG$data[colnames(pieInfo)[i]] <- pieInfo[, i] } ## Using scatterpie, ggtangle and ggrepel to generate the graph ## geom_scatterpie() allows to have scatter pie plot ## geom_text_repel() allows to have minimum overlying terms ## coord_fixed() forces the plot to have a 1:1 aspect ratio emapG + geom_scatterpie(aes(x=x, y=y, r=size/50), cols=c(colnames(pieInfo)), legend_name = "Group", color=NA) + geom_scatterpie_legend(radius=emapG$data$size/50, n=4, x=max(emapG$data$x), y=max(emapG$data$y), labeller=function(x) {round(x*50)}, label_position="right") + geom_text_repel(aes(x=x, y=y, label=label), max.overlaps=20) + coord_fixed() }
User selected enrichment terms are used to create a Cytoscape network where the selected terms and the genes that where part of the enrichment analysis are all represented as nodes. Edges are linking the genes to their terms. The selection of the term can by specifying the source of the terms (GO:MF, REAC, TF, etc.) or by listing the selected term IDs. The network is only generated when there is at least on significant term to graph. When the enrichment analysis contains more than one query, only one query can be selected to generate the network.
createNetwork( gostObject, source = c("TERM_ID", "GO:MF", "GO:CC", "GO:BP", "KEGG", "REAC", "TF", "MIRNA", "HPA", "CORUM", "HP", "WP"), termIDs = NULL, removeRoot = TRUE, query = NULL, title = "gprofiler network", collection = "enrichment results", fileName = "gprofilerNetwork.cx" )createNetwork( gostObject, source = c("TERM_ID", "GO:MF", "GO:CC", "GO:BP", "KEGG", "REAC", "TF", "MIRNA", "HPA", "CORUM", "HP", "WP"), termIDs = NULL, removeRoot = TRUE, query = NULL, title = "gprofiler network", collection = "enrichment results", fileName = "gprofilerNetwork.cx" )
gostObject |
a |
source |
a |
termIDs |
a |
removeRoot |
a |
query |
a |
title |
a |
collection |
a |
fileName |
a |
TRUE
Astrid Deschênes
## Loading dataset containing result from an enrichment analysis done with ## gprofiler2 data(parentalNapaVsDMSOEnrichment) ## Some of the enrichment results present in the dataset head(parentalNapaVsDMSOEnrichment$result) ## Create network for Gene Ontology - Molecular Function related results ## in Cytoscape (when the application is opened) ## Otherwise, create a CX file in the temporary directory ## The file can be opened in Cytoscape createNetwork(gostObject=parentalNapaVsDMSOEnrichment, source="KEGG", removeRoot=FALSE, title="KEGG Graph", fileName=file.path(tempdir(), "KEGG_demo.cx"))## Loading dataset containing result from an enrichment analysis done with ## gprofiler2 data(parentalNapaVsDMSOEnrichment) ## Some of the enrichment results present in the dataset head(parentalNapaVsDMSOEnrichment$result) ## Create network for Gene Ontology - Molecular Function related results ## in Cytoscape (when the application is opened) ## Otherwise, create a CX file in the temporary directory ## The file can be opened in Cytoscape createNetwork(gostObject=parentalNapaVsDMSOEnrichment, source="KEGG", removeRoot=FALSE, title="KEGG Graph", fileName=file.path(tempdir(), "KEGG_demo.cx"))
gprofiler2
(https://cran.r-project.org/web/packages/gprofiler2/vignettes/gprofiler2.html).The object is a list with 2 entries. It contains the results of the
enrichment analysis as well as the metadata related to the analysis.
data(demoGOST)data(demoGOST)
The list contains two entries. The result entry
contains a data.frame with the significant results obtained by
an enrichment analysis done with gprofiler2. The meta entry
contains a named list with all the metadata for the query.
This dataset can be
used to test the createNetwork function.
A list containing two entries. The result entry
contains a data.frame with the significant results obtained by
an enrichment analysis done with gprofiler2.
The meta entry contains a named list with all the
metadata for the query.
createNetwork for transforming functional enrichment results from gprofiler2 into a Cytoscape network
createEnrichMap for transforming functional enrichment results from gprofiler2 into an enrichment map
## Loading dataset containing result from an enrichment analysis done with ## gprofiler2 data(demoGOST) ## Create network for WikiPathways results ## in Cytoscape (if the application is open) ## Otherwise, create a CX file in the temporary directory ## The file can be opened in Cytoscape createNetwork(gostObject=demoGOST, source="WP", title="Wikipathways", fileName=file.path(tempdir(), "Wikipathways_Demo.cx"))## Loading dataset containing result from an enrichment analysis done with ## gprofiler2 data(demoGOST) ## Create network for WikiPathways results ## in Cytoscape (if the application is open) ## Otherwise, create a CX file in the temporary directory ## The file can be opened in Cytoscape createNetwork(gostObject=demoGOST, source="WP", title="Wikipathways", fileName=file.path(tempdir(), "Wikipathways_Demo.cx"))
The object is a data.frame with 24184 rows and 4 columns.
Each row correspond to a tested gene.
data(parentalNapaVsDMSODEG)data(parentalNapaVsDMSODEG)
a data.frame containing the results of a differential
expression analysis between napabucasin treated and DMSO control parental
MiaPaCa2 cells for all 24184 genes tested. The 4 columns are:
"EnsemblID": a character string representing the
unique Ensembl identifier for the tested gene
"log2FoldChange": a numeric representing the expression
difference (in log2FoldChange) between the napabucasin treatment and
the DMSO control for the tested gene
"padj": a numeric representing the adjusted p-value
associated to the difference in expression for the tested gene
"GeneName": a character string representing the name of
the tested gene
The differentially expressed genes between napabucasin-treated cells (0.5 uM) and DMSO as vehicle control are reprinted from Clinical Cancer Research, 2019, 25 (23), 7162–7174, Fieke E.M. Froeling, Manojit Mosur Swamynathan, Astrid Deschênes, Iok In Christine Chio, Erin Brosnan, Melissa A. Yao, Priya Alagesan, Matthew Lucito, Juying Li, An-Yun Chang, Lloyd C. Trotman, Pascal Belleau, Youngkyu Park, Harry A. Rogoff, James D. Watson, David A. Tuveson, Bioactivation of napabucasin triggers reactive oxygen species–mediated cancer cell death, with permission from AACR.
a data.frame containing the results of a differential
expression analysis between napabucasin treated and DMSO control parental
MiaPaCa2 cells for all 24184 genes tested. The 4 columns are:
"EnsemblID": a character string representing the
unique Ensembl identifier for the tested gene
"log2FoldChange": a numeric representing the expression
difference (in log2FoldChange) between the napabucasin treatment and
the DMSO control for the tested gene
"padj": a numeric representing the adjusted p-value
associated to the difference in expression for the tested gene
"GeneName": a character string representing the name of
the tested gene
The original RNA-sequencing data is available at the Gene Expression Omnibus (GEO) under the accession number GSE135352.
createNetwork for transforming functional enrichment results from gprofiler2 into a Cytoscape network
createEnrichMap for transforming functional enrichment results from gprofiler2 into an enrichment map
## Required library library(gprofiler2) ## Loading data set containing the results of a differentially expressed ## analysis between 2-hour treatment with 0.5 uM napabucasin and ## DMSO vehicle control parental MiaPaCa2 cells data(parentalNapaVsDMSODEG) allGenes <- unique(parentalNapaVsDMSODEG$EnsemblID) ## Select the significantly differentially expressed genes selection <- which(abs(parentalNapaVsDMSODEG$log2FoldChange) > 1 & parentalNapaVsDMSODEG$padj < 0.05) selectedGenes <- unique(parentalNapaVsDMSODEG$EnsemblID[selection]) ## Run an enrichment analysis using WikiPathways dataset gostres <- gost(query = list(parental_napa_vs_DMSO=selectedGenes), organism="hsapiens", correction_method = "g_SCS", sources=c("WP"), significant=TRUE, evcodes=TRUE, custom_bg=allGenes, exclude_iea=TRUE)## Required library library(gprofiler2) ## Loading data set containing the results of a differentially expressed ## analysis between 2-hour treatment with 0.5 uM napabucasin and ## DMSO vehicle control parental MiaPaCa2 cells data(parentalNapaVsDMSODEG) allGenes <- unique(parentalNapaVsDMSODEG$EnsemblID) ## Select the significantly differentially expressed genes selection <- which(abs(parentalNapaVsDMSODEG$log2FoldChange) > 1 & parentalNapaVsDMSODEG$padj < 0.05) selectedGenes <- unique(parentalNapaVsDMSODEG$EnsemblID[selection]) ## Run an enrichment analysis using WikiPathways dataset gostres <- gost(query = list(parental_napa_vs_DMSO=selectedGenes), organism="hsapiens", correction_method = "g_SCS", sources=c("WP"), significant=TRUE, evcodes=TRUE, custom_bg=allGenes, exclude_iea=TRUE)
The enrichment analysis was done with gprofile2 package (Kolberg L et al 2020) with database version 'e109_eg56_p17_1d3191d' and g:SCS multiple testing correction method applying significance threshold of 0.05 (Raudvere U et al 2019). All tested genes were used as background.
data(parentalNapaVsDMSOEnrichment)data(parentalNapaVsDMSOEnrichment)
a list created by gprofiler2 that contains the results
from the enrichment analysis:
"result": a data.frame with the significantly
enriched terms
"meta": a list with the meta-data information
The object is a named list with 2 entries. The 'result' entry
contains a data.frame with the enrichment analysis results and
the 'meta' entry contains metadata information.
The dataset used for the enrichment analysis is associated to this publication:
Froeling F.E.M. et al.Bioactivation of Napabucasin Triggers Reactive Oxygen Species–Mediated Cancer Cell Death. Clin Cancer Res 1 December 2019; 25 (23): 7162–7174
The enrichment analysis has been done with gprofile2 package (Kolberg L et al 2020) with database version 'e109_eg56_p17_1d3191d' and g:SCS multiple testing correction method applying significance threshold of 0.05 (Raudvere U et al 2019). All tested genes were used as background.
a list containing 2 entries:
"result": a data.frame with the significantly
enriched terms
"meta": a list with the meta-data information
The original RNA-sequencing data is available at the Gene Expression Omnibus (GEO) under the accession number GSE135352.
createNetwork for transforming functional enrichment results from gprofiler2 into a Cytoscape network
createEnrichMap for transforming functional enrichment results from gprofiler2 into an enrichment map
createEnrichMapAsIgraph for transforming functional enrichment results from gprofiler2 into an enrichment map in a igraph format
## Loading dataset containing the results of the enrichment analysis ## done on a differentially expressed ## analysis between 2-hour treatment with 0.5 uM napabucasin and ## DMSO vehicle control parental MiaPaCa2 cells data(parentalNapaVsDMSOEnrichment) ## Create an enrichment map for the GO:CC terms createEnrichMap(gostObject=parentalNapaVsDMSOEnrichment, query="parental_napa_vs_DMSO", source="GO:CC")## Loading dataset containing the results of the enrichment analysis ## done on a differentially expressed ## analysis between 2-hour treatment with 0.5 uM napabucasin and ## DMSO vehicle control parental MiaPaCa2 cells data(parentalNapaVsDMSOEnrichment) ## Create an enrichment map for the GO:CC terms createEnrichMap(gostObject=parentalNapaVsDMSOEnrichment, query="parental_napa_vs_DMSO", source="GO:CC")
The object is a data.frame with 23542 rows and 4 columns.
Each row correspond to a tested gene.
data(rosaNapaVsDMSODEG)data(rosaNapaVsDMSODEG)
a data.frame containing the results of a differential
expression analysis between napabucasin treated and DMSO control MiaPaCa2
cells stably expressing the Rosa26 control vector for all 23542 genes
tested. The 4 columns are:
"EnsemblID": a character string representing the
unique Ensembl identifier for the tested gene
"log2FoldChange": a numeric representing the expression
difference (in log2FoldChange) between the napabucasin treatment and
the DMSO control for the tested gene
"padj": a numeric representing the adjusted p-value
associated to the difference in expression for the tested gene
"GeneName": a character string representing the name of
the tested gene
The differentially expressed genes between napabucasin-treated cells (0.5 uM) and DMSO as vehicle control are reprinted from Clinical Cancer Research, 2019, 25 (23), 7162–7174, Fieke E.M. Froeling, Manojit Mosur Swamynathan, Astrid Deschênes, Iok In Christine Chio, Erin Brosnan, Melissa A. Yao, Priya Alagesan, Matthew Lucito, Juying Li, An-Yun Chang, Lloyd C. Trotman, Pascal Belleau, Youngkyu Park, Harry A. Rogoff, James D. Watson, David A. Tuveson, Bioactivation of napabucasin triggers reactive oxygen species–mediated cancer cell death, with permission from AACR.
a data.frame containing the results of a differential
expression analysis between napabucasin treated and DMSO control MiaPaCa2
cells stably expressing the Rosa26 control vector for all 23542 genes
tested. The 4 columns are:
"EnsemblID": a character string representing the
unique Ensembl identifier for the tested gene
"log2FoldChange": a numeric representing the expression
difference (in log2FoldChange) between the napabucasin treatment and
the DMSO control for the tested gene
"padj": a numeric representing the adjusted p-value
associated to the difference in expression for the tested gene
"GeneName": a character string representing the name of
the tested gene
The original RNA-sequencing data is available at the Gene Expression Omnibus (GEO) under the accession number GSE135352.
createNetwork for transforming functional enrichment results from gprofiler2 into a Cytoscape network
createEnrichMap for transforming functional enrichment results from gprofiler2 into an enrichment map
## Required library library(gprofiler2) ## Loading dataset containing the results of a differentially expressed ## analysis between 2-hour treatment with 0.5 uM napabucasin and ## DMSO vehicle control MiaPaCa2 cells stably expressing the ## Rosa26 control vector data(rosaNapaVsDMSODEG) allGenes <- unique(rosaNapaVsDMSODEG$EnsemblID) ## Select the significantly differentially expressed genes selection <- which(abs(rosaNapaVsDMSODEG$log2FoldChange) > 1 & rosaNapaVsDMSODEG$padj < 0.05) selectedGenes <- unique(rosaNapaVsDMSODEG$EnsemblID[selection]) ## Run an enrichment analysis using Transfac dataset (transcription factor) gostres <- gost(query = list(rosa_napa_vs_DMSO=selectedGenes), organism="hsapiens", correction_method = "g_SCS", sources=c("TF"), significant=TRUE, evcodes=TRUE, custom_bg=allGenes, exclude_iea=TRUE)## Required library library(gprofiler2) ## Loading dataset containing the results of a differentially expressed ## analysis between 2-hour treatment with 0.5 uM napabucasin and ## DMSO vehicle control MiaPaCa2 cells stably expressing the ## Rosa26 control vector data(rosaNapaVsDMSODEG) allGenes <- unique(rosaNapaVsDMSODEG$EnsemblID) ## Select the significantly differentially expressed genes selection <- which(abs(rosaNapaVsDMSODEG$log2FoldChange) > 1 & rosaNapaVsDMSODEG$padj < 0.05) selectedGenes <- unique(rosaNapaVsDMSODEG$EnsemblID[selection]) ## Run an enrichment analysis using Transfac dataset (transcription factor) gostres <- gost(query = list(rosa_napa_vs_DMSO=selectedGenes), organism="hsapiens", correction_method = "g_SCS", sources=c("TF"), significant=TRUE, evcodes=TRUE, custom_bg=allGenes, exclude_iea=TRUE)
The enrichment analysis was done with gprofile2 package (Kolberg L et al 2020) with database version 'e109_eg56_p17_1d3191d' and g:SCS multiple testing correction method applying significance threshold of 0.05 (Raudvere U et al 2019). All tested genes were used as background.
data(rosaNapaVsDMSOEnrichment)data(rosaNapaVsDMSOEnrichment)
a list created by gprofiler2 that contains the results
from the enrichment analysis:
"result": a data.frame with the significantly
enriched terms
"meta": a list with the meta-data information
The object is a named list with 2 entries. The 'result' entry
contains a data.frame with the enrichment analysis results and
the 'meta' entry contains metadata information.
The dataset used for the enrichment analysis is associated to this publication:
Froeling F.E.M. et al.Bioactivation of Napabucasin Triggers Reactive Oxygen Species–Mediated Cancer Cell Death. Clin Cancer Res 1 December 2019; 25 (23): 7162–7174
The enrichment analysis has been done with gprofile2 package (Kolberg L et al 2020) with database version 'e109_eg56_p17_1d3191d' and g:SCS multiple testing correction method applying significance threshold of 0.05 (Raudvere U et al 2019). All tested genes were used as background.
a list created by gprofiler2 that contains the results
from the enrichment analysis:
"result": a data.frame with the significantly enriched
terms
"meta": a list with the meta-data information
The original RNA-sequencing data is available at the Gene Expression Omnibus (GEO) under the accession number GSE135352.
createNetwork for transforming functional enrichment results from gprofiler2 into a Cytoscape network
createEnrichMap for transforming functional enrichment results from gprofiler2 into an enrichment map
## Loading dataset containing the enrichment analysis done on the ## differentially expressed analysis between 2-hour treatment with 0.5 uM ## napabucasin and DMSO control MiaPaCa2 cells stably expressing ## the Rosa26 control vector data(rosaNapaVsDMSOEnrichment) ## Create an enrichment map for the KEGG terms createEnrichMap(gostObject=rosaNapaVsDMSOEnrichment, query="rosa_napa_vs_DMSO", source="KEGG")## Loading dataset containing the enrichment analysis done on the ## differentially expressed analysis between 2-hour treatment with 0.5 uM ## napabucasin and DMSO control MiaPaCa2 cells stably expressing ## the Rosa26 control vector data(rosaNapaVsDMSOEnrichment) ## Create an enrichment map for the KEGG terms createEnrichMap(gostObject=rosaNapaVsDMSOEnrichment, query="rosa_napa_vs_DMSO", source="KEGG")
Validate the arguments passed to
validateCreateEnrichMapMultiComplex() function.
First, the object containing the enrichment results must correspond to a
object created by gprofiler2 software. Second, the selected
source must at least have one enriched term in the results. Then, if the
source is 'TERM_ID', the listed terms must be present in the enrichment
results.
validateCreateEnrichMapMultiComplexAsIgraphArg( gostObjectList, queryInfo, showCategory, similarityCutOff = similarityCutOff )validateCreateEnrichMapMultiComplexAsIgraphArg( gostObjectList, queryInfo, showCategory, similarityCutOff = similarityCutOff )
gostObjectList |
a |
queryInfo |
a
|
showCategory |
a positive |
similarityCutOff |
a positive |
TRUE when all arguments are valid
Astrid Deschênes
## Load the result of an enrichment analysis done with gprofiler2 data(parentalNapaVsDMSOEnrichment) data(rosaNapaVsDMSOEnrichment) queryDataFrame <- data.frame(queryName=c("parental_napa_vs_DMSO", "rosa_napa_vs_DMSO"), source=c("KEGG", "WP"), removeRoot=c(TRUE, TRUE), termIDs=c("", ""), groupName=c("parental - KEGG", "rosa - WP"), stringsAsFactors=FALSE) ## Check that all arguments are valid enrichViewNet:::validateCreateEnrichMapMultiComplexAsIgraphArg( gostObjectList=list(parentalNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment), queryInfo=queryDataFrame, showCategory=20, similarityCutOff=0.2)## Load the result of an enrichment analysis done with gprofiler2 data(parentalNapaVsDMSOEnrichment) data(rosaNapaVsDMSOEnrichment) queryDataFrame <- data.frame(queryName=c("parental_napa_vs_DMSO", "rosa_napa_vs_DMSO"), source=c("KEGG", "WP"), removeRoot=c(TRUE, TRUE), termIDs=c("", ""), groupName=c("parental - KEGG", "rosa - WP"), stringsAsFactors=FALSE) ## Check that all arguments are valid enrichViewNet:::validateCreateEnrichMapMultiComplexAsIgraphArg( gostObjectList=list(parentalNapaVsDMSOEnrichment, rosaNapaVsDMSOEnrichment), queryInfo=queryDataFrame, showCategory=20, similarityCutOff=0.2)