Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

prune_samples-methods

Define a subset of samples to keep in a phyloseq object.


Description

An S4 Generic method for pruning/filtering unwanted samples by defining those you want to keep.

Usage

prune_samples(samples, x)

## S4 method for signature 'character,otu_table'
prune_samples(samples, x)

## S4 method for signature 'character,sample_data'
prune_samples(samples, x)

## S4 method for signature 'character,phyloseq'
prune_samples(samples, x)

## S4 method for signature 'logical,ANY'
prune_samples(samples, x)

Arguments

samples

(Required). A character vector of the samples in object x that you want to keep – OR alternatively – a logical vector where the kept samples are TRUE, and length is equal to the number of samples in object x. If samples is a named logical, the samples retained is based on those names. Make sure they are compatible with the sample_names of the object you are modifying (x).

x

A phyloseq object.

Value

The class of the object returned by prune_samples matches the class of the phyloseq object, x.

See Also

Examples

data(GlobalPatterns)
 # Subset to just the Chlamydiae phylum.
 GP.chl <- subset_taxa(GlobalPatterns, Phylum=="Chlamydiae")
 # Remove the samples that have less than 20 total reads from Chlamydiae
 GP.chl <- prune_samples(sample_sums(GP.chl)>=20, GP.chl)
 # (p <- plot_tree(GP.chl, color="SampleType", shape="Family", label.tips="Genus", size="abundance"))

phyloseq

Handling and analysis of high-throughput microbiome census data

v1.34.0
AGPL-3
Authors
Paul J. McMurdie <joey711@gmail.com>, Susan Holmes <susan@stat.stanford.edu>, with contributions from Gregory Jordan and Scott Chamberlain
Initial release
2019-04-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.