SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
seqan3::format_vienna Class Reference

The Vienna format (dot bracket notation) for RNA sequences with secondary structure. More...

#include <seqan3/io/structure_file/format_vienna.hpp>

+ Inheritance diagram for seqan3::format_vienna:

Public Member Functions

Constructors, destructor and assignment
 format_vienna () noexcept=default
 Defaulted.
 
 format_vienna (format_vienna const &) noexcept=default
 Defaulted.
 
format_viennaoperator= (format_vienna const &) noexcept=default
 Defaulted.
 
 format_vienna (format_vienna &&) noexcept=default
 Defaulted.
 
format_viennaoperator= (format_vienna &&) noexcept=default
 Defaulted.
 
 ~format_vienna () noexcept=default
 

Static Public Attributes

static std::vector< std::stringfile_extensions
 The valid file extensions for this format; note that you can modify this value. More...
 

Protected Member Functions

template<typename stream_type , typename seq_legal_alph_type , bool structured_seq_combined, typename seq_type , typename id_type , typename bpp_type , typename structure_type , typename energy_type , typename react_type , typename comment_type , typename offset_type >
void read_structure_record (stream_type &stream, structure_file_input_options< seq_legal_alph_type, structured_seq_combined > const &options, seq_type &seq, id_type &id, bpp_type &bpp, structure_type &structure, energy_type &energy, react_type &react, react_type &react_err, comment_type &comment, offset_type &offset)
 Read from the specified stream and back-insert into the given field buffers. More...
 
template<typename stream_type , typename seq_type , typename id_type , typename bpp_type , typename structure_type , typename energy_type , typename react_type , typename comment_type , typename offset_type >
void write_structure_record (stream_type &stream, structure_file_output_options const &options, seq_type &&seq, id_type &&id, bpp_type &&bpp, structure_type &&structure, energy_type &&energy, react_type &&react, react_type &&react_err, comment_type &&comment, offset_type &&offset)
 Write the given fields to the specified stream. More...
 

Detailed Description

The Vienna format (dot bracket notation) for RNA sequences with secondary structure.

Introduction

Dot Bracket or Vienna Notation is widely used for secondary structure annotation. Is is a very simple format, containing one or more sequences. Each sequence must appear as a single line in the file. A sequence may be preceded by a special line starting with the '>' character followed by a sequence name (like FastA). After each sequence line there is usually a line containing secondary structure, using brackets to denote interacting nucleotides or amino acids, and dots for unpaired sites. The length of the struture must equal the length of the sequence. Optionally, the structure may be followed by a space character and the minimum free energy value enclosed in parentheses (). Note that there cannot be energy without structure.

The Vienna format is the output format of RNAfold. Furthermore, it is designed to be compatible with the input format of the ViennaRNA package (if structure and energy are omitted). See https://www.tbi.univie.ac.at/RNA/tutorial/#sec2_7 for details.

fields_specialisation

The Vienna format provides the fields seqan3::field::seq, seqan3::field::id, seqan3::field::bpp (read only), seqan3::field::structure, seqan3::field::structured_seq and seqan3::field::energy.

If you select seqan3::field::structured_seq you must not select seqan3::field::seq or seqan3::field::structure.
Either the field seqan3::field::seq or the field seqan3::field::structured_seq is required when writing.
The field seqan3::field::bpp is ignored when writing, but a structure string can be converted to bpp when reading.

Implementation notes

When reading the ID-line the identifier (>) and any blank characters before the actual ID are stripped. Each field is read/written as a single line (except ENERGY, which goes right after the structure). Numbers and spaces within the sequence are simply ignored, but not within the structure.

Constructor & Destructor Documentation

◆ ~format_vienna()

seqan3::format_vienna::~format_vienna ( )
defaultnoexcept

Defaulted.

Member Function Documentation

◆ read_structure_record()

template<typename stream_type , typename seq_legal_alph_type , bool structured_seq_combined, typename seq_type , typename id_type , typename bpp_type , typename structure_type , typename energy_type , typename react_type , typename comment_type , typename offset_type >
void seqan3::format_vienna::read_structure_record ( stream_type &  stream,
structure_file_input_options< seq_legal_alph_type, structured_seq_combined > const &  options,
seq_type &  seq,
id_type &  id,
bpp_type &  bpp,
structure_type &  structure,
energy_type &  energy,
react_type &  react,
react_type &  react_err,
comment_type &  comment,
offset_type &  offset 
)
inlineprotected

Read from the specified stream and back-insert into the given field buffers.

Template Parameters
stream_typeInput stream, must satisfy seqan3::Istream with char.
seq_typeType of the seqan3::field::seq input; must satisfy std::ranges::output_range over a seqan3::alphabet.
id_typeType of the seqan3::field::id input; must satisfy std::ranges::output_range over a seqan3::alphabet.
bpp_typeType of the seqan3::field::bpp input; must satisfy std::ranges::output_range over a set of pair of types satisfying std::is_floating_point and std::numeric_limits::is_integer, respectively.
structure_typeType of the seqan3::field::structure input; must satisfy std::ranges::output_range over a seqan3::rna_structure_alphabet.
energy_typeType of the seqan3::field::energy input; must satisfy std::is_floating_point.
react_typeType of the seqan3::field::react and seqan3::field::react_err input; must satisfy std::is_floating_point.
comment_typeType of the seqan3::field::comment input; must satisfy std::ranges::output_range over a seqan3::alphabet.
offset_typeType of the seqan3::field::offset input; must satisfy std::numeric_limits::is_integer.
Parameters
[in,out]streamThe input stream to read from.
[in]optionsFile specific options passed to the format.
[out]seqThe buffer for seqan3::field::seq input, i.e. the "sequence".
[out]idThe buffer for seqan3::field::id input, e.g. the header line.
[out]bppThe buffer for seqan3::field::bpp input.
[out]structureThe buffer for seqan3::field::structure input.
[out]energyThe buffer for seqan3::field::energy input.
[out]reactThe buffer for seqan3::field::react input.
[out]react_errThe buffer for seqan3::field::react_err input.
[out]commentThe buffer for seqan3::field::comment input.
[out]offsetThe buffer for seqan3::field::offset input.

Additional requirements

Implements seqan3::structure_file_input_format.

◆ write_structure_record()

template<typename stream_type , typename seq_type , typename id_type , typename bpp_type , typename structure_type , typename energy_type , typename react_type , typename comment_type , typename offset_type >
void seqan3::format_vienna::write_structure_record ( stream_type &  stream,
structure_file_output_options const &  options,
seq_type &&  seq,
id_type &&  id,
bpp_type &&  bpp,
structure_type &&  structure,
energy_type &&  energy,
react_type &&  react,
react_type &&  react_err,
comment_type &&  comment,
offset_type &&  offset 
)
inlineprotected

Write the given fields to the specified stream.

Template Parameters
stream_typeOutput stream, must satisfy seqan3::output_stream_over with char.
seq_typeType of the seqan3::field::seq output; must satisfy std::ranges::output_range over a seqan3::alphabet.
id_typeType of the seqan3::field::id output; must satisfy std::ranges::output_range over a seqan3::alphabet.
bpp_typeType of the seqan3::field::bpp output; must satisfy std::ranges::output_range over a set of pair of types satisfying std::is_floating_point and std::numeric_limits::is_integer, respectively.
structure_typeType of the seqan3::field::structure output; must satisfy std::ranges::output_range over a seqan3::rna_structure_alphabet.
energy_typeType of the seqan3::field::energy output; must satisfy std::is_floating_point.
react_typeType of the seqan3::field::react and seqan3::field::react_err output; must satisfy std::is_floating_point.
comment_typeType of the seqan3::field::comment output; must satisfy std::ranges::output_range over a seqan3::alphabet.
offset_typeType of the seqan3::field::offset output; must satisfy std::numeric_limits::is_integer.
Parameters
[in,out]streamThe output stream to write into.
[in]optionsFile specific options passed to the format.
[in]seqThe data for seqan3::field::seq output, i.e. the "sequence".
[in]idThe data for seqan3::field::id output, e.g. the header line.
[in]bppThe data for seqan3::field::bpp output.
[in]structureThe data for seqan3::field::structure output.
[in]energyThe data for seqan3::field::energy output.
[in]reactThe data for seqan3::field::react output.
[in]react_errThe data for seqan3::field::react_err output.
[in]commentThe data for seqan3::field::comment output.
[in]offsetThe data for seqan3::field::offset output.

Additional requirements

  • The format must also accept std::ignore as parameter for any of the fields, however it shall throw an exception if one of the fields required for writing the format is marked as such. [this shall be checked inside the function]
  • The format does not handle seqan3::field::structured_seq, instead seqan3::structure_file_output splits it into two views and passes it to the format as if they were separate.

Implements seqan3::structure_file_output_format.

Member Data Documentation

◆ file_extensions

std::vector<std::string> seqan3::format_vienna::file_extensions
inlinestatic
Initial value:
{
{ "dbn" },
{ "fasta" },
{ "fa" }
}

The valid file extensions for this format; note that you can modify this value.


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