PRUNE by metadata

PRUNE by metadata

Introduction

The function of the PRUNE template is to select branches. The PRUNE template belongs to the “Tree structure” class (refer to the Class for detail information).

Generally, users can select one branch or all branches within a node by entering the branch or node name. The selected branch will be included in the new phylogenetic tree, while the unselected branch will be excluded. This function is the only template function that changes the number of branches.

This section shows how to select branches in itol.toolkit. The process is very simple, and the main difficulty is that the user needs to determine which branches to be filtered. Without itol.toolkit, users have to perform data analysis and visualization preparation in fragmented environments. The itol.toolkit provides consistency to the workflow, allowing users to filter branches and output template files seamlessly.

Prune nodes

This section uses dataset 1 as an example. (refer to the Dataset for detail information)

The first step is to load the newick format tree file tree_of_itol_templates.tree and its corresponding metadata df_frequence and template_parameters_count.

The purpose of data processing in this section is to demonstrate how to select labels to be pruned according to users’ demands.

library(itol.toolkit)
tree <- system.file("extdata",
                    "tree_of_itol_templates.tree",
                    package = "itol.toolkit")
df_frequence <- data.table::fread(system.file("extdata",
                                              "templates_frequence.txt",
                                              package = "itol.toolkit"))
data("template_parameters_count")

We can also filter branches based on other information. For example, we used template_parameters_count data to filter templates with more than 30 parameters in unit_5.

tpc <- template_parameters_count
select_tip = row.names(tpc)[rowSums(tpc) > 30]
unit_5 <- create_unit(data = select_tip, 
                      key = "E005_prune_3", 
                      type = "PRUNE", 
                      tree = tree)
write_unit(unit_5)

Visit

# prune