ngsfilter: fixed a bug with unaligned chimeras (unpaired primers) and

made error annotations more explicit
This commit is contained in:
Celine Mercier
2019-12-10 13:43:32 +01:00
parent 53f18316b0
commit 35ce37c0f7
3 changed files with 12 additions and 7 deletions

15
python/obitools3/commands/ngsfilter.pyx Executable file → Normal file
View 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)

View File

@ -1,5 +1,5 @@
major = 3
minor = 0
serial= '0-beta1'
serial= '0-beta2'
version ="%d.%02d.%s" % (major,minor,serial)

View File

@ -83,7 +83,7 @@ def findPackage(root,base=None):
PACKAGE = "OBITools3"
VERSION = "3.0.0-beta1"
VERSION = "3.0.0-beta2"
AUTHOR = 'Celine Mercier'
EMAIL = 'celine.mercier@metabarcoding.org'
URL = "http://metabarcoding.org/obitools3"