|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
69 prepare_plugin( tree, xml );
79 xml.
attributes.emplace(
"xmlns:xsi",
"http://www.w3.org/2001/XMLSchema-instance");
82 "http://www.phyloxml.org http://www.phyloxml.org/1.10/phyloxml.xsd"
84 xml.
attributes.emplace(
"xmlns",
"http://www.phyloxml.org");
87 auto phylogeny = utils::make_unique< utils::XmlElement >();
88 phylogeny->tag =
"phylogeny";
89 phylogeny->attributes.emplace(
"rooted",
"true");
93 std::vector< utils::XmlElement* > stack;
94 stack.push_back(phylogeny.get());
95 xml.
content.push_back(std::move(phylogeny));
104 assert(depths[it.node().index()] <= cur_d + 1);
107 while (cur_d >= depths[it.node().index()] && depths[it.node().index()] > 0) {
108 assert(stack.size() > 0);
114 cur_d = depths[it.node().index()];
118 auto clade = utils::make_unique< utils::XmlElement >();
119 clade->tag =
"clade";
123 node_plugin( it.node(), *clade.get() );
126 edge_plugin( it.edge(), *clade.get() );
131 auto clade_ptr = clade.get();
132 stack.back()->content.push_back(std::move(clade));
133 stack.push_back(clade_ptr);
138 finish_plugin( tree, xml );
Provides functions for accessing the file system.
std::vector< edge_to_element_function > edge_to_element_plugins
Collect all functions to be called for each TreeEdge in order to translate it to a Phyloxml represent...
std::vector< node_to_element_function > node_to_element_plugins
Collect all functions to be called for each TreeNode in order to translate it to a Phyloxml represent...
void write(XmlDocument const &document, std::shared_ptr< utils::BaseOutputTarget > target) const
void write(Tree const &tree, std::shared_ptr< utils::BaseOutputTarget > target) const
Write a Tree to an output target, using the Phyloxml format.
utils::Range< IteratorPreorder< true > > preorder(ElementType const &element)
void to_document(Tree const &tree, utils::XmlDocument &xml) const
Store the information of the tree into an Phyloxml-formatted XmlDocument.
Provides some valuable additions to STD.
Class for representing phylogenetic trees.
Provides easy and fast logging functionality.
std::vector< std::unique_ptr< XmlValue > > content
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
std::vector< prepare_writing_function > prepare_writing_plugins
Collect all functions to be called before starting the actual tree writing.
std::vector< finish_writing_function > finish_writing_plugins
Collect all functions to be called after finishing the actual tree writing.
A collection of classes for working with XML documents. See XmlDocument for more.
Header of Tree distance methods.
std::vector< size_t > node_path_length_vector(Tree const &tree, TreeNode const &node)
Return a vector containing the depth of all nodes with respect to the given start node.