-
Notifications
You must be signed in to change notification settings - Fork 2
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] Adding Syncmer.hpp #15
Conversation
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.
Hi, I just took a quick look at the minstrobes and already added some things to improve. :)
Codecov Report
@@ Coverage Diff @@
## master #15 +/- ##
==========================================
+ Coverage 96.12% 96.26% +0.14%
==========================================
Files 9 10 +1
Lines 413 697 +284
==========================================
+ Hits 397 671 +274
- Misses 16 26 +10
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.
Can you tell me where in the code the difference between open and closed syncmers are? I must have missed it.
include/opensyncmer.hpp
Outdated
|
||
opensyncmer_position_offset = std::distance(std::begin(window_values), smallest_s_it); | ||
|
||
if (opensyncmer_position_offset == 0) { |
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.
The ; in the end seems wrong.
And seqan style is to put the {} on a seperate line each
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'm not sure I understand which one you mean. Could you please maybe highlight where exactly?
You often don`t use the tabs and indentation correctly. Please, see the example below and other seqan code. A function should look like this: void test()
{ // gets its own line
auto variable = 0; // is tabed in
if (true)
{
variable = 1; // tabed in even further
}
} |
|
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.
Looks already really good, but some small things need to be addressed.
I also wonder, if we should rename some things for clearification.
- Kmers: Your view is universal, so you can use it for any kind of values, so maybe window size makes more sense?
- Smer: Same problem as with kmer, maybe smaller_window_size is better?
- Window Values: This makes sense, if we rename kmer and smer, but if we leave kmer and smer, it does not make sense to name this window values.
Maybe you have some ideas?
include/syncmer.hpp
Outdated
/*!\brief Computes syncmers for a range of comparable values. A syncmer is a kmer that has its smallest smer | ||
* (s < k) at its start or end. An open-syncmer has its smer at its start. | ||
* \tparam urng_t The type of the first range being processed. See below for requirements. [template | ||
* parameter is omitted in pipe notation] | ||
* \param[in] urange1 The first input range to process. Must model std::ranges::viewable_range and | ||
* std::ranges::forward_range. | ||
* \param[in] urange2 The second input range to process. Must model std::ranges::viewable_range and | ||
* std::ranges::forward_range. | ||
* \param[in] smer_size The s-mer size used. | ||
* \param[in] kmer_size The k-mer size used. | ||
* \returns A range of std::totally_ordered where each value is ... See below for the | ||
* properties of the returned range. | ||
* \ingroup search_views |
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 not correct, this describes what you do when you use kmer_hash and syncmers together but the syncmer function itself, just gets two views (which can be not based on sequences) and then reports the values, when the smallest value in range is at a certain position.
This text can be used for a syncmer_hash view so maybe don't delete it and store it in a different file. :)
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 about this:
Computes syncmers for a range of comparable values. A syncmer is a window with size k that has
its smallest subwindow with size s (s < k) at its start or end. An open-syncmer has its smallest subwindow at its start.
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.
Now, that I think about it, you don`t need kmer and smer size, you can do the calculation for w-size before calling the syncmer function itself.
Then a syncmer would be a hash value, if the minimum of the sub_window_values is at the front or at the end...
include/syncmer.hpp
Outdated
* Looks at the number of values per window in two ranges, returns the smallest in smer and returns the corresponding | ||
* kmer from the other range as syncmer and shifts then by one to repeat this action. |
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 does not return the smer, it returns a kmer, if its smallest smer is at a certain position.
include/syncmer.hpp
Outdated
//!\brief Compare to another basic_iterator. | ||
friend bool operator==(basic_iterator const & lhs, basic_iterator const & rhs) | ||
{ | ||
return (lhs.urng1_iterator == rhs.urng1_iterator); |
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.
Shouldn`t this also include the second iterator and the size of window values?
include/syncmer.hpp
Outdated
} | ||
|
||
//!\brief Returns new window value. | ||
auto window_value() const |
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 think you need this function, just use *urng1_iterator directly.
include/syncmer.hpp
Outdated
auto smallest_s_it = std::ranges::min_element(window_values, std::less<value_type>{}); | ||
syncmer_position_offset = std::distance(std::begin(window_values), smallest_s_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.
Delete this empty line
include/syncmer.hpp
Outdated
{ | ||
auto syncmer_it = urng2_iterator; | ||
syncmer_value = *syncmer_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.
Why is there a ;
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.
This is still not resolved.
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.
You also have these in other positions of the code, I think that you should delete them.
include/syncmer.hpp
Outdated
if constexpr (!opensyncmer) | ||
{ | ||
auto syncmer_it = urng2_iterator; | ||
syncmer_value = *syncmer_it; | ||
return true; | ||
}; |
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.
Intendation is incorrect.
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.
Looks good, just some really minor things. Sorry. 💅
include/syncmer.hpp
Outdated
{ | ||
auto syncmer_it = urng2_iterator; | ||
syncmer_value = *syncmer_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.
This is still not resolved.
include/syncmer.hpp
Outdated
{ | ||
auto syncmer_it = urng2_iterator; | ||
syncmer_value = *syncmer_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.
You also have these in other positions of the code, I think that you should delete them.
Part of #1