place_tips_taxonomically: Place queries on a tree based on taxonomic identities.

View source: R/place_tips_taxonomically.R

place_tips_taxonomicallyR Documentation

Place queries on a tree based on taxonomic identities.

Description

Given a rooted tree with associated tip & node taxonomies, as well as a list of query taxonomies, place the queries on nodes of the tree based on taxonomic identity. Each query is placed at the deepest possible node (furthest from the root in terms of splits) for which it is certain that the query is a descendant of.

Usage

place_tips_taxonomically( tree,
                          query_labels,
                          query_taxonomies      = NULL,
                          tip_taxonomies        = NULL,
                          node_taxonomies       = NULL,
                          tree_taxon_delimiter  = ";",
                          query_taxon_delimiter = ";",
                          include_expanded_tree = TRUE)

Arguments

tree

Rooted tree of class "phylo".

query_labels

Character vector of length Nqueries, listing labels for the newly placed tips.

query_taxonomies

Optional character vector of length Nqueries, listing the taxonomic paths of the queries. If NULL, it is assumed that query_labels are taxonomies.

tip_taxonomies

Optional character vector of length Ntips, listing taxonomic paths for the tree's tips. If NULL, then tip labels are assumed to be tip taxonomies.

node_taxonomies

Optional character vector of length Nnodes, listing taxonomic paths for the tree's nodes. If NULL, then node labels are assumed to be node taxonomies.

tree_taxon_delimiter

Character, the delimiter between taxonomic levels in the tree's tip & node taxonomies (e.g., ";" for SILVA taxonomies).

query_taxon_delimiter

Character, the delimiter between taxonomic levels in query_taxonomies.

include_expanded_tree

If TRUE, the expanded tree (i.e., including the placements) is returned as well, at some computational cost. If FALSE, only the placement info is returned, but no tree expansion is done.

Details

This function assumes that the tip & node taxonomies are somewhat consistent with each other and with the tree's topology.

Value

A named list with the following elements:

placement_nodes

Integer vector of length Nqueries, with values in 1,..,Nnodes, specifying for each query the node on which it was placed. For queries that could not be placed on the tree, the value 0 is used.

If include_expanded_tree was TRUE, the following additional elements are included:

tree

Object of class "phylo", the extended tree constructed by adding the placements on the original tree.

placed_tips

Integer vector of length Nqueries, specifying which tips in the returned tree correspond to placements. For queries that could not be placed on the tree, the value 0 is used.

Author(s)

Stilianos Louca

See Also

expanded_tree_from_jplace


castor documentation built on June 29, 2024, 9:08 a.m.