Esempio n. 1
0
 def extracted_mz(self):
     if self.extracted_charge == ChargeNotProvided or (
             self.extracted_charge == 0 and self.charge == ChargeNotProvided):
         warnings.warn(
             "A precursor with an unknown charge state was used to compute a m/z.")
         return mass_charge_ratio(self.mz, DEFAULT_CHARGE_WHEN_NOT_RESOLVED)
     return mass_charge_ratio(self.extracted_neutral_mass, self.extracted_charge)
Esempio n. 2
0
    def mz(self):
        '''The calculated m/z of the ion

        Returns
        -------
        float
        '''
        return mass_charge_ratio(self.neutral_mass, self.charge)
    def mz(self):
        '''The calculated m/z of the ion

        Returns
        -------
        float
        '''
        return mass_charge_ratio(self.neutral_mass, self.charge)
Esempio n. 4
0
 def format_peak_vectors(self, scan):
     if self.deconvoluted:
         (neutral_mass_array, intensity_array, charge_array) = super(
             MGFSerializer, self).format_peak_vectors(scan)
         mz_array = [mass_charge_ratio(
             neutral_mass_array[i], charge_array[i]) for i in range(len(charge_array))]
     else:
         (mz_array, intensity_array, charge_array) = super(
             MGFSerializer, self).format_peak_vectors(scan)
     return (mz_array, intensity_array, charge_array)
Esempio n. 5
0
 def format_peak_vectors(self, scan):
     if self.deconvoluted:
         (neutral_mass_array, intensity_array, charge_array) = super(
             MGFSerializer, self).format_peak_vectors(scan)
         mz_array = [mass_charge_ratio(
             neutral_mass_array[i], charge_array[i]) for i in range(len(charge_array))]
     else:
         (mz_array, intensity_array, charge_array) = super(
             MGFSerializer, self).format_peak_vectors(scan)
     return (mz_array, intensity_array, charge_array)
Esempio n. 6
0
    def iter_mz(self):
        """Iterate over theoretical m/z coordinates for this analyte

        Yields
        ------
        float:
            The theoretical m/z for a charge state
        """
        for charge in self.charge_states:
            yield mass_charge_ratio(self.neutral_mass, charge)
Esempio n. 7
0
 def convert(self, data_source=None):
     precursor_id = None
     if self.precursor is not None:
         precursor_id = self.precursor.scan_id
     product_id = None
     if self.product is not None:
         product_id = self.product.scan_id
     conv = MemoryPrecursorInformation(
         mass_charge_ratio(self.neutral_mass, self.charge), self.intensity, self.charge,
         precursor_id, data_source, self.neutral_mass, self.charge,
         self.intensity, self.defaulted, self.orphan, product_id)
     return conv
Esempio n. 8
0
 def format_peak_vectors(self, scan):
     """As in :class:`~.HeaderedDelimitedTextWriter` but always writes m/z, even when charge
     is known.
     """
     if self.deconvoluted:
         (neutral_mass_array, intensity_array,
          charge_array) = super(MGFSerializer,
                                self).format_peak_vectors(scan)
         mz_array = [
             mass_charge_ratio(neutral_mass_array[i], charge_array[i])
             for i in range(len(charge_array))
         ]
     else:
         (mz_array, intensity_array,
          charge_array) = super(MGFSerializer,
                                self).format_peak_vectors(scan)
     return (mz_array, intensity_array, charge_array)
 def generate_isotopic_pattern(self, charge, node_type=Unmodified):
     if self.composition is not None:
         tid = isotopic_variants(
             self.composition + node_type.composition,
             charge=charge, charge_carrier=self.charge_carrier)
         out = []
         total = 0.
         for p in tid:
             out.append(p)
             total += p.intensity
             if total >= 0.95:
                 break
         return out
     else:
         tid = self.averagine.isotopic_cluster(
             mass_charge_ratio(
                 self.chromatogram.neutral_mass + node_type.mass,
                 charge, charge_carrier=self.charge_carrier),
             charge,
             charge_carrier=self.charge_carrier)
         return tid
Esempio n. 10
0
 def generate_isotopic_pattern(self, charge, node_type=Unmodified):
     if self.composition is not None:
         tid = isotopic_variants(self.composition + node_type.composition,
                                 charge=charge,
                                 charge_carrier=self.charge_carrier)
         out = []
         total = 0.
         for p in tid:
             out.append(p)
             total += p.intensity
             if total >= 0.95:
                 break
         return out
     else:
         tid = self.averagine.isotopic_cluster(
             mass_charge_ratio(self.chromatogram.neutral_mass +
                               node_type.mass,
                               charge,
                               charge_carrier=self.charge_carrier),
             charge,
             charge_carrier=self.charge_carrier)
         return tid
Esempio n. 11
0
 def convert(self, data_source=None):
     return MemoryPrecursorInformation(
         mass_charge_ratio(self.neutral_mass,
                           self.charge), self.intensity, self.charge,
         self.precursor.scan_id, data_source, self.neutral_mass, self.charge,
         self.intensity)
 def mz(self):
     return mass_charge_ratio(self.neutral_mass, self.charge)
Esempio n. 13
0
 def mz(self):
     if self._mz is None:
         self._mz = mass_charge_ratio(self.neutral_mass, self.charge)
     return self._mz