示例#1
0
    def __overlap_fe (self, gold_peaks, sample_peaks, fe_low, fe_up, top, bottom, step):
        ret = ["%d-%d" % (fe_low,fe_up)]
        gp = PeakIO()
        gp.init_from_dict(gold_peaks)
        gp.filter_fc(fe_low,fe_up)
        gptotal =  gp.total()
        if gptotal <= 0:
            return None

        ret.append(gptotal)
        for i in xrange(top,bottom,step):
            p = PeakIO()
            p.init_from_dict(sample_peaks[i])
            percent = 100.0*gp.overlap_with_other_peaks(p)/gptotal
            ret.append(percent)
            del p
        return ret
示例#2
0
    def __overlap(self, gold_peaks, sample_peaks, top=90, bottom=10, step=-10):
        """Calculate the overlap between several fe range for the
        golden peaks set and results from sampled data.
        
        """
        gp = PeakIO()
        gp.init_from_dict(gold_peaks)
        if self.femax:
            femax = min(self.femax,
                        (int(gp.max_fold_enrichment()) // self.festep + 1) *
                        self.festep)
        else:
            femax = (int(gp.max_fold_enrichment()) // self.festep +
                     1) * self.festep
        femin = self.femin
        diag_result = []
        for f in xrange(femin, femax, self.festep):

            fe_low = f
            fe_up = f + self.festep
            self.debug("#3 diag: fe range = %d -- %d" % (fe_low, fe_up))

            r = self.__overlap_fe(gold_peaks, sample_peaks, fe_low, fe_up, top,
                                  bottom, step)
            if r:
                diag_result.append(r)
        return diag_result
示例#3
0
 def __overlap (self, gold_peaks, sample_peaks, top=90,bottom=10,step=-10):
     """Calculate the overlap between several fe range for the
     golden peaks set and results from sampled data.
     
     """
     gp = PeakIO()
     gp.init_from_dict(gold_peaks)
     if self.femax:
         femax = min(self.femax, (int(gp.max_fold_enrichment())//self.festep+1)*self.festep)
     else:
         femax = (int(gp.max_fold_enrichment())//self.festep+1)*self.festep
     femin = self.femin
     diag_result = []
     for f in xrange(femin, femax, self.festep):
         
         fe_low = f
         fe_up = f + self.festep
         self.debug("#3 diag: fe range = %d -- %d" % (fe_low, fe_up))
         
         r = self.__overlap_fe(gold_peaks, sample_peaks, fe_low, fe_up, top, bottom, step)
         if r:
             diag_result.append(r)
     return diag_result
示例#4
0
    def __overlap_fe(self, gold_peaks, sample_peaks, fe_low, fe_up, top,
                     bottom, step):
        ret = ["%d-%d" % (fe_low, fe_up)]
        gp = PeakIO()
        gp.init_from_dict(gold_peaks)
        gp.filter_fc(fe_low, fe_up)
        gptotal = gp.total()
        if gptotal <= 0:
            return None

        ret.append(gptotal)
        for i in xrange(top, bottom, step):
            p = PeakIO()
            p.init_from_dict(sample_peaks[i])
            percent = 100.0 * gp.overlap_with_other_peaks(p) / gptotal
            ret.append(percent)
            del p
        return ret