From ceaafca4271b62ad31b3084474cb3897afcc931a Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Fri, 29 Mar 2019 10:56:17 +0100 Subject: [PATCH] ngsfilter: fixed a bug (maybe 2) in the algo for the choice of the reverse primer when running on unaligned sequences --- python/obitools3/commands/ngsfilter.pyx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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