Input/Output
MolecularEvolution.write_nexus Function
write_nexus(fname::String,tree::FelNode)
Writes the tree as a nexus file, suitable for opening in eg. FigTree. Data in the node_data
dictionary will be converted into annotations. Only tested for simple node_data
formats and types.
MolecularEvolution.newick Function
newick(root)
Returns a newick string representation of the tree.
sourceMolecularEvolution.read_newick_tree Function
read_newick_tree(treefile)
Reads in a tree from a file, of type FelNode
sourceMolecularEvolution.populate_tree! Function
populate_tree!(tree::FelNode, starting_message, names, data; init_all_messages = true, tolerate_missing = 1, leaf_name_transform = x -> x)
Takes a tree, and a starting_message
(which will serve as the memory template for populating messages all over the tree). starting_message
can be a message (ie. a vector of Partitions), but will also work with a single Partition (although the tree) will still be populated with a length-1 vector of Partitions. Further, as long as obs2partition
is implemented for your Partition type, the leaf nodes will be populated with the data from data
, matching the names on each leaf. When a leaf on the tree has a name that doesn't match anything in names
, then if
tolerate_missing = 0
, an error will be throwntolerate_missing = 1
, a warning will be thrown, and the message will be set to the uninformative message (requires identity!(::Partition) to be defined)tolerate_missing = 2
, the message will be set to the uninformative message, without warnings (requires identity!(::Partition) to be defined)
A renaming function that can eg. strip tags from the tree when matching leaf names with names
can be passed to leaf_name_transform
MolecularEvolution.read_fasta Function
read_fasta(filepath::String)
Reads in a fasta file and returns a tuple of (seqnames, seqs).
sourceMolecularEvolution.write_fasta Function
write_fasta(filepath::String, sequences::Vector{String}; seq_names = nothing)
Writes a fasta file from a vector of sequences, with optional seq_names.
source