def pileup(self, ref, start, end):
        ''' A cheap pileup knock-off using BamBaseCaller '''

        basecaller = ngsutils.bam.basecall.BamBaseCaller(self, regions=ngsutils.bed.BedFile(region='%s:%s-%s' % (ref, start + 1, end)))
        for basepos in basecaller.fetch():
            pileups = []
            for record in basepos.reads:
                indel = 0  # size of indel, ins > 0, del < 0
                level = 0  # don't know what this is...
                is_del = False
                is_head = False  # Guessing about these
                is_tail = False
                if record.qpos == 0:
                    if record.read.is_reverse:
                        is_tail = True
                    else:
                        is_head = True

                # Doubt these do the right thing
                if basepos.insertions:
                    indel = max([len(ins) for ins in basepos.insertions])

                if basepos.deletions:
                    indel = - max(basepos.deletions)
                    is_del = True

                pr = PileupRead(record.read, indel, is_del, is_head, is_tail, level, record.qpos)
                pileups.append(pr)

            yield PileupRecords(basepos.tid, basepos.pos, basepos.total, pileups)
dataset/ETHPy150Open ngsutils/ngsutils/ngsutils/bam/t/__init__.py/MockBam.pileup/original