Go to the documentation of this file.
24 #ifndef _TEXTWRITER_HPP_
25 #define _TEXTWRITER_HPP_
30 #include "boost/lexical_cast.hpp"
48 TextWriter(std::ostream& os,
int depth = 0,
int arrayExampleCount = 3)
51 arrayExampleCount_(arrayExampleCount < 0 ? std::numeric_limits<size_t>::max()
52 : (size_t) arrayExampleCount),
60 os_ << indent_ << text << std::endl;
67 if (!cvParam.
value.empty())
77 os_ << indent_ <<
"userParam: " << userParam.
name;
79 if (!userParam.
type.empty())
os_ <<
", " << userParam.
type;
85 template<
typename object_type>
89 for_each(v.begin(), v.end(), child());
102 child()(
"version: " + msd.
version());
103 if (!msd.
cvs.empty())
104 child()(
"cvList: ", msd.
cvs);
121 child()(msd.
run, metadata_only);
139 (*this)(
"fileDescription:");
149 for (std::vector<ParamGroupPtr>::const_iterator it=paramContainer.
paramGroupPtrs.begin();
151 (*this)(
"referenceableParamGroupRef: " + (*it)->id);
152 for_each(paramContainer.
cvParams.begin(), paramContainer.
cvParams.end(), *
this);
159 (*this)(
"fileContent:");
166 (*this)(
"sourceFile:");
184 (*this)(
"paramGroup:");
186 (
"id: " + paramGroup.
id)
196 (
"name: " + sample.
name)
203 (*this)(
"instrumentConfiguration:");
205 (
"id: " + instrumentConfiguration.
id)
210 child()(
"softwareRef: " + instrumentConfiguration.
softwarePtr->id);
216 (*this)(
"componentList:");
217 for (
size_t i=0; i < componentList.size(); ++i)
218 child()(componentList[i]);
224 switch(component.
type)
230 (*this)(
"analyzer: ");
233 (*this)(
"detector: ");
239 (
"order: " + boost::lexical_cast<std::string>(component.
order))
246 (*this)(
"software:");
248 (
"id: " + software.
id)
249 (
"version: " + software.
version)
256 (*this)(
"processingMethod:");
258 (
"order: " + boost::lexical_cast<std::string>(processingMethod.
order));
260 child()(
"softwareRef: " + processingMethod.
softwarePtr->id);
268 (*this)(
"dataProcessing:");
284 (*this)(
"scanSettings:");
295 child()(
"id: " + run.
id);
299 child()(
"sampleRef: " + run.
samplePtr->id);
314 std::string text(
"spectrumList (" + boost::lexical_cast<std::string>(spectrumList.
size()) +
" spectra)");
324 for (
size_t index=0; index<spectrumList.
size(); ++index)
326 (*spectrumList.
spectrum(index,
true));
332 return p.get() ? (*this)(*p, metadata_only) : *
this;
337 std::string text(
"chromatogramList (" + boost::lexical_cast<std::string>(chromatogramList.
size()) +
" chromatograms)");
347 for (
size_t index=0; index<chromatogramList.
size(); ++index)
355 return p.get() ? (*this)(*p, metadata_only) : *
this;
360 (*this)(
"spectrum:");
362 (
"index: " + boost::lexical_cast<std::string>(spectrum.
index))
363 (
"id: " + spectrum.
id);
364 if (!spectrum.
spotID.empty())
365 child()(
"spotID: " + spectrum.
spotID);
369 (
"defaultArrayLength: " + boost::lexical_cast<std::string>(spectrum.
defaultArrayLength))
375 child()(
"precursorList: ", spectrum.
precursors);
382 (*this)(
"chromatogram:");
384 (
"index: " + boost::lexical_cast<std::string>(chromatogram.
index))
385 (
"id: " + chromatogram.
id)
386 (
"defaultArrayLength: " + boost::lexical_cast<std::string>(chromatogram.
defaultArrayLength))
412 (*this)(
"scanWindow:");
419 if (!p.get() || p->empty())
return *
this;
421 std::stringstream oss;
422 oss <<
"[" << boost::lexical_cast<std::string>(p->data.size()) <<
"] ";
424 for (
size_t i=0; i < arrayExampleCount_ && i < p->data.size(); i++)
425 oss << p->data[i] <<
" ";
426 if (p->data.size() > arrayExampleCount_)
429 (*this)(
"binaryDataArray:");
431 if (p->dataProcessingPtr.get() && !p->dataProcessingPtr->empty())
432 child()(p->dataProcessingPtr);
433 if (!p->data.empty())
434 child()(
"binary: " + oss.str());
440 (*this)(
"selectedIon:");
447 (*this)(
"precursor:");
454 child()(
"isolationWindow:");
465 child()(
"activation:");
478 child()(
"isolationWindow:");
489 (
"scanList:", scanList.
scans);
494 template<
typename object_type>
497 return p.get() ? (*this)(*p) : *
this;
513 #endif // _TEXTWRITER_HPP_
Uncontrolled user parameters (essentially allowing free text). Before using these,...
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
std::string id
a unique identifier across the samples with which to reference this sample description.
std::string id
a unique identifier for this chromatogram. It should be expected that external files may use this ide...
std::string fullName
the usual name for the resource (e.g. The PSI-MS Controlled Vocabulary).
std::string name
an optional name for the sample description, mostly intended as a quick mnemonic.
TextWriter & operator()(const SpectrumList &spectrumList, bool metadata_only=false)
std::string type
the datatype of the parameter, where appropriate (e.g.: xsd:float).
boost::shared_ptr< SpectrumList > SpectrumListPtr
TextWriter & operator()(const CVParam &cvParam)
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
ComponentList componentList
list with the different components used in the mass spectrometer. At least one source,...
std::vector< SoftwarePtr > softwarePtrs
list and descriptions of software used to acquire and/or process the data in this mzML file.
The structure that captures the generation of a peak list (including the underlying acquisitions)
TextWriter & operator()(const Contact &contact)
virtual const boost::shared_ptr< const DataProcessing > dataProcessingPtr() const
returns the data processing affecting spectra retrieved through this interface
Information about an ontology or CV source and a short 'lookup' tag to refer to.
std::string URI
the URI for the resource.
TextWriter & operator()(const Component &component)
Description of the default peak processing method. This element describes the base method used in the...
std::string id
an optional id for the mzML document. It is recommended to use LSIDs when possible.
SoftwarePtr softwarePtr
this attribute MUST reference the 'id' of the appropriate SoftwareType.
Description of the source file, including location and type.
IsolationWindow isolationWindow
this element captures the isolation (or 'selection') window configured to isolate one or more precurs...
virtual size_t size() const =0
returns the number of spectra
std::vector< SourceFilePtr > sourceFilePtrs
container for a list of source file references.
A run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData=false) const =0
retrieve a spectrum by index
size_t defaultArrayLength
default length of binary data arrays contained in this element.
TextWriter & operator()(const ProcessingMethod &processingMethod)
TextWriter & operator()(const ParamGroup ¶mGroup)
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
std::vector< UserParam > userParams
a collection of uncontrolled user terms
std::string name
name of the source file, without reference to location (either URI or local path).
List and descriptions of scans.
TextWriter & operator()(const Software &software)
TextWriter & operator()(const SelectedIon &selectedIon)
InstrumentConfigurationPtr instrumentConfigurationPtr
this attribute MUST reference the 'id' attribute of the appropriate instrument configuration.
TextWriter & operator()(const Precursor &precursor)
std::string id
the short label to be used as a reference tag with which to refer to this particular Controlled Vocab...
std::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from.
CVID units
an optional CV parameter for the unit term associated with the value, if any (e.g....
std::string accession
an optional accession number for the mzML document.
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
TextWriter & operator()(const SpectrumListPtr &p, bool metadata_only=false)
TextWriter & operator()(const std::string &text)
std::vector< ScanWindow > scanWindows
container for a list of select windows.
TextWriter & operator()(const Run &run, bool metadata_only=false)
TextWriter & operator()(const ScanList &scanList)
bool empty() const
returns true iff the element contains no params and all members are empty or null
SourceFilePtr defaultSourceFilePtr
default source file reference
TextWriter & operator()(const FileDescription &fd)
TextWriter & operator()(const Target &target)
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the 'id' of the appropriate dataProcessing.
TextWriter(std::ostream &os, int depth=0, int arrayExampleCount=3)
constructs a TextWriter for MSData types
TextWriter & operator()(const std::string &label, const std::vector< object_type > &v)
std::vector< ProcessingMethod > processingMethods
description of the default peak processing method(s). This element describes the base method used in ...
std::string version
the version of the CV from which the referred-to terms are drawn.
TextWriter & operator()(const DataProcessing &dp)
std::string spectrumID
reference to the id attribute of the spectrum from which the precursor was selected.
IsolationWindow isolationWindow
this element captures the isolation (or 'selection') window configured to isolate one or more precurs...
std::vector< CV > cvs
container for one or more controlled vocabulary definitions.
List with the different components used in the mass spectrometer. At least one source,...
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
TextWriter & operator()(const Spectrum &spectrum)
std::string id
an identifier for this file.
const PWIZ_API_DECL CV & cv(const std::string &prefix)
returns a CV object for the specified namespace (prefix); currently supported namespaces are: MS UO
ComponentType type
the type of component (Source, Analyzer, or Detector)
TextWriter & operator()(const ParamContainer ¶mContainer)
boost::shared_ptr< ChromatogramList > ChromatogramListPtr
int order
this attribute MUST be used to indicate the order in which the components are encountered from source...
std::string spectrumID
for scans that are local to this document, this attribute can be used to reference the 'id' attribute...
std::string unitsName() const
convenience function to return string for the units
std::string id
the identifier with which to reference this ReferenceableParamGroup.
bool empty() const
returns true iff the element contains no params or param groups
SourceFilePtr sourceFilePtr
this attribute can optionally reference the 'id' of the appropriate sourceFile.
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
std::vector< Target > targets
target list (or 'inclusion list') configured prior to the run.
std::string id
a unique identifier for this data processing that is unique across all DataProcessingTypes.
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the 'id' of the appropriate dataProcessing.
std::string id
a unique identifier for this run.
std::string id
a unique identifier for this acquisition setting.
FileContent fileContent
this summarizes the different types of spectra that can be expected in the file. This is expected to ...
TextWriter & operator()(const ChromatogramListPtr &p, bool metadata_only=false)
std::string id
an identifier for this instrument configuration.
The base class for elements that may contain cvParams, userParams, or paramGroup references.
FileDescription fileDescription
information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
std::string spotID
the identifier for the spot from which this spectrum was derived, if a MALDI or similar run.
TextWriter & operator()(const ChromatogramList &chromatogramList, bool metadata_only=false)
std::vector< ScanSettingsPtr > scanSettingsPtrs
list with the descriptions of the acquisition settings applied prior to the start of data acquisition...
SourceFilePtr sourceFilePtr
if this attribute is set, it must reference the 'id' attribute of a sourceFile representing the exter...
bool empty() const
returns true iff all members are empty or null
virtual ChromatogramPtr chromatogram(size_t index, bool getBinaryData=false) const =0
retrieve a chromatogram by index
TextWriter & operator()(const boost::shared_ptr< object_type > &p)
Information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
std::string value
the value for the parameter, where appropriate.
const PWIZ_API_DECL CVTermInfo & cvTermInfo(CVID cvid)
returns CV term info for the specified CVID
TextWriter & operator()(const InstrumentConfiguration &instrumentConfiguration)
std::string version
the software version.
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i....
std::string location
URI-formatted location where the file was retrieved.
Activation activation
the type and energy level used for activation.
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Description of the acquisition settings of the instrument prior to the start of the run.
std::vector< Contact > contacts
structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam),...
TextWriter & operator()(const Sample &sample)
TextWriter & operator()(const Product &product)
std::string id
an identifier for this software that is unique across all SoftwareTypes.
ScanList scanList
list of scans
TextWriter & operator()(const UserParam &userParam)
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile.
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here....
std::vector< Scan > scans
std::string startTimeStamp
the optional start timestamp of the run, in UT.
virtual size_t size() const =0
returns the number of chromatograms
TextWriter & operator()(const ScanSettings &as)
This summarizes the different types of spectra that can be expected in the file. This is expected to ...
Expansible description of the sample used to generate the dataset, named in sampleName.
std::vector< SamplePtr > samplePtrs
list and descriptions of samples.
TextWriter & operator()(const MSData &msd, bool metadata_only=false)
std::vector< DataProcessingPtr > dataProcessingPtrs
list and descriptions of data processing applied to this data.
TextWriter & operator()(const BinaryDataArrayPtr &p)
size_t arrayExampleCount_
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
std::vector< InstrumentConfigurationPtr > instrumentConfigurationPtrs
list and descriptions of instrument configurations.
TextWriter & operator()(const ComponentList &componentList)
SoftwarePtr softwarePtr
reference to a previously defined software element.
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
std::vector< Precursor > precursors
list and descriptions of precursors to the spectrum currently being described.
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.
TextWriter & operator()(const Scan &scan)
bool empty() const
returns true iff the element contains no params and all members are empty or null
SamplePtr samplePtr
this attribute MUST reference the 'id' of the appropriate sample.
std::vector< SelectedIon > selectedIons
this list of precursor ions that were selected.
Interface for accessing chromatograms, which may be stored in memory or backed by a data file (RAW,...
TextWriter & operator()(const CV &cv)
TextWriter & operator()(const SourceFile &sf)
TextWriter & operator()(const FileContent &fileContent)
The method of precursor ion selection and activation.
std::string externalSpectrumID
for scans that are external to this document, this string must correspond to the 'id' attribute of a ...
size_t defaultArrayLength
default length of binary data arrays contained in this element.
TextWriter & operator()(const ScanWindow &window)
represents a tag-value pair, where the tag comes from the controlled vocabulary
Precursor precursor
description of precursor ion information (i.e. Q1 settings)
InstrumentConfigurationPtr defaultInstrumentConfigurationPtr
this attribute MUST reference the 'id' of the default instrument configuration. If a scan does not re...
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW,...
const std::string & version() const
returns the version of this mzML document; for a document created programmatically,...
TextWriter & operator()(const Chromatogram &chromatogram)
virtual const boost::shared_ptr< const DataProcessing > dataProcessingPtr() const
returns the data processing affecting spectra retrieved through this interface
int order
this attributes allows a series of consecutive steps to be placed in the correct order.
size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
std::string name
the name for the parameter.
Product product
description of product ion information (i.e. Q3 settings)
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
std::vector< ParamGroupPtr > paramGroupPtrs
container for a list of referenceableParamGroups
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms