Skip to contents

Most Recent Common Ancestor for a set of nodes

Usage

tol_mrca(ott_ids = NULL, node_ids = NULL, ...)

# S3 method for class 'tol_mrca'
tax_sources(tax, ...)

# S3 method for class 'tol_mrca'
unique_name(tax, ...)

# S3 method for class 'tol_mrca'
tax_name(tax, ...)

# S3 method for class 'tol_mrca'
tax_rank(tax, ...)

# S3 method for class 'tol_mrca'
ott_id(tax, ...)

# S3 method for class 'tol_mrca'
source_list(tax, ...)

Arguments

ott_ids

Numeric vector. The ott ids for which the MRCA is desired.

node_ids

Character vector. The node ids for which the MRCA is desired.

...

additional arguments to customize the API call (see rotl for more information).

tax

an object returned by tol_mrca().

Value

An invisible list of the MRCA node properties:

  • mrca List of node properties.

    • node_id String. The canonical identifier of the node.

    • num_tips Numeric. The number of descendant tips.

    • taxon A list of taxonomic properties. Only returned if the queried node is a taxon. (If the node is not a taxon, a nearest_taxon list is returned (see below)).

      • ott_id Numeric. The OpenTree Taxonomy ID (ottID).

      • name String. The taxonomic name of the queried node.

      • unique_name String. The string that uniquely identifies the taxon in OTT.

      • rank String. The taxonomic rank of the taxon in OTT.

      • tax_sources List. A list of identifiers for taxonomic sources, such as other taxonomies, that define taxa judged equivalent to this taxon.

      The following properties list support/conflict for the node across synthesis source trees. All properties involve sourceid keys and nodeid values (see source_id_map below) Not all properties are are present for every node.

    • partial_path_of List. The edge below this synthetic tree node is compatible with the edge below each of these input tree nodes (one per tree). Each returned element is reported as sourceid:nodeid.

    • supported_by List. Input tree nodes (one per tree) that support this synthetic tree node. Each returned element is reported as sourceid:nodeid.

    • terminal List. Input tree nodes (one per tree) that are equivalent to this synthetic tree node (via an exact mapping, or the input tree terminal may be the only terminal descended from this synthetic tree node. Each returned element is reported as sourceid:nodeid.

    • conflicts_with Named list of lists. Names correspond to sourceid keys. Each list contains input tree node ids (one or more per tree) that conflict with this synthetic node.

  • nearest_taxon A list of taxonomic properties of the nearest rootward taxon node to the MRCA node. Only returned if the MRCA node is a not taxon (otherwise the taxon list above is returned).

    • ott_id Numeric. The OpenTree Taxonomy ID (ottID).

    • name String. The taxonomic name of the queried node.

    • unique_name String. The string that uniquely identifies the taxon in OTT.

    • rank String. The taxonomic rank of the taxon in OTT.

    • tax_sources List. A list of identifiers for taxonomic sources, such as other taxonomies, that define taxa judged equivalent to this taxon.

  • source_id_map Named list of lists. Names correspond to the sourceid keys used in the support/conflict properties of the mrca list above. Source trees will have the following properties:

    • git_sha The git SHA identifying a particular source version.

    • tree_id The tree id associated with the study id used.

    • study_id The study identifier. Will typically include a prefix ("pg_" or "ot_").

    The only sourceid that does not correspond to a source tree is the taxonomy, which will have the name "ott"+`taxonomy_version`, and the value is the ott_id of the taxon in that taxonomy version. "Taxonomy" will only ever appear in supported_by.

Details

Get the MRCA of a set of nodes on the current synthetic tree. Accepts any combination of node ids and ott ids as input. Returns information about the most recent common ancestor (MRCA) node as well as the most recent taxonomic ancestor (MRTA) node (the closest taxonomic node to the MRCA node in the synthetic tree; the MRCA and MRTA may be the same node). If they are the same, the taxonomic information will be in the mrca slot, otherwise they will be in the nearest_taxon slot of the list. If any of the specified nodes is not in the synthetic tree an error will be returned.

Taxonomic methods (tax_sources(), ott_id(), unique_name(), ...) are available on the objects returned by tol_mrca(). If the MRCA node is MRTA, the name of the object returned by these methods will start with ‘ott’, otherwise it will start with ‘mrca’.

Examples

if (FALSE) { # \dontrun{
birds_mrca <- tol_mrca(ott_ids=c(412129, 119214))
ott_id(birds_mrca)
tax_sources(birds_mrca)
} # }