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

[MISC] rename align_cfg::scoring to align_cfg::scoring_scheme #2027

Merged
merged 1 commit into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Note that 3.1.0 will be the first API stable release and interfaces in this rele
pipeable configuration elements seqan3::align_cfg::method_global or seqan3::align_cfg::method_local
([\#1918](https://github.com/seqan/seqan3/pull/1918).
* The `seqan3::align_cfg::vectorise` configuration has been renamed to `seqan3::align_cfg::vectorised`.
* The `seqan3::align_cfg::scoring` configuration has been renamed to `seqan3::align_cfg::scoring_scheme`.

### Core

Expand Down
6 changes: 3 additions & 3 deletions doc/tutorial/pairwise_alignment/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ In this case it is a global alignment with edit distance.
Later in this tutorial we will give a more detailed description of the \ref alignment_configurations "configuration" and
how it can be used.
The minimum requirement for computing a pairwise alignment is to specify the alignment method (seqan3::align_cfg::method_local or seqan3::align_cfg::method_global) and the
seqan3::align_cfg::scoring configuration elements. The first one selects the internal algorithm and the second one
seqan3::align_cfg::scoring_scheme configuration elements. The first one selects the internal algorithm and the second one
provides the scoring scheme that should be used to score a pair of sequence characters.

Now we are going to call seqan3::align_pairwise. This interface requires two arguments: a tuple or a range of tuples
Expand Down Expand Up @@ -203,8 +203,8 @@ positive value and the score for mismatch and gaps must be negative in order to
\snippet doc/tutorial/pairwise_alignment/configurations.cpp gap_scheme

To configure the scoring scheme and the gap scheme for the alignment algorithm you need to use the
seqan3::align_cfg::scoring and the seqan3::align_cfg::gap configurations. The
seqan3::align_cfg::scoring is mandatory - similarly to the alignment method configuration. It would be
seqan3::align_cfg::scoring_scheme and the seqan3::align_cfg::gap configurations. The
seqan3::align_cfg::scoring_scheme is mandatory - similarly to the alignment method configuration. It would be
wrong to assume what the default scoring scheme should be. If you do not provide these configurations, the compilation
will fail with a corresponding error message. Not providing the gap scheme is ok. In this case the default initialised
gap scheme will be used for the alignment computation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main()

// Configure the alignment kernel.
auto config = seqan3::align_cfg::method_global{} |
seqan3::align_cfg::scoring{seqan3::aminoacid_scoring_scheme{
seqan3::align_cfg::scoring_scheme{seqan3::aminoacid_scoring_scheme{
seqan3::aminoacid_similarity_matrix::BLOSUM62}} |
seqan3::align_cfg::aligned_ends{seqan3::free_ends_second};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main()

// Configure the alignment kernel.
auto config = seqan3::align_cfg::method_global{} |
seqan3::align_cfg::scoring{seqan3::nucleotide_scoring_scheme{}};
seqan3::align_cfg::scoring_scheme{seqan3::nucleotide_scoring_scheme{}};

// Invoke the pairwise alignment which returns a lazy range over alignment results.
auto results = seqan3::align_pairwise(std::tie(s1, s2), config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int main()

// Configure the alignment kernel.
auto config = seqan3::align_cfg::method_global{} |
seqan3::align_cfg::scoring{seqan3::nucleotide_scoring_scheme{}};
seqan3::align_cfg::scoring_scheme{seqan3::nucleotide_scoring_scheme{}};

for (auto const & res : seqan3::align_pairwise(seqan3::views::pairwise_combine(vec), config))
seqan3::debug_stream << "Score: " << res.score() << '\n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int main()

// Configure the alignment kernel.
auto config = seqan3::align_cfg::method_global{} |
seqan3::align_cfg::scoring{seqan3::nucleotide_scoring_scheme{}} |
seqan3::align_cfg::scoring_scheme{seqan3::nucleotide_scoring_scheme{}} |
seqan3::align_cfg::aligned_ends{seqan3::free_ends_first};

for (auto const & res : seqan3::align_pairwise(seqan3::views::pairwise_combine(vec), config))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main()

// Configure the alignment kernel.
auto config = seqan3::align_cfg::method_global{} |
seqan3::align_cfg::scoring{seqan3::aminoacid_scoring_scheme{
seqan3::align_cfg::scoring_scheme{seqan3::aminoacid_scoring_scheme{
seqan3::aminoacid_similarity_matrix::BLOSUM62}} |
seqan3::align_cfg::gap{seqan3::gap_scheme{seqan3::gap_score{-2}, seqan3::gap_open_score{-9}}};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main()

// Configure the alignment kernel.
auto config = seqan3::align_cfg::method_global{} |
seqan3::align_cfg::scoring{seqan3::nucleotide_scoring_scheme{
seqan3::align_cfg::scoring_scheme{seqan3::nucleotide_scoring_scheme{
seqan3::match_score{4}, seqan3::mismatch_score{-2}}} |
seqan3::align_cfg::gap{seqan3::gap_scheme{seqan3::gap_score{-4}}} |
seqan3::align_cfg::aligned_ends{seqan3::free_ends_all} |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main()

// Configure the alignment kernel.
auto config = seqan3::align_cfg::method_global{} |
seqan3::align_cfg::scoring{seqan3::nucleotide_scoring_scheme{
seqan3::align_cfg::scoring_scheme{seqan3::nucleotide_scoring_scheme{
seqan3::match_score{4}, seqan3::mismatch_score{-2}}} |
seqan3::align_cfg::gap{seqan3::gap_scheme{seqan3::gap_score{-4}}} |
seqan3::align_cfg::aligned_ends{seqan3::free_ends_all} |
Expand Down
33 changes: 17 additions & 16 deletions include/seqan3/alignment/all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
* namespace called seqan3::align_cfg. This namespace is used to disambiguate configurations for the
* alignment algorithm with configurations from other algorithms in SeqAn.
* To compute a pairwise alignment at least two configuration elements must be provided, namely the
* the alignment method and the seqan3::align_cfg::scoring.
* the alignment method and the seqan3::align_cfg::scoring_scheme.
*
* ### Combining configuration elements
*
Expand All @@ -78,18 +78,18 @@
* types cannot be printed within the static assert, but the following table shows which combinations are possible.
* In general, the same configuration element cannot occur more than once inside of a configuration specification.
*
* | **Config** | **0** | **1** | **2** | **3** | **4** | **5** | **6** | **7** | **8** | **9** |
* |:---------------------------------------------------------|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
* | \ref seqan3::align_cfg::aligned_ends "0: Aligned ends" | ❌ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::band_fixed_size "1: Band" | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::gap "2: Gap scheme" | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::max_error "3: Max error" | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::method_global "4: Method global" | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::method_local "5: Method local" | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::parallel "6: Parallel" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::result "7: Result" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
* | \ref seqan3::align_cfg::scoring "8: Scoring scheme" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
* | \ref seqan3::align_cfg::vectorised "9: Vectorised" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
* | **Config** | **0** | **1** | **2** | **3** | **4** | **5** | **6** | **7** | **8** | **9** |
* |:-----------------------------------------------------------|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|
* | \ref seqan3::align_cfg::aligned_ends "0: Aligned ends" | ❌ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::band_fixed_size "1: Band" | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::gap "2: Gap scheme" | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::max_error "3: Max error" | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::method_global "4: Method global" | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::method_local "5: Method local" | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::parallel "6: Parallel" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ |
* | \ref seqan3::align_cfg::result "7: Result" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
* | \ref seqan3::align_cfg::scoring_scheme "8: Scoring scheme" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
* | \ref seqan3::align_cfg::vectorised "9: Vectorised" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
*
* \if DEV
* There is an additional configuration element \ref seqan3::align_cfg::debug "Debug", which enables the output of the
Expand Down Expand Up @@ -147,9 +147,9 @@
* their scores via `set_()` functions and by returning references to their internal score matrix. You can however
* add completely different types, as long as they model seqan3::scoring_scheme.
*
* The scoring scheme can be configured with the seqan3::align_cfg::scoring element. Since the scoring scheme is
* The scoring scheme can be configured with the seqan3::align_cfg::scoring_scheme element. Since the scoring scheme is
* strongly coupled on the sequences to be aligned it can not be defaulted. Thus, it is mandatory for the
* the developer to specify the seqan3::align_cfg::scoring configuration.
* the developer to specify the seqan3::align_cfg::scoring_scheme configuration.
*
* ### Scoring gaps
*
Expand Down Expand Up @@ -193,7 +193,8 @@
* special combinations of parameters a notably faster algorithm is available.
* It is automatically selected if all of the following requirements are satisfied:
* * Edit distance gaps, i.e. seqan3::align_cfg::gap is initialised with default initialised seqan3::gap_scheme
* * Edit distance scoring for \ref nucleotide "nucleotide alphabets", i.e. seqan3::align_cfg::scoring is initialised with default initialised seqan3::nucleotide_scoring_scheme.
* * Edit distance scoring for \ref nucleotide "nucleotide alphabets", i.e. seqan3::align_cfg::scoring_scheme is
* initialised with default initialised seqan3::nucleotide_scoring_scheme.
* * Global alignment, i.e. seqan3::align_cfg::method_global.
*
* There is a special shortcut for the above required scoring/gap configs called seqan3::align_cfg::edit_scheme,
Expand Down
5 changes: 3 additions & 2 deletions include/seqan3/alignment/configuration/align_config_edit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#pragma once

#include <seqan3/alignment/configuration/align_config_gap.hpp>
#include <seqan3/alignment/configuration/align_config_scoring.hpp>
#include <seqan3/alignment/configuration/align_config_scoring_scheme.hpp>
#include <seqan3/alignment/scoring/gap_scheme.hpp>
#include <seqan3/alignment/scoring/nucleotide_scoring_scheme.hpp>
#include <seqan3/core/algorithm/configuration.hpp>
Expand Down Expand Up @@ -48,6 +48,7 @@ namespace seqan3::align_cfg
* trigger the slower algorithm which can handle the case if the ends are free in the second sequence instead of the
* first sequence.
*/
inline constexpr configuration edit_scheme = scoring{nucleotide_scoring_scheme{}} | gap{gap_scheme{gap_score{-1}}};
inline constexpr configuration edit_scheme = scoring_scheme{nucleotide_scoring_scheme{}}
| gap{gap_scheme{gap_score{-1}}};

} // namespace seqan3
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// -----------------------------------------------------------------------------------------------------

/*!\file
* \brief Provides seqan3::align_cfg::scoring.
* \brief Provides seqan3::align_cfg::scoring_scheme.
* \author Jörg Winkler <j.winkler AT fu-berlin.de>
* \author Rene Rahn <rene.rahn AT fu-berlin.de>
*/
Expand Down Expand Up @@ -38,21 +38,21 @@ namespace seqan3::align_cfg
* \include test/snippet/alignment/configuration/minimal_alignment_config.cpp
*/
template <typename scoring_scheme_t>
struct scoring : public pipeable_config_element<scoring<scoring_scheme_t>, scoring_scheme_t>
struct scoring_scheme : public pipeable_config_element<scoring_scheme<scoring_scheme_t>, scoring_scheme_t>
{
//!\privatesection
//!\brief Internal id to check for consistent configuration settings.
static constexpr seqan3::detail::align_config_id id{seqan3::detail::align_config_id::scoring};
};

/*!\name Type deduction guides
* \relates seqan3::align_cfg::scoring
* \relates seqan3::align_cfg::scoring_scheme
* \{
*/

//!\brief Deduces the scoring scheme type from the constructor argument.
template <typename scheme_t>
scoring(scheme_t) -> scoring<remove_cvref_t<scheme_t>>;
scoring_scheme(scheme_t) -> scoring_scheme<remove_cvref_t<scheme_t>>;
//!\}

} // namespace seqan3::align_cfg
2 changes: 1 addition & 1 deletion include/seqan3/alignment/configuration/all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <seqan3/alignment/configuration/align_config_on_result.hpp>
#include <seqan3/alignment/configuration/align_config_parallel.hpp>
#include <seqan3/alignment/configuration/align_config_result.hpp>
#include <seqan3/alignment/configuration/align_config_scoring.hpp>
#include <seqan3/alignment/configuration/align_config_scoring_scheme.hpp>
#include <seqan3/alignment/configuration/align_config_vectorised.hpp>
#include <seqan3/alignment/configuration/detail.hpp>

Expand Down
2 changes: 1 addition & 1 deletion include/seqan3/alignment/configuration/detail.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ enum struct align_config_id : uint8_t
on_result, //!< ID for the \ref seqan3::align_cfg::on_result "on_result" option.
parallel, //!< ID for the \ref seqan3::align_cfg::parallel "parallel" option.
result, //!< ID for the \ref seqan3::align_cfg::result "result" option.
scoring, //!< ID for the \ref seqan3::align_cfg::scoring "scoring" option.
scoring, //!< ID for the \ref seqan3::align_cfg::scoring_scheme "scoring_scheme" option.
vectorised, //!< ID for the \ref seqan3::align_cfg::vectorised "vectorised" option.
SIZE //!< Represents the number of configuration elements.
};
Expand Down
4 changes: 2 additions & 2 deletions include/seqan3/alignment/pairwise/alignment_algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <type_traits>

#include <seqan3/alignment/configuration/align_config_band.hpp>
#include <seqan3/alignment/configuration/align_config_scoring.hpp>
#include <seqan3/alignment/configuration/align_config_scoring_scheme.hpp>
#include <seqan3/alignment/configuration/align_config_result.hpp>
#include <seqan3/alignment/exception.hpp>
#include <seqan3/alignment/matrix/trace_directions.hpp>
Expand Down Expand Up @@ -129,7 +129,7 @@ class alignment_algorithm :
*/
explicit constexpr alignment_algorithm(config_t const & cfg) : cfg_ptr{std::make_shared<config_t>(cfg)}
{
this->scoring_scheme = seqan3::get<align_cfg::scoring>(*cfg_ptr).value;
this->scoring_scheme = seqan3::get<align_cfg::scoring_scheme>(*cfg_ptr).value;
this->initialise_alignment_state(*cfg_ptr);
}
//!\}
Expand Down
6 changes: 3 additions & 3 deletions include/seqan3/alignment/pairwise/alignment_configurator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ struct alignment_contract
//!\brief Tests whether the scoring scheme is set and can be invoked with the sequences passed.
constexpr static bool expects_valid_scoring_scheme()
{
if constexpr (alignment_config_type::template exists<align_cfg::scoring>())
if constexpr (alignment_config_type::template exists<align_cfg::scoring_scheme>())
{
using scoring_type = std::remove_reference_t<
decltype(get<align_cfg::scoring>(std::declval<alignment_config_type>()).value)
decltype(get<align_cfg::scoring_scheme>(std::declval<alignment_config_type>()).value)
>;
return static_cast<bool>(scoring_scheme<scoring_type,
std::ranges::range_value_t<first_seq_t>,
Expand Down Expand Up @@ -318,7 +318,7 @@ struct alignment_configurator

// Use default edit distance if gaps are not set.
auto const & gaps = config_with_result_type.get_or(align_cfg::gap{gap_scheme{gap_score{-1}}}).value;
auto const & scoring_scheme = get<align_cfg::scoring>(cfg).value;
auto const & scoring_scheme = get<align_cfg::scoring_scheme>(cfg).value;
auto align_ends_cfg = config_with_result_type.get_or(align_cfg::aligned_ends{free_ends_none}).value;

if constexpr (config_t::template exists<seqan3::align_cfg::method_global>())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#pragma once

#include <seqan3/alignment/configuration/align_config_scoring.hpp>
#include <seqan3/alignment/configuration/align_config_scoring_scheme.hpp>

namespace seqan3::detail
{
Expand Down Expand Up @@ -49,7 +49,7 @@ class policy_scoring_scheme
* \param[in] config The alignment configuration with the stored scoring scheme.
*/
explicit policy_scoring_scheme(alignment_configuration_t const & config) :
scoring_scheme{seqan3::get<align_cfg::scoring>(config).value}
scoring_scheme{seqan3::get<align_cfg::scoring_scheme>(config).value}
{}
//!\}
};
Expand Down
4 changes: 2 additions & 2 deletions include/seqan3/alignment/pairwise/detail/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <seqan3/alignment/configuration/align_config_on_result.hpp>
#include <seqan3/alignment/configuration/align_config_parallel.hpp>
#include <seqan3/alignment/configuration/align_config_result.hpp>
#include <seqan3/alignment/configuration/align_config_scoring.hpp>
#include <seqan3/alignment/configuration/align_config_scoring_scheme.hpp>
#include <seqan3/alignment/configuration/align_config_vectorised.hpp>
#include <seqan3/alignment/matrix/detail/matrix_coordinate.hpp>
#include <seqan3/alignment/matrix/trace_directions.hpp>
Expand Down Expand Up @@ -134,7 +134,7 @@ struct alignment_configuration_traits
//!\brief Flag indicating whether a user provided callback was given.
static constexpr bool is_one_way_execution = configuration_t::template exists<align_cfg::on_result>();
//!\brief The selected scoring scheme.
using scoring_scheme_type = decltype(get<align_cfg::scoring>(std::declval<configuration_t>()).value);
using scoring_scheme_type = decltype(get<align_cfg::scoring_scheme>(std::declval<configuration_t>()).value);
//!\brief The alphabet of the selected scoring scheme.
using scoring_scheme_alphabet_type = typename scoring_scheme_type::alphabet_type;
//!\brief The selected result type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
#include <seqan/align.h>
#endif

constexpr auto nt_score_scheme = seqan3::nucleotide_scoring_scheme{seqan3::match_score{4},
seqan3::mismatch_score{-5}};
constexpr auto affine_cfg = seqan3::align_cfg::method_global{} |
seqan3::align_cfg::gap{seqan3::gap_scheme{seqan3::gap_score{-1},
seqan3::gap_open_score{-10}}} |
seqan3::align_cfg::scoring{seqan3::nucleotide_scoring_scheme{seqan3::match_score{4},
seqan3::mismatch_score{-5}}};
seqan3::align_cfg::scoring_scheme{nt_score_scheme};

// ============================================================================
// affine; score; dna4; single
Expand Down
Loading