Node height vs. node age

3,605 views
Skip to first unread message

Deven

unread,
Jan 28, 2014, 10:53:00 AM1/28/14
to beast...@googlegroups.com
Hello, I was wondering, what is the difference between node height and node age? I've been using the Phyloch package in R to export out node statistics from a TreeAnnotator MCC tree using median heights (I use this setting because keeping target heights was getting me some wonky results). I've noticed that my R-Phyloch output gives me heights (but not node ages), and Figtree displays both node heights and and node ages. Numerically they are slightly different, but still pretty much the same (e.g. in FigTree node age 164813.95 = height 165807.51). I was wondering, what is the actual difference?

These are the tree lines of code I used to get my data into R in case it is relevant:
read.beast("tree.txt") -> TREE
read.beast.table("tree.txt") -> TABLE
write.csv(TABLE, "table.csv")

Sincerely,
Deven Vyas

Nick Matzke

unread,
Jan 28, 2014, 12:50:55 PM1/28/14
to beast...@googlegroups.com
Not sure, but the prt() function in BioGeoBEARS will output
a table with heights, ages, node numbers, and other handy
information, for an APE tree object.

Cheers,
Nick
> --
> You received this message because you are subscribed to the
> Google Groups "beast-users" group.
> To unsubscribe from this group and stop receiving emails
> from it, send an email to
> beast-users...@googlegroups.com.
> To post to this group, send email to
> beast...@googlegroups.com.
> Visit this group at http://groups.google.com/group/beast-users.
> For more options, visit
> https://groups.google.com/groups/opt_out.

--
====================================================
Nicholas J. Matzke, Ph.D.
NIMBioS Postdoctoral Fellow in Mathematical Biology
National Institute for Mathematical and Biological Synthesis
(NIMBioS, www.nimbios.org)
Cell: 510-301-0179
Email: mat...@nimbios.org
Links to CV, R packages, etc.:
http://phylo.wikidot.com/nicholas-j-matzke

Also: Brian O'Meara Lab
Postdoc office: 425a Hesler
Department of Ecology and Evolutionary Biology
University of Tennessee, Knoxville
http://www.brianomeara.info/

NIMBioS Office:
Claxton Bldg. #110B
Office phone: 865-974-4873

NIMBioS:
1122 Volunteer Blvd., Suite 106
University of Tennessee
Knoxville, TN 37996-3410
Phone: (865) 974-9334
Fax: (865) 974-9300

-----------------------------------------------------
"[W]hen people thought the earth was flat, they were wrong.
When people thought the earth was spherical, they were
wrong. But if you think that thinking the earth is spherical
is just as wrong as thinking the earth is flat, then your
view is wronger than both of them put together."

Isaac Asimov (1989). "The Relativity of Wrong." The
Skeptical Inquirer, 14(1), 35-44. Fall 1989.
http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm
====================================================

Santiago Sánchez

unread,
Jan 28, 2014, 1:53:37 PM1/28/14
to beast...@googlegroups.com
Hello Deven,

I think node ages should be embedded in the MCC tree following a colon (:), whereas node heights should be summarized as annotations.

If you are looking for the former, you can also try the branching.times() function in APE.

Cheers,
Santiago



2014-01-28 Nick Matzke <mat...@nimbios.org>
--
You received this message because you are subscribed to the Google Groups "beast-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beast-users+unsubscribe@googlegroups.com.

To post to this group, send email to beast...@googlegroups.com.
Visit this group at http://groups.google.com/group/beast-users.
For more options, visit https://groups.google.com/groups/opt_out.



--
Santiago Sánchez-Ramírez
Department of Ecology and Evolutionary Biology, University of Toronto
Department of Natural History (Mycology), Royal Ontario Museum
100 Queen's Park
Toronto, ON
M5S 2C6
Canada

Deven

unread,
Jan 28, 2014, 5:48:33 PM1/28/14
to beast...@googlegroups.com, Nick Matzke
It appears the time_bp from prt() is neither the "node age" or "height"; it gives a similar value, but it is not identical. It does match the "height_median" from read.beast.table() though.

Nick Matzke

unread,
Jan 28, 2014, 5:53:12 PM1/28/14
to beast...@googlegroups.com
"time_bp" should be the time before present calculated from
the actual physical phylo3 object, e.g. as if you just read
in a plain newick file into APE.

So, if your summary tree from BEAST was calculated using
median heights, that's what will be in the phylo3 object.

(prt doesn't deal with the node information BEAST stores in
the NEXUS object, apologies if that's what you were looking
for, phyloch is your best bet for that I think)

Cheers,
Nick
> > beast-users...@googlegroups.com <javascript:>.
> > To post to this group, send email to
> > beast...@googlegroups.com <javascript:>.
> <http://groups.google.com/group/beast-users>.
> > For more options, visit
> > https://groups.google.com/groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
> --
> ====================================================
> Nicholas J. Matzke, Ph.D.
> NIMBioS Postdoctoral Fellow in Mathematical Biology
> National Institute for Mathematical and Biological
> Synthesis
> (NIMBioS, www.nimbios.org <http://www.nimbios.org>)
> Cell: 510-301-0179
> Email: mat...@nimbios.org <javascript:>
> <http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm>
>
> ====================================================

Deven

unread,
Jan 28, 2014, 5:53:46 PM1/28/14
to beast...@googlegroups.com
Hello, it seems that the branching.times() function is just giving me a list of strange and often negative numbers that do not at all correspond with the node they claim to (output copied below). Any idea what is going on here?

Sincerely,
Deven Vyas

> branching.times(TREE344)
        345         346         347         348         349         350         351         352         353         354         355         356         357         358         359         360         361
707170.7485 344878.1984  81082.4595  17262.0950  12517.9968  10567.5960 125134.6741  61812.3762   6663.5199  -7332.0140  -9177.6149 -12922.0325 -37212.6986 -31545.1919 -32894.8375 -34646.5211 -11754.2185
        362         363         364         365         366         367         368         369         370         371         372         373         374         375         376         377         378
-26515.5792 -29388.0635 -30796.7294 -32259.2147 -34700.3291 -35252.1144 -37197.8471 -37439.5975 -33620.9934 -38344.9129 -34958.9951 -35416.2033 -34536.9079 -36288.9319 -32843.5216 -37765.8463 -34696.7033
        379         380         381         382         383         384         385         386         387         388         389         390         391         392         393         394         395
-38376.5629 -28743.5061 -31830.9340 -38511.6911 -32913.1166 -34311.2673 -34961.7036 -36069.6164 -32561.7062  92755.7746  79277.2425 -19431.6221  63434.4420  44869.0701    110.2967  37358.7135  -4118.6223
        396         397         398         399         400         401         402         403         404         405         406         407         408         409         410         411         412
 35089.8016  31232.6372  30882.4162  18650.6066  -5356.0202  -7175.8060 -20064.3179 -31878.4314 -34534.8077 -34898.2883 -36292.7307 -37034.4765 -37087.6060 -38340.1376 -35196.8350 -36278.3231 -36733.6314
        413         414         415         416         417         418         419         420         421         422         423         424         425         426         427         428         429
-37506.4243 -26724.6601 -31048.6525 -38185.2124 -30076.3175 -32354.8200 -37167.1883 -38049.4866 -33274.8814 -33557.4460 -33892.7040 -34677.6337 -35413.4551 -35982.2037 -36460.5741 -37537.1898  23060.4490
        430         431         432         433         434         435         436         437         438         439         440         441         442         443         444         445         446
 20324.5481  17190.5044  14765.5196 -20922.4659 -23368.6290  12928.3071  10575.1053   9036.6097  -8455.3705   6033.3633  -5199.1598 -28043.9118   2985.1609  -1930.7163  -5864.7048   5264.8876   6252.5997
        447         448         449         450         451         452         453         454         455         456         457         458         459         460         461         462         463
 17147.0552  -3215.6455 -32816.9975  10979.9887  -5837.8934 -16516.9112 -17664.4142 -21497.9693 -25720.4513 -26730.6449 -31096.3537 -28501.1730 -32527.7588 -22885.9465 -25378.1644 -29419.9896 -31518.6848
        464         465         466         467         468         469         470         471         472         473         474         475         476         477         478         479         480
-24840.9673 -27839.5527 -31244.0731 -38217.1714 -29890.2724 -30701.2736 -34506.5082 -26469.0385 -29476.5592 -29868.4795 -31600.9120 -35253.8084 -29989.4943 -34273.5449   5534.7166 -22880.0004 -27948.9903
        481         482         483         484         485         486         487         488         489         490         491         492         493         494         495         496         497
-30618.8855 -32217.5196 -33160.1848 -38322.7678 -34611.5075  -2775.6067 -20160.1404 -21652.2731 -23275.7979 -24854.6049 -26127.5588 -35174.5442 -26363.1301 -30172.5402 -29896.5909 -27406.5662 -30392.2027
        498         499         500         501         502         503         504         505         506         507         508         509         510         511         512         513         514
-34181.4960 -36845.3462 -37925.9153 -16934.2141 -33796.9955 -36216.4916  15628.3978  10002.3746   4500.5387   1604.0492  -1725.2224  -1141.2301   5053.9841  -7264.9193 -15657.5518  12139.5795    460.2094
        515         516         517         518         519         520         521         522         523         524         525         526         527         528         529         530         531
 -6129.5565  -8542.2251 -16774.5363 -18857.7474 -16128.1482 -17048.9168 -20545.5097 -25701.5634  12818.8576   8372.3808    110.6402  -7628.0311  -9862.2257   9279.0077   1566.4255 -21456.2381 -29121.0252
        532         533         534         535         536         537         538         539         540         541         542         543         544         545         546         547         548
-16952.0511  17070.0740   -850.1770  -6089.7682 -38233.8216  13715.6545 -17925.3041 -22215.3730 -27377.3477 -31794.2873 -26817.0446 -33434.4568 -34968.7291 -36238.6439 -36983.9361 -38251.3128 -37721.5918
        549         550         551         552         553         554         555         556         557         558         559         560         561         562         563         564         565
 12997.8937  -2957.0341 -37164.2946 -10705.7566 -13870.6411 -18783.5482 -25619.3009 -37333.9227 -21194.0610 -25161.5333 -26429.1224 -27571.2808 -30939.1182 -35528.0689 -24030.4716 -30903.1363 -37156.3016
        566         567         568         569         570         571         572         573         574         575         576         577         578         579         580         581         582
-18712.6121 -32118.0492  31942.1574  21349.5641  11393.9543   9231.2061  -6735.6506 -11146.3260 -14602.2771 -19424.5405 -25920.3598 -27600.6354 -28892.7018 -31377.9605 -20360.8414 -22225.4045 -25747.2255
        583         584         585         586         587         588         589         590         591         592         593         594         595         596         597         598         599
-28136.8461 -32285.5851 -30667.1349 -25050.4149 -26202.7323 -25883.2239 -35454.9444 -36904.8496 -37711.7335 -25160.2495 -30454.3361 -32132.9516 -33707.8231 -34717.2823 -36167.1913 -37295.5276 -26197.2481
        600         601         602         603         604         605         606         607         608         609         610         611         612         613         614         615         616
-24578.3822 -26556.1355 -28192.4410 -30376.2723 -32574.6013 -38531.3104 -35515.7354 -37238.2371 -32531.5699 -36196.7723 -38051.4068 -33355.2874 -35942.0562 -37386.4568 -29767.5308 -36195.0490 -30537.1963
        617         618         619         620         621         622         623         624         625         626         627         628         629         630         631         632         633
-33450.5166 -34936.1875 -35883.8312 -32790.7347 -17576.9641 -32186.8305 -33448.2999 -34495.8957 -37069.2699 -38362.6847 -19785.2374 -26655.2263 -32099.7895 -34122.6950 -19615.6898 -37142.6081 -13855.8076
        634         635         636         637         638         639         640         641         642         643         644         645         646         647         648         649         650
-27765.4692 -31038.2342 -12622.0115  19708.6201  16785.2353  12755.7905   8022.1424   6565.8164   6527.9655   5399.0329  -2843.7072  -2202.7863 -38188.4799  -5512.9379    358.8694  -2401.5245  -3425.7189
        651         652         653         654         655         656         657         658         659         660         661         662         663         664         665         666         667
-19772.4336  10934.2274  -2959.4461 -19641.4892 -22846.4092 -19488.6889   8799.3226   3484.7401  -3387.3708 -21131.1798   5229.5419 -11576.0312 -14059.3177  13765.6262    482.1093  26315.7956  11096.3017
        668         669         670         671         672         673         674         675         676         677         678         679         680         681         682         683         684
  -592.0679  -5992.0557 -17243.3273 -24372.8881 -36477.0751 -29825.8357 -34603.1622 -25600.3610 -21555.6327 -25525.0571 -29010.9708 -32357.5359 -34948.5680 -37962.2158 -37576.0435 -37410.9344 -38462.1925
        685         686         687
 33779.0898 -31912.0867   3611.5014


2014-01-28 Nick Matzke <mat...@nimbios.org>
To unsubscribe from this group and stop receiving emails from it, send an email to beast-users...@googlegroups.com.

To post to this group, send email to beast...@googlegroups.com.
Visit this group at http://groups.google.com/group/beast-users.
For more options, visit https://groups.google.com/groups/opt_out.

Santiago Sánchez

unread,
Jan 28, 2014, 5:56:10 PM1/28/14
to beast...@googlegroups.com
Try it with a tree that was imported using read.nexus(), and not read.beast().


2014-01-28 Deven <deven.v...@gmail.com>

Deven

unread,
Jan 28, 2014, 5:59:16 PM1/28/14
to beast...@googlegroups.com
Just did that, same output. I do have fossil taxa in my tree, would that be the reason for this output?

Sincerely,
Deven Vyas

Santiago Sánchez

unread,
Jan 28, 2014, 6:04:37 PM1/28/14
to beast...@googlegroups.com
I've seen that when phy$node.label is active in the phylo object, branching.times() doesn't work properly. Another issue might be that not all tips are reaching "present time", this can also disturb the calculations in branching.times().

If you try, summary(phy), do you get any hidden annotations?


2014-01-28 Deven <deven.v...@gmail.com>

Deven

unread,
Jan 28, 2014, 6:11:49 PM1/28/14
to beast...@googlegroups.com
I don't see any annotations (though I may just not be recognizing them, hence output copied below). The MCC Tree I loaded in was a copy fresh off the cluster and never loaded into FigTree. I have five Neanderthal and two Denisovan fossil mitogenomes from GenBank in my analysis and outgroup fossil calibrations (which don't reach the present).

Sincerely,
Deven Vyas


> summary(nexus)

Phylogenetic tree: nexus

  Number of tips: 344
  Number of nodes: 343
  Branch lengths:
    mean: 12913.22
    variance: 1227278521
    distribution summary:
    Min.  1st Qu.   Median  3rd Qu.     Max.
  -679.3   2168.0   5162.0  13300.0 703600.0
  No root edge.
  First ten tip labels: A10_HM569228_Canada
                        A3_AP010994_Japan
                        A5_AP008265_Japan
                        B4_EU597559_China
                        B4a1a1a_AY963574_Bougainville
                        B6a_AY255136_China
                        C1a_AY519496_Russia(Siberia)
                        C4_FJ951604_Russia
                        C7_FJ951594_South_Korea
                        D5a1_AP008250_Japan
  No node labels.
> summary(TREE344)

Phylogenetic tree: TREE344

  Number of tips: 344
  Number of nodes: 343
  Branch lengths:
    mean: 12913.22
    variance: 1227278521
    distribution summary:
    Min.  1st Qu.   Median  3rd Qu.     Max.
  -679.3   2168.0   5162.0  13300.0 703600.0
  No root edge.
  First ten tip labels: A10_HM569228_Canada
                        A3_AP010994_Japan
                        A5_AP008265_Japan
                        B4_EU597559_China
                        B4a1a1a_AY963574_Bougainville
                        B6a_AY255136_China
                        C1a_AY519496_Russia(Siberia)
                        C4_FJ951604_Russia
                        C7_FJ951594_South_Korea
                        D5a1_AP008250_Japan
  No node labels.

Santiago Sánchez

unread,
Jan 28, 2014, 6:16:42 PM1/28/14
to beast...@googlegroups.com
Yeah, I don't see any annotations. So I guess branching.times() is useless for your tree, since you have terminals that don't reach the present. I would stick to annotations from BEAST, so read.beast(). Another suggestion is using TreeStat to get "node ages", and then import them to R as a table.

Cheers,
Santiago


2014-01-28 Deven <deven.v...@gmail.com>

Deven

unread,
Jan 28, 2014, 6:19:08 PM1/28/14
to beast...@googlegroups.com
Thanks for the help! Would there be any harm in just using heights instead of node age? In the cases where I've compare them they are very similar.

Santiago Sánchez

unread,
Jan 28, 2014, 6:24:28 PM1/28/14
to beast...@googlegroups.com
I don't think it's a big issue. Question: Why use median values and not mean? If you are having the "negative branch length" effect, you can try with the option "-heights ca" in treeannotator (see http://www.biomedcentral.com/1471-2148/13/221).



2014-01-28 Deven <deven.v...@gmail.com>

Deven

unread,
Jan 28, 2014, 6:36:09 PM1/28/14
to beast...@googlegroups.com
I never actually tried mean heights. When I was working out my model I tried keep-target-heights because my collaborator suggested it (and got wonky results, thus we decided to stop using it). I ended up using median heights simply because it was the GUI's default and it was not giving weird results. I do occasionally get negative branches, but they are generally fairly short and sometimes they may be a result of constraining mtDNA sequences to the PhyloTree "known" topology. Switching to means at this point would entail redoing a lot of stuff (and this project is already a semester behind schedule), so I will stick with medians (and try means in a future project).

Sincerely,
Deven Vyas

Santiago Sánchez

unread,
Jan 28, 2014, 6:48:32 PM1/28/14
to beast...@googlegroups.com
A quick note. In keep-target heights, treeannotator uses the branch lengths of the sampled MCC tree within your posterior distribution, in other words it doesn't summarize branch lengths across the posterior.



2014-01-28 Deven <deven.v...@gmail.com>
Reply all
Reply to author
Forward
0 new messages