I am wondering if it is possible to get node connectivity from newick formatted tree. e.g (((t10,t6),(t9,((((t5,t1),t4),t3),(t7,t2)))),t8);. The example image is shown using a length of 1.. How to I get a list of nodes that are connected. i.e relationship for each node. t5 and t1 are connected to t4, t4 connected to t3. so t5 and t1 are leaf nodes. Representing them in a table in the form looks like this
t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t1 (t1,t4) t2 (t2,t9) t3 (t3.t9) t4 (t4,t3) t5 (t5,t4) t6 (t6,t8) t7 (t7,t9) t8 t9 (t9,t8) t10 (t10,t8)
What I want is a list of tuples of the connected nodes e.g
list = [(t1,t4), (t2,t9), (t3.t9), (t4,t3), (t5,t4), (t6,t8), (t7,t9), (t9,t8), (t10,t8)]
My intuition of the connections maybe wrong but this is what I am trying to achieve. Is this possible? At end, I just want the leaf nodes to take on values of their parent nodes.