Skip to content

Commit

Permalink
- added start/end cycle override for SIM/SRM XICs from WIFF
Browse files Browse the repository at this point in the history
  • Loading branch information
chambm committed May 15, 2023
1 parent e93647c commit 45ae8f2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
28 changes: 15 additions & 13 deletions pwiz_aux/msrc/utility/vendor_api/ABI/WiffFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ struct ExperimentImpl : public Experiment
virtual size_t getSRMSize() const;
virtual void getSRM(size_t index, Target& target) const;

virtual void 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) const;
virtual void getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities,
double& basePeakX, double& basePeakY) const;

Expand Down Expand Up @@ -609,14 +609,24 @@ void ExperimentImpl::getSRM(size_t index, Target& target) const
CATCH_AND_FORWARD
}

void 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) const
{
try
{
if (index >= transitionCount+simCount)
throw std::out_of_range("[Experiment::getSIC()] index out of range");
throw std::out_of_range("[Experiment::getSIC()] index " + lexical_cast<string>(index) + " out of range");

Target target;
getSRM(index, target);

ExtractedIonChromatogramSettings^ option = gcnew ExtractedIonChromatogramSettings(index);
if (target.startTime != target.endTime)
{
option->StartCycle = convertRetentionTimeToCycle(target.startTime);
option->EndCycle = convertRetentionTimeToCycle(target.endTime);
option->UseStartEndCycle = true;
}

ExtractedIonChromatogram^ xic = msExperiment->GetExtractedIonChromatogram(option);

ToBinaryData(xic->GetActualXValues(), times);
Expand All @@ -628,18 +638,10 @@ void ExperimentImpl::getSIC(size_t index, pwiz::util::BinaryData<double>& times,
void ExperimentImpl::getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities,
double& basePeakX, double& basePeakY) const
{
basePeakY = getSIC(index, times, intensities);

try
{
if (index >= transitionCount)
throw std::out_of_range("[Experiment::getSIC()] index " + lexical_cast<string>(index) + " out of range");

ExtractedIonChromatogramSettings^ option = gcnew ExtractedIonChromatogramSettings(index);
ExtractedIonChromatogram^ xic = msExperiment->GetExtractedIonChromatogram(option);

ToBinaryData(xic->GetActualXValues(), times);
ToBinaryData(xic->GetActualYValues(), intensities);

basePeakY = xic->MaximumYValue;
basePeakX = 0;
for (size_t i=0; i < intensities.size(); ++i)
if (intensities[i] == basePeakY)
Expand Down
2 changes: 1 addition & 1 deletion pwiz_aux/msrc/utility/vendor_api/ABI/WiffFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ struct PWIZ_API_DECL Experiment

virtual size_t getSRMSize() const = 0;
virtual void getSRM(size_t index, Target& target) const = 0;
virtual void 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) const = 0;
virtual void getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities,
double& basePeakX, double& basePeakY) const = 0;

Expand Down
5 changes: 3 additions & 2 deletions pwiz_aux/msrc/utility/vendor_api/ABI/WiffFile2.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ struct Experiment2Impl : public Experiment
virtual size_t getSRMSize() const;
virtual void getSRM(size_t index, Target& target) const;

virtual void 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) const;
virtual void getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities,
double& basePeakX, double& basePeakY) const;

Expand Down Expand Up @@ -568,10 +568,11 @@ void Experiment2Impl::getSRM(size_t index, Target& target) const
CATCH_AND_FORWARD
}

void 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) const
{
double x, y;
getSIC(index, times, intensities, x, y);
return y;
}

void Experiment2Impl::getSIC(size_t index, pwiz::util::BinaryData<double>& times, pwiz::util::BinaryData<double>& intensities,
Expand Down

0 comments on commit 45ae8f2

Please sign in to comment.