lca_consensus: Last common ancestor consensus

Description Usage Arguments Value Distinguishing different primary methods

Description

This is an alternative to phylotax() which does not require a phylogenetic tree. Instead, multiple assignments are resolved by strict consensus at each rank in turn. For eaxample, if for a particular sequence all available assignments at the kingdom, phylum, and class agree, but there is disagreement at the order level, then the consensus assignment takes the kingdom, phylum, and class assignments to be correct, but does not include any assignment at the order level or below.

Usage

1
2
3
4
5
lca_consensus(
  taxa,
  ranks = NULL,
  method = if (utils::hasName(taxa, "method")) "consensus" else NULL
)

Arguments

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.

Value

A phylotax object.

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 lca_consensus() 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 lca_consensus() will have "consensus" in the method column. This value can be changed by setting the method argument to an unnamed character string, e.g., "method = 'cons'".

  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 consensus annotations, e.g., "method = c(algorithm = "consensus", region = "ITS2")". Each unique combination of values in these columns is treated as a distinct method.


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