ngsfilter: checks better if there is an associated sequencing quality

This commit is contained in:
mercierc
2021-09-08 10:30:11 +12:00
parent 4be9f36f99
commit 34de90bce6

2
python/obitools3/commands/ngsfilter.pyx Normal file → Executable file
View File

@ -271,7 +271,7 @@ cdef tuple annotate(sequences, infos, no_tags, verbose=False):
sequences[0][REVERSE_QUALITY_COLUMN] = sequences[1].quality # used by alignpairedend tool sequences[0][REVERSE_QUALITY_COLUMN] = sequences[1].quality # used by alignpairedend tool
for seq in sequences: for seq in sequences:
if hasattr(seq, "quality_array"): if hasattr(seq, "quality_array") and seq.quality_array is not None:
q = -reduce(lambda x,y:x+y,(math.log10(z) for z in seq.quality_array),0)/len(seq.quality_array)*10 q = -reduce(lambda x,y:x+y,(math.log10(z) for z in seq.quality_array),0)/len(seq.quality_array)*10
seq[b'avg_quality']=q seq[b'avg_quality']=q
q = -reduce(lambda x,y:x+y,(math.log10(z) for z in seq.quality_array[0:10]),0) q = -reduce(lambda x,y:x+y,(math.log10(z) for z in seq.quality_array[0:10]),0)