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"),
  return = c("tbl_df", "DataFrame")
)

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

Object of class determined by return argument.

Details

metrics() takes data stored in colData() and consistently returns a tbl_df or DataFrame with 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.

Functions

  • metrics,SummarizedExperiment-method: Sample-level metrics.

  • metrics,SingleCellExperiment-method: Cell-level metrics.

  • metricsPerSample,SingleCellExperiment-method: Sample-level metrics.

Note

These functions will error intentionally if no numeric columns are defined in colData().

Updated 2020-01-20.

Author

Michael Steinbaugh, Rory Kirchner

Examples

data( RangedSummarizedExperiment, SingleCellExperiment, package = "AcidTest" ) ## SummarizedExperiment ==== object <- RangedSummarizedExperiment object <- calculateMetrics(object)
#> → Calculating 12 sample metrics.
#> 496 coding features detected.
#> 0 mitochondrial features detected.
x <- metrics(object) print(x)
#> # A tibble: 12 x 10 #> sampleID condition nCount nFeature nCoding nMito #> <chr> <fct> <int> <int> <int> <int> #> 1 sample01 A 20880 443 20721 NA #> 2 sample02 A 22628 454 22484 NA #> 3 sample03 A 21473 439 21242 NA #> 4 sample04 A 21704 456 21504 NA #> 5 sample05 A 22963 453 22858 NA #> 6 sample06 A 22679 456 22516 NA #> 7 sample07 B 27369 443 27211 NA #> 8 sample08 B 28830 441 28614 NA #> 9 sample09 B 28040 436 27877 NA #> 10 sample10 B 28829 447 28626 NA #> 11 sample11 B 28508 448 28340 NA #> 12 sample12 B 29765 447 29523 NA #> # … with 4 more variables: #> # log10FeaturesPerCount <dbl>, mitoRatio <dbl>, #> # sampleName <fct>, interestingGroups <fct>
## SingleCellExperiment ==== object <- SingleCellExperiment object <- calculateMetrics(object)
#> → Calculating 100 sample metrics.
#> 496 coding features detected.
#> 0 mitochondrial features detected.
x <- metrics(object) print(x)
#> # A tibble: 100 x 10 #> cellID sampleID nCount nFeature nCoding nMito #> <chr> <fct> <int> <int> <int> <int> #> 1 cell0… sample1 46839 245 46748 NA #> 2 cell0… sample2 71187 274 71090 NA #> 3 cell0… sample1 74599 270 74472 NA #> 4 cell0… sample1 60845 265 60765 NA #> 5 cell0… sample1 62201 245 62098 NA #> 6 cell0… sample2 48714 259 48620 NA #> 7 cell0… sample2 43630 228 43570 NA #> 8 cell0… sample1 49508 255 49410 NA #> 9 cell0… sample1 55399 250 55318 NA #> 10 cell0… sample2 65374 287 65245 NA #> # … with 90 more rows, and 4 more variables: #> # log10FeaturesPerCount <dbl>, mitoRatio <dbl>, #> # sampleName <fct>, interestingGroups <fct>
x <- metricsPerSample(object, fun = "mean")
#> → Calculating mean per sample.
print(x)
#> # A tibble: 2 x 9 #> sampleID sampleName interestingGrou… nCount #> <chr> <fct> <fct> <dbl> #> 1 sample1 sample1 sample1 60587. #> 2 sample2 sample2 sample2 54304. #> # … with 5 more variables: nFeature <dbl>, #> # nCoding <dbl>, nMito <dbl>, #> # log10FeaturesPerCount <dbl>, mitoRatio <dbl>