28 using namespace pwiz::util;
29 using namespace pwiz::data;
30 using namespace pwiz::msdata;
45 spectrum0->id =
"sample=1 period=1 cycle=123 experiment=2";
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 =
"sample=1 period=1 cycle=345 experiment=2";
68 spectrumListSimple->spectra.push_back(spectrum0);
69 spectrumListSimple->spectra.push_back(spectrum1);
112 unit_assert(spectrum->binaryDataArrayPtrs.size() == 2);
113 unit_assert(&(spectrum->binaryDataArrayPtrs[0]->data[0]) == buffer);
120 vector<MZIntensityPair> mziPairs;
121 spectrum->getMZIntensityPairs(mziPairs);
124 vector<double> doubleArray;
126 doubleArray.resize(spectrum->defaultArrayLength*2);
127 spectrum->getMZIntensityPairs(reinterpret_cast<MZIntensityPair*>(&doubleArray[0]),
128 spectrum->defaultArrayLength);
130 for (
unsigned int i=0; i<10; i++)
140 spectrum->binaryDataArrayPtrs.clear();
141 unit_assert(spectrum->binaryDataArrayPtrs.empty());
142 vector<MZIntensityPair> mziPairs2;
143 for (
unsigned int i=0; i<10; i++)
146 unit_assert(spectrum->binaryDataArrayPtrs.size() == 2);
150 unit_assert(spectrum->binaryDataArrayPtrs[0]->data.size() == 10);
151 unit_assert(spectrum->binaryDataArrayPtrs[1]->data.size() == 10);
152 for (
unsigned int i=0; i<10; i++)
153 unit_assert(spectrum->binaryDataArrayPtrs[0]->data[i] == 2*i &&
154 spectrum->binaryDataArrayPtrs[1]->data[i] == 3*i);
157 spectrum = spectrumList.
spectrum(1);
172 for (
int i=0; i<3; i++)
174 vector<TimeIntensityPair> pairs;
187 for (
size_t i=0; i<3; i++)
189 vector<TimeIntensityPair> result;
192 for (
size_t j=0; j<10; j++)
193 unit_assert(result[j].time==j && result[j].intensity==10*i+j);
203 string id =
"hair=blue favorite=420 age=36.175 upsideDown=1";
205 map<string,string> parsedID =
id::parse(
id);
209 unit_assert(id::valueAs<int>(
id,
"favorite") == 420);
211 unit_assert(id::valueAs<bool>(
id,
"upsideDown") ==
true);
216 id =
"controllerType=0 controllerNumber=1 scan=123";
243 id =
"sample=1 period=2 cycle=123 experiment=3";
270 int main(
int argc,
char* argv[])
virtual size_t find(const std::string &id) const
find id in the spectrum index (returns size() on failure)
virtual size_t findAbbreviated(const std::string &abbreviatedId, char delimiter= '.') const
find an abbreviated id (e.g. "1.1.123.2" for "sample=1 period=1 cycle=123 experiment=2") in the spect...
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: Native format defined by scan=xsd:nonNegativeInteger.
Description of the way in which a particular software was used.
int main(int argc, char *argv[])
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: Native format defined by 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: Native format defined by 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
MS_WIFF_nativeID_format
WIFF nativeID format: Native format defined by sample=xsd:nonNegativeInteger period=xsd:nonNegativeIn...
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: Native format defined by scan=xsd:nonNegativeInteger.
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...
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: Native format defined by controllerType=xsd:nonNegativeInteger controllerNumb...
#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: Native format defined by 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...
represents a tag-value pair, where the tag comes from the controlled vocabulary