Quality control metrics

metrics(object, ...)

metricsPerSample(object, ...)

# S4 method for SummarizedExperiment
metrics(object, return = c("tibble",
  "DataFrame"))

# S4 method for SingleCellExperiment
metrics(object, return = c("tibble",
  "DataFrame"))

# S4 method for SingleCellExperiment
metricsPerSample(object, fun = c("mean",
  "median", "sum"))

Arguments

object

Object.

return

character(1). Return type. Uses match.arg() internally and defaults to the first argument in the character vector.

fun

character(1). Mathematical function name to apply. Uses match.arg() internally.

...

Additional arguments.

Value

  • "tibble": grouped_df. Grouped by sampleID column.

  • "DataFrame": DataFrame. Row names are identical to the column names of the object, like colData().

Details

metrics() takes data stored in colData() and consistently returns a tibble grouped by sample by default (sampleID). It always returns sampleName and interestingGroups columns, even when these columns are not defined in colData. This is designed to integrate with plotting functions that use ggplot2 internally.

Methods (by class)

  • SummarizedExperiment: Metrics are sample level. sampleID column corresponds to colnames.

  • SingleCellExperiment: Metrics are cell level. cellID column corresponds to colnames. Tibble is returned grouped by sample (sampleID column).

Examples

data(rse, sce, package = "acidtest") ## SummarizedExperiment ==== x <- metrics(rse) print(x)
#> # A tibble: 12 x 4 #> # Groups: sampleID [12] #> sampleID condition sampleName interestingGroups #> <chr> <fct> <fct> <fct> #> 1 sample01 A sample01 A #> 2 sample02 A sample02 A #> 3 sample03 A sample03 A #> 4 sample04 A sample04 A #> 5 sample05 A sample05 A #> 6 sample06 A sample06 A #> 7 sample07 B sample07 B #> 8 sample08 B sample08 B #> 9 sample09 B sample09 B #> 10 sample10 B sample10 B #> 11 sample11 B sample11 B #> 12 sample12 B sample12 B
## SingleCellExperiment ==== x <- metrics(sce) print(x)
#> # A tibble: 100 x 5 #> # Groups: sampleID [2] #> cellID expLibSize sampleID sampleName interestingGroups #> <chr> <dbl> <fct> <fct> <fct> #> 1 cell001 31969. sample1 sample1 sample1 #> 2 cell002 49291. sample1 sample1 sample1 #> 3 cell003 55145. sample2 sample2 sample2 #> 4 cell004 53802. sample1 sample1 sample1 #> 5 cell005 96257. sample2 sample2 sample2 #> 6 cell006 57539. sample2 sample2 sample2 #> 7 cell007 70297. sample1 sample1 sample1 #> 8 cell008 46842. sample2 sample2 sample2 #> 9 cell009 85225. sample1 sample1 sample1 #> 10 cell010 58212. sample1 sample1 sample1 #> # … with 90 more rows
x <- metricsPerSample(sce, fun = "mean")
#> Calculating mean per sample.
#> # A tibble: 2 x 4 #> # Groups: sampleID [2] #> sampleID expLibSize sampleName interestingGroups #> <fct> <dbl> <fct> <fct> #> 1 sample1 61185. sample1 sample1 #> 2 sample2 56830. sample2 sample2