-
Notifications
You must be signed in to change notification settings - Fork 82
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
Align config/output configuration #2024
Align config/output configuration #2024
Conversation
Codecov Report
@@ Coverage Diff @@
## release-3.0.2 #2024 +/- ##
=================================================
+ Coverage 97.89% 97.91% +0.02%
=================================================
Files 263 263
Lines 9879 9887 +8
=================================================
+ Hits 9671 9681 +10
+ Misses 208 206 -2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can survey it looks very good. Above all, I have a couple of formulation suggestions.
// NOTE(rrahn): You must update this test if you add a new value to seqan3::align_cfg::id | ||
EXPECT_EQ(static_cast<uint8_t>(seqan3::detail::align_config_id::SIZE), 13); | ||
EXPECT_EQ(static_cast<uint8_t>(seqan3::detail::align_config_id::SIZE), 19); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does this happen? Is this part of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This happens in the first 5 commits. Each output option is a separate commit and updates this value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We overlooked an 'options', but I already approve.
Thanks for the PR!
Great, thanks. @smehringer I will first rebase and then ping you again once the commits are clean again. |
20a9b26
to
e8fae4e
Compare
@smehringer this is now ready for second review. Thanks a lot. |
e8fae4e
to
b2bee49
Compare
@smehringer ping pong |
/*!\brief Tag representing score output for the alignment algorithms. | ||
* \ingroup alignment_configuration | ||
*/ | ||
struct output_score_tag : public pipeable_config_element<output_score_tag> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually had the tag in seqan3::detail to hide it from the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. In case we have a simple configuration we decided to call the class _tag
and the instance of it without the tag suffix. This has nothing to do with detail or non-detail code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case we have a simple configuration we decided to call the class _tag and the instance of it without the tag suffix
Yes absolutely
This has nothing to do with detail or non-detail code.
I still think so, at least it is that way in all the other condifurations:
seqan3::detail::method_local_tag
for seqan3::align_cfg::method_local
seqan3::detail::vectorised_tag
for seqan3::align_cfg::vectorised
seqan3::detail::output_query_id_tag
for seqan3::search_cfg::output_query_id
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No 😱 they should not be in detail. Otherwise, how is the user supposed to call get on it. seqan3::get<seqan3::align_cfg::method_local>
is not working and if the tag is in detail namespace, then he can't see the user documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha well somewhere this went wrong then. I always thought that all the special configuration functionality except the |
was rather for us internally anyway. Will you open an issue for this? I guess it should be in the current release then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix it right away in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha well somewhere this went wrong then.
Yes, by neither reading the user story nor the config design document. 😒
static constexpr bool has_output_configuration = compute_score || | ||
compute_end_positions || | ||
compute_begin_positions || | ||
compute_sequence_alignment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you leave out align_cfg::output_sequence1_id
and align_cfg::output_sequence2_id
on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a separate issue that I will work on afterwards.
else | ||
res_vt.begin_positions = this->invalid_coordinate(); | ||
} | ||
cached_begin_positions = alignment_begin_positions(this->trace_matrix(), cached_end_positions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if if constexpr (compute_end_positions)
before evaluated to false and the end positions have not been properly initialised?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, someone configured the edit distance wrong. This is an internal dependency. I will add a static_assert to make sure that this is safe at compile time.
Edit:
What I mean is that the edit distance algorithm internally has to choose these values. These dependencies are not part of any public interface so it would be an ill-formed program by the developer and not the user. But I added the static assert to make this clear.
{ // Only compute begin and end position if not cached already. | ||
using alignment_t = decltype(res_vt.alignment); | ||
res_vt.alignment = alignment_trace<alignment_t>(database, | ||
query, | ||
this->trace_matrix(), | ||
res_vt.end_positions, | ||
res_vt.begin_positions); | ||
cached_end_positions, | ||
cached_begin_positions); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the comment in this context. Where do you compute the begin and end position "if not cashed already"? It seems you are just using the cashed_[..]
variables without checking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is an old comment. I'll remove it
seqan3::align_cfg::result{seqan3::with_alignment, seqan3::using_score_type<double>}; | ||
seqan3::align_cfg::output_score | | ||
seqan3::align_cfg::output_alignment | | ||
seqan3::align_cfg::result{seqan3::with_score, seqan3::using_score_type<double>}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like above
@@ -68,7 +78,10 @@ TEST(alignment_selector, align_result_selector_using_score_type) | |||
|
|||
auto cfg = seqan3::align_cfg::method_global{} | | |||
seqan3::align_cfg::edit_scheme | | |||
seqan3::align_cfg::result{seqan3::with_end_positions, seqan3::using_score_type<double>}; | |||
seqan3::align_cfg::result{seqan3::with_score, seqan3::using_score_type<double>} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here
include/seqan3/alignment/all.hpp
Outdated
* aligned. For example in the global alignment the begin and end positions are identical to the positions of the | ||
* original sequences since the alignment has to encompass the entire sequences, but in case of a local alignment the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* aligned. For example in the global alignment the begin and end positions are identical to the positions of the | |
* original sequences since the alignment has to encompass the entire sequences, but in case of a local alignment the | |
* aligned. For example, the begin and end positions of a global alignment encompass the entire sequences, | |
* but in case of a local alignment the |
The sentence before was a little confusing and I think didn't bring in extra information.
include/seqan3/alignment/all.hpp
Outdated
* To obtain the actual alignment the option seqan3::align_cfg::output_alignment has to be specified. | ||
* The options can be combiend with each other in order to customise the alignment and the respective output of the | ||
* alignment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* To obtain the actual alignment the option seqan3::align_cfg::output_alignment has to be specified. | |
* The options can be combiend with each other in order to customise the alignment and the respective output of the | |
* alignment. | |
* To obtain the actual alignment the option seqan3::align_cfg::output_alignment has to be specified. | |
* The options can be combiend with each other in order to customise the alignment algorithm and the respective output of the |
How does the output customise the alignment? It can only customise the alignment algorithm, no?
I think you use "alignment" as in "the deed of aligning", but also for the resulting trace. That's a little confusing.
include/seqan3/alignment/all.hpp
Outdated
* If none of the above configuration was set by the user, then all output options will be enabled by default. | ||
* But be aware that trying to access one of the outputs, if it has not been configured, will raise a static assertion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm isn't that intuitive? We compute everything but then wouldn't let people access those information?
Or did I understand this sentence wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a sentence is missing
8ea4bdf
to
6941831
Compare
6941831
to
c170478
Compare
/*!\brief Tag representing score output for the alignment algorithms. | ||
* \ingroup alignment_configuration | ||
*/ | ||
struct output_score_tag : public pipeable_config_element<output_score_tag> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case we have a simple configuration we decided to call the class _tag and the instance of it without the tag suffix
Yes absolutely
This has nothing to do with detail or non-detail code.
I still think so, at least it is that way in all the other condifurations:
seqan3::detail::method_local_tag
for seqan3::align_cfg::method_local
seqan3::detail::vectorised_tag
for seqan3::align_cfg::vectorised
seqan3::detail::output_query_id_tag
for seqan3::search_cfg::output_query_id
...
seqan3::configuration cfg = seqan3::align_cfg::method_global{} | | ||
seqan3::align_cfg::edit_scheme | | ||
seqan3::align_cfg::result{seqan3::with_alignment, | ||
seqan3::using_score_type<double>}; | ||
seqan3::align_cfg::result{seqan3::with_score, seqan3::using_score_type<double>}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄 well thats true. You have many TODO comments in this PR though, so I thought you deliberately did this..
Adds the new alignment configuration to output the score.
… algorithm and the configurator. This removes any dependencies to the deprecated align_cfg::result configuration, i.e. the algorithms can be ported to the new interface using the align_cfg::output configuration.
With the new align_cfg::output configuration the different features that are computed are not dependent anymore. However, some computations of the edit distance algorithm are necessary in order to compute a specific feature. For example, when the alignment is requested the edit distance algorithm must also compute the begin and end positions. This commit separates the edit distance configuration from the user configurations, i.e. if the user requested an alignment but not the begin/end positions, the algorithm still executes correctly, while at the end only the alignemnt will be stored.
This changes the alignment traits and result seclector to use the new align_cfg::output option. It changes the interface of all tests and benchmarks and snippets to use the new configuration option.
47ee83e
to
08fcc66
Compare
See comment in Gitter before you merge |
fixes seqan/product_backlog#180
Replaces the align_cfg::result with the align_cfg::output.
The align_cfg::result is still needed in order to set the score type which will be fixed by another issue and is not part of this PR. So removing the result option will be done later when the score type is also changed to the new configuration.