rm_outlierf: Set to FALSE any outlier species greater than f fractional...

Description Usage Arguments Value See Also Examples

View source: R/transform_filter-methods.R

Description

This is for removing overly-abundant outlier taxa, not for trimming low-abundance taxa.

Usage

1
rm_outlierf(f, na.rm=TRUE)

Arguments

f

Single numeric value between 0 and 1. The maximum fractional abundance value that a taxa will be allowed to have in a sample without being marked for trimming.

na.rm

Logical. Should we remove NA values. Default TRUE.

Value

A function (enclosure), suitable for filterfun_sample.

See Also

topk, topf, topp, rm_outlierf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
t1 <- 1:10; names(t1)<-paste("t", 1:10, sep="")
rm_outlierf(0.15)(t1)
## Use simulated abundance matrix
set.seed(711)
testOTU <- otu_table(matrix(sample(1:50, 25, replace=TRUE), 5, 5), taxa_are_rows=FALSE)
taxa_sums(testOTU)
f1  <- filterfun_sample(rm_outlierf(0.1))
(wh1 <- genefilter_sample(testOTU, f1, A=1))
wh2 <- c(TRUE, TRUE, TRUE, FALSE, FALSE)
prune_taxa(wh1, testOTU)
prune_taxa(wh2, testOTU) 

Example output

   t1    t2    t3    t4    t5    t6    t7    t8    t9   t10 
 TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE FALSE 
sp1 sp2 sp3 sp4 sp5 
109  89 178 207  64 
  sp1   sp2   sp3   sp4   sp5 
FALSE  TRUE FALSE FALSE  TRUE 
OTU Table:          [2 taxa and 5 samples]
                     taxa are columns
    sp2 sp5
sa1   7  14
sa2  16  18
sa3   4  17
sa4  29   7
sa5  33   8
OTU Table:          [3 taxa and 5 samples]
                     taxa are columns
    sp1 sp2 sp3
sa1  15   7  13
sa2  22  16  31
sa3  17   4  44
sa4  32  29  42
sa5  23  33  48

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