diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2014-02-18 12:42:11 -0500 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2014-02-18 12:42:11 -0500 |
commit | 719c45d9ea49f33f087db899737ad5af4fc4414f (patch) | |
tree | 8f1eed693ffe3416f139c59e8481b81147d016ae /kmer_total_count.c | |
parent | 1c2ce90501d87db6431a7f29a37876d61347aff7 (diff) |
working sparse implementation
Diffstat (limited to 'kmer_total_count.c')
-rw-r--r-- | kmer_total_count.c | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/kmer_total_count.c b/kmer_total_count.c index 6b627f2..87f1b69 100644 --- a/kmer_total_count.c +++ b/kmer_total_count.c @@ -6,6 +6,7 @@ #include <string.h> #include <getopt.h> +#include "sparse.h" #include "kmer_utils.h" @@ -115,43 +116,15 @@ int main(int argc, char **argv) { width = pow_four(kmer); - unsigned long long *counts = get_kmer_counts_from_file(fh, kmer); - - // If nonzero is set, only print non zeros - if(nonzero) { - // if labels is set, print out our labels - if(label) { - for(i = 0; i < width; i++) - if(counts[i] != 0) { - char *kmer_str = index_to_kmer(i, kmer); - fprintf(stdout, "%s\t%llu\n", kmer_str, counts[i]); - free(kmer_str); - } - - } - else { - for(i = 0; i < width; i++) - if(counts[i] != 0) - fprintf(stdout, "%llu\t%llu\n", i, counts[i]); - - } - } - // If we aren't printing nonzeros print everything - else { - if(label) { - for(i = 0; i < width; i++) { - char *kmer_str = index_to_kmer(i, kmer); - fprintf(stdout, "%s\t%llu\n", kmer_str, counts[i]); - free(kmer_str); - } - } - else { - for(i = 0; i < width; i=i+4) { - fprintf(stdout, "%llu\n%llu\n%llu\n%llu\n", counts[i], counts[i+1], counts[i+2], counts[i+3]); - } - } + if(kmer > 12) { + node *root = get_kmer_counts_from_file(fh, kmer); + print_sparse(root, label, nonzero, kmer); } + //else { +// unsigned long long *counts = get_kmer_counts_from_file(fh, kmer); +// print(countst, label, nonzero); + //free(counts); +// } - free(counts); return EXIT_SUCCESS; } |