Metadata that describes the samples.
Usage
sampleData(object, ...)
sampleData(object, ...) <- value
# S4 method for SummarizedExperiment
sampleData(
object,
clean = TRUE,
ignoreCols = c("^description$", "^genomeBuild$", "^qualityFormat$", "^samRef$")
)
# S4 method for SummarizedExperiment,DFrame
sampleData(object) <- value
# S4 method for SummarizedExperiment
sampleNames(object)
Arguments
- object
Object.
- clean
logical(1)
. Only returnfactor
columns. Useful when working with objects that contain quality control metrics incolData()
. For example,bcbioRNASeq
andDESeqDataSet
objects often contain additional columns that aren't informative sample metadata.- ignoreCols
character
orNULL
. Only applies whenclean = TRUE
. Additional factor columns defined incolData
to be ignored as sample-level metadata. Particularly useful forSingleCellExperiment
objects, where cell-to-sample mappings are defined using thesampleId
column.- value
Value to assign.
- ...
Additional arguments.
Details
All columns defined in colData
of the object must be named in strict
lower camel case, otherwise this function will intentionally error.
All supported S4 classes
Illegal colData
:
interestingGroups
: Generated automatically, based on the criteria slotted into the object usinginterestingGroups()
. The function will error intentionally if this column is manually defined incolData()
.
Recommended colData
:
sampleName
: Human readable sample names used by basejump plotting functions in favor of object column names, which should be syntactically valid (but not always very readable). Seemake.names()
for more information on syntactically valid names. Note that if this column is not defined in the object, it will be returned automatically bysampleData()
.
SummarizedExperiment
Required colData
:
None.
Illegal colData
:
sampleId
: Redundant; already defined in the object column names.
Examples
data(RangedSummarizedExperiment, package = "AcidTest")
## SummarizedExperiment ====
object <- RangedSummarizedExperiment
sampleData(object)
#> DataFrame with 12 rows and 3 columns
#> condition sampleName interestingGroups
#> <factor> <factor> <factor>
#> sample01 A sample01 A
#> sample02 A sample02 A
#> sample03 A sample03 A
#> sample04 A sample04 A
#> sample05 A sample05 A
#> ... ... ... ...
#> sample08 B sample08 B
#> sample09 B sample09 B
#> sample10 B sample10 B
#> sample11 B sample11 B
#> sample12 B sample12 B
## Assignment support.
sampleData(object)[["batch"]] <- 1L
## `batch` column should be now defined.
sampleData(object)
#> DataFrame with 12 rows and 3 columns
#> condition sampleName interestingGroups
#> <factor> <factor> <factor>
#> sample01 A sample01 A
#> sample02 A sample02 A
#> sample03 A sample03 A
#> sample04 A sample04 A
#> sample05 A sample05 A
#> ... ... ... ...
#> sample08 B sample08 B
#> sample09 B sample09 B
#> sample10 B sample10 B
#> sample11 B sample11 B
#> sample12 B sample12 B