示例#1
0
    def lookup_standards(self):

        mztheo = []

        dfo = self.m.preproc.extractor.dataframe

        dfo.sort_values(by='mz', inplace=True)
        dfo.reset_index(drop=True, inplace=True)

        mzo = np.array(dfo['mz'])

        for i in self.standards:
            a = lookup.find(mzo, i, t=50)
            mztheo.append(a)
示例#2
0
    def collect_convex_hulls(self):

        self.convex_hulls = []

        # opening featureXML
        xml_file = oms.FeatureXMLFile()
        self.fmap = oms.FeatureMap()
        xml_file.load(self.feature_xml_fname, self.fmap)
        feature_mzs = []

        for i, fe in enumerate(self.fmap):

            feature_mzs.append([i, fe.getMZ()])

        feature_mzs = np.array(feature_mzs)
        feature_mzs = feature_mzs[feature_mzs[:, 1].argsort(), :]

        # looking up the example features in the featureXML
        self.examples_oms_features = {}

        for ex, (mz_t, mz_m) in self.peaks_peaks.items():

            i_mz_fe = lookup.find(feature_mzs[:, 1], mz_m, t=10)

            if i_mz_fe:

                self.examples_oms_features[feature_mzs[i_mz_fe, 0]] = ex

        # collecting convex hulls
        for ife, fe in enumerate(self.fmap):

            if ife in self.examples_oms_features:

                hull_list = fe.getConvexHulls()

                self.extend_hulls(hull_list, ife, 0)

                subord_feature = fe.getSubordinates()

                if subord_feature:

                    for subfe in subord_feature:

                        hull_list = subfe.getConvexHulls()

                        self.extend_hulls(hull_list, ife, 1)

        # columns: rt, mz, feature index, hull index, is sub-feature
        self.convex_hulls = np.vstack(self.convex_hulls)
        self.oms_feature_mzs = feature_mzs[feature_mzs[:, 0].argsort(), :]
示例#3
0
文件: sec.py 项目: soerendip/lipyd
 def background_correction_by_other_chromatograms(
         self,
         others,
         start = None,
         end = None,
     ):
     """
     Subtracts corresponding values of other chromatograms.
     
     Parameters
     ----------
     other : list,SECReader
         One or more instances of ``SECReader``.
     start : float
         Start at this volume. By default the beginning of the
         chromatogram.
     end : float
         Do until this volume. By default the end of the chromatogram.
     """
     
     def get_closest(vol):
         
         return lookup.find(self.volume, vol, np.inf)
     
     istart = 0 if start is None else get_closest(start)
     iend = 0 if end is None else get_closest(end)
     
     others = (
         (others,)
             if not isinstance(others, (tuple, list, np.ndarray)) else
         others
     )
     
     for i in xrange(istart, iend + 1):
         
         vol = self.volume[i]
         i_other = (
             lookup.find(other.volume, vol, np.inf)
             for other in others
         )
         background = np.median([
             others[j].absorbance[io]
             for j, io in enumerate(i_other)
         ])
         self.absorbance[i] = self.absorbance[i] - background
示例#4
0
    def lookup_progenesis(self):

        self.progenesis_peaks = {}

        if not hasattr(self, 'progenesis_mzs'):

            return

        for ex in self.examples:

            mz_theoretical = self.pc_adduct_masses[(ex, 0)]

            i = lookup.find(
                self.progenesis_mzs,  # all masses in the sample
                mz_theoretical,  # mass to search for
                t=10,  # tolerance in ppm
            )

            if i:

                self.progenesis_peaks[ex] = self.progenesis_mzs[i]
示例#5
0
    def lookup_peaks(self):

        self.peaks_peaks = {}

        for ex in self.examples:

            mz_theoretical = self.pc_adduct_masses[(ex, 0)]

            i = lookup.find(
                self.sample_selected,  # all masses in the sample
                mz_theoretical,  # mass to search for
                t=10,  # tolerance in ppm
            )

            if i is not None:

                self.peaks_peaks[ex] = (
                    mz_theoretical,
                    self.sample_selected[i],
                )

            else:

                print('Example not found: %s %.04f' % (ex, mz_theoretical))
示例#6
0
文件: sec.py 项目: soerendip/lipyd
 def get_closest(vol):
     
     return lookup.find(self.volume, vol, np.inf)