|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
53 print_sequence_( out, seq );
62 ? std::min( sequence_limit_, set.
size() )
70 label_len = std::max( label_len, set[i].label().size() );
76 print_sequence_( out, set[i], label_len );
88 std::ostringstream res;
96 std::ostringstream res;
119 sequence_limit_ = value;
125 return sequence_limit_;
130 line_length_ = value;
141 length_limit_ = value;
147 return length_limit_;
187 void PrinterSimple::print_character_(
195 auto color = color_map_.at( site );
202 out << utils::Style(
"black", color )( std::string( 1, site ) );
214 void PrinterSimple::print_sites_(
220 ? std::min( length_limit_, seq.length() )
227 if( l > 0 && line_length_ > 0 && l % line_length_ == 0 ) {
231 print_character_( out, seq[l] );
235 out << ( seq.length() >
length_limit ?
" ...\n" :
"\n" );
238 void PrinterSimple::print_sequence_(
245 out << seq.label() <<
"\n";
248 out << seq.label() <<
": ";
249 if( label_len > 0 && seq.label().size() > label_len ) {
250 out << std::string( label_len - seq.label().size(),
' ' );
254 print_sites_( out, seq );
std::map< char, std::string > const & color_map() const
Get the currently set list of colors for each Sequence character.
@ kSameLine
The label is printed on the line where the Sequence sites start, separated from them by ": ".
std::string operator()(Sequence const &seq) const
Return a string representing the print of a single Sequence.
size_t sequence_limit() const
Get the currently set limit for how many Sequences to print.
double length(Tree const &tree)
Get the length of the tree, i.e., the sum of all branch lengths.
void print(std::ostream &out, Sequence const &seq) const
Print a single Sequence to a stream.
@ kNone
No color, even if a color_map() is provided.
Simple printer class for Sequences and SequenceSets.
Provides some commonly used string utility functions.
LabelMode
Modes for how to print Sequence labels.
size_t length_limit() const
Get the currently set length limit.
ColorMode
Modes for how the Sequence sites are colored.
Simple text style class for colorized and bold output to a terminal.
size_t line_length() const
Get the currently set line length, i.e., when to wrap.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Store a set of Sequences.
@ kSeparateLine
The label is printed on a line preceeding the Sequence sites.
ColorMode color_mode() const
Get the currently set color mode.
@ kForeground
Color the text foreground of the characters, leave the background at default.
@ kBackground
Color the text background of the characters, set the foreground to black.
LabelMode label_mode() const
Get the currently set LabelMode.