To make a transition from phyloseq easier, the subsetSamples and subsetFeatures functions are implemented. To avoid name clashes they are named differently.

subsetSamples(x, ...)

subsetFeatures(x, ...)

subsetTaxa(x, ...)

# S4 method for SummarizedExperiment
subsetSamples(x, ...)

# S4 method for SummarizedExperiment
subsetFeatures(x, ...)

# S4 method for SummarizedExperiment
subsetTaxa(x, ...)

Arguments

x

a SummarizedExperiment object

...

See subset. drop is not supported.

Value

A subset of x

Details

However, the use of these functions is discouraged since subsetting using [ works on both dimension at the same time, is more flexible and is used throughout R to subset data with two or more dimension. Therefore, these functions will be removed in Bioconductor release 3.15 (April, 2022).

Examples

data(GlobalPatterns)
subsetSamples(GlobalPatterns, colData(GlobalPatterns)$SampleType == "Soil")
#> Warning: subsetSamples is deprecated. Please use '[]' for subsetting instead.
#> class: TreeSummarizedExperiment 
#> dim: 19216 3 
#> metadata(0):
#> assays(1): counts
#> rownames(19216): 549322 522457 ... 200359 271582
#> rowData names(7): Kingdom Phylum ... Genus Species
#> colnames(3): CL3 CC1 SV1
#> colData names(7): X.SampleID Primer ... SampleType Description
#> reducedDimNames(0):
#> mainExpName: NULL
#> altExpNames(0):
#> rowLinks: a LinkDataFrame (19216 rows)
#> rowTree: 1 phylo tree(s) (19216 leaves)
#> colLinks: NULL
#> colTree: NULL
# Vector that is used to specify subset must not include NAs 
subsetFeatures(GlobalPatterns, rowData(GlobalPatterns)$Phylum == "Actinobacteria" & 
               !is.na(rowData(GlobalPatterns)$Phylum))
#> Warning: subsetFeatures is deprecated. Please use '[]' for subsetting instead.
#> class: TreeSummarizedExperiment 
#> dim: 1631 26 
#> metadata(0):
#> assays(1): counts
#> rownames(1631): 368907 12724 ... 308664 535482
#> rowData names(7): Kingdom Phylum ... Genus Species
#> colnames(26): CL3 CC1 ... Even2 Even3
#> colData names(7): X.SampleID Primer ... SampleType Description
#> reducedDimNames(0):
#> mainExpName: NULL
#> altExpNames(0):
#> rowLinks: a LinkDataFrame (1631 rows)
#> rowTree: 1 phylo tree(s) (19216 leaves)
#> colLinks: NULL
#> colTree: NULL