diff --git a/include/seqan3/search/views/kmer_hash.hpp b/include/seqan3/search/views/kmer_hash.hpp index cf20dc0080..8fdc63eba7 100644 --- a/include/seqan3/search/views/kmer_hash.hpp +++ b/include/seqan3/search/views/kmer_hash.hpp @@ -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 diff --git a/test/snippet/search/views/kmer_hash.cpp b/test/snippet/search/views/kmer_hash.cpp index cfa7c8369a..ff7f36fc0d 100644 --- a/test/snippet/search/views/kmer_hash.cpp +++ b/test/snippet/search/views/kmer_hash.cpp @@ -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] + } } diff --git a/test/snippet/search/views/kmer_hash.err b/test/snippet/search/views/kmer_hash.err index fcde4abd79..18c85e7662 100644 --- a/test/snippet/search/views/kmer_hash.err +++ b/test/snippet/search/views/kmer_hash.err @@ -1,3 +1,5 @@ [6,27,44,50,9] [6,27,44,50,9] [2,7,8,14,1] +[12] +[12]