I want to create a tree (cluster) using the Interactive Tree of Life tool (iTOL). As an input file (or line), this tool uses Newick format , which is a way of representing graphically theoretical trees with edge lengths using parentheses and commas. In addition, additional information, such as loaded values of cluster nodes , can be supported .
For example, here I created a data set for cluster analysis using a package clusterGeneration:
library(clusterGeneration)
set.seed(1)
tmp1 <- genRandomClust(numClust=3, sepVal=0.3, numNonNoisy=5,
numNoisy=3, numOutlier=5, numReplicate=2, fileName="chk1")
data <- tmp1$datList[[2]]
Then I performed a cluster analysis and evaluated the support of the cluster nodes using bootstrap using the package pvclust:
set.seed(2)
y <- pvclust(data=data,method.hclust="average",method.dist="correlation",nboot=100)
plot(y)
Here is the cluster and the loaded values:

To create a Newick file, I used apepackage:
library(ape)
yy<-as.phylo(y$hclust)
write.tree(yy,digits=2)
write.tree the function will print the tree in Newick format:
((x2: 0.45, x6: 0.45): 0.043, ((x7: 0.26, (x4: 0.14, (x1: 0.14, x3: 0.14): 0.0064) : 0.12): 0.22, (x5: ββ0.28, x8: 0.28): 0.2): 0.011);
These numbers represent the lengths of the branches (cluster edge lengths). Following the instructions on the iTOL help page (section "Downloading and working with your trees"), I manually added boot values ββto my Newick file (bold values ββbelow):
((2: 0,45, x6: 0,45) 74: 0,043, ((7: 0,26, (4: 0,14, (x1: 0,14, 3: 0,14) 55: 0,0064) 68: 0,12) 100: 0,22, (5: 0,28, 8: 0,28) 100: 0,2) 63: 0,011);
, iTOL. , ...
: , ?
:
(round(y$edges,2)*100)[,1:2]
, Newick, :
yy$edge.length
, write.tree . , .write.tree2, , Newick.
.