Data.filter: A Data Filter

Description Usage Arguments Value Examples

View source: R/Data.filter.R

Description

This function creates a new dataset from an existing one by ordering taxa in order of decreasing abundance, collapsing less-abundant taxa into one category as specified by the user and excluding samples with a total number of reads fewer than the user-specified value.

Usage

1
2
	Data.filter(data, order.type = "data", minReads = 0, numTaxa = NULL, 
		perTaxa = NULL)

Arguments

data

A matrix of taxonomic counts(columns) for each sample(rows).

order.type

If "sample": Rank taxa based on its taxonomic frequency.
If "data": Rank taxa based on cumulative taxonomic counts across all samples (default).

minReads

Samples with a total number of reads less than read.crit value will be deleted.

numTaxa

The number of taxa to keep, while collapsing the other (less abundant) taxa. Only one argument, numTaxa or perTaxa should be specified.

perTaxa

The combined percentage of data to keep, while collapsing the remaining taxa. Only one argument, numTaxa or perTaxa should be specified.

Value

A data frame of taxa and samples with a total number of reads greater than the minimum value. The last taxon labeled 'Other' contains the sum of the least abundant taxa collapsed by setting 'numTaxa' or 'perTaxa'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
	data(saliva) 
	
	### Excludes all samples with fewer than 1000 reads and collapses
	### taxa with 11th or smaller abundance into one category 
	filterDataNum <- Data.filter(saliva, "data", 1000, numTaxa=10) 
	
	### Excludes all samples with fewer than 1000 reads and collapses
	### the least abundant taxa to keep as close to 95% of the data as
	### possible
	filterDataPer <- Data.filter(saliva, "data", 1000, perTaxa=.95) 
	
	dim(saliva)
	dim(filterDataNum)
	dim(filterDataPer)

HMP documentation built on Aug. 31, 2019, 5:05 p.m.