def get_p(self):
        """Return a P object of probabilites"""
        
        p=PGBG(numprom=self.numprom,numbiprom=self.numbiprom,numdown=self.numdown)
        
        try:
            chroms=self.get_chroms()
            if not chroms: raise ValueError
        except (__HOLE__,ValueError):
            return p
        
        for chrom in chroms:
            total=self[chrom]['Ns']
            p.init_table(chrom)
            # check if the denominator is zero
            try:
                p[chrom]['promoter']=map(lambda x: 1.0*x/total,self[chrom]['promoter'])
            except ZeroDivisionError:
                total=1
                p[chrom]['promoter']=map(lambda x: 1.0*x/total,self[chrom]['promoter'])
            p[chrom]['bipromoter']=map(lambda x: 1.0*x/total,self[chrom]['bipromoter'])
            p[chrom]['downstream']=map(lambda x: 1.0*x/total,self[chrom]['downstream'])
            p[chrom]['gene']=map(lambda x: 1.0*x/total,self[chrom]['gene'])
            
            #relative locations
            total_rel_loc=sum(self[chrom]['rel_loc'][0])
            total_rel_loc_cds=sum(self[chrom]['rel_loc_cds'][0])
        # check if the denominator is zero
            try:
                p_rel_loc0=map(lambda x: 1.0*x/total_rel_loc,self[chrom]['rel_loc'][0])
            except ZeroDivisionError:
                total_rel_loc=1
                p_rel_loc0=map(lambda x: 1.0*x/total_rel_loc,self[chrom]['rel_loc'][0])
            p_rel_loc1=map(lambda x: 1.0*x/total_rel_loc,self[chrom]['rel_loc'][1])
            
            try:
                p_rel_loc_cds0=map(lambda x: 1.0*x/total_rel_loc_cds,self[chrom]['rel_loc_cds'][0])
            except ZeroDivisionError:
                total_rel_loc_cds=1
                p_rel_loc_cds0=map(lambda x: 1.0*x/total_rel_loc_cds,self[chrom]['rel_loc_cds'][0])
            p_rel_loc_cds1=map(lambda x: 1.0*x/total_rel_loc_cds,self[chrom]['rel_loc_cds'][1])
           
            p[chrom]['rel_loc']=[p_rel_loc0,p_rel_loc1]
            p[chrom]['rel_loc_cds']=[p_rel_loc_cds0,p_rel_loc_cds1]
        
        
            try:
                p[chrom]['roi']=1.0*self[chrom]['roi']/total
            except ZeroDivisionError:
                p[chrom]['roi']=1.0*self[chrom]['roi']
            except KeyError:
                pass
        
            
            try:
                p[chrom]['chroms']=1.0*self[chrom]['Ns']/self['whole']['Ns']
            except ZeroDivisionError:
                p[chrom]['chroms']=total
                
        return p
dataset/ETHPy150Open taoliu/taolib/Assoc/tables.py/SummaryGBG.get_p