Skip to content

Commit

Permalink
Merge pull request #1243 from rrahn/feature/add_alignment_cache
Browse files Browse the repository at this point in the history
Feature/add alignment cache
  • Loading branch information
rrahn authored Sep 11, 2019
2 parents 3288604 + a913963 commit e2c5fec
Showing 1 changed file with 52 additions and 0 deletions.
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

0 comments on commit e2c5fec

Please sign in to comment.