Skip to content

Add ignoreRtCorrection support in measurement loading#648

Merged
YukiMatsuzawa merged 1 commit intomasterfrom
bugfix/rt-correction-chromatograms-tab
Oct 21, 2025
Merged

Add ignoreRtCorrection support in measurement loading#648
YukiMatsuzawa merged 1 commit intomasterfrom
bugfix/rt-correction-chromatograms-tab

Conversation

@YukiMatsuzawa
Copy link
Copy Markdown
Contributor

Add ignoreRtCorrection support in measurement loading

  • Modified LoadMeasurementAsync to accept ignoreRtCorrection parameter.
  • Added new constructor in StandardDataProvider for ignoreRtCorrection.
  • Updated StandardDataProviderFactory to include IgnoreRtCorrection property.
  • Set IgnoreRtCorrection to true in RtCorrectionProcessModelLegacy for parallel processing.
  • Enhanced documentation for StandardDataProvider constructors.

- Modified LoadMeasurementAsync to accept ignoreRtCorrection parameter.
- Added new constructor in StandardDataProvider for ignoreRtCorrection.
- Updated StandardDataProviderFactory to include IgnoreRtCorrection property.
- Set IgnoreRtCorrection to true in RtCorrectionProcessModelLegacy for parallel processing.
- Enhanced documentation for StandardDataProvider constructors.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for ignoring retention time (RT) correction during measurement loading, primarily to enable parallel processing in the RT correction workflow. The key change allows the RT correction process to load raw data without applying existing RT corrections, preventing corruption when multiple threads process files simultaneously.

Key Changes:

  • Added ignoreRtCorrection parameter to the measurement loading pipeline
  • Introduced a new property and constructor to control RT correction behavior in StandardDataProvider
  • Configured parallel RT correction processing to ignore existing RT corrections

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
RtCorrectionProcessModelLegacy.cs Sets IgnoreRtCorrection = true when creating data providers for parallel RT correction processing
StandardDataProvider.cs Adds new constructor and factory property to support the ignoreRtCorrection parameter
BaseDataProvider.cs Modifies LoadMeasurementAsync to conditionally apply RT correction based on the new parameter

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

protected static async Task<RawMeasurement> LoadMeasurementAsync(AnalysisFileBean file, bool isProfile, bool isImagingMs, bool isGuiProcess, int retry, CancellationToken token) {
using (var access = new RawDataAccess(file.AnalysisFilePath, 0, isProfile, isImagingMs, isGuiProcess, file.RetentionTimeCorrectionBean.PredictedRt)) {
protected static async Task<RawMeasurement> LoadMeasurementAsync(AnalysisFileBean file, bool isProfile, bool isImagingMs, bool isGuiProcess, int retry, bool ignoreRtCorrection, CancellationToken token) {
List<double> correctedRts = ignoreRtCorrection ? null : file.RetentionTimeCorrectionBean.PredictedRt;
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a conditional access operator for safer null handling. If file.RetentionTimeCorrectionBean or PredictedRt could be null, this could throw a NullReferenceException. The logic should handle the case where RT correction data might not exist: List<double> correctedRts = ignoreRtCorrection ? null : file.RetentionTimeCorrectionBean?.PredictedRt;

Suggested change
List<double> correctedRts = ignoreRtCorrection ? null : file.RetentionTimeCorrectionBean.PredictedRt;
List<double> correctedRts = ignoreRtCorrection ? null : file.RetentionTimeCorrectionBean?.PredictedRt;

Copilot uses AI. Check for mistakes.
private readonly int retry = 5;

/// <summary>
/// Whether to ignore RT correction when reading raw spectra.
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The documentation comment uses 'RT' abbreviation while the property name uses the full 'RtCorrection'. For consistency, consider expanding 'RT' to 'retention time' in the comment: 'Whether to ignore retention time correction when reading raw spectra.'

Suggested change
/// Whether to ignore RT correction when reading raw spectra.
/// Whether to ignore retention time correction when reading raw spectra.

Copilot uses AI. Check for mistakes.
@YukiMatsuzawa YukiMatsuzawa merged commit 85e8ae3 into master Oct 21, 2025
5 checks passed
@YukiMatsuzawa YukiMatsuzawa deleted the bugfix/rt-correction-chromatograms-tab branch October 21, 2025 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants