def size(self, chrom=''):
        """Return how many genomic regions in this object
        
        Parameters:
        1. chrom: chromosome whose size will be obtained. If '', return a dictionary of all the chromosomes
        """
        
        # a specific chromosome
        if chrom:
            try:
                n = len(self[chrom]['start'])
            except KeyError:
                n = 0
        else:
            chroms = self.get_chroms()
            n = {}
            a = 0
            for chrom in chroms:
                try:
                    n[chrom] = len(self[chrom]['start'])
                except __HOLE__:
                    n[chrom] = 0
                a += n[chrom]
                
            n['whole']= a 

        return n
dataset/ETHPy150Open taoliu/taolib/Assoc/inout.py/Bed.size