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;
Interface for accessing chromatograms, which may be stored in memory or backed by a data file (RAW,...
virtual size_t size() const =0
returns the number of chromatograms
virtual ChromatogramPtr chromatogram(size_t index, bool getBinaryData=false) const =0
retrieve a chromatogram by index
virtual const boost::shared_ptr< const DataProcessing > dataProcessingPtr() const
returns the data processing affecting spectra retrieved through this interface
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW,...
virtual const boost::shared_ptr< const DataProcessing > dataProcessingPtr() const
returns the data processing affecting spectra retrieved through this interface
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
TextWriter & operator()(const BinaryDataArrayPtr &p)
TextWriter & operator()(const ParamContainer ¶mContainer)
TextWriter & operator()(const Contact &contact)
TextWriter & operator()(const SelectedIon &selectedIon)
TextWriter & operator()(const ComponentList &componentList)
TextWriter & operator()(const ParamGroup ¶mGroup)
TextWriter & operator()(const ChromatogramListPtr &p, bool metadata_only=false)
TextWriter & operator()(const ProcessingMethod &processingMethod)
TextWriter & operator()(const InstrumentConfiguration &instrumentConfiguration)
TextWriter & operator()(const Target &target)
TextWriter & operator()(const Spectrum &spectrum)
TextWriter & operator()(const Chromatogram &chromatogram)
TextWriter & operator()(const Run &run, bool metadata_only=false)
TextWriter & operator()(const MSData &msd, bool metadata_only=false)
TextWriter & operator()(const SourceFile &sf)
TextWriter & operator()(const Scan &scan)
size_t arrayExampleCount_
TextWriter & operator()(const ScanSettings &as)
TextWriter & operator()(const SpectrumListPtr &p, bool metadata_only=false)
TextWriter & operator()(const SpectrumList &spectrumList, bool metadata_only=false)
TextWriter & operator()(const CV &cv)
TextWriter & operator()(const DataProcessing &dp)
TextWriter & operator()(const Component &component)
TextWriter & operator()(const CVParam &cvParam)
TextWriter & operator()(const FileContent &fileContent)
TextWriter & operator()(const std::string &label, const std::vector< object_type > &v)
TextWriter(std::ostream &os, int depth=0, int arrayExampleCount=3)
constructs a TextWriter for MSData types
TextWriter & operator()(const boost::shared_ptr< object_type > &p)
TextWriter & operator()(const Sample &sample)
TextWriter & operator()(const UserParam &userParam)
TextWriter & operator()(const Precursor &precursor)
TextWriter & operator()(const Software &software)
TextWriter & operator()(const ScanList &scanList)
TextWriter & operator()(const std::string &text)
TextWriter & operator()(const Product &product)
TextWriter & operator()(const ChromatogramList &chromatogramList, bool metadata_only=false)
TextWriter & operator()(const ScanWindow &window)
TextWriter & operator()(const FileDescription &fd)
PWIZ_API_DECL const CVTermInfo & cvTermInfo(CVID cvid)
returns CV term info for the specified CVID
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
boost::shared_ptr< SpectrumList > SpectrumListPtr
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
boost::shared_ptr< ChromatogramList > ChromatogramListPtr
Information about an ontology or CV source and a short 'lookup' tag to refer to.
std::string id
the short label to be used as a reference tag with which to refer to this particular Controlled Vocab...
std::string fullName
the usual name for the resource (e.g. The PSI-MS Controlled Vocabulary).
std::string URI
the URI for the resource.
std::string version
the version of the CV from which the referred-to terms are drawn.
represents a tag-value pair, where the tag comes from the controlled vocabulary
std::string unitsName() const
convenience function to return string for the units
The base class for elements that may contain cvParams, userParams, or paramGroup references.
bool empty() const
returns true iff the element contains no params or param groups
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
std::vector< UserParam > userParams
a collection of uncontrolled user terms
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
std::string id
the identifier with which to reference this ReferenceableParamGroup.
Uncontrolled user parameters (essentially allowing free text). Before using these,...
CVID units
an optional CV parameter for the unit term associated with the value, if any (e.g....
std::string value
the value for the parameter, where appropriate.
std::string name
the name for the parameter.
std::string type
the datatype of the parameter, where appropriate (e.g.: xsd:float).
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the 'id' of the appropriate dataProcessing.
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Precursor precursor
description of precursor ion information (i.e. Q1 settings)
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Product product
description of product ion information (i.e. Q3 settings)
std::string id
a unique identifier for this chromatogram. It should be expected that external files may use this ide...
size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i....
ComponentType type
the type of component (Source, Analyzer, or Detector)
int order
this attribute MUST be used to indicate the order in which the components are encountered from source...
List with the different components used in the mass spectrometer. At least one source,...
Description of the way in which a particular software was used.
std::vector< ProcessingMethod > processingMethods
description of the default peak processing method(s). This element describes the base method used in ...
std::string id
a unique identifier for this data processing that is unique across all DataProcessingTypes.
This summarizes the different types of spectra that can be expected in the file. This is expected to ...
Information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
std::vector< Contact > contacts
structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam),...
FileContent fileContent
this summarizes the different types of spectra that can be expected in the file. This is expected to ...
bool empty() const
returns true iff all members are empty or null
std::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from.
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
ComponentList componentList
list with the different components used in the mass spectrometer. At least one source,...
std::string id
an identifier for this instrument configuration.
SoftwarePtr softwarePtr
reference to a previously defined software element.
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
std::vector< ScanSettingsPtr > scanSettingsPtrs
list with the descriptions of the acquisition settings applied prior to the start of data acquisition...
const std::string & version() const
returns the version of this mzML document; for a document created programmatically,...
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
std::vector< SoftwarePtr > softwarePtrs
list and descriptions of software used to acquire and/or process the data in this mzML file.
std::string accession
an optional accession number for the mzML document.
std::string id
an optional id for the mzML document. It is recommended to use LSIDs when possible.
FileDescription fileDescription
information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
std::vector< InstrumentConfigurationPtr > instrumentConfigurationPtrs
list and descriptions of instrument configurations.
std::vector< ParamGroupPtr > paramGroupPtrs
container for a list of referenceableParamGroups
std::vector< SamplePtr > samplePtrs
list and descriptions of samples.
std::vector< DataProcessingPtr > dataProcessingPtrs
list and descriptions of data processing applied to this data.
std::vector< CV > cvs
container for one or more controlled vocabulary definitions.
The method of precursor ion selection and activation.
bool empty() const
returns true iff the element contains no params and all members are empty or null
std::vector< SelectedIon > selectedIons
this list of precursor ions that were selected.
IsolationWindow isolationWindow
this element captures the isolation (or 'selection') window configured to isolate one or more precurs...
Activation activation
the type and energy level used for activation.
std::string spectrumID
reference to the id attribute of the spectrum from which the precursor was selected.
Description of the default peak processing method. This element describes the base method used in the...
int order
this attributes allows a series of consecutive steps to be placed in the correct order.
SoftwarePtr softwarePtr
this attribute MUST reference the 'id' of the appropriate SoftwareType.
bool empty() const
returns true iff the element contains no params and all members are empty or null
IsolationWindow isolationWindow
this element captures the isolation (or 'selection') window configured to isolate one or more precurs...
A run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
SourceFilePtr defaultSourceFilePtr
default source file reference
std::string id
a unique identifier for this run.
std::string startTimeStamp
the optional start timestamp of the run, in UT.
InstrumentConfigurationPtr defaultInstrumentConfigurationPtr
this attribute MUST reference the 'id' of the default instrument configuration. If a scan does not re...
SamplePtr samplePtr
this attribute MUST reference the 'id' of the appropriate sample.
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here....
Expansible description of the sample used to generate the dataset, named in sampleName.
std::string name
an optional name for the sample description, mostly intended as a quick mnemonic.
std::string id
a unique identifier across the samples with which to reference this sample description.
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile.
std::string spectrumID
for scans that are local to this document, this attribute can be used to reference the 'id' attribute...
std::string externalSpectrumID
for scans that are external to this document, this string must correspond to the 'id' attribute of a ...
InstrumentConfigurationPtr instrumentConfigurationPtr
this attribute MUST reference the 'id' attribute of the appropriate instrument configuration.
SourceFilePtr sourceFilePtr
if this attribute is set, it must reference the 'id' attribute of a sourceFile representing the exter...
std::vector< ScanWindow > scanWindows
container for a list of select windows.
List and descriptions of scans.
std::vector< Scan > scans
Description of the acquisition settings of the instrument prior to the start of the run.
std::vector< Target > targets
target list (or 'inclusion list') configured prior to the run.
std::string id
a unique identifier for this acquisition setting.
std::vector< SourceFilePtr > sourceFilePtrs
container for a list of source file references.
std::string id
an identifier for this software that is unique across all SoftwareTypes.
std::string version
the software version.
Description of the source file, including location and type.
std::string name
name of the source file, without reference to location (either URI or local path).
std::string location
URI-formatted location where the file was retrieved.
std::string id
an identifier for this file.
The structure that captures the generation of a peak list (including the underlying acquisitions)
SourceFilePtr sourceFilePtr
this attribute can optionally reference the 'id' of the appropriate sourceFile.
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the 'id' of the appropriate dataProcessing.
size_t defaultArrayLength
default length of binary data arrays contained in this element.
ScanList scanList
list of scans
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
std::vector< Precursor > precursors
list and descriptions of precursors to the spectrum currently being described.
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
std::string spotID
the identifier for the spot from which this spectrum was derived, if a MALDI or similar run.
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.