genefilter_sample-methods: Filter OTUs with arbitrary function, sample-wise.

Description Usage Arguments Value See Also Examples

Description

A general OTU trimming function for selecting OTUs that satisfy some criteria within the distribution of each sample, and then also an additional criteria for number of samples that must pass. This is a genefilter-like function that only considers sample-wise criteria. The number of acceptable samples is used as the final criteria (set by the argument A) to determine whether or not the taxa should be retained (TRUE) or not (FALSE). Just like with genefilter, a logical having length equal to nrow()/ntaxa is returned, indicating which should be kept. This output can be provided directly to OTU trimming function, prune_taxa. By contrast, genefilter, of the genefilter package in Bioconductor, works only on the rows of a matrix. Note that, because otu_table-class inherits directly from the matrix-class, an unmodified otu_table can be provided to genefilter, but be mindful of the orientation of the otu_table (use taxa_are_rows), and transpose (t) if needed.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
genefilter_sample(X, flist, A=1)

## S4 method for signature 'matrix'
genefilter_sample(X, flist, A = 1)

## S4 method for signature 'otu_table'
genefilter_sample(X, flist, A = 1)

## S4 method for signature 'phyloseq'
genefilter_sample(X, flist, A = 1)

Arguments

X

The object that needs trimming. Can be matrix, otu_table, or higher- order phyloseq classes that contain an otu_table.

flist

An enclosure object, typically created with filterfun_sample

A

An integer. The number of samples in which a taxa / OTUs passed the filter for it to be labeled TRUE in the output logical vector.

Value

A logical vector with names equal to taxa_names (or rownames, if matrix).

See Also

genefilter, filterfun_sample, t, prune_taxa

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#
## testOTU <- otu_table(matrix(sample(1:50, 25, replace=TRUE), 5, 5), taxa_are_rows=FALSE)
## f1  <- filterfun_sample(topk(2))
## wh1 <- genefilter_sample(testOTU, f1, A=2)
## wh2 <- c(TRUE, TRUE, TRUE, FALSE, FALSE)
## prune_taxa(wh1, testOTU)
## prune_taxa(wh2, testOTU)
## 
## tax_table1 <- tax_table(matrix("abc", 5, 5))
## prune_taxa(wh1, tax_table1)
## prune_taxa(wh2, tax_table1)

Example output



phyloseq documentation built on Nov. 8, 2020, 6:41 p.m.