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] Adding Syncmer.hpp #15

Merged
merged 17 commits into from
Feb 11, 2022
Merged

[FEATURE] Adding Syncmer.hpp #15

merged 17 commits into from
Feb 11, 2022

Conversation

Hosseinem
Copy link
Contributor

@Hosseinem Hosseinem commented Jan 12, 2022

Part of #1

Copy link
Collaborator

@MitraDarja MitraDarja left a 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. :)

include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jan 18, 2022

Codecov Report

Merging #15 (ad5ddce) into master (5833945) will increase coverage by 0.14%.
The diff coverage is 97.39%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
include/syncmer.hpp 97.39% <97.39%> (ø)
src/main.cpp 100.00% <0.00%> (ø)
include/compare.h 100.00% <0.00%> (ø)
src/compare.cpp 93.06% <0.00%> (+0.76%) ⬆️

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 5833945...ad5ddce. Read the comment docs.

Copy link
Collaborator

@MitraDarja MitraDarja left a 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/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/opensyncmer.hpp Outdated Show resolved Hide resolved

opensyncmer_position_offset = std::distance(std::begin(window_values), smallest_s_it);

if (opensyncmer_position_offset == 0) {
Copy link
Collaborator

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

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'm not sure I understand which one you mean. Could you please maybe highlight where exactly?

include/opensyncmer.hpp Outdated Show resolved Hide resolved
include/opensyncmer.hpp Outdated Show resolved Hide resolved
include/syncmer.hpp Outdated Show resolved Hide resolved
@MitraDarja
Copy link
Collaborator

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
   }
}

@Hosseinem
Copy link
Contributor Author

@Hosseinem Hosseinem closed this Jan 24, 2022
@Hosseinem Hosseinem reopened this Jan 24, 2022
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/minstrobe.hpp Outdated Show resolved Hide resolved
include/syncmer.hpp Outdated Show resolved Hide resolved
include/syncmer.hpp Outdated Show resolved Hide resolved
include/syncmer.hpp Outdated Show resolved Hide resolved
@Hosseinem Hosseinem changed the title [FEATURE] Adding Minstrobe.hpp and Syncmer.hpp [FEATURE] Adding Syncmer.hpp Feb 9, 2022
Copy link
Collaborator

@MitraDarja MitraDarja left a 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.

  1. Kmers: Your view is universal, so you can use it for any kind of values, so maybe window size makes more sense?
  2. Smer: Same problem as with kmer, maybe smaller_window_size is better?
  3. 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?

test/api/syncmer_test.cpp Show resolved Hide resolved
Comment on lines 539 to 551
/*!\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
Copy link
Collaborator

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. :)

Copy link
Contributor Author

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.

Copy link
Collaborator

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 Show resolved Hide resolved
Comment on lines 255 to 256
* 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.
Copy link
Collaborator

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.

//!\brief Compare to another basic_iterator.
friend bool operator==(basic_iterator const & lhs, basic_iterator const & rhs)
{
return (lhs.urng1_iterator == rhs.urng1_iterator);
Copy link
Collaborator

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?

}

//!\brief Returns new window value.
auto window_value() const
Copy link
Collaborator

@MitraDarja MitraDarja Feb 10, 2022

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.

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);


Copy link
Collaborator

Choose a reason for hiding this comment

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

Delete this empty line

{
auto syncmer_it = urng2_iterator;
syncmer_value = *syncmer_it;
};
Copy link
Collaborator

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?

Copy link
Collaborator

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.

Copy link
Collaborator

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.

Comment on lines 461 to 466
if constexpr (!opensyncmer)
{
auto syncmer_it = urng2_iterator;
syncmer_value = *syncmer_it;
return true;
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Intendation is incorrect.

Copy link
Collaborator

@MitraDarja MitraDarja left a 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. 💅

{
auto syncmer_it = urng2_iterator;
syncmer_value = *syncmer_it;
};
Copy link
Collaborator

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.

{
auto syncmer_it = urng2_iterator;
syncmer_value = *syncmer_it;
};
Copy link
Collaborator

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 Show resolved Hide resolved
include/syncmer.hpp Outdated Show resolved Hide resolved
include/syncmer.hpp Outdated Show resolved Hide resolved
include/syncmer.hpp Outdated Show resolved Hide resolved
include/syncmer.hpp Outdated Show resolved Hide resolved
include/syncmer.hpp Outdated Show resolved Hide resolved
include/syncmer.hpp Outdated Show resolved Hide resolved
@MitraDarja MitraDarja merged commit e198317 into seqan:master Feb 11, 2022
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.

3 participants