expanded_tree_from_jplace: Place queries on a tree from a jplace file.

View source: R/expanded_tree_from_jplace.r

expanded_tree_from_jplaceR Documentation

Place queries on a tree from a jplace file.

Description

Given a jplace file (e.g., as generated by pplacer or EPA-NG), construct an expanded tree consisting of the original reference tree and additional tips representing the placed query sequences. The reference tree and placements are loaded from the jplace file. If multiple placements are listed for a query, this function can either add the best (maximum-likelihood) placement or all listed placements.

Usage

expanded_tree_from_jplace(file_path,
                          only_best_placements  = TRUE,
                          max_names_per_query   = 1)

Arguments

file_path

Character, the path to the input jplace file.

only_best_placements

Logical, only keep the best placement of each query, i.e., the placement with maximum likelihood.

max_names_per_query

Positive integer, maximum number of sequence names to keep from each query. Only relevant if queries in the jplace file include multiple sequence names (these typically represent identical sequences). If greater than 1, and a query includes multiple sequence names, then each of these sequence names will be added as a tip to the tree.

Details

This function assumes version 3 of the jplace file format, as defined by Matsen et al. (2012).

Value

A named list with the following elements:

tree

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

placed_tips

Integer vector, specifying which tips in the returned tree correspond to placements.

reference_tree

Object of class "phylo", the original reference tree loaded from the jplace file. This will be a subtree of tree.

Author(s)

Stilianos Louca

References

Frederick A. Matsen et al. (2012). A format for phylogenetic placements. PLOS One. 7:e31009

See Also

place_tips_taxonomically

Examples

## Not run: 
# load jplace file and create expanded tree
J = expanded_tree_from_jplace("epa_ng_output.jplace")

# save the reference and expanded tree as Newick files
write_tree(J$reference_tree, file="reference.tre")
write_tree(J$tree, file="expanded.tre")

## End(Not run)

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