Switch to unified view

a b/singlecellmultiomics/statistic/trimming.py
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
4
from .statistic import StatisticHistogram
5
import singlecellmultiomics.pyutils as pyutils
6
7
8
class TrimmingStats(StatisticHistogram):
9
    def __init__(self, args):
10
        StatisticHistogram.__init__(self, args)
11
        self.totalFragmentsTrimmed = 0
12
13
    def processRead(self, R1,R2=None):
14
15
        for read in [R1,R2]:
16
            if read is None:
17
                continue
18
19
            if read.has_tag('a1') or read.has_tag(
20
                    'eB') or read.has_tag('A2') or read.has_tag('EB'):
21
                self.totalFragmentsTrimmed += 1
22
23
    def __repr__(self):
24
        return f'Trimmed fragments: {self.totalFragmentsTrimmed}'
25
26
    def __iter__(self):
27
        yield 'Trimmed fragments', self.totalFragmentsTrimmed