28 using namespace pwiz::util;
29 using namespace pwiz::data;
30 using namespace pwiz::msdata;
45 spectrum0->id =
"scan=1";
49 for (
unsigned int i=0; i<10; i++) bd_mz->data.push_back(i);
51 double* buffer = &bd_mz->data[0];
55 for (
unsigned int i=0; i<10; i++) bd_intensity->data.push_back(10-i);
58 spectrum0->binaryDataArrayPtrs.push_back(bd_mz);
59 spectrum0->binaryDataArrayPtrs.push_back(bd_intensity);
60 spectrum0->defaultArrayLength = 10;
64 spectrum1->id =
"scan=2";
68 spectrumListSimple->spectra.push_back(spectrum0);
69 spectrumListSimple->spectra.push_back(spectrum1);
108 unit_assert(spectrum->binaryDataArrayPtrs.size() == 2);
109 unit_assert(&(spectrum->binaryDataArrayPtrs[0]->data[0]) == buffer);
116 vector<MZIntensityPair> mziPairs;
117 spectrum->getMZIntensityPairs(mziPairs);
120 vector<double> doubleArray;
122 doubleArray.resize(spectrum->defaultArrayLength*2);
123 spectrum->getMZIntensityPairs(reinterpret_cast<MZIntensityPair*>(&doubleArray[0]),
124 spectrum->defaultArrayLength);
126 for (
unsigned int i=0; i<10; i++)
136 spectrum->binaryDataArrayPtrs.clear();
137 unit_assert(spectrum->binaryDataArrayPtrs.empty());
138 vector<MZIntensityPair> mziPairs2;
139 for (
unsigned int i=0; i<10; i++)
142 unit_assert(spectrum->binaryDataArrayPtrs.size() == 2);
146 unit_assert(spectrum->binaryDataArrayPtrs[0]->data.size() == 10);
147 unit_assert(spectrum->binaryDataArrayPtrs[1]->data.size() == 10);
148 for (
unsigned int i=0; i<10; i++)
149 unit_assert(spectrum->binaryDataArrayPtrs[0]->data[i] == 2*i &&
150 spectrum->binaryDataArrayPtrs[1]->data[i] == 3*i);
153 spectrum = spectrumList.
spectrum(1);
168 for (
int i=0; i<3; i++)
170 vector<TimeIntensityPair> pairs;
183 for (
size_t i=0; i<3; i++)
185 vector<TimeIntensityPair> result;
188 for (
size_t j=0; j<10; j++)
189 unit_assert(result[j].time==j && result[j].intensity==10*i+j);
199 string id =
"hair=blue favorite=420 age=36.175 upsideDown=1";
201 map<string,string> parsedID =
id::parse(
id);
205 unit_assert(id::valueAs<int>(
id,
"favorite") == 420);
207 unit_assert(id::valueAs<bool>(
id,
"upsideDown") ==
true);
212 id =
"controllerType=0 controllerNumber=1 scan=123";
239 id =
"sample=1 period=2 cycle=123 experiment=3";
266 int main(
int argc,
const char* argv[])
virtual size_t find(const std::string &id) const
find id in the spectrum index (returns size() on failure)
MS_MSn_spectrum
MSn spectrum: MSn refers to multi-stage MS/MS experiments designed to record product ion spectra wher...
Interface for accessing chromatograms, which may be stored in memory or backed by a data file (RAW...
MS_Bruker_Agilent_YEP_nativeID_format
Bruker/Agilent YEP nativeID format: scan=xsd:nonNegativeInteger.
Description of the way in which a particular software was used.
virtual const boost::shared_ptr< const DataProcessing > dataProcessingPtr() const
returns the data processing affecting spectra retrieved through this interface
virtual const SpectrumIdentity & spectrumIdentity(size_t index) const =0
access to a spectrum index
MS_spectrum_identifier_nativeID_format
spectrum identifier nativeID format: spectrum=xsd:nonNegativeInteger.
std::vector< ChromatogramPtr > chromatograms
boost::shared_ptr< Spectrum > SpectrumPtr
#define unit_assert_equal(x, y, epsilon)
boost::shared_ptr< DataProcessing > DataProcessingPtr
MS_no_nativeID_format
no nativeID format: No nativeID format indicates that the file tagged with this term does not contain...
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData=false) const =0
retrieve a spectrum by index
PWIZ_API_DECL std::string abbreviate(const std::string &id, char delimiter= '.')
abbreviates a nativeID ("name1=value1 name2=value2" translates to "value1.value2") ...
virtual size_t size() const =0
returns the number of spectra
MS_Bruker_BAF_nativeID_format
Bruker BAF nativeID format: scan=xsd:nonNegativeInteger.
void testSpectrumListSimple()
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW...
UO_second
second: A time unit which is equal to the duration of 9 192 631 770 periods of the radiation correspo...
MS_intensity_array
intensity array: A data array of intensity values.
MS_m_z_array
m/z array: A data array of m/z values.
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
PWIZ_API_DECL std::map< std::string, std::string > parse(const std::string &id)
parses an id string into a map<string,string>
MS_WIFF_nativeID_format
WIFF nativeID format: sample=xsd:nonNegativeInteger period=xsd:nonNegativeInteger cycle=xsd:nonNegati...
The data point type of a mass spectrum.
#define unit_assert_operator_equal(expected, actual)
Simple writeable in-memory implementation of ChromatogramList.
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
virtual const boost::shared_ptr< const DataProcessing > dataProcessingPtr() const
returns the data processing affecting spectra retrieved through this interface
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
The data point type of a chromatogram.
std::vector< DataProcessingPtr > allDataProcessingPtrs() const
return dataProcessingPtrs augmented by the dataProcessingPtr() set in SpectrumList and/or Chromatogra...
void testAllDataProcessing()
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
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.
Identifying information for a spectrum.
MS_scan_number_only_nativeID_format
scan number only nativeID format: scan=xsd:nonNegativeInteger.
std::vector< DataProcessingPtr > dataProcessingPtrs
list and descriptions of data processing applied to this data.
virtual IndexList findNameValue(const std::string &name, const std::string &value) const
find all spectrum indexes with specified name/value pair
MS_Thermo_nativeID_format
Thermo nativeID format: controllerType=xsd:nonNegativeInteger controllerNumber=xsd:positiveInteger sc...
#define TEST_PROLOG(argc, argv)
virtual ChromatogramPtr chromatogram(size_t index, bool getBinaryData=false) const =0
retrieve a chromatogram by index
MS_multiple_peak_list_nativeID_format
multiple peak list nativeID format: index=xsd:nonNegativeInteger.
boost::shared_ptr< SpectrumListSimple > SpectrumListSimplePtr
PWIZ_API_DECL std::string value(const std::string &id, const std::string &name)
convenience function to extract a named value from an id string
PWIZ_API_DECL std::string translateNativeIDToScanNumber(CVID nativeIDFormat, const std::string &id)
translates a nativeID in the given nativeID format to a simple integer "scan number"; some nativeID f...
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
virtual size_t size() const =0
returns the number of chromatograms
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Simple writeable in-memory implementation of SpectrumList.
boost::shared_ptr< Chromatogram > ChromatogramPtr
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
PWIZ_API_DECL std::string translateScanNumberToNativeID(CVID nativeIDFormat, const std::string &scanNumber)
translates a "scan number" to a string that is correct for the given nativeID format; semantic validi...
MS_number_of_counts
number of counts: The number of counted events observed in one or a group of elements of a detector...
represents a tag-value pair, where the tag comes from the controlled vocabulary