How To Prevent Neighbour-Joining Resulted Negative Branch Length For Phylogenetic Tree Drawing?
1
0
Entering edit mode
12.6 years ago
Ken ▴ 10

Hi, I was using rapidNJ to perform neighbour-joining but it gave me a couple of nodes with negative branch length. Is there any way I can fix it? If rapidNJ won't do it, do you have any recommended program to do a better job? Thanks.

phylogenetics • 8.6k views
ADD COMMENT
5
Entering edit mode
12.6 years ago
Andreas ★ 2.5k

Negative branch lengths are possible in theory and might occur in the output of other programs (e.g. FastTree) as well. See the short section on negative branch lengths here for example. If your downstream analysis requires non-negative branch-lengths, a quick hack is to replace negative entries with zero (even though in theory you should add the difference to the adjacent branch length). The following should do (untested!):

sed -e 's,:-[0-9\.]\+,:0.0,g' in.tree > out.tree

Andreas

ADD COMMENT
0
Entering edit mode

Correct answer, but no upvote?

ADD REPLY
0
Entering edit mode

this answer gave me confidence on my results. But no better alternative solution and the sed command doesn't add the difference to the adjacent branch length. sorry for my strictness. ;P

ADD REPLY
1
Entering edit mode

You had a problem and I gave you an answer plus a solution. Not a really encouraging reply.

ADD REPLY

Login before adding your answer.

Traffic: 2650 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6