31 using namespace pwiz::util;
33 using namespace pwiz::msdata;
44 os <<
"Spectrum cache indices (from MRU to LRU):";
45 for (SpectrumListCache::CacheType::iterator itr = cache.
begin(); itr != cache.
end(); ++itr)
46 os <<
" " << itr->second->index;
90 spectrum->index = index;
93 spectrum->precursors.push_back(
Precursor(123.4));
97 for (
size_t i=0; i < (index+1)*10; ++i)
99 mzArray.
data.push_back(i);
100 intensityArray.
data.push_back(i*100);
102 spectrum->defaultArrayLength = mzArray.
data.size();
146 if (
os_) *
os_ << cache << endl;
164 boost::shared_ptr<stringstream> ss(
new stringstream);
166 serializer.
write(*ss, msd, 0);
167 serializer.
read(ss, msd);
187 if (
os_) *
os_ << cache << endl;
195 if (
os_) *
os_ << cache << endl;
208 if (
os_) *
os_ << cache << endl;
217 if (
os_) *
os_ << cache << endl;
227 if (
os_) *
os_ << cache << endl;
250 boost::shared_ptr<stringstream> ss(
new stringstream);
252 serializer.
write(*ss, msd, 0);
253 serializer.
read(ss, msd);
271 if (
os_) *
os_ << cache << endl;
278 if (
os_) *
os_ << cache << endl;
286 if (
os_) *
os_ << cache << endl;
294 if (
os_) *
os_ << cache << endl;
305 if (
os_) *
os_ << cache << endl;
329 boost::shared_ptr<stringstream> ss(
new stringstream);
331 serializer.
write(*ss, msd, 0);
332 serializer.
read(ss, msd);
350 if (
os_) *
os_ << cache << endl;
359 if (
os_) *
os_ << cache << endl;
367 if (
os_) *
os_ << cache << endl;
378 if (
os_) *
os_ << cache << endl;
389 if (
os_) *
os_ << cache << endl;
400 std::string srcparent(__FILE__);
402 size_t pos = srcparent.rfind(
"pwiz");
403 srcparent.resize(pos);
404 std::string example_data_dir = srcparent +
"example_data/";
423 c->binaryDataArrayPtrs[0]->data[0]);
424 unit_assert(!s->binaryDataArrayPtrs[1]->data.empty());
425 unit_assert(!c->binaryDataArrayPtrs[1]->data.empty());
427 c->binaryDataArrayPtrs[1]->data[0]);
446 int main(
int argc,
char* argv[])
452 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
MS_MSn_spectrum
MSn spectrum: MSn refers to multi-stage MS/MS experiments designed to record product ion spectra wher...
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 ...
void testFileReads(const char *filename)
ScanList scanList
list of scans
void testMemoryMRUCache()
The method of precursor ion selection and activation.
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData=false) const
returns the requested spectrum which may or may not be cached depending on the current cache mode ...
boost::shared_ptr< Spectrum > SpectrumPtr
bool spectrumHasBinaryData(const Spectrum &s)
std::vector< Precursor > precursors
list and descriptions of precursors to the spectrum currently being described.
bool hasBinaryData() const
returns true iff has nonnull and nonempty BinaryDataArrayPtr
void testModeMetaDataOnly()
MS_ms_level
ms level: Stages of ms achieved in a multi stage mass spectrometry experiment.
void write(std::ostream &os, const MSData &msd, const pwiz::util::IterationListenerRegistry *iterationListenerRegistry=0) const
write MSData object to ostream as MGF; iterationListenerRegistry may be used to receive progress upda...
std::vector< UserParam > userParams
a collection of uncontrolled user terms
#define unit_assert_operator_equal(expected, actual)
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
adds a level of flexible MRU caching to a SpectrumList processor chain
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
void read(boost::shared_ptr< std::istream > is, MSData &msd) const
read in MSData object from an MGF istream note: istream may be managed by MSData's SpectrumList...
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
PWIZ_API_DECL std::ostream & operator<<(std::ostream &os, const PeakDetectorMatchedFilter::Score &a)
MemoryMRUCacheMode_MetaDataOnly
void testModeMetaDataAndBinaryData()
MSData object plus file I/O.
MSData <-> MGF stream serialization.
std::vector< double > data
the binary data.
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
MemoryMRUCacheMode_BinaryDataOnly
SpectrumPtr makeSpectrumPtr(size_t index, const string &id)
const item_type & mru() const
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.
bool spectrumHasMetadata(const Spectrum &s)
#define TEST_PROLOG(argc, argv)
CacheType & spectrumCache()
returns a reference to the cache, to enable clearing it or changing the mode
SourceFilePtr sourceFilePtr
this attribute can optionally reference the 'id' of the appropriate sourceFile.
std::size_t max_size() const
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the 'id' of the appropriate dataProcessing.
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
const item_type & lru() const
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Simple writeable in-memory implementation of SpectrumList.
void testModeBinaryDataOnly()
bool insert(const item_type &item)
MS_number_of_counts
number of counts: The number of counted events observed in one or a group of elements of a detector...