Rev Language Reference

writeFasta - FASTA file writing function

This function writes out a FASTA formatted file given data of class `AbstractHomologousDiscreteCharacterData`. Filename is specified using the `fn` argument.


writeFasta(String filename, AbstractHomologousDiscreteCharacterData data)


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

Return Type


# let's make up some taxa
taxa = v("horse", "whale", "unicorn", "narwhal")
# convert these to the taxon datatype
for(i in 1:4) { taxa[i] = taxon(taxa[i]) }
# 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 FASTA file with a simulated molecular matrix
# to the working directory
writeFasta(filename="test.fasta", full_model)

See Also