From 67bf470e1246db3fa15c56315aa0038f393a5b07 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Wed, 15 Jan 2014 12:08:51 -0500 Subject: add a fix for skip char --- kmer_utils.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/kmer_utils.c b/kmer_utils.c index 18e26a5..73cf819 100644 --- a/kmer_utils.c +++ b/kmer_utils.c @@ -89,15 +89,20 @@ static void translate_nucleotides_to_numbers(char *str, size_t len, const unsign static size_t calculate_mer(const char *str, size_t *pos, size_t kmer_len, size_t error_mer) { size_t mer = 0; - size_t multiply = 1; + size_t multiply; size_t i; + size_t end; - // for each char in the k-mer check if it is an error char + // set our multiplier to be pow(4, mer) >> 2; multiply = (unsigned long long)1 << (kmer_len* 2); multiply = multiply >> 2; - for(i = *pos; i < *pos + kmer_len; ++i) { + + // for each char in the k-mer check if it is an error char + end = *pos + kmer_len; + for(i = *pos; i < end; ++i) { if(str[i] == SPACE) { - continue; + end++; + continue; } if(str[i] == ERROR) { *pos = i; -- cgit v1.2.3