|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_TREE_FORMATS_PHYLOXML_COLOR_WRITER_PLUGIN_H_
2 #define GENESIS_TREE_FORMATS_PHYLOXML_COLOR_WRITER_PLUGIN_H_
100 throw std::length_error(
101 "Color vector does not have as many elements as the tree has edges."
139 void set_color_(
utils::XmlElement& element,
unsigned char r,
unsigned char g,
unsigned char b )
const
149 auto re = utils::make_unique< utils::XmlElement >(
"red");
152 auto ge = utils::make_unique< utils::XmlElement >(
"green");
155 auto be = utils::make_unique< utils::XmlElement >(
"blue");
158 auto color = utils::make_unique< utils::XmlElement >(
"color");
159 color->content.push_back(std::move(re));
160 color->content.push_back(std::move(ge));
161 color->content.push_back(std::move(be));
163 element.
content.push_back(std::move(color));
166 void set_color_( utils::XmlElement& element, utils::Color color )
const
168 set_color_( element, color.r_byte(), color.g_byte(), color.b_byte() );
176 #endif // include guard
void prepare_writing(Tree const &tree, utils::XmlDocument &xml) const
virtual ~PhyloxmlColorWriterPlugin() override=default
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...
size_t index() const
Return the index of this Edge.
utils::Color ignored_color() const
Return the currently set ignored color. See the setter for more information.
PhyloxmlColorWriterPlugin & operator=(PhyloxmlColorWriterPlugin const &)=default
std::string to_string(GenomeLocus const &locus)
void register_with(PhyloxmlWriter &writer) const
Class for representing phylogenetic trees.
bool enable_color() const
Returns whether colors tags are written to the output.
std::vector< std::unique_ptr< XmlValue > > content
Write a Tree to Phyloxml format.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
void edge_to_element(TreeEdge const &edge, utils::XmlElement &element) const
std::vector< prepare_writing_function > prepare_writing_plugins
Collect all functions to be called before starting the actual tree writing.
bool use_ignored_color() const
Return whether currently an ignored color is used.
PhyloxmlColorWriterPlugin()=default
Plugin class for PhyloXML output that allows coloring of edges.
Base class for creating plugin classes that allow coloring of Tree edges.
std::vector< utils::Color > const & edge_colors() const
Return the edge colors that are currently set.
A collection of classes for working with XML documents. See XmlDocument for more.
size_t edge_count() const
Return the number of TreeEdges of the Tree.