ProteoWizard
Classes | Functions | Variables
IOTest.cpp File Reference
#include "IO.hpp"
#include "Diff.hpp"
#include "References.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"

Go to the source code of this file.

Classes

class  TestIterationListener
 
class  TestIterationListener_WithCancel
 

Functions

template<typename object_type >
void testObject (const object_type &a)
 
template<typename object_type >
void testObjectWithMSData (const object_type &a, const MSData &msd)
 
void testObject_SpectrumList (const SpectrumList &a)
 
void testObject_ChromatogramList (const ChromatogramList &a)
 
void testCV ()
 
void testUserParam ()
 
void testCVParam ()
 
void testParamGroup ()
 
template<typename object_type >
void testNamedParamContainer ()
 
void testSourceFile ()
 
void testFileDescription ()
 
void testSample ()
 
void testComponent ()
 
void testComponentList ()
 
void testSoftware ()
 
void testInstrumentConfiguration ()
 
void testProcessingMethod ()
 
void testDataProcessing ()
 
void testScanSettings ()
 
void testPrecursor ()
 
void testProduct ()
 
void testScan ()
 
void testScanList ()
 
void testBinaryDataArray (const BinaryDataEncoder::Config &config)
 
void testBinaryDataArray ()
 
void testBinaryDataArrayExternalMetadata ()
 
void testSpectrum ()
 
void testChromatogram ()
 
void testSpectrumList ()
 
void testSpectrumListWithPositions ()
 
void testSpectrumListWriteProgress ()
 
void testChromatogramList ()
 
void testChromatogramListWithPositions ()
 
void testRun ()
 
void initializeTestData (MSData &msd)
 
void testMSData ()
 
void test ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 
const char * bdaWithExternalMetadata
 

Function Documentation

template<typename object_type >
void testObject ( const object_type &  a)

Definition at line 42 of file IOTest.cpp.

References diff(), os_, pwiz::identdata::IO::read(), unit_assert, and pwiz::identdata::IO::write().

43 {
44  if (os_) *os_ << "testObject(): " << typeid(a).name() << endl;
45 
46  // write 'a' out to a stream
47 
48  ostringstream oss;
49  XMLWriter writer(oss);
50  IO::write(writer, a);
51  if (os_) *os_ << oss.str() << endl;
52 
53  // read 'b' in from stream
54 
55  object_type b;
56  istringstream iss(oss.str());
57  IO::read(iss, b);
58 
59  // compare 'a' and 'b'
60 
62  if (diff && os_) *os_ << "diff:\n" << diff << endl;
63  unit_assert(!diff);
64 }
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
ostream * os_
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
PWIZ_API_DECL void read(std::istream &is, CV &cv)
#define unit_assert(x)
Definition: unit.hpp:82
template<typename object_type >
void testObjectWithMSData ( const object_type &  a,
const MSData msd 
)

Definition at line 68 of file IOTest.cpp.

References diff(), os_, pwiz::identdata::IO::read(), unit_assert, and pwiz::identdata::IO::write().

Referenced by testScan(), and testScanList().

69 {
70  if (os_) *os_ << "testObject(): " << typeid(a).name() << endl;
71 
72  // write 'a' out to a stream
73 
74  ostringstream oss;
75  XMLWriter writer(oss);
76  IO::write(writer, a, msd);
77  if (os_) *os_ << oss.str() << endl;
78 
79  // read 'b' in from stream
80 
81  object_type b;
82  istringstream iss(oss.str());
83  IO::read(iss, b);
84 
85  // compare 'a' and 'b'
86 
88  if (diff && os_) *os_ << "diff:\n" << diff << endl;
89  unit_assert(!diff);
90 }
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
ostream * os_
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
PWIZ_API_DECL void read(std::istream &is, CV &cv)
#define unit_assert(x)
Definition: unit.hpp:82
void testObject_SpectrumList ( const SpectrumList a)

Definition at line 93 of file IOTest.cpp.

References diff(), os_, pwiz::identdata::IO::read(), unit_assert, and pwiz::identdata::IO::write().

Referenced by testSpectrumList().

94 {
95  if (os_) *os_ << "testObject_SpectrumList(): " << endl;
96 
97  // write 'a' out to a stream
98 
99  ostringstream oss;
100  XMLWriter writer(oss);
101  MSData dummy;
102  IO::write(writer, a, dummy);
103  if (os_) *os_ << oss.str() << endl;
104 
105  // read 'b' in from stream
106 
108  istringstream iss(oss.str());
109  IO::read(iss, b);
110 
111  // compare 'a' and 'b'
112 
114  if (diff && os_) *os_ << "diff:\n" << diff << endl;
115  unit_assert(!diff);
116 
117 
118 }
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
ostream * os_
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
PWIZ_API_DECL void read(std::istream &is, CV &cv)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:850
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:717
#define unit_assert(x)
Definition: unit.hpp:82
void testObject_ChromatogramList ( const ChromatogramList a)

Definition at line 120 of file IOTest.cpp.

References diff(), os_, pwiz::identdata::IO::read(), unit_assert, and pwiz::identdata::IO::write().

Referenced by testChromatogramList().

122 {
123  if (os_) *os_ << "testObject_ChromatogramList(): " << endl;
124 
125  // write 'a' out to a stream
126 
127  ostringstream oss;
128  XMLWriter writer(oss);
129  IO::write(writer, a);
130  if (os_) *os_ << oss.str() << endl;
131 
132  // read 'b' in from stream
133 
135  istringstream iss(oss.str());
136  IO::read(iss, b);
137 
138  // compare 'a' and 'b'
139 
141  if (diff && os_) *os_ << "diff:\n" << diff << endl;
142  unit_assert(!diff);
143 }
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
ostream * os_
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:791
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
PWIZ_API_DECL void read(std::istream &is, CV &cv)
#define unit_assert(x)
Definition: unit.hpp:82
void testCV ( )

Definition at line 146 of file IOTest.cpp.

References pwiz::cv::CV::fullName, pwiz::cv::CV::id, testObject(), pwiz::cv::CV::URI, and pwiz::cv::CV::version.

147 {
148  CV a;
149  a.URI = "abcd";
150  a.id = "efgh";
151  a.fullName = "ijkl";
152  a.version = "mnop";
153 
154  testObject(a);
155 }
std::string id
the short label to be used as a reference tag with which to refer to this particular Controlled Vocab...
Definition: cv.hpp:10159
void testObject(const object_type &a)
Definition: IOTest.cpp:41
Information about an ontology or CV source and a short &#39;lookup&#39; tag to refer to.
Definition: cv.hpp:10156
std::string fullName
the usual name for the resource (e.g. The PSI-MS Controlled Vocabulary).
Definition: cv.hpp:10165
std::string URI
the URI for the resource.
Definition: cv.hpp:10162
std::string version
the version of the CV from which the referred-to terms are drawn.
Definition: cv.hpp:10168
void testUserParam ( )

Definition at line 158 of file IOTest.cpp.

References pwiz::data::UserParam::name, testObject(), pwiz::data::UserParam::type, pwiz::data::UserParam::units, UO_minute, and pwiz::data::UserParam::value.

159 {
160  UserParam a;
161  a.name = "abcd";
162  a.value = "efgh";
163  a.type = "ijkl";
164  a.units = UO_minute;
165 
166  testObject(a);
167 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
std::string value
the value for the parameter, where appropriate.
Definition: ParamTypes.hpp:191
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
std::string type
the datatype of the parameter, where appropriate (e.g.: xsd:float).
Definition: ParamTypes.hpp:194
std::string name
the name for the parameter.
Definition: ParamTypes.hpp:188
UO_minute
minute: A time unit which is equal to 60 seconds.
Definition: cv.hpp:9392
CVID units
an optional CV parameter for the unit term associated with the value, if any (e.g. MS_electron_volt).
Definition: ParamTypes.hpp:197
void testCVParam ( )

Definition at line 170 of file IOTest.cpp.

References MS_m_z, MS_selected_ion_m_z, testObject(), and UO_second.

171 {
172  CVParam a(MS_selected_ion_m_z, "810.48", MS_m_z);
173  testObject(a);
174 
175  CVParam b(UO_second, "123.45");
176  testObject(b);
177 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
UO_second
second: A time unit which is equal to the duration of 9 192 631 770 periods of the radiation correspo...
Definition: cv.hpp:9329
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of the ion selected for fragmentation.
Definition: cv.hpp:2741
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:215
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
void testParamGroup ( )

Definition at line 180 of file IOTest.cpp.

References pwiz::data::ParamContainer::cvParams, MS_ionization_type, MS_m_z, MS_selected_ion_m_z, pwiz::data::ParamContainer::paramGroupPtrs, testObject(), and pwiz::data::ParamContainer::userParams.

181 {
182  ParamGroup a("pg");
183  a.userParams.push_back(UserParam("goober", "goo", "peanuts"));
184  a.cvParams.push_back(CVParam(MS_ionization_type, "420"));
185  a.cvParams.push_back(CVParam(MS_selected_ion_m_z, "666", MS_m_z));
186  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pgp")));
187  testObject(a);
188 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:236
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of the ion selected for fragmentation.
Definition: cv.hpp:2741
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
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:215
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:116
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:321
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
template<typename object_type >
void testNamedParamContainer ( )

Definition at line 192 of file IOTest.cpp.

References MS_ionization_type, MS_m_z, MS_selected_ion_m_z, and testObject().

193 {
194  object_type a;
195  a.userParams.push_back(UserParam("goober", "goo", "peanuts"));
196  a.cvParams.push_back(CVParam(MS_ionization_type, "420"));
197  a.cvParams.push_back(CVParam(MS_selected_ion_m_z, "666", MS_m_z));
198  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pgp")));
199  testObject(a);
200 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:236
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of the ion selected for fragmentation.
Definition: cv.hpp:2741
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
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:215
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:116
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:321
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
void testSourceFile ( )

Definition at line 203 of file IOTest.cpp.

References pwiz::data::ParamContainer::cvParams, MS_ionization_type, MS_m_z, MS_selected_ion_m_z, pwiz::data::ParamContainer::paramGroupPtrs, testObject(), and pwiz::data::ParamContainer::userParams.

204 {
205  SourceFile a("id123", "name456", "location789");
206  a.userParams.push_back(UserParam("goober", "goo", "peanuts"));
207  a.cvParams.push_back(CVParam(MS_ionization_type, "420"));
208  a.cvParams.push_back(CVParam(MS_selected_ion_m_z, "666", MS_m_z));
209  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pgp")));
210  testObject(a);
211 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:236
Description of the source file, including location and type.
Definition: MSData.hpp:53
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of the ion selected for fragmentation.
Definition: cv.hpp:2741
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
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:215
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:116
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:321
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
void testFileDescription ( )

Definition at line 214 of file IOTest.cpp.

References pwiz::msdata::FileDescription::contacts, pwiz::data::ParamContainer::cvParams, pwiz::msdata::FileDescription::fileContent, MS_contact_name, MS_MSn_spectrum, MS_SHA_1, MS_Thermo_RAW_file, pwiz::msdata::FileDescription::sourceFilePtrs, and testObject().

215 {
216  FileDescription a;
217  a.fileContent.cvParams.push_back(MS_MSn_spectrum);
218 
219  SourceFilePtr sf(new SourceFile("1", "tiny1.RAW", "file://F:/data/Exp01"));
220  sf->cvParams.push_back(MS_Thermo_RAW_file);
221  sf->cvParams.push_back(MS_SHA_1);
222  a.sourceFilePtrs.push_back(sf);
223 
224  Contact contact;
225  contact.cvParams.push_back(CVParam(MS_contact_name, "Darren"));
226  a.contacts.push_back(contact);
227 
228  testObject(a);
229 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
Structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam), or a reference to a predefined set of these in this mzML file (paramGroupRef).
Definition: MSData.hpp:79
MS_MSn_spectrum
MSn spectrum: MSn refers to multi-stage MS/MS experiments designed to record product ion spectra wher...
Definition: cv.hpp:2204
std::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from...
Definition: MSData.hpp:89
Description of the source file, including location and type.
Definition: MSData.hpp:53
MS_Thermo_RAW_file
Thermo RAW file: Thermo Scientific RAW file format.
Definition: cv.hpp:2138
FileContent fileContent
this summarizes the different types of spectra that can be expected in the file. This is expected to ...
Definition: MSData.hpp:86
MS_SHA_1
SHA-1: SHA-1 (Secure Hash Algorithm-1) is a cryptographic hash function designed by the National Secu...
Definition: cv.hpp:2156
Information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
Definition: MSData.hpp:83
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:247
std::vector< Contact > contacts
structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam), or a reference to a predefined set of these in this mzML file (paramGroupRef)
Definition: MSData.hpp:92
MS_contact_name
contact name: Name of the contact person or organization.
Definition: cv.hpp:2249
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition: MSData.hpp:75
void testSample ( )

Definition at line 232 of file IOTest.cpp.

References pwiz::data::ParamContainer::cvParams, MS_ionization_type, MS_m_z, MS_selected_ion_m_z, pwiz::data::ParamContainer::paramGroupPtrs, testObject(), and pwiz::data::ParamContainer::userParams.

233 {
234  Sample a("id123", "name456");
235  a.userParams.push_back(UserParam("goober", "goo", "peanuts"));
236  a.cvParams.push_back(CVParam(MS_ionization_type, "420"));
237  a.cvParams.push_back(CVParam(MS_selected_ion_m_z, "666", MS_m_z));
238  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pgp")));
239  testObject(a);
240 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:236
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of the ion selected for fragmentation.
Definition: cv.hpp:2741
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
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:215
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:116
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:321
Expansible description of the sample used to generate the dataset, named in sampleName.
Definition: MSData.hpp:100
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
void testComponent ( )

Definition at line 243 of file IOTest.cpp.

References pwiz::msdata::ComponentType_Source, pwiz::data::ParamContainer::cvParams, MS_ionization_type, MS_m_z, MS_selected_ion_m_z, pwiz::data::ParamContainer::paramGroupPtrs, testObject(), and pwiz::data::ParamContainer::userParams.

244 {
246  a.userParams.push_back(UserParam("goober", "goo", "peanuts"));
247  a.cvParams.push_back(CVParam(MS_ionization_type, "420"));
248  a.cvParams.push_back(CVParam(MS_selected_ion_m_z, "666", MS_m_z));
249  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pgp")));
250  testObject(a);
251 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:236
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i...
Definition: MSData.hpp:130
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of the ion selected for fragmentation.
Definition: cv.hpp:2741
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
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:215
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:116
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:321
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
void testComponentList ( )

Definition at line 254 of file IOTest.cpp.

References MS_electron_multiplier, MS_nanoelectrospray, MS_quadrupole_ion_trap, and testObject().

255 {
256  ComponentList a;
257  a.push_back(Component(MS_nanoelectrospray, 1));
258  a.push_back(Component(MS_quadrupole_ion_trap, 2));
259  a.push_back(Component(MS_electron_multiplier, 3));
260  testObject(a);
261 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i...
Definition: MSData.hpp:130
MS_nanoelectrospray
nanoelectrospray: Electrospray ionization at a flow rate less than ~25 nL/min. Nanoelectrospray is sy...
Definition: cv.hpp:1604
MS_electron_multiplier
electron multiplier: A device to amplify the current of a beam or packet of charged particles or phot...
Definition: cv.hpp:1052
List with the different components used in the mass spectrometer. At least one source, one mass analyzer and one detector need to be specified.
Definition: MSData.hpp:155
MS_quadrupole_ion_trap
quadrupole ion trap: Quadrupole Ion Trap mass analyzer captures the ions in a three dimensional ion t...
Definition: cv.hpp:377
void testSoftware ( )

Definition at line 264 of file IOTest.cpp.

References pwiz::msdata::Software::id, MS_ionization_type, pwiz::data::ParamContainer::set(), testObject(), and pwiz::msdata::Software::version.

265 {
266  Software a;
267  a.id = "goober";
269  a.version = "4.20";
270  testObject(a);
271 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:116
std::string version
the software version.
Definition: MSData.hpp:184
A piece of software.
Definition: MSData.hpp:178
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
std::string id
an identifier for this software that is unique across all SoftwareTypes.
Definition: MSData.hpp:181
void testInstrumentConfiguration ( )

Definition at line 274 of file IOTest.cpp.

References pwiz::msdata::InstrumentConfiguration::componentList, pwiz::data::ParamContainer::cvParams, pwiz::msdata::InstrumentConfiguration::id, MS_electron_multiplier, MS_instrument_serial_number, MS_LCQ_Deca, MS_nanoelectrospray, MS_quadrupole_ion_trap, pwiz::msdata::InstrumentConfiguration::softwarePtr, and testObject().

275 {
277  a.id = "LCQ Deca";
278  a.cvParams.push_back(MS_LCQ_Deca);
279  a.cvParams.push_back(CVParam(MS_instrument_serial_number, 23433));
283  a.softwarePtr = SoftwarePtr(new Software("XCalibur"));
284  testObject(a);
285 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
ComponentList componentList
list with the different components used in the mass spectrometer. At least one source, one mass analyzer and one detector need to be specified.
Definition: MSData.hpp:234
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:197
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i...
Definition: MSData.hpp:130
SoftwarePtr softwarePtr
reference to a previously defined software element.
Definition: MSData.hpp:237
MS_nanoelectrospray
nanoelectrospray: Electrospray ionization at a flow rate less than ~25 nL/min. Nanoelectrospray is sy...
Definition: cv.hpp:1604
MS_electron_multiplier
electron multiplier: A device to amplify the current of a beam or packet of charged particles or phot...
Definition: cv.hpp:1052
MS_LCQ_Deca
LCQ Deca: ThermoFinnigan LCQ Deca.
Definition: cv.hpp:2111
MS_instrument_serial_number
instrument serial number: Serial Number of the instrument.
Definition: cv.hpp:2033
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:247
A piece of software.
Definition: MSData.hpp:178
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
Definition: MSData.hpp:228
MS_quadrupole_ion_trap
quadrupole ion trap: Quadrupole Ion Trap mass analyzer captures the ions in a three dimensional ion t...
Definition: cv.hpp:377
std::string id
an identifier for this instrument configuration.
Definition: MSData.hpp:231
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
void testProcessingMethod ( )

Definition at line 288 of file IOTest.cpp.

References pwiz::data::ParamContainer::cvParams, MS_charge_deconvolution, MS_deisotoping, MS_peak_picking, pwiz::msdata::ProcessingMethod::order, pwiz::msdata::ProcessingMethod::softwarePtr, and testObject().

289 {
291  a.order = 420;
292  a.cvParams.push_back(CVParam(MS_deisotoping, false));
293  a.cvParams.push_back(CVParam(MS_charge_deconvolution, false));
294  a.cvParams.push_back(CVParam(MS_peak_picking, true));
295  a.softwarePtr = SoftwarePtr(new Software("pwiz"));
296  testObject(a);
297 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
MS_deisotoping
deisotoping: The removal of isotope peaks to represent the fragment ion as one data point and is comm...
Definition: cv.hpp:194
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:197
SoftwarePtr softwarePtr
this attribute MUST reference the &#39;id&#39; of the appropriate SoftwareType.
Definition: MSData.hpp:259
Description of the default peak processing method. This element describes the base method used in the...
Definition: MSData.hpp:253
int order
this attributes allows a series of consecutive steps to be placed in the correct order.
Definition: MSData.hpp:256
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:247
A piece of software.
Definition: MSData.hpp:178
MS_charge_deconvolution
charge deconvolution: The determination of the mass of an ion based on the mass spectral peaks that r...
Definition: cv.hpp:197
MS_peak_picking
peak picking: Spectral peak processing conducted on the acquired data to convert profile data to cent...
Definition: cv.hpp:200
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
void testDataProcessing ( )

Definition at line 300 of file IOTest.cpp.

References pwiz::data::ParamContainer::cvParams, pwiz::msdata::DataProcessing::id, MS_charge_deconvolution, MS_deisotoping, MS_peak_picking, pwiz::msdata::ProcessingMethod::order, pwiz::msdata::DataProcessing::processingMethods, pwiz::msdata::ProcessingMethod::softwarePtr, testObject(), and pwiz::data::ParamContainer::userParams.

301 {
302  DataProcessing a;
303 
304  a.id = "msdata processing";
305 
306  ProcessingMethod pm1, pm2;
307 
308  pm1.order = 420;
309  pm1.cvParams.push_back(CVParam(MS_deisotoping, false));
310  pm1.cvParams.push_back(CVParam(MS_charge_deconvolution, false));
311  pm1.cvParams.push_back(CVParam(MS_peak_picking, true));
312  pm1.softwarePtr = SoftwarePtr(new Software("msdata"));
313 
314  pm2.order = 421;
315  pm2.userParams.push_back(UserParam("testing"));
316 
317  a.processingMethods.push_back(pm1);
318  a.processingMethods.push_back(pm2);
319 
320  testObject(a);
321 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
MS_deisotoping
deisotoping: The removal of isotope peaks to represent the fragment ion as one data point and is comm...
Definition: cv.hpp:194
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:197
std::vector< ProcessingMethod > processingMethods
description of the default peak processing method(s). This element describes the base method used in ...
Definition: MSData.hpp:278
SoftwarePtr softwarePtr
this attribute MUST reference the &#39;id&#39; of the appropriate SoftwareType.
Definition: MSData.hpp:259
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
Description of the default peak processing method. This element describes the base method used in the...
Definition: MSData.hpp:253
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:250
int order
this attributes allows a series of consecutive steps to be placed in the correct order.
Definition: MSData.hpp:256
std::string id
a unique identifier for this data processing that is unique across all DataProcessingTypes.
Definition: MSData.hpp:275
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:247
A piece of software.
Definition: MSData.hpp:178
MS_charge_deconvolution
charge deconvolution: The determination of the mass of an ion based on the mass spectral peaks that r...
Definition: cv.hpp:197
MS_peak_picking
peak picking: Spectral peak processing conducted on the acquired data to convert profile data to cent...
Definition: cv.hpp:200
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
void testScanSettings ( )

Definition at line 324 of file IOTest.cpp.

References pwiz::msdata::ScanSettings::id, MS_selected_ion_m_z, pwiz::data::ParamContainer::set(), pwiz::msdata::ScanSettings::sourceFilePtrs, pwiz::msdata::ScanSettings::targets, testObject(), and pwiz::data::ParamContainer::userParams.

325 {
326  ScanSettings a;
327 
328  a.id = "as1";
329 
330  Target t1, t2;
331 
332  t1.set(MS_selected_ion_m_z, 200);
333  t2.userParams.push_back(UserParam("testing"));
334 
335  a.targets.push_back(t1);
336  a.targets.push_back(t2);
337 
338  a.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf1")));
339  a.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf2")));
340 
341  testObject(a);
342 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
Description of the source file, including location and type.
Definition: MSData.hpp:53
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of the ion selected for fragmentation.
Definition: cv.hpp:2741
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:250
std::vector< Target > targets
target list (or &#39;inclusion list&#39;) configured prior to the run.
Definition: MSData.hpp:214
std::string id
a unique identifier for this acquisition setting.
Definition: MSData.hpp:208
std::vector< SourceFilePtr > sourceFilePtrs
container for a list of source file references.
Definition: MSData.hpp:211
Description of the acquisition settings of the instrument prior to the start of the run...
Definition: MSData.hpp:205
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition: MSData.hpp:75
void testPrecursor ( )

Definition at line 345 of file IOTest.cpp.

References pwiz::msdata::Precursor::activation, pwiz::msdata::Precursor::isolationWindow, MS_charge_state, MS_collision_energy, MS_collision_induced_dissociation, MS_isolation_window_lower_offset, MS_isolation_window_target_m_z, MS_isolation_window_upper_offset, MS_m_z, MS_selected_ion_m_z, pwiz::msdata::Precursor::selectedIons, pwiz::data::ParamContainer::set(), pwiz::msdata::Precursor::spectrumID, and testObject().

346 {
347  Precursor a;
348 
349  a.spectrumID = "scan=19";
353  a.selectedIons.resize(2);
354  a.selectedIons[0].set(MS_selected_ion_m_z, 445.34, MS_m_z);
355  a.selectedIons[1].set(MS_charge_state, 2);
358 
359  testObject(a);
360 
361  // TODO: fix this to test mzML 1.0 precursors;
362  // (requires fixing the framework to support testing different schema versions)
363 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
MS_charge_state
charge state: The charge state of the ion, single or multiple and positive or negatively charged...
Definition: cv.hpp:227
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:3023
The method of precursor ion selection and activation.
Definition: MSData.hpp:310
IsolationWindow isolationWindow
this element captures the isolation (or &#39;selection&#39;) window configured to isolate one or more precurs...
Definition: MSData.hpp:325
MS_collision_induced_dissociation
collision-induced dissociation: The dissociation of an ion after collisional excitation. The term collisional-activated dissociation is not recommended.
Definition: cv.hpp:578
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of the ion selected for fragmentation.
Definition: cv.hpp:2741
MS_collision_energy
collision energy: Energy for an ion experiencing collision with a stationary gas particle resulting i...
Definition: cv.hpp:242
std::string spectrumID
reference to the id attribute of the spectrum from which the precursor was selected.
Definition: MSData.hpp:322
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:215
Activation activation
the type and energy level used for activation.
Definition: MSData.hpp:331
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:3020
std::vector< SelectedIon > selectedIons
this list of precursor ions that were selected.
Definition: MSData.hpp:328
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
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:3026
void testProduct ( )

Definition at line 366 of file IOTest.cpp.

References pwiz::msdata::Product::isolationWindow, MS_isolation_window_lower_offset, MS_isolation_window_target_m_z, MS_isolation_window_upper_offset, MS_m_z, pwiz::data::ParamContainer::set(), and testObject().

367 {
368  Product a;
369 
373 
374  testObject(a);
375 }
void testObject(const object_type &a)
Definition: IOTest.cpp:41
IsolationWindow isolationWindow
this element captures the isolation (or &#39;selection&#39;) window configured to isolate one or more precurs...
Definition: MSData.hpp:349
product ion information
Definition: MSData.hpp:346
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:3023
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:215
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:3020
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
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:3026
void testScan ( )

Definition at line 378 of file IOTest.cpp.

References pwiz::data::ParamContainer::cvParams, pwiz::msdata::Scan::instrumentConfigurationPtr, MS_filter_string, MS_m_z, MS_scan_start_time, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::Scan::scanWindows, testObjectWithMSData(), and UO_minute.

379 {
380  Scan a;
381 
383  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("CommonMS1SpectrumParams")));
384  a.cvParams.push_back(CVParam(MS_scan_start_time, 5.890500, UO_minute));
385  a.cvParams.push_back(CVParam(MS_filter_string, "+ c NSI Full ms [ 400.00-1800.00]"));
386  a.scanWindows.push_back(ScanWindow(400.0, 1800.0, MS_m_z));
387 
388  MSData dummy;
389  testObjectWithMSData(a, dummy);
390 }
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:236
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile...
Definition: MSData.hpp:368
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:140
MS_filter_string
filter string: A string unique to Thermo instrument describing instrument settings for the scan...
Definition: cv.hpp:1982
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:215
std::vector< ScanWindow > scanWindows
container for a list of select windows.
Definition: MSData.hpp:386
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:247
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
Definition: ParamTypes.hpp:244
InstrumentConfigurationPtr instrumentConfigurationPtr
this attribute MUST reference the &#39;id&#39; attribute of the appropriate instrument configuration.
Definition: MSData.hpp:383
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:321
UO_minute
minute: A time unit which is equal to 60 seconds.
Definition: cv.hpp:9392
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
Definition: MSData.hpp:228
boost::shared_ptr< InstrumentConfiguration > InstrumentConfigurationPtr
Definition: MSData.hpp:249
void testObjectWithMSData(const object_type &a, const MSData &msd)
Definition: IOTest.cpp:68
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:850
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
void testScanList ( )

Definition at line 393 of file IOTest.cpp.

References pwiz::data::ParamContainer::cvParams, MS_reflectron_off, MS_reflectron_on, MS_sum_of_spectra, pwiz::msdata::ScanList::scans, and testObjectWithMSData().

394 {
395  ScanList a;
396  a.cvParams.push_back(MS_sum_of_spectra);
397 
398  Scan a1;
399  a1.cvParams.push_back(MS_reflectron_on);
400 
401  Scan a2;
402  a1.cvParams.push_back(MS_reflectron_off);
403 
404  a.scans.push_back(a1);
405  a.scans.push_back(a2);
406 
407  MSData dummy;
408  testObjectWithMSData(a, dummy);
409 }
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile...
Definition: MSData.hpp:368
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:247
MS_reflectron_on
reflectron on: Reflectron is on.
Definition: cv.hpp:467
MS_sum_of_spectra
sum of spectra: Spectra Sum.
Definition: cv.hpp:2162
std::vector< Scan > scans
Definition: MSData.hpp:396
List and descriptions of scans.
Definition: MSData.hpp:394
void testObjectWithMSData(const object_type &a, const MSData &msd)
Definition: IOTest.cpp:68
MS_reflectron_off
reflectron off: Reflectron is off.
Definition: cv.hpp:464
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:850
void testBinaryDataArray ( const BinaryDataEncoder::Config config)

Definition at line 412 of file IOTest.cpp.

References pwiz::msdata::BinaryDataArray::data, pwiz::msdata::BinaryDataArray::dataProcessingPtr, diff(), os_, pwiz::identdata::IO::read(), unit_assert, and pwiz::identdata::IO::write().

413 {
414  if (os_) *os_ << "testBinaryDataArray():\n";
415 
416  BinaryDataArray a;
417  for (int i=0; i<10; i++) a.data.push_back(i);
419 
420  // write 'a' out to a stream
421 
422  ostringstream oss;
423  XMLWriter writer(oss);
424  IO::write(writer, a, config);
425  if (os_) *os_ << oss.str() << endl;
426 
427  // read 'b' in from stream
428 
429  BinaryDataArray b;
430  istringstream iss(oss.str());
431  IO::read(iss, b);
432 
433  // compare 'a' and 'b'
434 
436  if (diff && os_) *os_ << "diff:\n" << diff << endl;
437  unit_assert(!diff);
438 }
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
ostream * os_
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
DataProcessingPtr dataProcessingPtr
this optional attribute may reference the &#39;id&#39; attribute of the appropriate dataProcessing.
Definition: MSData.hpp:406
void diff(const string &filename1, const string &filename2)
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
std::vector< double > data
the binary data.
Definition: MSData.hpp:409
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
PWIZ_API_DECL void read(std::istream &is, CV &cv)
#define unit_assert(x)
Definition: unit.hpp:82
void testBinaryDataArray ( )

Definition at line 441 of file IOTest.cpp.

References pwiz::msdata::BinaryDataEncoder::Config::byteOrder, pwiz::msdata::BinaryDataEncoder::Config::precision, and testBinaryDataArray().

442 {
444 
445  config.precision = BinaryDataEncoder::Precision_32;
446  config.byteOrder = BinaryDataEncoder::ByteOrder_LittleEndian;
447  testBinaryDataArray(config);
448 
449  config.precision = BinaryDataEncoder::Precision_64;
450  config.byteOrder = BinaryDataEncoder::ByteOrder_LittleEndian;
451  testBinaryDataArray(config);
452 
453  //config.precision = BinaryDataEncoder::Precision_64;
454  //config.compression = BinaryDataEncoder::Compression_Zlib;
455  //testBinaryDataArray(config);
456 }
void testBinaryDataArray()
Definition: DiffTest.cpp:487
encoding/decoding configuration
void testBinaryDataArrayExternalMetadata ( )

Definition at line 466 of file IOTest.cpp.

References bdaWithExternalMetadata, pwiz::msdata::BinaryDataArray::data, MS_64_bit_float, MS_m_z_array, MS_no_compression, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::IO::read(), and unit_assert.

Referenced by test().

467 {
468  // instantiate an MSData object with the binary array metadata held in a ParamGroup
469 
470  MSData msd;
471  ParamGroupPtr pg(new ParamGroup);
472  pg->id = "mz_params";
473  pg->cvParams.push_back(MS_m_z_array);
474  pg->cvParams.push_back(MS_64_bit_float);
475  pg->cvParams.push_back(MS_no_compression);
476  msd.paramGroupPtrs.push_back(pg);
477 
478  istringstream is(bdaWithExternalMetadata);
479  BinaryDataArray bda;
480 
481  // test read with MSData reference
482 
483  IO::read(is, bda, &msd);
484 
485  unit_assert(bda.data.size() == 15);
486  for (size_t i=0; i<15; i++)
487  unit_assert(bda.data[i] == i);
488 }
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:236
MS_64_bit_float
64-bit float: 64-bit precision little-endian floating point conforming to IEEE-754.
Definition: cv.hpp:2015
MS_no_compression
no compression: No Compression.
Definition: cv.hpp:2177
MS_m_z_array
m/z array: A data array of m/z values.
Definition: cv.hpp:1988
const char * bdaWithExternalMetadata
Definition: IOTest.cpp:459
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:321
std::vector< double > data
the binary data.
Definition: MSData.hpp:409
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
PWIZ_API_DECL void read(std::istream &is, CV &cv)
std::vector< ParamGroupPtr > paramGroupPtrs
container for a list of referenceableParamGroups
Definition: MSData.hpp:866
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:850
#define unit_assert(x)
Definition: unit.hpp:82
void testSpectrum ( )

Definition at line 491 of file IOTest.cpp.

References pwiz::msdata::Spectrum::binaryDataArrayPtrs, pwiz::data::ParamContainer::cvParams, pwiz::msdata::Spectrum::dataProcessingPtr, pwiz::msdata::Spectrum::defaultArrayLength, diff(), pwiz::msdata::SpectrumIdentity::id, pwiz::msdata::SpectrumIdentity::index, MS_charge_state, MS_collision_energy, MS_collision_induced_dissociation, MS_filter_string, MS_intensity_array, MS_ionization_type, MS_m_z, MS_m_z_array, MS_MSn_spectrum, MS_reflectron_on, MS_scan_start_time, MS_selected_ion_m_z, os_, pwiz::msdata::Spectrum::precursors, pwiz::msdata::Spectrum::products, pwiz::identdata::IO::read(), ReadBinaryData, pwiz::msdata::Spectrum::scanList, pwiz::msdata::ScanList::scans, pwiz::data::ParamContainer::set(), pwiz::msdata::SpectrumIdentity::sourceFilePosition, pwiz::msdata::Spectrum::sourceFilePtr, unit_assert, UO_electronvolt, and pwiz::identdata::IO::write().

492 {
493  if (os_) *os_ << "testSpectrum():\n";
494 
495  Spectrum a;
496 
497  a.index = 123;
498  a.id = "goo";
499  a.defaultArrayLength = 666;
501  a.sourceFilePtr = SourceFilePtr(new SourceFile("sf"));
503  for (size_t i=0; i<a.defaultArrayLength; i++)
504  a.binaryDataArrayPtrs.back()->data.push_back(i);
505  a.binaryDataArrayPtrs.back()->set(MS_m_z_array);
507  for (size_t i=0; i<a.defaultArrayLength; i++)
508  a.binaryDataArrayPtrs.back()->data.push_back(i*2);
510  a.cvParams.push_back(MS_reflectron_on);
511  a.cvParams.push_back(MS_MSn_spectrum);
512 
513  a.precursors.push_back(Precursor());
514  a.precursors.back().spectrumID = "19";
515  a.precursors.back().selectedIons.resize(1);
516  a.precursors.back().selectedIons[0].set(MS_selected_ion_m_z, 445.34, MS_m_z);
517  a.precursors.back().selectedIons[0].set(MS_charge_state, 2);
518  a.precursors.back().activation.set(MS_collision_induced_dissociation);
519  a.precursors.back().activation.set(MS_collision_energy, 35.00, UO_electronvolt);
520 
521  a.products.push_back(Product());
522  a.products.back().isolationWindow.set(MS_ionization_type, "420");
523 
524  a.scanList.scans.push_back(Scan());
525  Scan& scan = a.scanList.scans.back();
526  scan.set(MS_scan_start_time, 4.20);
527  scan.set(MS_filter_string, "doobie");
528 
529  a.scanList.scans.push_back(Scan());
530  Scan& scan2 = a.scanList.scans.back();
531  scan2.set(MS_scan_start_time, 4.21);
532  scan2.set(MS_filter_string, "doo");
533 
534  // write 'a' out to a stream
535 
536  ostringstream oss;
537  XMLWriter writer(oss);
538  MSData dummy;
539  IO::write(writer, a, dummy);
540  if (os_) *os_ << oss.str() << endl;
541 
542  // read 'b' in from stream
543 
544  Spectrum b;
545  istringstream iss(oss.str());
546  IO::read(iss, b, IO::ReadBinaryData);
547  unit_assert(b.sourceFilePosition == 0); // not -1
548 
549  // compare 'a' and 'b'
550 
552  if (diff && os_) *os_ << "diff:\n" << diff << endl;
553  unit_assert(!diff);
554 
555  // test IgnoreBinaryData
556 
557  Spectrum c;
558  iss.seekg(0);
559  IO::read(iss, c); // default = IgnoreBinaryData
560  unit_assert(c.binaryDataArrayPtrs.empty());
561  unit_assert(c.sourceFilePosition == 0); // not -1
562 
563  a.binaryDataArrayPtrs.clear();
564  diff(a, c);
565  unit_assert(!diff);
566 }
MS_charge_state
charge state: The charge state of the ion, single or multiple and positive or negatively charged...
Definition: cv.hpp:227
std::vector< Product > products
list and descriptions of product ion information
Definition: MSData.hpp:522
product ion information
Definition: MSData.hpp:346
MS_MSn_spectrum
MSn spectrum: MSn refers to multi-stage MS/MS experiments designed to record product ion spectra wher...
Definition: cv.hpp:2204
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
ScanList scanList
list of scans
Definition: MSData.hpp:516
Description of the source file, including location and type.
Definition: MSData.hpp:53
ReadBinaryData
Definition: IO.hpp:173
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile...
Definition: MSData.hpp:368
The method of precursor ion selection and activation.
Definition: MSData.hpp:310
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: MSData.hpp:525
ostream * os_
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:140
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
std::vector< Precursor > precursors
list and descriptions of precursors to the spectrum currently being described.
Definition: MSData.hpp:519
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
MS_collision_induced_dissociation
collision-induced dissociation: The dissociation of an ion after collisional excitation. The term collisional-activated dissociation is not recommended.
Definition: cv.hpp:578
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of the ion selected for fragmentation.
Definition: cv.hpp:2741
MS_filter_string
filter string: A string unique to Thermo instrument describing instrument settings for the scan...
Definition: cv.hpp:1982
MS_intensity_array
intensity array: A data array of intensity values.
Definition: cv.hpp:1991
void diff(const string &filename1, const string &filename2)
MS_m_z_array
m/z array: A data array of m/z values.
Definition: cv.hpp:1988
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
Definition: MSData.hpp:475
MS_collision_energy
collision energy: Energy for an ion experiencing collision with a stationary gas particle resulting i...
Definition: cv.hpp:242
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: MSData.hpp:507
boost::iostreams::stream_offset sourceFilePosition
for file-based MSData implementations, this attribute may refer to the spectrum&#39;s position in the fil...
Definition: MSData.hpp:481
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:215
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:116
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:247
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Definition: MSData.hpp:472
MS_reflectron_on
reflectron on: Reflectron is on.
Definition: cv.hpp:467
std::vector< Scan > scans
Definition: MSData.hpp:396
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
PWIZ_API_DECL void read(std::istream &is, CV &cv)
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
UO_electronvolt
electronvolt: A non-SI unit of energy (eV) defined as the energy acquired by a single unbound electro...
Definition: cv.hpp:10091
SourceFilePtr sourceFilePtr
this attribute can optionally reference the &#39;id&#39; of the appropriate sourceFile.
Definition: MSData.hpp:513
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the &#39;id&#39; of the appropriate dataProcessing.
Definition: MSData.hpp:510
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: MSData.hpp:504
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:850
#define unit_assert(x)
Definition: unit.hpp:82
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:416
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition: MSData.hpp:75
void testChromatogram ( )

Definition at line 569 of file IOTest.cpp.

References pwiz::msdata::Chromatogram::binaryDataArrayPtrs, pwiz::data::ParamContainer::cvParams, pwiz::msdata::Chromatogram::dataProcessingPtr, pwiz::msdata::Chromatogram::defaultArrayLength, diff(), pwiz::msdata::ChromatogramIdentity::id, pwiz::msdata::ChromatogramIdentity::index, MS_intensity_array, MS_time_array, MS_total_ion_current_chromatogram, os_, pwiz::identdata::IO::read(), ReadBinaryData, pwiz::msdata::ChromatogramIdentity::sourceFilePosition, unit_assert, and pwiz::identdata::IO::write().

570 {
571  if (os_) *os_ << "testChromatogram():\n";
572 
573  Chromatogram a;
574 
575  a.index = 123;
576  a.id = "goo";
577  a.defaultArrayLength = 666;
580  for (size_t i=0; i<a.defaultArrayLength; i++)
581  a.binaryDataArrayPtrs.back()->data.push_back(i);
582  a.binaryDataArrayPtrs.back()->set(MS_time_array);
584  for (size_t i=0; i<a.defaultArrayLength; i++)
585  a.binaryDataArrayPtrs.back()->data.push_back(i*2);
587  a.cvParams.push_back(MS_total_ion_current_chromatogram); // TODO: fix when CV has appropriate terms
588 
589  // write 'a' out to a stream
590 
591  ostringstream oss;
592  XMLWriter writer(oss);
593  IO::write(writer, a);
594  if (os_) *os_ << oss.str() << endl;
595 
596  // read 'b' in from stream
597 
598  Chromatogram b;
599  istringstream iss(oss.str());
600  IO::read(iss, b, IO::ReadBinaryData);
601  unit_assert(b.sourceFilePosition == 0); // not -1
602 
603  // compare 'a' and 'b'
604 
606  if (diff && os_) *os_ << "diff:\n" << diff << endl;
607  unit_assert(!diff);
608 
609  // test IgnoreBinaryData
610 
611  Chromatogram c;
612  iss.seekg(0);
613  IO::read(iss, c); // default = IgnoreBinaryData
614  unit_assert(c.binaryDataArrayPtrs.empty());
615  unit_assert(c.sourceFilePosition == 0); // not -1
616 
617  a.binaryDataArrayPtrs.clear();
618  diff(a, c);
619  unit_assert(!diff);
620 }
std::string id
a unique identifier for this chromatogram. It should be expected that external files may use this ide...
Definition: MSData.hpp:494
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
MS_total_ion_current_chromatogram
total ion current chromatogram: Chromatogram obtained by plotting the total ion current detected in e...
Definition: cv.hpp:947
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
ReadBinaryData
Definition: IO.hpp:173
ostream * os_
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: MSData.hpp:572
size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
Definition: MSData.hpp:491
A single chromatogram.
Definition: MSData.hpp:569
MS_intensity_array
intensity array: A data array of intensity values.
Definition: cv.hpp:1991
void diff(const string &filename1, const string &filename2)
MS_time_array
time array: A data array of relative time offset values from a reference time.
Definition: cv.hpp:2279
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:247
boost::iostreams::stream_offset sourceFilePosition
for file-based MSData implementations, this attribute may refer to the chromatogram&#39;s position in the...
Definition: MSData.hpp:497
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
PWIZ_API_DECL void read(std::istream &is, CV &cv)
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the &#39;id&#39; of the appropriate dataProcessing.
Definition: MSData.hpp:575
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: MSData.hpp:584
#define unit_assert(x)
Definition: unit.hpp:82
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:416
void testSpectrumList ( )

Definition at line 623 of file IOTest.cpp.

References pwiz::msdata::SpectrumListSimple::dp, pwiz::msdata::SpectrumListSimple::spectra, and testObject_SpectrumList().

624 {
626 
627  SpectrumPtr spectrum1(new Spectrum);
628  spectrum1->id = "goober";
629  spectrum1->index = 0;
630  spectrum1->defaultArrayLength = 666;
631  spectrum1->userParams.push_back(UserParam("description1"));
632 
633  SpectrumPtr spectrum2(new Spectrum);
634  spectrum2->id = "raisinet";
635  spectrum2->index = 1;
636  spectrum2->defaultArrayLength = 667;
637  spectrum2->userParams.push_back(UserParam("description2"));
638 
639  a.spectra.push_back(spectrum1);
640  a.spectra.push_back(spectrum2);
641  a.dp = DataProcessingPtr(new DataProcessing("dp"));
642 
644 }
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:565
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
void testObject_SpectrumList(const SpectrumList &a)
Definition: IOTest.cpp:93
std::vector< SpectrumPtr > spectra
Definition: MSData.hpp:719
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: MSData.hpp:504
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:717
void testSpectrumListWithPositions ( )

Definition at line 647 of file IOTest.cpp.

References os_, pwiz::msdata::SpectrumListSimple::spectra, unit_assert, and pwiz::identdata::IO::write().

Referenced by test().

648 {
649  if (os_) *os_ << "testSpectrumListWithPositions()\n ";
650 
652 
653  SpectrumPtr spectrum1(new Spectrum);
654  spectrum1->id = "goober";
655  spectrum1->index = 0;
656  spectrum1->defaultArrayLength = 666;
657  spectrum1->userParams.push_back(UserParam("description1"));
658 
659  SpectrumPtr spectrum2(new Spectrum);
660  spectrum2->id = "raisinet";
661  spectrum2->index = 1;
662  spectrum2->defaultArrayLength = 667;
663  spectrum2->userParams.push_back(UserParam("description2"));
664 
665  a.spectra.push_back(spectrum1);
666  a.spectra.push_back(spectrum2);
667 
668  ostringstream oss;
669  XMLWriter writer(oss);
670  vector<stream_offset> positions;
671  MSData dummy;
672  IO::write(writer, a, dummy, BinaryDataEncoder::Config(), &positions);
673 
674  if (os_)
675  {
676  copy(positions.begin(), positions.end(), ostream_iterator<stream_offset>(*os_, " "));
677  *os_ << endl << oss.str() << endl;
678  *os_ << "\n\n";
679  }
680 
681  unit_assert(positions.size() == 2);
682  unit_assert(positions[0] == 27);
683  unit_assert(positions[1] == 179);
684 }
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:565
ostream * os_
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
encoding/decoding configuration
std::vector< SpectrumPtr > spectra
Definition: MSData.hpp:719
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: MSData.hpp:504
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:850
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:717
#define unit_assert(x)
Definition: unit.hpp:82
void testSpectrumListWriteProgress ( )

Definition at line 722 of file IOTest.cpp.

References pwiz::util::IterationListenerRegistry::addListener(), TestIterationListener::indices(), TestIterationListener_WithCancel::indices(), boost::lexical_cast(), os_, pwiz::msdata::SpectrumListSimple::spectra, unit_assert, and pwiz::identdata::IO::write().

Referenced by test().

723 {
724  if (os_) *os_ << "testSpectrumListWriteProgress()\n ";
725 
727 
728  for (size_t i=0; i<11; i++)
729  {
730  SpectrumPtr spectrum(new Spectrum);
731  spectrum->id = "goober_" + lexical_cast<string>(i);
732  spectrum->index = i;
733  spectrum->defaultArrayLength = 666;
734  a.spectra.push_back(spectrum);
735  }
736 
737  ostringstream oss;
738  XMLWriter writer(oss);
739 
741  TestIterationListener& listener = *boost::static_pointer_cast<TestIterationListener>(listenerPtr);
742  IterationListenerRegistry registry;
743  registry.addListener(listenerPtr, 3); // callbacks: 0,2,5,8,10
744 
745  MSData dummy;
746  IO::write(writer, a, dummy, BinaryDataEncoder::Config(), 0, &registry);
747 
748  if (os_)
749  {
750  *os_ << "callback indices: ";
751  copy(listener.indices().begin(), listener.indices().end(),
752  ostream_iterator<size_t>(*os_, " "));
753  *os_ << "\n\n";
754  }
755 
756  unit_assert(listener.indices().size() == 5);
757  unit_assert(listener.indices()[0] == 0);
758  unit_assert(listener.indices()[1] == 2);
759  unit_assert(listener.indices()[2] == 5);
760  unit_assert(listener.indices()[3] == 8);
761  unit_assert(listener.indices()[4] == 10);
762 
763  // test #2, this time with cancel at index 6
764 
766  TestIterationListener_WithCancel& cancelListener = *boost::static_pointer_cast<TestIterationListener_WithCancel>(cancelListenerPtr);
767  IterationListenerRegistry registry2;
768  registry2.addListener(cancelListenerPtr, 3); // callbacks: 0,2, cancel at 5
769 
770  ostringstream oss2;
771  XMLWriter writer2(oss2);
772  IO::write(writer2, a, dummy, BinaryDataEncoder::Config(), 0, &registry2);
773 
774  if (os_)
775  {
776  *os_ << "callback indices: ";
777  copy(cancelListener.indices().begin(), cancelListener.indices().end(),
778  ostream_iterator<size_t>(*os_, " "));
779  *os_ << "\n\n";
780  }
781 
782  unit_assert(cancelListener.indices().size() == 2);
783  unit_assert(cancelListener.indices()[0] == 0);
784  unit_assert(cancelListener.indices()[1] == 2);
785 }
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
void addListener(const IterationListenerPtr &listener, size_t iterationPeriod)
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:565
ostream * os_
float lexical_cast(const std::string &str)
boost::shared_ptr< IterationListener > IterationListenerPtr
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
const vector< size_t > & indices() const
Definition: IOTest.cpp:715
encoding/decoding configuration
std::vector< SpectrumPtr > spectra
Definition: MSData.hpp:719
handles registration of IterationListeners and broadcast of update messages
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: MSData.hpp:504
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:850
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:717
#define unit_assert(x)
Definition: unit.hpp:82
const vector< size_t > & indices() const
Definition: IOTest.cpp:697
void testChromatogramList ( )

Definition at line 788 of file IOTest.cpp.

References pwiz::msdata::ChromatogramListSimple::chromatograms, pwiz::msdata::ChromatogramListSimple::dp, and testObject_ChromatogramList().

789 {
791 
792  ChromatogramPtr chromatogram1(new Chromatogram);
793  chromatogram1->id = "goober";
794  chromatogram1->index = 0;
795  chromatogram1->defaultArrayLength = 666;
796 
797  ChromatogramPtr chromatogram2(new Chromatogram);
798  chromatogram2->id = "raisinet";
799  chromatogram2->index = 1;
800  chromatogram2->defaultArrayLength = 667;
801 
802  a.chromatograms.push_back(chromatogram1);
803  a.chromatograms.push_back(chromatogram2);
804  a.dp = DataProcessingPtr(new DataProcessing("dp"));
805 
807 }
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
std::vector< ChromatogramPtr > chromatograms
Definition: MSData.hpp:793
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
A single chromatogram.
Definition: MSData.hpp:569
void testObject_ChromatogramList(const ChromatogramList &a)
Definition: IOTest.cpp:120
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:791
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:616
void testChromatogramListWithPositions ( )

Definition at line 810 of file IOTest.cpp.

References pwiz::msdata::ChromatogramListSimple::chromatograms, os_, unit_assert, and pwiz::identdata::IO::write().

Referenced by test().

811 {
812  if (os_) *os_ << "testChromatogramListWithPositions()\n ";
813 
815 
816  ChromatogramPtr chromatogram1(new Chromatogram);
817  chromatogram1->id = "goober";
818  chromatogram1->index = 0;
819  chromatogram1->defaultArrayLength = 666;
820 
821  ChromatogramPtr chromatogram2(new Chromatogram);
822  chromatogram2->id = "raisinet";
823  chromatogram2->index = 1;
824  chromatogram2->defaultArrayLength = 667;
825 
826  a.chromatograms.push_back(chromatogram1);
827  a.chromatograms.push_back(chromatogram2);
828 
829  ostringstream oss;
830  XMLWriter writer(oss);
831  vector<stream_offset> positions;
832  IO::write(writer, a, BinaryDataEncoder::Config(), &positions);
833 
834  if (os_)
835  {
836  copy(positions.begin(), positions.end(), ostream_iterator<stream_offset>(*os_, " "));
837  *os_ << endl << oss.str() << endl;
838  *os_ << "\n\n";
839  }
840 
841  unit_assert(positions.size() == 2);
842  unit_assert(positions[0] == 31);
843  unit_assert(positions[1] == 113);
844 }
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
std::vector< ChromatogramPtr > chromatograms
Definition: MSData.hpp:793
ostream * os_
A single chromatogram.
Definition: MSData.hpp:569
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:791
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
encoding/decoding configuration
#define unit_assert(x)
Definition: unit.hpp:82
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:616
void testRun ( )

Definition at line 847 of file IOTest.cpp.

References pwiz::msdata::Run::chromatogramListPtr, pwiz::msdata::Run::defaultInstrumentConfigurationPtr, pwiz::msdata::Run::defaultSourceFilePtr, diff(), pwiz::msdata::Run::id, IgnoreSpectrumList, os_, pwiz::identdata::IO::read(), pwiz::msdata::Run::samplePtr, pwiz::msdata::Run::spectrumListPtr, pwiz::msdata::Run::startTimeStamp, unit_assert, and pwiz::identdata::IO::write().

848 {
849  if (os_) *os_ << "testRun():\n";
850 
851  Run a;
852 
853  a.id = "goober";
855  a.samplePtr = SamplePtr(new Sample("sample"));
856  a.startTimeStamp = "20 April 2004 4:20pm";
858 
859  // spectrumList
860 
861  shared_ptr<SpectrumListSimple> spectrumListSimple(new SpectrumListSimple);
862 
863  SpectrumPtr spectrum1(new Spectrum);
864  spectrum1->id = "goober";
865  spectrum1->index = 0;
866  spectrum1->defaultArrayLength = 666;
867  spectrum1->userParams.push_back(UserParam("description1"));
868 
869  SpectrumPtr spectrum2(new Spectrum);
870  spectrum2->id = "raisinet";
871  spectrum2->index = 1;
872  spectrum2->defaultArrayLength = 667;
873  spectrum2->userParams.push_back(UserParam("description2"));
874 
875  spectrumListSimple->spectra.push_back(spectrum1);
876  spectrumListSimple->spectra.push_back(spectrum2);
877 
878  a.spectrumListPtr = spectrumListSimple;
879 
880  // chromatogramList
881 
882  shared_ptr<ChromatogramListSimple> chromatogramListSimple(new ChromatogramListSimple);
883 
884  ChromatogramPtr chromatogram1(new Chromatogram);
885  chromatogram1->id = "goober";
886  chromatogram1->index = 0;
887  chromatogram1->defaultArrayLength = 666;
888 
889  ChromatogramPtr chromatogram2(new Chromatogram);
890  chromatogram2->id = "raisinet";
891  chromatogram2->index = 1;
892  chromatogram2->defaultArrayLength = 667;
893 
894  chromatogramListSimple->chromatograms.push_back(chromatogram1);
895  chromatogramListSimple->chromatograms.push_back(chromatogram2);
896 
897  a.chromatogramListPtr = chromatogramListSimple;
898 
899  // write 'a' out to a stream
900 
901  MSData dummy;
902 
903  ostringstream oss;
904  XMLWriter writer(oss);
905  IO::write(writer, a, dummy);
906  if (os_) *os_ << oss.str() << endl;
907 
908  // read 'b' in from stream, ignoring SpectrumList (default)
909 
910  Run b;
911  istringstream iss(oss.str());
912  IO::read(iss, b, IO::IgnoreSpectrumList); // IO::IgnoreSpectrumList
913 
914  // compare 'a' and 'b'
915 
917  if (diff && os_) *os_ << "diff:\n" << diff << endl;
918  unit_assert(diff);
919  unit_assert(diff.a_b.spectrumListPtr.get());
920  unit_assert(diff.a_b.spectrumListPtr->size() == 1);
921  unit_assert(diff.a_b.spectrumListPtr->spectrum(0)->userParams.size() == 1);
922 
923  // read 'c' in from stream, reading SpectrumList
924 
925  Run c;
926  iss.seekg(0);
927  IO::read(iss, c, IO::ReadSpectrumList);
928 
929  // compare 'a' and 'c'
930 
931  diff(a,c);
932  if (diff && os_) *os_ << "diff:\n" << diff << endl;
933  unit_assert(!diff);
934 
935  // remove SpectrumList and ChromatogramList from a, and compare to b
936 
937  a.spectrumListPtr.reset();
938  a.chromatogramListPtr.reset();
939  diff(a, b);
940  unit_assert(!diff);
941 }
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
Description of the source file, including location and type.
Definition: MSData.hpp:53
IgnoreSpectrumList
Definition: IO.hpp:212
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
Definition: MSData.hpp:831
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:565
ostream * os_
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
A single chromatogram.
Definition: MSData.hpp:569
std::string id
a unique identifier for this run.
Definition: MSData.hpp:813
void diff(const string &filename1, const string &filename2)
SourceFilePtr defaultSourceFilePtr
default source file reference
Definition: MSData.hpp:825
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
A run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:810
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:791
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
std::string startTimeStamp
the optional start timestamp of the run, in UT.
Definition: MSData.hpp:822
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
Definition: MSData.hpp:228
boost::shared_ptr< InstrumentConfiguration > InstrumentConfigurationPtr
Definition: MSData.hpp:249
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:828
PWIZ_API_DECL void read(std::istream &is, CV &cv)
Expansible description of the sample used to generate the dataset, named in sampleName.
Definition: MSData.hpp:100
boost::shared_ptr< Sample > SamplePtr
Definition: MSData.hpp:117
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: MSData.hpp:504
SamplePtr samplePtr
this attribute MUST reference the &#39;id&#39; of the appropriate sample.
Definition: MSData.hpp:819
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:850
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:717
#define unit_assert(x)
Definition: unit.hpp:82
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:616
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition: MSData.hpp:75
InstrumentConfigurationPtr defaultInstrumentConfigurationPtr
this attribute MUST reference the &#39;id&#39; of the default instrument configuration. If a scan does not re...
Definition: MSData.hpp:816
void initializeTestData ( MSData msd)

Definition at line 944 of file IOTest.cpp.

References pwiz::msdata::MSData::accession, pwiz::msdata::Precursor::activation, pwiz::msdata::Spectrum::binaryDataArrayPtrs, pwiz::msdata::Chromatogram::binaryDataArrayPtrs, pwiz::msdata::Run::chromatogramListPtr, pwiz::msdata::FileDescription::contacts, pwiz::cv::cv(), pwiz::data::ParamContainer::cvParams, pwiz::msdata::MSData::cvs, pwiz::msdata::MSData::dataProcessingPtrs, pwiz::msdata::Spectrum::defaultArrayLength, pwiz::msdata::Chromatogram::defaultArrayLength, pwiz::msdata::Run::defaultInstrumentConfigurationPtr, pwiz::msdata::Run::defaultSourceFilePtr, pwiz::msdata::FileDescription::fileContent, pwiz::msdata::MSData::fileDescription, pwiz::cv::CV::fullName, pwiz::msdata::SpectrumIdentity::id, pwiz::msdata::ChromatogramIdentity::id, pwiz::msdata::Run::id, pwiz::msdata::MSData::id, pwiz::cv::CV::id, pwiz::msdata::SpectrumIdentity::index, pwiz::msdata::ChromatogramIdentity::index, pwiz::msdata::Scan::instrumentConfigurationPtr, pwiz::msdata::MSData::instrumentConfigurationPtrs, MS_base_peak_intensity, MS_base_peak_m_z, MS_Bioworks, MS_centroid_spectrum, MS_charge_deconvolution, MS_charge_state, MS_collision_energy, MS_collision_induced_dissociation, MS_contact_address, MS_contact_email, MS_contact_name, MS_contact_URL, MS_Conversion_to_mzML, MS_deisotoping, MS_electron_multiplier, MS_filter_string, MS_full_scan, MS_highest_observed_m_z, MS_instrument_serial_number, MS_intensity_array, MS_LCQ_Deca, MS_lowest_observed_m_z, MS_m_z, MS_m_z_array, MS_ms_level, MS_MSn_spectrum, MS_nanoelectrospray, MS_peak_picking, MS_positive_scan, MS_pwiz, MS_quadrupole_ion_trap, MS_scan_start_time, MS_scan_window_lower_limit, MS_scan_window_upper_limit, MS_selected_ion_m_z, MS_SHA_1, MS_Thermo_RAW_file, MS_time_array, MS_total_ion_current, MS_total_ion_current_chromatogram, MS_Xcalibur, pwiz::msdata::ProcessingMethod::order, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::msdata::Spectrum::precursors, pwiz::msdata::MSData::run, pwiz::msdata::Run::samplePtr, pwiz::msdata::MSData::samplePtrs, pwiz::msdata::Spectrum::scanList, pwiz::msdata::ScanList::scans, pwiz::msdata::MSData::scanSettingsPtrs, pwiz::msdata::Scan::scanWindows, pwiz::msdata::Precursor::selectedIons, pwiz::data::ParamContainer::set(), pwiz::msdata::ProcessingMethod::softwarePtr, pwiz::msdata::MSData::softwarePtrs, pwiz::msdata::FileDescription::sourceFilePtrs, pwiz::msdata::Precursor::spectrumID, pwiz::msdata::Run::spectrumListPtr, pwiz::msdata::Run::startTimeStamp, UO_electronvolt, UO_minute, pwiz::cv::CV::URI, pwiz::data::ParamContainer::userParams, and pwiz::cv::CV::version.

Referenced by testMSData().

945 {
946  msd.accession = "test accession";
947  msd.id = "test id";
948 
949  // cvList
950 
951  msd.cvs.resize(1);
952  CV& cv = msd.cvs.front();
953  cv.URI = "http://psidev.sourceforge.net/ms/xml/mzdata/psi-ms.2.0.2.obo";
954  cv.id = "MS";
955  cv.fullName = "Proteomics Standards Initiative Mass Spectrometry Ontology";
956  cv.version = "2.0.2";
957 
958  // fileDescription
959 
961  fc.cvParams.push_back(MS_MSn_spectrum);
962  fc.userParams.push_back(UserParam("number of cats", "4"));
963 
964  SourceFilePtr sfp(new SourceFile);
965  sfp->id = "1";
966  sfp->name = "tiny1.RAW";
967  sfp->location = "file://F:/data/Exp01";
968  sfp->cvParams.push_back(MS_Thermo_RAW_file);
969  sfp->cvParams.push_back(CVParam(MS_SHA_1,"71be39fb2700ab2f3c8b2234b91274968b6899b1"));
970  msd.fileDescription.sourceFilePtrs.push_back(sfp);
971 
972  SourceFilePtr sfp_parameters(new SourceFile("sf_parameters", "parameters.par", "file:///C:/settings/"));
973  msd.fileDescription.sourceFilePtrs.push_back(sfp_parameters);
974 
975  msd.fileDescription.contacts.resize(1);
976  Contact& contact = msd.fileDescription.contacts.front();
977  contact.cvParams.push_back(CVParam(MS_contact_name, "William Pennington"));
978  contact.cvParams.push_back(CVParam(MS_contact_address,
979  "Higglesworth University, 12 Higglesworth Avenue, 12045, HI, USA"));
980  contact.cvParams.push_back(CVParam(MS_contact_URL, "http://www.higglesworth.edu/"));
981  contact.cvParams.push_back(CVParam(MS_contact_email, "wpennington@higglesworth.edu"));
982 
983  // paramGroupList
984 
985  ParamGroupPtr pg1(new ParamGroup);
986  pg1->id = "CommonMS1SpectrumParams";
987  pg1->cvParams.push_back(MS_positive_scan);
988  pg1->cvParams.push_back(MS_full_scan);
989  msd.paramGroupPtrs.push_back(pg1);
990 
991  ParamGroupPtr pg2(new ParamGroup);
992  pg2->id = "CommonMS2SpectrumParams";
993  pg2->cvParams.push_back(MS_positive_scan);
994  pg2->cvParams.push_back(MS_full_scan);
995  msd.paramGroupPtrs.push_back(pg2);
996 
997  // sampleList
998 
999  SamplePtr samplePtr(new Sample);
1000  samplePtr->id = "1";
1001  samplePtr->name = "Sample1";
1002  msd.samplePtrs.push_back(samplePtr);
1003 
1004  // instrumentConfigurationList
1005 
1006  InstrumentConfigurationPtr instrumentConfigurationPtr(new InstrumentConfiguration);
1007  instrumentConfigurationPtr->id = "LCQ Deca";
1008  instrumentConfigurationPtr->cvParams.push_back(MS_LCQ_Deca);
1009  instrumentConfigurationPtr->cvParams.push_back(CVParam(MS_instrument_serial_number,"23433"));
1010  instrumentConfigurationPtr->componentList.push_back(Component(MS_nanoelectrospray, 1));
1011  instrumentConfigurationPtr->componentList.push_back(Component(MS_quadrupole_ion_trap, 2));
1012  instrumentConfigurationPtr->componentList.push_back(Component(MS_electron_multiplier, 3));
1013 
1014  SoftwarePtr softwareXcalibur(new Software);
1015  softwareXcalibur->id = "Xcalibur";
1016  softwareXcalibur->set(MS_Xcalibur);
1017  softwareXcalibur->version = "2.0.5";
1018  instrumentConfigurationPtr->softwarePtr = softwareXcalibur;
1019 
1020  msd.instrumentConfigurationPtrs.push_back(instrumentConfigurationPtr);
1021 
1022  // softwareList
1023 
1024  SoftwarePtr softwareBioworks(new Software);
1025  softwareBioworks->id = "Bioworks";
1026  softwareBioworks->set(MS_Bioworks);
1027  softwareBioworks->version = "3.3.1 sp1";
1028 
1029  SoftwarePtr software_pwiz(new Software);
1030  software_pwiz->id = "pwiz";
1031  software_pwiz->set(MS_pwiz);
1032  software_pwiz->version = "1.0";
1033 
1034  msd.softwarePtrs.push_back(softwareBioworks);
1035  msd.softwarePtrs.push_back(software_pwiz);
1036  msd.softwarePtrs.push_back(softwareXcalibur);
1037 
1038  // dataProcessingList
1039 
1040  DataProcessingPtr dpXcalibur(new DataProcessing);
1041  dpXcalibur->id = "Xcalibur Processing";
1042 
1043  ProcessingMethod procXcal;
1044  procXcal.order = 1;
1045  procXcal.softwarePtr = softwareXcalibur;
1046  procXcal.cvParams.push_back(CVParam(MS_deisotoping, false));
1047  procXcal.cvParams.push_back(CVParam(MS_charge_deconvolution, false));
1048  procXcal.cvParams.push_back(CVParam(MS_peak_picking, true));
1049 
1050  dpXcalibur->processingMethods.push_back(procXcal);
1051 
1052  DataProcessingPtr dp_msconvert(new DataProcessing);
1053  dp_msconvert->id = "pwiz conversion";
1054 
1055  ProcessingMethod proc_msconvert;
1056  proc_msconvert.order = 2;
1057  proc_msconvert.softwarePtr = software_pwiz;
1058  proc_msconvert.cvParams.push_back(MS_Conversion_to_mzML);
1059 
1060  dp_msconvert->processingMethods.push_back(proc_msconvert);
1061 
1062  msd.dataProcessingPtrs.push_back(dpXcalibur);
1063  msd.dataProcessingPtrs.push_back(dp_msconvert);
1064 
1065  ScanSettingsPtr as1(new ScanSettings("as1"));
1066  as1->sourceFilePtrs.push_back(sfp_parameters);
1067  Target t1;
1068  t1.set(MS_m_z, 1000);
1069  Target t2;
1070  t2.set(MS_m_z, 1200);
1071  as1->targets.push_back(t1);
1072  as1->targets.push_back(t2);
1073  msd.scanSettingsPtrs.push_back(as1);
1074 
1075  // run
1076 
1077  msd.run.id = "Exp01";
1078  msd.run.defaultInstrumentConfigurationPtr = instrumentConfigurationPtr;
1079  msd.run.samplePtr = samplePtr;
1080  msd.run.startTimeStamp = "2007-06-27T15:23:45.00035";
1081  msd.run.defaultSourceFilePtr = sfp;
1082 
1083  shared_ptr<SpectrumListSimple> spectrumList(new SpectrumListSimple);
1084  msd.run.spectrumListPtr = spectrumList;
1085 
1086  spectrumList->spectra.push_back(SpectrumPtr(new Spectrum));
1087  spectrumList->spectra.push_back(SpectrumPtr(new Spectrum));
1088 
1089  Spectrum& s19 = *spectrumList->spectra[0];
1090  s19.id = "S19";
1091  s19.index = 0;
1092  s19.defaultArrayLength = 10;
1093  s19.cvParams.push_back(MS_MSn_spectrum);
1094  s19.set(MS_ms_level, 1);
1095  s19.cvParams.push_back(MS_centroid_spectrum);
1096  s19.cvParams.push_back(CVParam(MS_lowest_observed_m_z, 400.39));
1097  s19.cvParams.push_back(CVParam(MS_highest_observed_m_z, 1795.56));
1098  s19.cvParams.push_back(CVParam(MS_base_peak_m_z, 445.347));
1099  s19.cvParams.push_back(CVParam(MS_base_peak_intensity, 120053));
1100  s19.cvParams.push_back(CVParam(MS_total_ion_current, 1.66755e+007));
1101  s19.scanList.scans.push_back(Scan());
1102  Scan& s19scan = s19.scanList.scans.back();
1103  s19scan.instrumentConfigurationPtr = instrumentConfigurationPtr;
1104  s19scan.paramGroupPtrs.push_back(pg1);
1105  s19scan.cvParams.push_back(CVParam(MS_scan_start_time, 5.890500, UO_minute));
1106  s19scan.cvParams.push_back(CVParam(MS_filter_string, "+ c NSI Full ms [ 400.00-1800.00]"));
1107  s19scan.scanWindows.resize(1);
1108  ScanWindow& window = s19scan.scanWindows.front();
1109  window.cvParams.push_back(CVParam(MS_scan_window_lower_limit, 400.000000));
1110  window.cvParams.push_back(CVParam(MS_scan_window_upper_limit, 1800.000000));
1111 
1112  BinaryDataArrayPtr s19_mz(new BinaryDataArray);
1113  s19_mz->dataProcessingPtr = dpXcalibur;
1114  s19_mz->cvParams.push_back(MS_m_z_array);
1115  s19_mz->data.resize(10);
1116  for (int i=0; i<10; i++)
1117  s19_mz->data[i] = i;
1118 
1119  BinaryDataArrayPtr s19_intensity(new BinaryDataArray);
1120  s19_intensity->dataProcessingPtr = dpXcalibur;
1121  s19_intensity->cvParams.push_back(MS_intensity_array);
1122  s19_intensity->data.resize(10);
1123  for (int i=0; i<10; i++)
1124  s19_intensity->data[i] = 10-i;
1125 
1126  s19.binaryDataArrayPtrs.push_back(s19_mz);
1127  s19.binaryDataArrayPtrs.push_back(s19_intensity);
1128 
1129  Spectrum& s20 = *spectrumList->spectra[1];
1130  s20.id = "S20";
1131  s20.index = 1;
1132  s20.defaultArrayLength = 10;
1133 
1134  s20.cvParams.push_back(MS_MSn_spectrum);
1135  s20.set(MS_ms_level, 2);
1136 
1137  s20.cvParams.push_back(MS_centroid_spectrum);
1138  s20.cvParams.push_back(CVParam(MS_lowest_observed_m_z, 320.39));
1139  s20.cvParams.push_back(CVParam(MS_highest_observed_m_z, 1003.56));
1140  s20.cvParams.push_back(CVParam(MS_base_peak_m_z, 456.347));
1141  s20.cvParams.push_back(CVParam(MS_base_peak_intensity, 23433));
1142  s20.cvParams.push_back(CVParam(MS_total_ion_current, 1.66755e+007));
1143 
1144  s20.precursors.resize(1);
1145  Precursor& precursor = s20.precursors.front();
1146  precursor.spectrumID= s19.id;
1147  precursor.selectedIons.resize(1);
1148  precursor.selectedIons[0].cvParams.push_back(CVParam(MS_selected_ion_m_z, 445.34));
1149  precursor.selectedIons[0].cvParams.push_back(CVParam(MS_charge_state, 2));
1151  precursor.activation.cvParams.push_back(CVParam(MS_collision_energy, 35.00, UO_electronvolt));
1152 
1153  s20.scanList.scans.push_back(Scan());
1154  Scan& s20scan = s20.scanList.scans.back();
1155  s20scan.instrumentConfigurationPtr = instrumentConfigurationPtr;
1156  s20scan.paramGroupPtrs.push_back(pg2);
1157  s20scan.cvParams.push_back(CVParam(MS_scan_start_time, 5.990500, UO_minute));
1158  s20scan.cvParams.push_back(CVParam(MS_filter_string, "+ c d Full ms2 445.35@cid35.00 [ 110.00-905.00]"));
1159  s20scan.scanWindows.resize(1);
1160  ScanWindow& window2 = s20scan.scanWindows.front();
1161  window2.cvParams.push_back(CVParam(MS_scan_window_lower_limit, 110.000000));
1162  window2.cvParams.push_back(CVParam(MS_scan_window_upper_limit, 905.000000));
1163 
1164  BinaryDataArrayPtr s20_mz(new BinaryDataArray);
1165  s20_mz->dataProcessingPtr = dpXcalibur;
1166  s20_mz->cvParams.push_back(MS_m_z_array);
1167  s20_mz->data.resize(10);
1168  for (int i=0; i<10; i++)
1169  s20_mz->data[i] = i;
1170 
1171  BinaryDataArrayPtr s20_intensity(new BinaryDataArray);
1172  s20_intensity->dataProcessingPtr = dpXcalibur;
1173  s20_intensity->cvParams.push_back(MS_intensity_array);
1174  s20_intensity->data.resize(10);
1175  for (int i=0; i<10; i++)
1176  s20_intensity->data[i] = 10-i;
1177 
1178  s20.binaryDataArrayPtrs.push_back(s20_mz);
1179  s20.binaryDataArrayPtrs.push_back(s20_intensity);
1180 
1181  // chromatograms
1182 
1183  shared_ptr<ChromatogramListSimple> chromatogramList(new ChromatogramListSimple);
1184  msd.run.chromatogramListPtr = chromatogramList;
1185 
1186  chromatogramList->chromatograms.push_back(ChromatogramPtr(new Chromatogram));
1187 
1188  Chromatogram& tic = *chromatogramList->chromatograms[0];
1189  tic.id = "tic";
1190  tic.index = 0;
1191  tic.defaultArrayLength = 10;
1193 
1194  BinaryDataArrayPtr tic_time(new BinaryDataArray);
1195  tic_time->dataProcessingPtr = dp_msconvert;
1196  tic_time->cvParams.push_back(MS_time_array);
1197  tic_time->data.resize(10);
1198  for (int i=0; i<10; i++)
1199  tic_time->data[i] = i;
1200 
1201  BinaryDataArrayPtr tic_intensity(new BinaryDataArray);
1202  tic_intensity->dataProcessingPtr = dp_msconvert;
1203  tic_intensity->cvParams.push_back(MS_intensity_array);
1204  tic_intensity->data.resize(10);
1205  for (int i=0; i<10; i++)
1206  tic_intensity->data[i] = 10-i;
1207 
1208  tic.binaryDataArrayPtrs.push_back(tic_time);
1209  tic.binaryDataArrayPtrs.push_back(tic_intensity);
1210 }
MS_contact_address
contact address: Postal address of the contact person or organization.
Definition: cv.hpp:2252
std::string id
the short label to be used as a reference tag with which to refer to this particular Controlled Vocab...
Definition: cv.hpp:10159
Structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam), or a reference to a predefined set of these in this mzML file (paramGroupRef).
Definition: MSData.hpp:79
MS_deisotoping
deisotoping: The removal of isotope peaks to represent the fragment ion as one data point and is comm...
Definition: cv.hpp:194
MS_Bioworks
Bioworks: Thermo Finnigan software for data analysis of peptides and proteins.
Definition: cv.hpp:2045
MS_charge_state
charge state: The charge state of the ion, single or multiple and positive or negatively charged...
Definition: cv.hpp:227
This summarizes the different types of spectra that can be expected in the file. This is expected to ...
Definition: MSData.hpp:49
MS_MSn_spectrum
MSn spectrum: MSn refers to multi-stage MS/MS experiments designed to record product ion spectra wher...
Definition: cv.hpp:2204
std::string id
a unique identifier for this chromatogram. It should be expected that external files may use this ide...
Definition: MSData.hpp:494
PWIZ_API_DECL const CV & cv(const std::string &prefix)
returns a CV object for the specified namespace (prefix); currently supported namespaces are: MS UO ...
std::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from...
Definition: MSData.hpp:89
MS_total_ion_current_chromatogram
total ion current chromatogram: Chromatogram obtained by plotting the total ion current detected in e...
Definition: cv.hpp:947
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
MS_full_scan
full scan: Feature of the ion trap mass spectrometer where MS data is acquired over a mass range...
Definition: cv.hpp:1940
ScanList scanList
list of scans
Definition: MSData.hpp:516
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:197
MS_base_peak_intensity
base peak intensity: The intensity of the greatest peak in the mass spectrum.
Definition: cv.hpp:1961
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:236
Description of the source file, including location and type.
Definition: MSData.hpp:53
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile...
Definition: MSData.hpp:368
std::vector< InstrumentConfigurationPtr > instrumentConfigurationPtrs
list and descriptions of instrument configurations.
Definition: MSData.hpp:878
The method of precursor ion selection and activation.
Definition: MSData.hpp:310
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
Definition: MSData.hpp:831
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: MSData.hpp:525
MS_highest_observed_m_z
highest observed m/z: Highest m/z value observed in the m/z array.
Definition: cv.hpp:2027
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i...
Definition: MSData.hpp:130
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:565
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:1247
MS_contact_URL
contact URL: Uniform Resource Locator related to the contact person or organization.
Definition: cv.hpp:2255
boost::shared_ptr< ScanSettings > ScanSettingsPtr
Definition: MSData.hpp:224
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:140
std::vector< Precursor > precursors
list and descriptions of precursors to the spectrum currently being described.
Definition: MSData.hpp:519
MS_positive_scan
positive scan: Polarity of the scan is positive.
Definition: cv.hpp:569
MS_nanoelectrospray
nanoelectrospray: Electrospray ionization at a flow rate less than ~25 nL/min. Nanoelectrospray is sy...
Definition: cv.hpp:1604
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
SoftwarePtr softwarePtr
this attribute MUST reference the &#39;id&#39; of the appropriate SoftwareType.
Definition: MSData.hpp:259
MS_Thermo_RAW_file
Thermo RAW file: Thermo Scientific RAW file format.
Definition: cv.hpp:2138
MS_electron_multiplier
electron multiplier: A device to amplify the current of a beam or packet of charged particles or phot...
Definition: cv.hpp:1052
MS_scan_window_upper_limit
scan window upper limit: The lower m/z bound of a mass spectrometer scan window.
Definition: cv.hpp:1946
Information about an ontology or CV source and a short &#39;lookup&#39; tag to refer to.
Definition: cv.hpp:10156
MS_collision_induced_dissociation
collision-induced dissociation: The dissociation of an ion after collisional excitation. The term collisional-activated dissociation is not recommended.
Definition: cv.hpp:578
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: MSData.hpp:572
size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
Definition: MSData.hpp:491
A single chromatogram.
Definition: MSData.hpp:569
FileDescription fileDescription
information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
Definition: MSData.hpp:863
FileContent fileContent
this summarizes the different types of spectra that can be expected in the file. This is expected to ...
Definition: MSData.hpp:86
MS_LCQ_Deca
LCQ Deca: ThermoFinnigan LCQ Deca.
Definition: cv.hpp:2111
std::vector< ScanSettingsPtr > scanSettingsPtrs
list with the descriptions of the acquisition settings applied prior to the start of data acquisition...
Definition: MSData.hpp:875
MS_ms_level
ms level: Stages of ms achieved in a multi stage mass spectrometry experiment.
Definition: cv.hpp:1979
MS_contact_email
contact email: Email address of the contact person or organization.
Definition: cv.hpp:2258
std::string id
an optional id for the mzML document. It is recommended to use LSIDs when possible.
Definition: MSData.hpp:856
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of the ion selected for fragmentation.
Definition: cv.hpp:2741
std::string id
a unique identifier for this run.
Definition: MSData.hpp:813
MS_filter_string
filter string: A string unique to Thermo instrument describing instrument settings for the scan...
Definition: cv.hpp:1982
MS_intensity_array
intensity array: A data array of intensity values.
Definition: cv.hpp:1991
MS_instrument_serial_number
instrument serial number: Serial Number of the instrument.
Definition: cv.hpp:2033
std::string fullName
the usual name for the resource (e.g. The PSI-MS Controlled Vocabulary).
Definition: cv.hpp:10165
MS_SHA_1
SHA-1: SHA-1 (Secure Hash Algorithm-1) is a cryptographic hash function designed by the National Secu...
Definition: cv.hpp:2156
SourceFilePtr defaultSourceFilePtr
default source file reference
Definition: MSData.hpp:825
MS_m_z_array
m/z array: A data array of m/z values.
Definition: cv.hpp:1988
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
Definition: MSData.hpp:475
MS_collision_energy
collision energy: Energy for an ion experiencing collision with a stationary gas particle resulting i...
Definition: cv.hpp:242
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: MSData.hpp:507
Description of the default peak processing method. This element describes the base method used in the...
Definition: MSData.hpp:253
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:250
std::string spectrumID
reference to the id attribute of the spectrum from which the precursor was selected.
Definition: MSData.hpp:322
int order
this attributes allows a series of consecutive steps to be placed in the correct order.
Definition: MSData.hpp:256
MS_time_array
time array: A data array of relative time offset values from a reference time.
Definition: cv.hpp:2279
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:791
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:215
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:1958
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:887
std::string accession
an optional accession number for the mzML document.
Definition: MSData.hpp:853
Activation activation
the type and energy level used for activation.
Definition: MSData.hpp:331
std::string URI
the URI for the resource.
Definition: cv.hpp:10162
std::vector< ScanWindow > scanWindows
container for a list of select windows.
Definition: MSData.hpp:386
MS_scan_window_lower_limit
scan window lower limit: The upper m/z bound of a mass spectrometer scan window.
Definition: cv.hpp:1949
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:247
std::vector< Contact > contacts
structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam), or a reference to a predefined set of these in this mzML file (paramGroupRef)
Definition: MSData.hpp:92
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Definition: MSData.hpp:472
std::vector< CV > cvs
container for one or more controlled vocabulary definitions.
Definition: MSData.hpp:860
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
Definition: ParamTypes.hpp:244
A piece of software.
Definition: MSData.hpp:178
std::string startTimeStamp
the optional start timestamp of the run, in UT.
Definition: MSData.hpp:822
InstrumentConfigurationPtr instrumentConfigurationPtr
this attribute MUST reference the &#39;id&#39; attribute of the appropriate instrument configuration.
Definition: MSData.hpp:383
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:321
UO_minute
minute: A time unit which is equal to 60 seconds.
Definition: cv.hpp:9392
std::vector< SamplePtr > samplePtrs
list and descriptions of samples.
Definition: MSData.hpp:869
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
Definition: MSData.hpp:228
boost::shared_ptr< InstrumentConfiguration > InstrumentConfigurationPtr
Definition: MSData.hpp:249
std::vector< Scan > scans
Definition: MSData.hpp:396
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
std::vector< SelectedIon > selectedIons
this list of precursor ions that were selected.
Definition: MSData.hpp:328
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:828
std::vector< ParamGroupPtr > paramGroupPtrs
container for a list of referenceableParamGroups
Definition: MSData.hpp:866
std::vector< SoftwarePtr > softwarePtrs
list and descriptions of software used to acquire and/or process the data in this mzML file...
Definition: MSData.hpp:872
Description of the acquisition settings of the instrument prior to the start of the run...
Definition: MSData.hpp:205
MS_centroid_spectrum
centroid spectrum: Processing of profile data to produce spectra that contains discrete peaks of zero...
Definition: cv.hpp:551
std::vector< DataProcessingPtr > dataProcessingPtrs
list and descriptions of data processing applied to this data.
Definition: MSData.hpp:881
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: MSData.hpp:584
MS_pwiz
pwiz (ProteoWizard): ProteoWizard software for data processing and analysis. Primarily developed by t...
Definition: cv.hpp:2348
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
MS_quadrupole_ion_trap
quadrupole ion trap: Quadrupole Ion Trap mass analyzer captures the ions in a three dimensional ion t...
Definition: cv.hpp:377
Expansible description of the sample used to generate the dataset, named in sampleName.
Definition: MSData.hpp:100
UO_electronvolt
electronvolt: A non-SI unit of energy (eV) defined as the energy acquired by a single unbound electro...
Definition: cv.hpp:10091
MS_Xcalibur
Xcalibur: Thermo Finnigan software for data acquisition and analysis.
Definition: cv.hpp:2042
boost::shared_ptr< Sample > SamplePtr
Definition: MSData.hpp:117
MS_charge_deconvolution
charge deconvolution: The determination of the mass of an ion based on the mass spectral peaks that r...
Definition: cv.hpp:197
MS_contact_name
contact name: Name of the contact person or organization.
Definition: cv.hpp:2249
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: MSData.hpp:504
std::string version
the version of the CV from which the referred-to terms are drawn.
Definition: cv.hpp:10168
SamplePtr samplePtr
this attribute MUST reference the &#39;id&#39; of the appropriate sample.
Definition: MSData.hpp:819
MS_lowest_observed_m_z
lowest observed m/z: Lowest m/z value observed in the m/z array.
Definition: cv.hpp:2030
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:717
MS_Conversion_to_mzML
Conversion to mzML: Conversion of a file format to Proteomics Standards Initiative mzData file format...
Definition: cv.hpp:2081
MS_peak_picking
peak picking: Spectral peak processing conducted on the acquired data to convert profile data to cent...
Definition: cv.hpp:200
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:616
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:416
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition: MSData.hpp:75
InstrumentConfigurationPtr defaultInstrumentConfigurationPtr
this attribute MUST reference the &#39;id&#39; of the default instrument configuration. If a scan does not re...
Definition: MSData.hpp:816
void testMSData ( )

Definition at line 1213 of file IOTest.cpp.

References pwiz::msdata::Run::chromatogramListPtr, diff(), initializeTestData(), os_, pwiz::identdata::IO::read(), pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, unit_assert, and pwiz::identdata::IO::write().

1214 {
1215  if (os_) *os_ << "testMSData():\n";
1216 
1217  MSData a;
1218  initializeTestData(a);
1219 
1220  // write 'a' out to a stream
1221 
1222  ostringstream oss;
1223  XMLWriter writer(oss);
1224  IO::write(writer, a);
1225  if (os_) *os_ << oss.str() << endl;
1226 
1227  // read 'b' in from stream, ignoring SpectrumList (default)
1228 
1229  MSData b;
1230  istringstream iss(oss.str());
1231  IO::read(iss, b); // IO::IgnoreSpectrumList
1232 
1233  // compare 'a' and 'b'
1234 
1236  if (diff && os_) *os_ << "diff:\n" << diff << endl;
1237  unit_assert(diff);
1238  unit_assert(diff.a_b.run.spectrumListPtr.get());
1239  unit_assert(diff.a_b.run.spectrumListPtr->size() == 1);
1240  unit_assert(diff.a_b.run.spectrumListPtr->spectrum(0)->userParams.size() == 1);
1241 
1242  // read 'c' in from stream, reading SpectrumList
1243 
1244  MSData c;
1245  iss.seekg(0);
1246  IO::read(iss, c, IO::ReadSpectrumList);
1247 
1248  // compare 'a' and 'c'
1249 
1250  diff(a,c);
1251  if (diff && os_) *os_ << "diff:\n" << diff << endl;
1252  unit_assert(!diff);
1253 
1254  // remove SpectrumList and ChromatogramList from a, and compare to b
1255 
1256  a.run.spectrumListPtr.reset();
1257  a.run.chromatogramListPtr.reset();
1258  diff(a, b);
1259  unit_assert(!diff);
1260 }
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
Definition: MSData.hpp:831
ostream * os_
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void initializeTestData(MSData &msd)
Definition: IOTest.cpp:944
void diff(const string &filename1, const string &filename2)
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:887
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:828
PWIZ_API_DECL void read(std::istream &is, CV &cv)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:850
#define unit_assert(x)
Definition: unit.hpp:82
void test ( )

Definition at line 1263 of file IOTest.cpp.

References testBinaryDataArray(), testBinaryDataArrayExternalMetadata(), testChromatogram(), testChromatogramList(), testChromatogramListWithPositions(), testComponent(), testComponentList(), testCV(), testCVParam(), testDataProcessing(), testFileDescription(), testInstrumentConfiguration(), testMSData(), testParamGroup(), testPrecursor(), testProcessingMethod(), testProduct(), testRun(), testSample(), testScan(), testScanList(), testScanSettings(), testSoftware(), testSourceFile(), testSpectrum, testSpectrumList(), testSpectrumListWithPositions(), testSpectrumListWriteProgress(), and testUserParam().

1264 {
1265  testCV();
1266  testUserParam();
1267  testCVParam();
1268  testParamGroup();
1269  testNamedParamContainer<FileContent>();
1270  testSourceFile();
1271  testNamedParamContainer<Contact>();
1273  testSample();
1274  testComponent();
1275  testComponentList();
1276  testSoftware();
1280  testNamedParamContainer<Target>();
1281  testScanSettings();
1282  testNamedParamContainer<IsolationWindow>();
1283  testNamedParamContainer<SelectedIon>();
1284  testNamedParamContainer<Activation>();
1285  testPrecursor();
1286  testProduct();
1287  testNamedParamContainer<ScanWindow>();
1288  testScan();
1289  testScanList();
1292  testSpectrum();
1293  testChromatogram();
1294  testSpectrumList();
1299  testRun();
1300  testMSData();
1301 }
void testMSData()
Definition: DiffTest.cpp:888
void testProcessingMethod()
Definition: DiffTest.cpp:281
void testSourceFile()
Definition: DiffTest.cpp:601
void testSpectrumList()
Definition: DiffTest.cpp:637
void testChromatogramListWithPositions()
Definition: IOTest.cpp:810
void testSpectrumListWithPositions()
Definition: IOTest.cpp:647
void testChromatogramList()
Definition: DiffTest.cpp:725
void testDataProcessing()
Definition: DiffTest.cpp:311
void testUserParam()
void testFileDescription()
Definition: DiffTest.cpp:84
void testChromatogram()
Definition: DiffTest.cpp:600
void testScanList()
Definition: DiffTest.cpp:456
const TestSpectrumInfo testSpectrum[]
void testRun()
Definition: DiffTest.cpp:828
void testBinaryDataArray()
Definition: DiffTest.cpp:487
void testScanSettings()
Definition: DiffTest.cpp:349
void testProduct()
Definition: DiffTest.cpp:407
void testInstrumentConfiguration()
Definition: DiffTest.cpp:249
void testComponent()
Definition: DiffTest.cpp:156
void testBinaryDataArrayExternalMetadata()
Definition: IOTest.cpp:466
void testParamGroup()
void testPrecursor()
Definition: DiffTest.cpp:375
void testScan()
void testComponentList()
Definition: DiffTest.cpp:194
void testCVParam()
void testCV()
void testSoftware()
void testSpectrumListWriteProgress()
Definition: IOTest.cpp:722
void testSample()
Definition: DiffTest.cpp:1151
int main ( int  argc,
char *  argv[] 
)

Definition at line 1304 of file IOTest.cpp.

References os_, test(), TEST_EPILOG, TEST_FAILED, and TEST_PROLOG_EX.

1305 {
1306  TEST_PROLOG_EX(argc, argv, "_MSData")
1307 
1308  try
1309  {
1310  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
1311  test();
1312  if (os_) *os_ << "ok\n";
1313  }
1314  catch (exception& e)
1315  {
1316  TEST_FAILED(e.what())
1317  }
1318  catch (...)
1319  {
1320  TEST_FAILED("Caught unknown exception.")
1321  }
1322 
1323  TEST_EPILOG
1324 }
ostream * os_
#define TEST_EPILOG
Definition: unit.hpp:166
#define TEST_PROLOG_EX(argc, argv, suffix)
Definition: unit.hpp:145
#define TEST_FAILED(x)
Definition: unit.hpp:160

Variable Documentation

ostream* os_ = 0

Definition at line 38 of file IOTest.cpp.

const char* bdaWithExternalMetadata
Initial value:
= "\
<binaryDataArray encodedLength=\"160\" arrayLength=\"15\"> \
<referenceableParamGroupRef ref=\"mz_params\"/> \
<binary>AAAAAAAAAAAAAAAAAADwPwAAAAAAAABAAAAAAAAACEAAAAAAAAAQQAAAAAAAABRAAAAAAAAAGEAAAAAAAAAcQAAAAAAAACBAAAAAAAAAIkAAAAAAAAAkQAAAAAAAACZAAAAAAAAAKEAAAAAAAAAqQAAAAAAAACxA</binary> \
</binaryDataArray>"

Definition at line 459 of file IOTest.cpp.

Referenced by testBinaryDataArrayExternalMetadata().