Range color block

Range color block

Introduction

The TREE_COLORS allows you to set the style of branches at any level. It has five attributes: “range”, “clade”, “branch”, “label”, and “label_background”. While style parameters is simple of TREE_COLORS, the data parameters are extremely complex. The Style template belongs to the “Tree structure” class (refer to the Class for detail information).

To set the style of a branch or node, users must enter the name of the branch tip or node and the attribute such as color, label, style, and size.The selected branch will then display the new styles as defined by the specified attribute. Although this function provides the most comprehensive templates for modifying tree style, its complexity in data parameters proves to be a great challenge for users.

This section shows how to use itol.toolkit to modify the style. The itol.toolkit significantly reduces the difficulty level for using iTOL by enabling automatic data recognition. Without itol.toolkit, users would have to organize various attribute parameters and their corresponding input data manually. With the itol.toolkit, the entire workflow becomes more cohesive, and users can directly output the template files once they have confirmed which data to use.

Regular flow

This section uses dataset 1 as an example to show how to draw the line chart. (refer to the Dataset for detail information)

Load data

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

library(itol.toolkit)
tree <- system.file("extdata",
                    "tree_of_itol_templates.tree",
                    package = "itol.toolkit")
hub <- create_hub(tree = tree)
data("template_groups")

If the user enters all four columns, the program will figure out which is the subclass and which is the color.

We can use the “range” attribute to set color of the tip label area. Unlike the “label_background” attribute, the “range” attribute color action range is consistent in the area of each label. In unit_7, we only use two columns to show hot use these function. The attribute are fed to the subtype parameter. Based on the input data, the create_unit function treat the first column as tip id, and the second columns as the “range” information (whatever the header is). Moreover, the color is also generated by the second column of input data. Also, colors can be defined using the color parameter. As a result, the program has handle all possible cases automatically, lowering the threshold at which users are preparing for input data.

unit_7 <- create_unit(data = template_groups, 
                      key = "E007_tree_colors_1", 
                      type = "TREE_COLORS", 
                      subtype = "range", 
                      tree = tree)
write_unit(unit_7)

Visit

# tree_colors