gluc / data.tree

General Purpose Hierarchical Data Structure for R
http://gluc.github.io/data.tree
208 stars 40 forks source link

toNewick() returns wrong branch length #159

Open Lan-h opened 2 years ago

Lan-h commented 2 years ago

Hi, I tried to follow the vignette to convert a dataframe to Newick format, but I the branch length in the output are wrong, although the overall shape of the tree is correct. This is my current data.tree object: `

population = FromDataFrameTable(myTable, pathName = "LineageTracing", colLevels = c("TimeBranching") , na.rm = FALSE) print(population,"TimeBranching") levelName TimeBranching 1 1 0 2 ¦--2 1 3 ¦--3 5 4 ¦--4 9 5 ¦ °--6 1 6 °--5 10 and the way I tried to convert it to Newick format: ToNewick(population, heightAttribute = "TimeBranching") "(2:-1,3:-5,(6:8)4:-9,5:-10)1;" ` the output should be "(2:1,3:5,(6:1)4:9,5:10)1;" instead.

Is there a way to fix this issue ? Thank you in advance!

gluc commented 1 year ago

Hey, sorry for the late reply. Could you please provide a reproducible example (specifically: what is myTable)? Thx.