Skip to content

Commit

Permalink
- added ignoreScheduledLimitsForChromatograms flag for telling pwiz t…
Browse files Browse the repository at this point in the history
…o try to get SIM/SRM chromatograms from the entire time range instead of within the scheduled limits; works around a bug(?) with Sciex WIFF where it records the wrong scheduled limits but the data is actually there if you tell it to ignore the limits (reported by Phillip and Celeste)
  • Loading branch information
chambm committed May 15, 2023
1 parent 45ae8f2 commit 64ac83d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 22 deletions.
2 changes: 2 additions & 0 deletions pwiz/data/msdata/Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Reader::Config::Config()
, sortAndJitter(false)
, globalChromatogramsAreMs1Only(false)
, ddaProcessing(false)
, ignoreScheduledLimitsForChromatograms(false)
{
}

Expand All @@ -74,6 +75,7 @@ Reader::Config::Config(const Config& rhs)
isolationMzAndMobilityFilter = rhs.isolationMzAndMobilityFilter;
sortAndJitter = rhs.sortAndJitter;
globalChromatogramsAreMs1Only = rhs.globalChromatogramsAreMs1Only;
ignoreScheduledLimitsForChromatograms = rhs.ignoreScheduledLimitsForChromatograms;
}

// default implementation; most Readers don't need to worry about multi-run input files
Expand Down
4 changes: 4 additions & 0 deletions pwiz/data/msdata/Reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ class PWIZ_API_DECL Reader
// to the same precursor from the same survey scan, and lockmass-correcting the precursor mass (if the lockmass refiner is active).
bool ddaProcessing;

/// when true, scheduled SIM/SRM chromatograms will try to get an XIC covering the entire range instead of just the scheduled range
/// (useful if the instrument recorded extra data outside the scheduled limits, currently only applicable to Sciex WIFF)
bool ignoreScheduledLimitsForChromatograms;

Config();
Config(const Config& rhs);
};
Expand Down
4 changes: 2 additions & 2 deletions pwiz/data/vendor_readers/ABI/ChromatogramList_ABI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ PWIZ_API_DECL ChromatogramPtr ChromatogramList_ABI::chromatogram(size_t index, D
result->setTimeIntensityArrays(std::vector<double>(), std::vector<double>(), UO_minute, MS_number_of_detector_counts);

pwiz::util::BinaryData<double> times, intensities;
experiment->getSIC(ie.transition, times, intensities);
experiment->getSIC(ie.transition, times, intensities, config_.ignoreScheduledLimitsForChromatograms);
result->defaultArrayLength = times.size();

if (getBinaryData)
Expand Down Expand Up @@ -290,7 +290,7 @@ PWIZ_API_DECL ChromatogramPtr ChromatogramList_ABI::chromatogram(size_t index, D
result->setTimeIntensityArrays(std::vector<double>(), std::vector<double>(), UO_minute, MS_number_of_detector_counts);

pwiz::util::BinaryData<double> times, intensities;
experiment->getSIC(ie.transition, times, intensities);
experiment->getSIC(ie.transition, times, intensities, config_.ignoreScheduledLimitsForChromatograms);
result->defaultArrayLength = times.size();

if (getBinaryData)
Expand Down
18 changes: 12 additions & 6 deletions pwiz_aux/msrc/utility/vendor_api/ABI/WiffFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ struct ExperimentImpl : public Experiment
virtual size_t getSRMSize() const;
virtual void getSRM(size_t index, Target& target) const;

virtual double getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities) const;
virtual double getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities, bool ignoreScheduledLimits) const;
virtual void getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities,
double& basePeakX, double& basePeakY) const;
double& basePeakX, double& basePeakY, bool ignoreScheduledLimits) const;

virtual void getAcquisitionMassRange(double& startMz, double& stopMz) const;
virtual ScanType getScanType() const;
Expand Down Expand Up @@ -609,7 +609,7 @@ void ExperimentImpl::getSRM(size_t index, Target& target) const
CATCH_AND_FORWARD
}

double ExperimentImpl::getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities) const
double ExperimentImpl::getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities, bool ignoreScheduledLimits) const
{
try
{
Expand All @@ -620,7 +620,13 @@ double ExperimentImpl::getSIC(size_t index, pwiz::util::BinaryData<double>& time
getSRM(index, target);

ExtractedIonChromatogramSettings^ option = gcnew ExtractedIonChromatogramSettings(index);
if (target.startTime != target.endTime)
if (ignoreScheduledLimits)
{
option->StartCycle = 0;
option->EndCycle = convertRetentionTimeToCycle(cycleTimes().back());
option->UseStartEndCycle = true;
}
else if (target.startTime != target.endTime)
{
option->StartCycle = convertRetentionTimeToCycle(target.startTime);
option->EndCycle = convertRetentionTimeToCycle(target.endTime);
Expand All @@ -636,9 +642,9 @@ double ExperimentImpl::getSIC(size_t index, pwiz::util::BinaryData<double>& time
}

void ExperimentImpl::getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities,
double& basePeakX, double& basePeakY) const
double& basePeakX, double& basePeakY, bool ignoreScheduledLimits) const
{
basePeakY = getSIC(index, times, intensities);
basePeakY = getSIC(index, times, intensities, ignoreScheduledLimits);

try
{
Expand Down
4 changes: 2 additions & 2 deletions pwiz_aux/msrc/utility/vendor_api/ABI/WiffFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ struct PWIZ_API_DECL Experiment

virtual size_t getSRMSize() const = 0;
virtual void getSRM(size_t index, Target& target) const = 0;
virtual double getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities) const = 0;
virtual double getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities, bool ignoreScheduledLimits) const = 0;
virtual void getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities,
double& basePeakX, double& basePeakY) const = 0;
double& basePeakX, double& basePeakY, bool ignoreScheduledLimits) const = 0;

virtual void getAcquisitionMassRange(double& startMz, double& stopMz) const = 0;
virtual ScanType getScanType() const = 0;
Expand Down
10 changes: 5 additions & 5 deletions pwiz_aux/msrc/utility/vendor_api/ABI/WiffFile2.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ struct Experiment2Impl : public Experiment
virtual size_t getSRMSize() const;
virtual void getSRM(size_t index, Target& target) const;

virtual double getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities) const;
virtual double getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities, bool ignoreScheduledLimits) const;
virtual void getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities,
double& basePeakX, double& basePeakY) const;
double& basePeakX, double& basePeakY, bool ignoreScheduledLimits) const;

virtual void getAcquisitionMassRange(double& startMz, double& stopMz) const;
virtual ScanType getScanType() const;
Expand Down Expand Up @@ -568,15 +568,15 @@ void Experiment2Impl::getSRM(size_t index, Target& target) const
CATCH_AND_FORWARD
}

double Experiment2Impl::getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities) const
double Experiment2Impl::getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities, bool ignoreScheduledLimits) const
{
double x, y;
getSIC(index, times, intensities, x, y);
getSIC(index, times, intensities, x, y, ignoreScheduledLimits);
return y;
}

void Experiment2Impl::getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities,
double& basePeakX, double& basePeakY) const
double& basePeakX, double& basePeakY, bool ignoreScheduledLimits) const
{
try
{
Expand Down
10 changes: 3 additions & 7 deletions pwiz_tools/commandline/msconvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,8 @@ struct Config : public Reader::Config
Config()
: outputPath("."), verbose(false), merge(false)
{
simAsSpectra = false;
srmAsSpectra = false;
combineIonMobilitySpectra = false;
ignoreCalibrationScans = false;
reportSonarBins = false;
unknownInstrumentIsError = true;
stripLocationFromSourceFiles = false;
stripVersionFromSoftware = false;
ddaProcessing = false;
}

string outputFilename(const string& inputFilename, const MSData& inputMSData) const;
Expand Down Expand Up @@ -344,6 +337,9 @@ Config parseCommandLine(int argc, char** argv)
("ignoreCalibrationScans",
po::value<bool>(&config.ignoreCalibrationScans)->zero_tokens(),
": do not process calibration scans (currently only applies to Waters lockmass function)")
("ignoreScheduledLimitsForChromatograms",
po::value<bool>(&config.ignoreScheduledLimitsForChromatograms)->zero_tokens(),
": scheduled SIM/SRM chromatograms will try to get an XIC covering the entire run time instead of just the scheduled limits")
("acceptZeroLengthSpectra",
po::value<bool>(&config.acceptZeroLengthSpectra)->zero_tokens(),
": some vendor readers have an efficient way of filtering out empty spectra, but it takes more time to open the file")
Expand Down

0 comments on commit 64ac83d

Please sign in to comment.