diff --git a/python/obitools3/commands/ngsfilter.pyx b/python/obitools3/commands/ngsfilter.pyx index 9375d9a..073855d 100755 --- a/python/obitools3/commands/ngsfilter.pyx +++ b/python/obitools3/commands/ngsfilter.pyx @@ -283,7 +283,8 @@ cdef tuple annotate(sequences, infos, verbose=False): if pattern == MAX_PATTERN: new_seq = True pattern = 0 - directmatch.append((p, p(seq, same_sequence=not new_seq, pattern=pattern), seq)) + # Saving original primer as 4th member of the tuple to serve as correct key in infos dict even if it might be reversed complemented (not here) + directmatch.append((p, p(seq, same_sequence=not new_seq, pattern=pattern), seq, p)) new_seq = False pattern+=1 @@ -329,10 +330,11 @@ cdef tuple annotate(sequences, infos, verbose=False): # Keep only paired reverse primer infos = infos[directmatch[0]] - # If not aligned, look for other match in already computed match (choose the one that makes the biggest amplicon) + # If not aligned, look for other match in already computed matches (choose the one that makes the biggest amplicon) if not_aligned: i=1 - while all_direct_matches[i][1] is None and all_direct_matches[i][0].forward and i