Example #1
0
 def __init__(self,
              neutral_mass,
              intensity,
              charge,
              signal_to_noise,
              index,
              full_width_at_half_max,
              a_to_a2_ratio=0,
              most_abundant_mass=0,
              average_mass=0,
              score=0,
              envelope=None,
              mz=0,
              fit=None,
              chosen_for_msms=False,
              area=0):
     if index is None:
         index = _Index()
     if envelope is None:
         envelope = ()
     self.neutral_mass = neutral_mass
     self.intensity = intensity
     self.signal_to_noise = signal_to_noise
     self.index = index
     self.full_width_at_half_max = full_width_at_half_max
     self.charge = charge
     self.a_to_a2_ratio = a_to_a2_ratio
     self.most_abundant_mass = most_abundant_mass
     self.average_mass = average_mass
     self.score = score
     self.envelope = Envelope(envelope)
     self.mz = mz or mass_charge_ratio(self.neutral_mass, self.charge)
     self.fit = fit
     self.chosen_for_msms = chosen_for_msms
     self.area = area
    def _reindex(self):
        """
        Updates the :attr:`index` of each peak in `self` and updates the
        sorted order.

        Returns
        -------
        self: DeconvolutedPeakSet
        """
        self.peaks = tuple(sorted(self.peaks, key=operator.attrgetter("neutral_mass")))
        self._mz_ordered = tuple(sorted(self.peaks, key=operator.attrgetter("mz")))
        for i, peak in enumerate(self.peaks):
            peak.index = _Index()
            peak.index.neutral_mass = i
        for i, peak in enumerate(self._mz_ordered):
            peak.index.mz = i
        return self
Example #3
0
    def _reindex(self):
        """
        Updates the :attr:`index` of each peak in `self` and updates the
        sorted order.

        Returns
        -------
        self: DeconvolutedPeakSet
        """
        self.peaks = tuple(
            sorted(self.peaks, key=operator.attrgetter("neutral_mass")))
        self._mz_ordered = tuple(
            sorted(self.peaks, key=operator.attrgetter("mz")))
        for i, peak in enumerate(self.peaks):
            peak.index = _Index()
            peak.index.neutral_mass = i
        for i, peak in enumerate(self._mz_ordered):
            peak.index.mz = i
        return self
Example #4
0
    def reindex(self):
        """
        Updates the :attr:`index` of each peak in `self` and updates the
        sorted order.

        Returns
        -------
        self: DeconvolutedPeakSet
        """
        self.peaks = tuple(
            sorted(self.peaks, key=lambda x: (x.neutral_mass, x.drift_time)))
        self._mz_ordered = tuple(
            sorted(self.peaks, key=lambda x: (x.mz, x.drift_time)))
        for i, peak in enumerate(self.peaks):
            peak.index = _Index()
            peak.index.neutral_mass = i
        for i, peak in enumerate(self._mz_ordered):
            peak.index.mz = i
        return self
 def __init__(self, neutral_mass, intensity, charge, signal_to_noise, index, full_width_at_half_max,
              a_to_a2_ratio=None, most_abundant_mass=None, average_mass=None, score=None,
              envelope=None, mz=None, fit=None, chosen_for_msms=False, area=0):
     if index is None:
         index = _Index()
     self.neutral_mass = neutral_mass
     self.intensity = intensity
     self.signal_to_noise = signal_to_noise
     self.index = index
     self.full_width_at_half_max = full_width_at_half_max
     self.charge = charge
     self.a_to_a2_ratio = a_to_a2_ratio
     self.most_abundant_mass = most_abundant_mass
     self.average_mass = average_mass
     self.score = score
     self.envelope = Envelope(envelope)
     self.mz = mz or mass_charge_ratio(self.neutral_mass, self.charge)
     self.fit = fit
     self.chosen_for_msms = chosen_for_msms
     self.area = area