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