diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2013-10-02 21:38:43 -0400 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2013-10-02 21:38:43 -0400 |
commit | f47ce6202d2bb6425638a9142bbbebd7d44fb64f (patch) | |
tree | 612415c474b838247fe187eb1a68a9f9805d19e0 /kmer_utils.c | |
parent | 45628e09b8f2e496a8766c442626dd6a13465286 (diff) |
use an external iterator so that we can skip over anything in range of an errorw
Diffstat (limited to 'kmer_utils.c')
-rw-r--r-- | kmer_utils.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/kmer_utils.c b/kmer_utils.c index f63caef..f4f8d2f 100644 --- a/kmer_utils.c +++ b/kmer_utils.c @@ -1,6 +1,8 @@ +#include "kmer_total_count.h" + // convert a string of k-mer size base-4 values into a // base-10 index -long num_to_index(const char *str, const int kmer, const long error_pos) { +unsigned long num_to_index(const char *str, const int kmer, const long error_pos) { int i = 0; unsigned long out = 0; @@ -8,8 +10,13 @@ long num_to_index(const char *str, const int kmer, const long error_pos) { for(i = kmer - 1; i >= 0; i--){ - if(str[i] >> 2) - return error_pos; + if(str[i] >> 2) { + #ifndef SHARED + position += i; + #endif + return error_pos; + } + out += str[i] * multiply; multiply = multiply << 2; |