extract: Extract or Replace Parts of an Object

extractR Documentation

Extract or Replace Parts of an Object

Description

Extract genes by row and cells by column.

Usage

## S4 method for signature 'CellRanger,ANY,ANY,ANY'
x[i, j, ..., drop = FALSE]

Arguments

x

Object.

i

Indices specifying elements to extract or replace. Indices are numeric or character vectors, empty (missing), or NULL.

For more information:

help(topic = "Extract", package = "base")
j

Indices specifying elements to extract or replace. Indices are numeric or character vectors, empty (missing), or NULL.

For more information:

help(topic = "Extract", package = "base")
...

Additional arguments.

drop

For matrices and arrays. If TRUE the result is coerced to the lowest possible dimension (see the examples). This only works for extracting elements, not for the replacement. See drop for further details.

Details

Refer to cellToSample() and selectSamples() if sample-level extraction is desired. Note that sampleId is slotted into colData() and defines the cell-to-sample mappings.

Unfiltered cellular barcode distributions for the entire dataset, including cells not kept in the matrix will be dropped in favor of the nCount column of colData.

Value

CellRanger.

Note

Updated 2023-09-25.

Author(s)

Michael Steinbaugh

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

Examples

data(pbmc_v3)

## CellRanger ====
object <- pbmc_v3

cells <- head(colnames(object), 100L)
head(cells)
genes <- head(rownames(object), 100L)
head(genes)

## Subset by cell identifiers.
object[, cells]

## Subset by genes.
object[genes, ]

## Subset by both genes and cells.
object[genes, cells]

steinbaugh/Chromium documentation built on Oct. 13, 2023, 4:17 p.m.