Loading...
Searching...
No Matches
rna15.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <vector>
#include <seqan3/alphabet/nucleotide/dna15.hpp>
#include <seqan3/alphabet/nucleotide/nucleotide_base.hpp>
// ------------------------------------------------------------------
// rna15
// ------------------------------------------------------------------
namespace seqan3
{
class rna15 : public nucleotide_base<rna15, 15>
{
private:
using base_t = nucleotide_base<rna15, 15>;
friend base_t;
friend base_t::base_t;
public:
constexpr rna15() noexcept = default;
constexpr rna15(rna15 const &) noexcept = default;
constexpr rna15(rna15 &&) noexcept = default;
constexpr rna15 & operator=(rna15 const &) noexcept = default;
constexpr rna15 & operator=(rna15 &&) noexcept = default;
~rna15() noexcept = default;
using base_t::base_t;
template <std::same_as<dna15> t>
constexpr rna15(t const & r) noexcept
{
assign_rank(r.to_rank());
}
private:
static constexpr char_type
rank_to_char_table[alphabet_size]{'A', 'B', 'C', 'D', 'G', 'H', 'K', 'M', 'N', 'R', 'S', 'U', 'V', 'W', 'Y'};
static constexpr rank_type rank_complement(rank_type const rank)
{
return dna15::rank_complement(rank);
}
static constexpr char_type rank_to_char(rank_type const rank)
{
return rank_to_char_table[rank];
}
static constexpr rank_type char_to_rank(char_type const chr)
{
return dna15::char_to_rank(chr);
}
};
// ------------------------------------------------------------------
// containers
// ------------------------------------------------------------------
using rna15_vector = std::vector<rna15>;
// ------------------------------------------------------------------
// literals
// ------------------------------------------------------------------
inline namespace literals
{
constexpr rna15 operator""_rna15(char const c) noexcept
{
return rna15{}.assign_char(c);
}
SEQAN3_WORKAROUND_LITERAL rna15_vector operator""_rna15(char const * s, std::size_t n)
{
rna15_vector r;
r.resize(n);
for (size_t i = 0; i < n; ++i)
r[i].assign_char(s[i]);
return r;
}
} // namespace literals
} // namespace seqan3
seqan3::alphabet_base::assign_char
constexpr derived_type & assign_char(char_type const chr) noexcept
Assign from a character, implicitly converts invalid characters.
Definition alphabet_base.hpp:160
seqan3::alphabet_base::rank_type
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
seqan3::alphabet_base::char_type
std::conditional_t< std::same_as< char_t, void >, char, char_t > char_type
The char representation; conditional needed to make semi alphabet definitions legal.
Definition alphabet_base.hpp:69
seqan3::alphabet_base::assign_rank
constexpr derived_type & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition alphabet_base.hpp:184
seqan3::dna15
The 15 letter DNA alphabet, containing all IUPAC smybols minus the gap.
Definition dna15.hpp:48
seqan3::rna15::rna15
constexpr rna15() noexcept=default
Defaulted.
seqan3::rna15::rna15_vector
std::vector< rna15 > rna15_vector
Alias for a std::vector of seqan3::rna15.
Definition rna15.hpp:147
dna15.hpp
Provides seqan3::dna15, container aliases and string literals.
seqan3::alphabet_size
constexpr auto alphabet_size
A type trait that holds the size of a (semi-)alphabet.
Definition alphabet/concept.hpp:834
seqan3::literals
The SeqAn namespace for literals.
seqan3
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
std
SeqAn specific customisations in the standard namespace.
nucleotide_base.hpp
Provides seqan3::nucleotide_base.
SEQAN3_WORKAROUND_LITERAL
#define SEQAN3_WORKAROUND_LITERAL
Our char literals returning std::vector should be constexpr if constexpr std::vector is supported.
Definition platform.hpp:310
std::vector::resize
T resize(T... args)
std::size_t
vector
Hide me