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

[FEATURE] view_translate_join #1171

Merged
merged 2 commits into from
Jul 18, 2019
Merged

Conversation

sarahet
Copy link
Member

@sarahet sarahet commented Jul 9, 2019

This PR introduces the view_translate_join

  • Enables translation of two-dimensional input ranges into two-dimensional output ranges where ranges of frames per input sequence are joined
  • Offers potential for better performance in later applications if this is desired in comparison to standard view_translate

@sarahet sarahet added the feature/proposal a new feature or an idea of label Jul 9, 2019
@sarahet sarahet requested a review from h-2 July 9, 2019 14:47
@sarahet sarahet changed the title Feature view translate join [FEATURE] view_translate_join Jul 9, 2019
@sarahet sarahet force-pushed the feature_view_translate_join branch from 910a959 to 4f240ca Compare July 9, 2019 15:25
@codecov
Copy link

codecov bot commented Jul 9, 2019

Codecov Report

Merging #1171 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1171      +/-   ##
==========================================
+ Coverage   96.45%   96.47%   +0.02%     
==========================================
  Files         201      202       +1     
  Lines        7752     7803      +51     
==========================================
+ Hits         7477     7528      +51     
  Misses        275      275
Impacted Files Coverage Δ
include/seqan3/range/view/translate_join.hpp 100% <100%> (ø)

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 0e0b73a...e2fa839. Read the comment docs.

Copy link
Member

@h-2 h-2 left a comment

Choose a reason for hiding this comment

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

Looks very good already, just a bunch of minor comments.

include/seqan3/range/view/translate_join.hpp Outdated Show resolved Hide resolved
include/seqan3/range/view/translate_join.hpp Outdated Show resolved Hide resolved
include/seqan3/range/view/translate_join.hpp Outdated Show resolved Hide resolved
include/seqan3/range/view/translate_join.hpp Show resolved Hide resolved
//!\cond
requires !std::Same<remove_cvref_t<rng_t>, view_translate_join> &&
std::ranges::ViewableRange<rng_t> &&
std::Constructible<urng_t, ranges::ref_view<std::remove_reference_t<rng_t>>>
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
std::Constructible<urng_t, ranges::ref_view<std::remove_reference_t<rng_t>>>
std::Constructible<urng_t, all_view<rng_t>>

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
std::Constructible<urng_t, ranges::ref_view<std::remove_reference_t<rng_t>>>
std::Constructible<urng_t, std::ranges::all_view<rng_t>>

include/seqan3/range/view/translate_join.hpp Outdated Show resolved Hide resolved
test/unit/range/view/view_translate_test.cpp Show resolved Hide resolved
test/unit/range/view/view_translate_test.cpp Show resolved Hide resolved
include/seqan3/range/view/translate_join.hpp Outdated Show resolved Hide resolved
@sarahet sarahet force-pushed the feature_view_translate_join branch from 4f240ca to ba91828 Compare July 15, 2019 13:17
@sarahet sarahet requested review from h-2 and smehringer July 15, 2019 13:18
@sarahet
Copy link
Member Author

sarahet commented Jul 15, 2019

@h-2 Should we also have an iterator test for all nucleotide alphabets?

//!\cond
requires !std::Same<remove_cvref_t<rng_t>, view_translate_join> &&
std::ranges::ViewableRange<rng_t> &&
std::Constructible<urng_t, ranges::ref_view<std::remove_reference_t<rng_t>>>
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
std::Constructible<urng_t, ranges::ref_view<std::remove_reference_t<rng_t>>>
std::Constructible<urng_t, std::ranges::all_view<rng_t>>

include/seqan3/range/view/translate_join.hpp Show resolved Hide resolved
include/seqan3/range/view/translate_join.hpp Show resolved Hide resolved
include/seqan3/range/view/translate_join.hpp Show resolved Hide resolved
@h-2
Copy link
Member

h-2 commented Jul 15, 2019

@h-2 Should we also have an iterator test for all nucleotide alphabets?

We shouldn't need to add this here, but the simple view::translate_single should eventually get those for all nucleotides...

@sarahet
Copy link
Member Author

sarahet commented Jul 15, 2019

I cannot comment under the suggestion for some reason ..
The suggested change std::Constructible<urng_t, std::ranges::all_view<rng_t>> does not work (as the other suggestion from above) .. this is why I did not change it in the first place when you mentioned it (not ignoring you here).

Sorry that I did not make it clearer. All your changes using all_view failed .

@sarahet sarahet force-pushed the feature_view_translate_join branch from ba91828 to 89e953d Compare July 15, 2019 13:56
@sarahet sarahet requested a review from h-2 July 15, 2019 14:31
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.

Iterator template looks good :)

*/
template <std::ranges::View urng_t>
//!\cond
requires std::ranges::SizedRange<urng_t> &&
Copy link
Member

Choose a reason for hiding this comment

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

I guess those requirements are not needed for overload resolution but just for "type cheking"? If so we decided to use static asserts rather than concet. The error messages are more readable :)

Copy link
Member Author

@sarahet sarahet Jul 16, 2019

Choose a reason for hiding this comment

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

Isn't it enough that the concepts are checked via static_assert in the adaptor? This gets anyways called when constructing the view, right?

Copy link
Member

Choose a reason for hiding this comment

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

There is a general rule in SeqAn about having static_asserts instead of requirements if they are not required for overload resolution. For the regular translate views I would argue that we might actually add other overloads and in that case the constraints for this class would be the same, but we would change the constraints on the adaptor (which would then allow e.g. BidirectionalRange but would forward those to view::translate | view::join).

TLDR: It doesn't make much of a difference. Since I don't think this particular class will get another specialisation, you can also just copy the static assert from the adaptor into the class and remove the concept constraints.

decltype(view::translate_join(vec)) test_range = view::translate_join(vec);

template <typename A, typename B>
static void expect_eq(A && begin_iterator_value, B && expected_range_value)
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
static void expect_eq(A && begin_iterator_value, B && expected_range_value)
static void expect_eq(A && test_range_value, B && expected_range_value)

💅 but not neccessary

@sarahet sarahet force-pushed the feature_view_translate_join branch from 89e953d to 53409b8 Compare July 16, 2019 17:06
@sarahet sarahet requested a review from smehringer July 17, 2019 07:58
@sarahet sarahet force-pushed the feature_view_translate_join branch from 53409b8 to 285774e Compare July 18, 2019 09:01
@sarahet sarahet requested a review from h-2 July 18, 2019 09:05
@sarahet sarahet force-pushed the feature_view_translate_join branch from 285774e to e2fa839 Compare July 18, 2019 11:23
@h-2
Copy link
Member

h-2 commented Jul 18, 2019

@smehringer Do you want a final review or can I merge this after CI passes?

@h-2 h-2 merged commit 617b4b5 into seqan:master Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/proposal a new feature or an idea of
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants