aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kmer_frequency_per_sequence.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/kmer_frequency_per_sequence.c b/kmer_frequency_per_sequence.c
index 7c1bf9b..2d02403 100644
--- a/kmer_frequency_per_sequence.c
+++ b/kmer_frequency_per_sequence.c
@@ -43,7 +43,7 @@ int main(int argc, char **argv) {
unsigned long total = 0;
// reset our count matrix to zero
- memset(counts, 0, width);
+ memset(counts, 0, width * sizeof(unsigned long long));
for(i = 0; i < read - kmer; i++) {
line[i] = alpha[(int)line[i]];
@@ -53,17 +53,14 @@ int main(int argc, char **argv) {
counts[num_to_index(&line[i],kmer, width)]++;
}
- for(i = 0; i < width; i++)
- total += counts[i];
-
for(i = 0; i < width - 1; i++)
- printf("%.12f\t", (double)counts[i] / total);
- printf("%.12f\n", (double)counts[width - 1] / total);
+ printf("%llu\t", counts[i]);
+ printf("%llu\n", counts[width - 1]);
- free(counts);
}
}
+ free(counts);
free(line);