Rev Language Reference


writeNexus - Nexus file writer

Function for writing a nexus file.

Usage

writeNexus(String filename, AbstractHomologousDiscreteCharacterData data)

Arguments

filename : String (pass by value)
The name of the file.
data : AbstractHomologousDiscreteCharacterData (pass by value)
The character data matrix to print.

Return Type

Details

The first argument is the filename to write to and this must be a string. The second argument is a data object that must be some character matrix. This data matrix could be a morphological matrix, a molecular matrix, or a tree.

Example

# let's make up some taxa
taxa = v("horse", "whale", "unicorn", "narwhal")
# simulate a tree
tau ~ dnUniformTimeTree(rootAge=1, taxa=taxa)
# we also need a molecular substitution model
molecular_model := fnJC(4)
# together these form a continuous time Markov chain over the tree
full_model ~ dnPhyloCTMC(tree=tau, Q=molecular_model, nSites = 100, type="DNA")
# this will print a Nexus file with a simulated molecular matrix
# to the working directory
writeNexus(filename="test.nex", full_model)

See Also