ngsfilter: fixed a bug with unaligned chimeras (unpaired primers) and
made error annotations more explicit
This commit is contained in:
15
python/obitools3/commands/ngsfilter.pyx
Executable file → Normal file
15
python/obitools3/commands/ngsfilter.pyx
Executable file → Normal file
@ -335,13 +335,18 @@ cdef tuple annotate(sequences, infos, no_tags, verbose=False):
|
||||
final_sequence[b'reverse_match']=match.seq
|
||||
|
||||
# Keep only paired reverse primer
|
||||
infos = infos[directmatch[0]]
|
||||
infos = infos[directmatch[0]]
|
||||
rev_prim = list(infos.keys())[0]
|
||||
|
||||
# If not aligned, look for other match in already computed matches (choose the one that makes the biggest amplicon)
|
||||
if not_aligned:
|
||||
i=1
|
||||
# TODO comment
|
||||
while i<len(all_direct_matches) and (all_direct_matches[i][1] is None or all_direct_matches[i][0].forward == directmatch[0].forward or all_direct_matches[i][0] == directmatch[0]):
|
||||
while i<len(all_direct_matches) and \
|
||||
(all_direct_matches[i][1] is None or \
|
||||
all_direct_matches[i][0].forward == directmatch[0].forward or \
|
||||
all_direct_matches[i][0] == directmatch[0] or \
|
||||
rev_prim != all_direct_matches[i][0]) :
|
||||
i+=1
|
||||
if i < len(all_direct_matches):
|
||||
reversematch = all_direct_matches[i]
|
||||
@ -445,7 +450,7 @@ cdef tuple annotate(sequences, infos, no_tags, verbose=False):
|
||||
if len(s)==1:
|
||||
sample=s[0]
|
||||
elif len(s)>1:
|
||||
final_sequence[b'error']=b'multiple samples match tags'
|
||||
final_sequence[b'error']=b'Did not found reverse tag'
|
||||
return False, final_sequence
|
||||
else:
|
||||
sample=None
|
||||
@ -455,13 +460,13 @@ cdef tuple annotate(sequences, infos, no_tags, verbose=False):
|
||||
if len(s)==1:
|
||||
sample=s[0]
|
||||
elif len(s)>1:
|
||||
final_sequence[b'error']=b'multiple samples match tags'
|
||||
final_sequence[b'error']=b'Did not found forward tag'
|
||||
return False, final_sequence
|
||||
else:
|
||||
sample=None
|
||||
|
||||
if sample is None:
|
||||
final_sequence[b'error']=b"Cannot assign sequence to a sample"
|
||||
final_sequence[b'error']=b"No tags found"
|
||||
return False, final_sequence
|
||||
|
||||
final_sequence.update(sample)
|
||||
|
@ -1,5 +1,5 @@
|
||||
major = 3
|
||||
minor = 0
|
||||
serial= '0-beta1'
|
||||
serial= '0-beta2'
|
||||
|
||||
version ="%d.%02d.%s" % (major,minor,serial)
|
||||
|
Reference in New Issue
Block a user