Wednesday, September 23, 2015

The Templeton Test in parsimony analysis: part 2, how to do it in PAUP and TNT

After discussing the Templeton Test in an earlier post, this post is about how to conduct it in practice.

Templeton Test in PAUP

It is fairly easy in PAUP. First have your data matrix in memory. Build your constraint using the command constraints NameOfConstraint = ((Taxon1, Taxon2, Taxon3)), in this case forcing taxa 1-3 into monophyly; the others do not have to be mentioned. Then search for the shortest trees consistent with the constraint using the same search strategies as for the overall best tree that you want to compare against. The search command needs to be given the parameters telling it to enforce the constraint, as in hsearch enforce=Yes constraint=NameOfConstraint addseq=random nreps=10, for example. Save resulting trees as usual.

Now randomly select one most parsimonious tree from unconstrained and one from constrained analysis, place them together in their own Nexus file, and import them (and only them) into PAUP, again with the data matrix in memory. Call the PAUP command pscores all / nonparamTest = yes testdetails = yes. This will conduct the Templeton Test. Remember the test tests for incongruence, so that a significant P value means that the longer tree from constrained analysis is significantly longer - or in other words, the group you are interested in is "significantly non-monophyletic", so to say.

Templeton Test in TNT

Unfortunately, and as mentioned before, I don't know any other software apart from PAUP that has the test implemented. So I spent a bit of my free time over the past two weeks and scripted the Templeton Test for TNT. It took some frustration tolerance, but I think it works now.

First, of course, one will have to get the two trees to compare against each other. For general search, refer to my post on parsimony analysis in TNT using the command line. To do a constrained analysis of e.g. taxon1, taxon2 and taxon3 forced into monophyly, use the commands force + [ taxon1 taxon2 taxon3 ] ; and constrain = ; , then search and export results as normal.

As in the case of PAUP, you need the data matrix in TNT's memory, and it is probably best to have the two trees to be tested against each other in one file. Using TNT's own file format, the file could for example look something like this:

mxram 200 ;
nstates DNA ;
nstates NOGAPS ;

xread
30 10
&[dna]
Argl    GTCGTTATGCTAGTATACGCCTACCCGTCA
Bargl   CCGGCCATCTGTGTGCAGATGGGGCGACGA
Cargl   GTTACTGGCCCTGATTTCTCCGCTTCTAAT
Dargl   ACCACACACTGGGCAATACGAGCTCAAGCC
Ergl    AGTCTCGCAGTAACGCTCATCAGCTAACGA
Fargl   AAGAGTTAGAGGCTCGCTAATTCGCACTGT
Gargl   CGGGGTCCCTTGGGTGTTTTGCACTAGCGT
Hargl   CAGGTAGGCTAGTATGTGTCTTTCCTTCCA
Irgl    GGGGTATGTGGCTGCGTGGTCAAATGTGCA
Jargl   GCATACGTATTTGCTCGGCGTGCTTGGTCT
;

tread
(Argl (Cargl (Jargl (Dargl (Fargl (Bargl (Ergl (Gargl (Hargl Irgl )))))))))*
(Argl (Bargl (Jargl (Dargl (Fargl (Cargl (Ergl (Gargl (Hargl Irgl )))))))));
proc /;


The file is read with the usual procedure YourFileName ; command. TNT should also be able to read Nexus files but I had some difficulty with that when I tried.

Anyway, when the two trees and the data matrix are in memory, all one needs to do is execute the Templeton Test script I have written with the procedure templetontest.tnt ; command. Because I had to explicitly give it a list of critical values, the script is a tad too long for this post, so it is available under this link.

Because it produces a bit of text output that you may want to keep, it might be good to activate a log file before running the script.

No comments:

Post a Comment