A toolkit for working with phylogenetic data.
v0.19.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PhylipWriter Class Reference

#include <genesis/sequence/formats/phylip_writer.hpp>

Detailed Description

Definition at line 50 of file phylip_writer.hpp.

Public Member Functions

 PhylipWriter ()=default
 
 PhylipWriter (PhylipWriter const &)=default
 
 PhylipWriter (PhylipWriter &&)=default
 
 ~PhylipWriter ()=default
 
PhylipWriterlabel_length (size_t value)
 Set the length of the label in front of the sequences. More...
 
size_t label_length () const
 Return the currently set label length. More...
 
PhylipWriterline_length (size_t value)
 Set the line length, which determines after how many chars (Sequence sites) lines breaks are inserted when writing the Phylip file. More...
 
size_t line_length () const
 Get the current line length. More...
 
PhylipWriteroperator= (PhylipWriter const &)=default
 
PhylipWriteroperator= (PhylipWriter &&)=default
 
void to_file (SequenceSet const &sset, std::string const &fn) const
 Write Sequences of a SequenceSet to a file in Phylip format. More...
 
void to_stream (SequenceSet const &sset, std::ostream &os) const
 Write Sequences of a SequenceSet to a stream in Phylip format. More...
 
std::string to_string (SequenceSet const &sset) const
 Return Sequences of a SequenceSet in form of a Phylip formatted string. More...
 

Constructor & Destructor Documentation

PhylipWriter ( )
default
~PhylipWriter ( )
default
PhylipWriter ( PhylipWriter const &  )
default
PhylipWriter ( PhylipWriter &&  )
default

Member Function Documentation

PhylipWriter & label_length ( size_t  value)

Set the length of the label in front of the sequences.

Phylip has the weird property that labels are written in front of sequences and do not need to have a delimiter, but instead are simply the first n characters of the string. This value determines after how many chars the label ends and the actual sequence begins.

If set to 0 (default), a relaxed version of Phylip is used, where the sequence begin is automatically detected. Labels can then be of arbitrary lengths, as long as they do not contain white spaces. After the label, a space is appended.

If set to a value greater than 0, the label will be cut off after that many chars. For shorter labels, the remaining number is filled with spaces. The functions returns the PhylipWriter object to allow fluent interfaces.

Definition at line 152 of file phylip_writer.cpp.

size_t label_length ( ) const

Return the currently set label length.

See the setter label_length( size_t ) for details.

Definition at line 163 of file phylip_writer.cpp.

PhylipWriter & line_length ( size_t  value)

Set the line length, which determines after how many chars (Sequence sites) lines breaks are inserted when writing the Phylip file.

Default is 80. If set to 0, no breaks are inserted. The functions returns the PhylipWriter object to allow fluent interfaces.

Definition at line 175 of file phylip_writer.cpp.

size_t line_length ( ) const

Get the current line length.

See the setter line_length( size_t ) for details.

Definition at line 186 of file phylip_writer.cpp.

PhylipWriter& operator= ( PhylipWriter const &  )
default
PhylipWriter& operator= ( PhylipWriter &&  )
default
void to_file ( SequenceSet const &  sset,
std::string const &  filename 
) const

Write Sequences of a SequenceSet to a file in Phylip format.

If the file cannot be written to, the function throws an exception. Also, by default, if the file already exists, an exception is thrown. See Options::allow_file_overwriting() to change this behaviour.

Definition at line 113 of file phylip_writer.cpp.

void to_stream ( SequenceSet const &  sset,
std::ostream &  os 
) const

Write Sequences of a SequenceSet to a stream in Phylip format.

Definition at line 62 of file phylip_writer.cpp.

std::string to_string ( SequenceSet const &  sset) const

Return Sequences of a SequenceSet in form of a Phylip formatted string.

Caveat: This might be a long string! If you simply want to examine a Sequence or SequenceSet, have a look at the print() and print_color() functions.

Definition at line 126 of file phylip_writer.cpp.


The documentation for this class was generated from the following files: