Quality control metrics

metrics(object, ...)

metricsPerSample(object, ...)

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

# S4 method for SingleCellExperiment
metrics(object, return = c("tbl_df",
  "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

  • "tbl_df": grouped_df. Tibble 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).

Note

Updated 2019-08-06.

Examples

data( RangedSummarizedExperiment, SingleCellExperiment, package = "acidtest" ) rse <- RangedSummarizedExperiment sce <- SingleCellExperiment ## 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 4 #> # Groups: sampleID [2] #> cellID sampleID sampleName interestingGroups #> <chr> <fct> <fct> <fct> #> 1 cell001 sample1 sample1 sample1 #> 2 cell002 sample2 sample2 sample2 #> 3 cell003 sample1 sample1 sample1 #> 4 cell004 sample2 sample2 sample2 #> 5 cell005 sample2 sample2 sample2 #> 6 cell006 sample1 sample1 sample1 #> 7 cell007 sample1 sample1 sample1 #> 8 cell008 sample1 sample1 sample1 #> 9 cell009 sample1 sample1 sample1 #> 10 cell010 sample1 sample1 sample1 #> # … with 90 more rows
x <- metricsPerSample(sce, fun = "mean")
#> Calculating mean per sample.
#> # A tibble: 2 x 3 #> # Groups: sampleID [2] #> sampleID sampleName interestingGroups #> <fct> <fct> <fct> #> 1 sample1 sample1 sample1 #> 2 sample2 sample2 sample2