Loading...
Searching...
No Matches
seqan3::format_vienna Class Reference
IO » Structure File

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:
[legend]

## Public Member Functions

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

## Static Public Attributes

static std::vector< std::string > | file_extensions {{"dbn"}, {"fasta"}, {"fa"}}
| The valid file extensions for this format; note that you can modify this value.

## 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.
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.

## Additional Inherited Members

Related Symbols inherited from seqan3::structure_file_input_format< t >
static inline std::vector< std::string > | file_extensions
| The format type is required to provide a vector of all supported file extensions.
Related Symbols inherited from seqan3::structure_file_output_format< t >
static inline std::vector< std::string > | file_extensions
| The format type is required to provide a vector of all supported file extensions.

## 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.

Remarks
  For a complete overview, take a look at Structure File

## 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 )

inline protected

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

Template Parameters

  stream_type | Input stream, must satisfy seqan3::input_stream_over with char.
  seq_type | Type of the seqan3::field::seq input; must satisfy std::ranges::output_range over a seqan3::alphabet.
  id_type | Type of the seqan3::field::id input; must satisfy std::ranges::output_range over a seqan3::alphabet.
  bpp_type | Type 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_type | Type of the seqan3::field::structure input; must satisfy std::ranges::output_range over a seqan3::rna_structure_alphabet.
  energy_type | Type of the seqan3::field::energy input; must satisfy std::is_floating_point.
  react_type | Type of the seqan3::field::react and seqan3::field::react_err input; must satisfy std::is_floating_point.
  comment_type | Type of the seqan3::field::comment input; must satisfy std::ranges::output_range over a seqan3::alphabet.
  offset_type | Type of the seqan3::field::offset input; must satisfy std::numeric_limits::is_integer.

Parameters

  [in,out] | stream | The input stream to read from.
  [in] | options | File specific options passed to the format.
  [out] | seq | The buffer for seqan3::field::seq input, i.e. the "sequence".
  [out] | id | The buffer for seqan3::field::id input, e.g. the header line.
  [out] | bpp | The buffer for seqan3::field::bpp input.
  [out] | structure | The buffer for seqan3::field::structure input.
  [out] | energy | The buffer for seqan3::field::energy input.
  [out] | react | The buffer for seqan3::field::react input.
  [out] | react_err | The buffer for seqan3::field::react_err input.
  [out] | comment | The buffer for seqan3::field::comment input.
  [out] | offset | The buffer for seqan3::field::offset input.

### Additional requirements

- The function must also accept std::ignore as parameter for any of the fields. [This is enforced by the concept checker!]
- In this case the data read for that field shall be discarded by the format.
- Instead of passing the fields seqan3::field::seq and seqan3::field::structure, you may also pass seqan3::field::structured_seq to both parameters. If you do, the std::ranges::range_value_t of the argument must be a specialisation of seqan3::structured_rna and the second template parameter to seqan3::structure_file_input_options must be set to true.

Implements seqan3::structure_file_input_format< t >.

## 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 )

inline protected

Write the given fields to the specified stream.

Template Parameters

  stream_type | Output stream, must satisfy seqan3::output_stream_over with char.
  seq_type | Type of the seqan3::field::seq output; must satisfy std::ranges::output_range over a seqan3::alphabet.
  id_type | Type of the seqan3::field::id output; must satisfy std::ranges::output_range over a seqan3::alphabet.
  bpp_type | Type 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_type | Type of the seqan3::field::structure output; must satisfy std::ranges::output_range over a seqan3::rna_structure_alphabet.
  energy_type | Type of the seqan3::field::energy output; must satisfy std::is_floating_point.
  react_type | Type of the seqan3::field::react and seqan3::field::react_err output; must satisfy std::is_floating_point.
  comment_type | Type of the seqan3::field::comment output; must satisfy std::ranges::output_range over a seqan3::alphabet.
  offset_type | Type of the seqan3::field::offset output; must satisfy std::numeric_limits::is_integer.

Parameters

  [in,out] | stream | The output stream to write into.
  [in] | options | File specific options passed to the format.
  [in] | seq | The data for seqan3::field::seq output, i.e. the "sequence".
  [in] | id | The data for seqan3::field::id output, e.g. the header line.
  [in] | bpp | The data for seqan3::field::bpp output.
  [in] | structure | The data for seqan3::field::structure output.
  [in] | energy | The data for seqan3::field::energy output.
  [in] | react | The data for seqan3::field::react output.
  [in] | react_err | The data for seqan3::field::react_err output.
  [in] | comment | The data for seqan3::field::comment output.
  [in] | offset | The 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< t >.

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

- format_vienna.hpp

Hide me