Phylobasics

Simple ape phylogeny

#######################################################
# R code: Phylogeny versus cladogram
#######################################################
library(ape)

# Tree specification
newick_string = "((((human:6,chimp:6):1,gorilla:7):6,orang:13):5,gibbon:18);"
tr = read.tree(file="",text=newick_string)
plot(ladderize(tr, right=FALSE), cex=1.5); axisPhylo(cex=2); title("Dated phylogeny of humans and closest relatives"); mtext("millions of years ago", side=1, line=3)

# Remove branch lengths
tr2 = tr
tr2$edge.length = NULL
plot(ladderize(tr2, right=FALSE), cex=1.5); title("Cladogram of humans and closest relatives\n(branch lengths irrelevant)"); mtext("x-axis not meaningful", side=1, line=3)

Using command-line TreeAnnotator

Two bits of help with TreeAnnotator

1. TreeAnnotator:

TreeAnnotator can have memory issues with large numbers of big trees. I tend to use the command-line version. In Macs it works like this:

java -Xms512m -Xmx512m -jar /Applications/BEAST_2.4.3/treeannotator.jar -heights median 
-burnin 0 -limit 0 merged_trees_v1.nexus merged_trees_v1.mcc

This converts the tree samples in "merged_trees_v1.nexus" to an MCC summary tree in "merged_trees_v1.mcc". The other options:

  • java — starts java (which is what runs Beast, TreeAnnotator, etc.)
  • -Xms512m -Xmx512m — these specify the amount of memory. If 512 still causes a memory error, raise to 1024, 2048, etc.
  • -jar /Applications/BEAST_2.4.3/treeannotator.jar — this has the command-line version of TreeAnnotator, as a .jar file (a Java application). Google "treeannotator.jar" to find one to download
  • -heights median — the node heights in the MCC tree are the median of the ages for that clade in the tree samples (the median will be less subject to extremes than the mean/average)
  • -burnin 0 — skip 0 trees as burn-in (typically, you will want to skip 25% or 50% of the trees, e.g. skip 2500 trees if you have 10000 saved; above, I removed these trees separately)
  • -limit 0 — I think this is a posterior probability limit for clades (if you said 50, it would force a 50% majority-rule tree I think)
  • merged_trees_v1.nexus merged_trees_v1.mcc — input and output filenames

2. Burntrees. If you still have too many trees saved, you can use Nylander's "burntrees" perl scripts (google these) to quickly filter treefiles (e.g. take every 10th tree), remove burnin trees, etc.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License