Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[FIX] Alignment score types should be signed #1891

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,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