# [R-sig-phylo] Newick tree merging at the wrong level?

```Dear list,

TL;DR: When I plot the newick tree ((((A,B),C,D),E),(((F,G),H),I));
shouldn't ((A,B),C,D) merge at the same level as ((F,G),H)?
Or in a phylogenetic tree it doesn't matter?```
```
library(ape)
plot(newickTree)
goes just fine but then, when I add D:
plot(newickTree)
The merge between (A,B),C,D goes one level up (and consequently E too).

Very long version: I'm developing my own hierarchical clustering algorithm
that outputs a matrix like the one bellow:

| Level 1 | Level 2 |  Level 3   |    Level 4     |     Level 5       |
Level 6
------------------------------------------------------------------------------------------------------
1 | 1         | c(5,8)   | c(2, 5, 8)  | c(2, 5, 7, 8)  | c(2, 5, 6, 7, 8)
| 1:10
2 | 2         | c(5,8)   | c(1, 5, 8)  | c(2, 5, 7, 8)  | c(2, 5, 6, 7, 8)
| 1:10
3 | 3         | c(4,9)   | c(3, 4, 9)  | c(2, 5, 7, 8)  | c(1, 2, 5, 7, 8)
| 1:10
4 | 4         | c(4,9)   | c(3, 4, 9)  | c(3, 4, 9, 10) | c(2, 5, 6, 7, 8)
| 1:10
5 | 5         | c(5,8)   | c(1, 5, 8)  | c(2, 5, 7, 8)  | c(2, 5, 6, 7, 8)
| 1:10
6 | 6         | c(5,8)   | c(2, 5, 8)  | c(2, 5, 7, 8)  | c(1, 2, 5, 7, 8)
| 1:10
7 | 7         | c(5,8)   | c(2, 5, 8)  | c(2, 5, 7, 8)  | c(1, 2, 5, 7, 8)
| 1:10
8 | 8         | c(5,8)   | c(2, 5, 8)  | c(2, 5, 7, 8)  | c(2, 5, 6, 7, 8)
| 1:10
9 | 9         | c(4,9)   | c(3, 4, 9)  | c(2, 5, 7, 8)  | c(2, 5, 6, 7, 8)
| 1:10
10| 10      | c(4,9)   | c(3, 4, 9)  | c(3, 4, 9, 10) | c(2, 5, 6, 7, 8) |
1:10

I want to plot a dendrogram based on this and the best idea I had was to
convert that matrix to a newick tree format and use ape to read it and plot
as a dendrogram.
So the corresponding newick tree would be
newickTree <-
plot(newickTree)
But the levels are wrong.. I was expecting this:
newickTree <-

plot(newickTree)

I know that I can just specify the heights and solve my problem but that
(Making ultrametric trees) was to make every height = 1 and read it with
chronos()
newickTree <-

dendr <- chronos(newickTree)
plot(dendr)
but it doesn't look right..

Sorry for the newbie questions.. I just wanted a way to make my algorithm
output a dendrogram.

--
Carlos Porto Filho
Bioengenharia - EESC / IQSC / FMRP - USP

[[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
```