24#ifndef _IDENTDATA_TEXTWRITER_HPP_
25#define _IDENTDATA_TEXTWRITER_HPP_
31#include <boost/foreach.hpp>
42using namespace boost::logic;
49 :
os_(os), depth_(depth), indent_(depth*2,
' ')
60 os_ << indent_ << text << std::endl;
67 os_ << indent_ << value << std::endl;
75 if (!cvParam.
value.empty())
86 os_ << indent_ << label << v << std::endl;
93 os_ << indent_ << label << v << std::endl;
100 os_ << indent_ << label << std::boolalpha << v << std::endl;
107 os_ << indent_ <<
"userParam: " << userParam.
name;
108 if (!userParam.
value.empty())
os_ <<
", " << userParam.
value;
109 if (!userParam.
type.empty())
os_ <<
", " << userParam.
type;
116 template<
typename object_type>
120 for_each(v.begin(), v.end(), child());
125 template<
typename object_type>
128 for_each(v.begin(), v.end(), child());
133 template<
typename object_type>
136 (*this)(label + boost::lexical_cast<std::string>(v));
144 for_each(paramContainer.
cvParams.begin(), paramContainer.
cvParams.end(), child());
152 for_each(paramContainer.
cvParams.begin(), paramContainer.
cvParams.end(), *
this);
160 (*this)(
"BibliographicReference: ");
163 child()(
"authors: "+br.
authors);
169 child()(
"editor: "+br.
editor);
171 child()(
"year: ", br.
year);
173 child()(
"volume: "+br.
volume);
174 if (!br.
issue.empty())
175 child()(
"issue: "+br.
issue);
176 if (!br.
pages.empty())
177 child()(
"pages: "+br.
pages);
178 if (!br.
title.empty())
179 child()(
"title: "+br.
title);
187 (*this)(
"TranslationTable:");
195 (*this)(
"DatabaseTranslation:");
197 child()(
"frames: ", dt.
frames);
206 (*this)(
"SpectrumIdentificationProtocol:");
238 (*this)(
"DBSequence: ");
241 child()(
"length: ", ds.
length);
247 child()(
"Seq: "+ds.
seq);
255 (*this)(
"SubstitutionModification: ");
271 (*this)(
"IonType: ");
272 if (!it.
index.empty())
273 child()(
"index: " + makeDelimitedListString(it.
index));
275 child()(
"charge: ", it.
charge);
285 (*this)(
"Measure: ");
294 (*this)(
"SearchDatabase: ");
297 child()(
"location: " + sd.
location);
299 child()(
"version: " + sd.
version);
316 (*this)(
"SpectraData: ");
318 child()(
"location: " + sd.
location);
331 (*this)(
"SpectrumIdentificationItem:");
333 child()(
"id: ", sii.
id);
334 if (!sii.
name.empty())
335 child()(
"name: ", sii.
name);
338 child()(
"rank: ", sii.
rank);
350 child()(
"sample_ref: ", sii.
samplePtr->id);
353 if (pe.get() && !pe->empty())
354 child()(
"peptideEvidence_ref: ", pe->id);
367 (*this)(
"SpectrumIdentificationResult: ");
382 (*this)(
"SpectrumIdentificationList: ");
396 (*this)(
"ProteinDetectionList: ");
406 (*this)(
"AnalysisData: ");
420 (*this)(
"FragmentArray: ");
425 child()(
"values: " + makeDelimitedListString(fa.
values));
437 child()(
"location: " + sf.
location);
441 child()(
"externalFormatDocumentation: ",
465 (*this)(
"DataCollection: ");
482 child()(
"include: ", f.
include);
484 child()(
"exclude: ", f.
exclude);
491 (*this)(
"SearchModification: ");
497 child()(
"residues: " + makeDelimitedListString(sm.
residues));
507 (*this)(
"Enzymes: ");
511 child()(
"enzymes: ", ezs.
enzymes);
518 (*this)(
"MassTable: ");
520 child()(
"id: " + mt.
id);
522 child()(
"msLevel: ", mt.
msLevel);
526 child()(
"ambiguousResidue: ", mt.
residues);
533 (*this)(
"AnalysisProtocolCollection: ");
535 child()(
"spectrumIdentificationProtocol: ",
538 child()(
"proteinDetectionProtocol: ",
546 (*this)(
"PeptideHypothesis: ");
557 (*this)(
"ProteinDetectionHypothesis: ");
572 (*this)(
"ProteinAmbiguityGroup: ");
583 (*this)(
"ProteinDetection: ");
599 (*this)(
"SpectrumIdentification: ");
609 child()(
"inputSpectra: " + makeDelimitedRefListString(si.
inputSpectra));
611 child()(
"searchDatabase: " + makeDelimitedRefListString(si.
searchDatabase));
628 (*this)(
"SequenceCollection: ");
666 (*this)(
"Organization: ");
669 child()(
"Parent: ", org.
parent->id);
677 if (
dynamic_cast<Person*
>(cont.get()))
678 (*this)((
const Person&)(*cont));
699 (*this)(
"ContactRole: ");
702 if (!cr.CVParam::empty())
703 child()(
"Role: ", (
const CVParam&)cr);
710 (*this)(
"Provider: ");
732 (*this)(
"AnalysisSampleCollection: ", asc.
samples);
740 (*this)(
"analysisSoftware:");
742 if (!asp->version.empty())
743 child()(
"version: "+asp->version);
744 if (asp->contactRolePtr.get() && asp->contactRolePtr->empty())
745 child()(*asp->contactRolePtr);
746 if (!asp->softwareName.empty())
747 child()(
"softwareName: ", asp->softwareName);
748 if (!asp->URI.empty())
749 child()(
"uri: "+asp->URI);
750 if (!asp->customizations.empty())
751 child()(
"customizations: "+asp->customizations);
759 if (!enzyme.
id.empty())
760 child()(
"id: "+enzyme.
id);
765 child()(
"semiSpecific: ", (enzyme.
terminalSpecificity != proteome::Digestion::FullySpecific ?
"true":
"false"));
782 child()(
"id: "+
id.id);
783 if (!
id.name.empty())
784 child()(
"name: "+
id.name);
793 child()(
"id: "+
id.id);
794 if (!
id.name.empty())
795 child()(
"name: "+
id.name);
805 (*this)(
"Residue: ");
807 child()(
"code: ", res.
code);
809 child()(
"mass: ", res.
mass);
816 (*this)(
"AmbiguousResidue: ");
818 child()(
"code: ", res.
code);
827 (*this)(
"Modification: ");
829 child()(
"location: ", mod.
location);
831 child()(
"residues: " + makeDelimitedListString(mod.
residues));
844 (*this)(
"Peptide: ");
859 (*this)(
"PeptideEvidence: ");
866 child()(
"start: ", pe.
start);
868 child()(
"end: ", pe.
end);
870 child()(
"pre: ", pe.
pre);
872 child()(
"post: ", pe.
post);
876 child()(
"frame: ", pe.
frame);
877 child()(
"isDecoy: ", pe.
isDecoy);
887 (
"version: " + mzid.
version());
888 if (!mzid.
cvs.empty())
889 child()(
"cvList: ", mzid.
cvs);
925 template<
typename object_type>
928 return p.get() ? (*this)(*p) : *
this;
936 template <
typename object_type>
939 std::ostringstream oss;
940 for (
size_t i=0; i < objects.size(); ++i)
942 if (i > 0) oss << delimiter;
943 oss << objects[i]->id;
948 template <
typename object_type>
951 std::ostringstream oss;
953 for (
size_t i=0; i < objects.size(); ++i)
955 if (i > 0) oss << delimiter;
TextWriter & operator()(const Enzymes &ezs)
TextWriter & operator()(const CV &cv)
TextWriter & operator()(const std::string &label, const float &v)
TextWriter & operator()(const SubstitutionModification &ds)
TextWriter & operator()(const AnalysisProtocolCollection &apc)
TextWriter & operator()(const SpectraData &sd)
TextWriter & operator()(const IdentifiableParamContainer &id)
std::string makeDelimitedRefListString(const std::vector< boost::shared_ptr< object_type > > &objects, const char *delimiter=" ")
TextWriter & operator()(const PeptideHypothesis &ph)
TextWriter & operator()(const BibliographicReference &br)
TextWriter & operator()(const ProteinDetectionList &pdl)
TextWriter & operator()(const DataCollection &dc)
TextWriter & operator()(const Person &per)
TextWriter & operator()(const SpectrumIdentificationItem &sii)
TextWriter & operator()(const Sample &sample)
TextWriter & operator()(const SequenceCollection &sc)
TextWriter & operator()(const std::string &label, const object_type &v)
TextWriter & operator()(const PeptideEvidence &pe)
TextWriter & operator()(const IdentData &mzid)
std::string makeDelimitedListString(const std::vector< object_type > &objects, const char *delimiter=" ")
TextWriter & operator()(const TranslationTable &tt)
TextWriter & operator()(const SearchModification &sm)
TextWriter & operator()(const SearchDatabase &sd)
TextWriter & operator()(const MassTable &mt)
TextWriter & operator()(const Provider &provider)
TextWriter & operator()(const Contact &cont)
TextWriter & operator()(const FragmentArray &fa)
TextWriter & operator()(const Organization &org)
TextWriter & operator()(const AnalysisSampleCollection &asc)
TextWriter & operator()(const CVParam &cvParam)
TextWriter & operator()(const std::string &label, const std::vector< object_type > &v)
TextWriter & operator()(const Peptide &pep)
TextWriter & operator()(const std::string &label, const ContactPtr cont)
TextWriter & operator()(const ContactRole &cr)
TextWriter & operator()(const Residue &res)
TextWriter & operator()(const UserParam &userParam)
TextWriter & operator()(const std::string &text)
TextWriter & operator()(const ProteinAmbiguityGroup &pag)
TextWriter & operator()(const Modification &mod)
TextWriter & operator()(const AmbiguousResidue &res)
TextWriter & operator()(const SourceFile &sf)
TextWriter & operator()(const SpectrumIdentificationProtocol &si)
TextWriter & operator()(const Filter &f)
TextWriter & operator()(const Enzyme &enzyme)
TextWriter & operator()(const AnalysisData &ad)
TextWriter(std::ostream &os, int depth=0)
TextWriter & operator()(const std::string &label, const ParamContainer ¶mContainer)
TextWriter & operator()(const std::string &label, const bool &v)
TextWriter & operator()(const ParamContainer ¶mContainer)
TextWriter & operator()(const ContactPtr cont)
TextWriter & operator()(const SpectrumIdentification &si)
TextWriter & operator()(const Identifiable &id)
TextWriter & operator()(const DBSequence &ds)
TextWriter & operator()(const std::string &label, const double &v)
TextWriter & operator()(const float value)
TextWriter & operator()(const Inputs &inputs)
TextWriter & operator()(const std::vector< object_type > &v)
TextWriter & operator()(const SpectrumIdentificationResult &sir)
TextWriter & operator()(const Measure &m)
TextWriter & operator()(const DatabaseTranslation &dt)
TextWriter & operator()(const ProteinDetectionHypothesis &pdh)
TextWriter & operator()(const ProteinDetection &pd)
TextWriter & operator()(const AnalysisSoftwarePtr &asp)
TextWriter & operator()(const boost::shared_ptr< object_type > &p)
TextWriter & operator()(const AnalysisCollection &ac)
TextWriter & operator()(const SpectrumIdentificationList &sil)
TextWriter & operator()(const IonType &it)
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
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< CVParam > cvParams
a collection of controlled vocabulary terms
std::vector< UserParam > userParams
a collection of uncontrolled user terms
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).
Implementation of AmbiguousResidueType from the mzIdentML schema.
Implementation of AnalysisCollectionType from the mzIdentML schema.
std::vector< SpectrumIdentificationPtr > spectrumIdentification
ProteinDetection proteinDetection
Implementation of AnalysisDataType from the mzIdentML schema.
std::vector< SpectrumIdentificationListPtr > spectrumIdentificationList
ProteinDetectionListPtr proteinDetectionListPtr
Implementation of AnalysisProtocolCollectionType from the mzIdentML schema.
std::vector< ProteinDetectionProtocolPtr > proteinDetectionProtocol
std::vector< SpectrumIdentificationProtocolPtr > spectrumIdentificationProtocol
Implementation of AnalysisSampleCollectionType from mzIdentML schema.
std::vector< SamplePtr > samples
Implementation for the BibliographicReferenceType tag in the mzIdentML schema.
Implementation of DBSequenceType from the mzIdentML schema.
SearchDatabasePtr searchDatabasePtr
Implementation of DataCollectionType from the mzIdentML schema.
AnalysisData analysisData
Implementation of DatabaseTranslationType from the mzIdentML schema.
std::vector< TranslationTablePtr > translationTable
std::vector< int > frames
Implementation of EnzymeType from the mzIdentML schema.
proteome::Digestion::Specificity terminalSpecificity
ParamContainer enzymeName
Implementation of EnzymesType from the mzIdentML schema.
std::vector< EnzymePtr > enzymes
boost::logic::tribool independent
Implementation of FilterType from the mzIdentML schema.
ParamContainer filterType
Implementation of FragmentArrayType from the mzIdentML schema.
std::vector< double > values
Implementation of the MzIdentMLType from the mzIdentML schema.
SequenceCollection sequenceCollection
DataCollection dataCollection
AnalysisProtocolCollection analysisProtocolCollection
std::vector< AnalysisSoftwarePtr > analysisSoftwareList
std::vector< ContactPtr > auditCollection
const std::string & version() const
returns the version of this mzIdentML document; for a document created programmatically,...
std::vector< BibliographicReferencePtr > bibliographicReference
AnalysisSampleCollection analysisSampleCollection
AnalysisCollection analysisCollection
Parent class representing extensions of the IdentifiableType from the mzIdentML schema.
Parent class of all Identifiable objects that have ParamGroups.
Implementation of IonTypeType from the mzIdentML schema.
std::vector< FragmentArrayPtr > fragmentArray
Implementation of MassTableType from the mzIdentML schema.
std::vector< ResiduePtr > residues
std::vector< AmbiguousResiduePtr > ambiguousResidue
std::vector< int > msLevel
Implementation of MeasureType from the mzIdentML schema.
Implementation of ModificationType from the mzIdentML schema.
double monoisotopicMassDelta
std::vector< char > residues
Implementation of AbstractOrganizationType from the mzIdentML schema.
boost::shared_ptr< Organization > parent
Implementation of PeptideEvidenceType from the mzIdentML schema.
DBSequencePtr dbSequencePtr
TranslationTablePtr translationTablePtr
Implementation of PeptideType from the mzIdentML schema.
std::vector< ModificationPtr > modification
std::vector< SubstitutionModificationPtr > substitutionModification
std::string peptideSequence
Implementation of PeptideHypothesisType from the mzIdentML schema.
PeptideEvidencePtr peptideEvidencePtr
std::vector< SpectrumIdentificationItemPtr > spectrumIdentificationItemPtr
Implementation of PersonType from the mzIdentML schema.
std::vector< OrganizationPtr > affiliations
Implementation of ProteinAmbiguityGroupType from the mzIdentML schema.
std::vector< ProteinDetectionHypothesisPtr > proteinDetectionHypothesis
Implementation of ProteinDetectionType from the mzIdentML schema.
std::vector< SpectrumIdentificationListPtr > inputSpectrumIdentifications
ProteinDetectionProtocolPtr proteinDetectionProtocolPtr
ProteinDetectionListPtr proteinDetectionListPtr
virtual bool empty() const
Implementation of ProteinDetectionHypothesisType from the mzIdentML schema.
std::vector< PeptideHypothesis > peptideHypothesis
DBSequencePtr dbSequencePtr
Implementation of ProteinDetectionListType from the mzIdentML schema.
std::vector< ProteinAmbiguityGroupPtr > proteinAmbiguityGroup
Implementation of ProviderType from the mzIdentML schema.
ContactRolePtr contactRolePtr
Implementation of ResidueType from the mzIdentML schema.
Implementation of the SampleType from the mzIdentML schema.
std::vector< boost::shared_ptr< Sample > > subSamples
std::vector< ContactRolePtr > contactRole
Implementation of SearchDatabaseType from the mzIdentML schema.
long numDatabaseSequences
ParamContainer databaseName
Implementation of SearchModificationType from the mzIdentML schema.
std::vector< char > residues
Implementation of SequenceCollectionType from the mzIdentML schema.
std::vector< DBSequencePtr > dbSequences
std::vector< PeptideEvidencePtr > peptideEvidence
std::vector< PeptidePtr > peptides
Implementation of SourceFileType from the mzIdentML schema.
std::vector< std::string > externalFormatDocumentation
Implementation of SpectraDataType from the mzIdentML schema.
std::vector< std::string > externalFormatDocumentation
Implementation of SpectrumIdentificationType from the mzIdentML schema.
std::vector< SpectraDataPtr > inputSpectra
SpectrumIdentificationListPtr spectrumIdentificationListPtr
std::vector< SearchDatabasePtr > searchDatabase
SpectrumIdentificationProtocolPtr spectrumIdentificationProtocolPtr
Implementation of SpectrumIdentificationItemType from the mzIdentML schema.
double calculatedMassToCharge
std::vector< PeptideEvidencePtr > peptideEvidencePtr
MassTablePtr massTablePtr
double experimentalMassToCharge
std::vector< IonTypePtr > fragmentation
Implementation of SpectrumIdentificationListType from the mzIdentML schema.
std::vector< SpectrumIdentificationResultPtr > spectrumIdentificationResult
std::vector< MeasurePtr > fragmentationTable
long numSequencesSearched
Implementation of SpectrumIdentificationProtocolType from the mzIdentML schema.
ParamContainer additionalSearchParams
std::vector< SearchModificationPtr > modificationParams
ParamContainer fragmentTolerance
DatabaseTranslationPtr databaseTranslation
std::vector< FilterPtr > databaseFilters
std::vector< MassTablePtr > massTable
ParamContainer parentTolerance
AnalysisSoftwarePtr analysisSoftwarePtr
Implementation of SpectrumIdentificationResultType from the mzIdentML schema.
SpectraDataPtr spectraDataPtr
std::vector< SpectrumIdentificationItemPtr > spectrumIdentificationItem
Implementation of SubstitutionModificationType from the mzIdentML schema.
double monoisotopicMassDelta
Implementation of TranslationTableType from the mzIdentML schema.