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

[API] The alignment configuration for the band changed to seqan3::align_cfg::band_fixed_size #1873

Merged
merged 5 commits into from
Jun 11, 2020

Conversation

rrahn
Copy link
Contributor

@rrahn rrahn commented Jun 4, 2020

Changes

  • Make strong type streamable
  • Add test case for exists in configuration test template
  • Rename the existing band to align_cfg::band_fixed_size
  • Introducing strong types for setting lower and upper diagonal
  • Direct access of the members via the config.
  • Adjust the tutorial and all snippets
  • Adjust the API documentation
  • Remove all references to the old static_band mechanism
  • Fix all dependent classes and tests

fixes seqan/product_backlog#98

@rrahn rrahn requested review from a team and svnbgnk and removed request for a team June 4, 2020 21:50
@marehr marehr requested review from marehr and removed request for svnbgnk June 7, 2020 17:13
@marehr
Copy link
Member

marehr commented Jun 7, 2020

I assigned myself, because I'm was also requested to review PR #1876.

Copy link
Member

@marehr marehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only small things! Despite the high number of changes the diff look pretty good :)

include/seqan3/core/detail/strong_type.hpp Outdated Show resolved Hide resolved
doc/tutorial/pairwise_alignment/index.md Outdated Show resolved Hide resolved
requires output_stream_over<stream_t, underlying_type_t const &> &&
((skills & strong_type_skill::stream) != strong_type_skill::none)
//!\endcond
stream_t & operator<<(stream_t & stream, strong_type<underlying_type_t, derived_t, skills> const & value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you not overload debugstream?

I'm not a huge fan of overloading every possible stream operator.

I would prefer a specific overload for debugstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it weird if we say the skill allows streaming the type but then only restrict it to the debug stream. I am also in slight preference for making the strong type a public type at some point.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question is why strong types are not always printable if the underlying type is printable?

Please just overload debug_stream 🥺

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is exactly the design of the strong types. They are not supposed to automatically inherit the behavior of the underlying type but it needs to be selected individually. If you want the type to inherit all its features just use a type alias.
It would be ok, I guess as, long as the strong type is detail to make it only debug streambale. It would not be ok if it is public. Something we should consider for the future if we are beginning to use strong types in more public interfaces. Since then the user knows what can be done with the interface. I will make it now explicit, but that should become a generic stream overload if it goes public.

@rrahn rrahn requested a review from marehr June 8, 2020 14:26
@rrahn
Copy link
Contributor Author

rrahn commented Jun 8, 2020

@marehr when you are done I'll rebase onto master to get rid of the changelog conflict.

Copy link
Member

@marehr marehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥺

requires output_stream_over<stream_t, underlying_type_t const &> &&
((skills & strong_type_skill::stream) != strong_type_skill::none)
//!\endcond
stream_t & operator<<(stream_t & stream, strong_type<underlying_type_t, derived_t, skills> const & value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question is why strong types are not always printable if the underlying type is printable?

Please just overload debug_stream 🥺

@rrahn rrahn force-pushed the alignment/banded_implementation_config branch from b14e78b to 2595eaf Compare June 9, 2020 11:03
@rrahn rrahn requested a review from marehr June 9, 2020 11:03
@codecov
Copy link

codecov bot commented Jun 9, 2020

Codecov Report

Merging #1873 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1873   +/-   ##
=======================================
  Coverage   97.67%   97.67%           
=======================================
  Files         253      254    +1     
  Lines        9552     9565   +13     
=======================================
+ Hits         9330     9343   +13     
  Misses        222      222           
Impacted Files Coverage Δ
...ignment/matrix/detail/aligned_sequence_builder.hpp 100.00% <ø> (ø)
...e/seqan3/alignment/pairwise/detail/type_traits.hpp 100.00% <ø> (ø)
...qan3/alignment/configuration/align_config_band.hpp 100.00% <100.00%> (ø)
...etail/alignment_score_matrix_one_column_banded.hpp 97.05% <100.00%> (ø)
...trix/detail/alignment_trace_matrix_full_banded.hpp 97.87% <100.00%> (+0.09%) ⬆️
.../seqan3/alignment/pairwise/alignment_algorithm.hpp 100.00% <100.00%> (ø)
...gnment/pairwise/policy/alignment_matrix_policy.hpp 100.00% <100.00%> (ø)
include/seqan3/core/detail/strong_type.hpp 100.00% <100.00%> (ø)
...qan3/alignment/matrix/detail/matrix_coordinate.hpp 100.00% <0.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2248404...f63e2b9. Read the comment docs.

Copy link
Member

@marehr marehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not completely sure how to proceed.

Technically, this PR should come after #1871, but it will work any way even after that PR.

My only open issue would be renaming type_skills -> skills_.

requires std::same_as<band_t, static_band>
//!\endcond
struct band : public pipeable_config_element<band<band_t>, band_t>
class band_fixed_size : public pipeable_config_element<band_fixed_size, seqan3::detail::empty_type>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class band_fixed_size : public pipeable_config_element<band_fixed_size, seqan3::detail::empty_type>
class band_fixed_size : public pipeable_config_element<band_fixed_size, seqan3::detail::empty_type>

Is this blocked by #1871?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, both could be valid. But need to be updated anyway. Since #1871 is in second review already i will update this afterwards.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1871 is merged :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know

*/
{ std::remove_reference_t<strong_type_t>::skills };
//!\cond
requires std::same_as<decltype(std::remove_reference_t<strong_type_t>::skills), strong_type_skill const>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😿 This will mess up #1866 again 😿 But such is live 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whatever comes first :)

@@ -112,11 +166,12 @@ namespace seqan3::detail
*
* \include test/snippet/core/detail/strong_type_adding_skills.cpp
*/
template <typename value_t, typename derived_t, strong_type_skill skills = strong_type_skill::none>
template <typename value_t, typename derived_t, strong_type_skill type_skills = strong_type_skill::none>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
template <typename value_t, typename derived_t, strong_type_skill type_skills = strong_type_skill::none>
template <typename value_t, typename derived_t, strong_type_skill skills_ = strong_type_skill::none>

After our new resolution 🦆 and 🏃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢 Why did I agree on this? So ugly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm I have the feeling this might be resolved in another commit but then again your commit history is clean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my history is always clean 🙆‍♂️ :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you are just refusing the renaming? :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but I usually sleep during the night and obviously do not update the changes then. ;)

SEQAN3_CONCEPT strong_type_specialisation = requires (strong_type_t && obj)
{
//!\endcond

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stupid question, but wouldn't something like this suffice?

template <typename strong_type_t>
SEQAN3_CONCEPT strong_type_specialisation = requires (strong_type_t && obj)
{
    typename strong_type_t::value_type;
    {strong_type_t::skills};
    requires std::derived_from<strong_type_t, // I forgot the order of arguments.
                               strong_type<typename strong_type_t::value_type,
                                           strong_type_t,
                                           strong_type_t::skills>>;
}

with some additional std::remove_cvref_t for strong_type_t & instances?

I think this would be a bit more close to the intention of type specialisation. (I forgot in our earlier discussion that the strong type is inherited, so is_type_specialisation_of_v wouldn't have worked even without mixed template arguments.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you check?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still open?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

@marehr marehr requested a review from smehringer June 9, 2020 20:36
Copy link
Member

@smehringer smehringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only small stuff

SEQAN3_CONCEPT strong_type_specialisation = requires (strong_type_t && obj)
{
//!\endcond

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you check?

include/seqan3/core/detail/strong_type.hpp Outdated Show resolved Hide resolved
@@ -112,11 +166,12 @@ namespace seqan3::detail
*
* \include test/snippet/core/detail/strong_type_adding_skills.cpp
*/
template <typename value_t, typename derived_t, strong_type_skill skills = strong_type_skill::none>
template <typename value_t, typename derived_t, strong_type_skill type_skills = strong_type_skill::none>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm I have the feeling this might be resolved in another commit but then again your commit history is clean?

* \returns `stream_t &` A reference to the given stream.
*/
template <typename char_t, strong_type_specialisation strong_type_t>
debug_stream_type<char_t> & operator<<(debug_stream_type<char_t> & stream, strong_type_t && value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this also require that the underlying type is streamable?
Edit: Damn but we still have this bug that "everything is streamable" right?

include/seqan3/alignment/all.hpp Outdated Show resolved Hide resolved
requires std::same_as<band_t, static_band>
//!\endcond
struct band : public pipeable_config_element<band<band_t>, band_t>
class band_fixed_size : public pipeable_config_element<band_fixed_size, seqan3::detail::empty_type>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1871 is merged :D

@rrahn rrahn force-pushed the alignment/banded_implementation_config branch from 5011d11 to 646a771 Compare June 11, 2020 12:12
@rrahn rrahn requested a review from smehringer June 11, 2020 12:16
SEQAN3_CONCEPT strong_type_specialisation = requires (strong_type_t && obj)
{
//!\endcond

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still open?

…gn_cfg::band_fixed_size

* Rename the existing band to align_cfg::band_fixed_size
* Introducing strong types for setting lower and upper diagonal
* Direct access of the members via the config.
* Adjust the tutorial and all snippets
* Adjust the API documentation
* Remove all references to the old static_band mechanism
* Fix all dependent classes and tests
@rrahn rrahn force-pushed the alignment/banded_implementation_config branch from 646a771 to f63e2b9 Compare June 11, 2020 20:36
@rrahn rrahn merged commit ba70f70 into seqan:master Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update alignment configuration band
3 participants