SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::dssp9 Class Reference

The protein structure alphabet of the characters "HGIEBTSCX". More...

#include <seqan3/alphabet/structure/dssp9.hpp>

+ Inheritance diagram for seqan3::dssp9:

Public Member Functions

Constructors, destructor and assignment
constexpr dssp9 () noexcept=default
 Defaulted.
 
constexpr dssp9 (dssp9 const &) noexcept=default
 Defaulted.
 
constexpr dssp9 (dssp9 &&) noexcept=default
 Defaulted.
 
constexpr dssp9operator= (dssp9 const &) noexcept=default
 Defaulted.
 
constexpr dssp9operator= (dssp9 &&) noexcept=default
 Defaulted.
 
 ~dssp9 () noexcept=default
 Defaulted.
 
- Public Member Functions inherited from seqan3::alphabet_base< dssp9, 9 >
constexpr alphabet_base () noexcept=default
 Defaulted.
 
constexpr alphabet_base (alphabet_base const &) noexcept=default
 Defaulted.
 
constexpr alphabet_base (alphabet_base &&) noexcept=default
 Defaulted.
 
constexpr alphabet_baseoperator= (alphabet_base const &) noexcept=default
 Defaulted.
 
constexpr alphabet_baseoperator= (alphabet_base &&) noexcept=default
 Defaulted.
 
 ~alphabet_base () noexcept=default
 Defaulted.
 
constexpr char_type to_char () const noexcept
 Return the letter as a character of char_type.
 
constexpr rank_type to_rank () const noexcept
 Return the letter's numeric value (rank in the alphabet).
 
constexpr dssp9assign_char (char_type const chr) noexcept
 Assign from a character, implicitly converts invalid characters.
 
constexpr dssp9assign_rank (rank_type const c) noexcept
 Assign from a numeric value.
 

Private Types

using base_t = alphabet_base< dssp9, 9 >
 The base class.
 

Static Private Member Functions

static constexpr rank_type char_to_rank (char_type const chr)
 Returns the rank representation of character.
 
static constexpr char_type rank_to_char (rank_type const rank)
 Returns the character representation of rank.
 

Private Attributes

friend base_t
 Befriend seqan3::alphabet_base.
 

Static Private Attributes

static constexpr std::array< rank_type, 256 > char_to_rank_table
 The lookup table used in char_to_rank.
 
static constexpr char_type rank_to_char_table [alphabet_size] {'H', 'B', 'E', 'G', 'I', 'T', 'S', 'C', 'X'}
 The lookup table used in rank_to_char.
 

Related Symbols

(Note that these are not member symbols.)

Structure literals
constexpr dssp9 operator""_dssp9 (char const ch) noexcept
 The seqan3::dssp9 char literal.
 
constexpr std::vector< dssp9operator""_dssp9 (char const *str, std::size_t len)
 The seqan3::dssp9 string literal.
 

Additional Inherited Members

- Static Public Attributes inherited from seqan3::alphabet_base< dssp9, 9 >
static constexpr detail::min_viable_uint_t< size > alphabet_size
 The size of the alphabet, i.e. the number of different values it can take.
 
- Protected Types inherited from seqan3::alphabet_base< dssp9, 9 >
using char_type = std::conditional_t< std::same_as< char, void >, char, char >
 The char representation; conditional needed to make semi alphabet definitions legal.
 
using rank_type = detail::min_viable_uint_t< size - 1 >
 The type of the alphabet when represented as a number (e.g. via to_rank()).
 

Detailed Description

The protein structure alphabet of the characters "HGIEBTSCX".

The DSSP annotation links structure elements to protein sequences. Originally created with 7 letters as a file format for the DSSP program (https://swift.cmbi.umcn.nl/gv/dssp/), it is also used in the stockholm file format for structure alignments, extended by the characters C and X (https://en.wikipedia.org/wiki/Stockholm_format).

The letter abbreviations are as follows:

H = alpha helix B = beta bridge E = strand G = helix-3 I = helix-5 T = turn S = bend C = coil/loop X = unknown

Example

// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
int main()
{
using namespace seqan3::literals;
seqan3::dssp9 letter{'H'_dssp9};
letter.assign_char('B');
seqan3::debug_stream << letter << '\n'; // prints "B"
letter.assign_char('F'); // Unknown characters are implicitly converted to 'X'.
seqan3::debug_stream << letter << '\n'; // prints "X"
}
constexpr derived_type & assign_char(char_type const chr) noexcept
Assign from a character, implicitly converts invalid characters.
Definition alphabet_base.hpp:160
The protein structure alphabet of the characters "HGIEBTSCX".
Definition dssp9.hpp:59
Provides seqan3::debug_stream and related types.
Provides the dssp format for protein structure.
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition debug_stream.hpp:37
The SeqAn namespace for literals.

This entity is experimental and subject to change in the future. Experimental since version 3.1.

Member Function Documentation

◆ char_to_rank()

static constexpr rank_type seqan3::dssp9::char_to_rank ( char_type const  chr)
inlinestaticconstexprprivate

Returns the rank representation of character.

This function is required by seqan3::alphabet_base.

◆ rank_to_char()

static constexpr char_type seqan3::dssp9::rank_to_char ( rank_type const  rank)
inlinestaticconstexprprivate

Returns the character representation of rank.

This function is required by seqan3::alphabet_base.

Friends And Related Symbol Documentation

◆ operator""_dssp9() [1/2]

constexpr std::vector< dssp9 > operator""_dssp9 ( char const *  str,
std::size_t  len 
)
related

The seqan3::dssp9 string literal.

Parameters
[in]strA pointer to the character string to assign.
[in]lenThe size of the character string to assign.
Returns
std::vector<seqan3::dssp9>

You can use this string literal to easily assign to std::vector<seqan3::dssp9>:

// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
int main()
{
using namespace seqan3::literals;
std::vector<seqan3::dssp9> sequence1{"EHHHHT"_dssp9};
std::vector<seqan3::dssp9> sequence2 = "EHHHHT"_dssp9;
auto sequence3 = "EHHHHT"_dssp9;
}

This entity is experimental and subject to change in the future. Experimental since version 3.1.

◆ operator""_dssp9() [2/2]

constexpr dssp9 operator""_dssp9 ( char const  ch)
related

The seqan3::dssp9 char literal.

Parameters
[in]chThe character to represent as dssp.
Returns
seqan3::dssp9

You can use this char literal to assign a seqan3::dssp9 character:

// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
int main()
{
using namespace seqan3::literals;
seqan3::dssp9 letter1{'('_dssp9};
auto letter2 = '('_dssp9;
}

This entity is experimental and subject to change in the future. Experimental since version 3.1.

Member Data Documentation

◆ char_to_rank_table

constexpr std::array<rank_type, 256> seqan3::dssp9::char_to_rank_table
staticconstexprprivate
Initial value:
{
[]() constexpr {
ret.fill(8u);
for (rank_type rnk = 0u; rnk < alphabet_size; ++rnk)
ret[static_cast<rank_type>(rank_to_char_table[rnk])] = rnk;
return ret;
}()
}
static constexpr detail::min_viable_uint_t< size > alphabet_size
The size of the alphabet, i.e. the number of different values it can take.
Definition alphabet_base.hpp:196
static constexpr char_type rank_to_char_table[alphabet_size]
The lookup table used in rank_to_char.
Definition dssp9.hpp:82
T fill(T... args)

The lookup table used in char_to_rank.

We would have defined these lookup tables directly within their respective constexpr functions, but at the time of writing this, gcc did not (clang >= 4 did!) auto-generate lookup tables.

static constexpr char_type rank_to_char(rank_type const rank)
{
// not possible because of static not being allowed within a constexpr function
static constexpr lookup_table = ...;
return lookup_table[rank];
}
static constexpr char_type rank_to_char(rank_type const rank)
{
// up-to the compiler to optimise, no guarantee that a lookup table is used.
constexpr lookup_table = ...;
return lookup_table[rank];
}
detail::min_viable_uint_t< size - 1 > rank_type
The type of the alphabet when represented as a number (e.g. via to_rank()).
Definition alphabet_base.hpp:77
std::conditional_t< std::same_as< char, void >, char, char > char_type
The char representation; conditional needed to make semi alphabet definitions legal.
Definition alphabet_base.hpp:69
rank_type rank
The value of the alphabet letter is stored as the rank.
Definition alphabet_base.hpp:258
static constexpr char_type rank_to_char(rank_type const rank)
Returns the character representation of rank.
Definition dssp9.hpp:85
See also
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99320 for the progress on gcc

◆ rank_to_char_table

constexpr char_type seqan3::dssp9::rank_to_char_table[alphabet_size] {'H', 'B', 'E', 'G', 'I', 'T', 'S', 'C', 'X'}
staticconstexprprivate

The lookup table used in rank_to_char.

We would have defined these lookup tables directly within their respective constexpr functions, but at the time of writing this, gcc did not (clang >= 4 did!) auto-generate lookup tables.

static constexpr char_type rank_to_char(rank_type const rank)
{
// not possible because of static not being allowed within a constexpr function
static constexpr lookup_table = ...;
return lookup_table[rank];
}
static constexpr char_type rank_to_char(rank_type const rank)
{
// up-to the compiler to optimise, no guarantee that a lookup table is used.
constexpr lookup_table = ...;
return lookup_table[rank];
}
See also
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99320 for the progress on gcc

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