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

§ testObject()

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
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)
ostream * os_
Definition: IOTest.cpp:38
#define unit_assert(x)
Definition: unit.hpp:85

§ testObjectWithMSData()

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
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)
ostream * os_
Definition: IOTest.cpp:38
#define unit_assert(x)
Definition: unit.hpp:85

§ testObject_SpectrumList()

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
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)
ostream * os_
Definition: IOTest.cpp:38
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:712
#define unit_assert(x)
Definition: unit.hpp:85

§ testObject_ChromatogramList()

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
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:786
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
PWIZ_API_DECL void read(std::istream &is, CV &cv)
ostream * os_
Definition: IOTest.cpp:38
#define unit_assert(x)
Definition: unit.hpp:85

§ testCV()

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:13356
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:13353
std::string fullName
the usual name for the resource (e.g. The PSI-MS Controlled Vocabulary).
Definition: cv.hpp:13362
std::string URI
the URI for the resource.
Definition: cv.hpp:13359
std::string version
the version of the CV from which the referred-to terms are drawn.
Definition: cv.hpp:13365

§ testUserParam()

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.

Referenced by test().

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:12589
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

§ testCVParam()

void testCVParam ( )

Definition at line 170 of file IOTest.cpp.

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

Referenced by test().

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:12526
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of an selected ion.
Definition: cv.hpp:2749
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:223
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44

§ testParamGroup()

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.

Referenced by test().

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:239
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of an selected ion.
Definition: cv.hpp:2749
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:223
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:324
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44

§ testNamedParamContainer()

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:239
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of an selected ion.
Definition: cv.hpp:2749
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:223
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:324
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44

§ testSourceFile()

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:239
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 an selected ion.
Definition: cv.hpp:2749
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:223
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:324
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44

§ testFileDescription()

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_format, pwiz::msdata::FileDescription::sourceFilePtrs, and testObject().

Referenced by test().

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_format);
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 MS2 experiments designed to record product ion spectra where ...
Definition: cv.hpp:2212
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_format
Thermo RAW format: Thermo Scientific RAW file format.
Definition: cv.hpp:2146
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:2164
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:250
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:2257
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

§ testSample()

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:239
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of an selected ion.
Definition: cv.hpp:2749
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:223
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:324
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

§ testComponent()

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.

Referenced by test().

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:239
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 an selected ion.
Definition: cv.hpp:2749
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:223
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:324
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44

§ testComponentList()

void testComponentList ( )

Definition at line 254 of file IOTest.cpp.

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

Referenced by test().

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:1612
MS_electron_multiplier
electron multiplier: A device to amplify the current of a beam or packet of charged particles or phot...
Definition: cv.hpp:1060
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:385

§ testSoftware()

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.

Referenced by test().

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:124
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

§ testInstrumentConfiguration()

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().

Referenced by test().

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:1612
MS_electron_multiplier
electron multiplier: A device to amplify the current of a beam or packet of charged particles or phot...
Definition: cv.hpp:1060
MS_LCQ_Deca
LCQ Deca: ThermoFinnigan LCQ Deca.
Definition: cv.hpp:2119
MS_instrument_serial_number
instrument serial number: Serial Number of the instrument.
Definition: cv.hpp:2041
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
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:385
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

§ testProcessingMethod()

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().

Referenced by test().

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:202
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:250
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:205
MS_peak_picking
peak picking: Spectral peak processing conducted on the acquired data to convert profile data to cent...
Definition: cv.hpp:208
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44

§ testDataProcessing()

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.

Referenced by test().

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:202
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:253
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:250
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:205
MS_peak_picking
peak picking: Spectral peak processing conducted on the acquired data to convert profile data to cent...
Definition: cv.hpp:208
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44

§ testScanSettings()

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.

Referenced by test().

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 an selected ion.
Definition: cv.hpp:2749
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:253
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

§ testPrecursor()

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().

Referenced by test().

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:235
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:3031
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:586
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of an selected ion.
Definition: cv.hpp:2749
MS_collision_energy
collision energy: Energy for an ion experiencing collision with a stationary gas particle resulting i...
Definition: cv.hpp:250
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:223
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:3028
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:3034

§ testProduct()

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().

Referenced by test().

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:3031
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:223
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:3028
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:3034

§ testScan()

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.

Referenced by test().

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:239
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:148
MS_filter_string
filter string: A string unique to Thermo instrument describing instrument settings for the scan...
Definition: cv.hpp:1990
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:223
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:250
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
Definition: ParamTypes.hpp:247
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:324
UO_minute
minute: A time unit which is equal to 60 seconds.
Definition: cv.hpp:12589
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:845
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44

§ testScanList()

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().

Referenced by test().

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:250
MS_reflectron_on
reflectron on: Reflectron is on.
Definition: cv.hpp:475
MS_sum_of_spectra
sum of spectra: Spectra Sum.
Definition: cv.hpp:2170
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:472
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845

§ testBinaryDataArray() [1/2]

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().

Referenced by test(), and testBinaryDataArray().

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
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)
ostream * os_
Definition: IOTest.cpp:38
#define unit_assert(x)
Definition: unit.hpp:85

§ testBinaryDataArray() [2/2]

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(const BinaryDataEncoder::Config &config)
Definition: IOTest.cpp:412
encoding/decoding configuration

§ testBinaryDataArrayExternalMetadata()

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:239
MS_64_bit_float
64-bit float: 64-bit precision little-endian floating point conforming to IEEE-754.
Definition: cv.hpp:2023
MS_no_compression
no compression: No Compression.
Definition: cv.hpp:2185
MS_m_z_array
m/z array: A data array of m/z values.
Definition: cv.hpp:1996
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:324
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:861
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
#define unit_assert(x)
Definition: unit.hpp:85

§ testSpectrum()

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().

Referenced by test().

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:235
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 MS2 experiments designed to record product ion spectra where ...
Definition: cv.hpp:2212
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
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:148
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:586
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of an selected ion.
Definition: cv.hpp:2749
MS_filter_string
filter string: A string unique to Thermo instrument describing instrument settings for the scan...
Definition: cv.hpp:1990
MS_intensity_array
intensity array: A data array of intensity values.
Definition: cv.hpp:1999
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:1996
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:250
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:223
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
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:475
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)
ostream * os_
Definition: IOTest.cpp:38
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:13288
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:845
#define unit_assert(x)
Definition: unit.hpp:85
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

§ testChromatogram()

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().

Referenced by test().

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:955
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
ReadBinaryData
Definition: IO.hpp:173
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:576
size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
Definition: MSData.hpp:491
A single chromatogram.
Definition: MSData.hpp:573
MS_intensity_array
intensity array: A data array of intensity values.
Definition: cv.hpp:1999
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:2287
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
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:579
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: MSData.hpp:588
ostream * os_
Definition: IOTest.cpp:38
#define unit_assert(x)
Definition: unit.hpp:85
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:416

§ testSpectrumList()

void testSpectrumList ( )

Definition at line 623 of file IOTest.cpp.

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

Referenced by test().

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:569
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:714
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:712

§ testSpectrumListWithPositions()

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:569
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:714
ostream * os_
Definition: IOTest.cpp:38
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:845
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:712
#define unit_assert(x)
Definition: unit.hpp:85

§ testSpectrumListWriteProgress()

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
const vector< size_t > & indices() const
Definition: IOTest.cpp:715
void addListener(const IterationListenerPtr &listener, size_t iterationPeriod)
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:569
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:697
encoding/decoding configuration
std::vector< SpectrumPtr > spectra
Definition: MSData.hpp:714
handles registration of IterationListeners and broadcast of update messages
ostream * os_
Definition: IOTest.cpp:38
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:845
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:712
#define unit_assert(x)
Definition: unit.hpp:85

§ testChromatogramList()

void testChromatogramList ( )

Definition at line 788 of file IOTest.cpp.

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

Referenced by test().

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:788
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
A single chromatogram.
Definition: MSData.hpp:573
void testObject_ChromatogramList(const ChromatogramList &a)
Definition: IOTest.cpp:120
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:786
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:620

§ testChromatogramListWithPositions()

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:788
A single chromatogram.
Definition: MSData.hpp:573
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:786
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
encoding/decoding configuration
ostream * os_
Definition: IOTest.cpp:38
#define unit_assert(x)
Definition: unit.hpp:85
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:620

§ testRun()

void testRun ( )

Definition at line 847 of file IOTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::a_b, 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().

Referenced by test().

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:826
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:569
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
A single chromatogram.
Definition: MSData.hpp:573
std::string id
a unique identifier for this run.
Definition: MSData.hpp:808
void diff(const string &filename1, const string &filename2)
SourceFilePtr defaultSourceFilePtr
default source file reference
Definition: MSData.hpp:820
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:805
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:786
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:817
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:823
PWIZ_API_DECL void read(std::istream &is, CV &cv)
ostream * os_
Definition: IOTest.cpp:38
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:814
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:712
#define unit_assert(x)
Definition: unit.hpp:85
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:620
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:811

§ initializeTestData()

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_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_format, 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_format);
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  msd.paramGroupPtrs.push_back(pg1);
989 
990  ParamGroupPtr pg2(new ParamGroup);
991  pg2->id = "CommonMS2SpectrumParams";
992  pg2->cvParams.push_back(MS_positive_scan);
993  msd.paramGroupPtrs.push_back(pg2);
994 
995  // sampleList
996 
997  SamplePtr samplePtr(new Sample);
998  samplePtr->id = "1";
999  samplePtr->name = "Sample1";
1000  msd.samplePtrs.push_back(samplePtr);
1001 
1002  // instrumentConfigurationList
1003 
1004  InstrumentConfigurationPtr instrumentConfigurationPtr(new InstrumentConfiguration);
1005  instrumentConfigurationPtr->id = "LCQ Deca";
1006  instrumentConfigurationPtr->cvParams.push_back(MS_LCQ_Deca);
1007  instrumentConfigurationPtr->cvParams.push_back(CVParam(MS_instrument_serial_number,"23433"));
1008  instrumentConfigurationPtr->componentList.push_back(Component(MS_nanoelectrospray, 1));
1009  instrumentConfigurationPtr->componentList.push_back(Component(MS_quadrupole_ion_trap, 2));
1010  instrumentConfigurationPtr->componentList.push_back(Component(MS_electron_multiplier, 3));
1011 
1012  SoftwarePtr softwareXcalibur(new Software);
1013  softwareXcalibur->id = "Xcalibur";
1014  softwareXcalibur->set(MS_Xcalibur);
1015  softwareXcalibur->version = "2.0.5";
1016  instrumentConfigurationPtr->softwarePtr = softwareXcalibur;
1017 
1018  msd.instrumentConfigurationPtrs.push_back(instrumentConfigurationPtr);
1019 
1020  // softwareList
1021 
1022  SoftwarePtr softwareBioworks(new Software);
1023  softwareBioworks->id = "Bioworks";
1024  softwareBioworks->set(MS_Bioworks);
1025  softwareBioworks->version = "3.3.1 sp1";
1026 
1027  SoftwarePtr software_pwiz(new Software);
1028  software_pwiz->id = "pwiz";
1029  software_pwiz->set(MS_pwiz);
1030  software_pwiz->version = "1.0";
1031 
1032  msd.softwarePtrs.push_back(softwareBioworks);
1033  msd.softwarePtrs.push_back(software_pwiz);
1034  msd.softwarePtrs.push_back(softwareXcalibur);
1035 
1036  // dataProcessingList
1037 
1038  DataProcessingPtr dpXcalibur(new DataProcessing);
1039  dpXcalibur->id = "Xcalibur Processing";
1040 
1041  ProcessingMethod procXcal;
1042  procXcal.order = 1;
1043  procXcal.softwarePtr = softwareXcalibur;
1044  procXcal.cvParams.push_back(CVParam(MS_deisotoping, false));
1045  procXcal.cvParams.push_back(CVParam(MS_charge_deconvolution, false));
1046  procXcal.cvParams.push_back(CVParam(MS_peak_picking, true));
1047 
1048  dpXcalibur->processingMethods.push_back(procXcal);
1049 
1050  DataProcessingPtr dp_msconvert(new DataProcessing);
1051  dp_msconvert->id = "pwiz conversion";
1052 
1053  ProcessingMethod proc_msconvert;
1054  proc_msconvert.order = 2;
1055  proc_msconvert.softwarePtr = software_pwiz;
1056  proc_msconvert.cvParams.push_back(MS_Conversion_to_mzML);
1057 
1058  dp_msconvert->processingMethods.push_back(proc_msconvert);
1059 
1060  msd.dataProcessingPtrs.push_back(dpXcalibur);
1061  msd.dataProcessingPtrs.push_back(dp_msconvert);
1062 
1063  ScanSettingsPtr as1(new ScanSettings("as1"));
1064  as1->sourceFilePtrs.push_back(sfp_parameters);
1065  Target t1;
1066  t1.set(MS_m_z, 1000);
1067  Target t2;
1068  t2.set(MS_m_z, 1200);
1069  as1->targets.push_back(t1);
1070  as1->targets.push_back(t2);
1071  msd.scanSettingsPtrs.push_back(as1);
1072 
1073  // run
1074 
1075  msd.run.id = "Exp01";
1076  msd.run.defaultInstrumentConfigurationPtr = instrumentConfigurationPtr;
1077  msd.run.samplePtr = samplePtr;
1078  msd.run.startTimeStamp = "2007-06-27T15:23:45.00035";
1079  msd.run.defaultSourceFilePtr = sfp;
1080 
1081  shared_ptr<SpectrumListSimple> spectrumList(new SpectrumListSimple);
1082  msd.run.spectrumListPtr = spectrumList;
1083 
1084  spectrumList->spectra.push_back(SpectrumPtr(new Spectrum));
1085  spectrumList->spectra.push_back(SpectrumPtr(new Spectrum));
1086 
1087  Spectrum& s19 = *spectrumList->spectra[0];
1088  s19.id = "S19";
1089  s19.index = 0;
1090  s19.defaultArrayLength = 10;
1091  s19.cvParams.push_back(MS_MSn_spectrum);
1092  s19.set(MS_ms_level, 1);
1093  s19.cvParams.push_back(MS_centroid_spectrum);
1094  s19.cvParams.push_back(CVParam(MS_lowest_observed_m_z, 400.39));
1095  s19.cvParams.push_back(CVParam(MS_highest_observed_m_z, 1795.56));
1096  s19.cvParams.push_back(CVParam(MS_base_peak_m_z, 445.347));
1097  s19.cvParams.push_back(CVParam(MS_base_peak_intensity, 120053));
1098  s19.cvParams.push_back(CVParam(MS_total_ion_current, 1.66755e+007));
1099  s19.scanList.scans.push_back(Scan());
1100  Scan& s19scan = s19.scanList.scans.back();
1101  s19scan.instrumentConfigurationPtr = instrumentConfigurationPtr;
1102  s19scan.paramGroupPtrs.push_back(pg1);
1103  s19scan.cvParams.push_back(CVParam(MS_scan_start_time, 5.890500, UO_minute));
1104  s19scan.cvParams.push_back(CVParam(MS_filter_string, "+ c NSI Full ms [ 400.00-1800.00]"));
1105  s19scan.scanWindows.resize(1);
1106  ScanWindow& window = s19scan.scanWindows.front();
1107  window.cvParams.push_back(CVParam(MS_scan_window_lower_limit, 400.000000));
1108  window.cvParams.push_back(CVParam(MS_scan_window_upper_limit, 1800.000000));
1109 
1110  BinaryDataArrayPtr s19_mz(new BinaryDataArray);
1111  s19_mz->dataProcessingPtr = dpXcalibur;
1112  s19_mz->cvParams.push_back(MS_m_z_array);
1113  s19_mz->data.resize(10);
1114  for (int i=0; i<10; i++)
1115  s19_mz->data[i] = i;
1116 
1117  BinaryDataArrayPtr s19_intensity(new BinaryDataArray);
1118  s19_intensity->dataProcessingPtr = dpXcalibur;
1119  s19_intensity->cvParams.push_back(MS_intensity_array);
1120  s19_intensity->data.resize(10);
1121  for (int i=0; i<10; i++)
1122  s19_intensity->data[i] = 10-i;
1123 
1124  s19.binaryDataArrayPtrs.push_back(s19_mz);
1125  s19.binaryDataArrayPtrs.push_back(s19_intensity);
1126 
1127  Spectrum& s20 = *spectrumList->spectra[1];
1128  s20.id = "S20";
1129  s20.index = 1;
1130  s20.defaultArrayLength = 10;
1131 
1132  s20.cvParams.push_back(MS_MSn_spectrum);
1133  s20.set(MS_ms_level, 2);
1134 
1135  s20.cvParams.push_back(MS_centroid_spectrum);
1136  s20.cvParams.push_back(CVParam(MS_lowest_observed_m_z, 320.39));
1137  s20.cvParams.push_back(CVParam(MS_highest_observed_m_z, 1003.56));
1138  s20.cvParams.push_back(CVParam(MS_base_peak_m_z, 456.347));
1139  s20.cvParams.push_back(CVParam(MS_base_peak_intensity, 23433));
1140  s20.cvParams.push_back(CVParam(MS_total_ion_current, 1.66755e+007));
1141 
1142  s20.precursors.resize(1);
1143  Precursor& precursor = s20.precursors.front();
1144  precursor.spectrumID= s19.id;
1145  precursor.selectedIons.resize(1);
1146  precursor.selectedIons[0].cvParams.push_back(CVParam(MS_selected_ion_m_z, 445.34));
1147  precursor.selectedIons[0].cvParams.push_back(CVParam(MS_charge_state, 2));
1149  precursor.activation.cvParams.push_back(CVParam(MS_collision_energy, 35.00, UO_electronvolt));
1150 
1151  s20.scanList.scans.push_back(Scan());
1152  Scan& s20scan = s20.scanList.scans.back();
1153  s20scan.instrumentConfigurationPtr = instrumentConfigurationPtr;
1154  s20scan.paramGroupPtrs.push_back(pg2);
1155  s20scan.cvParams.push_back(CVParam(MS_scan_start_time, 5.990500, UO_minute));
1156  s20scan.cvParams.push_back(CVParam(MS_filter_string, "+ c d Full ms2 445.35@cid35.00 [ 110.00-905.00]"));
1157  s20scan.scanWindows.resize(1);
1158  ScanWindow& window2 = s20scan.scanWindows.front();
1159  window2.cvParams.push_back(CVParam(MS_scan_window_lower_limit, 110.000000));
1160  window2.cvParams.push_back(CVParam(MS_scan_window_upper_limit, 905.000000));
1161 
1162  BinaryDataArrayPtr s20_mz(new BinaryDataArray);
1163  s20_mz->dataProcessingPtr = dpXcalibur;
1164  s20_mz->cvParams.push_back(MS_m_z_array);
1165  s20_mz->data.resize(10);
1166  for (int i=0; i<10; i++)
1167  s20_mz->data[i] = i;
1168 
1169  BinaryDataArrayPtr s20_intensity(new BinaryDataArray);
1170  s20_intensity->dataProcessingPtr = dpXcalibur;
1171  s20_intensity->cvParams.push_back(MS_intensity_array);
1172  s20_intensity->data.resize(10);
1173  for (int i=0; i<10; i++)
1174  s20_intensity->data[i] = 10-i;
1175 
1176  s20.binaryDataArrayPtrs.push_back(s20_mz);
1177  s20.binaryDataArrayPtrs.push_back(s20_intensity);
1178 
1179  // chromatograms
1180 
1181  shared_ptr<ChromatogramListSimple> chromatogramList(new ChromatogramListSimple);
1182  msd.run.chromatogramListPtr = chromatogramList;
1183 
1184  chromatogramList->chromatograms.push_back(ChromatogramPtr(new Chromatogram));
1185 
1186  Chromatogram& tic = *chromatogramList->chromatograms[0];
1187  tic.id = "tic";
1188  tic.index = 0;
1189  tic.defaultArrayLength = 10;
1191 
1192  BinaryDataArrayPtr tic_time(new BinaryDataArray);
1193  tic_time->dataProcessingPtr = dp_msconvert;
1194  tic_time->cvParams.push_back(MS_time_array);
1195  tic_time->data.resize(10);
1196  for (int i=0; i<10; i++)
1197  tic_time->data[i] = i;
1198 
1199  BinaryDataArrayPtr tic_intensity(new BinaryDataArray);
1200  tic_intensity->dataProcessingPtr = dp_msconvert;
1201  tic_intensity->cvParams.push_back(MS_intensity_array);
1202  tic_intensity->data.resize(10);
1203  for (int i=0; i<10; i++)
1204  tic_intensity->data[i] = 10-i;
1205 
1206  tic.binaryDataArrayPtrs.push_back(tic_time);
1207  tic.binaryDataArrayPtrs.push_back(tic_intensity);
1208 }
MS_contact_address
contact address: Postal address of the contact person or organization.
Definition: cv.hpp:2260
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:13356
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:202
MS_Bioworks
Bioworks: Thermo Finnigan software for data analysis of peptides and proteins.
Definition: cv.hpp:2053
MS_charge_state
charge state: The charge state of the ion, single or multiple and positive or negatively charged...
Definition: cv.hpp:235
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 MS2 experiments designed to record product ion spectra where ...
Definition: cv.hpp:2212
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:955
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
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:1969
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:239
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:873
The method of precursor ion selection and activation.
Definition: MSData.hpp:310
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
Definition: MSData.hpp:826
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:2035
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:569
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:1255
MS_contact_URL
contact URL: Uniform Resource Locator related to the contact person or organization.
Definition: cv.hpp:2263
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:148
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:577
MS_nanoelectrospray
nanoelectrospray: Electrospray ionization at a flow rate less than ~25 nL/min. Nanoelectrospray is sy...
Definition: cv.hpp:1612
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_format
Thermo RAW format: Thermo Scientific RAW file format.
Definition: cv.hpp:2146
MS_electron_multiplier
electron multiplier: A device to amplify the current of a beam or packet of charged particles or phot...
Definition: cv.hpp:1060
MS_scan_window_upper_limit
scan window upper limit: The lower m/z bound of a mass spectrometer scan window.
Definition: cv.hpp:1954
Information about an ontology or CV source and a short &#39;lookup&#39; tag to refer to.
Definition: cv.hpp:13353
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:586
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: MSData.hpp:576
size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
Definition: MSData.hpp:491
A single chromatogram.
Definition: MSData.hpp:573
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:858
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:2119
std::vector< ScanSettingsPtr > scanSettingsPtrs
list with the descriptions of the acquisition settings applied prior to the start of data acquisition...
Definition: MSData.hpp:870
MS_ms_level
ms level: Stages of ms achieved in a multi stage mass spectrometry experiment.
Definition: cv.hpp:1987
MS_contact_email
contact email: Email address of the contact person or organization.
Definition: cv.hpp:2266
std::string id
an optional id for the mzML document. It is recommended to use LSIDs when possible.
Definition: MSData.hpp:851
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of an selected ion.
Definition: cv.hpp:2749
std::string id
a unique identifier for this run.
Definition: MSData.hpp:808
MS_filter_string
filter string: A string unique to Thermo instrument describing instrument settings for the scan...
Definition: cv.hpp:1990
MS_intensity_array
intensity array: A data array of intensity values.
Definition: cv.hpp:1999
MS_instrument_serial_number
instrument serial number: Serial Number of the instrument.
Definition: cv.hpp:2041
std::string fullName
the usual name for the resource (e.g. The PSI-MS Controlled Vocabulary).
Definition: cv.hpp:13362
MS_SHA_1
SHA-1: SHA-1 (Secure Hash Algorithm-1) is a cryptographic hash function designed by the National Secu...
Definition: cv.hpp:2164
SourceFilePtr defaultSourceFilePtr
default source file reference
Definition: MSData.hpp:820
MS_m_z_array
m/z array: A data array of m/z values.
Definition: cv.hpp:1996
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:250
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:253
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:2287
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:786
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:223
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:1966
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
std::string accession
an optional accession number for the mzML document.
Definition: MSData.hpp:848
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:13359
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:1957
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
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:855
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
Definition: ParamTypes.hpp:247
A piece of software.
Definition: MSData.hpp:178
std::string startTimeStamp
the optional start timestamp of the run, in UT.
Definition: MSData.hpp:817
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:324
UO_minute
minute: A time unit which is equal to 60 seconds.
Definition: cv.hpp:12589
std::vector< SamplePtr > samplePtrs
list and descriptions of samples.
Definition: MSData.hpp:864
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:823
std::vector< ParamGroupPtr > paramGroupPtrs
container for a list of referenceableParamGroups
Definition: MSData.hpp:861
std::vector< SoftwarePtr > softwarePtrs
list and descriptions of software used to acquire and/or process the data in this mzML file...
Definition: MSData.hpp:867
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:559
std::vector< DataProcessingPtr > dataProcessingPtrs
list and descriptions of data processing applied to this data.
Definition: MSData.hpp:876
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: MSData.hpp:588
MS_pwiz
pwiz (ProteoWizard software): ProteoWizard software for data processing and analysis. Primarily developed by the labs of P. Malick and D. Tabb.
Definition: cv.hpp:2356
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:385
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:13288
MS_Xcalibur
Xcalibur: Thermo Finnigan software for data acquisition and analysis.
Definition: cv.hpp:2050
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:205
MS_contact_name
contact name: Name of the contact person or organization.
Definition: cv.hpp:2257
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:13365
SamplePtr samplePtr
this attribute MUST reference the &#39;id&#39; of the appropriate sample.
Definition: MSData.hpp:814
MS_lowest_observed_m_z
lowest observed m/z: Lowest m/z value observed in the m/z array.
Definition: cv.hpp:2038
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:712
MS_Conversion_to_mzML
Conversion to mzML: Conversion of a file format to Proteomics Standards Initiative mzML file format...
Definition: cv.hpp:2089
MS_peak_picking
peak picking: Spectral peak processing conducted on the acquired data to convert profile data to cent...
Definition: cv.hpp:208
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:620
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:811

§ testMSData()

void testMSData ( )

Definition at line 1211 of file IOTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::a_b, 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().

Referenced by test().

1212 {
1213  if (os_) *os_ << "testMSData():\n";
1214 
1215  MSData a;
1216  initializeTestData(a);
1217 
1218  // write 'a' out to a stream
1219 
1220  ostringstream oss;
1221  XMLWriter writer(oss);
1222  IO::write(writer, a);
1223  if (os_) *os_ << oss.str() << endl;
1224 
1225  // read 'b' in from stream, ignoring SpectrumList (default)
1226 
1227  MSData b;
1228  istringstream iss(oss.str());
1229  IO::read(iss, b); // IO::IgnoreSpectrumList
1230 
1231  // compare 'a' and 'b'
1232 
1234  if (diff && os_) *os_ << "diff:\n" << diff << endl;
1235  unit_assert(diff);
1236  unit_assert(diff.a_b.run.spectrumListPtr.get());
1237  unit_assert(diff.a_b.run.spectrumListPtr->size() == 1);
1238  unit_assert(diff.a_b.run.spectrumListPtr->spectrum(0)->userParams.size() == 1);
1239 
1240  // read 'c' in from stream, reading SpectrumList
1241 
1242  MSData c;
1243  iss.seekg(0);
1244  IO::read(iss, c, IO::ReadSpectrumList);
1245 
1246  // compare 'a' and 'c'
1247 
1248  diff(a,c);
1249  if (diff && os_) *os_ << "diff:\n" << diff << endl;
1250  unit_assert(!diff);
1251 
1252  // remove SpectrumList and ChromatogramList from a, and compare to b
1253 
1254  a.run.spectrumListPtr.reset();
1255  a.run.chromatogramListPtr.reset();
1256  diff(a, b);
1257  unit_assert(!diff);
1258 }
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
Definition: MSData.hpp:826
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:882
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:823
PWIZ_API_DECL void read(std::istream &is, CV &cv)
ostream * os_
Definition: IOTest.cpp:38
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
#define unit_assert(x)
Definition: unit.hpp:85

§ test()

void test ( )

Definition at line 1261 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().

1262 {
1263  testCV();
1264  testUserParam();
1265  testCVParam();
1266  testParamGroup();
1267  testNamedParamContainer<FileContent>();
1268  testSourceFile();
1269  testNamedParamContainer<Contact>();
1271  testSample();
1272  testComponent();
1273  testComponentList();
1274  testSoftware();
1278  testNamedParamContainer<Target>();
1279  testScanSettings();
1280  testNamedParamContainer<IsolationWindow>();
1281  testNamedParamContainer<SelectedIon>();
1282  testNamedParamContainer<Activation>();
1283  testPrecursor();
1284  testProduct();
1285  testNamedParamContainer<ScanWindow>();
1286  testScan();
1287  testScanList();
1290  testSpectrum();
1291  testChromatogram();
1292  testSpectrumList();
1297  testRun();
1298  testMSData();
1299 }
void testProcessingMethod()
Definition: IOTest.cpp:288
void testSample()
Definition: IOTest.cpp:193
void testComponentList()
Definition: IOTest.cpp:254
void testUserParam()
Definition: IOTest.cpp:158
void testSoftware()
Definition: IOTest.cpp:264
void testScan()
Definition: IOTest.cpp:378
void testChromatogramListWithPositions()
Definition: IOTest.cpp:810
void testChromatogramList()
Definition: IOTest.cpp:788
void testSpectrumListWithPositions()
Definition: IOTest.cpp:647
void testBinaryDataArray(const BinaryDataEncoder::Config &config)
Definition: IOTest.cpp:412
void testFileDescription()
Definition: IOTest.cpp:214
void testParamGroup()
Definition: IOTest.cpp:180
void testComponent()
Definition: IOTest.cpp:243
void testScanList()
Definition: IOTest.cpp:393
void testCV()
Definition: IOTest.cpp:93
void testPrecursor()
Definition: IOTest.cpp:345
void testMSData()
Definition: IOTest.cpp:1211
void testSpectrum()
Definition: IOTest.cpp:491
void testScanSettings()
Definition: IOTest.cpp:324
void testBinaryDataArrayExternalMetadata()
Definition: IOTest.cpp:466
void testInstrumentConfiguration()
Definition: IOTest.cpp:274
void testCVParam()
Definition: IOTest.cpp:170
void testRun()
Definition: IOTest.cpp:847
void testDataProcessing()
Definition: IOTest.cpp:300
void testSourceFile()
Definition: IOTest.cpp:566
void testChromatogram()
Definition: IOTest.cpp:569
void testProduct()
Definition: IOTest.cpp:366
void testSpectrumList()
Definition: IOTest.cpp:623
void testSpectrumListWriteProgress()
Definition: IOTest.cpp:722

§ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 1302 of file IOTest.cpp.

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

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

Variable Documentation

§ os_

ostream* os_ = 0

Definition at line 38 of file IOTest.cpp.

§ bdaWithExternalMetadata

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().