Phylogenies can be imported into MorphoJ in the form of NEXUS files. Phylogenetic information can then be used to understand the evolution of shape by mapping the shape variation among taxa onto the phylogeny and by computing independent contrasts among taxa and changes along the branches of the phylogeny (see Map Onto Phylogeny in the Comparison menu).
NEXUS files are the closest thing to a standard file format for phylogeny information that is currently available. NEXUS files are produced by programs such as Mesquite, PAUP*, MacClade and a range of others. A standard for NEXUS files has been published (Maddison et al. 1997), and MorphoJ has been written to comply with this standard.
Choosing the menu item Import Phylogeny File in the File menu will invoke the following dialog box:
The dialog box shows an interface for choosing a file from the computer. It is the user's responsibility to ensure that this file is a NEXUS file that conforms to the standard and contains at least one tree. Clicking the Open button will select the file and import it into MorphoJ.
As a result, one or more phylogenetic trees should appear in the Project Tree, named according to the information in the NEXUS file.
To check whether the trees have been imported correctly, you can invoke the popup menu for each of them and select 'Display Graphs'.
MorphoJ only reads the relevant part of the information in a NEXUS file and ignores the rest. Here is a simple example of a NEXUS file (from Maddison et al. 1997):
#NEXUS
BEGIN TAXA;
TaxLabels Scarabaeus Drosophila Aranaeus;
END;
BEGIN TREES;
Translate
beetle Scarabaeus, fly Drosophila, spider Aranaeus;
Tree tree1 = ((1,2),3);
Tree tree2 = ((beetle,fly),spider);
Tree tree3 = ((Scarabaeus,Drosophila),Aranaeus);
END;
The TAXA block, if it exists, is scanned for a TAXLABELS command providing information on taxon names.
The most important information is read from the TREES block. If no TREES block exists or if it contains no TREE command, no action is taken. If there is a TRANSLATE command, taxon names are read from it. Finally, all TREE commands in the block are read, and a tree is formed for each of them.
The taxon names can be read either from the TAXLABELS command of a TAXA block or from the TRANSLATE or TREE commands of the TREES block. The following are the rules for allocating taxon names:
1. If a taxon label in a TREE command occurs in the TAXLABELS command of the TAXA block, this label is used (the strings 'Scarabaeus', 'Drosophila' and 'Aranaeus' in the example above).
2. If a taxon label in a TREE command occurs in the TRANSLATE command of the TREES block, the translation corresponding to that label is used (for the labels 'beetle', 'fly' and 'spider' in the example above). If the labels in the TRANSLATE command are integer numbers, this takes precedence over the order of taxa in the TAXLABELS command of the TAXA block (rule 3).
3. If the label can be read as an integer value between 1 and the number of taxon names in the TAXLABELS command, the corresponding name is used ('Scarabaeus' for '1', 'Drosophila' for '2', and 'Aranaeus' for '3' in the example above).
4. Otherwise, the label in the TREE command is used directly.
As a result, all three trees in the example file are identical.
According to the NEXUS standard, underscores in taxon names are changed into spaces. For instance, 'Homo_sapiens' in a NEXUS file will therefore be read as 'Homo sapiens' and will be stored in the MorphoJ project in that way. The taxon name will therefore contain a space instead of the underscore. It is important to note that the classifier used to match the taxon name, in this example, also needs to contain a space and not an underscore.
This is no problem if you have used a text file to import the classifier variable that you intend to use for matching the taxon names with the phylogeny (or if you have extracted them from the identifiers). However, if you have imported the data from a file format that does not support labels containing spaces (e.g. Morphologika), you need to adjust the values of the corresponding classifier variable to replace the underscores by spaces (by using Edit Classifiers in the Preliminaries menu).
A standard for NEXUS files has been published (Maddison et al. 1997), but adherence to this standard is not good overall (see this report). Accordingly, the files produced as 'NEXUS files' by different programs can differ considerably, and whether they can be read correctly depends on the specific deviations from the standard.
MorphoJ checks for negative branch lengths and will not read trees with negative branch lengths. Branch lengths may be absent, zero or positive.
If there are difficulties with importing a NEXUS tree, a possibility to diagnose the problem might be to read the tree with another program reading NEXUS trees, for instance Mesquite. Possible error messages may be helpful for locating and fixing the problem.
Maddison, D. R., D. L. Swofford, and W. P. Maddison. 1997. NEXUS: an extensible file format for systematic information. Systematic Biology 46:590–621.