Archive for June, 2011

The Arrival of a Little Monkey

Toby Charles Allen (whose intellectual close friends get to call him T.C.), was born at 9:03am, on Wednesday 29th June 2011 (just missed Tau Day…) He’s a sturdy 8 lbs 10 oz, and is happy and healthy, as are both his parents.



Alright darlin'? *wink*

Broken Britain Part 34,127: Not yet 12 hours old, and already he has an ASBO tag.


The War-and-Peace-O-Meter: Week Four

Previous weeks: 0, 1, 2, 3

Pretty much bang-on the 20% mark this week. I had hoped to get through it a bit quicker, but while it’s eminently readable, it’s not the sort of book you can churn through at a rate of knots. And, since I’m only going to read this book once, I might as well savour it…

Part of the reason I haven’t read much this week is because I did some working from home, so I haven’t had my usual bus-time for reading. Instead, I tended to watch the second Frasier episode on Channel 4 at breakfast time; then watched some Wimbledon at tea-time. Haven’t really done much of note this week – it feels like I’ve mostly just been sitting around, idling my engine, pacing the halls, and getting my metaphors all muddled.

LyX: LaTeX, the Easy(ish) Way


I’ve resisted learning TeX/LaTeX for years; I appreciate the principle, but I baulk at the idea of learning another language, particularly one which requires a bunch of opaque commands at the top of each file. I like a nice GUI, and Word, for all its faults, does give you lots of control if you use the styles correctly. And the EndNote Web plugin allows you to sort out referencing without too much pain.

And yet, and yet… LaTeX is the right way to do things, from a typesetting viewpoint, and also because it correctly places the emphasis on content. What’s a graphically minded chap to do? I recently discovered LyX, which claims to fill this gap in the market. I thought I’d see how easy it was to turn out a nice looking document with LyX by replicating a Word doc that I was intending to post on this blog (on tree comparison).

Citing References

To make life a bit easier for myself, I shelved sorting out a BibTeX library, and just copied the references from the Word doc. Getting the citations to appear correctly was trickier than I thought it should be; it was easy enough to change the document settings so that the bibliography was ‘natbib’ format. But then I had no control over the precise display of the citation, e.g. (Mackenzie, 2011) versus Mackenzie (2011). I resorted to writing the TeX tags directly, aided by an excellent Natbib reference sheet. But then I got some errors when compiling the LyX document in PDF format. After a bit of digging, I determined that the \usepackage{natbib} had disappeared from the LaTeX preamble – other than entering it manually, I couldn’t figure out how to get it back.

Inserting a Header

Getting a header was also somewhat convoluted, and again involved dipping a reluctant toe into grimy TeX-infested waters. I had an intermediate problem in that the help within LyX is not searchable, which seems odd; but the interwebs told me that I needed to switch on fancy headers in the page layout settings, and then amend the preamble again (grrr) with \lhead{}, \chead{}, and \rhead{Tree Comparison - James E. Allen}. You need the empty definitions to suppress default headings, which seems more annoying than useful.


I used Word’s built-in PDF-saving (it’s version 2007, btw), and created two versions, with and without automatic hyphenation. (I also switched on kerning in the hyphenated doc, but I couldn’t see that it had any effect…) For the LyX document, I used the XeTeX PDF exporter, since I wanted to use my favourite Windows font, Georgia.

Tree Comparison: Word

Tree Comparison: Word (Hyphenated)

Tree Comparison: LyX


LyX wasn’t as straightforward as I’d hoped, but now that I’ve sorted a few teething issues, I think I could use it in future with a minimum of fuss. As to the results, I think the LyX-based document looks the best; the Word version without hyphenation looks quite gappy, and the automatic hyphenation isn’t great. The LyX file has too much whitespace above the title for my liking, and I’d prefer gaps between the paragraphs rather than indentation, but I daresay I can find a different layout that I like better. The wider margins make the text more readable, but it is odd that “weighted” juts out into the right margin; I couldn’t figure out why, but I could fix it by adding {sloppypar} tags around that paragraph. (The LaTeX wikibook is excellent for figuring out stuff like that.)

Tree Comparison

Throughout the course of my degree I have found it useful to write summaries of the various aspects of phylogenetics and biology that I have learned. That these will be useful to others is perhaps a vain hope, in both senses of the word, but I thought I might as well publish some of them on my blog. (It also afforded me the chance to try my hand at LyX/LaTeX.) For your reading convenience, this post is available as a pdf pdf.

Tree Comparison
Phylogenetic trees have two properties that can usefully be compared, their topologies and their branch lengths. Usually, the desired outcome of a tree comparison is a single number, indicating how different the trees are from one another. Reducing multiple complex structures to a single interpretable digit is difficult, even when just comparing two trees; a range of methods have been developed, most of which use (sometimes implicitly) graph theoretical measures of distance. Note that this is different from the situation of tree evaluation, where the aim is to determine whether some trees are a better representation of evolutionary history than others. Tree comparison is often done after evaluation, to gauge how much credence and importance to give to the results of the evaluation (there is, as yet, no method to state formally that the difference between trees is significant).

Felsenstein (2004, pp.528-535) provides a historical overview of phylogenetic tree comparison, starting with the symmetric difference metric, also known as the Robinson-Foulds (RF) distance, which measures differences in topology between a pair of (possibly multifurcating) trees (Robinson and Foulds, 1981). The symmetric difference can be conceptualised as the minimum number of transformations that are required to convert one tree to the other, where a transformation corresponds to either removing a branch and merging the nodes it connected, or by splitting a node into two and inserting a branch between the new nodes. The symmetric difference is widely used, but can be highly sensitive; that is, it can have a high value for trees which are intuitively similar (Felsenstein, 2004).

Including information on branch lengths in tree comparisons is potentially useful, particularly when the tree has a relatively wide range of branch lengths. The weighted Robinson-Foulds distance (Robinson and Foulds, 1979) and the branch score (Kuhner and Felsenstein, 1994) are two metrics that use branch length information, and both are based on the symmetric difference. The weighted RF distance is the sum of the differences between corresponding branch lengths; a branch length is considered to be zero if it does not exist in one of the trees. The branch score is similar, but squares the differences before adding them, and the square root of this sum is named the branch-length distance (BLD) (Felsenstein, 2004).

The pair of trees being compared can be mapped to two points in tree space, which suggests another distance metric, the geodesic distance, defined as the shortest path between two points in tree space. In tree space, the weighted RF distance and the BLD correspond to Manhattan and Euclidean distances, respectively (Kupczok et al., 2008). Calculating the geodesic distance may be computationally prohibitive for large trees, but good approximations are available (Kupczok et al., 2008).

All of the distances that use branch lengths will produce relatively high values if the branches in one tree tend to be larger, even if the topologies are very similar; that is, if the evolutionary rate differs between the trees. This behaviour may or may not be desirable, so to prevent differences in rate from having a disproportionate effect, Kuhner and Felsenstein (1994) suggested using relative branch lengths, dividing each branch length by the sum of all branch lengths. As far as I am aware, this has not been implemented in any publicly available software. The K score is a modification of the BLD that scales one tree to have similar global divergence to the other before calculating the BLD, but the scaling means that the K score is no longer mathematically defined as a distance, and its use is not always appropriate (Soria-Carrasco et al., 2007).

Citing this Document
[If referring to this document, please cite its location on the Monkeyshines website:]


  • Felsenstein, J. (2004) Inferring Phylogenies. Sinauer, Sunderland, Massachusetts.
  • Kuhner,M.K. and Felsenstein, J. (1994) A simulation comparison of phylogeny algorithms under equal and unequal evolutionary rates. Molecular Biology and Evolution, 11, 459-468. Pubmed
  • Kupczok, A. et al. (2008) An exact algorithm for the geodesic distance between phylogenetic trees. Journal of Computational Biology, 15, 577-591. Pubmed
  • Robinson, D.F. and Foulds, L.R. (1979) Comparison of weighted labelled trees. Lecture Notes in Mathematics, 748, 119-126.
  • Robinson, D.F. and Foulds, L.R. (1981) Comparison of phylogenetic trees. Mathematical Biosciences, 53, 131-147.
  • Soria-Carrasco, V. et al. (2007) The Ktree score: quantification of differences in the relative branch length and topology of phylogenetic trees. Bioinformatics, 23, 2954-2956. Pubmed

The War-and-Peace-O-Meter: Week Three

Previous weeks: 0, 1, 2

The battles in War and Peace have been good reading this week, although my progress has been somewhat stymied by the BBC. They’ve adapted Kate Atkinson’s Jackson Brodie novels (two of which I have previously reviewed: Case Histories and One Good Turn), which Mrs. Monkeyshines and I have enjoyed settling down to of a Sunday evening. The third novel, When Will There Be Good News? has been on my ‘to-read’ list for a while, and I wanted to get through it before I watch it on TV tonight. So that’s gobbled up most of my reading time this week; but I’m glad that it did, as I liked it the best of the three books. The strands of the story came together pleasingly, and as with the previous books, the narrative twists were unexpected yet plausible.

Our new telly turned up this week (a nice shiny LED flat screen), which was rather exciting for me – I’ve only ever bought one television before, about 10 years ago, and it was a big ole CRT as flat screens cost the same as a small car back then. Mrs. Monkeyshines and I finished watching the final season of 24 on the new screen – as with most of the latter series, there were ridiculous moments, but it was entertaining escapsim. And the foreknowledge that this series was the last provided the added tension of not knowing how it would end, whether Jack really would make it through day 8…

The War-and-Peace-O-Meter: Week Two

Previous weeks: 0, 1

Well into part two of volume one of War and Peace, and the men have gone off to war. Although as yet there’s been no actual fighting; I suspect that the marching, waiting around, and wonderfully frantic retreat are more typical of the realities of war. More pragmatically, I’m on page 150 – now that I’m into triple figures there’s no going back.

It’s been a relatively quiet week in the MonkeyShines household; Binky’s wobbly canine tooth necessitated another trip to the vets, which he did not enjoy, but he’s his usual sociable self, so isn’t too poorly. I’ve been wasting too much time playing Glitch, but figured I might as well enjoy it while it’s quiet on the home front…

“Dapper Socks” Mackenzie

Contemplating my dapper besocked paws

What a handsome devil!

The War-and-Peace-O-Meter: Week One

Last week I explained that I would be tracking my progress while I read War and Peace. I think I’ve done quite well in this first week, although I do feel like a bit of a lemon pulling it out of my bag on the bus. I’m getting to grips with the characters and their connections, and it’s really rather engagingly written.

Since an in-depth review of the book seems a bit redundant, I thought I might as well chronicle what’s going on in my life while I read War and Peace. I’ve had a good week, on the whole: I submitted my first first-authored paper to a journal, and bought a home cinema speaker system with some ill-gotten gains from a lucky punt on the football a few weeks ago. Binky did require a trip to the vets (dodgy tooth), but he now seems to be eating and sleeping better. And Mrs. MonkeyShines and I have been enjoying the anticipation of an exciting time later this month…