0
$\begingroup$

I have a dendrogram represented in a format I don't understand:

(K_5:1.000030e+00,((K_1:2.000000e-05,(K_2:1.000000e-05,K_3:1.000000e-05):1.000000e-05):1.000000e-05,K_4:3.000000e-05)0.806:1.000000e+00):0.000000e+00;

I am not sure how to interpret the above. It is an output of hierarchical clustering.

K_1, K_2, K_3, K_4, K_5 are the data points.

I have other dendrograms represented in the following format:

[x_1,x_2,x_3,x_4,x_5] (we start with one big cluster and split a cluster at each step)

[x_1,x_2][x_3,x_4,x_5]

[x_1,x_2][x_3,x_5][x_4]

[x_1][x_2][x_3,x_5][x_4]

[x_1][x_2][x_3][x_5][x_4]

I want a way to convert between these two representations.

$\endgroup$
2
  • $\begingroup$ Can you tell from which package you got this dendrogram output? $\endgroup$ Aug 3 '20 at 13:29
  • $\begingroup$ It's from FINEstructure. It's for genome analysis. $\endgroup$ Aug 3 '20 at 14:17
0
$\begingroup$

This output represents the dendogram as a tree. The innermost parentheses represent the deepest parts of the tree. For instance the top (root) of the tree start with the pair K5 and a subtree, then this subtree is made of another subtree and K4, and so on.

If we ignore the numerical values (distances I assume?) we have this:

(K_5,
  (
    (K_1,
       (
         K_2,K_3
       )
       
    )
    K_4
  )
)

Which represents this tree:

 --------------------
 |                  |
 |            -------------
K_5           |           |
           -------       K_4
           |     |
          K_1  -----
               |   |
              K_2 K_3

Then it can be converted to the desired format:

[K_1 , K_2 , K_3 , K_4 , K_5]
[K_1 , K_2 , K_3 , K_4] [K_5]
[K_1 , K_2 , K_3] [K_4] [K_5]
[K_1] [K_2 , K_3] [K_4] [K_5]
[K_1] [K_2] [K_3] [K_4] [K_5]
$\endgroup$
2
  • $\begingroup$ Is there a name for this representation? Is it the most standard representation? $\endgroup$ Aug 3 '20 at 15:10
  • 1
    $\begingroup$ I don't know any name or whether this is a standard representation of a dendogram. However it's common to represent any kind of tree with a parenthesis structure, for instance mult(6,plus(3,4)) for "6 * (3+4)). I guess the notation is inspired from that... or it could simply be the most direct way to print the data structure in the software you're using. $\endgroup$
    – Erwan
    Aug 3 '20 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.