Runs a battery of pre-analysis checks on a raw-counts
SummarizedExperiment: duplicate
sample identifiers, missing values in sample metadata, non-integer
count values, and library-size outliers detected via a robust
(median absolute deviation-based) rule. Every check is reported with
the statistic that triggered it, not just a pass/fail flag, so the
result can be inspected or logged rather than trusted blindly.
qc_explore(se, mad_threshold = 3)A SummarizedExperiment with a raw-count assay as its
first assay (assay(se, 1)). Counts should be non-negative
integers (or values coercible to integers without loss).
Numeric scalar. Samples whose log10 library size
deviates from the median by more than mad_threshold robust
median absolute deviations are flagged as library-size outliers.
Defaults to 3.
An object of class "rnaSentry_qc" (a list) with elements:
Number of samples (columns) in se.
Number of genes (rows) in se.
Character vector of duplicated sample IDs,
or character(0) if none.
Logical; TRUE if the count assay
contains non-integer values.
A data.frame reporting the proportion of
missing values per colData(se) column.
Character vector of sample IDs flagged as library-size outliers.
A data.frame summarizing every issue raised, with
columns check, severity, detail and stage.
library(SummarizedExperiment)
set.seed(1)
counts <- matrix(rpois(60, lambda = 200), nrow = 6, ncol = 10,
dimnames = list(paste0("gene", 1:6), paste0("S", 1:10)))
counts[, 1] <- counts[, 1] * 50L # inject one library-size outlier
coldata <- DataFrame(condition = rep(c("A", "B"), each = 5),
row.names = paste0("S", 1:10))
se <- SummarizedExperiment(assays = list(counts = counts), colData = coldata)
qc <- qc_explore(se)
qc$flags
#> check severity
#> 1 library_size_outlier warning
#> detail stage
#> 1 Samples with library size > 3 MADs from the median: S1 qc_explore