ProteoWizard
Functions | Variables
Serializer_MSn_Test.cpp File Reference
#include "Serializer_MSn.hpp"
#include "Serializer_mzML.hpp"
#include "Diff.hpp"
#include "TextWriter.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "boost/iostreams/positioning.hpp"
#include "pwiz/utility/misc/Std.hpp"
#include <cstring>

Go to the source code of this file.

Functions

void initializeTinyMS1 (MSData &msd)
 
void initializeTinyMS2 (MSData &msd)
 
void testWriteReadMS1 (const MSData &msd)
 
void testWriteReadBMS1 (const MSData &msd)
 
void testWriteReadCMS1 (const MSData &msd)
 
void testWriteReadMS2 (const MSData &msd)
 
void testWriteReadBMS2 (const MSData &msd)
 
void testWriteReadCMS2 (const MSData &msd)
 
void testWriteRead ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 

Function Documentation

§ initializeTinyMS1()

void initializeTinyMS1 ( MSData msd)

Definition at line 39 of file Serializer_MSn_Test.cpp.

References pwiz::msdata::Spectrum::defaultArrayLength, pwiz::msdata::FileDescription::fileContent, pwiz::msdata::MSData::fileDescription, pwiz::msdata::Spectrum::getIntensityArray(), pwiz::msdata::Spectrum::getMZArray(), pwiz::msdata::SpectrumIdentity::id, pwiz::msdata::SpectrumIdentity::index, MS_base_peak_intensity, MS_base_peak_m_z, MS_centroid_spectrum, MS_highest_observed_m_z, MS_lowest_observed_m_z, MS_MS2_format, MS_ms_level, MS_MSn_spectrum, MS_number_of_detector_counts, MS_scan_number_only_nativeID_format, MS_scan_start_time, MS_total_ion_current, pwiz::msdata::MSData::run, pwiz::msdata::Spectrum::scanList, pwiz::msdata::ScanList::scans, pwiz::data::ParamContainer::set(), pwiz::msdata::Spectrum::setMZIntensityArrays(), pwiz::msdata::FileDescription::sourceFilePtrs, pwiz::msdata::Run::spectrumListPtr, and UO_second.

Referenced by testWriteRead().

40 {
42  fc.set(MS_MSn_spectrum);
44 
45  SourceFilePtr sourceFile(new SourceFile);
46  sourceFile->set(MS_scan_number_only_nativeID_format);
47  sourceFile->set(MS_MS2_format);
48  msd.fileDescription.sourceFilePtrs.push_back(sourceFile);
49 
50  shared_ptr<SpectrumListSimple> spectrumList(new SpectrumListSimple);
51  msd.run.spectrumListPtr = spectrumList;
52  spectrumList->spectra.push_back(SpectrumPtr(new Spectrum));
53 
54  Spectrum& s20 = *spectrumList->spectra[0];
55  s20.id = "scan=1";
56  s20.index = 0;
57 
58  s20.set(MS_MSn_spectrum);
59  s20.set(MS_ms_level, 1);
60 
64  s20.set(MS_base_peak_m_z, 0);
65  s20.set(MS_base_peak_intensity, 20);
66  s20.set(MS_total_ion_current, 110);
67 
68  s20.scanList.scans.push_back(Scan());
69  Scan& s20scan = s20.scanList.scans.back();
70  s20scan.set(MS_scan_start_time, 4, UO_second);
71 
72  s20.setMZIntensityArrays(vector<double>(), vector<double>(), MS_number_of_detector_counts);
73  vector<double>& s20_mz = s20.getMZArray()->data;
74  vector<double>& s20_intensity = s20.getIntensityArray()->data;
75 
76  for (int i=0; i<10; i++)
77  s20_mz.push_back(i*2);
78 
79  for (int i=0; i<10; i++)
80  s20_intensity.push_back((10-i)*2);
81 
82  s20.defaultArrayLength = s20_mz.size();
83 
84 } // initializeTinyMS1()
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::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from...
Definition: MSData.hpp:89
ScanList scanList
list of scans
Definition: MSData.hpp:516
MS_base_peak_intensity
base peak intensity: The intensity of the greatest peak in the mass spectrum.
Definition: cv.hpp:1969
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
MS_highest_observed_m_z
highest observed m/z: Highest m/z value observed in the m/z array.
Definition: cv.hpp:2035
MS_MS2_format
MS2 format: MS2 file format for MS2 spectral data.
Definition: cv.hpp:4636
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_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
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_ms_level
ms level: Stages of ms achieved in a multi stage mass spectrometry experiment.
Definition: cv.hpp:1987
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
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
Definition: MSData.hpp:475
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: MSData.hpp:507
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
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Definition: MSData.hpp:472
BinaryDataArrayPtr getIntensityArray() const
get intensity array (may be null)
std::vector< Scan > scans
Definition: MSData.hpp:396
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
MS_scan_number_only_nativeID_format
scan number only nativeID format: Native format defined by scan=xsd:nonNegativeInteger.
Definition: cv.hpp:2848
MS_number_of_detector_counts
number of detector counts: The number of counted events observed in one or a group of elements of a d...
Definition: cv.hpp:580
BinaryDataArrayPtr getMZArray() const
get m/z array (may be null)
MS_centroid_spectrum
centroid spectrum: Processing of profile data to produce spectra that contains discrete peaks of zero...
Definition: cv.hpp:559
void setMZIntensityArrays(const std::vector< double > &mzArray, const std::vector< double > &intensityArray, CVID intensityUnits)
set m/z and intensity arrays separately (they must be the same size)
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: MSData.hpp:504
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
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition: MSData.hpp:75

§ initializeTinyMS2()

void initializeTinyMS2 ( MSData msd)

Definition at line 86 of file Serializer_MSn_Test.cpp.

References pwiz::msdata::Spectrum::defaultArrayLength, pwiz::msdata::FileDescription::fileContent, pwiz::msdata::MSData::fileDescription, pwiz::msdata::Spectrum::getIntensityArray(), pwiz::msdata::Spectrum::getMZArray(), pwiz::msdata::SpectrumIdentity::id, pwiz::msdata::SpectrumIdentity::index, pwiz::msdata::Precursor::isolationWindow, MS_base_peak_intensity, MS_base_peak_m_z, MS_centroid_spectrum, MS_highest_observed_m_z, MS_isolation_window_target_m_z, MS_lowest_observed_m_z, MS_m_z, MS_MS2_format, MS_ms_level, MS_MSn_spectrum, MS_number_of_detector_counts, MS_possible_charge_state, MS_scan_number_only_nativeID_format, MS_scan_start_time, MS_selected_ion_m_z, MS_total_ion_current, pwiz::msdata::Spectrum::precursors, pwiz::msdata::MSData::run, pwiz::msdata::Spectrum::scanList, pwiz::msdata::ScanList::scans, pwiz::msdata::Precursor::selectedIons, pwiz::data::ParamContainer::set(), pwiz::msdata::Spectrum::setMZIntensityArrays(), pwiz::msdata::FileDescription::sourceFilePtrs, pwiz::msdata::Run::spectrumListPtr, and UO_second.

Referenced by testWriteRead().

87 {
89  fc.set(MS_MSn_spectrum);
91 
92  SourceFilePtr sourceFile(new SourceFile);
93  sourceFile->set(MS_scan_number_only_nativeID_format);
94  sourceFile->set(MS_MS2_format);
95  msd.fileDescription.sourceFilePtrs.push_back(sourceFile);
96 
97  shared_ptr<SpectrumListSimple> spectrumList(new SpectrumListSimple);
98  msd.run.spectrumListPtr = spectrumList;
99  spectrumList->spectra.push_back(SpectrumPtr(new Spectrum));
100 
101  Spectrum& s20 = *spectrumList->spectra[0];
102  s20.id = "scan=1";
103  s20.index = 0;
104 
105  s20.set(MS_MSn_spectrum);
106  s20.set(MS_ms_level, 2);
107 
109  s20.set(MS_lowest_observed_m_z, 0);
110  s20.set(MS_highest_observed_m_z, 18);
111  s20.set(MS_base_peak_m_z, 0);
112  s20.set(MS_base_peak_intensity, 20);
113  s20.set(MS_total_ion_current, 110);
114 
115  s20.precursors.resize(1);
116  Precursor& precursor = s20.precursors.front();
117  precursor.selectedIons.resize(1);
118  precursor.selectedIons[0].set(MS_selected_ion_m_z, 445.34, MS_m_z);
119  precursor.selectedIons[0].set(MS_possible_charge_state, 2);
121 
122  s20.scanList.scans.push_back(Scan());
123  Scan& s20scan = s20.scanList.scans.back();
124  s20scan.set(MS_scan_start_time, 4, UO_second);
125 
126  s20.setMZIntensityArrays(vector<double>(), vector<double>(), MS_number_of_detector_counts);
127  vector<double>& s20_mz = s20.getMZArray()->data;
128  vector<double>& s20_intensity = s20.getIntensityArray()->data;
129 
130  for (int i=0; i<10; i++)
131  s20_mz.push_back(i*2);
132 
133  for (int i=0; i<10; i++)
134  s20_intensity.push_back((10-i)*2);
135 
136  s20.defaultArrayLength = s20_mz.size();
137 
138 } // initializeTinyMS2()
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::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from...
Definition: MSData.hpp:89
ScanList scanList
list of scans
Definition: MSData.hpp:516
MS_base_peak_intensity
base peak intensity: The intensity of the greatest peak in the mass spectrum.
Definition: cv.hpp:1969
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
The method of precursor ion selection and activation.
Definition: MSData.hpp:310
MS_highest_observed_m_z
highest observed m/z: Highest m/z value observed in the m/z array.
Definition: cv.hpp:2035
MS_MS2_format
MS2 format: MS2 file format for MS2 spectral data.
Definition: cv.hpp:4636
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_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
IsolationWindow isolationWindow
this element captures the isolation (or &#39;selection&#39;) window configured to isolate one or more precurs...
Definition: MSData.hpp:325
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_ms_level
ms level: Stages of ms achieved in a multi stage mass spectrometry experiment.
Definition: cv.hpp:1987
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
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
Definition: MSData.hpp:475
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: MSData.hpp:507
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
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Definition: MSData.hpp:472
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
BinaryDataArrayPtr getIntensityArray() const
get intensity array (may be null)
MS_possible_charge_state
possible charge state: A possible charge state of the ion in a situation where the charge of an ion i...
Definition: cv.hpp:2419
std::vector< Scan > scans
Definition: MSData.hpp:396
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
MS_scan_number_only_nativeID_format
scan number only nativeID format: Native format defined by scan=xsd:nonNegativeInteger.
Definition: cv.hpp:2848
MS_number_of_detector_counts
number of detector counts: The number of counted events observed in one or a group of elements of a d...
Definition: cv.hpp:580
BinaryDataArrayPtr getMZArray() const
get m/z array (may be null)
MS_centroid_spectrum
centroid spectrum: Processing of profile data to produce spectra that contains discrete peaks of zero...
Definition: cv.hpp:559
void setMZIntensityArrays(const std::vector< double > &mzArray, const std::vector< double > &intensityArray, CVID intensityUnits)
set m/z and intensity arrays separately (they must be the same size)
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: MSData.hpp:504
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
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition: MSData.hpp:75

§ testWriteReadMS1()

void testWriteReadMS1 ( const MSData msd)

Definition at line 141 of file Serializer_MSn_Test.cpp.

References diff(), pwiz::msdata::DiffConfig::ignoreMetadata, pwiz::msdata::MSn_Type_MS1, os_, pwiz::msdata::Serializer_MSn::read(), unit_assert, and pwiz::msdata::Serializer_MSn::write().

Referenced by testWriteRead().

142 {
143  Serializer_MSn serializer(MSn_Type_MS1);
144 
145  ostringstream oss;
146  serializer.write(oss, msd);
147 
148  if (os_) *os_ << "oss:\n" << oss.str() << endl;
149 
150  MSData msd2;
151  shared_ptr<istream> iss(new istringstream(oss.str()));
152  serializer.read(iss, msd2);
153 
154  DiffConfig config;
155  config.ignoreMetadata = true;
156  Diff<MSData, DiffConfig> diff(msd, msd2, config);
157 
158  if (os_ && diff) *os_ << diff << endl;
159  unit_assert(!diff);
160 }
bool ignoreMetadata
ignore all file level metadata, and most scan level metadata, i.e.
Definition: Diff.hpp:214
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
MSData <-> MSn stream serialization.
configuration struct for diffing MSData types
Definition: Diff.hpp:205
ostream * os_
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

§ testWriteReadBMS1()

void testWriteReadBMS1 ( const MSData msd)

Definition at line 162 of file Serializer_MSn_Test.cpp.

References diff(), pwiz::msdata::DiffConfig::ignoreDataProcessing, pwiz::msdata::DiffConfig::ignoreMetadata, pwiz::msdata::MSn_Type_BMS1, os_, pwiz::msdata::Serializer_MSn::read(), unit_assert, and pwiz::msdata::Serializer_MSn::write().

Referenced by testWriteRead().

163 {
164  Serializer_MSn serializer(MSn_Type_BMS1);
165 
166  ostringstream oss;
167  serializer.write(oss, msd);
168 
169  if (os_) *os_ << "oss:\n" << oss.str() << endl;
170 
171  MSData msd2;
172  shared_ptr<istream> iss(new istringstream(oss.str()));
173  serializer.read(iss, msd2);
174 
175  DiffConfig config;
176  config.ignoreMetadata = true;
177  config.ignoreDataProcessing = true;
178  Diff<MSData, DiffConfig> diff(msd, msd2, config);
179  if (os_ && diff) *os_ << diff << endl;
180  unit_assert(!diff);
181 }
bool ignoreMetadata
ignore all file level metadata, and most scan level metadata, i.e.
Definition: Diff.hpp:214
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
MSData <-> MSn stream serialization.
configuration struct for diffing MSData types
Definition: Diff.hpp:205
ostream * os_
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

§ testWriteReadCMS1()

void testWriteReadCMS1 ( const MSData msd)

Definition at line 183 of file Serializer_MSn_Test.cpp.

References diff(), pwiz::msdata::DiffConfig::ignoreDataProcessing, pwiz::msdata::DiffConfig::ignoreMetadata, pwiz::msdata::MSn_Type_CMS1, os_, pwiz::msdata::Serializer_MSn::read(), unit_assert, and pwiz::msdata::Serializer_MSn::write().

Referenced by testWriteRead().

184 {
185  Serializer_MSn serializer(MSn_Type_CMS1);
186 
187  ostringstream oss;
188  serializer.write(oss, msd);
189 
190  if (os_) *os_ << "oss:\n" << oss.str() << endl;
191 
192  MSData msd2;
193  shared_ptr<istream> iss(new istringstream(oss.str()));
194  serializer.read(iss, msd2);
195 
196  DiffConfig config;
197  config.ignoreMetadata = true;
198  config.ignoreDataProcessing = true;
199  Diff<MSData, DiffConfig> diff(msd, msd2, config);
200  if (os_ && diff) *os_ << diff << endl;
201  unit_assert(!diff);
202 }
bool ignoreMetadata
ignore all file level metadata, and most scan level metadata, i.e.
Definition: Diff.hpp:214
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
MSData <-> MSn stream serialization.
configuration struct for diffing MSData types
Definition: Diff.hpp:205
ostream * os_
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

§ testWriteReadMS2()

void testWriteReadMS2 ( const MSData msd)

Definition at line 204 of file Serializer_MSn_Test.cpp.

References diff(), pwiz::msdata::DiffConfig::ignoreMetadata, pwiz::msdata::MSn_Type_MS2, os_, pwiz::msdata::Serializer_MSn::read(), unit_assert, and pwiz::msdata::Serializer_MSn::write().

Referenced by testWriteRead().

205 {
206  Serializer_MSn serializer(MSn_Type_MS2);
207 
208  ostringstream oss;
209  serializer.write(oss, msd);
210 
211  if (os_) *os_ << "oss:\n" << oss.str() << endl;
212 
213  MSData msd2;
214  shared_ptr<istream> iss(new istringstream(oss.str()));
215  serializer.read(iss, msd2);
216 
217  DiffConfig config;
218  config.ignoreMetadata = true;
219  Diff<MSData, DiffConfig> diff(msd, msd2, config);
220  if (os_ && diff) *os_ << diff << endl;
221  unit_assert(!diff);
222 }
bool ignoreMetadata
ignore all file level metadata, and most scan level metadata, i.e.
Definition: Diff.hpp:214
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
MSData <-> MSn stream serialization.
configuration struct for diffing MSData types
Definition: Diff.hpp:205
ostream * os_
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

§ testWriteReadBMS2()

void testWriteReadBMS2 ( const MSData msd)

Definition at line 224 of file Serializer_MSn_Test.cpp.

References diff(), pwiz::msdata::DiffConfig::ignoreDataProcessing, pwiz::msdata::DiffConfig::ignoreMetadata, pwiz::msdata::MSn_Type_BMS2, os_, pwiz::msdata::Serializer_MSn::read(), unit_assert, and pwiz::msdata::Serializer_MSn::write().

Referenced by testWriteRead().

225 {
226  Serializer_MSn serializer(MSn_Type_BMS2);
227 
228  ostringstream oss;
229  serializer.write(oss, msd);
230 
231  if (os_) *os_ << "oss:\n" << oss.str() << endl;
232 
233  MSData msd2;
234  shared_ptr<istream> iss(new istringstream(oss.str()));
235  serializer.read(iss, msd2);
236 
237  DiffConfig config;
238  config.ignoreMetadata = true;
239  config.ignoreDataProcessing = true;
240  Diff<MSData, DiffConfig> diff(msd, msd2, config);
241  if (os_ && diff) *os_ << diff << endl;
242  unit_assert(!diff);
243 }
bool ignoreMetadata
ignore all file level metadata, and most scan level metadata, i.e.
Definition: Diff.hpp:214
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
MSData <-> MSn stream serialization.
configuration struct for diffing MSData types
Definition: Diff.hpp:205
ostream * os_
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

§ testWriteReadCMS2()

void testWriteReadCMS2 ( const MSData msd)

Definition at line 245 of file Serializer_MSn_Test.cpp.

References diff(), pwiz::msdata::DiffConfig::ignoreDataProcessing, pwiz::msdata::DiffConfig::ignoreMetadata, pwiz::msdata::MSn_Type_CMS2, os_, pwiz::msdata::Serializer_MSn::read(), unit_assert, and pwiz::msdata::Serializer_MSn::write().

Referenced by testWriteRead().

246 {
247  Serializer_MSn serializer(MSn_Type_CMS2);
248 
249  ostringstream oss;
250  serializer.write(oss, msd);
251 
252  if (os_) *os_ << "oss:\n" << oss.str() << endl;
253 
254  MSData msd2;
255  shared_ptr<istream> iss(new istringstream(oss.str()));
256  serializer.read(iss, msd2);
257 
258  DiffConfig config;
259  config.ignoreMetadata = true;
260  config.ignoreDataProcessing = true;
261  Diff<MSData, DiffConfig> diff(msd, msd2, config);
262  if (os_ && diff) *os_ << diff << endl;
263  unit_assert(!diff);
264 }
bool ignoreMetadata
ignore all file level metadata, and most scan level metadata, i.e.
Definition: Diff.hpp:214
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
MSData <-> MSn stream serialization.
configuration struct for diffing MSData types
Definition: Diff.hpp:205
ostream * os_
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

§ testWriteRead()

void testWriteRead ( )

Definition at line 266 of file Serializer_MSn_Test.cpp.

References initializeTinyMS1(), initializeTinyMS2(), testWriteReadBMS1(), testWriteReadBMS2(), testWriteReadCMS1(), testWriteReadCMS2(), testWriteReadMS1(), and testWriteReadMS2().

Referenced by main().

267 {
268  MSData msd1, msd2;
269 
270  initializeTinyMS1(msd1);
271  initializeTinyMS2(msd2);
272 
273  testWriteReadMS1(msd1);
274  testWriteReadBMS1(msd1);
275  testWriteReadCMS1(msd1);
276  testWriteReadMS2(msd2);
277  testWriteReadBMS2(msd2);
278  testWriteReadCMS2(msd2);
279 }
void initializeTinyMS2(MSData &msd)
void testWriteReadBMS1(const MSData &msd)
void testWriteReadMS1(const MSData &msd)
void initializeTinyMS1(MSData &msd)
void testWriteReadBMS2(const MSData &msd)
void testWriteReadMS2(const MSData &msd)
void testWriteReadCMS2(const MSData &msd)
void testWriteReadCMS1(const MSData &msd)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845

§ main()

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

Definition at line 282 of file Serializer_MSn_Test.cpp.

References os_, TEST_EPILOG, TEST_FAILED, TEST_PROLOG, and testWriteRead().

283 {
284  TEST_PROLOG(argc, argv)
285 
286  try
287  {
288  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
289  testWriteRead();
290  }
291  catch (exception& e)
292  {
293  TEST_FAILED(e.what())
294  }
295  catch (...)
296  {
297  TEST_FAILED("Caught unknown exception.")
298  }
299 
301 }
#define TEST_EPILOG
Definition: unit.hpp:182
#define TEST_FAILED(x)
Definition: unit.hpp:176
#define TEST_PROLOG(argc, argv)
Definition: unit.hpp:174
void testWriteRead()
ostream * os_

Variable Documentation

§ os_

ostream* os_ = 0