37using boost::logic::tribool;
45 os <<
"size: " << sl.
size() << endl;
47 for (
size_t i=0, end=sl.
size(); i<end; i++)
50 os << spectrum->index <<
" "
51 << spectrum->id <<
" "
52 <<
"ms" << spectrum->cvParam(
MS_ms_level).value <<
" "
54 <<
"scanTime:" << spectrum->scanList.scans[0].cvParam(
MS_scan_start_time).timeInSeconds() <<
" "
55 <<
"scanFilter:" << spectrum->scanList.scans[0].cvParam(
MS_filter_string).value <<
" "
65 for (
size_t i=0; i<11; ++i)
69 spectrum->id =
"scan=" + lexical_cast<string>(100+i);
73 vector<MZIntensityPair> mzint(i*2);
74 for (
size_t j=1.0; j<i*2; ++j)
83 sl->spectra.push_back(spectrum);
92 spectrum->scanList.scans.push_back(
Scan());
113 if (i == 0 || i == 6)
115 spectrum->scanList.scans[0].set(
MS_filter_string,
"FTMS + p NSI SIM ms [595.0000-655.0000]");
117 else if (i == 3 || i == 9)
119 spectrum->scanList.scans[0].set(
MS_filter_string,
"FTMS + p NSI SIM ms [395.0000-1005.0000]");
123 spectrum->precursors.push_back(
Precursor((i+4)*100, 3));
126 ostringstream filterLine;
130 filterLine <<
"FTMS + c NSI Full ms2 " << (i + 4) * 100 <<
".0000@etd30.00 [100.0000-2000.0000]";
135 filterLine <<
"ITMS + c NSI Full ms2 " << (i + 4) * 100 <<
".0000@cid30.00 [100.0000-2000.0000]";
139 spectrum->precursors[0].activation.set(
MS_HCD);
140 filterLine <<
"ITMS + c NSI Full ms2 " << (i + 4) * 100 <<
".0000@hcd30.00 [100.0000-2000.0000]";
144 spectrum->precursors[0].activation.set(
MS_IRMPD);
145 filterLine <<
"ITMS + c NSI Full ms2 " << (i + 4) * 100 <<
".0000@irmpd30.00 [100.0000-2000.0000]";
151 filterLine <<
"FTMS + c NSI Full ms2 " << (i + 4) * 100 <<
".0000@irmpd30.00 [100.0000-2000.0000]";
154 spectrum->scanList.scans.push_back(
Scan());
159 sl->spectra.push_back(spectrum);
164 *
os_ <<
"original spectrum list:\n";
177 return spectrumIdentity.
index%2 == 0;
186 if (
os_) *
os_ <<
"testEven:\n";
198 for (
size_t i=0, end=filter.size(); i<end; i++)
202 unit_assert(
id.
id ==
"scan=" + lexical_cast<string>(100+i*2));
206 unit_assert(spectrum->id ==
"scan=" + lexical_cast<string>(100+i*2));
215 if (spectrumIdentity.
index%2 != 0)
return false;
216 return boost::logic::indeterminate;
229 return (param.
valueAs<
int>() == 2);
238 if (
os_) *
os_ <<
"testEvenMS2:\n";
249 unit_assert(filter.spectrumIdentity(0).id ==
"scan=102");
250 unit_assert(filter.spectrumIdentity(1).id ==
"scan=104");
251 unit_assert(filter.spectrumIdentity(2).id ==
"scan=108");
265 return (spectrumIdentity.
index==1 ||
266 spectrumIdentity.
index==3 ||
267 spectrumIdentity.
index==5);
281 if (
os_) *
os_ <<
"testSelectedIndices:\n";
292 unit_assert(filter.spectrumIdentity(0).id ==
"scan=101");
293 unit_assert(filter.spectrumIdentity(1).id ==
"scan=103");
294 unit_assert(filter.spectrumIdentity(2).id ==
"scan=105");
307 return boost::logic::indeterminate;
313 return boost::logic::indeterminate;
323 if (
os_) *
os_ <<
"testHasBinaryData:\n";
328 shared_ptr<stringstream> ss(
new stringstream);
330 serializer.
write(*ss, msd);
333 serializer.
read(ss, msd2);
358 if (
os_) *
os_ <<
"testIndexSet:\n";
374 unit_assert(filter.spectrumIdentity(0).id ==
"scan=103");
375 unit_assert(filter.spectrumIdentity(1).id ==
"scan=104");
376 unit_assert(filter.spectrumIdentity(2).id ==
"scan=105");
377 unit_assert(filter.spectrumIdentity(3).id ==
"scan=107");
378 unit_assert(filter.spectrumIdentity(4).id ==
"scan=109");
384 if (
os_) *
os_ <<
"testScanNumberSet:\n";
387 scanNumberSet.
insert(102,104);
388 scanNumberSet.
insert(107);
399 unit_assert(filter.spectrumIdentity(0).id ==
"scan=102");
400 unit_assert(filter.spectrumIdentity(1).id ==
"scan=103");
401 unit_assert(filter.spectrumIdentity(2).id ==
"scan=104");
402 unit_assert(filter.spectrumIdentity(3).id ==
"scan=107");
408 if (
os_) *
os_ <<
"testScanEventSet:\n";
423 unit_assert(filter.spectrumIdentity(0).id ==
"scan=100");
424 unit_assert(filter.spectrumIdentity(1).id ==
"scan=102");
425 unit_assert(filter.spectrumIdentity(2).id ==
"scan=103");
426 unit_assert(filter.spectrumIdentity(3).id ==
"scan=104");
427 unit_assert(filter.spectrumIdentity(4).id ==
"scan=106");
428 unit_assert(filter.spectrumIdentity(5).id ==
"scan=107");
429 unit_assert(filter.spectrumIdentity(6).id ==
"scan=108");
435 if (
os_) *
os_ <<
"testScanTimeRange:\n";
437 const double low = 422.5;
438 const double high = 427.5;
449 unit_assert(filter.spectrumIdentity(0).id ==
"scan=103");
450 unit_assert(filter.spectrumIdentity(1).id ==
"scan=104");
451 unit_assert(filter.spectrumIdentity(2).id ==
"scan=105");
452 unit_assert(filter.spectrumIdentity(3).id ==
"scan=106");
453 unit_assert(filter.spectrumIdentity(4).id ==
"scan=107");
459 if (
os_) *
os_ <<
"testMSLevelSet:\n";
474 unit_assert(filter.spectrumIdentity(0).id ==
"scan=100");
475 unit_assert(filter.spectrumIdentity(1).id ==
"scan=103");
476 unit_assert(filter.spectrumIdentity(2).id ==
"scan=106");
477 unit_assert(filter.spectrumIdentity(3).id ==
"scan=109");
493 unit_assert(filter.spectrumIdentity(0).id ==
"scan=101");
494 unit_assert(filter.spectrumIdentity(1).id ==
"scan=102");
495 unit_assert(filter.spectrumIdentity(2).id ==
"scan=104");
496 unit_assert(filter.spectrumIdentity(3).id ==
"scan=105");
497 unit_assert(filter.spectrumIdentity(4).id ==
"scan=107");
498 unit_assert(filter.spectrumIdentity(5).id ==
"scan=108");
514 unit_assert(filter.spectrumIdentity(0).id ==
"scan=110");
520 if (
os_) *
os_ <<
"testMS2Activation:\n";
539 unit_assert(filter.spectrumIdentity(0).id ==
"scan=102");
604 if (
os_) *
os_ <<
"testMassAnalyzerFilter:\n";
620 unit_assert(filter.spectrumIdentity(0).id ==
"scan=100");
641 if (
os_) *
os_ <<
"testMZPresentFilter:\n";
646 std::set<double> mzSet;
650 double threshold = 10;
669 std::set<double> mzSet1;
670 mzSet1.insert(200.0);
671 mzSet1.insert(300.0);
672 double threshold1 = 5;
689 if (
os_) *
os_ <<
"testThermoFilterFilter:\n";
692 string queryString =
"395.0000-1005.0000";
696 *
os_ <<
"Including all spectra that contain " << queryString << endl;
708 *
os_ <<
"Excluding all spectra that contain " << queryString << endl;
727 *
os_ <<
"Excluding all spectra that contain " << queryString << endl;
738 queryString =
"FTMS + p NSI SIM ms [395.0000-1005.0000]";
742 *
os_ <<
"Including all spectra that exactly match " << queryString << endl;
751 queryString =
"FTMS + p NSI SIM ms [395.0000-1005.0000]";
755 *
os_ <<
"Excluding all spectra that exactly match " << queryString << endl;
789int main(
int argc,
char* argv[])
795 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
void testScanEventSet(SpectrumListPtr sl)
int main(int argc, char *argv[])
void testMSLevelSet(SpectrumListPtr sl)
void testHasBinaryData(SpectrumListPtr sl)
void testMZPresentFilter(SpectrumListPtr sl)
void testEvenMS2(SpectrumListPtr sl)
void testScanNumberSet(SpectrumListPtr sl)
void testEven(SpectrumListPtr sl)
void testMassAnalyzerFilter(SpectrumListPtr sl)
void testThermoFilterFilter(SpectrumListPtr sl)
void testScanTimeRange(SpectrumListPtr sl)
void printSpectrumList(const SpectrumList &sl, ostream &os)
void testMS2Activation(SpectrumListPtr sl)
SpectrumListPtr createSpectrumList()
void testIndexSet(SpectrumListPtr sl)
void testSelectedIndices(SpectrumListPtr sl)
SpectrumList filter, for creating Spectrum sub-lists.
virtual const msdata::SpectrumIdentity & spectrumIdentity(size_t index) const
access to a spectrum index
virtual size_t size() const
returns the number of spectra
MSData <-> mzML stream serialization.
void write(std::ostream &os, const MSData &msd, const pwiz::util::IterationListenerRegistry *iterationListenerRegistry=0) const
write MSData object to ostream as mzML; iterationListenerRegistry may be used to receive progress upd...
void read(boost::shared_ptr< std::istream > is, MSData &msd) const
read in MSData object from an mzML istream note: istream may be managed by MSData's SpectrumList,...
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW,...
virtual size_t size() const =0
returns the number of spectra
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData=false) const =0
retrieve a spectrum by index
a virtual container of integers, accessible via an iterator interface, stored as union of intervals
void insert(Interval interval)
insert an interval of integers into the virtual container
MS_spectrum_type
spectrum type: Spectrum type.
MS_MS1_spectrum
MS1 spectrum: Mass spectrum created by a single-stage MS experiment or the first stage of a multi-sta...
MS_HCD
HCD (beam-type collision-induced dissociation): A collision-induced dissociation process that occurs ...
MS_collision_induced_dissociation
collision-induced dissociation: The dissociation of an ion after collisional excitation....
MS_fourier_transform_ion_cyclotron_resonance_mass_spectrometer
fourier transform ion cyclotron resonance mass spectrometer: A mass spectrometer based on the princip...
MS_quadrupole
quadrupole: A mass spectrometer that consists of four parallel rods whose centers form the corners of...
MS_ms_level
ms level: Stages of ms achieved in a multi stage mass spectrometry experiment.
MS_orbitrap
orbitrap: An ion trapping device that consists of an outer barrel-like electrode and a coaxial inner ...
MS_IRMPD
IRMPD (infrared multiphoton dissociation): Multiphoton ionization where the reactant ion dissociates ...
MS_MSn_spectrum
MSn spectrum: MSn refers to multi-stage MS2 experiments designed to record product ion spectra where ...
MS_mass_spectrum
mass spectrum: A plot of the relative abundance of a beam or other collection of ions as a function o...
MS_radial_ejection_linear_ion_trap
radial ejection linear ion trap: A linear ion trap mass spectrometer where ions are ejected along the...
MS_filter_string
filter string: A string unique to Thermo instrument describing instrument settings for the scan.
MS_preset_scan_configuration
preset scan configuration: A user-defined scan configuration that specifies the instrumental settings...
MS_emission_spectrum
emission spectrum: A plot of the relative intensity of electromagnetic radiation emitted by atoms or ...
MS_scan_start_time
scan start time: The time that an analyzer started a scan, relative to the start of the MS run.
MS_ion_trap
ion trap: A device for spatially confining ions using electric and magnetic fields alone or in combin...
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...
MS_electron_transfer_dissociation
electron transfer dissociation: A process to fragment ions in a mass spectrometer by inducing fragmen...
UO_second
second: A time unit which is equal to the duration of 9 192 631 770 periods of the radiation correspo...
PWIZ_API_DECL bool cvIsA(CVID child, CVID parent)
returns true iff child IsA parent in the CV
PWIZ_API_DECL void initializeTiny(MSData &msd)
boost::shared_ptr< SpectrumList > SpectrumListPtr
boost::shared_ptr< Spectrum > SpectrumPtr
boost::shared_ptr< InstrumentConfiguration > InstrumentConfigurationPtr
boost::shared_ptr< SpectrumListSimple > SpectrumListSimplePtr
@ DetailLevel_FullMetadata
virtual tribool accept(const SpectrumIdentity &spectrumIdentity) const
return values: true: accept the Spectrum false: reject the Spectrum indeterminate: need to see the fu...
virtual string describe() const
return a string describing how the predicate filters
virtual tribool accept(const Spectrum &spectrum) const
return true iff Spectrum is accepted
virtual string describe() const
return a string describing how the predicate filters
virtual tribool accept(const SpectrumIdentity &spectrumIdentity) const
return values: true: accept the Spectrum false: reject the Spectrum indeterminate: need to see the fu...
virtual tribool accept(const Spectrum &spectrum) const
return true iff Spectrum is accepted
virtual DetailLevel suggestedDetailLevel() const
can be overridden in subclasses that know they will need a certain detail level; it must be overridde...
virtual string describe() const
return a string describing how the predicate filters
HasBinaryDataPredicate(DetailLevel suggestedDetailLevel)
virtual tribool accept(const msdata::SpectrumIdentity &spectrumIdentity) const
return values: true: accept the Spectrum false: reject the Spectrum indeterminate: need to see the fu...
virtual string describe() const
return a string describing how the predicate filters
virtual tribool accept(const SpectrumIdentity &spectrumIdentity) const
return values: true: accept the Spectrum false: reject the Spectrum indeterminate: need to see the fu...
virtual bool done() const
return true iff done accepting chromatograms; this allows early termination of the iteration through ...
client-implemented filter predicate – called during construction of SpectrumList_Filter to create the...
@ Orientation_MostIntense
@ ThresholdingBy_Count
keep the <threshold> [most|least] intense data points
struct for expressing m/z tolerance in either amu or ppm
represents a tag-value pair, where the tag comes from the controlled vocabulary
value_type valueAs() const
templated value access with type conversion
CVParam cvParam(CVID cvid) const
finds cvid in the container:
CVParam cvParamChild(CVID cvid) const
finds child of cvid in the container:
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i....
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
The data point type of a mass spectrum.
The method of precursor ion selection and activation.
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here....
The structure that captures the generation of a peak list (including the underlying acquisitions)
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Identifying information for a spectrum.
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Simple writeable in-memory implementation of SpectrumList.
#define unit_assert_operator_equal(expected, actual)
#define TEST_PROLOG(argc, argv)