Go to the documentation of this file.
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[])
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Simple writeable in-memory implementation of ChromatogramList.
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...
void testAllDataProcessing()
Identifying information for a spectrum.
The structure that captures the generation of a peak list (including the underlying acquisitions)
MS_WIFF_nativeID_format
WIFF nativeID format: Native format defined by sample=xsd:nonNegativeInteger period=xsd:nonNegativeIn...
PWIZ_API_DECL std::map< std::string, std::string > parse(const std::string &id)
parses an id string into a map<string,string>
MS_m_z_array
m/z array: A data array of m/z values.
virtual const boost::shared_ptr< const DataProcessing > dataProcessingPtr() const
returns the data processing affecting spectra retrieved through this interface
#define unit_assert_equal(x, y, epsilon)
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...
virtual size_t size() const =0
returns the number of spectra
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData=false) const =0
retrieve a spectrum by index
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
MS_MSn_spectrum
MSn spectrum: MSn refers to multi-stage MS2 experiments designed to record product ion spectra where ...
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 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_no_nativeID_format
no nativeID format: No nativeID format indicates that the file tagged with this term does not contain...
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
virtual size_t find(const std::string &id) const
find id in the spectrum index (returns size() on failure)
UO_second
second: A time unit which is equal to the duration of 9 192 631 770 periods of the radiation correspo...
#define unit_assert_operator_equal(expected, actual)
int main(int argc, char *argv[])
virtual const SpectrumIdentity & spectrumIdentity(size_t index) const =0
access to a spectrum index
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
MS_spectrum_identifier_nativeID_format
spectrum identifier nativeID format: Native format defined by spectrum=xsd:nonNegativeInteger.
MS_Bruker_Agilent_YEP_nativeID_format
Bruker/Agilent YEP nativeID format: Native format defined by scan=xsd:nonNegativeInteger.
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
MS_Bruker_BAF_nativeID_format
Bruker BAF nativeID format: Native format defined by scan=xsd:nonNegativeInteger.
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...
virtual ChromatogramPtr chromatogram(size_t index, bool getBinaryData=false) const =0
retrieve a chromatogram by index
MS_scan_number_only_nativeID_format
scan number only nativeID format: Native format defined by scan=xsd:nonNegativeInteger.
boost::shared_ptr< Spectrum > SpectrumPtr
MS_intensity_array
intensity array: A data array of intensity values.
Simple writeable in-memory implementation of SpectrumList.
The data point type of a chromatogram.
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here....
MS_Thermo_nativeID_format
Thermo nativeID format: Native format defined by controllerType=xsd:nonNegativeInteger controllerNumb...
virtual size_t size() const =0
returns the number of chromatograms
#define TEST_PROLOG(argc, argv)
boost::shared_ptr< DataProcessing > DataProcessingPtr
std::vector< DataProcessingPtr > allDataProcessingPtrs() const
return dataProcessingPtrs augmented by the dataProcessingPtr() set in SpectrumList and/or Chromatogra...
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
std::vector< DataProcessingPtr > dataProcessingPtrs
list and descriptions of data processing applied to this data.
MS_multiple_peak_list_nativeID_format
multiple peak list nativeID format: Native format defined by index=xsd:nonNegativeInteger.
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Description of the way in which a particular software was used.
PWIZ_API_DECL std::string abbreviate(const std::string &id, char delimiter='.')
abbreviates a nativeID ("name1=value1 name2=value2" translates to "value1.value2")
boost::shared_ptr< Chromatogram > ChromatogramPtr
The data point type of a mass spectrum.
Interface for accessing chromatograms, which may be stored in memory or backed by a data file (RAW,...
represents a tag-value pair, where the tag comes from the controlled vocabulary
void testSpectrumListSimple()
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW,...
virtual IndexList findNameValue(const std::string &name, const std::string &value) const
find all spectrum indexes with specified name/value pair
boost::shared_ptr< SpectrumListSimple > SpectrumListSimplePtr
virtual const boost::shared_ptr< const DataProcessing > dataProcessingPtr() const
returns the data processing affecting spectra retrieved through this interface
std::vector< ChromatogramPtr > chromatograms