SeqAn3  3.0.3
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. More...
 
using sequence_alphabet_type = sequence_alphabet_t
 First template parameter as member type. More...
 

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. More...
 
Read functions
constexpr char_type to_char () const noexcept
 Return a character. More...
 
- Public Member Functions inherited from seqan3::alphabet_tuple_base< masked< sequence_alphabet_t >, sequence_alphabet_t, mask >
constexpr alphabet_tuple_base (component_types ... components) noexcept
 Construction from initialiser-list.
 
constexpr alphabet_tuple_base (component_type const alph) noexcept
 Construction via a value of one of the components. More...
 
constexpr alphabet_tuple_base (indirect_component_type const alph) noexcept
 Construction via a value of a subtype that is assignable to one of the components. More...
 
constexpr masked< sequence_alphabet_t > & operator= (component_type const alph) noexcept
 Assignment via a value of one of the components. More...
 
constexpr masked< sequence_alphabet_t > & operator= (indirect_component_type const alph) noexcept
 Assignment via a value of a subtype that is assignable to one of the components. More...
 
constexpr operator type () const noexcept
 Implicit cast to a single letter. Works only if the type is unique in the type list. More...
 
- Public Member Functions inherited from seqan3::alphabet_base< masked< sequence_alphabet_t >,(1 *... *alphabet_size< component_types >), void >
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. More...
 
constexpr rank_type to_rank () const noexcept
 Return the letter's numeric value (rank in the alphabet). More...
 
constexpr masked< sequence_alphabet_t > & assign_char (char_type const chr) noexcept
 Assign from a character, implicitly converts invalid characters. More...
 
constexpr masked< sequence_alphabet_t > & assign_rank (rank_type const c) noexcept
 Assign from a numeric value. More...
 

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.
 

Additional Inherited Members

- Static Public Attributes inherited from seqan3::alphabet_base< masked< sequence_alphabet_t >,(1 *... *alphabet_size< component_types >), void >
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. More...
 
- Protected Types inherited from seqan3::alphabet_base< masked< sequence_alphabet_t >,(1 *... *alphabet_size< component_types >), void >
using char_type = std::conditional_t< std::same_as< void, void >, char, void >
 The char representation; conditional needed to make semi alphabet definitions legal. More...
 
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()). 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 namespace seqan3::literals;
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";
}
}
constexpr derived_type & assign_char(char_type const chr) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:211
static const mask unmasked
Member for unmasked.
Definition: mask.hpp:79
Implementation of a masked composite, which extends a given alphabet with a mask.
Definition: masked.hpp:47
Provides seqan3::debug_stream and related types.
Provides seqan3::dna4, container aliases and string literals.
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition: debug_stream.hpp:42
Extends a given alphabet with the mask alphabet.
The SeqAn namespace for literals.
See also
Mask submodule , it contains an explanation of hard-masking (UNKNOWN character) and soft-masking (lower/upper case letters).

This entity is stable. Since version 3.1.

Member Typedef Documentation

◆ char_type

template<writable_alphabet sequence_alphabet_t>
using seqan3::masked< sequence_alphabet_t >::char_type = alphabet_char_t<sequence_alphabet_type>

Equals the char_type of sequence_alphabet_type.

This entity is stable. Since version 3.1.

◆ sequence_alphabet_type

template<writable_alphabet sequence_alphabet_t>
using seqan3::masked< sequence_alphabet_t >::sequence_alphabet_type = sequence_alphabet_t

First template parameter as member type.

This entity is stable. Since version 3.1.

Member Function Documentation

◆ assign_char()

template<writable_alphabet sequence_alphabet_t>
constexpr masked& seqan3::masked< sequence_alphabet_t >::assign_char ( char_type const  c)
inlineconstexprnoexcept

Assign from a character.

This entity is stable. Since version 3.1.

◆ to_char()

template<writable_alphabet sequence_alphabet_t>
constexpr char_type seqan3::masked< sequence_alphabet_t >::to_char ( ) const
inlineconstexprnoexcept

Return a character.

This entity is stable. Since version 3.1.

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
staticconstexprprotected
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;
} ()
}
alphabet_char_t< sequence_alphabet_type > char_type
Equals the char_type of sequence_alphabet_type.
Definition: masked.hpp:63
sequence_alphabet_t sequence_alphabet_type
First template parameter as member type.
Definition: masked.hpp:57
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition: concept.hpp:523
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition: concept.hpp:155
constexpr auto is_lower
Checks whether c is a lower case character.
Definition: predicate.hpp:269

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
staticconstexprprotected
Initial value:
{
[] ()
{
for (size_t i = 0; i < alphabet_size; ++i)
{
ret[i] = (i < alphabet_size / 2)
}
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:276
constexpr auto to_char
Return the char representation of an alphabet object.
Definition: concept.hpp:384
constexpr auto assign_rank_to
Assign a rank to an alphabet object.
Definition: concept.hpp:291
constexpr char_type to_lower(char_type const c) noexcept
Converts 'A'-'Z' to 'a'-'z' respectively; other characters are returned as is.
Definition: transform.hpp:81

Rank to char conversion table.


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