View source: R/expanded_tree_from_jplace.r
| expanded_tree_from_jplace | R Documentation |
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.
expanded_tree_from_jplace(file_path,
only_best_placements = TRUE,
max_names_per_query = 1,
max_pendant_length = Inf,
min_like_weight_ratio = 0)
file_path |
Character, the path to the input |
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. |
max_pendant_length |
Positive numeric, optional maximum acceptable placement pendant length. Any placements exceeding this pendant length are omitted. If |
min_like_weight_ratio |
Numeric between 0 and 1, optional minimum acceptable placement likelihood weight ratio. Any placements below this threshold are omitted. If |
This function assumes version 3 of the jplace file format, as defined by Matsen et al. (2012).
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. |
pendant_lengths |
Integer vector, specifying the edge lengths leading into the placed tips. This will be synchronized with the returned vector |
loglikelihoods |
Numeric vector, specifying the placement log-likelihoods loaded from the jplace file. This will be synchronized with the returned vector |
like_weight_ratios |
Numeric vector, specifying the placement likelihood weight ratios loaded from the jplace file (Matsen et al. 2012). This will be synchronized with the returned vector |
reference_tree |
Object of class "phylo", the original reference tree loaded from the jplace file. This will be a subtree of |
reference_edges |
Integer vector, listing the edge indices in the reference tree onto which the placements were performed. This vector is synchronized with the returned |
NPfiltered |
Integer, number of placements that have been filtered out due to quality criteria such as |
Stilianos Louca
Frederick A. Matsen et al. (2012). A format for phylogenetic placements. PLOS One. 7:e31009
place_tips_taxonomically
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.