Question: Converting Phylogenetic Tree Into A Binary One - R Ape Package
gravatar for Agatha
9.1 years ago by
Agatha350 wrote:


I am trying to generate a skyline plot for a tree read from a file , but I get the following error:

> skyline(new_tree)
Error in coalescent.intervals.phylo(x) : object "x" is not a binary tree

Therefore I am trying to find a way in converting it into a binary tree using the ape package. This is how my tree looks like.

[1] "(13.1:3.419372019,43.1:4.999255162,28.1:1.312062435,21.1:4.79710673,20.1:2.684386432,4.1:2.200648241,37.1:1.842346707,23.1:0.64305868,29.1:0.5388636841,15.1:2.634891758,36.1:1.237981993,40.1:3.525394923,26.1:1.064726807,16.1:0.5079536373,33.1:3.725563462,10.1:4.941130066,18.1:0.5457785237,6.1:4.091318485,11.1:0.1958651538,34.1:3.393013553,2.1:0.7575133257,38.1:3.214719145,35.1:0.176306339,8.1:0.3980455943,42.1:4.85883169,22.1:1.438767907,5.1:3.569074487,27.1:1.856116496,39.1:2.685387186,17.1:4.454120644,30.1:2.536021449,31.1:2.863102485,41.1:2.290262851,7.1:2.874266852,25.1:0.2412481245,3.1:2.35817861,12.1:3.307488272,14.1:3.553288149,1.1:0.2333991311,24.1:4.563503764,9.1:4.044738467,32.1:2.8040902,19.1:1.752629864);"

Any suggestions? Thanks!

R phylogenetics • 4.8k views
ADD COMMENTlink modified 11 months ago by Biostar ♦♦ 20 • written 9.1 years ago by Agatha350
gravatar for Botond Sipos
9.1 years ago by
Botond Sipos1.7k
United Kingdom
Botond Sipos1.7k wrote:

It looks that your tree is one big polytomy. You could randomly break the polytomies as described in the R Hackaton wiki, but based on my understanding of how skyline methods work, you should not use the resulting tree as an input. The skyline method relies on the branch lengths and the polytomies are resolved by creating arbitrary internal branches of length zero.

I guess you should investigate the reason behind getting an unresolved tree and try to get a resolved one if possible.

ADD COMMENTlink written 9.1 years ago by Botond Sipos1.7k

@Botond Sipos- Actually my tree is a consensus re-branched tree. I had a nexus file with several trees, read it up, generated the consensus tree using the consensus function ...and afterwards I had to re-branch it since all the branches had the same length(using compute.brlen). That new_tree is the consensus rebranched one and I cannot use it as an input since it is not binary....I don't know where the problem is. For the birds.order data, I get the desired input..could it be that the nexus file I have been provided has some issues? Thank you!

ADD REPLYlink written 9.1 years ago by Agatha350
gravatar for Aleksandr Levchuk
9.1 years ago by
United States
Aleksandr Levchuk3.2k wrote:

(You can use this webpage to visualize trees

Your tree looks like this: Star is a tree

It's a star structure. I don't see any sensible way to convert this into a binary tree.

ADD COMMENTlink written 9.1 years ago by Aleksandr Levchuk3.2k

@Aleksandr Levchuk I did visualize the tree in R and I tried to root it or to find ways to make it "usable"...but still I cannot use it as an input for the skyline function ..and apparently I cannot do anything about it:) Thanks!

ADD REPLYlink written 9.1 years ago by Agatha350
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 946 users visited in the last hour