emapplot: emapplot

emapplotR Documentation

emapplot

Description

Enrichment Map for enrichment result of over-representation test or gene set enrichment analysis

Usage

emapplot(x, ...)

## S4 method for signature 'enrichResult'
emapplot(x, showCategory = 30, ...)

## S4 method for signature 'gseaResult'
emapplot(x, showCategory = 30, ...)

## S4 method for signature 'compareClusterResult'
emapplot(x, showCategory = 30, ...)

emapplot.enrichResult(
  x,
  showCategory = 30,
  layout = NULL,
  coords = NULL,
  color = "p.adjust",
  min_edge = 0.2,
  cex_label_category = 1,
  cex_category = 1,
  cex_line = 1,
  shadowtext = TRUE,
  label_style = "shadowtext",
  repel = FALSE,
  node_label = "category",
  with_edge = TRUE,
  group_category = FALSE,
  group_legend = FALSE,
  cex_label_group = 1,
  nWords = 4,
  label_format = 30,
  clusterFunction = stats::kmeans,
  nCluster = NULL,
  layout.params = list(layout = NULL, coords = NULL),
  edge.params = list(show = TRUE, min = 0.2),
  cex.params = list(category_node = 1, category_label = 1, line = 1),
  hilight.params = list(category = NULL, alpha_hilight = 1, alpha_no_hilight = 0.3),
  cluster.params = list(cluster = FALSE, method = stats::kmeans, n = NULL, legend =
    FALSE, label_style = "shadowtext", label_words_n = 4, label_format = 30),
  ...
)

emapplot.compareClusterResult(
  x,
  showCategory = 30,
  layout = NULL,
  coords = NULL,
  split = NULL,
  pie = "equal",
  legend_n = 5,
  cex_category = 1,
  cex_line = 1,
  min_edge = 0.2,
  cex_label_category = 1,
  shadowtext = TRUE,
  with_edge = TRUE,
  group_category = FALSE,
  label_format = 30,
  group_legend = FALSE,
  node_label = "category",
  label_style = "shadowtext",
  repel = FALSE,
  cex_label_group = 1,
  nWords = 4,
  clusterFunction = stats::kmeans,
  nCluster = NULL,
  cex_pie2axis = 1,
  pie.params = list(pie = "equal", legend_n = 5),
  layout.params = list(layout = NULL, coords = NULL),
  edge.params = list(show = TRUE, min = 0.2),
  cluster.params = list(cluster = FALSE, method = stats::kmeans, n = NULL, legend =
    FALSE, label_style = "shadowtext", label_words_n = 4, label_format = 30),
  cex.params = list(category_node = 1, category_label = 1, line = 1, pie2axis = 1,
    label_group = 1),
  hilight.params = list(category = NULL, alpha_hilight = 1, alpha_no_hilight = 0.3),
  ...
)

Arguments

x

Enrichment result.

...

additional parameters

additional parameters can refer the following parameters.

  • force Force of repulsion between overlapping text labels. Defaults to 1.

  • nudge_x, nudge_y Horizontal and vertical adjustments to nudge the starting position of each text label.

  • direction "both", "x", or "y" – direction in which to adjust position of labels.

  • ellipse_style style of ellipse, one of "ggforce" an "polygon".

  • ellipse_pro numeric indicating confidence value for the ellipses, it can be used only when ellipse_style = "polygon".

  • alpha the transparency of ellipse fill.

  • type The type of ellipse. The default "t" assumes a multivariate t-distribution, and "norm" assumes a multivariate normal distribution. "euclid" draws a circle with the radius equal to level, representing the euclidean distance from the center.

showCategory

A number or a vector of terms. If it is a number, the first n terms will be displayed. If it is a vector of terms, the selected terms will be displayed.

layout

Layout of the map, e.g. 'star', 'circle', 'gem', 'dh', 'graphopt', 'grid', 'mds', 'randomly', 'fr', 'kk', 'drl' or 'lgl'. Will be removed in the next version. Will be removed in the next version.

coords

a data.frame with two columns: 'x' for X-axis coordinate and 'y' for Y-axis coordinate. Will be removed in the next version.

color

Variable that used to color enriched terms, e.g. 'pvalue', 'p.adjust' or 'qvalue'.

min_edge

The minimum similarity threshold for whether two nodes are connected, should between 0 and 1, default value is 0.2. Will be removed in the next version.

cex_label_category

Scale of category node label size. Will be removed in the next version.

cex_category

Number indicating the amount by which plotting category nodes should be scaled relative to the default. Will be removed in the next version.

cex_line

Scale of line width. Will be removed in the next version.

shadowtext

a logical value, whether to use shadow font.

label_style

style of group label, one of "shadowtext" and "ggforce". Will be removed in the next version.

repel

whether to correct the position of the label. Defaults to FALSE.

node_label

Select which labels to be displayed, one of 'category', 'group', 'all' and 'none'.

with_edge

Logical, if TRUE, draw the edges of the network diagram. Will be removed in the next version.

group_category

a logical, if TRUE, group the category. Will be removed in the next version.

group_legend

Logical, if TRUE, the grouping legend will be displayed. The default is FALSE. Will be removed in the next version.

cex_label_group

Numeric, scale of group labels size, the default value is 1. Will be removed in the next version.

nWords

Numeric, the number of words in the cluster tags, the default value is 4. Will be removed in the next version.

label_format

a numeric value sets wrap length, alternatively a custom function to format axis labels. Will be removed in the next version.

clusterFunction

function of Clustering method, such as stats::kmeans(the default), cluster::clara, cluster::fanny or cluster::pam. Will be removed in the next version.

nCluster

Numeric, the number of clusters, the default value is square root of the number of nodes. Will be removed in the next version.

layout.params

list, the parameters to control the layout. see the layout.params in the following. layout.params control the attributes of layout, it can be referred to the following parameters:

  • layout Layout of the map, e.g. 'star', 'circle', 'gem', 'dh', 'graphopt', 'grid', 'mds', 'randomly', 'fr', 'kk', 'drl' or 'lgl'..

  • coords a data.frame with two columns: 'x' for X-axis coordinate and 'y' for Y-axis coordinate.

edge.params

list, the parameters to control the edge. see the edge.params in the following. edge.params control the attributes of edge, it can be referred to the following parameters:

  • show Logical, if TRUE (the default), draw the edges of the network diagram.

  • min The minimum similarity threshold for whether two nodes are connected, should between 0 and 1, default value is 0.2.

cex.params

list, the parameters to control the edge. see the cex.params in the following. cex.params control the attributes of edge, it can be referred to the following parameters:

  • category_node Number indicating the amount by which plotting category nodes should be scaled relative to the default.

  • category_label Scale of category node label size.

  • line Scale of line width.

  • pie2axis It is used to adjust the relative size of the pie chart on the coordinate axis, the default value is 1.

  • label_group Numeric, scale of group labels size, the default value is 1.

hilight.params

list, the parameters to control the attributes of highlighted nodes and edges. see the hilight.params in the following. hilight.params control the attributes of highlight, it can be referred to the following parameters:

  • category category nodes to be highlight.

  • alpha_hilight alpha of highlighted nodes.

  • alpha_no_hilight alpha of unhighlighted nodes.

cluster.params

list, the parameters to control the attributes of highlighted nodes and edges. see the cluster.params in the following. cluster.params control the attributes of highlight, it can be referred to the following parameters:

  • cluster a logical, if TRUE, group the category.

  • method function of Clustering method, such as stats::kmeans(the default), cluster::clara, cluster::fanny or cluster::pam.

  • n Numeric, the number of clusters, the default value is square root of the number of nodes.

  • legend Logical, if TRUE, the grouping legend will be displayed. The default is FALSE.

  • label_style style of group label, one of "shadowtext" and "ggforce".

  • label_words_n Numeric, the number of words in the cluster tags, the default value is 4.

  • label_format a numeric value sets wrap length, alternatively a custom function to format axis labels.

split

separate result by 'category' variable

pie

proportion of clusters in the pie chart, one of 'equal' (default) and 'Count' Will be removed in the next version.

legend_n

number of circle in legend Will be removed in the next version.

cex_pie2axis

It is used to adjust the relative size of the pie chart on the coordinate axis, the default value is 1. Will be removed in the next version.

pie.params

list, the parameters to control the attributes of pie nodes. see the pie.params in the following. pie.params control the attributes of pie nodes, it can be referred to the following parameters:

  • pie proportion of clusters in the pie chart, one of 'equal' (default) and 'Count'.

  • legend_n number of circle in legend.

Details

This function visualizes gene sets as a network (i.e. enrichment map). Mutually overlapping gene sets tend to cluster together, making it easier for interpretation. When the similarity between terms meets a certain threshold (default is 0.2, adjusted by parameter 'min_edge'), there will be edges between terms. The stronger the similarity, the shorter and thicker the edges. The similarity between terms is obtained by function 'pairwise_termsim', the details of similarity calculation can be found in its documentation: pairwise_termsim.

Value

ggplot object

Author(s)

Guangchuang Yu

Examples

## Not run: 
    library(DOSE)
    data(geneList)
    de <- names(geneList)[1:100]
    x <- enrichDO(de)
    x2 <- pairwise_termsim(x)
    emapplot(x2)
    # use `layout` to change the layout of map
    emapplot(x2, layout = "star")
    # use `showCategory` to  select the displayed terms. It can be a number of a vector of terms.
    emapplot(x2, showCategory = 10)
    categorys <- c("pre-malignant neoplasm", "intestinal disease",
                   "breast ductal carcinoma")
    emapplot(x2, showCategory = categorys)

    # It can also graph compareClusterResult
    library(clusterProfiler)
    library(DOSE)
    library(org.Hs.eg.db)
    data(gcSample)
    xx <- compareCluster(gcSample, fun="enrichGO", OrgDb="org.Hs.eg.db")
    xx2 <- pairwise_termsim(xx)
    emapplot(xx2)

## End(Not run)

YuLab-SMU/enrichplot documentation built on April 15, 2024, 5:18 p.m.