MAplot: MAplot

View source: R/MAplot.R

MAplotR Documentation

MAplot

Description

This function plots log2 fold changes (y-axis) versus the mean of normalized counts (on the x-axis). Statistically significant features are colored.

Usage

MAplot(
  degseqDF,
  FDR.cutoff = 0.05,
  comparison,
  filter = c(Fold = 2, FDR = 10),
  genes = "NULL",
  plotly = FALSE,
  savePlot = FALSE,
  filePlot = NULL
)

Arguments

degseqDF

object of class data.frame generated by systemPipeR::run_edgeR() or systemPipeR::run_DESeq2().

FDR.cutoff

filter cutoffs for the p-value adjusted.

comparison

character vector specifying the factor names for comparison.

filter

Named vector with filter cutoffs of format c(Fold=2, FDR=1) where Fold refers to the fold change cutoff (unlogged) and FDR to the p-value cutoff.

genes

character vector of genes names to show on the plot.

plotly

logical: when FALSE (default), the ggplot2 plot will be returned. TRUE option returns the plotly version of the plot.

savePlot

logical: when FALSE (default), the plot will not be saved. If TRUE the plot will be saved, and requires the filePlot argument.

filePlot

file name where the plot will be saved. For more information, please consult the ggplot2::ggsave() function.

Value

returns an object of ggplot or plotly class.

Examples

## Load targets file and count reads dataframe
targetspath <- system.file("extdata", "targets.txt", package = "systemPipeR")
targets <- read.delim(targetspath, comment = "#")
cmp <- systemPipeR::readComp(
    file = targetspath, format = "matrix",
    delim = "-"
)
countMatrixPath <- system.file("extdata", "countDFeByg.xls",
    package = "systemPipeR"
)
countMatrix <- read.delim(countMatrixPath, row.names = 1)
### DEG analysis with `systemPipeR`
degseqDF <- systemPipeR::run_DESeq2(
    countDF = countMatrix, targets = targets,
    cmp = cmp[[1]], independent = FALSE
)
DEG_list <- systemPipeR::filterDEGs(
    degDF = degseqDF,
    filter = c(Fold = 2, FDR = 10)
)
## Plot
MAplot(degseqDF,
    comparison = "M12-A12", filter = c(Fold = 1, FDR = 20),
    genes = "ATCG00280"
)

systemPipeR/systemPipeTools documentation built on May 4, 2022, 2:37 p.m.