Skip to content

Commit

Permalink
[DOC] clarification how shapes are applied in kmer-hash (#2981)
Browse files Browse the repository at this point in the history
* [DOC] clarification how shapes are applied in kmer-hash

* Apply suggestions from code review

* [misc] improved doc and snippet for kmer_hash

Update test/snippet/search/views/kmer_hash.cpp
Update include/seqan3/search/views/kmer_hash.hpp

Co-authored-by: Svenja Mehringer <[email protected]>

Co-authored-by: Enrico Seiler <[email protected]>
Co-authored-by: Svenja Mehringer <[email protected]>
  • Loading branch information
3 people authored May 17, 2022
1 parent f10e557 commit d3aa8be
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/seqan3/search/views/kmer_hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,9 @@ namespace seqan3::views
*
* See the \link views views submodule documentation \endlink for detailed descriptions of the view properties.
*
* \attention The Shape is defined from right to left! The mask 0b11111101 applied to "AGAAAATA" is
* interpreted as "A.AAAATA" (and not "AGAAAA.A") and will return the hash value for "AAAAATA".
*
* ### Example
*
* \include test/snippet/search/views/kmer_hash.cpp
Expand Down
10 changes: 10 additions & 0 deletions test/snippet/search/views/kmer_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,14 @@ int main()
seqan3::debug_stream << (text | seqan3::views::kmer_hash(seqan3::ungapped{3})) << '\n'; // [6,27,44,50,9]

seqan3::debug_stream << (text | seqan3::views::kmer_hash(0b101_shape)) << '\n'; // [2,7,8,14,1]

// Attention: the Shape is defined from right to left!
// The mask 0b11111101 applied to "AGAAAATA" ("A.AAAATA") will yield
// the same hash value as mask 0b1111111 applied to "AAAAATA".
{
auto text1 = "AGAAAATA"_dna4;
auto text2 = "AAAAATA"_dna4;
seqan3::debug_stream << (text1 | seqan3::views::kmer_hash(0b11111101_shape)) << '\n'; // [12]
seqan3::debug_stream << (text2 | seqan3::views::kmer_hash(0b1111111_shape)) << '\n'; // [12]
}
}
2 changes: 2 additions & 0 deletions test/snippet/search/views/kmer_hash.err
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[6,27,44,50,9]
[6,27,44,50,9]
[2,7,8,14,1]
[12]
[12]

1 comment on commit d3aa8be

@vercel
Copy link

@vercel vercel bot commented on d3aa8be May 17, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

seqan3 – ./

seqan3-seqan.vercel.app
seqan3.vercel.app
seqan3-git-master-seqan.vercel.app

Please sign in to comment.