SeqAn3 3.3.0-rc.1
The Modern C++ library for sequence analysis.
 
Loading...
Searching...
No Matches
policy_affine_gap_with_trace_recursion_banded.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6// -----------------------------------------------------------------------------------------------------
7
13#pragma once
14
16
17namespace seqan3::detail
18{
19
25template <typename alignment_configuration_t>
27 protected policy_affine_gap_with_trace_recursion<alignment_configuration_t>
28{
29protected:
32 // Import base types.
33 using typename base_t::affine_cell_type;
34 using typename base_t::score_type;
35 using typename base_t::traits_type;
36
37 // Import base member.
40
54
56 explicit policy_affine_gap_with_trace_recursion_banded(alignment_configuration_t const & config) : base_t{config}
57 {}
59
61 template <typename affine_cell_t>
63 affine_cell_t previous_cell,
64 score_type const sequence_score) const noexcept
65 {
66 diagonal_score += sequence_score;
67 score_type horizontal_score = previous_cell.horizontal_score();
68 trace_directions best_trace{};
69
70 best_trace = previous_cell.horizontal_trace();
71 diagonal_score = (diagonal_score < horizontal_score)
72 ? horizontal_score
73 : (best_trace |= trace_directions::diagonal, diagonal_score);
74
75 score_type from_optimal_score = diagonal_score + gap_open_score;
76 trace_directions next_horizontal_trace = trace_directions::left;
77
78 horizontal_score += gap_extension_score;
79 horizontal_score = (horizontal_score < from_optimal_score)
80 ? (next_horizontal_trace = trace_directions::left_open, from_optimal_score)
81 : horizontal_score;
82
83 return {{diagonal_score, horizontal_score, from_optimal_score},
84 {best_trace, next_horizontal_trace, trace_directions::up_open}};
85 }
86};
87} // namespace seqan3::detail
A proxy for an affine score matrix cell.
Definition: affine_cell_proxy.hpp:117
decltype(auto) horizontal_score() &noexcept
Access the horizontal score of the wrapped score matrix cell.
Definition: affine_cell_proxy.hpp:213
Implements the alignment recursion function for the banded alignment algorithm using affine gap costs...
Definition: policy_affine_gap_with_trace_recursion_banded.hpp:28
policy_affine_gap_with_trace_recursion_banded(alignment_configuration_t const &config)
Defaulted.
Definition: policy_affine_gap_with_trace_recursion_banded.hpp:56
policy_affine_gap_with_trace_recursion_banded & operator=(policy_affine_gap_with_trace_recursion_banded &&)=default
Defaulted.
policy_affine_gap_with_trace_recursion_banded & operator=(policy_affine_gap_with_trace_recursion_banded const &)=default
Defaulted.
policy_affine_gap_with_trace_recursion_banded(policy_affine_gap_with_trace_recursion_banded const &)=default
Defaulted.
policy_affine_gap_with_trace_recursion_banded(policy_affine_gap_with_trace_recursion_banded &&)=default
Defaulted.
score_type gap_extension_score
The score for a gap extension.
Definition: policy_affine_gap_recursion.hpp:59
typename traits_type::score_type score_type
The configured score type.
Definition: policy_affine_gap_recursion.hpp:52
score_type gap_open_score
The score for a gap opening including the gap extension.
Definition: policy_affine_gap_recursion.hpp:61
affine_cell_type initialise_band_first_cell(score_type diagonal_score, affine_cell_t previous_cell, score_type const sequence_score) const noexcept
Initialises the first cell of a banded column that does not start in the first row of the matrix.
Definition: policy_affine_gap_with_trace_recursion_banded.hpp:62
Implements the alignment recursion function for the alignment algorithm using affine gap costs with t...
Definition: policy_affine_gap_with_trace_recursion.hpp:27
score_type gap_extension_score
The score for a gap extension.
Definition: policy_affine_gap_recursion.hpp:59
typename traits_type::score_type score_type
The configured score type.
Definition: policy_affine_gap_recursion.hpp:52
score_type gap_open_score
The score for a gap opening including the gap extension.
Definition: policy_affine_gap_recursion.hpp:61
affine_cell_proxy< std::pair< affine_score_tuple_t, affine_trace_tuple_t > > affine_cell_type
The affine cell type returned by the functions.
Definition: policy_affine_gap_with_trace_recursion.hpp:42
alignment_configuration_traits< alignment_configuration_t > traits_type
The configuration traits type.
Definition: policy_affine_gap_recursion.hpp:48
trace_directions
The possible directions a trace can have. The values can be combined by the logical |-operator.
Definition: trace_directions.hpp:29
@ left
Trace comes from the left entry.
@ diagonal
Trace comes from the diagonal entry.
@ left_open
Trace comes from the left entry, while opening the gap.
@ up_open
Trace comes from the above entry, while opening the gap.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Provides seqan3::detail::policy_affine_gap_with_trace_recursion.