aboutsummaryrefslogtreecommitdiff
path: root/kmer_counts_per_sequence.c
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-02-27 12:27:20 -0500
committerCalvin Morrison <mutantturkey@gmail.com>2014-02-27 12:27:20 -0500
commit9beee3e285febb8b777ff16b314bf0d399c2300c (patch)
tree6787b60ef4dbd9e997e5d017370e322dff37b81b /kmer_counts_per_sequence.c
parentb19791da2c96887bdca09d85451c4281e326ff65 (diff)
fixed sparse in combination with --mer-file
Diffstat (limited to 'kmer_counts_per_sequence.c')
-rw-r--r--kmer_counts_per_sequence.c14
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) {