driftPlot {MatrixQCvis} | R Documentation |
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'.
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") )
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"' |
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'.
'gg' object from 'ggplot2'
#' ## 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")