SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
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.
 
- 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.
 
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.
 
constexpr masked< sequence_alphabet_t > & operator= (component_type const alph) noexcept
 Assignment via a value of one of the components.
 
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.
 
constexpr operator type () const noexcept
 Implicit cast to a single letter. Works only if the type is unique in the type list.
 
- Public Member Functions inherited from seqan3::alphabet_base< derived_type, size, char_t >
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 derived_type & assign_char (char_type const chr) noexcept
 Assign from a character, implicitly converts invalid characters.
 
constexpr derived_type & assign_rank (rank_type const c) noexcept
 Assign from a numeric value.
 

Static Protected Attributes

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

Related Symbols

(Note that these are not member symbols.)

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< derived_type, size, char_t >
static constexpr detail::min_viable_uint_t< size > alphabet_size = size
 The size of the alphabet, i.e. the number of different values it can take.
 
- Protected Types inherited from seqan3::alphabet_base< derived_type, size, char_t >
using char_type = std::conditional_t< std::same_as< char_t, void >, char, char_t >
 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

template<writable_alphabet sequence_alphabet_t>
requires std::regular<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.

// 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::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:160
static mask const unmasked
Member for unmasked.
Definition mask.hpp:65
Implementation of a masked composite, which extends a given alphabet with a mask.
Definition masked.hpp:42
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:37
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:
{
[]() constexpr
{
for (size_t i = 0; i < 256; ++i)
{
char_type const c = static_cast<char_type>(i);
}
return ret;
}()}
alphabet_char_t< sequence_alphabet_type > char_type
Equals the char_type of sequence_alphabet_type.
Definition masked.hpp:58
sequence_alphabet_t sequence_alphabet_type
First template parameter as member type.
Definition masked.hpp:52
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition alphabet/concept.hpp:517
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition alphabet/concept.hpp:152
constexpr auto is_lower
Checks whether c is a lower case character.
Definition predicate.hpp:243

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:
{
[]() constexpr
{
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:196
constexpr auto to_char
Return the char representation of an alphabet object.
Definition alphabet/concept.hpp:381
constexpr auto assign_rank_to
Assign a rank to an alphabet object.
Definition alphabet/concept.hpp:288
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:74

Rank to char conversion table.


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