sampleData: Sample data

sampleDataR Documentation

Sample data

Description

Metadata that describes the samples.

Usage

sampleData(object, ...)

sampleData(object, ...) <- value

## S4 method for signature 'SingleCellExperiment'
sampleData(
  object,
  clean = TRUE,
  ignoreCols = c("^description$", "^genomeBuild$", "^qualityFormat$", "^samRef$"),
  denylistCols = c("^ident$", "^g2mScore$", "^sScore$", "^phase$", "^oldIdent$",
    "^origIdent$", "^res[0-9]+")
)

## S4 replacement method for signature 'SingleCellExperiment,DFrame'
sampleData(object) <- value

Arguments

object

Object.

clean

logical(1). Only return factor columns. Useful when working with objects that contain quality control metrics in colData(). For example, bcbioRNASeq and DESeqDataSet objects often contain additional columns that aren't informative sample metadata.

ignoreCols

character or NULL. Only applies when clean = TRUE. Additional factor columns defined in colData to be ignored as sample-level metadata. Particularly useful for SingleCellExperiment objects, where cell-to-sample mappings are defined using the sampleId column.

denylistCols

character or NULL. Column names that should not be treated as sample-level metadata. Currently applicable only to SingleCellExperiment objects, which have cell-level columns that can be difficult to distinguish, especially when processed using Seurat, scater, etc.

value

Value to assign.

...

Additional arguments.

Details

This is a complement to the standard colData() function, but improves support for accessing sample metadata for datasets where multiple items in the columns map to a single sample (e.g. cells for a single-cell RNA-seq experiment).

Value

DataFrame.

SingleCellExperiment

Recommended colData:

  • sampleId: factor defining cell-to-sample mappings. These mappings should use syntactically valid names. Note that this is not currently required as we're supporting SingleCellExperiment objects from 1 sample, but it's required for working with multiple samples in a single object.

Note

Updated 2023-03-27.

Examples

data(SingleCellExperiment_splatter, package = "AcidTest")

## SingleCellExperiment ====
object <- SingleCellExperiment_splatter
sampleData(object)

## Assignment support.
sampleData(object)[["batch"]] <- 1L
## `batch` column should be now defined.
sampleData(object)

acidgenomics/r-acidsinglecell documentation built on March 30, 2024, 5:39 a.m.