selectSamples: Select samples

selectSamplesR Documentation

Select samples

Description

Utility function that enables quick and easy sample selection.

Usage

selectSamples(object, ...)

## S4 method for signature 'SingleCellExperiment'
selectSamples(object, ...)

Arguments

object

Object.

...

Selection arguments:

  • Key value pairs that must map to the column names of sampleData().

  • atomic values are supported.

  • Avoid using logical or numeric indices (e.g. which() return), thereby making your code more human readable, and easier to interpret.

Details

Internally, pattern matching against sample and file names is applied using logical grep matching.

Value

Modified object. Subset (extraction) containing the desired samples.

Intended usage

This function is intended to be used for sample extraction from Bioconductor container classes where the column names don't correspond to samples (e.g. SingleCellExperiment).

Bracket-based subsetting

Bracket-based subsetting with [ also works on SingleCellExperiment objects but it's not intuitive. In this case, provide cellular barcode identifiers for columns and gene identifiers for rows.

Note

Updated 2022-03-02.

See Also

  • sampleData().

  • split().

Examples

data(SingleCellExperiment_splatter, package = "AcidTest")

## SingleCellExperiment ====
object <- SingleCellExperiment_splatter
sample <- Biobase::sampleNames(object)[[1L]]
print(sample)
subset <- selectSamples(object, sampleName = sample)
print(subset)

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