deconvolution

class deimos.deconvolution.MS2Deconvolution(ms1_features, ms1_data, ms2_features, ms2_data)[source]

Performs MS2 deconvolution by correlating non-m/z separation dimension profiles and scoring the agreement between precursor and fragment.

apply(dims=['drift_time', 'retention_time'], resolution=[0.01, 0.01])[source]

Perform deconvolution according to mathed features and their extracted profiles.

Parameters:
  • dims (: str or list) – Dimensions(s) for which to calculate MS1:MS2 correspondence by 1D profile agreement (i.e. non-m/z).

  • resolution (float or list) – Resolution applied to per-dimension profile interpolations.

Returns:

All MS1:MS2 pairings and associated agreement scores.

Return type:

DataFrame

configure_profile_extraction(dims=['mz', 'drift_time', 'retention_time'], low=[-0.0001, -0.05, -0.3], high=[0.0004, 0.05, 0.3], relative=[True, True, False])[source]

Configure parameters to generate extracted ion subsets of the data.

Parameters:
  • dims (str or list) – Dimension(s) by which to subset the data.

  • low (float or list) – Lower tolerance(s) in each dimension.

  • high (float or list) – Upper tolerance(s) in each dimension.

  • relative (bool or list) – Whether to use relative or absolute tolerance per dimension.

construct_putative_pairs(dims=['drift_time', 'retention_time'], low=[-0.12, -0.1], high=[1.4, 0.1], ce=None, model=<function offset_correction_model>, require_ms1_greater_than_ms2=True, error_tolerance=0.12)[source]

Determine each possible MS1:MS2 pair within specified tolerances. If considering drift time, apply a model to correct for drift time offset such that MS2 can be downselected by respective error in drift time (i.e. a poor model correction suggests an incorrect MS1:MS2 pair).

Parameters:
  • dims (str or list) – Dimension(s) by which to match MS1:MS2.

  • low (float or list) – Lower bound(s) in each dimension.

  • high (float or list) – Upper bound(s) in each dimension.

  • ce (float) – Collision energy of MS2 collection.

  • model (function) – Model used to correct for drift time offset between MS1 precursor and MS2 fragment. If omitted, a default model is used.

  • require_ms1_greater_than_ms2 (bool) – Signal whether precursor intensity must be greater than fragment intensity for putative assignments.

  • error_tolerance (float) – Acceptable difference between precursor and fragment drift times following correction by offset model.

Returns:

All MS1:MS2 pairings and associated agreement scores per requested dimension.

Return type:

DataFrame

deimos.deconvolution.cosine(a, b)[source]

Cosine distance (1 - similarity) between two arrays.

Parameters:
  • a (array) – N-dimensional arrays.

  • b (array) – N-dimensional arrays.

Returns:

Cosine distance.

Return type:

float

deimos.deconvolution.get_1D_profiles(features, dims=['mz', 'drift_time', 'retention_time'])[source]

Extract 1D profile for each of the indicated dimension(s).

Parameters:
  • features (DataFrame) – Input feature coordinates and intensities.

  • dims (str or list) – Dimensions considered in generating 1D profile(s).

Returns:

Dictionary indexed by dimension containing univariate splines for each 1D profile.

Return type:

dict of UnivariateSpline

deimos.deconvolution.offset_correction_model(dt_ms2, mz_ms2, mz_ms1, ce=0, params=[1.02067031, -0.02062323, 0.00176694])[source]