Relative Content

Tag Archive for rtree

How to Truncate a data.tree Tree in R to a Specific Level

I’m working with a tree structure in R using the data.tree package. I want to truncate the tree to a specific level, keeping only the nodes up to that level and removing all deeper levels. For example, if I have a tree with 4 levels (root, children, grandchildren, great-grandchildren), I want to truncate it to level 2, keeping only the root, children, and grandchildren.

Annotating phylogenetic trees

I realize this might be niche–and the current stuff out there that is tree specific don’t apply in my case.
Trying to annotate the branches of a phylogenetic tree. So these are amino acid sequences. I want the branches to have what are the specific amino acid changes relative to the first sequence in the alignment (also imported). When I check the annotations, the positions are correct, the specific mutations (non-synonymous) not so much. But it is between my “step 7” and “step 8” that things go south. Here is the current script with the specific error when run:

Difficulty in Obtaining Final Leaves from data.tree Package in R

I am currently working with the data.tree package in R to create hierarchical trees. However, I am facing challenges in obtaining the final leaves (terminal nodes) from the tree. Despite following the package documentation, I am unable to retrieve the desired results.