MAplot: Create a MA plot

View source: R/tab_values.R

MAplotR Documentation

Create a MA plot

Description

The function creates a 2D histogram of M and A values.

Usage

MAplot(
  tbl,
  group = c("all", colnames(tbl)),
  plot = c("all", unique(tbl[["name"]]))
)

Arguments

tbl

tibble containing the M and A values, as obtained from the MAvalues function

group

character, one of colnames(colData(se)) (se used in MAvalues) or "all"

plot

character, one of colData(se)$name (se used in MAvalues) or "all"

Details

MAplot returns a 2D hex histogram instead of a classical scatterplot due to computational reasons and better visualization of overlaying points. The argument plot specifies the sample (refering to colData(se)$name) to be plotted. If plot = "all", MA values for all samples will be plotted (samples will be plotted in facets). If the number of features (tbl$Features) is below 1000, points will be plotted (via geom_points), otherwise hexagons will be plotted (via geom_hex).

Value

gg object from ggplot2

Examples

## create se
set.seed(1)
a <- matrix(rnorm(10000), nrow = 1000, ncol = 10,
            dimnames = list(seq_len(1000), paste("sample", seq_len(10))))
a[c(1, 5, 8), seq_len(5)] <- NA
cD <- data.frame(name = colnames(a), type = c(rep("1", 5), rep("2", 5)))
rD <- data.frame(spectra = rownames(a))
se <- SummarizedExperiment::SummarizedExperiment(assay = a,
    rowData = rD, colData = cD)

tbl <- MAvalues(se, log = FALSE, group = "all")
MAplot(tbl, group = "all", plot = "all")


tnaake/MatrixQCvis documentation built on June 20, 2024, 7:22 a.m.