From 17b2d0791b525b7946f186c8b250123a60374a44 Mon Sep 17 00:00:00 2001 From: Simon Gene Gottlieb Date: Tue, 17 May 2022 09:36:29 +0200 Subject: [PATCH] [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 --- include/seqan3/search/views/kmer_hash.hpp | 4 ++-- test/snippet/search/views/kmer_hash.cpp | 13 +++++++------ test/snippet/search/views/kmer_hash.err | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/seqan3/search/views/kmer_hash.hpp b/include/seqan3/search/views/kmer_hash.hpp index 09ae64311b..8fdc63eba7 100644 --- a/include/seqan3/search/views/kmer_hash.hpp +++ b/include/seqan3/search/views/kmer_hash.hpp @@ -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 * diff --git a/test/snippet/search/views/kmer_hash.cpp b/test/snippet/search/views/kmer_hash.cpp index 749d9c742a..ff7f36fc0d 100644 --- a/test/snippet/search/views/kmer_hash.cpp +++ b/test/snippet/search/views/kmer_hash.cpp @@ -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] } } diff --git a/test/snippet/search/views/kmer_hash.err b/test/snippet/search/views/kmer_hash.err index d2f3e13684..18c85e7662 100644 --- a/test/snippet/search/views/kmer_hash.err +++ b/test/snippet/search/views/kmer_hash.err @@ -1,5 +1,5 @@ [6,27,44,50,9] [6,27,44,50,9] [2,7,8,14,1] -[11] -[11] +[12] +[12]