tax.abund: Aggregate OTU Data Based on Taxonomy

Description Usage Arguments Value Author(s) See Also Examples

Description

This function consumes OTU table(s) and (optionally) a taxonomic rank, then extracts the classification of each OTU at the given taxonomic rank, groups by classification at the given rank, removes all groups with only 0 counts, optionally removes all unclassified groups, sorts groups based on abundance, and then returns the transpose.

Usage

1
2
tax.abund(otu1, otu2=NULL, rank=NULL, drop.unclassified=FALSE,
          top=NULL, count=TRUE, mode="number")

Arguments

otu1

the first OTU table to be used.

otu2

the second OTU table to be used.

rank

a character vector representing a rank. Must be in one of three specific formats (see ?RAM.rank.formatting for help). If omitted, the function will repeat for all seven major taxonomic ranks.

drop.unclassified

logical. Determine whether or not the OTUs labelled "unclassified" or missing classification at the given taxonomic rank should be excluded.

top

the number of groups to select, starting with the most abundant. If NULL, all are selected.

count

logical. Should the actual count of each OTU be shown, or should the relative abundances be shown?

mode

a character vector, one of "percent" or "number". If number, then top many groups will be selected. If percent, then all groups with relative abundance in at least one sample above top will be selected.

Value

The value returned by this function may become nested lists, so for convenience, any nested lists have been given descriptive items names to make accessing its elements simple (see Examples).

Author(s)

Wen Chen and Joshua Simpson.

See Also

RAM.rank.formatting

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(ITS1, ITS2)
# aggregate based on phylum
ITS1.p <- tax.abund(ITS1, rank="p")
# aggregate based on all ranks; ignoring all unclassified OTUs
ITS1.taxa <- tax.abund(ITS1, drop.unclassified=FALSE)
# aggregate for one rank for both ITS1 and ITS2
lst <- tax.abund(ITS1, ITS2, rank="class")
# aggregate for all ranks for both ITS1 and ITS2
lst.all <- tax.abund(ITS1, ITS2)
stopifnot(identical(lst.all$otu1$phylum, ITS1.p))
# get the counts for all genera with relative abundance > 25%
tax.abund(ITS1, rank="g", top=25, mode="percent", count=TRUE)

Example output

Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.4-4
Loading required package: ggplot2
sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
           Fusarium unclassified_below_family Cryptococcus unidentified
P1001.1M1        21                      2619         6058         1933
P1001.1M2        41                      1950         4440          860
P1001.1M3        63                      2383         9195         2344
P1001.1M4         7                       289         1102          353
P1001.1M5       220                      2082         4792         4734
P1001.1M6        77                      1412         2643         2760
P1001.1M7       172                      3538         5936         4711
P1001.1M8       354                      2723         6532         5057
P1001.1M9      1138                      7350         3071         2059
P1001.1M10      209                      4062         1964          731
P1001.1M11     5409                      5389         1371         2848
P1001.1M12     2561                      6903          862         2434
P1001.1M13    14803                      9037          627         1070
P1001.1M14     9303                      9597          540          955
P1001.1M15    26138                      5054          323         1036
P1001.1M16    23973                      7014          569         1137

RAM documentation built on May 2, 2019, 3:04 p.m.