Nexus file


The extensible NEXUS file format is widely used in phylogenetics, evolutionary biology, and bioinformatics. It stores information about taxa, morphological character states, DNA and protein sequence alignments, distances, and phylogenetic trees. The NEXUS format also allows the storage of data that can facilitate analyses, such as sets of characters or taxa. Many popular phylogenetic programs, including PAUP*, MrBayes, Mesquite, MacClade, and SplitsTree, use this format. Nexus file names typically have the extension .nxs or .nex.

Syntax

A NEXUS file is made out of a fixed header #NEXUS followed by multiple blocks. Each block starts with BEGIN block_name; and ends with END;. The keywords are case-insensitive. Comments are enclosed inside square brackets. Each of the pre-defined types of blocks may appear only once.
Block NameDescription
TAXASpecifies the OTUs in data set
CHARACTERSSpecifies the character data
DATAEquivalent to a CHARACTERS block that includes the NewTaxa subcommand in the Dimensions command
TREESStores trees in Newick format
DISTANCESStores distance matrices
SETSAssigns names to sets of characters or OTUs
ASSUMPTIONSAssumptions about the data or directions regarding data treatment

The following example NEXUS uses the TAXA, CHARACTERS, and TREES blocks:
#NEXUS
Begin TAXA;
Dimensions ntax=4;
TaxLabels Alpha Beta Gamma Delta;
End;
Begin CHARACTERS;
Dimensions nchar=15;
Format datatype=dna missing=? gap=- matchchar=.;
Matrix

Alpha
Beta
Gamma
Delta
;
End;
Begin TREES;
Tree tree1 = ;
END;