aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-01-15 12:08:51 -0500
committerCalvin Morrison <mutantturkey@gmail.com>2014-01-15 12:08:51 -0500
commit67bf470e1246db3fa15c56315aa0038f393a5b07 (patch)
tree3b866d64edda7c3eab893ce42a1b8369fbdc32f1
parentd9757890cae093ccd805bd773f8c4759165907bf (diff)
add a fix for skip char
-rw-r--r--kmer_utils.c13
1 files 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;