This function consumes an OTU table and splits its taxonomy columns into the seven major taxonomic ranks. It returns a data frame preserving all numerical data, but changing the 'taxonomy' column to the name of the appropriate rank, and preserving only the classifications at that rank.
the first OTU table to be used.
the second OTU table to be used.
the (optional) rank to split at and return (see ?RAM.rank.formatting for formatting details).
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).
otu2 is given:
rank is given: a list containing two data
frames (otu1 and otu2 split at the given rank).
rank is not given: a list containing two
lists. The first sublist represents
otu2. The sublists contain seven data
frames, which are the data split at each taxonomic rank
otu2 is not given:
rank is given: a single data frame
(otu1 split at the given rank).
rank is not given: a list containing seven
data frames (otu1 split at each taxonomic rank).
This function may seem similar to
get.rank, but they are
get.rank only returns the entries classified
at that taxonomic rank, and so some OTUs might be omitted in
the returned data frame. With
tax.split, it is guaranteed
that all OTUs will be preserved in the returned data table
(although they may be missing taxonomic classification at that
rank). If no OTUs are classified at the given rank, the taxonomy
column for that rank will be filled with empty strings.
Wen Chen and Joshua Simpson.
1 2 3 4 5 6 7 8 9 10
data(ITS1, ITS2) # split only ITS1 data at a single rank ITS1.tax.p <- tax.split(ITS1, rank="phylum") # split only ITS1 data at all ranks ITS1.tax.all <- tax.split(ITS1) # split ITS1 and IST2 data at a given rank lst <- tax.split(ITS1, ITS2, rank="c") # split ITS1 and ITS2 at every rank lst.all <- tax.split(ITS1, ITS2) stopifnot(identical(lst.all$otu1$phylum, ITS1.tax.p))