def normalizePeptideRatios(self, norm_prot, target_log_mean=0.0): # DAD: implement target_peps = [self.peptide_data[k] for k in peptide_keys] acc = stats.LogAccumulator(store=False) for p in target_peps: acc.addAll([r for r in p.ratios]) mean = acc.mean sd = acc.sd log_mean = math.log(mean) for p_key in self.peptide_data.keys(): p = self.peptide_data[p_key] ratlist = p.heavy_light_ratio_list for xi in range(len(ratlist)): #ratlist[xi] = math.exp((math.log(ratlist[xi]) - (log_mean - target_log_mean))/(log_sd/target_log_sd)) try: norm_log_ratio = (math.log(ratlist[xi]) - (log_mean - target_log_mean))/(log_sd/target_log_sd) ratlist[xi] = math.exp(norm_log_ratio) except OverflowError: print "overflow! --", p_key, xi, ratlist[xi], math.log(ratlist[xi]), norm_log_ratio return
def getNormalizedHeavyMediumRatioSummary(self): acc = stats.LogAccumulator(store=True) acc.addAll(self.heavy_medium_normalized_ratio_list) return acc.summary
def getNormalizedMediumLightRatioSummary(self): acc = stats.LogAccumulator(store=True) acc.addAll(self.medium_light_normalized_ratio_list) return acc.summary
def getHeavyLightRatioSummary(self): acc = stats.LogAccumulator(store=True) for pep in self.peptides: acc.addAll(pep.heavy_light_ratio_list) s = acc.summary return s
def getIntensityRatioSummary(self, ratio_string): acc = stats.LogAccumulator(store=True) acc.addAll(self.getIntensityRatios(ratio_string)) return acc.summary
def getNormalizedHeavyLightRatioSummary(self): acc = stats.LogAccumulator(store=True) for pep in self.peptide_dict.values(): acc.addAll(pep.heavy_light_normalized_ratio_list) return acc.summary
def getHeavyLightRatioSummary(self): acc = stats.LogAccumulator(store=True) acc.addAll(self.heavy_light_ratio_list) return acc.summary
def getMediumLightRatioSummary(self): acc = stats.LogAccumulator(store=True) for pep in self.peptides: acc.addAll(pep.medium_light_ratio_list) return acc.summary
def getHeavyMediumRatioSummary(self): acc = stats.LogAccumulator(store=True) for pep in self.peptides: acc.addAll(pep.heavy_medium_ratio_list) return acc.summary
def getIntensityRatioSummary(self, ratio_string): acc = stats.LogAccumulator(store=True) for pep in self.peptides: acc.addAll(pep.getIntensityRatios(ratio_string)) return acc.summary