Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add alignment cache #1243

Merged
merged 1 commit into from
Sep 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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