Extract genes by row and samples by column.
Arguments
- x
Object.
- i
Indices specifying elements to extract or replace. Indices are
numeric
orcharacter
vectors, empty (missing
), orNULL
.For more information:
- j
Indices specifying elements to extract or replace. Indices are
numeric
orcharacter
vectors, empty (missing
), orNULL
.For more information:
- 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. Seedrop
for further details.
References
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
Examples
data(deseq)
object <- deseq
dim(object)
#> [1] 500 12
genes <- head(rownames(object), 50L)
head(genes)
#> [1] "gene1" "gene2" "gene3" "gene4" "gene5" "gene6"
samples <- head(colnames(object), 2L)
head(samples)
#> [1] "sample1" "sample2"
x <- object[genes, samples]
print(x)
#> DESeqAnalysis 0.7.1; DESeq2 1.41.12
#> data:
#> dim: 50 2
#> metadata(1): version
#> assays(4): counts mu H cooks
#> rownames(50): gene1 gene2 ... gene49 gene50
#> rowData names(40): broadClass description ... deviance maxCooks
#> colnames(2): sample1 sample2
#> colData names(3): condition treatment sizeFactor
#> transformType: varianceStabilizingTransformation
#> resultsNames(2): condition_B_vs_A treatment_D_vs_C
#> alphaThreshold: 0.01
#> lfcShrinkType: apeglm