multiplierz.mzTools.featureDetector - BlaisProteomics/multiplierz GitHub Wiki

Feature detection is the process of defining and finding the traces of individual analyte molecules in MS1 time-M/Z space; this is often useful for quantitation, or for determining the effectiveness of chromatographic separation. Feature detection is performed automatically by the Multiplierz SILAC analysis algorithm, but it can also be performed separately.

detect_features(datafile, tolerance = 10, force = False)

This generates a feature data file for the specified MS data; the output file will be name of the input file plus the extension '.features'. By default, this function terminates if a pre-existing file is found with this name; the force argument, set to True, will cause it to instead overwrite the pre-existing file. tolerance is the M/Z deviation from expected values that will be accepted as the algorithm groups individual peaks into features, in units of parts-per-million; set this according to the mass accuracy of your instrument.

feature_analysis(datafile, resultfiles, tolerance = 10, mzRegex = None, scanRegex = None)

Generates a feature data file, or uses an existing file if one is found, and uses this to annotate a set of PSM report files with the corresponding feature data. Added columns are:

  • Feature : The index of the feature object in the feature file, for indexing with FeatureInterface.
  • feature error : "Near-miss" PSMs, spectra that did not correctly correspond to a given feature but could be explained through a non-standard acquisition from the same precursor, are recorded here.
  • feature start scan : The first MS1 scan in which the feature is evident.
  • feature end scan : The last MS1 scan in which the feature is evident.
  • feature start time : Retention time index of the first MS1 scan.
  • feature end time: Retention time index of the last MS1 scan.
  • feature skewness: The skew of the feature XIC; potentially useful for detecting invalid or unusual elution profiles.
  • feature kurtosis: the kurtosis for the XIC; potentially useful for detecting invalid or unusual elution profiles.

The Feature Detection Algorithm

Feature detection is performed in several stages. Conceptually, a feature is defined as a set of successive peaks that are identifiably members of an isotopic sequence with the same M/Z and charge state; recovering these allows quantification and other procedures to recover a large amount of detector signal which does not match the monoisotopic mass of the analyte (e.g., the 1xC13 peak adjacent to this mass, which oftentimes is a stronger signal than the monoisotopic peak.)

Since determination of isotopic envelopes is a highly visible differentiator between valid analytes and noise (and as a data-reduction step), all MS1s are first run through the Multiplierz peak-picking algorithm; this returns the peaks of each scan organized by isotopic envelope, as well as by the charge of such envelopes. Peaks not associated with an isotopic sequence are discarded.

To accelerate later processing, the collection of isotopic envelopes is organized into a two-layer hashtable structure, mapping charge states to mappings from scan numbers to set of present isotopic envelopes; additionally, the latter set of isotopic envelopes is stored in a custom datastructure that is optimized to return items that are closet to a specified M/Z value. Starting with the highest-signal isotopic envelope in the collection, the scans before and after its source scan are examined for a charge-matching isotopic envelope at the same M/Z. If one is found, in either direction, the search continues to the next scan, and so on for as long as matching envelopes are found; thanks to the lookup tables, each step is a roughly O(log(envelope_count)) operation. Additionally, the search process is continued over a set length of retention time after (or before) the last seen signal from the feature, to account for momentary dropout of the analyte signal.

Once a feature has been identified, the peaks it contains are marked as accounted-for and the next-highest-signal unaccounted-for isotopic envelope is used as the starting point for the next feature, until all envelopes are accounted for. Only features that appear in multiple successive MS1 scans are retained. Feature data are converted to Python objects for easy use and serialized/compressed into a Sqlite database for efficient storage and retrieval.