diff --git a/doc/tutorial/pairwise_alignment/configurations.cpp b/doc/tutorial/pairwise_alignment/configurations.cpp index 63308c9b27..2481da8e41 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 @@ -15,6 +11,10 @@ #include //! [include_gap_cost_affine] +//! [include_method] +#include +//! [include_method] + //! [include_output] #include //! [include_output] @@ -33,18 +33,16 @@ int main() { { -//! [aligned_ends] - -seqan3::front_end_first fef{std::true_type{}}; -seqan3::back_end_first bef{std::false_type{}}; -seqan3::front_end_second fes{true}; -seqan3::back_end_second bes{false}; - -auto cfg_1 = seqan3::align_cfg::aligned_ends{seqan3::end_gaps{fef, bef, fes, bes}}; -auto cfg_2 = seqan3::align_cfg::aligned_ends{seqan3::end_gaps{fef, fes}}; -//! [aligned_ends] -(void) cfg_1; -(void) cfg_2; +//! [method_global_free_end_gaps] + // Example of a semi-global alignment where leading and trailing gaps in the + // second sequence are not penalised: + auto config = seqan3::align_cfg::method_global{ + seqan3::align_cfg::free_end_gaps_sequence1_leading{false}, + 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}}; +//! [method_global_free_end_gaps] +(void) config; } { diff --git a/doc/tutorial/pairwise_alignment/index.md b/doc/tutorial/pairwise_alignment/index.md index 0273ae756c..b29f5a7508 100644 --- a/doc/tutorial/pairwise_alignment/index.md +++ b/doc/tutorial/pairwise_alignment/index.md @@ -110,45 +110,26 @@ seqan3::align_cfg::method_global. \remark The method configuration must be given by the user as it strongly depends on the application context. It would be wrong for us to assume what the intended default behaviour should be. -The global alignment can be further refined by setting the seqan3::align_cfg::aligned_ends option. -The seqan3::align_cfg::aligned_ends class specifies whether or not gaps at the end of the sequences are penalised. -In SeqAn you can configure this behaviour for every end (front and back of the first sequence and second sequence) -separately using the seqan3::end_gaps class. -This class is constructed with up to 4 end gap specifiers (one for every end): - - - seqan3::front_end_first - aligning front of first sequence with a gap. - - seqan3::back_end_first - aligning back of first sequence with a gap. - - seqan3::front_end_second - aligning front of second sequence with a gap. - - seqan3::back_end_second - aligning back of second sequence with a gap. - -These classes can be constructed with either a constant boolean (std::true_type or std::false_type) or a regular `bool` -argument. The former enables static configuration of the respective features in the alignment algorithm. The -latter allows to configure these features at runtime. This makes setting these values from runtime dependent parameters, -e.g. user input, much easier. The following code snippet demonstrates the different use cases: - -\snippet doc/tutorial/pairwise_alignment/configurations.cpp include_aligned_ends -\snippet doc/tutorial/pairwise_alignment/configurations.cpp aligned_ends - -The `cfg_1` and the `cfg_2` will result in the exact same configuration of the alignment where aligning the front of -either sequence with gaps is not penalised while the back of both sequences is. The order of the arguments is -irrelevant. Specifiers initialised with constant booleans can be mixed with those initialised with `bool` values. -If a specifier for a particular sequence end is not given, it defaults to the specifier initialised with -`std::false_type`. - -\note You should always prefer initialising the end-gaps specifiers using the boolean constants if possible -as it reduces the compile time. The reason for this is that the runtime information is converted into static types -for the alignment algorithm. For every end-gap specifier the compiler will generate two versions for the `true` and the -`false` case. This adds up to 16 different paths the compiler needs to instantiate. - -SeqAn also offers \ref predefined_end_gap_configurations "predefined" seqan3::end_gaps configurations that -cover the typical use cases. - -| Entity | Meaning | -| -------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| -| \ref seqan3::end_gaps::free_ends_none "free_ends_none" | Enables the typical global alignment. | -| \ref seqan3::end_gaps::free_ends_all "free_ends_all" | Enables overlap alignment, where the end of one sequence can overlap the end of the other sequence. | -| \ref seqan3::end_gaps::free_ends_first "free_ends_first" | Enables semi global alignment, where the second sequence is aligned as an infix of the first sequence. | -| \ref seqan3::end_gaps::free_ends_second "free_ends_second" | Enables semi global alignment, where the first sequence is aligned as an infix of the second sequence. | +The global alignment can be further refined by initialising the seqan3::align_cfg::method_global configuration element +with the free end gap specifiers. They specify whether gaps at the end of the sequences are penalised. +In SeqAn you can configure this behaviour for every end, namely for leading and trailing gaps of the first and second +sequence. seqan3::align_cfg::method_global is constructed with 4 free end gap specifiers (one for every end): + + - seqan3::align_cfg::free_end_gaps_sequence1_leading - If set to true, aligning leading gaps in first sequence is + not penalised. + - seqan3::align_cfg::free_end_gaps_sequence2_leading - If set to true, aligning leading gaps in second sequence is + not penalised. + - seqan3::align_cfg::free_end_gaps_sequence1_trailing - If set to true, aligning trailing gaps in first sequence is + not penalised. + - seqan3::align_cfg::free_end_gaps_sequence2_trailing - If set to true, aligning trailing gaps in second sequence is + not penalised. + +The following code snippet demonstrates the different use cases: + +\snippet doc/tutorial/pairwise_alignment/configurations.cpp include_method +\snippet doc/tutorial/pairwise_alignment/configurations.cpp method_global_free_end_gaps + +The order of arguments is fixed and must always be as shown in the example. \assignment{Assignment 2} @@ -161,8 +142,8 @@ would be aligned as an infix of the second sequence. \include doc/tutorial/pairwise_alignment/pairwise_alignment_solution_2.cpp -To accomplish our goal we simply add the align_cfg::aligned_ends option initialised with `free_ends_first` to the -existing configuration. +To accomplish our goal we initialise the `method_global` option with the free end specifiers +for sequence 1 set to `true`, and those for sequence 2 with `false`. \endsolution @@ -193,7 +174,7 @@ the alignment computation. The default initialised seqan3::align_cfg::gap_cost_a and for a gap opening to `0`. Note that the gap open score is added to the gap score when a gap is opened within the alignment computation. Therefore setting the gap open score to `0` disables affine gaps. You can pass a seqan3::align_cfg::extension_score and a seqan3::align_cfg::open_score object to initialise the scheme -with custom gap penalties. The penalties can be assessed changed later by using the respective member variables +with custom gap penalties. The penalties can be assessed changed later by using the respective member variables `extension_score` and `open_score`. \attention SeqAn's alignment algorithm computes the maximal similarity score, thus the match score must be set to a @@ -306,19 +287,25 @@ To make the configuration easier, we added a shortcut called seqan3::align_cfg:: \snippet doc/tutorial/pairwise_alignment/configurations.cpp include_edit \snippet doc/tutorial/pairwise_alignment/configurations.cpp edit +The `edit_scheme` still has to be combined with an alignment method. When combining it +with the seqan3::align_cfg::method_global configuration element, the edit distance algorithm +can be further refined with free end gaps (see section `Global and semi-global alignment`). + +\attention Only the following free end gap configurations are supported for the +global alignment configuration with the edit scheme: +- no free end gaps (all free end gap specifiers are set to `false`) +- free end gaps for the first sequence (free end gaps are set to `true` for the first and + to `false` for the second sequence) +Using any other free end gap configuration will disable the edit distance and fall back to the standard pairwise +alignment and will not use the fast bitvector algorithm. + ### Refine edit distance -The edit distance can be further refined using seqan3::align_cfg::aligned_ends to also compute a semi-global alignment -and the seqan3::align_cfg::min_score configuration to fix an edit score (a limit of the allowed number of edits). If the -respective alignment could not find a solution within the given error bound, the resulting score is infinity -(corresponds to std::numeric_limits::max). Also the alignment and the begin and end positions of the alignment can be -computed using a combination of the align_cfg::output_alignment, align_cfg::output_begin_position and -align_cfg::output_end_position options. - -\attention Only the options seqan3::free_ends_none and seqan3::free_ends_first -are supported for the aligned ends configuration with the edit distance. Using any other aligned ends configuration will -disable the edit distance and fall back to the standard pairwise alignment and will not use the fast bitvector -algorithm. +The edit distance can be further refined using the seqan3::align_cfg::min_score configuration to fix an edit score +(a limit of the allowed number of edits).. If the respective alignment could not find a solution within the given error +bound, the resulting score is infinity (corresponds to std::numeric_limits::max). Also the alignment and the begin and +end positions of the alignment can be computed using a combination of the align_cfg::output_alignment, +align_cfg::output_begin_position and align_cfg::output_end_position options. \assignment{Assignment 6} 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/all.hpp b/include/seqan3/alignment/all.hpp index e1a8f2c00c..a4621d5f07 100644 --- a/include/seqan3/alignment/all.hpp +++ b/include/seqan3/alignment/all.hpp @@ -78,25 +78,23 @@ * 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** | **10** | **11** | **12** | **13** | **14** | **15** | - * |:----------------------------------------------------------------------------|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:------:|:------:|:------:|:------:|:------:|:------:| - * | \ref seqan3::align_cfg::aligned_ends "0: Aligned ends" | ❌ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::band_fixed_size "1: Band" | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::gap_cost_affine "2: Gap scheme affine" | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::min_score "3: Min score" | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::method_global "4: Method global" | ❌ | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::method_local "5: Method local" | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::output_alignment "6: Alignment output" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::output_end_position "7: End positions output" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::output_begin_position "8: Begin positions output" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::output_score "9: Score output" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::output_sequence1_id "10: Sequence1 id output" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::output_sequence2_id "11: Sequence2 id output" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::parallel "12: Parallel" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | - * | \ref seqan3::align_cfg::score_type "13: Score type" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | - * | \ref seqan3::align_cfg::scoring_scheme "14: Scoring scheme" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | - * | \ref seqan3::align_cfg::vectorised "15: Vectorised" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | - + * | **Config** | **0** | **1** | **2** | **3** | **4** | **5** | **6** | **7** | **8** | **9** | **10** | **11** | **12** | **13** | **14** | + * |:----------------------------------------------------------------------------|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:------:|:------:|:------:|:------:|:------:| + * | \ref seqan3::align_cfg::band_fixed_size "0: Band" | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | + * | \ref seqan3::align_cfg::gap_cost_affine "1: Gap scheme affine" | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | + * | \ref seqan3::align_cfg::min_score "2: Min score" | ✅ | ✅ | ❌ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | + * | \ref seqan3::align_cfg::method_global "3: Method global" | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | + * | \ref seqan3::align_cfg::method_local "4: Method local" | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | + * | \ref seqan3::align_cfg::output_alignment "5: Alignment output" | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | + * | \ref seqan3::align_cfg::output_end_position "6: End positions output" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | + * | \ref seqan3::align_cfg::output_begin_position "7: Begin positions output" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | + * | \ref seqan3::align_cfg::output_score "8: Score output" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | + * | \ref seqan3::align_cfg::output_sequence1_id "9: Sequence1 id output" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | + * | \ref seqan3::align_cfg::output_sequence2_id "10: Sequence2 id output" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | + * | \ref seqan3::align_cfg::parallel "11: Parallel" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | + * | \ref seqan3::align_cfg::score_type "12: Score type" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | + * | \ref seqan3::align_cfg::scoring_scheme "13: Scoring scheme" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | + * | \ref seqan3::align_cfg::vectorised "14: Vectorised" | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | * * \if DEV * There is an additional configuration element \ref seqan3::align_cfg::detail::debug "Debug", which enables the output @@ -229,7 +227,8 @@ * * The edit configuration can be further specialised with following configs: * * Set a minimal score, i.e. specify the seqan3::align_cfg::min_score configuration - * * Compute a semi-global alignment, i.e seqan3::align_cfg::aligned_ends is initialised with seqan3::end_gaps::free_ends_first. + * * Compute a semi-global alignment, i.e refine the seqan3::align_cfg::method_global configuration with the respective + * free end gap specifiers. * * \note If there was a configuration that is not suitable for the edit distance algorithm the standard alignment * algorithm is executed as a fallback. 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/align_config_edit.hpp b/include/seqan3/alignment/configuration/align_config_edit.hpp index 4fe92db54e..57585bfe8c 100644 --- a/include/seqan3/alignment/configuration/align_config_edit.hpp +++ b/include/seqan3/alignment/configuration/align_config_edit.hpp @@ -34,8 +34,9 @@ namespace seqan3::align_cfg * * Under the hood SeqAn uses a [fast bit-vector algorithm](https://dl.acm.org/citation.cfm?id=316550) to compute the * edit distance whenever possible. This depends on the final alignment configuration. Currently, the fast - * edit distance algorithm is only triggered for \ref seqan3::align_cfg::method_global "global alignments" and - * \ref seqan3::end_gaps::free_ends_first "semi-global alignments" with free ends in the first sequence. + * edit distance algorithm is only triggered for \ref seqan3::align_cfg::method_global "global alignments" with the + * with free ends in the first sequence. So make sure to configure the seqan3::align_cfg::method_global configuration + * element accordingly (see class documentation). * * The performance of the algorithm can further be improved if the number of maximal errors (edits) is known by using * the align_cfg::min_score configuration. 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