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.

Methods (by class)

  • SummarizedExperiment: Sample-level metrics.

  • SingleCellExperiment: Cell-level metrics.

  • SingleCellExperiment: Sample-level metrics.

Note

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

Updated 2019-08-18.

Examples

data( RangedSummarizedExperiment, SingleCellExperiment, package = "acidtest" ) ## SummarizedExperiment ==== object <- RangedSummarizedExperiment object <- calculateMetrics(object)
#> Calculating 12 sample metrics.
#> 497 coding features detected.
#> 0 mitochondrial features detected.
x <- metrics(object) print(x)
#> # A tibble: 12 x 10 #> sampleID condition nCount nFeature nCoding nMito log10FeaturesPe… mitoRatio #> <chr> <fct> <int> <int> <int> <int> <dbl> <dbl> #> 1 sample01 A 22553 460 22287 NA 0.612 NA #> 2 sample02 A 21764 456 21605 NA 0.613 NA #> 3 sample03 A 21736 456 21554 NA 0.613 NA #> 4 sample04 A 22659 455 22467 NA 0.610 NA #> 5 sample05 A 22610 454 22460 NA 0.610 NA #> 6 sample06 A 21398 454 21080 NA 0.614 NA #> 7 sample07 B 29115 442 28905 NA 0.593 NA #> 8 sample08 B 28394 447 28152 NA 0.595 NA #> 9 sample09 B 26967 442 26756 NA 0.597 NA #> 10 sample10 B 28500 443 28212 NA 0.594 NA #> 11 sample11 B 28602 445 28392 NA 0.594 NA #> 12 sample12 B 28519 444 28253 NA 0.594 NA #> # … with 2 more variables: sampleName <fct>, interestingGroups <fct>
## SingleCellExperiment ==== object <- SingleCellExperiment object <- calculateMetrics(object)
#> Calculating 100 sample metrics.
#> 497 coding features detected.
#> 0 mitochondrial features detected.
x <- metrics(object) print(x)
#> # A tibble: 100 x 10 #> cellID sampleID nCount nFeature nCoding nMito log10FeaturesPe… mitoRatio #> <chr> <fct> <int> <int> <int> <int> <dbl> <dbl> #> 1 cell0… sample1 61091 264 60207 NA 0.506 NA #> 2 cell0… sample2 52953 270 52256 NA 0.515 NA #> 3 cell0… sample2 37985 242 37460 NA 0.521 NA #> 4 cell0… sample2 58957 276 58226 NA 0.512 NA #> 5 cell0… sample1 93296 286 91488 NA 0.494 NA #> 6 cell0… sample1 57158 257 56407 NA 0.507 NA #> 7 cell0… sample1 56084 250 55302 NA 0.505 NA #> 8 cell0… sample1 69314 301 68239 NA 0.512 NA #> 9 cell0… sample1 44619 238 44074 NA 0.511 NA #> 10 cell0… sample2 79072 291 77874 NA 0.503 NA #> # … with 90 more rows, and 2 more variables: sampleName <fct>, #> # interestingGroups <fct>
x <- metricsPerSample(object, fun = "mean")
#> Calculating mean per sample.
#> # A tibble: 2 x 9 #> sampleID sampleName interestingGrou… nCount nFeature nCoding nMito #> <chr> <fct> <fct> <dbl> <dbl> <dbl> <dbl> #> 1 sample1 sample1 sample1 57038. 261. 56141. NA #> 2 sample2 sample2 sample2 55170 260. 54230. NA #> # … with 2 more variables: log10FeaturesPerCount <dbl>, mitoRatio <dbl>