|
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_NEWICK_WRITER_H_
2 #define GENESIS_TREE_FORMATS_NEWICK_WRITER_H_
54 struct NewickBrokerElement;
174 void write(
Tree const& tree, std::shared_ptr<utils::BaseOutputTarget> target )
const;
189 std::shared_ptr<utils::BaseOutputTarget> target,
190 bool with_names =
false
262 quotation_mark_ = value;
273 return quotation_mark_;
286 force_quot_marks_ = value;
297 return force_quot_marks_;
313 line_length_ = value;
339 trailing_new_line_ = value;
351 return trailing_new_line_;
362 write_names_ = value;
384 write_values_ = value;
395 return write_values_;
406 write_comments_ = value;
417 return write_comments_;
455 void write(
NewickBroker const& broker, std::shared_ptr<utils::BaseOutputTarget> target )
const;
479 bool force_quot_marks_ =
false;
480 char quotation_mark_ =
'\"';
481 size_t line_length_ = 0;
482 bool trailing_new_line_ =
true;
484 bool write_names_ =
true;
485 bool write_values_ =
true;
486 bool write_comments_ =
true;
487 bool write_tags_ =
true;
494 #endif // include guard
NewickWriter & quotation_mark(char value)
Set the type of quotation marks used for node names that contain special characters.
NewickBroker tree_to_broker(Tree const &tree) const
Transform the information of the tree into a NewickBroker object.
NewickWriter & write_names(bool value)
Set whether to write Newick node names.
std::function< void(TreeNode const &node, NewickBrokerElement &element) > node_to_element_function
Function type that translates from a TreeNode to a NewickBrokerElement.
NewickWriter & trailing_new_line(bool value)
Set whether to write a new line char \n at the end of each tree.
NewickWriter & force_quotation_marks(bool value)
If set to true, all names are wrapped in quotation marks, regardless of whether the name contains any...
NewickWriter & operator=(NewickWriter const &)=default
std::vector< finish_writing_function > finish_writing_plugins
Collect all functions to be called after finishing the actual tree writing.
NewickWriter & line_length(size_t value)
Set the approximate maximal line length to use when writing Newick trees.
Write a Tree to Newick format.
char quotation_mark() const
Get the currently set type of quotation marks used for node names.
NewickWriter & write_tags(bool value)
Set whether to write Newick tags (e.g., for jplace files).
std::vector< prepare_writing_function > prepare_writing_plugins
Collect all functions to be called before starting the actual tree writing.
tree::TreeSet tree_set(SampleSet const &sample_set)
Return a TreeSet containing all the trees of the SampleSet.
bool write_comments() const
Get whether Newick comments (e.g., some forms of bootstrap values) are written.
void write(Tree const &tree, std::shared_ptr< utils::BaseOutputTarget > target) const
Write a Tree to an output target, using the Newick format.
Class for representing phylogenetic trees.
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 Newick representat...
std::string to_string(Tree const &tree) const
Shorthand to write a Tree to Newick format and return it is a string.
bool write_tags() const
Get whether Newick tags (e.g., for jplace files) are written.
bool write_values() const
Get whether Newick values (e.g., branch lengths) are written.
std::function< void(TreeEdge const &edge, NewickBrokerElement &element) > edge_to_element_function
Function type that translates from a TreeEdge to a NewickBrokerElement.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Stores a Newick tree in an intermediate format that can be further processed into a Tree.
NewickWriter & write_values(bool value)
Set whether to write Newick values (e.g., branch lengths).
size_t line_length() const
Get the currently set approximate maximal line length.
bool force_quotation_marks() const
Get whether all names are wrapped in quotation marks.
bool write_names() const
Get whether Newick node names are written.
virtual ~NewickWriter()=default
Store the information for one element of a Newick tree.
std::function< void(Tree const &tree, NewickBroker &broker) > prepare_writing_function
Function type that allows to do some preparatory work with the Tree and NewickBroker before the actua...
std::function< void(Tree const &tree, NewickBroker &broker) > finish_writing_function
Function type that allows to do some finalizing work with the Tree and NewickBroker after the actual ...
NewickWriter & write_comments(bool value)
Set whether to write Newick comments (e.g., some forms of bootstrap values).
bool trailing_new_line() const
Get the current setting for whether a new line char \n is written to the end of each tree.
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 Newick representat...