-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1243 from rrahn/feature/add_alignment_cache
Feature/add alignment cache
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
include/seqan3/alignment/pairwise/detail/alignment_algorithm_cache.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// ----------------------------------------------------------------------------------------------------- | ||
// Copyright (c) 2006-2019, Knut Reinert & Freie Universität Berlin | ||
// Copyright (c) 2016-2019, Knut Reinert & MPI für molekulare Genetik | ||
// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License | ||
// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md | ||
// ----------------------------------------------------------------------------------------------------- | ||
|
||
/*!\file | ||
* \brief Provides seqan3::detail::alignment_algorithm_cache. | ||
* \author Rene Rahn <rene.rahn AT fu-berlin.de> | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <seqan3/alignment/matrix/alignment_coordinate.hpp> | ||
#include <seqan3/alignment/matrix/alignment_optimum.hpp> | ||
|
||
namespace seqan3::detail | ||
{ | ||
/*!\brief Local cache for the standard alignment algorithm. | ||
* \tparam score_type The type of the score. | ||
* \ingroup pairwise_alignment | ||
* | ||
* \details | ||
* | ||
* This cache is used internally for the standard alignment algorithm and caches the gap extension and gap open scores | ||
* as well as the current alignment optimum. | ||
* The alignment optimum stores the current score and the corresponding matrix coordinate in | ||
* the underlying two-dimensional matrix. | ||
*/ | ||
template <typename score_type> | ||
struct alignment_algorithm_cache | ||
{ | ||
//!\brief The cached gap open score. | ||
score_type gap_open_score{}; | ||
//!\brief The cached gap extension score. | ||
score_type gap_extension_score{}; | ||
//!\brief The current alignment optimum. | ||
alignment_optimum<score_type> optimum{std::numeric_limits<score_type>::lowest(), | ||
alignment_coordinate{column_index_type{0u}, row_index_type{0u}}}; | ||
}; | ||
|
||
/*!\name Type deduction guides | ||
* \relates seqan3::detail::alignment_algorithm_cache | ||
* \{ | ||
*/ | ||
|
||
//!\brief Deduces the template parameter for the score type from construction with gap open and gap extension scores. | ||
template <typename score_type> | ||
alignment_algorithm_cache(score_type, score_type) -> alignment_algorithm_cache<score_type>; | ||
//!\} | ||
} // namespace seqan3::detail |