def filter(self):
        for tup in self.parent.filter():
            if not self._last:
                self._last = tup
            elif self._last[0] == tup[0]:
                if self.verbose:
                    sys.stderr.write('[Paired] %s (pass)\n' % self._last[0])
                    sys.stderr.write('[Paired] %s (pass)\n' % tup[0])
                yield self._last
                yield tup
                self._last = None
                self.kept += 2
            else:
                if self.verbose:
                    sys.stderr.write('[Paired] %s (fail)\n' % self._last[0])
                self.removed += 1
                if self.discard:
                    self.discard(tup[0])
                self._last = tup

        if self._last:
            if self.verbose:
                sys.stderr.write('[Paired] %s (pass)\n' % self._last[0])
            self.removed += 1
            if self.discard:
                self.discard(self._last[0])
dataset/ETHPy150Open ngsutils/ngsutils/ngsutils/fastq/filter.py/PairedFilter.filter/original