phylotax: Assign taxon labels to nodes in a tree when there is a...

Description Usage Arguments Value Distinguishing different primary methods

View source: R/phylotax.R

Description

Assign taxon labels to nodes in a tree when there is a consensus of IDs on descendant tips.

Usage

1
2
3
4
5
6
7
8
phylotax(
  tree = NULL,
  taxa,
  ranks = NULL,
  method = if (utils::hasName(taxa, "method")) "PHYLOTAX" else NULL,
  cons_method = method,
  fallback = TRUE
)

Arguments

tree

(ape::phylo() object) A tree including the taxa to be classified. The tip labels should match the "label" column in taxa. If no tree is given, a star tree will be used, which results in each tip being assigned to the strict consensus of its primary assignments, if any.

taxa

(data.frame) Taxon assignments for the taxa on the tree, as returned by taxtable(). Should have columns "label", "rank", and "taxon", but may have other columns as well; see the method argument. Multiple assignments for each label are allowed, and can be generated by using rbind() or dplyr::bind_rows() on results from multiple calls to taxonomy() and taxtable().

ranks

(character) names of ranks used in the taxon assignments, from most to least inclusive. This can be omitted if the "rank" column of "taxa" is an integer or ordered factor, in which case the smallest value is the most inclusive rank, or alternatively if the "rank" column of "taxa" is a character or factor with values/levels from the set rootrank, domain, kingdom, phylum, class, order, family, genus, species.

method

(a single character string, or a named character vector) how to identify different methods. See details.

cons_method

(a single character string, or a named character vector) how to identify different methods for the fallback consensus. See details.

fallback

(logical) If TRUE, use lca_consensus() for tips which do not have a tree (which may be all of the tips, if no tree is given).

Value

an S3 object with class "phylotax", with five elements:

Distinguishing different primary methods

Primary methods can be distinguished in three ways:

  1. Not at all. For this option, taxa should not have a column named "method", and the the method argument to phylotax() should be NULL.

  2. A single column named "method" in taxa. If method=NULL but taxa has a "method" column, then this column is assumed to uniquely identify the methods. Assignments made by phylotax() will have "PHYLOTAX" in the method column. This value can be changed by setting the method argument to an unnamed character string, e.g., "method = 'consensus'".

  3. Custom columns. If the method argument is a named character vector, then the names are taken to be columns in taxa (which must exist) and the values are taken to be the values for each column which should be used for PHYLOTAX annotations, e.g., "method = c(algorithm = "PHYLOTAX", region = "ITS2")". PHYLOTAX will treat each unique combination of values in these columns as a distinct method.


brendanf/phylotax documentation built on March 3, 2021, 2:21 p.m.