driftPlot {MatrixQCvis}R Documentation

Plot the trend line for aggregated values

Description

The function 'driftPlot' aggregates the (count/intensity) values from the 'assay()' slot of a 'SummarizedExperiment' by the 'median' or 'sum' of the (count/intensity) values. 'driftPlot' then visualizes these aggregated values and adds a trend line (using either LOESS or a linear model) from (a subset of) the aggregated values. The subset is specified by the arguments 'category' and 'level'.

Usage

driftPlot(
  se,
  aggregation = c("median", "sum"),
  category = colnames(colData(se)),
  orderCategory = colnames(colData(se)),
  level = c("all", unique(colData(se)[, category])),
  method = c("loess", "lm")
)

Arguments

se

'SummarizedExperiment'

aggregation

'character', type of aggregation of (count/intensity) values

category

'character', column of 'colData(se)'

orderCategory

'character', column of 'colData(se)'

level

'character', from which samples should the LOESS curve be calculated, either '"all"' or one of the levels of the selected columns of 'colData(se)' ('"category"')

method

'character', either '"loess"' or '"lm"'

Details

The x-values are sorted according to the 'orderCategory' argument: The levels of the corresponding column in 'colData(se)' are pasted with the sample names (in the column 'name') and factorized. Internal usage in 'shinyQC'.

Value

'gg' object from 'ggplot2'

Examples

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

driftPlot(se, aggregation = "sum", category = "type", 
    orderCategory = "type", level = "1", method = "loess")


[Package MatrixQCvis version 1.2.2 Index]