Skip to contents

Extract genes by row and cells by column.

Usage

# S4 method for bcbioSingleCell,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.

Value

bcbioSingleCell.

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().

Note

Updated 2021-09-10.

References

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

Author

Michael Steinbaugh

Examples

## bcbioSingleCell ====
data(bcb)

cells <- head(colnames(bcb))
head(cells)
#> [1] "AAACACTA_CTTCGATT" "AAACTACA_CCACATTA" "AACTGCCT_GCAAGGAC"
#> [4] "AAGAAGGT_TCTGTGGT" "AAGCCTTC_TAAATAGG" "AATAAGGA_CCACATTA"
genes <- head(rownames(bcb))
head(genes)
#> [1] "ENSG00000071082" "ENSG00000100316" "ENSG00000106631" "ENSG00000108821"
#> [5] "ENSG00000112306" "ENSG00000115414"

## Subset by cell identifiers.
bcb[, cells]
#> bcbioSingleCell 0.7.0
#> uploadDir: /Users/mike/git/monorepo/r-packages/bcbioSingleCell/inst/extdata/indrops
#> dates(2): 2018-01-01 2023-10-05
#> level: genes
#> sampleMetadataFile: ../inst/extdata/indrops/metadata.csv
#> organism: Homo sapiens
#> ensemblRelease: 90
#> interestingGroups: sampleName
#> filtered: FALSE
#> class: SingleCellExperiment 
#> dim: 50 6 
#> metadata(27): allSamples bcbioCommandsLog ... yaml subset
#> assays(1): counts
#> rownames(50): ENSG00000071082 ENSG00000100316 ... ENSG00000269028
#>   ENSG00000282105
#> rowData names(9): broadClass description ... ncbiGeneId seqCoordSystem
#> colnames(6): AAACACTA_CTTCGATT AAACTACA_CCACATTA ... AAGCCTTC_TAAATAGG
#>   AATAAGGA_CCACATTA
#> colData names(15): aggregate description ... sampleName sequence
#> reducedDimNames(0):
#> mainExpName: NULL
#> altExpNames(0):

## Subset by genes.
bcb[genes, ]
#> bcbioSingleCell 0.7.0
#> uploadDir: /Users/mike/git/monorepo/r-packages/bcbioSingleCell/inst/extdata/indrops
#> dates(2): 2018-01-01 2023-10-05
#> level: genes
#> sampleMetadataFile: ../inst/extdata/indrops/metadata.csv
#> organism: Homo sapiens
#> ensemblRelease: 90
#> interestingGroups: sampleName
#> filtered: FALSE
#> class: SingleCellExperiment 
#> dim: 6 100 
#> metadata(27): allSamples bcbioCommandsLog ... yaml subset
#> assays(1): counts
#> rownames(6): ENSG00000071082 ENSG00000100316 ... ENSG00000112306
#>   ENSG00000115414
#> rowData names(9): broadClass description ... ncbiGeneId seqCoordSystem
#> colnames(100): AAACACTA_CTTCGATT AAACTACA_CCACATTA ...
#>   TGGGAATT_ATATAGGA TGTTATCA_ACGCAGAG
#> colData names(15): aggregate description ... sampleName sequence
#> reducedDimNames(0):
#> mainExpName: NULL
#> altExpNames(0):

## Subset by both genes and cells.
bcb[genes, cells]
#> bcbioSingleCell 0.7.0
#> uploadDir: /Users/mike/git/monorepo/r-packages/bcbioSingleCell/inst/extdata/indrops
#> dates(2): 2018-01-01 2023-10-05
#> level: genes
#> sampleMetadataFile: ../inst/extdata/indrops/metadata.csv
#> organism: Homo sapiens
#> ensemblRelease: 90
#> interestingGroups: sampleName
#> filtered: FALSE
#> class: SingleCellExperiment 
#> dim: 6 6 
#> metadata(27): allSamples bcbioCommandsLog ... yaml subset
#> assays(1): counts
#> rownames(6): ENSG00000071082 ENSG00000100316 ... ENSG00000112306
#>   ENSG00000115414
#> rowData names(9): broadClass description ... ncbiGeneId seqCoordSystem
#> colnames(6): AAACACTA_CTTCGATT AAACTACA_CCACATTA ... AAGCCTTC_TAAATAGG
#>   AATAAGGA_CCACATTA
#> colData names(15): aggregate description ... sampleName sequence
#> reducedDimNames(0):
#> mainExpName: NULL
#> altExpNames(0):