diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2014-01-16 13:11:06 -0500 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2014-01-16 13:11:06 -0500 |
commit | c34cb2424726b7c3643d65ad048144dfef585e3c (patch) | |
tree | f71a385002246f1129836b5c30c0c3cea711a3d5 | |
parent | 851ad0f28451f631aad9f9109295637238d3fc26 (diff) |
update translate function
-rw-r--r-- | kmer_utils.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/kmer_utils.c b/kmer_utils.c index 8e793b6..e1b0a44 100644 --- a/kmer_utils.c +++ b/kmer_utils.c @@ -81,24 +81,26 @@ char *kmer_index_to_kmer(unsigned long long index, long kmer) { } // convert a string into values from a lookup array -static bool translate_nucleotides_to_numbers(char *str, size_t len, const unsigned char *lookup, bool *header) { +bool translate_nucleotides_to_numbers(char *str, size_t len, const unsigned char *lookup, bool start_header) { + + bool header = start_header; size_t i; for(i = 0; i < len; ++i) { - if(str[i] == '>') - *header = true; - - if(*header) { - if(str[i] == '\n') - *header = false; - + if(str[i] == '>') { + header = true; + } + if(header) { + if(str[i] == '\n') { + header = false; + } str[i] = ERROR; } else str[i] = lookup[(int)str[i]]; } - return *header; + return header; } static size_t calculate_mer(const char *str, size_t str_len, size_t *pos, size_t kmer_len, size_t error_mer) { |