SeqAn3  3.0.2
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-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, 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 
15 #include <tuple>
16 
22 
23 namespace seqan3::detail
24 {
25 
30 template <typename alignment_configuration_t>
31 class policy_affine_gap_recursion_banded : protected policy_affine_gap_recursion<alignment_configuration_t>
32 {
33 protected:
35  using base_policy_t = policy_affine_gap_recursion<alignment_configuration_t>;
36  // Import base types
37  using typename base_policy_t::traits_type;
38  using typename base_policy_t::score_type;
39  using typename base_policy_t::affine_cell_type;
40 
41  //Import member types.
42  using base_policy_t::gap_extension_score;
43  using base_policy_t::gap_open_score;
44 
48  policy_affine_gap_recursion_banded() = default;
49  policy_affine_gap_recursion_banded(policy_affine_gap_recursion_banded const &) = default;
50  policy_affine_gap_recursion_banded(policy_affine_gap_recursion_banded &&) = default;
51  policy_affine_gap_recursion_banded & operator=(policy_affine_gap_recursion_banded const &) = default;
52  policy_affine_gap_recursion_banded & operator=(policy_affine_gap_recursion_banded &&) = default;
53  ~policy_affine_gap_recursion_banded() = default;
54 
64  explicit policy_affine_gap_recursion_banded(alignment_configuration_t const & config) : base_policy_t{config}
65  {}
67 
84  template <typename affine_cell_t>
86  requires is_type_specialisation_of_v<affine_cell_t, affine_cell_proxy>
88  affine_cell_type initialise_band_first_cell(score_type diagonal_score,
89  affine_cell_t previous_cell,
90  score_type const sequence_score) const noexcept
91  {
92  diagonal_score += sequence_score;
93  score_type horizontal_score = previous_cell.horizontal_score();
94 
95  diagonal_score = (diagonal_score < horizontal_score) ? horizontal_score : diagonal_score;
96 
97  score_type from_optimal_score = diagonal_score + gap_open_score;
98  horizontal_score += gap_extension_score;
99  horizontal_score = (horizontal_score < from_optimal_score) ? from_optimal_score : horizontal_score;
100  return {diagonal_score, horizontal_score, from_optimal_score};
101  }
102 };
103 } // namespace seqan3::detail
align_config_gap_cost_affine.hpp
Provides seqan3::align_config::gap_cost_affine.
type_traits.hpp
Provides helper type traits for the configuration and execution of the alignment algorithm.
template_inspection.hpp
Provides seqan3::type_list and auxiliary type traits.
tuple
affine_cell_proxy.hpp
Provides seqan3::detail::affine_cell_proxy.
policy_affine_gap_recursion.hpp
Provides seqan3::detail::policy_affine_gap_recursion.