def filter(self):
        for name, comment, seq, qual in self.parent.filter():
            if len(qual) > self.size:
                if len(seq) == len(qual):  
                    # basespace or colorspace w/o prefix
                    seq = seq[self.size:]
                    qual = qual[self.size:]
                else:
                    # colorspace with prefix
                    # can not be trimmed this way
                    sys.stderr.write('You can not trim the prefix away with colorspace data!')
                    sys.exit(1)

                if self.verbose:
                    if seq and qual:
                        sys.stderr.write('[Prefix] %s (altered)\n' % (name,))
                        self.altered += 1
                        comment = '%s #trunc' % comment
                    else:
                        sys.stderr.write('[Prefix] %s (removed)\n' % (name,))
                        self.removed += 1
                        if self.discard:
                            self.discard(name)
                        continue
            else:
                self.kept += 1

            yield (name, comment, seq, qual)
dataset/ETHPy150Open ngsutils/ngsutils/ngsutils/fastq/filter.py/PrefixFilter.filter/original