Skip to content

OpenSwathWorkflow: Error integrating drift time when processing non-ion mobility DIA data #7883

Closed

Description

@singjc

OpenSwathWorkflow seems to attempt to integrate with drift time for regular DIA (non ion mobility) data. The ion mobility params are turned off, so I'm not sure why it would still try to integrate with drift_time.

Also noticed use_ms1_ion_mobility seems to be a duplicated param.

params

TOPPBase.cpp(1662): Value of string option 'no_progress': 0
TOPPBase.cpp(1662): Value of string option 'in': /data/input/20200902_Erli_pro_117.mzML.gz
TOPPBase.cpp(1662): Value of string option 'tr': /data/input/library.pqp
TOPPBase.cpp(1662): Value of string option 'out_features': /data/20200902_Erli_pro_117.osw
TOPPBase.cpp(1662): Value of string option 'tr_type': 
TOPPBase.cpp(1662): Value of string option 'out_features_type': 
TOPPBase.cpp(1662): Value of string option 'out_qc': 
TOPPBase.cpp(1662): Value of string option 'tr_irt': /data/input/20200902_Erli_pro_117_Q1_run_peaks_linear.pqp
TOPPBase.cpp(1662): Value of string option 'tr_irt_nonlinear': /data/input/20200902_Erli_pro_117_Q1_run_peaks.pqp
TOPPBase.cpp(1662): Value of string option 'rt_norm': 
TOPPBase.cpp(1662): Value of string option 'swath_windows_file': 
TOPPBase.cpp(1662): Value of string option 'out_chrom': /data/20200902_Erli_pro_117.sqMass
TOPPBase.cpp(1662): Value of string option 'split_file_input': 0
TOPPBase.cpp(1662): Value of string option 'use_elution_model_score': 0
TOPPBase.cpp(1662): Value of string option 'force': 1
TOPPBase.cpp(1662): Value of string option 'pasef': 0
TOPPBase.cpp(1662): Value of string option 'sort_swath_maps': 0
TOPPBase.cpp(1662): Value of string option 'enable_ms1': true
TOPPBase.cpp(1662): Value of string option 'enable_ipf': true
TOPPBase.cpp(1662): Value of int option 'batchSize': 1000
TOPPBase.cpp(1662): Value of int option 'outer_loop_threads': -1
TOPPBase.cpp(1662): Value of int option 'ms1_isotopes': 3
TOPPBase.cpp(1662): Value of int option 'debug': 1
TOPPBase.cpp(1662): Value of double option 'min_rsq': 0.95
TOPPBase.cpp(1662): Value of double option 'min_coverage': 0.6
TOPPBase.cpp(1662): Value of string option 'readOptions': cacheWorkingInMemory
TOPPBase.cpp(1662): Value of string option 'mz_correction_function': quadratic_regression_delta_ppm
TOPPBase.cpp(1662): Value of string option 'tempDirectory': /data/tmp/
TOPPBase.cpp(1662): Value of double option 'min_upper_edge_dist': 1.0
TOPPBase.cpp(1662): Value of string option 'use_ms1_ion_mobility': false
TOPPBase.cpp(1662): Value of string option 'matching_window_only': false
TOPPBase.cpp(1662): Value of double option 'mz_extraction_window': 20.0
TOPPBase.cpp(1662): Value of string option 'mz_extraction_window_unit': ppm
TOPPBase.cpp(1662): Value of double option 'rt_extraction_window': 300.0
TOPPBase.cpp(1662): Value of double option 'ion_mobility_window': -1.0
TOPPBase.cpp(1662): Value of string option 'extraction_function': tophat
TOPPBase.cpp(1662): Value of double option 'extra_rt_extraction_window': 0.0
TOPPBase.cpp(1662): Value of double option 'irt_mz_extraction_window': 40.0
TOPPBase.cpp(1662): Value of double option 'irt_im_extraction_window': -1.0
TOPPBase.cpp(1662): Value of string option 'irt_mz_extraction_window_unit': ppm
TOPPBase.cpp(1662): Value of double option 'mz_extraction_window_ms1': 20.0
TOPPBase.cpp(1662): Value of string option 'mz_extraction_window_ms1_unit': ppm
TOPPBase.cpp(1662): Value of string option 'use_ms1_ion_mobility': false

Log

MRMTransitionGroupPicker.h(214): **** Creating MRMFeature for peak 0 in chrom. 0 with POS: 809.17 INT: 112815 and borders 805.843 817.14 (11.2979)
MRMTransitionGroupPicker.h(979):  * peak 0 left boundary 805.843 with inty 397496
MRMTransitionGroupPicker.h(980):  * peak 0 right boundary 817.14 with inty 397496
MRMTransitionGroupPicker.h(979):  * peak 1 left boundary 803.017 with inty 8280.83
MRMTransitionGroupPicker.h(980):  * peak 1 right boundary 825.609 with inty 8280.83
MRMTransitionGroupPicker.h(1008):  - Recalculating right peak boundaries 821.375 mean / best 817.14 std 4.23444 : 1 coefficient of variation
MRMTransitionGroupPicker.h(1016):  - CV too large: correcting right boundary to  825.609
MRMTransitionGroupPicker.h(1025):  - Recalculating left peak boundaries 804.43 mean / best 805.843 std 1.41281 : 1 coefficient of variation
MRMTransitionGroupPicker.h(1033):  - CV too large: correcting left boundary to  805.843
MRMTransitionGroupPicker.h(735):  ** Removed 2 peaks enclosed in and 0 peaks overlapping with added feature.
MRMTransitionGroupPicker.h(153): **** No more peaks left. Nr. chroms: 6
MRMFeatureFinderScoring.cpp(607): Scoring feature RT: 873.494 MZ: 0 INT: 1.59159e+07 == 13136 [ expected RT 9.69507 / 915.457 ] with 6 transitions and 6 chromatograms

---------------------------------------------------
FATAL: uncaught exception!
---------------------------------------------------
last entry in the exception handler: 
exception of type MissingInformation occurred in line 82, function void OpenMS::DIAHelpers::integrateWindow_(const SpectrumPtr&, double&, double&, double&, const OpenMS::RangeMZ&, const OpenMS::RangeMobility&, bool) of /code/OpenMS/src/openms/source/ANALYSIS/OPENSWATH/DIAHelper.cpp
error message: Cannot integrate with drift time if no drift time is available
---------------------------------------------------

Activity

  1. singjc commented on Mar 5, 2025

    @singjc
    ContributorAuthor

    @jcharkow, off quick glance, do you know why this would occur? Shouldn't the im_ranges and im related stuff be turned off if pasef is not set and the ion_mobility scoring is turned off?

  2. jcharkow commented on Mar 5, 2025

    @jcharkow
    Collaborator

    Sorry, at quick glance I am not sure.

    Some possibilities:

    1. If there are IM values in the library IM might be turned on
    2. If IM extraction window is set, that might be causing the error

    PASEF flag should be unrelated, I don't think it is passed this far down in the workflow. Also I the error is occurring when intensity of the feature is computed so I don't think it would be related to IM scores either.

    Can you post the run command?

  3. singjc commented on Mar 5, 2025

    @singjc
    ContributorAuthor
    1. If there are IM values in the library IM might be turned on

    Looking at the library, there is no IM information, so probably rules out that.

    sqlite> PRAGMA table_info(PRECURSOR);
    0|ID|INT|1||1
    1|TRAML_ID|TEXT|0||0
    2|GROUP_LABEL|TEXT|0||0
    3|PRECURSOR_MZ|REAL|1||0
    4|CHARGE|INT|0||0
    5|LIBRARY_INTENSITY|REAL|0||0
    6|LIBRARY_RT|REAL|0||0
    7|LIBRARY_DRIFT_TIME|REAL|0||0
    8|DECOY|INT|1||0
    
    sqlite> SELECT * FROM PRECURSOR LIMIT 5;
    25430|23528||349.8222|3||9.1685426265|-1.0|0 # DRIFT_TIME column is -1.0
    4202|103779||352.1658|3||12.583124757|-1.0|0
    61296|55808||352.4963|3||12.913616018|-1.0|0
    4776|104295||352.5181|3||23.830034753|-1.0|0
    84259|76475||353.1579|3||20.236586244|-1.0|0
    
    1. If IM extraction window is set, that might be causing the error

    I don't set the IM extraction windows either 🤔

    apptainer run -B $cache:/data osw.simg OpenSwathWorkflow \
    -in /data/input/$(basename $file) \
    -tr /data/input/$(basename $library) \
    -tr_irt /data/input/$(basename $irt_linear_lib) \
    -tr_irt_nonlinear /data/input/$(basename $irt_nonlinear_lib) \
    -enable_ms1 true \
    -enable_ipf true \
    -force \
    -use_ms1_ion_mobility false \ # I have to explicitly set to false, otherwise it defaults to true
    -out_features /data/${file_cache%.*}.osw \
    -out_chrom /data/${file_cache%.*}.sqMass \
    -rt_extraction_window 300 \
    -mz_extraction_window 20 \
    -mz_extraction_window_unit ppm \
    -mz_extraction_window_ms1 20 \
    -mz_extraction_window_ms1_unit ppm \
    -irt_mz_extraction_window_unit ppm \
    -irt_mz_extraction_window 40 \
    -min_coverage 0.6 \
    -min_rsq 0.95 \
    -min_upper_edge_dist 1 \
    -ms1_isotopes 3 \
    -readOptions cacheWorkingInMemory \
    -mz_correction_function quadratic_regression_delta_ppm \
    -tempDirectory /data/tmp/ \
    -Debugging:irt_trafo /data/${file_cache%.*}_debug_irt.trafoXML \
    -Debugging:irt_mzml /data/${file_cache%.*}_debug_irt_chrom.mzML \
    -Calibration:debug_mz_file /data/${file_cache%.*}_debug_mz.txt \
    -log /data/${file_cache%.*}.log \
    -debug 10 \
    -threads $threads \
    -RTNormalization:alignmentMethod lowess \
    -RTNormalization:NrRTBins 6 \
    -RTNormalization:MinBinsFilled 4 \
    -RTNormalization:lowess:span 0.01 \
    -Scoring:stop_report_after_feature 5 \
    -Scoring:TransitionGroupPicker:PeakPickerChromatogram:sgolay_frame_length 11 \
    -Scoring:uis_threshold_sn -1 \
    -Scoring:Scores:use_uis_scores
    

    PASEF flag should be unrelated, I don't think it is passed this far down in the workflow. Also I the error is occurring when intensity of the feature is computed so I don't think it would be related to IM scores either.

    Yeah it's occurring during scoring, I think it's most likely during the DIAScoring

  4. timosachsenberg commented on Mar 5, 2025

    @timosachsenberg
    Contributor

    Let's if AI is helpful:

    Based on my analysis of the OpenSwathWorkflow code, I've identified the issue with drift time integration for regular DIA (non-ion mobility) data.

    The Issue
    The problem occurs in the DIAScoring process during the OpenSwathWorkflow execution. Even when ion mobility parameters are turned off, the code is still passing a RangeMobility object to various scoring functions that handle drift time.

    Key findings:
    In OpenSwathScoring.cpp, the calculateDIAScores function takes a RangeMobility& im_range parameter that is passed to various scoring functions, including:

    diascoring.dia_massdiff_score
    diascoring.score_with_isotopes
    diascoring.dia_isotope_scores
    For MS1 scoring, there's a check that correctly creates an empty RangeMobility object when ion mobility is disabled:

    RangeMobility im_range_ms1;
    if (use_ms1_ion_mobility_)
    {
    im_range_ms1 = im_range;
    }
    else // do not extract across IM in MS1
    {
    im_range_ms1 = RangeMobility();
    }
    However, for MS2 scoring, there's no similar check. The im_range parameter is passed directly to the scoring functions regardless of whether ion mobility is enabled.

    In OpenSwathWorkflow.cpp, when calling scoreAllChromatograms_, the im_range parameter is passed from the extraction process, but there's no check to ensure it's empty when ion mobility is disabled.

    The Root Cause
    The root cause is that when ion mobility is disabled, a non-empty RangeMobility object is still being passed to the DIAScoring functions. This causes the scoring functions to attempt to filter spectra by drift time, even though this shouldn't happen for regular DIA data.

    The issue is likely in the OpenSwathWorkflow::scoreAllChromatograms_ function, where the im_range parameter is not properly initialized as empty when ion mobility is disabled.

    Solution
    The solution would be to ensure that when ion mobility is disabled, an empty RangeMobility object is passed to the DIAScoring functions. This could be done by:

    Adding a check in OpenSwathWorkflow::scoreAllChromatograms_ to create an empty RangeMobility object when ion mobility is disabled.

    Or, modifying the fetchSpectrumSwath function in OpenSwathScoring.cpp to ignore the im_range parameter when ion mobility is disabled.

    Alternatively, adding a check in each DIAScoring function to ignore the im_range parameter when it's not empty but ion mobility is disabled.

    The most straightforward fix would be to add a check in OpenSwathWorkflow::scoreAllChromatograms_ similar to the one for MS1 scoring, to ensure that an empty RangeMobility object is used when ion mobility is disabled.

  5. singjc commented on Mar 5, 2025

    @singjc
    ContributorAuthor

    Kind of close, the error seems to stem from the MRMFeatureFinderScoring::scoreIdentification_ method, the im_range seems to be set in MRMFeatureFinderScoring.cpp#L319-L328. Even though the there is no drift time set in the library, it still gets set to a value of -1 to -1, so im_range ends up not being empty, which is why it tries to integrate the drift time as well.

    I am wondering why we don't pass the same im_range that is used by the regular/detecting DIA scores to scoreIdentification_ (MRMFeatureFinderScoring.cpp#L732-L775)? @jcharkow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions