enrichplot
enrichplot copied to clipboard
How to extract network (in cnetplot + emapplot) for export?
Hi,
For further fine-tuning of the layout (because of overlapping nodes/labels) I would like to export the underlying networks generated by the cnetplot
and emapplot
functions for further processing in (e.g.) Cytoscape.
-
I know that I can send
igraph
objects directly to Cytoscape using theRCy3
package. [Alternatively, the network could be exported as *.gml or *.graphml file]. -
From studying the relevant source codes I also know that under the hood first
igraph
objects are generated that are then 'further processed' within the functions (e.g. source code from cnetplot). Generation of the networks asigraph
object: https://github.com/YuLab-SMU/enrichplot/blob/e2c76422a58b01637065e4b6f98e017ae690041a/R/cnetplot.R#L233 Example of further processing: https://github.com/YuLab-SMU/enrichplot/blob/e2c76422a58b01637065e4b6f98e017ae690041a/R/cnetplot.R#L240
So my question is if it currently is somehow possible to extract the "final" igraph
object g
from the output from the cnetplot
and emapplot
functions?
If so, how to do this?
If not, allow me then to submit a feature request; the (optional) addition of the igraph
object g
to the output from the cnetplot
and emapplot
functions (such as p
below).
Thanks! G
> library(clusterProfiler)
> library(enrichplot)
> library(DOSE)
>
> data(geneList)
> de <- names(geneList)[abs(geneList) > 2]
>
> edo <- enrichDGN(de)
>
> edox <- setReadable(edo, 'org.Hs.eg.db', 'ENTREZID')
>
> p <- cnetplot(edox, color.params = list(foldChange = geneList) )
Scale for size is already present.
Adding another scale for size, which will replace the existing scale.
>
> attributes(p)
$names
[1] "data" "layers" "scales" "mapping" "theme"
[6] "coordinates" "facet" "plot_env" "labels" "guides"
$class
[1] "ggraph" "gg" "ggplot"
>