#include <genesis/sequence/formats/fasta_writer.hpp>
Write Fasta data.
This class provides simple facilities for writing Fasta data.
Exemplary usage:
std::string outfile = "path/to/file.fasta"; SequenceSet sequence_set; FastaWriter().line_length( 100 ).write( sequence_set, utils::to_file( outfile ));
See FastaReader for a description of the Fasta format.
Definition at line 67 of file fasta_writer.hpp.
Public Member Functions | |
| FastaWriter ()=default | |
| FastaWriter (FastaWriter &&)=default | |
| FastaWriter (FastaWriter const &)=default | |
| ~FastaWriter ()=default | |
| AbundanceNotation | abundance_notation () const |
| Get the current setting for how to write abundances. More... | |
| FastaWriter & | abundance_notation (AbundanceNotation value) |
| Set the notation for how to write Sequence abundances. More... | |
| size_t | line_length () const |
| Get the current line length. More... | |
| FastaWriter & | line_length (size_t value) |
| Set the line length, which determines after how many chars (Sequence sites) lines breaks are inserted when writing the Fasta file. More... | |
| FastaWriter & | operator= (FastaWriter &&)=default |
| FastaWriter & | operator= (FastaWriter const &)=default |
| void | write (Sequence const &sequence, std::shared_ptr< utils::BaseOutputTarget > target) const |
| Write a single Sequence to an output target, using the Fasta format. More... | |
| void | write (SequenceSet const &sequence_set, std::shared_ptr< utils::BaseOutputTarget > target) const |
| Write a SequenceSet to an output target, using the Fasta format. More... | |
| void | write_sequence (Sequence const &sequence, std::ostream &os) const |
| Write a single Sequence to an output stream in Fasta format. More... | |
Public Types | |
| enum | AbundanceNotation { kNone, kUnderscore, kSize } |
| Enumeration of types for how to write Sequence abundances. More... | |
|
default |
|
default |
|
default |
|
default |
| FastaWriter::AbundanceNotation abundance_notation | ( | ) | const |
Get the current setting for how to write abundances.
Definition at line 119 of file fasta_writer.cpp.
| FastaWriter & abundance_notation | ( | FastaWriter::AbundanceNotation | value | ) |
Set the notation for how to write Sequence abundances.
Default is to not write abundances. Use this setting to change that.
Definition at line 113 of file fasta_writer.cpp.
| size_t line_length | ( | ) | const |
Get the current line length.
See the setter line_length( size_t ) for details.
Definition at line 108 of file fasta_writer.cpp.
| FastaWriter & line_length | ( | size_t | value | ) |
Set the line length, which determines after how many chars (Sequence sites) lines breaks are inserted when writing the Fasta file.
Default is 80. If set to 0, no breaks are inserted. The functions returns the FastaWriter object to allow fluent interfaces.
Definition at line 102 of file fasta_writer.cpp.
|
default |
|
default |
| void write | ( | Sequence const & | sequence, |
| std::shared_ptr< utils::BaseOutputTarget > | target | ||
| ) | const |
Write a single Sequence to an output target, using the Fasta format.
See the output target convenience functions utils::to_file(), utils::to_stream(), and utils::to_string() for examples of how to obtain a suitable output target.
Definition at line 50 of file fasta_writer.cpp.
| void write | ( | SequenceSet const & | sequence_set, |
| std::shared_ptr< utils::BaseOutputTarget > | target | ||
| ) | const |
Write a SequenceSet to an output target, using the Fasta format.
See the output target convenience functions utils::to_file(), utils::to_stream(), and utils::to_string() for examples of how to obtain a suitable output target.
Definition at line 55 of file fasta_writer.cpp.
| void write_sequence | ( | Sequence const & | sequence, |
| std::ostream & | os | ||
| ) | const |
Write a single Sequence to an output stream in Fasta format.
Definition at line 63 of file fasta_writer.cpp.
|
strong |
Enumeration of types for how to write Sequence abundances.
| Enumerator | |
|---|---|
| kNone | Do not write abundances. This is the default. |
| kUnderscore | Write abundances appaneded by an underscore: |
| kSize | Write abundances appended as a text of the form |
Definition at line 78 of file fasta_writer.hpp.