xEnrichMatrix | R Documentation

## Function to compare enrichment results using matrix plots

### Description

`xEnrichMatrix` is supposed to compare enrichment results using matrix plots.

### Usage

    xEnrichMatrix(list_eTerm, method = c("ggplot2", "circle", "square",
    "color", "pie"), displayBy = c("zscore", "fc", "adjp", "pvalue"),
    FDR.cutoff = 0.05, wrap.width = NULL, sharings = NULL,
    reorder = c("row", "none", "col", "both"), colormap = "jet",
    ncolors = 20, zlim = NULL, slim = NULL,
    legend.direction = c("horizontal", "vertical"), title = NULL,
    flip = FALSE, y.rotate = 45, shape = 19, font.family = "sans",
    ...)

### Arguments

`list_eTerm` | a list of "eTerm" objects, or a data frame (with at least 3 columns "group", "name" and "adjp")
`method` | which method will be used for plotting. It can be "circle" (by default), "square", "color" and "pie"
`displayBy` | which statistics will be used for comparison. It can be "fc" for enrichment fold change (by default), "adjp" for adjusted p value (or FDR), "pvalue" for p value, "zscore" for enrichment z-score
`FDR.cutoff` | FDR cutoff used to declare the significant terms. By default, it is set to 0.05
`wrap.width` | a positive integer specifying wrap width of name
`sharings` | a numeric vector specifying whether only shared terms will be displayed. For example, when comparing three groups of enrichment results, it can be set into c(2,3) to display only shared terms by any two or all three. By default, it is NULL meaning no such restriction
`reorder` | how to reorder rows and columns. It can be "none" for no reordering, "row" for reordering rows according to number of sharings (by default), "col" for reordering columns, and "both" for reordering rows and columns
`colormap` | short name for the colormap. It can be one of "jet" (jet colormap), "bwr" (blue-white-red colormap), "gbr" (green-black-red colormap), "wyr" (white-yellow-red colormap), "br" (black-red colormap), "yr" (yellow-red colormap), "wb" (white-black colormap), and "rainbow" (rainbow colormap, that is, red-yellow-green-cyan-blue-magenta). Alternatively, any hyphen-separated HTML color names, e.g. "blue-black-yellow", "royalblue-white-sandybrown", "darkgreen-white-darkviolet". A list of standard color names can be found in http://html-color-codes.info/color-names
`ncolors` | the number of colors specified over the colormap
`zlim` | the minimum and maximum z values for which colors should be plotted, defaulting to the range of the finite values of displayed matrix
`slim` | the minimum and maximum displaying values for which sizes should be plotted
`legend.direction` | the legend guide direction. It can be "horizontal" (useful for many groups with lengthy labelling), "vertical"
`title` | the title of the plot. By default, it is NULL
`flip` | logical to indicate whether to flip the coordiate. By default, it sets to false
`y.rotate` | the angle to rotate the y tick labelings. By default, it is 45
`shape` | the number specifying the shape. By default, it is 19
`font.family` | the font family for texts
`...` | additional graphic parameters for corrplot::corrplot

### Value

If the method is 'ggplot2', it returns a ggplot object. Otherwise, it is a data frame

### Note

none

### See Also

`xEnricherGenes`, `xEnricherSNPs`, `xEnrichViewer`

### Examples

    ## Not run:
    # Load the XGR package and specify the location of built-in data
    library(XGR)
    RData.location <- "http://galahad.well.ox.ac.uk/bigdata/"
    xEnrichMatrix(list_eTerm, method="circle", displayBy="adjp",
    FDR.cutoff=0.05, wrap.width=50, sharings=NULL, reorder="row",
    colormap="black-yellow-red", ncolors=16, zlim=c(0,8), cl.pos="b",
    cl.ratio=0.1, cl.align.text="c", tl.col="black", tl.cex=0.7, tl.srt=90,
    title=paste0(ontology,": log10(FDR)"))
    xEnrichMatrix(list_eTerm, method="pie", displayBy="adjp",
    FDR.cutoff=0.05, wrap.width=50, sharings=NULL, reorder="row",
    colormap="grey-grey", ncolors=1, zlim=c(0,8), cl.pos="n", cl.ratio=0.1,
    cl.align.text="c", tl.col="black", tl.cex=0.7, tl.srt=90,
    title=paste0(ontology,": log10(FDR)"))
    gp <- xEnrichMatrix(list_eTerm, method="ggplot2", displayBy="zscore",
    FDR.cutoff=0.05, wrap.width=40, sharings=NULL, reorder="row",
    colormap="yellow-red", flip=T, y.rotate=45, font.family=font.family)

    ## End(Not run)