Extract genes by row and samples by column.

# S4 method for DESeqAnalysis,ANY,ANY,ANY
[(x, i, j, drop = FALSE)

## Arguments

x object from which to extract element(s) or in which to replace element(s). indices specifying elements to extract or replace. Indices are numeric or character vectors or empty (missing) or NULL. Numeric values are coerced to integer as by as.integer (and hence truncated towards zero). Character vectors will be matched to the names of the object (or for matrices/arrays, the dimnames): see ‘Character indices’ below for further details. For [-indexing only: i, j, ... can be logical vectors, indicating elements/slices to select. Such vectors are recycled if necessary to match the corresponding extent. i, j, ... can also be negative integers, indicating elements/slices to leave out of the selection. When indexing arrays by [ a single argument i can be a matrix with as many columns as there are dimensions of x; the result is then a vector with elements corresponding to the sets of indices in each row of i. An index value of NULL is treated as if it were integer(0). indices specifying elements to extract or replace. Indices are numeric or character vectors or empty (missing) or NULL. Numeric values are coerced to integer as by as.integer (and hence truncated towards zero). Character vectors will be matched to the names of the object (or for matrices/arrays, the dimnames): see ‘Character indices’ below for further details. For [-indexing only: i, j, ... can be logical vectors, indicating elements/slices to select. Such vectors are recycled if necessary to match the corresponding extent. i, j, ... can also be negative integers, indicating elements/slices to leave out of the selection. When indexing arrays by [ a single argument i can be a matrix with as many columns as there are dimensions of x; the result is then a vector with elements corresponding to the sets of indices in each row of i. An index value of NULL is treated as if it were integer(0). 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

DESeqAnalysis.

## Note

Updated 2020-10-28.

## 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)
#> [1] "gene001" "gene002" "gene003" "gene004" "gene005" "gene006"samples <- head(colnames(object), 2L)
#> [1] "sample01" "sample02"
x <- object[genes, samples]
print(x)
#> DESeqAnalysis 0.2.18; DESeq2 1.26.0
#> data:
#>   dim: 50 2
#>   metadata(3): version date interestingGroups
#>   assays(4): counts mu H cooks
#>   rownames(50): gene001 gene002 ... gene049 gene050
#>   rowData names(38): broadClass description ... deviance maxCooks
#>   colnames(2): sample01 sample02
#>   colData names(3): condition treatment sizeFactor
#> transformType: varianceStabilizingTransformation
#> resultsNames(2): condition_B_vs_A treatment_D_vs_C
#> alphaThreshold: 0.01
#> lfcShrinkType: apeglm