Skip to content

Commit

Permalink
Merge pull request #1891 from Irallia/BUG/alignment/assert_using_an_u…
Browse files Browse the repository at this point in the history
…nsigned_score_type

[FIX] Alignment score types should be signed
  • Loading branch information
smehringer committed Jun 16, 2020
2 parents 2ea3a70 + b9d043f commit 9816dcf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ Note that 3.1.0 will be the first API stable release and interfaces in this rele
* When invoking the alignment algorithm with a user defined thread count using the `seqan3::align_cfg::parallel`
configuration element, `std::thread::hardware_concurrency()` many threads were always spawned. This is now fixed and
only the specified number of threads will be spawned ([\#1854](https://github.com/seqan/seqan3/pull/1854)).
* Using an unsigned `score_type` is prevented with a static assert, since gaps and mismatches have negative scores and
thus need a signed score type ([\#1891](https://github.com/seqan/seqan3/pull/1891)).

### Argument Parser

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ class result : public pipeable_config_element<result<alignment_result_tag_t, sco
public:
//!\brief The score type of the alignment result.
using score_type = score_t;

static_assert(std::is_signed_v<score_type>,
"The alignment algorithm cannot be computed with an unsigned type as the score type. If you "
"explicitly want an unsigned type as the score type, please submit a feature request explaining the "
"your specific use case on our github page: github.com/seqan/seqan3.git.");
/*!\name Constructors, destructor and assignment
* \{
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main()
// You can also change the score type:

// Compute only the score given a specific score_type.
seqan3::align_cfg::result cfg_score_uint16{seqan3::with_score, seqan3::using_score_type<uint16_t>};
seqan3::align_cfg::result cfg_score_uint16{seqan3::with_score, seqan3::using_score_type<int16_t>};

// Compute the score given a specific score_type and the back coordinate.
seqan3::align_cfg::result cfg_end_double{seqan3::with_back_coordinate, seqan3::using_score_type<double>};
Expand Down

0 comments on commit 9816dcf

Please sign in to comment.