26template <
typename configuration_t>
27 requires is_type_specialisation_of_v<configuration_t, configuration>
28class policy_alignment_result_builder;
42template <
typename sequence1_id_t,
43 typename sequence2_id_t,
79template <
typename sequence1_
id_t,
typename sequence2_
id_t,
typename score_t>
84template <
typename sequence1_
id_t,
typename sequence2_
id_t,
typename score_t,
typename end_positions_t>
89template <
typename sequence1_id_t,
90 typename sequence2_id_t,
92 typename end_positions_t,
93 typename begin_positions_t>
98template <
typename sequence1_id_t,
99 typename sequence2_id_t,
101 typename end_positions_t,
102 typename begin_positions_t,
103 typename alignment_t>
114template <
typename result_t>
115struct alignment_result_value_type_accessor;
145template <
typename alignment_result_value_t>
146 requires detail::is_type_specialisation_of_v<alignment_result_value_t, detail::alignment_result_value_type>
151 alignment_result_value_t
data{};
172 template <
typename configuration_t>
173 requires detail::is_type_specialisation_of_v<configuration_t, configuration>
208 static_assert(!std::is_same_v<sequence1_id_t, std::nullopt_t *>,
209 "Trying to access the id of the first sequence, although it was not requested in the"
210 " alignment configuration.");
211 return data.sequence1_id;
219 static_assert(!std::is_same_v<sequence2_id_t, std::nullopt_t *>,
220 "Trying to access the id of the second sequence, although it was not requested in the"
221 " alignment configuration.");
222 return data.sequence2_id;
230 static_assert(!std::is_same_v<score_t, std::nullopt_t *>,
231 "Trying to access the score, although it was not requested in the alignment configuration.");
243 static_assert(!std::is_same_v<end_positions_t, std::nullopt_t *>,
244 "Trying to access the end position of the first sequence, although it was not requested in the"
245 " alignment configuration.");
246 return data.end_positions.first;
257 static_assert(!std::is_same_v<end_positions_t, std::nullopt_t *>,
258 "Trying to access the end position of the second sequence, although it was not requested in the"
259 " alignment configuration.");
260 return data.end_positions.second;
275 static_assert(!std::is_same_v<begin_positions_t, std::nullopt_t *>,
276 "Trying to access the begin position of the first sequence, although it was not requested in the"
277 " alignment configuration.");
278 return data.begin_positions.first;
293 static_assert(!std::is_same_v<begin_positions_t, std::nullopt_t *>,
294 "Trying to access the begin position of the second sequence, although it was not requested in the"
295 " alignment configuration.");
296 return data.begin_positions.second;
307 static_assert(!std::is_same_v<alignment_t, std::nullopt_t *>,
308 "Trying to access the alignment, although it was not requested in the alignment configuration.");
309 return data.alignment;
329 "Trying to access the score matrix, although it was not requested in the alignment configuration.");
330 return data.score_debug_matrix;
348 "Trying to access the trace matrix, although it was not requested in the alignment configuration.");
349 return data.trace_debug_matrix;
367template <
typename result_value_t>
387template <
typename char_t,
typename alignment_result_t>
388 requires detail::is_type_specialisation_of_v<std::remove_cvref_t<alignment_result_t>,
alignment_result>
392 using result_data_t =
393 typename detail::alignment_result_value_type_accessor<std::remove_cvref_t<alignment_result_t>>::type;
395 constexpr bool has_sequence1_id = !std::is_same_v<decltype(std::declval<result_data_t>().sequence1_id), disabled_t>;
396 constexpr bool has_sequence2_id = !std::is_same_v<decltype(std::declval<result_data_t>().sequence2_id), disabled_t>;
397 constexpr bool has_score = !std::is_same_v<decltype(std::declval<result_data_t>().score), disabled_t>;
398 constexpr bool has_end_positions =
399 !std::is_same_v<decltype(std::declval<result_data_t>().end_positions), disabled_t>;
400 constexpr bool has_begin_positions =
401 !std::is_same_v<decltype(std::declval<result_data_t>().begin_positions), disabled_t>;
402 constexpr bool has_alignment = !std::is_same_v<decltype(std::declval<result_data_t>().alignment), disabled_t>;
404 bool prepend_comma =
false;
405 auto append_to_stream = [&](
auto &&... args)
407 ((stream << (prepend_comma ?
std::string{
", "} :
std::string{})) << ... << std::forward<decltype(args)>(args));
408 prepend_comma =
true;
412 if constexpr (has_sequence1_id)
413 append_to_stream(
"sequence1 id: ", result.sequence1_id());
414 if constexpr (has_sequence2_id)
415 append_to_stream(
"sequence2 id: ", result.sequence2_id());
416 if constexpr (has_score)
417 append_to_stream(
"score: ", result.score());
418 if constexpr (has_begin_positions)
419 append_to_stream(
"begin: (", result.sequence1_begin_position(),
",", result.sequence2_begin_position(),
")");
420 if constexpr (has_end_positions)
421 append_to_stream(
"end: (", result.sequence1_end_position(),
",", result.sequence2_end_position(),
")");
422 if constexpr (has_alignment)
423 append_to_stream(
"\nalignment:\n", result.alignment());
Stores the alignment results and gives access to score, alignment and the front and end positionss.
Definition: alignment_result.hpp:148
constexpr sequence2_id_t sequence2_id() const noexcept
Returns the alignment identifier of the second sequence.
Definition: alignment_result.hpp:217
alignment_result & operator=(alignment_result &&)=default
Defaulted.
alignment_result & operator=(alignment_result const &)=default
Defaulted.
decltype(data.sequence1_id) sequence1_id_t
The type for the alignment identifier for the first sequence.
Definition: alignment_result.hpp:158
constexpr sequence1_id_t sequence1_id() const noexcept
Returns the alignment identifier of the first sequence.
Definition: alignment_result.hpp:206
alignment_result_value_t data
Object that stores the computed alignment results.
Definition: alignment_result.hpp:151
constexpr auto sequence2_end_position() const noexcept
Returns the end position of the second sequence of the alignment.
Definition: alignment_result.hpp:255
constexpr auto sequence1_begin_position() const noexcept
Returns the begin position of the first sequence of the alignment.
Definition: alignment_result.hpp:273
alignment_result(alignment_result const &)=default
Defaulted.
decltype(data.sequence2_id) sequence2_id_t
The type for the alignment identifier for the second sequence.
Definition: alignment_result.hpp:160
constexpr alignment_t const & alignment() const noexcept
Returns the actual alignment, i.e. the base pair matching.
Definition: alignment_result.hpp:305
constexpr auto sequence2_begin_position() const noexcept
Returns the begin position of the second sequence of the alignment.
Definition: alignment_result.hpp:291
~alignment_result()=default
Defaulted.
constexpr score_t score() const noexcept
Returns the alignment score.
Definition: alignment_result.hpp:228
constexpr auto sequence1_end_position() const noexcept
Returns the end position of the first sequence of the alignment.
Definition: alignment_result.hpp:241
alignment_result()=default
decltype(data.score) score_t
The type for the resulting score.
Definition: alignment_result.hpp:162
decltype(data.end_positions) end_positions_t
The type for the end positions.
Definition: alignment_result.hpp:164
constexpr auto const & score_matrix() const noexcept
Returns the score matrix used to compute the alignment.
Definition: alignment_result.hpp:325
constexpr auto const & trace_matrix() const noexcept
Returns the trace matrix used to compute the alignment.
Definition: alignment_result.hpp:344
alignment_result(alignment_result_value_t value)
Constructs a seqan3::alignment_result from an value_type object.
Definition: alignment_result.hpp:185
alignment_result(alignment_result &&)=default
Defaulted.
decltype(data.alignment) alignment_t
The type for the alignment.
Definition: alignment_result.hpp:168
decltype(data.begin_positions) begin_positions_t
The type for the begin positions.
Definition: alignment_result.hpp:166
A "pretty printer" for most SeqAn data structures and related types.
Definition: debug_stream_type.hpp:78
Implements the alignment result builder.
Definition: policy_alignment_result_builder.hpp:37
Provides seqan3::configuration and utility functions.
Provides seqan3::debug_stream and related types.
debug_stream_type< char_t > & operator<<(debug_stream_type< char_t > &stream, alignment_t &&alignment)
Stream operator for alignments, which are represented as tuples of aligned sequences.
Definition: debug_stream_alignment.hpp:110
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
result_value_t type
The underlying value type used for the given alignment result type.
Definition: alignment_result.hpp:371
A struct that contains the actual alignment result data.
Definition: alignment_result.hpp:51
alignment_t alignment
The alignment, i.e. the actual base pair matching.
Definition: alignment_result.hpp:63
begin_positions_t begin_positions
The begin positions of the alignment.
Definition: alignment_result.hpp:61
sequence1_id_t sequence1_id
The alignment identifier for the first sequence.
Definition: alignment_result.hpp:53
trace_debug_matrix_t trace_debug_matrix
The trace matrix. Only accessible with seqan3::align_cfg::detail::debug.
Definition: alignment_result.hpp:68
end_positions_t end_positions
The end positions of the alignment.
Definition: alignment_result.hpp:59
sequence2_id_t sequence2_id
The alignment identifier for the second sequence.
Definition: alignment_result.hpp:55
score_debug_matrix_t score_debug_matrix
The score matrix. Only accessible with seqan3::align_cfg::detail::debug.
Definition: alignment_result.hpp:66
score_t score
The alignment score.
Definition: alignment_result.hpp:57
Provides type traits for working with templates.