diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2014-02-27 12:27:20 -0500 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2014-02-27 12:27:20 -0500 |
commit | 9beee3e285febb8b777ff16b314bf0d399c2300c (patch) | |
tree | 6787b60ef4dbd9e997e5d017370e322dff37b81b /kmer_counts_per_sequence.c | |
parent | b19791da2c96887bdca09d85451c4281e326ff65 (diff) |
fixed sparse in combination with --mer-file
Diffstat (limited to 'kmer_counts_per_sequence.c')
-rw-r--r-- | kmer_counts_per_sequence.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/kmer_counts_per_sequence.c b/kmer_counts_per_sequence.c index bd18f04..946b491 100644 --- a/kmer_counts_per_sequence.c +++ b/kmer_counts_per_sequence.c @@ -129,7 +129,6 @@ int main(int argc, char **argv) { width = pow_four(kmer); if(specific_mers) { - sparse = false; desired_indicies = malloc((width) * sizeof(size_t)); if(desired_indicies == NULL) { fprintf(stderr, "%s\n", strerror(errno)); @@ -137,7 +136,7 @@ int main(int argc, char **argv) { } num_desired_indicies = load_specific_mers_from_file(mer_fn, kmer, width, desired_indicies); if(num_desired_indicies == 0) { - fprintf(stderr, "Error: no mers loaded from file"); + fprintf(stderr, "Error: no mers loaded from file\n"); exit(EXIT_FAILURE); } } @@ -181,9 +180,16 @@ int main(int argc, char **argv) { if(specific_mers) { - for(k = 0; k < num_desired_indicies; k++) { - if(desired_indicies[k] != 0) + if(sparse) { + for(k = 0; k < num_desired_indicies; k++) { + if(counts[desired_indicies[k]] != 0) + fprintf(stdout, "%llu\t%zu\t%llu\n", sequence, desired_indicies[k], counts[desired_indicies[k]]); + } + } + else { + for(k = 0; k < num_desired_indicies; k++) { fprintf(stdout, "%llu\t%zu\t%llu\n", sequence, desired_indicies[k], counts[desired_indicies[k]]); + } } } else if(sparse) { |