Skip to content

Commit

Permalink
[misc] improved doc and snippet for kmer_hash
Browse files Browse the repository at this point in the history
Update test/snippet/search/views/kmer_hash.cpp
Update include/seqan3/search/views/kmer_hash.hpp

Co-authored-by: Svenja Mehringer <[email protected]>
  • Loading branch information
SGSSGene and smehringer committed May 17, 2022
1 parent 34d4eb6 commit 17b2d07
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions include/seqan3/search/views/kmer_hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,8 +774,8 @@ 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 0b1101 applied to ACGT will return
* the sequence AGT.
* \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
*
Expand Down
13 changes: 7 additions & 6 deletions test/snippet/search/views/kmer_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ int main()

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

// Note: the Shape is defined from right to left. The mask 0b1101 applied to ACGT will yield
// the same result as mask 0b111 applied to AGT.
// 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 = "ACGT"_dna4;
auto text2 = "AGT"_dna4;
seqan3::debug_stream << (text1 | seqan3::views::kmer_hash(0b1101_shape)) << '\n'; // [11]
seqan3::debug_stream << (text2 | seqan3::views::kmer_hash(0b111_shape)) << '\n'; // [11]
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]
}
}
4 changes: 2 additions & 2 deletions test/snippet/search/views/kmer_hash.err
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[6,27,44,50,9]
[6,27,44,50,9]
[2,7,8,14,1]
[11]
[11]
[12]
[12]

0 comments on commit 17b2d07

Please sign in to comment.