SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
seqan3::masked< sequence_alphabet_t > Class Template Reference

Implementation of a masked composite, which extends a given alphabet with a mask. More...

#include <seqan3/alphabet/mask/masked.hpp>

+ Inheritance diagram for seqan3::masked< sequence_alphabet_t >:

Public Types

using char_type = alphabet_char_t< sequence_alphabet_type >
 Equals the char_type of sequence_alphabet_type.
 
using sequence_alphabet_type = sequence_alphabet_t
 First template parameter as member type.
 

Public Member Functions

Constructors, destructor and assignment
constexpr masked ()=default
 Defaulted.
 
constexpr masked (masked const &)=default
 Defaulted.
 
constexpr masked (masked &&)=default
 Defaulted.
 
constexpr maskedoperator= (masked const &)=default
 Defaulted.
 
constexpr maskedoperator= (masked &&)=default
 Defaulted.
 
 ~masked ()=default
 Defaulted.
 
Write functions
constexpr maskedassign_char (char_type const c) noexcept
 Assign from a character.
 
Read functions
constexpr char_type to_char () const noexcept
 Return a character.
 
Read functions

All read operations are constant complexity.

constexpr operator type () const noexcept
 Implicit cast to a single letter. Works only if the type is unique in the type list.
 
Read functions
constexpr rank_type to_rank () const noexcept
 Return the letter's numeric value (rank in the alphabet). More...
 
Write functions
constexpr derived_type & assign_char (char_type const c) noexcept
 Assign from a character, implicitly converts invalid characters. More...
 
constexpr derived_type & assign_rank (rank_type const c) noexcept
 Assign from a numeric value. More...
 

Static Public Attributes

static detail::min_viable_uint_t< size > constexpr alphabet_size = size
 The size of the alphabet, i.e. the number of different values it can take.
 

Static Protected Attributes

static constexpr std::array< rank_type, detail::size_in_values_v< char_type > > char_to_rank
 Char to rank conversion table. More...
 
static constexpr std::array< char_type, alphabet_sizerank_to_char
 Rank to char conversion table. More...
 

Related Functions

(Note that these are not member functions.)

template<typename sequence_alphabet_type >
 masked (sequence_alphabet_type &&, mask const &) -> masked< std::decay_t< sequence_alphabet_type >>
 Type deduction guide enables usage of masked without specifying template args. More...
 
Requirements for std::totally_ordered

You can expect these functions on all types that implement std::totally_ordered.

bool operator< (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
bool operator<= (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
bool operator> (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
bool operator>= (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
Requirements for std::equality_comparable

You can expect these functions on all types that implement std::Equality_comparable.

bool operator== (type const &lhs, type const &rhs)
 (In-)Equality comparison. More...
 
bool operator!= (type const &lhs, type const &rhs)
 (In-)Equality comparison. More...
 
Requirements for std::swappable

You can expect these functions on all types that implement std::swappable.

void swap (t &lhs, t &rhs)
 Swaps the contents of two objects. More...
 

Detailed Description

template<writable_alphabet sequence_alphabet_t>
class seqan3::masked< sequence_alphabet_t >

Implementation of a masked composite, which extends a given alphabet with a mask.

Template Parameters
sequence_alphabet_tType of the first letter; must satisfy seqan3::writable_alphabet and std::regular.

The masked composite represents a seqan3::alphabet_tuple_base of any given alphabet with the masked alphabet. It allows one to specify which portions of a sequence should be masked, without losing additional information by replacing the sequence directly.

int main()
{
using seqan3::operator""_dna4;
seqan3::masked<seqan3::dna4> dna4_another_masked{'A'_dna4, seqan3::mask::UNMASKED};
// create a dna4 masked alphabet with an unmasked A
dna4_masked.assign_char('a'); // assigns a masked 'A'_dna4
if (dna4_masked.to_char() != dna4_another_masked.to_char())
{
seqan3::debug_stream << dna4_masked.to_char() << " is not the same as " <<
dna4_another_masked.to_char() << "\n";
}
}

Member Function Documentation

◆ assign_char()

template<typename derived_type, size_t size, typename char_t = char>
constexpr derived_type& seqan3::alphabet_base< derived_type, size, char_t >::assign_char ( char_type const  c)
inlinenoexceptinherited

Assign from a character, implicitly converts invalid characters.

Parameters
cThe character to be assigned.

Provides an implementation for seqan3::assign_char_to, required to model seqan3::alphabet.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ assign_rank()

template<typename derived_type, size_t size, typename char_t = char>
constexpr derived_type& seqan3::alphabet_base< derived_type, size, char_t >::assign_rank ( rank_type const  c)
inlinenoexceptinherited

Assign from a numeric value.

Parameters
cThe rank to be assigned.

Provides an implementation for seqan3::assign_rank_to, required to model seqan3::semialphabet.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ to_rank()

template<typename derived_type, size_t size, typename char_t = char>
constexpr rank_type seqan3::alphabet_base< derived_type, size, char_t >::to_rank ( ) const
inlinenoexceptinherited

Return the letter's numeric value (rank in the alphabet).

Provides an implementation for seqan3::to_rank, required to model seqan3::semialphabet.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

Friends And Related Function Documentation

◆ masked()

template<typename sequence_alphabet_type >
masked ( sequence_alphabet_type &&  ,
mask const &   
) -> masked< std::decay_t< sequence_alphabet_type >>
related

Type deduction guide enables usage of masked without specifying template args.

Member Data Documentation

◆ char_to_rank

template<writable_alphabet sequence_alphabet_t>
constexpr std::array<rank_type, detail::size_in_values_v<char_type> > seqan3::masked< sequence_alphabet_t >::char_to_rank
staticprotected
Initial value:
{
[] ()
{
for (size_t i = 0; i < 256; ++i)
{
char_type c = static_cast<char_type>(i);
ret[i] = is_lower(c)
}
return ret;
} ()
}

Char to rank conversion table.

◆ rank_to_char

template<writable_alphabet sequence_alphabet_t>
constexpr std::array<char_type, alphabet_size> seqan3::masked< sequence_alphabet_t >::rank_to_char
staticprotected
Initial value:
{
[] ()
{
for (size_t i = 0; i < alphabet_size; ++i)
{
ret[i] = (i < alphabet_size / 2)
}
return ret;
} ()
}

Rank to char conversion table.


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