Loading...
Searching...
No Matches
alphabet/quality/concept.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 <seqan3/alphabet/concept.hpp>
// ============================================================================
// to_phred()
// ============================================================================
namespace seqan3::detail::adl_only
{
template <typename... args_t>
void to_phred(args_t...) = delete;
struct to_phred_cpo : public detail::customisation_point_object<to_phred_cpo, 2>
{
using base_t = detail::customisation_point_object<to_phred_cpo, 2>;
using base_t::base_t;
template <typename alphabet_t>
static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<2>, alphabet_t && alphabet)(
/*return*/ seqan3::custom::alphabet<alphabet_t>::to_phred(std::forward<alphabet_t>(alphabet)) /*;*/
);
template <typename alphabet_t>
static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<1>, alphabet_t && alphabet)(
/*return*/ to_phred(std::forward<alphabet_t>(alphabet)) /*;*/
);
template <typename alphabet_t>
static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<0>, alphabet_t && alphabet)(
/*return*/ std::forward<alphabet_t>(alphabet).to_phred() /*;*/
);
};
} // namespace seqan3::detail::adl_only
namespace seqan3
{
inline constexpr auto to_phred = detail::adl_only::to_phred_cpo{};
template <typename alphabet_type>
requires requires {
{ seqan3::to_phred(std::declval<alphabet_type>()) };
}
using alphabet_phred_t = decltype(seqan3::to_phred(std::declval<alphabet_type>()));
} // namespace seqan3
// ============================================================================
// assign_phred_to()
// ============================================================================
namespace seqan3::detail::adl_only
{
template <typename... args_t>
void assign_phred_to(args_t...) = delete;
struct assign_phred_to_cpo : public detail::customisation_point_object<assign_phred_to_cpo, 2>
{
using base_t = detail::customisation_point_object<assign_phred_to_cpo, 2>;
using base_t::base_t;
template <typename alphabet_t>
static constexpr auto
SEQAN3_CPO_OVERLOAD(priority_tag<2>, seqan3::alphabet_phred_t<alphabet_t> const phred, alphabet_t && alphabet)(
/*return*/ static_cast<alphabet_t>(seqan3::custom::alphabet<alphabet_t>::assign_phred_to(phred, alphabet)) /*;*/
);
template <typename alphabet_t>
static constexpr auto
SEQAN3_CPO_OVERLOAD(priority_tag<1>, seqan3::alphabet_phred_t<alphabet_t> const phred, alphabet_t && alphabet)(
/*return*/ static_cast<alphabet_t>(assign_phred_to(phred, alphabet)) /*;*/
);
template <typename alphabet_t>
static constexpr auto
SEQAN3_CPO_OVERLOAD(priority_tag<0>, seqan3::alphabet_phred_t<alphabet_t> const phred, alphabet_t && alphabet)(
/*return*/ static_cast<alphabet_t>(alphabet.assign_phred(phred)) /*;*/
);
};
} // namespace seqan3::detail::adl_only
namespace seqan3
{
inline constexpr auto assign_phred_to = detail::adl_only::assign_phred_to_cpo{};
} // namespace seqan3
// ============================================================================
// seqan3::quality_alphabet
// ============================================================================
namespace seqan3
{
template <typename t>
concept quality_alphabet = alphabet<t> && requires (t qual) {
{ seqan3::to_phred(qual) };
};
// ============================================================================
// seqan3::writable_quality_alphabet
// ============================================================================
template <typename t>
concept writable_quality_alphabet =
writable_alphabet<t> && quality_alphabet<t> && requires (t v, alphabet_phred_t<t> c) {
{ seqan3::assign_phred_to(c, v) };
};
} // namespace seqan3
concept.hpp
Core alphabet concept and free function/type trait wrappers.
SEQAN3_CPO_OVERLOAD
#define SEQAN3_CPO_OVERLOAD(...)
A macro that helps to define a seqan3::detail::customisation_point_object.
Definition customisation_point.hpp:106
std::declval
T declval(T... args)
std::forward
T forward(T... args)
seqan3::field::qual
@ qual
The qualities, usually in Phred score notation.
Definition record.hpp:64
alphabet
The generic alphabet concept that covers most data types used in ranges.
quality_alphabet
A concept that indicates whether an alphabet represents quality scores.
writable_alphabet
Refines seqan3::alphabet and adds assignability.
writable_quality_alphabet
A concept that indicates whether a writable alphabet represents quality scores.
seqan3
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
seqan3::to_phred
constexpr auto to_phred
The public getter function for the Phred representation of a quality score.
Definition alphabet/quality/concept.hpp:97
seqan3::assign_phred_to
constexpr auto assign_phred_to
Assign a Phred score to a quality alphabet object.
Definition alphabet/quality/concept.hpp:225
seqan3::alphabet_phred_t
decltype(seqan3::to_phred(std::declval< alphabet_type >())) alphabet_phred_t
The phred_type of the alphabet; defined as the return type of seqan3::to_phred.
Definition alphabet/quality/concept.hpp:109
Hide me