aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2013-10-31 15:03:04 -0400
committerCalvin Morrison <mutantturkey@gmail.com>2013-10-31 15:03:04 -0400
commit73a1855d95ff13306f58ac4c2952a87f5068228e (patch)
tree74d558e42d9efb996afdb99bd4686c9e4225b44a
parent8784d26bf275128935a1f682fab6cfff30d2e15b (diff)
Revert "fix memset"
This reverts commit 8784d26bf275128935a1f682fab6cfff30d2e15b.
-rw-r--r--kmer_frequency_per_sequence.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/kmer_frequency_per_sequence.c b/kmer_frequency_per_sequence.c
index 2d02403..7c1bf9b 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 * sizeof(unsigned long long));
+ memset(counts, 0, width);
for(i = 0; i < read - kmer; i++) {
line[i] = alpha[(int)line[i]];
@@ -53,14 +53,17 @@ 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("%llu\t", counts[i]);
- printf("%llu\n", counts[width - 1]);
+ printf("%.12f\t", (double)counts[i] / total);
+ printf("%.12f\n", (double)counts[width - 1] / total);
+ free(counts);
}
}
- free(counts);
free(line);