-
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
Misc/refactor aligned sequence builder #1237
Misc/refactor aligned sequence builder #1237
Conversation
c630f20
to
8457f9f
Compare
Codecov Report
@@ Coverage Diff @@
## master #1237 +/- ##
==========================================
+ Coverage 97.58% 97.61% +0.02%
==========================================
Files 221 222 +1
Lines 8975 8999 +24
==========================================
+ Hits 8758 8784 +26
+ Misses 217 215 -2
Continue to review full report at Codecov.
|
9da3eef
to
a6c4a57
Compare
a6c4a57
to
c4cfc33
Compare
c4cfc33
to
69a9e04
Compare
include/seqan3/alignment/matrix/detail/aligned_sequence_builder.hpp
Outdated
Show resolved
Hide resolved
include/seqan3/alignment/matrix/detail/aligned_sequence_builder.hpp
Outdated
Show resolved
Hide resolved
69a9e04
to
d3a3dba
Compare
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.
One thing, otherwise LGTM
d3a3dba
to
28d784b
Compare
include/seqan3/alignment/matrix/detail/aligned_sequence_builder.hpp
Outdated
Show resolved
Hide resolved
28d784b
to
0ea2159
Compare
@smehringer ping |
0ea2159
to
c999d7d
Compare
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.
some tiny stuff left
include/seqan3/alignment/matrix/detail/aligned_sequence_builder.hpp
Outdated
Show resolved
Hide resolved
c999d7d
to
2beed90
Compare
Is this not blocked anymore? |
No it is not anymore. I applied the changes on top of this PR. some thing I messed up. don't wanna talk about it |
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.
sorry for revisiting some stuff 🙇♂️
include/seqan3/alignment/matrix/detail/aligned_sequence_builder.hpp
Outdated
Show resolved
Hide resolved
include/seqan3/alignment/matrix/detail/aligned_sequence_builder.hpp
Outdated
Show resolved
Hide resolved
include/seqan3/alignment/matrix/detail/aligned_sequence_builder.hpp
Outdated
Show resolved
Hide resolved
include/seqan3/alignment/matrix/detail/aligned_sequence_builder.hpp
Outdated
Show resolved
Hide resolved
include/seqan3/alignment/matrix/detail/aligned_sequence_builder.hpp
Outdated
Show resolved
Hide resolved
test/unit/alignment/matrix/detail/aligned_sequence_builder_test.cpp
Outdated
Show resolved
Hide resolved
CI is failing; https://travis-ci.org/seqan/seqan3/jobs/586123431#L5487 |
fa70d6f
to
a3a4ca4
Compare
a3a4ca4
to
dd089fd
Compare
Okay, thank you I have a look at it. Just to make sure:
is the first commit that I should look at. |
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 are getting close :) Thank you for removing that band option, you forgot to remove some left-overs. As always some naming things.
The only thing that is currently concerning to me is the is_instantiable_with
, because it does not do what it describes. But that should not be a blocker for this PR.
*/ | ||
constexpr trace_iterator_banded(matrix_iter_t const matrix_iter) noexcept : base_t{matrix_iter} | ||
template <typename index_t> | ||
constexpr trace_iterator_banded(matrix_iter_t const matrix_iter, column_index_type<index_t> const & pivot_column) |
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.
Okay so you now moved the offset into the trace-iterator, but why is the pivot in here? I thought the matrix provides the positions as in a full matrix. So that the trace_iterator is the same for all trace matrices. That's at least what I remembered from the design sketch that we did. I would like to discuss this in person again and review the pictures of the board that we took back then. Maybe my memory is faulty.
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 need to rethink it but mainly because it avoids some additional book keeping.
include/seqan3/alignment/matrix/detail/aligned_sequence_builder.hpp
Outdated
Show resolved
Hide resolved
include/seqan3/alignment/matrix/detail/aligned_sequence_builder.hpp
Outdated
Show resolved
Hide resolved
void fill_aligned_sequence(reverse_traces_t && rev_traces, | ||
fst_aligned_t & fst_aligned, | ||
sec_aligned_t & sec_aligned) const | ||
template <typename reverse_traces_t, typename fst_t, typename sec_t> |
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.
why adding here an extra template for fst_t? What difference does it make? I think fst_aligned_t & fst_aligned
was completely fine, because you know your passed types.
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.
that's true
} | ||
} | ||
|
||
all_view<fst_rng_t> fst_rng; //!< A view over the first range. | ||
all_view<sec_rng_t> sec_rng; //!< A view over the second range. | ||
std::optional<size_t> band_col_offset; //!< The offset of the column where an optional band starts. |
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 is now obsolete.
std::optional<size_t> band_col_offset; //!< The offset of the column where an optional band starts. |
@@ -12,13 +12,16 @@ | |||
|
|||
#pragma once | |||
|
|||
#include <optional> |
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 now obsolete
#include <optional> |
//!\brief Deduces the type from the passed constructor arguments. | ||
template <std::ranges::viewable_range fst_rng_t, std::ranges::viewable_range sec_rng_t> | ||
aligned_sequence_builder(fst_rng_t, sec_rng_t, std::optional<static_band>) | ||
-> aligned_sequence_builder<fst_rng_t, sec_rng_t>; |
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.
remove me please, thank you!
@@ -95,155 +97,131 @@ TYPED_TEST(aligned_sequence_builder_fixture, construction) | |||
TYPED_TEST(aligned_sequence_builder_fixture, build_from_2_3) | |||
{ | |||
auto p = this->path(matrix_offset{row_index_type{2}, column_index_type{3}}); | |||
auto [begin, end, alignment] = this->builder(p); | |||
auto [cut_interval_first, cut_interval_second, alignment] = this->builder(p); |
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.
Even when seeing the tests, cut_interval
does not seem to be the right name.
sequence1_subrange
sequence2_subrange
would be nicer
(Oh I forgot that you can structural bind data members, thank you for reminding me :) )
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 above subrange would indicate that it is in fact a subrange. But it is not. It is just the interval of the slice/subrange. I also kept the naming with the first/second. At least this matches the pair member notation in the stl.
dd089fd
to
e9e797f
Compare
The banded trace iterator should return the actual coordinates within the global alignment matrix and not the coordiantes of the underlying storage. This corresponding mapping is only known by the banded trace matrix.
e9e797f
to
9599551
Compare
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.
:)
matrix_coordinate begin; //!< The coordinate where the trimmed first and second sequence begin. | ||
matrix_coordinate end; //!< The coordinate where the trimmed first and second sequence end. | ||
std::pair<fst_aligned_t, sec_aligned_t> alignment; //!< The alignment over the trimmed sequences. | ||
std::pair<size_t, size_t> slice_interval_first{}; //!< The slice positions of the first sequence. |
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.
:)
@@ -95,155 +97,131 @@ TYPED_TEST(aligned_sequence_builder_fixture, construction) | |||
TYPED_TEST(aligned_sequence_builder_fixture, build_from_2_3) | |||
{ | |||
auto p = this->path(matrix_offset{row_index_type{2}, column_index_type{3}}); | |||
auto [begin, end, alignment] = this->builder(p); | |||
auto [slice_interval_first, slice_interval_second, alignment] = this->builder(p); |
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.
:)
9599551
to
5205342
Compare
@rrahn You messed your rebases up and introduced new files that should have been deleted: test/unit/range/views/view_pseudo_random_access_test.cpp |
NOTE This PR is for discussing the current situation with the begin_ra/end_ra and the to_random_access view concept.
In General I am not very happy with doing all this additional random access semantics stuff.
Some of my general concerns:
1. The view only wraps the original type and forwards its begin_ra/end_ra members as begin/end. But the type is lost and thus it is not directly usable for using it as the original data structure. But often this is what you want. For example, the gap_decorator fulfills the aligned sequence concept and the bidirectional range concept. You can raise it to random access range as proposed originally but then you loose the aligned sequence concept. However, in case of the gap_decorator you want to be able to use the interface also with the random access iterator (which is also fixed in this PR). Then you can use iterator from a different type as regular iterators to a different interface.2. I don't see many other places except our decorators where you would model random access even if it might not be constant time access. Thus, we are effectively preventing the efficient use case in the default version (it was fixable in the gap_decorator, but not sure if I can generalize this), which is worse then expecting that access should be constant even if it is not. I think if documented it should be ok to only stick to one begin/end and always give the weak_random_access_iterator in this case. It would be in general less confusing to use (see first point).
The view random access range is moved out into another PR together with some changes related to the gap_decorator. This PR is now rebased on this.
Blocked by
#1283