def merge(self,rmout):
    for rawspectrum in self.rt_all.keys():
      for peptide in self.rt_all[rawspectrum]:
        rt = []
        for idx in all_indices(sorted(self.prob_all[rawspectrum][peptide], reverse=True)[0],self.prob_all[rawspectrum][peptide]):
          rt.append(self.rt_all[rawspectrum][peptide][idx])

        if rmout and len(rt) > 2:
          self.rt[rawspectrum][peptide] = lmedian(array(rt)[chauvenet(array(rt),array(rt))])
          self.rt_run[rawspectrum][peptide] = array(rt)[chauvenet(array(rt),array(rt))]
        else:
          self.rt[rawspectrum][peptide] = lmedian(rt)
          self.rt_run[rawspectrum][peptide] = rt
Ejemplo n.º 2
0
  def merge(self,rmout):
    for rawspectrum in self.rt_all:
      for peptide in self.rt_all[rawspectrum]:
        rt = []
        for idx in all_indices(sorted(self.prob_all[rawspectrum][peptide], reverse=True)[0],self.prob_all[rawspectrum][peptide]):
          rt.append(self.rt_all[rawspectrum][peptide][idx])

        if rmout and len(rt) > 2:
          self.rt[rawspectrum][peptide] = lmedian(array(rt)[chauvenet(array(rt),array(rt))])
          self.rt_run[rawspectrum][peptide] = array(rt)[chauvenet(array(rt),array(rt))]
        else:
          self.rt[rawspectrum][peptide] = lmedian(rt)
          self.rt_run[rawspectrum][peptide] = rt
Ejemplo n.º 3
0
    def transform(self, rmout):
        irt = {}
        for rawspectrum in self.rt:
            for peptide in self.rt[rawspectrum]:
                self.irt[rawspectrum][peptide] = scipy.polyval(
                    [self.a[rawspectrum], self.b[rawspectrum]],
                    self.rt[rawspectrum][peptide])
                if peptide not in irt:
                    irt[peptide] = []
                irt[peptide].append(self.irt[rawspectrum][peptide])

        for peptide in irt:
            if len(irt) == 1:
                self.irt_merged[peptide] = round(irt[peptide][0], 5)
            else:
                if rmout and len(irt) > 2:
                    self.irt_merged[peptide] = round(
                        lmedian(
                            array(irt[peptide])[invert(
                                chauvenet(array(irt[peptide]),
                                          array(irt[peptide])))]), 5)
                else:
                    self.irt_merged[peptide] = round(lmedian(irt[peptide]), 5)

        for i in range(0, len(self.blocks)):
            self.blocks[i].replace(self.irt_merged[self.blocks[i].peptide])
  def transform(self,rmout):
    irt = {}
    for rawspectrum in self.rt.keys():
      for peptide in self.rt[rawspectrum].keys():
        self.irt[rawspectrum][peptide] = scipy.polyval([self.a[rawspectrum],self.b[rawspectrum]],self.rt[rawspectrum][peptide])
        if peptide not in irt.keys():
          irt[peptide] = []
        irt[peptide].append(self.irt[rawspectrum][peptide])

    for peptide in irt.keys():
      if len(irt) == 1:
        self.irt_merged[peptide] = round(irt[peptide][0],5)
      else:
        if rmout and len(irt) > 2:
          self.irt_merged[peptide] = round(lmedian(array(irt[peptide])[invert(chauvenet(array(irt[peptide]),array(irt[peptide])))]),5)
        else:
          self.irt_merged[peptide] = round(lmedian(irt[peptide]),5)
 
    for i in range(0,len(self.blocks)):
      self.blocks[i].replace(self.irt_merged[self.blocks[i].peptide])