aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kmer_total_count.c3
-rw-r--r--kmer_utils.c14
2 files changed, 7 insertions, 10 deletions
diff --git a/kmer_total_count.c b/kmer_total_count.c
index 23ca512..6d07e13 100644
--- a/kmer_total_count.c
+++ b/kmer_total_count.c
@@ -13,8 +13,9 @@ int main(int argc, char **argv) {
char *line = NULL;
size_t len = 0;
ssize_t read;
+ long i = 0;
+
unsigned int kmer = 0;
- unsigned long i = 0;
unsigned long width = 0;
unsigned long long *counts;
diff --git a/kmer_utils.c b/kmer_utils.c
index e737346..c0441e2 100644
--- a/kmer_utils.c
+++ b/kmer_utils.c
@@ -16,27 +16,23 @@
// long kmer - how long of a index value you want to return
// long error_pos - what index to return for a non ACGT character
//
-inline long convert_kmer_to_index(const char *str, long kmer, long error_pos) {
+inline long convert_kmer_to_index(const char *str, int kmer, long error_pos) {
- long i = 0;
- long out = 0;
- long multiply = 1;
+ int i = 0;
+ unsigned long out = 0;
+ unsigned long multiply = 1;
for(i = kmer - 1; i >= 0; i--){
- switch(str[i]) {
+ switch(str[i] | 0x20 ) {
case 'a':
- case 'A':
break;
case 'c':
- case 'C':
out += 1 * multiply;
break;
case 'g':
- case 'G':
out += 2 * multiply;
break;
case 't':
- case 'T':
out += 3 * multiply;
break;
default: