ProteoWizard
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DemuxHelpersTest Class Reference

Public Member Functions

void Run ()
 

Protected Member Functions

virtual void SetUp ()
 
void TearDown ()
 
void TryGetScanIDTokenTest ()
 
void initializeLarge (MSData &msd, size_t cycleSize=4, size_t numCycles=5)
 
void TryGetDemuxIndexTest ()
 
void TryGetOriginalIndexTest ()
 
void TryGetMSLevelTest ()
 
void TryGetNumPrecursorsTest ()
 
void TryGetStartTimeTest ()
 
void FindNearbySpectraTest ()
 

Protected Attributes

const size_t MS1_INDEX_0 = 0
 
const size_t MS2_INDEX_0 = 1
 
const size_t MS1_INDEX_1 = 2
 
const size_t MS2_INDEX_1 = 3
 
MSData _msd
 
Spectrum_const_ptr _s10
 
Spectrum_const_ptr _s20
 
Spectrum_const_ptr _s11
 
Spectrum_const_ptr _s21
 

Detailed Description

Definition at line 30 of file DemuxHelpersTest.cpp.

Member Function Documentation

◆ Run()

void DemuxHelpersTest::Run ( )
inline

◆ SetUp()

virtual void DemuxHelpersTest::SetUp ( )
inlineprotectedvirtual

Definition at line 48 of file DemuxHelpersTest.cpp.

49 {
50 // Generate test data
52
53 auto spectrumListPtr = _msd.run.spectrumListPtr;
54
55 _s10 = spectrumListPtr->spectrum(MS1_INDEX_0, true);
56 _s20 = spectrumListPtr->spectrum(MS2_INDEX_0, true);
57 _s11 = spectrumListPtr->spectrum(MS1_INDEX_1, true);
58 _s21 = spectrumListPtr->spectrum(MS2_INDEX_1, true);
59 }
Spectrum_const_ptr _s20
Spectrum_const_ptr _s21
Spectrum_const_ptr _s10
Spectrum_const_ptr _s11
PWIZ_API_DECL void initializeTiny(MSData &msd)
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
Definition MSData.hpp:886
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here....
Definition MSData.hpp:827

References _msd, _s10, _s11, _s20, _s21, pwiz::msdata::examples::initializeTiny(), MS1_INDEX_0, MS1_INDEX_1, MS2_INDEX_0, MS2_INDEX_1, pwiz::msdata::MSData::run, and pwiz::msdata::Run::spectrumListPtr.

Referenced by Run().

◆ TearDown()

void DemuxHelpersTest::TearDown ( )
inlineprotected

Definition at line 61 of file DemuxHelpersTest.cpp.

62 {
63 }

Referenced by Run().

◆ TryGetScanIDTokenTest()

void DemuxHelpersTest::TryGetScanIDTokenTest ( )
inlineprotected

Definition at line 65 of file DemuxHelpersTest.cpp.

66 {
67 string value;
68 bool success;
69 success = TryGetScanIDToken(*_s10, "blah", value);
70 unit_assert(!success);
71 success = TryGetScanIDToken(*_s10, "scan", value);
72 unit_assert(success);
73 unit_assert(boost::iequals(value, "19"));
74 }
bool TryGetScanIDToken(const msdata::SpectrumIdentity &spectrumIdentity, const std::string &tokenName, std::string &value)
Tries to read the given token from a spectrum identity id.
PWIZ_API_DECL std::string value(const std::string &id, const std::string &name)
convenience function to extract a named value from an id string
#define unit_assert(x)
Definition unit.hpp:85

References _s10, pwiz::analysis::TryGetScanIDToken(), and unit_assert.

Referenced by Run().

◆ initializeLarge()

void DemuxHelpersTest::initializeLarge ( MSData msd,
size_t  cycleSize = 4,
size_t  numCycles = 5 
)
inlineprotected

Definition at line 76 of file DemuxHelpersTest.cpp.

77 {
78 // Use initializeTiny as base and overwrite the spectrumList
80
81 // Pull pointers from existing spectra
82 shared_ptr<SpectrumListSimple> spectrumListPtr = boost::dynamic_pointer_cast<SpectrumListSimple>(msd.run.spectrumListPtr);
83 if (!spectrumListPtr)
84 throw std::runtime_error("initializeLarge() spectrumList from initializeTiny was not of the expected type");
85
86 auto dppwiz = spectrumListPtr->dp;
87
88 auto pg1 = spectrumListPtr->spectra[0]->paramGroupPtrs[0];
89 auto pg2 = spectrumListPtr->spectra[1]->paramGroupPtrs[0];
90
91 auto instrumentConfigurationPtr = spectrumListPtr->spectra[0]->scanList.scans.back().instrumentConfigurationPtr;
92
93 auto dpCompassXtract = spectrumListPtr->spectra[0]->binaryDataArrayPtrs[0]->dataProcessingPtr;
94
95 // Clear spectra
96 spectrumListPtr->spectra.clear();
97
98 size_t scanNum = 0;
99 for (size_t cycleIndex = 0; cycleIndex < numCycles; ++cycleIndex)
100 {
101 // Add MS1 spectrum first
102 spectrumListPtr->spectra.push_back(SpectrumPtr(new Spectrum));
103 Spectrum& ms1 = *spectrumListPtr->spectra[scanNum];
104 boost::format scanfmt("scan=%1%");
105 scanfmt % scanNum;
106 ms1.id = scanfmt.str();
107 ms1.index = scanNum;
108
109 ms1.set(MS_ms_level, 1);
110
112 ms1.set(MS_lowest_observed_m_z, 400.39, MS_m_z);
113 ms1.set(MS_highest_observed_m_z, 1795.56, MS_m_z);
114 ms1.set(MS_base_peak_m_z, 445.347, MS_m_z);
116 ms1.set(MS_total_ion_current, 1.66755e+007);
117
118 ms1.paramGroupPtrs.push_back(pg1);
119 ms1.scanList.scans.push_back(Scan());
121 Scan& ms1scan = ms1.scanList.scans.back();
122 ms1scan.instrumentConfigurationPtr = instrumentConfigurationPtr;
123 ms1scan.set(MS_scan_start_time, 5.890500, UO_minute);
124 ms1scan.set(MS_filter_string, "+ c NSI Full ms [ 400.00-1800.00]");
125 ms1scan.set(MS_preset_scan_configuration, 3);
126 ms1scan.scanWindows.resize(1);
127 ScanWindow& window = ms1.scanList.scans.back().scanWindows.front();
128 window.set(MS_scan_window_lower_limit, 400.000000, MS_m_z);
129 window.set(MS_scan_window_upper_limit, 1800.000000, MS_m_z);
130
132 ms1_mz->dataProcessingPtr = dpCompassXtract;
133 ms1_mz->set(MS_m_z_array, "", MS_m_z);
134 ms1_mz->data.resize(15);
135 for (int i = 0; i < 15; i++)
136 ms1_mz->data[i] = i;
137
138 BinaryDataArrayPtr ms1_intensity(new BinaryDataArray);
139 ms1_intensity->dataProcessingPtr = dpCompassXtract;
140 ms1_intensity->set(MS_intensity_array, "", MS_number_of_detector_counts);
141 ms1_intensity->data.resize(15);
142 for (int i = 0; i < 15; i++)
143 ms1_intensity->data[i] = 15 - i;
144
145 ms1.binaryDataArrayPtrs.push_back(ms1_mz);
146 ms1.binaryDataArrayPtrs.push_back(ms1_intensity);
147 ms1.defaultArrayLength = ms1_mz->data.size();
148
149 // Increment scan index
150 ++scanNum;
151
152 // Add MS2 spectra
153 for (size_t ms2Index = 0; ms2Index < cycleSize; ++ms2Index)
154 {
155 spectrumListPtr->spectra.push_back(SpectrumPtr(new Spectrum));
156 Spectrum& ms2 = *spectrumListPtr->spectra[scanNum];
157
158 // Fill in MS2 data
159 boost::format scanfmt("scan=%1%");
160 scanfmt % scanNum;
161 ms2.id = scanfmt.str();
162 ms2.index = 1;
163
164 ms2.paramGroupPtrs.push_back(pg2);
165 ms2.set(MS_ms_level, 2);
166
168 ms2.set(MS_lowest_observed_m_z, 320.39, MS_m_z);
169 ms2.set(MS_highest_observed_m_z, 1003.56, MS_m_z);
170 ms2.set(MS_base_peak_m_z, 456.347, MS_m_z);
172 ms2.set(MS_total_ion_current, 1.66755e+007);
173
174 ms2.precursors.resize(1);
175 Precursor& precursor = ms2.precursors.front();
176 precursor.spectrumID = ms1.id;
180 precursor.selectedIons.resize(1);
181 precursor.selectedIons[0].set(MS_selected_ion_m_z, 445.34, MS_m_z);
183 precursor.selectedIons[0].set(MS_charge_state, 2);
186
187 ms2.scanList.scans.push_back(Scan());
189 Scan& ms2scan = ms2.scanList.scans.back();
190 ms2scan.instrumentConfigurationPtr = instrumentConfigurationPtr;
191 ms2scan.set(MS_scan_start_time, 5.990500, UO_minute);
192 ms2scan.set(MS_filter_string, "+ c d Full ms2 445.35@cid35.00 [ 110.00-905.00]");
193 ms2scan.set(MS_preset_scan_configuration, 4);
194 ms2scan.scanWindows.resize(1);
195 ScanWindow& window2 = ms2scan.scanWindows.front();
196 window2.set(MS_scan_window_lower_limit, 110.000000, MS_m_z);
197 window2.set(MS_scan_window_upper_limit, 905.000000, MS_m_z);
198
200 ms2_mz->dataProcessingPtr = dpCompassXtract;
201 ms2_mz->set(MS_m_z_array, "", MS_m_z);
202 ms2_mz->data.resize(10);
203 for (int i = 0; i < 10; i++)
204 ms2_mz->data[i] = i * 2;
205
206 BinaryDataArrayPtr ms2_intensity(new BinaryDataArray);
207 ms2_intensity->dataProcessingPtr = dpCompassXtract;
208 ms2_intensity->set(MS_intensity_array, "", MS_number_of_detector_counts);
209 ms2_intensity->data.resize(10);
210 for (int i = 0; i < 10; i++)
211 ms2_intensity->data[i] = (10 - i) * 2;
212
213 ms2.binaryDataArrayPtrs.push_back(ms2_mz);
214 ms2.binaryDataArrayPtrs.push_back(ms2_intensity);
215 ms2.defaultArrayLength = ms2_mz->data.size();
216
217 // Increment scan index
218 ++scanNum;
219 }
220 }
221 }
MS_no_combination
no combination: Use this term if only one scan was recorded or there is no information about scans av...
Definition cv.hpp:3072
MS_intensity_array
intensity array: A data array of intensity values.
Definition cv.hpp:2151
UO_minute
minute: A time unit which is equal to 60 seconds.
Definition cv.hpp:13896
MS_highest_observed_m_z
highest observed m/z: Highest m/z value observed in the m/z array.
Definition cv.hpp:2187
MS_scan_window_lower_limit
scan window lower limit: The upper m/z bound of a mass spectrometer scan window.
Definition cv.hpp:2109
MS_collision_induced_dissociation
collision-induced dissociation: The dissociation of an ion after collisional excitation....
Definition cv.hpp:747
UO_electronvolt
electronvolt: A non-SI unit of energy (eV) defined as the energy acquired by a single unbound electro...
Definition cv.hpp:14595
MS_lowest_observed_m_z
lowest observed m/z: Lowest m/z value observed in the m/z array.
Definition cv.hpp:2190
MS_scan_window_upper_limit
scan window upper limit: The lower m/z bound of a mass spectrometer scan window.
Definition cv.hpp:2106
MS_collision_energy
collision energy: Energy for an ion experiencing collision with a stationary gas particle resulting i...
Definition cv.hpp:411
MS_ms_level
ms level: Stages of ms achieved in a multi stage mass spectrometry experiment.
Definition cv.hpp:2139
MS_centroid_spectrum
centroid spectrum: Processing of profile data to produce spectra that contains discrete peaks of zero...
Definition cv.hpp:720
MS_profile_spectrum
profile spectrum: A profile mass spectrum is created when data is recorded with ion current (counts p...
Definition cv.hpp:726
MS_isolation_window_lower_offset
isolation window lower offset: The extent of the isolation window in m/z below the isolation window t...
Definition cv.hpp:3183
MS_m_z_array
m/z array: A data array of m/z values.
Definition cv.hpp:2148
MS_filter_string
filter string: A string unique to Thermo instrument describing instrument settings for the scan.
Definition cv.hpp:2142
MS_m_z
m/z: Three-character symbol m/z is used to denote the quantity formed by dividing the mass of an ion ...
Definition cv.hpp:384
MS_preset_scan_configuration
preset scan configuration: A user-defined scan configuration that specifies the instrumental settings...
Definition cv.hpp:2511
MS_charge_state
charge state: The charge state of the ion, single or multiple and positive or negatively charged.
Definition cv.hpp:396
MS_isolation_window_target_m_z
isolation window target m/z: The primary or reference m/z about which the isolation window is defined...
Definition cv.hpp:3180
MS_isolation_window_upper_offset
isolation window upper offset: The extent of the isolation window in m/z above the isolation window t...
Definition cv.hpp:3186
MS_total_ion_current
total ion current: The sum of all the separate ion currents carried by the ions of different m/z cont...
Definition cv.hpp:1407
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of an selected ion.
Definition cv.hpp:2901
MS_scan_start_time
scan start time: The time that an analyzer started a scan, relative to the start of the MS run.
Definition cv.hpp:309
MS_number_of_detector_counts
number of detector counts: The number of counted events observed in one or a group of elements of a d...
Definition cv.hpp:741
MS_base_peak_intensity
base peak intensity: The intensity of the greatest peak in the mass spectrum.
Definition cv.hpp:2121
MS_base_peak_m_z
base peak m/z: M/z value of the signal of highest intensity in the mass spectrum.
Definition cv.hpp:2118
MS_peak_intensity
peak intensity: Intensity of ions as measured by the height or area of a peak in a mass spectrum.
Definition cv.hpp:402
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition MSData.hpp:417
boost::shared_ptr< Spectrum > SpectrumPtr
Definition MSData.hpp:573
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition MSData.hpp:405
The method of precursor ion selection and activation.
Definition MSData.hpp:312
std::vector< SelectedIon > selectedIons
this list of precursor ions that were selected.
Definition MSData.hpp:329
IsolationWindow isolationWindow
this element captures the isolation (or 'selection') window configured to isolate one or more precurs...
Definition MSData.hpp:326
Activation activation
the type and energy level used for activation.
Definition MSData.hpp:332
std::string spectrumID
reference to the id attribute of the spectrum from which the precursor was selected.
Definition MSData.hpp:323
std::vector< Scan > scans
Definition MSData.hpp:397
The structure that captures the generation of a peak list (including the underlying acquisitions)
Definition MSData.hpp:506
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition MSData.hpp:508
ScanList scanList
list of scans
Definition MSData.hpp:517
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition MSData.hpp:526
std::vector< Precursor > precursors
list and descriptions of precursors to the spectrum currently being described.
Definition MSData.hpp:520
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
Definition MSData.hpp:476
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Definition MSData.hpp:473

References pwiz::msdata::Precursor::activation, pwiz::msdata::Spectrum::binaryDataArrayPtrs, pwiz::msdata::Spectrum::defaultArrayLength, pwiz::msdata::SpectrumIdentity::id, pwiz::msdata::SpectrumIdentity::index, pwiz::msdata::examples::initializeTiny(), pwiz::msdata::Precursor::isolationWindow, MS_base_peak_intensity, MS_base_peak_m_z, MS_centroid_spectrum, MS_charge_state, MS_collision_energy, MS_collision_induced_dissociation, MS_filter_string, MS_highest_observed_m_z, MS_intensity_array, MS_isolation_window_lower_offset, MS_isolation_window_target_m_z, MS_isolation_window_upper_offset, MS_lowest_observed_m_z, MS_m_z, MS_m_z_array, MS_ms_level, MS_no_combination, MS_number_of_detector_counts, MS_peak_intensity, MS_preset_scan_configuration, MS_profile_spectrum, MS_scan_start_time, MS_scan_window_lower_limit, MS_scan_window_upper_limit, MS_selected_ion_m_z, MS_total_ion_current, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::Spectrum::precursors, pwiz::msdata::MSData::run, pwiz::msdata::Spectrum::scanList, pwiz::msdata::ScanList::scans, pwiz::msdata::Precursor::selectedIons, pwiz::data::ParamContainer::set(), pwiz::msdata::Precursor::spectrumID, pwiz::msdata::Run::spectrumListPtr, UO_electronvolt, and UO_minute.

Referenced by FindNearbySpectraTest().

◆ TryGetDemuxIndexTest()

void DemuxHelpersTest::TryGetDemuxIndexTest ( )
inlineprotected

Definition at line 223 of file DemuxHelpersTest.cpp.

224 {
225 bool success;
226 size_t index = 0;
227 success = TryGetDemuxIndex(*_s10, index);
228 unit_assert(!success);
229 Spectrum emptySpectrum;
230 emptySpectrum.id = emptySpectrum.id + " demux=0";
231 success = TryGetDemuxIndex(emptySpectrum, index);
232 unit_assert(success);
234 }
bool TryGetDemuxIndex(const msdata::SpectrumIdentity &spectrumIdentity, size_t &index)
Tries to read the index of the demultiplexed spectrum relative to the multiplexed spectrum it was der...
#define unit_assert_operator_equal(expected, actual)
Definition unit.hpp:92

References _s10, pwiz::msdata::SpectrumIdentity::id, pwiz::analysis::TryGetDemuxIndex(), unit_assert, and unit_assert_operator_equal.

Referenced by Run().

◆ TryGetOriginalIndexTest()

void DemuxHelpersTest::TryGetOriginalIndexTest ( )
inlineprotected

Definition at line 236 of file DemuxHelpersTest.cpp.

237 {
238 bool success;
239 size_t index;
240 success = TryGetOriginalIndex(*_s10, index);
241 unit_assert(success);
243 Spectrum emptySpectrum;
244 success = TryGetOriginalIndex(emptySpectrum, index);
245 unit_assert(!success);
246 }
bool TryGetOriginalIndex(const msdata::SpectrumIdentity &spectrumIdentity, size_t &index)
Tries to read the original index of the spectrum before demultiplexing using the SpectrumIdentity of ...

References _s10, pwiz::analysis::TryGetOriginalIndex(), unit_assert, and unit_assert_operator_equal.

Referenced by Run().

◆ TryGetMSLevelTest()

void DemuxHelpersTest::TryGetMSLevelTest ( )
inlineprotected

Definition at line 248 of file DemuxHelpersTest.cpp.

249 {
250 Spectrum emptySpectrum;
251
252 int msLevel = 0;
253 bool success;
254 success = TryGetMSLevel(*_s10, msLevel);
255 unit_assert_operator_equal(msLevel, 1);
256 unit_assert(success);
257 success = TryGetMSLevel(*_s20, msLevel);
258 unit_assert(success);
259 unit_assert_operator_equal(msLevel, 2);
260 success = TryGetMSLevel(emptySpectrum, msLevel);
261 unit_assert(!success);
262 }
bool TryGetMSLevel(const msdata::Spectrum &spectrum, int &msLevel)
Tries to read MS level from spectrum.

References _s10, _s20, pwiz::analysis::TryGetMSLevel(), unit_assert, and unit_assert_operator_equal.

Referenced by Run().

◆ TryGetNumPrecursorsTest()

void DemuxHelpersTest::TryGetNumPrecursorsTest ( )
inlineprotected

Definition at line 264 of file DemuxHelpersTest.cpp.

265 {
266 bool success;
267 int numPrecursors;
268 Spectrum emptySpectrum;
269 success = TryGetNumPrecursors(emptySpectrum, numPrecursors);
270 unit_assert(!success);
271 success = TryGetNumPrecursors(*_s10, numPrecursors);
272 unit_assert(success);
273 unit_assert_operator_equal(numPrecursors, 0);
274 success = TryGetNumPrecursors(*_s20, numPrecursors);
275 unit_assert(success);
276 unit_assert_operator_equal(numPrecursors, 1);
277 }
bool TryGetNumPrecursors(const msdata::Spectrum &spectrum, int &numPrecursors)
Tries to get the number of precursors contributing to a multiplexed spectrum.

References _s10, _s20, pwiz::analysis::TryGetNumPrecursors(), unit_assert, and unit_assert_operator_equal.

Referenced by Run().

◆ TryGetStartTimeTest()

void DemuxHelpersTest::TryGetStartTimeTest ( )
inlineprotected

Definition at line 279 of file DemuxHelpersTest.cpp.

280 {
281 bool success;
282 double startTime;
283 success = TryGetStartTime(*_s10, startTime);
284 unit_assert(success);
285 unit_assert_equal(startTime, 5.890500, 0.000001);
286 Spectrum emptySpectrum;
287 success = TryGetStartTime(emptySpectrum, startTime);
288 unit_assert(!success);
289 }
bool TryGetStartTime(const msdata::Spectrum &spectrum, double &startTime)
Tries to get the start time of the scan.
#define unit_assert_equal(x, y, epsilon)
Definition unit.hpp:99

References _s10, pwiz::analysis::TryGetStartTime(), unit_assert, and unit_assert_equal.

Referenced by Run().

◆ FindNearbySpectraTest()

void DemuxHelpersTest::FindNearbySpectraTest ( )
inlineprotected

Definition at line 291 of file DemuxHelpersTest.cpp.

292 {
293 bool success;
294 vector<size_t> spectraIndices;
295
296 // Test when centered on the first index
297 success = FindNearbySpectra(spectraIndices, _msd.run.spectrumListPtr, MS2_INDEX_0, 2);
298 unit_assert(success);
299 unit_assert_operator_equal(2, spectraIndices.size());
300 unit_assert_operator_equal(MS2_INDEX_0, spectraIndices[0]);
301 unit_assert_operator_equal(MS2_INDEX_1, spectraIndices[1]);
302
303 // Test when centered on the last index
304 success = FindNearbySpectra(spectraIndices, _msd.run.spectrumListPtr, MS2_INDEX_1, 2);
305 unit_assert(success);
306 unit_assert_operator_equal(2, spectraIndices.size());
307 unit_assert_operator_equal(MS2_INDEX_0, spectraIndices[0]);
308 unit_assert_operator_equal(MS2_INDEX_1, spectraIndices[1]);
309
310 // Test requesting only one spectrum
311 success = FindNearbySpectra(spectraIndices, _msd.run.spectrumListPtr, MS2_INDEX_0, 1);
312 unit_assert(success);
313 unit_assert_operator_equal(1, spectraIndices.size());
314 unit_assert_operator_equal(MS2_INDEX_0, spectraIndices[0]);
315
316 // Try and request more spectra than are available
317 success = FindNearbySpectra(spectraIndices, _msd.run.spectrumListPtr, MS2_INDEX_0, 3);
318 unit_assert(!success);
319
320 // Try using center index that is not an MS2 spectrum
322 success = FindNearbySpectra(spectraIndices, _msd.run.spectrumListPtr, MS1_INDEX_0, 2),
323 std::runtime_error,
324 "Center index must be an MS2 spectrum")
325
326 // Test accessing out of range
327 size_t tooLargeOfIndex = _msd.run.spectrumListPtr->size() + 1;
329 success = FindNearbySpectra(spectraIndices, _msd.run.spectrumListPtr, tooLargeOfIndex, 2),
330 std::out_of_range,
331 "Spectrum index not in range of the given spectrum list")
332
333 // Generate a larger MSData set for testing stride and larger numbers of nearby spectra
334 MSData msd;
335 size_t cycleSize = 4;
336 size_t numCycles = 5;
337 initializeLarge(msd, cycleSize, numCycles);
338
339 // Test for different numbers of spectra
340
341 // Test ability to handle interspersed MS1 spectra
342 size_t centerIndex = 2 * (cycleSize + 1); // Start at the beginning of the third cycle
343 centerIndex += 1; // Skip MS1 spectrum
344 success = FindNearbySpectra(spectraIndices, msd.run.spectrumListPtr, centerIndex, 3);
345 unit_assert(success);
346 unit_assert_operator_equal(3, spectraIndices.size());
347 unit_assert_operator_equal(8, spectraIndices[0]);
348 unit_assert_operator_equal(9, spectraIndices[1]);
349 unit_assert_operator_equal(11, spectraIndices[2]);
350
351 // Test stride
352 success = FindNearbySpectra(spectraIndices, msd.run.spectrumListPtr, centerIndex, 5, cycleSize);
353 unit_assert(success);
354 unit_assert_operator_equal(5, spectraIndices.size());
355 unit_assert_operator_equal(1, spectraIndices[0]);
356 unit_assert_operator_equal(6, spectraIndices[1]);
357 unit_assert_operator_equal(11, spectraIndices[2]);
358 unit_assert_operator_equal(16, spectraIndices[3]);
359 unit_assert_operator_equal(21, spectraIndices[4]);
360 }
void initializeLarge(MSData &msd, size_t cycleSize=4, size_t numCycles=5)
bool FindNearbySpectra(std::vector< size_t > &spectraIndices, pwiz::msdata::SpectrumList_const_ptr slPtr, size_t centerIndex, size_t numSpectraToFind, size_t stride=1)
Tries to find a given number of ms2 spectra near the given spectrum index.
STL namespace.
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition MSData.hpp:850
#define unit_assert_throws_what(x, exception, whatStr)
Definition unit.hpp:119

References _msd, pwiz::analysis::FindNearbySpectra(), initializeLarge(), MS1_INDEX_0, MS2_INDEX_0, MS2_INDEX_1, pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert, unit_assert_operator_equal, and unit_assert_throws_what.

Referenced by Run().

Member Data Documentation

◆ MS1_INDEX_0

const size_t DemuxHelpersTest::MS1_INDEX_0 = 0
protected

Definition at line 363 of file DemuxHelpersTest.cpp.

Referenced by FindNearbySpectraTest(), and SetUp().

◆ MS2_INDEX_0

const size_t DemuxHelpersTest::MS2_INDEX_0 = 1
protected

Definition at line 364 of file DemuxHelpersTest.cpp.

Referenced by FindNearbySpectraTest(), and SetUp().

◆ MS1_INDEX_1

const size_t DemuxHelpersTest::MS1_INDEX_1 = 2
protected

Definition at line 365 of file DemuxHelpersTest.cpp.

Referenced by SetUp().

◆ MS2_INDEX_1

const size_t DemuxHelpersTest::MS2_INDEX_1 = 3
protected

Definition at line 366 of file DemuxHelpersTest.cpp.

Referenced by FindNearbySpectraTest(), and SetUp().

◆ _msd

MSData DemuxHelpersTest::_msd
protected

Definition at line 368 of file DemuxHelpersTest.cpp.

Referenced by FindNearbySpectraTest(), and SetUp().

◆ _s10

Spectrum_const_ptr DemuxHelpersTest::_s10
protected

◆ _s20

Spectrum_const_ptr DemuxHelpersTest::_s20
protected

Definition at line 371 of file DemuxHelpersTest.cpp.

Referenced by SetUp(), TryGetMSLevelTest(), and TryGetNumPrecursorsTest().

◆ _s11

Spectrum_const_ptr DemuxHelpersTest::_s11
protected

Definition at line 372 of file DemuxHelpersTest.cpp.

Referenced by SetUp().

◆ _s21

Spectrum_const_ptr DemuxHelpersTest::_s21
protected

Definition at line 373 of file DemuxHelpersTest.cpp.

Referenced by SetUp().


The documentation for this class was generated from the following file: