ggplot2_marginPlot {ERSSA} | R Documentation

## Plot percent increase in detection of DE genes across replicate levels

### Description

`ggplot2_marginPlot` function plots the percent change in number of DE genes identified at each step-wise increase in replicate level.

### Usage

    ggplot2_marginPlot(deg = NULL, stat = "mean", path = ".",
      save_plot = TRUE)

### Arguments

`deg` | The list of DE genes generated by one of ERSSA::DE_*.R scripts.
`stat` | The statistic used for plotting. Options include 'mean', 'median'. Default='mean'.
`path` | Path to which the plot will be saved. Default to current working directory.
`save_plot` | Boolean. Whether to save plot to drive. Default to TRUE.

### Details

The percent change is calculated as (margin*100 lower replicate level). The results are visualized as bar plots. Either mean or median can be used for the calculation.

### Value

A list is returned containing:

- gg_object the ggplot2 object, which can then be further customized.

- marg_diff.dataframe the tidy table version of percent changes for plotting.

### Author(s)

Zixuan Shao, Zixuanshao.zach@gmail.com

### References

H. Wickham. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York, 2009.

### Examples

    # load edgeR deg object generated by erssa_edger using example dataset
    # example dataset containing 1000 genes, 4 replicates and 5 comb. per rep.
    # level
    data(deg.partial, package = "ERSSA")

    gg_margin = ggplot2_marginPlot(deg.partial)

[Package ERSSA version 1.4.0 Index]