From cc803c25e01a98381f6679044dff55b8d4e9d2dc Mon Sep 17 00:00:00 2001 From: smehringer Date: Wed, 16 Sep 2020 17:58:07 +0200 Subject: [PATCH 1/3] [MISC] Delete all usage of seqan3::align_cfg::aligned_ends. --- .../pairwise_alignment/configurations.cpp | 4 - .../pa_assignment_3_solution.cpp | 3 +- .../pairwise_alignment_solution_2.cpp | 3 +- .../pairwise_alignment_solution_4.cpp | 1 - .../pairwise_alignment_solution_5.cpp | 1 - .../read_mapper/read_mapper_step3.cpp | 1 - .../read_mapper/read_mapper_step4.cpp | 1 - doc/tutorial/search/search_solution5.cpp | 2 - .../align_config_aligned_ends.hpp | 564 ------------------ .../seqan3/alignment/configuration/all.hpp | 1 - .../seqan3/alignment/configuration/detail.hpp | 76 ++- .../alignment/pairwise/detail/type_traits.hpp | 3 - test/performance/io/format_sam_benchmark.cpp | 1 - .../configuration/align_cfg_aligned_ends.cpp | 20 - .../align_cfg_aligned_ends_access.cpp | 29 - .../configuration/align_cfg_edit_example.cpp | 7 +- .../alignment/configuration/CMakeLists.txt | 1 - .../align_config_aligned_ends_test.cpp | 403 ------------- .../align_config_common_test.cpp | 5 +- .../pairwise/alignment_configurator_test.cpp | 6 +- .../fixture/semi_global_affine_banded.hpp | 10 +- .../fixture/semi_global_affine_unbanded.hpp | 9 +- ...obal_edit_distance_max_errors_unbanded.hpp | 1 - .../semi_global_edit_distance_unbanded.hpp | 4 +- .../semi_global_affine_banded_test.cpp | 27 +- 25 files changed, 55 insertions(+), 1128 deletions(-) delete mode 100644 include/seqan3/alignment/configuration/align_config_aligned_ends.hpp delete mode 100644 test/snippet/alignment/configuration/align_cfg_aligned_ends.cpp delete mode 100644 test/snippet/alignment/configuration/align_cfg_aligned_ends_access.cpp delete mode 100644 test/unit/alignment/configuration/align_config_aligned_ends_test.cpp diff --git a/doc/tutorial/pairwise_alignment/configurations.cpp b/doc/tutorial/pairwise_alignment/configurations.cpp index 63308c9b27..2ebdea10d8 100644 --- a/doc/tutorial/pairwise_alignment/configurations.cpp +++ b/doc/tutorial/pairwise_alignment/configurations.cpp @@ -2,10 +2,6 @@ #include //! [include] -//! [include_aligned_ends] -#include -//! [include_aligned_ends] - //! [include_scoring_scheme] #include #include diff --git a/doc/tutorial/pairwise_alignment/pa_assignment_3_solution.cpp b/doc/tutorial/pairwise_alignment/pa_assignment_3_solution.cpp index 2ad915f188..96dfea376b 100644 --- a/doc/tutorial/pairwise_alignment/pa_assignment_3_solution.cpp +++ b/doc/tutorial/pairwise_alignment/pa_assignment_3_solution.cpp @@ -33,8 +33,7 @@ int main() seqan3::align_cfg::free_end_gaps_sequence1_trailing{false}, seqan3::align_cfg::free_end_gaps_sequence2_trailing{true}} | seqan3::align_cfg::scoring_scheme{seqan3::aminoacid_scoring_scheme{ - seqan3::aminoacid_similarity_matrix::BLOSUM62}} | - seqan3::align_cfg::aligned_ends{seqan3::free_ends_second}; + seqan3::aminoacid_similarity_matrix::BLOSUM62}}; for (auto const & res : seqan3::align_pairwise(source, config)) seqan3::debug_stream << "Score: " << res.score() << '\n'; diff --git a/doc/tutorial/pairwise_alignment/pairwise_alignment_solution_2.cpp b/doc/tutorial/pairwise_alignment/pairwise_alignment_solution_2.cpp index 28048bd056..6530164d12 100644 --- a/doc/tutorial/pairwise_alignment/pairwise_alignment_solution_2.cpp +++ b/doc/tutorial/pairwise_alignment/pairwise_alignment_solution_2.cpp @@ -22,8 +22,7 @@ int main() seqan3::align_cfg::free_end_gaps_sequence2_leading{false}, seqan3::align_cfg::free_end_gaps_sequence1_trailing{true}, seqan3::align_cfg::free_end_gaps_sequence2_trailing{false}} | - seqan3::align_cfg::scoring_scheme{seqan3::nucleotide_scoring_scheme{}} | - seqan3::align_cfg::aligned_ends{seqan3::free_ends_first}; + 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'; diff --git a/doc/tutorial/pairwise_alignment/pairwise_alignment_solution_4.cpp b/doc/tutorial/pairwise_alignment/pairwise_alignment_solution_4.cpp index b1082e215c..b37367bbe6 100644 --- a/doc/tutorial/pairwise_alignment/pairwise_alignment_solution_4.cpp +++ b/doc/tutorial/pairwise_alignment/pairwise_alignment_solution_4.cpp @@ -28,7 +28,6 @@ int main() seqan3::match_score{4}, seqan3::mismatch_score{-2}}} | seqan3::align_cfg::gap_cost_affine{seqan3::align_cfg::open_score{0}, seqan3::align_cfg::extension_score{-4}} | - seqan3::align_cfg::aligned_ends{seqan3::free_ends_all} | output_config; for (auto const & res : seqan3::align_pairwise(std::tie(seq1, seq2), config)) diff --git a/doc/tutorial/pairwise_alignment/pairwise_alignment_solution_5.cpp b/doc/tutorial/pairwise_alignment/pairwise_alignment_solution_5.cpp index ff74f9bc81..949ec585f1 100644 --- a/doc/tutorial/pairwise_alignment/pairwise_alignment_solution_5.cpp +++ b/doc/tutorial/pairwise_alignment/pairwise_alignment_solution_5.cpp @@ -28,7 +28,6 @@ int main() seqan3::match_score{4}, seqan3::mismatch_score{-2}}} | seqan3::align_cfg::gap_cost_affine{seqan3::align_cfg::open_score{0}, seqan3::align_cfg::extension_score{-4}} | - seqan3::align_cfg::aligned_ends{seqan3::free_ends_all} | output_config | seqan3::align_cfg::band_fixed_size{seqan3::align_cfg::lower_diagonal{-3}, seqan3::align_cfg::upper_diagonal{8}}; diff --git a/doc/tutorial/read_mapper/read_mapper_step3.cpp b/doc/tutorial/read_mapper/read_mapper_step3.cpp index c1c8f975f0..4a04f21437 100644 --- a/doc/tutorial/read_mapper/read_mapper_step3.cpp +++ b/doc/tutorial/read_mapper/read_mapper_step3.cpp @@ -59,7 +59,6 @@ void map_reads(std::filesystem::path const & query_path, seqan3::align_cfg::free_end_gaps_sequence1_trailing{true}, seqan3::align_cfg::free_end_gaps_sequence2_trailing{false}} | seqan3::align_cfg::edit_scheme | - seqan3::align_cfg::aligned_ends{seqan3::free_ends_first} | seqan3::align_cfg::output_alignment{} | seqan3::align_cfg::output_score{}; //! [alignment_config] diff --git a/doc/tutorial/read_mapper/read_mapper_step4.cpp b/doc/tutorial/read_mapper/read_mapper_step4.cpp index 32c108eb78..bf115d7a9c 100644 --- a/doc/tutorial/read_mapper/read_mapper_step4.cpp +++ b/doc/tutorial/read_mapper/read_mapper_step4.cpp @@ -68,7 +68,6 @@ void map_reads(std::filesystem::path const & query_path, seqan3::align_cfg::free_end_gaps_sequence1_trailing{true}, seqan3::align_cfg::free_end_gaps_sequence2_trailing{false}} | seqan3::align_cfg::edit_scheme | - seqan3::align_cfg::aligned_ends{seqan3::free_ends_first} | seqan3::align_cfg::output_alignment{} | seqan3::align_cfg::output_begin_position{} | seqan3::align_cfg::output_score{}; diff --git a/doc/tutorial/search/search_solution5.cpp b/doc/tutorial/search/search_solution5.cpp index e533b5ac0c..bc1e92e0ef 100644 --- a/doc/tutorial/search/search_solution5.cpp +++ b/doc/tutorial/search/search_solution5.cpp @@ -26,7 +26,6 @@ void run_text_single() seqan3::align_cfg::free_end_gaps_sequence1_trailing{true}, seqan3::align_cfg::free_end_gaps_sequence2_trailing{false}} | seqan3::align_cfg::edit_scheme | - seqan3::align_cfg::aligned_ends{seqan3::free_ends_first} | seqan3::align_cfg::output_alignment{} | seqan3::align_cfg::output_score{}; @@ -69,7 +68,6 @@ void run_text_collection() seqan3::align_cfg::free_end_gaps_sequence1_trailing{true}, seqan3::align_cfg::free_end_gaps_sequence2_trailing{false}} | seqan3::align_cfg::edit_scheme | - seqan3::align_cfg::aligned_ends{seqan3::free_ends_first} | seqan3::align_cfg::output_alignment{} | seqan3::align_cfg::output_score{}; diff --git a/include/seqan3/alignment/configuration/align_config_aligned_ends.hpp b/include/seqan3/alignment/configuration/align_config_aligned_ends.hpp deleted file mode 100644 index 882b09fccf..0000000000 --- a/include/seqan3/alignment/configuration/align_config_aligned_ends.hpp +++ /dev/null @@ -1,564 +0,0 @@ -// ----------------------------------------------------------------------------------------------------- -// Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin -// Copyright (c) 2016-2020, 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::align_cfg::aligned_ends. - * \author Jörg Winkler - * \author Rene Rahn - */ - -#pragma once - -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace seqan3 -{ - -/*!\brief A mixin class which can maintain a static or a dynamic bool state. - * \ingroup alignment_configuration - * \tparam value_t The value type to be represented. Must be of type std::true_type, std::false_type or `bool`. - * \tparam _is_static A boolean that evaluates to true only if `value_t` is a std::integral_constant. - * \tparam _value A boolean that captures the value of `value_t`, iff `_is_static` is `true`. Otherwise false. - * - * \details - * - * This mixin base class provides an optional pattern regarding the static state of the represented value. - * If the mixin is constructed from an std::integral_constant, it will hold an static state of the wrapped value. - * In the other case, when constructing it from a boolean, the state of the value will be dynamic. - */ -template , std::false_type, std::true_type>::value, - bool _value = std::conditional_t<_is_static, value_t, std::false_type>::value> -//!\cond - requires std::same_as || std::same_as || std::same_as -//!\endcond -struct sequence_end_gap_specifier_base -{ -protected: - - //!\brief Friend of this class to provide access to static constexpr members. - template - friend class end_gaps; - - //!\brief Used to differentiate between static and dynamic state. - static constexpr bool is_static = _is_static; - //!\brief Holds the static value if the state is static. - static constexpr bool static_value = _value; - -public: - - //!\brief Returns the wrapped value. - constexpr bool operator()() const noexcept - { - return value; - } - - //!\brief The wrapped value. - value_t value{}; -}; - -// ---------------------------------------------------------------------------- -// front_end_first -// ---------------------------------------------------------------------------- - -/*!\brief The penalty configuration for aligning the front of the first sequence with a gap. - * \ingroup alignment_configuration - * \tparam value_t The type of the value to be wrapped. Can be of type std::true_type, std::false_type or bool. - * - * \details - * - * This strong type enables (`false`) or disables (`true`) penalties for aligning the respective sequence end with gaps. - * If one constructs this element with a std::integral_constant it will convert to a static type such that - * compile time optimisations can be used. If the type is constructed from a bool it will convert to a dynamic type - * but will be converted to a static type during the configuration of the pairwise alignment algorithm. - * Using a `bool` allows to dynamically set the value if the option is only known at runtime. If the option is - * already known at compile time the static version will be the preferred option. - * - * \see seqan3::back_end_first - * \see seqan3::front_end_second - * \see seqan3::back_end_second - */ -template -struct front_end_first : public sequence_end_gap_specifier_base -{ - //!\privatesection - //!\brief An internal id to allow consistency checks with other gap specifiers. - static constexpr std::integral_constant id{}; -}; - -/*!\name Type deduction guides - * \relates seqan3::front_end_first - * \{ - */ -//!\brief Deduces the template argument from the type of the wrapped value. -template -front_end_first(value_t) -> front_end_first; -//!\} - -// ---------------------------------------------------------------------------- -// back_end_first -// ---------------------------------------------------------------------------- - -/*!\brief The penalty configuration for aligning the back of the first sequence with a gap. - * \ingroup alignment_configuration - * \tparam value_t The type of the value to be wrapped. Can be of type std::true_type, std::false_type or bool. - * - * \copydetails seqan3::front_end_first - * - * \see front_end_first - * \see front_end_second - * \see back_end_second - */ -template -struct back_end_first : public sequence_end_gap_specifier_base -{ - //!\privatesection - //!\brief An internal id to allow consistency checks with other gap specifiers. - static constexpr std::integral_constant id{}; -}; - -/*!\name Type deduction guides - * \relates seqan3::back_end_first - * \{ - */ -//!\brief Deduces the template argument from the type of the wrapped value. -template -back_end_first(value_t) -> back_end_first; -//!\} - -// ---------------------------------------------------------------------------- -// front_end_second -// ---------------------------------------------------------------------------- - -/*!\brief The penalty configuration for aligning the front of the second sequence with a gap. - * \ingroup alignment_configuration - * \tparam value_t The type of the value to be wrapped. Can be of type std::true_type, std::false_type or bool. - * - * \copydetails seqan3::front_end_first - * - * \see front_end_first - * \see back_end_first - * \see back_end_second - */ -template -struct front_end_second : public sequence_end_gap_specifier_base -{ - //!\privatesection - //!\brief An internal id to allow consistency checks with other gap specifiers. - static constexpr std::integral_constant id{}; -}; - -/*!\name Type deduction guides - * \relates seqan3::front_end_second - * \{ - */ -//!\brief Deduces the template argument from the type of the wrapped value. -template -front_end_second(value_t) -> front_end_second; -//!\} - -// ---------------------------------------------------------------------------- -// back_end_second -// ---------------------------------------------------------------------------- - -/*!\brief The penalty configuration for aligning the back of the second sequence with a gap. - * \ingroup alignment_configuration - * \tparam value_t The type of the value to be wrapped. Can be of type std::true_type, std::false_type or bool. - * - * \copydetails seqan3::front_end_first - * - * \see front_end_first - * \see back_end_first - * \see front_end_second - */ -template -struct back_end_second : public sequence_end_gap_specifier_base -{ - //!\privatesection - //!\brief An internal id to allow consistency checks with other gap specifiers. - static constexpr std::integral_constant id{}; -}; - -/*!\name Type deduction guides - * \relates seqan3::back_end_second - * \{ - */ -//!\brief Deduces the template argument from the type of the wrapped value. -template -back_end_second(value_t) -> back_end_second; -//!\} - -// ---------------------------------------------------------------------------- -// end_gaps -// ---------------------------------------------------------------------------- - -/*!\brief Wraps the sequence end-gap specifiers and provides ordered access to the respective values. - * \ingroup alignment_configuration - * \tparam ends_t A parameter pack containing at most 4 sequence end-gap specifier. - * - * \details - * - * A wrapper for providing ordered access to the end-gap specifiers independent of the input order. - * The possible input types can be: seqan3::front_end_first, seqan3::back_end_first, - * seqan3::front_end_second and seqan3::back_end_second. - * The types in the parameter pack `ends_t` are deduced by the corresponding constructor argument. - * If a specifier is not set it will default to `false` and thus the respective end-gap will be penalised in the - * pairwise alignment. - * - * ### Static vs runtime configuration - * - * The end_gaps class preserves the static/non-static property of the respective end-gap specifier. Those specifiers - * can, depending on how they are constructed, contain a static information or a runtime information whether or not a - * specific end-gap is enabled. To check whether the information was static the function end_gaps::is_static can be - * used. If it was static the function end_gaps::get_static can be used to obtain the respective value at compile time. - * Note that both functions are static and thus need to be called on the type and not on an instance of the type. - * - * \include snippet/alignment/configuration/align_cfg_aligned_ends_access.cpp - * - * To get the respective value at runtime use the \ref operator[]() "[]-operator". This function returns always the - * respective value independent of whether the value was provided by a static variable or a runtime variable. - * Also note that static and non-static end-gap specifier can be mixed within the end_gaps class - * template. - * - * It is strongly recommended to use the static information if possible and only make those specifiers depend on - * runtime parameters that cannot be resolved at compile time. This will reduce the compile time while configuring - * the alignment algorithm since the runtime information need to be translated into static information for the alignment - * algorithm. - * - * \see seqan3::front_end_first - * \see seqan3::back_end_first - * \see seqan3::front_end_second - * \see seqan3::back_end_second - */ -template -//!\cond - requires (sizeof...(ends_t) <= 4) && - ((detail::is_type_specialisation_of_v || - detail::is_type_specialisation_of_v || - detail::is_type_specialisation_of_v || - detail::is_type_specialisation_of_v) && ...) -//!\endcond -class end_gaps -{ - //!\brief Helper function to check valid end_gaps configuration. - template - static constexpr bool check_consistency(_ends_t ...ends) - { - if constexpr (sizeof...(ends) < 2) - { - return true; - } - else - { - return [] (auto head, auto ...tail) constexpr - { - using head_t = decltype(head); - if constexpr (((head_t::id != decltype(tail)::id) && ...)) - return check_consistency(tail...); - else - return false; - }(ends...); - } - } - - static_assert(check_consistency(ends_t{}...), - "You may not use the same end_gap specifier more than once."); - -public: - /*!\name Constructors, destructor and assignment - * \{ - */ - - //! \brief Default constructor. - constexpr end_gaps() noexcept - { - [[maybe_unused]] auto dummy = ((values[std::remove_reference_t::id()] = - std::remove_reference_t::static_value), ..., 0); - } - - constexpr end_gaps(end_gaps const &) noexcept = default; //!< Defaulted - constexpr end_gaps(end_gaps &&) noexcept = default; //!< Defaulted - constexpr end_gaps & operator=(end_gaps const &) noexcept = default; //!< Defaulted - constexpr end_gaps & operator=(end_gaps &&) noexcept = default; //!< Defaulted - ~end_gaps() noexcept = default; //!< Defaulted - - //!\brief Construction from at least one sequence end-gap specifier. - constexpr end_gaps(ends_t const ...args) noexcept - requires (sizeof...(ends_t) > 0) - { - detail::for_each([this](auto e) - { - values[std::remove_cvref_t::id()] = e(); - }, args...); - } - //\!} - - /*!\name Element access - * \{ - */ - /*!\brief Returns the value for the specifier at the given position. - * \param[in] pos The position to get the value for the respective end-gap for. - * - * \details - * - * The sequence end-gap specifier are stored in an ordered fashion. The following position mapping will be used - * to access the respective values: - * seqan3::front_end_first → 0; seqan3::back_end_first → 1; - * seqan3::front_end_second → 2; seqan3::back_end_second → 3. - * - * \returns `true` if the respective sequence end-gap is set to be free, `false` otherwise. - */ - constexpr bool operator[](size_t const pos) const noexcept - { - assert(pos < values.size()); - return values[pos]; - } - - /*!\brief Returns the static value for the specifier at the given position. - * \tparam pos The position to get the value for the respective end-gap for. - * - * \details - * - * The sequence end-gap specifier are stored in an ordered fashion. The following position mapping will be used - * to access the respective values: - * seqan3::front_end_first → 0; seqan3::back_end_first → 1; - * seqan3::front_end_second → 2; seqan3::back_end_second → 3. - * - * \returns `true` if the respective sequence end-gap is set to be free, `false` otherwise. - */ - template - static constexpr bool get_static() noexcept - { - static_assert(is_static_array[pos], - "You may not access an element that was not set in a core constant expression."); - return get(static_values); - } - //!\} - - /*!\ name Observers - * \{ - */ - /*!\brief Returns whether a value at the given position was set statically. - * \tparam pos The position to get the value for the respective end-gap for. - * - * \details - * - * \copydetails end_gaps::get_static - * - * \returns `true` if the respective sequence end-gap was set in a static context, `false` otherwise. - */ - template - static constexpr bool is_static() noexcept - { - return get(is_static_array); - } - //!\} - -private: - - //!\brief Stores the values. - std::array values{false, false, false, false}; - - //!\brief Stores whether a value is accessible in a constexpr context. - static constexpr std::array is_static_array - { - [](auto ...ends) constexpr - { - std::array tmp{false, false, false, false}; - detail::for_each([&tmp](auto v) - { - tmp[decltype(v)::id()] = decltype(v)::is_static; - }, ends...); - return tmp; - }(ends_t{}...) - }; - - //!\brief Stores the static values. - static constexpr std::array static_values - { - [](auto ...ends) constexpr - { - std::array tmp{false, false, false, false}; - detail::for_each([&tmp](auto v) - { - tmp[decltype(v)::id()] = decltype(v)::static_value; - }, ends...); - return tmp; - }(ends_t{}...) - }; -}; - -/*!\name Type deduction guides - * \{ - */ - -/*!\brief Deduces the end-gap specifier from the constructor arguments. - * \relates seqan3::end_gaps - * \tparam ends_t A template parameter pack containing at most 4 sequence end-gap specifiers. - */ -template -end_gaps(ends_t const & ...) -> end_gaps; -//!\} - -// ---------------------------------------------------------------------------- -// free_ends_all -// ---------------------------------------------------------------------------- - -/*!\name Predefined end-gaps configurations - * \relates seqan3::end_gaps - * \anchor predefined_end_gap_configurations - * \brief These variables are pre-configured end-gaps that are frequently used in pairwise sequence alignments. - * \{ - */ - -/*!\brief All ends are free. - * - * \details - * - * Computes an overlap alignment where the end of one sequence can overlap with the end of the other sequence. - * In the following example the gaps at the ends are not penalised and the sequences are aligned such that the prefix - * of the first sequences matches the suffix of the second sequence. - * - * ``` - * -----ACGTAAAACGT - * ||||| - * TTTTTACGTA------ - * ``` - */ -inline constexpr end_gaps free_ends_all{front_end_first{}, - back_end_first{}, - front_end_second{}, - back_end_second{}}; - -// ---------------------------------------------------------------------------- -// free_ends_none -// ---------------------------------------------------------------------------- - -/*!\brief All ends are penalised. - * - * \details - * - * Computes a global alignment where all end-gaps are penalised. For example in the following alignment, the - * alignment is forced to cover the entire sequences and the leading gaps will be penalised. - * - * ``` - * ---ACG--TAAAACGT - * ||| || | ||| - * AAAACGTATAGACCGT - * ``` - */ -inline constexpr end_gaps free_ends_none{front_end_first{}, - back_end_first{}, - front_end_second{}, - back_end_second{}}; - -// ---------------------------------------------------------------------------- -// free_ends_first -// ---------------------------------------------------------------------------- - -/*!\brief Ends of the first sequence are free. - * - * \details - * - * Computes a semi-global alignment where the ends of the first sequence can align to gaps without additional costs. - * For example in the following alignment, the leading and trailing gaps are not penalised and the smaller sequence - * can be aligned such that it matches the middle part of the longer sequence. - * - * ``` - * TTTTTACGT---ATGTCCCCC - * |||| | || - * -----ACGTAAAACGT----- - * ``` - */ -inline constexpr end_gaps free_ends_first{front_end_first{}, - back_end_first{}, - front_end_second{}, - back_end_second{}}; - -// ---------------------------------------------------------------------------- -// free_ends_second -// ---------------------------------------------------------------------------- - -/*!\brief Ends for the second sequence are free. - * - * \details - * - * Computes a semi-global alignment where the ends of the second sequence can align to gaps without additional costs. - * For example in the following alignment, the leading and trailing gaps are not penalised and the smaller sequence - * can be aligned such that it matches the middle part of the longer sequence. - * - * ``` - * -----ACGTAAAACGT----- - * |||| | || - * TTTTTACGT---ATGTCCCCC - * ``` - */ -inline constexpr end_gaps free_ends_second{front_end_first{}, - back_end_first{}, - front_end_second{}, - back_end_second{}}; -//!\} -} // namespace seqan3 - -namespace seqan3::align_cfg -{ - -// ---------------------------------------------------------------------------- -// aligned_ends -// ---------------------------------------------------------------------------- - -/*!\brief The configuration for aligned sequence ends. - * \ingroup alignment_configuration - * \tparam end_gaps_t The type of the end-gaps. Must be a specialisation of seqan3::end_gaps. - * - * \details - * - * This configuration element configures the aligned ends to further refine the global alignment algorithm. - * Particularly, the ends of the alignment can be penalised with gap costs or not. For example, the semi-global - * alignment does not penalise the leading and trailing gaps of one sequence while it does for the other sequence. - * - * The class is instantiated with an object of seqan3::end_gaps. The user can configure each of the - * gap specifier separately allowing for maximal flexibility when configuring the alignment algorithm. - * However, there are also predefined \ref predefined_end_gap_configurations "configurations" which should be - * preferred whenever possible. - * - * If this configuration element is not specified for the alignment algorithm, it will automatically default to - * \ref seqan3::end_gaps::free_ends_none "free_ends_none" which computes a global alignment. - * - * ### Example - * - * \include snippet/alignment/configuration/align_cfg_aligned_ends.cpp - */ -template -//!\cond - requires seqan3::detail::is_type_specialisation_of_v -//!\endcond -struct aligned_ends : public pipeable_config_element, end_gaps_t> -{ - //!\privatesection - //!\brief Internal id to check for consistent configuration settings. - static constexpr seqan3::detail::align_config_id id{seqan3::detail::align_config_id::aligned_ends}; -}; - -/*!\name Type deduction guides - * \relates seqan3::align_cfg::aligned_ends - * \{ - */ -//!\brief Deduces the end-gaps object type from the constructor argument. -template -aligned_ends(end_gaps_t) -> aligned_ends>; -//!\} - -} // namespace seqan3::align_cfg diff --git a/include/seqan3/alignment/configuration/all.hpp b/include/seqan3/alignment/configuration/all.hpp index 8ec29ba9bf..9bc343122a 100644 --- a/include/seqan3/alignment/configuration/all.hpp +++ b/include/seqan3/alignment/configuration/all.hpp @@ -12,7 +12,6 @@ #pragma once -#include #include #include #include diff --git a/include/seqan3/alignment/configuration/detail.hpp b/include/seqan3/alignment/configuration/detail.hpp index 645a61c82d..ee1039d8a6 100644 --- a/include/seqan3/alignment/configuration/detail.hpp +++ b/include/seqan3/alignment/configuration/detail.hpp @@ -22,8 +22,6 @@ namespace seqan3::detail */ enum struct align_config_id : uint8_t { - - aligned_ends, //!< ID for the \ref seqan3::align_cfg::aligned_ends "aligned_ends" option. band, //!< ID for the \ref seqan3::align_cfg::band_fixed_size "band" option. debug, //!< ID for the \ref seqan3::align_cfg::detail::debug "debug" option. gap, //!< ID for the \ref seqan3::align_cfg::gap_cost_affine "gap_cost_affine" option. @@ -58,44 +56,42 @@ template <> inline constexpr std::array(align_config_id::SIZE)>, static_cast(align_config_id::SIZE)> compatibility_table { - { //aligned_ends - //| band - //| | debug - //| | | gap - //| | | | global - //| | | | | local - //| | | | | | min_score - //| | | | | | | on_result - //| | | | | | | | output_alignment - //| | | | | | | | | output_begin_position - //| | | | | | | | | | output_end_position - //| | | | | | | | | | | output_sequence1_id - //| | | | | | | | | | | | output_sequence2_id - //| | | | | | | | | | | | | output_score - //| | | | | | | | | | | | | | parallel - //| | | | | | | | | | | | | | | result_type - //| | | | | | | | | | | | | | | | score_type - //| | | | | | | | | | | | | | | | | scoring - //| | | | | | | | | | | | | | | | | | vectorised - { 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 0: aligned_ends - { 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 1: band - { 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 2: debug - { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 3: gap - { 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 4: global - { 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 5: local - { 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 6: max_error - { 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 7: on_result - { 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 8: output_alignment - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 9: output_begin_position - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1}, // 10: output_end_position - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1}, // 11: output_sequence1_id - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1}, // 12: output_sequence2_id - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1}, // 13: output_score - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1}, // 14: parallel - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1}, // 15: result_type - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}, // 16: score_type - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, // 17: scoring - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0} // 18: vectorised + { //band + //| debug + //| | gap + //| | | global + //| | | | local + //| | | | | min_score + //| | | | | | on_result + //| | | | | | | output_alignment + //| | | | | | | | output_begin_position + //| | | | | | | | | output_end_position + //| | | | | | | | | | output_sequence1_id + //| | | | | | | | | | | output_sequence2_id + //| | | | | | | | | | | | output_score + //| | | | | | | | | | | | | parallel + //| | | | | | | | | | | | | | result_type + //| | | | | | | | | | | | | | | score_type + //| | | | | | | | | | | | | | | | scoring + //| | | | | | | | | | | | | | | | | vectorised + { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 0: band + { 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 1: debug + { 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 2: gap + { 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 3: global + { 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 4: local + { 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 5: max_error + { 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 6: on_result + { 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 7: output_alignment + { 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // 8: output_begin_position + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1}, // 9: output_end_position + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1}, // 10: output_sequence1_id + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1}, // 11: output_sequence2_id + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1}, // 12: output_score + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1}, // 13: parallel + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1}, // 14: result_type + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}, // 15: score_type + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1}, // 16: scoring + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0} // 17: vectorised } }; diff --git a/include/seqan3/alignment/pairwise/detail/type_traits.hpp b/include/seqan3/alignment/pairwise/detail/type_traits.hpp index ed84aec033..c8209d47d0 100644 --- a/include/seqan3/alignment/pairwise/detail/type_traits.hpp +++ b/include/seqan3/alignment/pairwise/detail/type_traits.hpp @@ -14,7 +14,6 @@ #include -#include #include #include #include @@ -125,8 +124,6 @@ struct alignment_configuration_traits //!\brief Flag indicating whether global alignment method is enabled. static constexpr bool is_global = configuration_t::template exists(); - //!\brief Flag indicating whether global alignment mode with free ends is enabled. - static constexpr bool with_free_end_gaps = configuration_t::template exists(); //!\brief Flag indicating whether local alignment mode is enabled. static constexpr bool is_local = configuration_t::template exists(); //!\brief Flag indicating whether banded alignment mode is enabled. diff --git a/test/performance/io/format_sam_benchmark.cpp b/test/performance/io/format_sam_benchmark.cpp index 3efdd8b60f..174346c849 100644 --- a/test/performance/io/format_sam_benchmark.cpp +++ b/test/performance/io/format_sam_benchmark.cpp @@ -48,7 +48,6 @@ static std::string create_sam_file_string(size_t const n_queries) seqan3::align_cfg::scoring_scheme{nt_score_scheme} | seqan3::align_cfg::gap_cost_affine{seqan3::align_cfg::open_score{-10}, seqan3::align_cfg::extension_score{-1}} | - seqan3::align_cfg::aligned_ends{seqan3::free_ends_first} | seqan3::align_cfg::output_begin_position{} | seqan3::align_cfg::output_alignment{} | seqan3::align_cfg::output_score{}; diff --git a/test/snippet/alignment/configuration/align_cfg_aligned_ends.cpp b/test/snippet/alignment/configuration/align_cfg_aligned_ends.cpp deleted file mode 100644 index cf0af21d85..0000000000 --- a/test/snippet/alignment/configuration/align_cfg_aligned_ends.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -int main() -{ - // Setup for overlap alignment. - seqan3::align_cfg::aligned_ends overlap{seqan3::free_ends_all}; - - // Setup for global alignment. - seqan3::align_cfg::aligned_ends global{seqan3::free_ends_none}; - - // Setup for semi-global alignment with free-end gaps in the first sequence. - seqan3::align_cfg::aligned_ends semi_seq1{seqan3::free_ends_first}; - - // Setup for semi-global alignment with free-end gaps in the second sequence. - seqan3::align_cfg::aligned_ends semi_seq2{seqan3::free_ends_second}; - - // Custom settings. - seqan3::align_cfg::aligned_ends custom{seqan3::end_gaps{seqan3::front_end_first{std::true_type{}}, seqan3::front_end_second{std::true_type{}}}}; -} diff --git a/test/snippet/alignment/configuration/align_cfg_aligned_ends_access.cpp b/test/snippet/alignment/configuration/align_cfg_aligned_ends_access.cpp deleted file mode 100644 index c45f5338fb..0000000000 --- a/test/snippet/alignment/configuration/align_cfg_aligned_ends_access.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -int main() -{ - // Create an end_gaps object with one user defined static value and one user defined non-static value. - seqan3::end_gaps eg{seqan3::front_end_first{std::true_type{}}, seqan3::front_end_second{true}}; - - // Check if the front_end_first parameter contains static information. - if constexpr (decltype(eg)::is_static<0>()) - { - seqan3::debug_stream << "The leading gaps of the first sequence are static and the value is: " << - std::boolalpha << decltype(eg)::get_static<0>() << '\n'; - } - - // Defaulted parameters will always be false and static. - seqan3::debug_stream << "The leading gaps of the first sequence are static and the value is " << - std::boolalpha << decltype(eg)::get_static<0>() << '\n'; - - // Non-static parameters won't be captured as static. Trying to access it via get_static will trigger a static assert. - if constexpr (!decltype(eg)::is_static<2>()) - { - seqan3::debug_stream << "The leading gaps of the second sequence is not static! The value is: " << - std::boolalpha << eg[2] << '\n'; - } - - seqan3::debug_stream << "The value can always be determined at runtime like for the trailing gaps of the second sequence: " << - std::boolalpha << eg[3] << '\n'; -} diff --git a/test/snippet/alignment/configuration/align_cfg_edit_example.cpp b/test/snippet/alignment/configuration/align_cfg_edit_example.cpp index c56c9bdae4..43ab36116e 100644 --- a/test/snippet/alignment/configuration/align_cfg_edit_example.cpp +++ b/test/snippet/alignment/configuration/align_cfg_edit_example.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -11,8 +10,7 @@ int main() seqan3::align_cfg::free_end_gaps_sequence2_leading{false}, seqan3::align_cfg::free_end_gaps_sequence1_trailing{true}, seqan3::align_cfg::free_end_gaps_sequence2_trailing{false}} | - seqan3::align_cfg::edit_scheme | - seqan3::align_cfg::aligned_ends{seqan3::free_ends_first}; + seqan3::align_cfg::edit_scheme; // Computes semi global edit distance using slower standard pairwise algorithm. auto cfg_slow = seqan3::align_cfg::method_global{ @@ -20,8 +18,7 @@ int main() seqan3::align_cfg::free_end_gaps_sequence2_leading{true}, seqan3::align_cfg::free_end_gaps_sequence1_trailing{false}, seqan3::align_cfg::free_end_gaps_sequence2_trailing{true}} | - seqan3::align_cfg::edit_scheme | - seqan3::align_cfg::aligned_ends{seqan3::free_ends_second}; + seqan3::align_cfg::edit_scheme; // Computes global distance allowing a minimal score of 3 (Default: edit distance). auto cfg_errors = seqan3::align_cfg::method_global{} | diff --git a/test/unit/alignment/configuration/CMakeLists.txt b/test/unit/alignment/configuration/CMakeLists.txt index 9fd166c97e..bdf2337e71 100644 --- a/test/unit/alignment/configuration/CMakeLists.txt +++ b/test/unit/alignment/configuration/CMakeLists.txt @@ -1,5 +1,4 @@ seqan3_test(align_config_band_test.cpp) -seqan3_test(align_config_aligned_ends_test.cpp) seqan3_test(align_config_common_test.cpp) seqan3_test(align_config_edit_test.cpp) seqan3_test(align_config_gap_cost_affine_test.cpp) diff --git a/test/unit/alignment/configuration/align_config_aligned_ends_test.cpp b/test/unit/alignment/configuration/align_config_aligned_ends_test.cpp deleted file mode 100644 index 097d6288ac..0000000000 --- a/test/unit/alignment/configuration/align_config_aligned_ends_test.cpp +++ /dev/null @@ -1,403 +0,0 @@ -// ----------------------------------------------------------------------------------------------------- -// Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin -// Copyright (c) 2016-2020, 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 -// ----------------------------------------------------------------------------------------------------- - -#include - -#include -#include -#include - -#include -#include -#include - -template -struct dummy_gap : seqan3::sequence_end_gap_specifier_base -{}; - -template -class static_end_gap_test : public ::testing::Test -{ -public: - - static constexpr bool expected_value = static_end_gap_test::determine_value(type{}); - -private: - - template