From e391ddac10731e76eb8f6c18ee3d18964d7c6ce2 Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Mon, 14 Apr 2014 14:49:12 -0400 Subject: add offset for sequence --- kmer_locations.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'kmer_locations.c') diff --git a/kmer_locations.c b/kmer_locations.c index 3270e7f..3539755 100644 --- a/kmer_locations.c +++ b/kmer_locations.c @@ -8,7 +8,7 @@ #include "kmer_utils.h" -void print_mer(unsigned long long mer, long const long pos, const bool labels, const bool reverse, unsigned int kmer, char *label) { +void print_mer(unsigned long long mer, const long long pos, const bool labels, const bool reverse, unsigned int kmer, char *label) { if(labels) { char *kmer_str; bool free_ptr = false; @@ -67,15 +67,21 @@ void print_sequence(const char *seq, // sequence } // bump up the mer value in the counts array + long long pos; + if(!reverse) + pos = global_pos + position; + else + pos = global_pos + ((signed)seq_length - position); + if(num_specific_mers != 0) { size_t j; for(j = 0; j < num_specific_mers; j++) { if(mer == specific_mers[j]) - print_mer(mer, position + global_pos, labels, reverse, kmer, specific_mers_labels[j]); + print_mer(mer, pos, labels, reverse, kmer, specific_mers_labels[j]); } } else { - print_mer(mer, position + global_pos, labels, reverse, kmer, NULL); + print_mer(mer, pos, labels, reverse, kmer, NULL); } // skip count if error next: ; -- cgit v1.2.3