/usr/lib/python3/dist-packages/cutadapt/qualtrim.py is in python3-cutadapt 1.15-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # coding: utf-8
"""
Quality trimming.
"""
from __future__ import print_function, division, absolute_import
import sys
if sys.version > '3':
xrange = range
def nextseq_trim_index(sequence, cutoff, base=33):
"""
Variant of the above quality trimming routine that works on NextSeq data.
With Illumina NextSeq, bases are encoded with two colors. 'No color' (a
dark cycle) usually means that a 'G' was sequenced, but that also occurs
when sequencing falls off the end of the fragment. The read then contains
a run of high-quality G bases in the end.
This routine works as the one above, but counts qualities belonging to 'G'
bases as being equal to cutoff - 1.
"""
bases = sequence.sequence
qualities = sequence.qualities
s = 0
max_qual = 0
max_i = len(qualities)
for i in reversed(xrange(max_i)):
q = ord(qualities[i]) - base
if bases[i] == 'G':
q = cutoff - 1
s += cutoff - q
if s < 0:
break
if s > max_qual:
max_qual = s
max_i = i
return max_i
from cutadapt._qualtrim import quality_trim_index, nextseq_trim_index
|