SeqAn3 3.1.0
The Modern C++ library for sequence analysis.
policy_affine_gap_recursion_banded.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2021, 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
24template <typename alignment_configuration_t>
25class policy_affine_gap_recursion_banded : protected policy_affine_gap_recursion<alignment_configuration_t>
26{
27protected:
29 using base_t = policy_affine_gap_recursion<alignment_configuration_t>;
30 // Import base types
31 using typename base_t::traits_type;
32 using typename base_t::score_type;
33 using typename base_t::affine_cell_type;
34
35 //Import member types.
36 using base_t::gap_extension_score;
37 using base_t::gap_open_score;
38
42 policy_affine_gap_recursion_banded() = default;
43 policy_affine_gap_recursion_banded(policy_affine_gap_recursion_banded const &) = default;
44 policy_affine_gap_recursion_banded(policy_affine_gap_recursion_banded &&) = default;
45 policy_affine_gap_recursion_banded & operator=(policy_affine_gap_recursion_banded const &) = default;
46 policy_affine_gap_recursion_banded & operator=(policy_affine_gap_recursion_banded &&) = default;
47 ~policy_affine_gap_recursion_banded() = default;
48
58 explicit policy_affine_gap_recursion_banded(alignment_configuration_t const & config) : base_t{config}
59 {}
61
78 template <typename affine_cell_t>
79 affine_cell_type initialise_band_first_cell(score_type diagonal_score,
80 affine_cell_t previous_cell,
81 score_type const sequence_score) const noexcept
82 {
83 diagonal_score += sequence_score;
84 score_type horizontal_score = previous_cell.horizontal_score();
85 diagonal_score = (diagonal_score < horizontal_score) ? horizontal_score : diagonal_score;
86 score_type from_optimal_score = diagonal_score + gap_open_score;
87 horizontal_score += gap_extension_score;
88 horizontal_score = (horizontal_score < from_optimal_score) ? from_optimal_score : horizontal_score;
89 return {diagonal_score, horizontal_score, from_optimal_score};
90 }
91};
92} // namespace seqan3::detail
Provides seqan3::detail::policy_affine_gap_recursion.