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_internal(
  x,
  layout = igraph::layout_with_kk,
  showCategory = 30,
  color = "p.adjust",
  size_category = 1,
  min_edge = 0.2,
  color_edge = "grey",
  size_edge = 0.5,
  node_label = "category",
  pie = "equal",
  group = FALSE,
  group_style = "ggforce",
  label_group_style = "shawdowtext",
  label_format = 30,
  clusterFunction = stats::kmeans,
  nWords = 4,
  nCluster = NULL
)

Arguments

x

Enrichment result.

...

Additional parameters

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

igraph layout

color

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

size_category

relative size of the categories

min_edge

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

color_edge

color of the network edge

size_edge

relative size of edge width

node_label

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

pie

one of 'equal' or 'Count' to set the slice ratio of the pies

group

logical, if TRUE, group the category.

group_style

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

label_group_style

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

label_format

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

clusterFunction

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

nWords

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

nCluster

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

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 Nov. 8, 2024, 5:20 p.m.