Go to the documentation of this file.
24 #ifndef _IDENTDATA_TEXTWRITER_HPP_
25 #define _IDENTDATA_TEXTWRITER_HPP_
31 #include <boost/foreach.hpp>
42 using 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;
967 #endif // _IDENTDATA_TEXTWRITER_HPP_
Uncontrolled user parameters (essentially allowing free text). Before using these,...
TextWriter & operator()(const SpectraData &sd)
TextWriter & operator()(const ProteinDetectionList &pdl)
std::vector< SearchModificationPtr > modificationParams
std::string fullName
the usual name for the resource (e.g. The PSI-MS Controlled Vocabulary).
Implementation of SpectrumIdentificationItemType from the mzIdentML schema.
Implementation of PersonType from the mzIdentML schema.
TextWriter & operator()(const IdentifiableParamContainer &id)
std::string type
the datatype of the parameter, where appropriate (e.g.: xsd:float).
TextWriter & operator()(const Organization &org)
TextWriter & operator()(const Measure &m)
std::vector< SpectrumIdentificationItemPtr > spectrumIdentificationItem
std::vector< TranslationTablePtr > translationTable
TextWriter & operator()(const AnalysisCollection &ac)
Implementation of PeptideEvidenceType from the mzIdentML schema.
std::vector< ProteinDetectionProtocolPtr > proteinDetectionProtocol
std::vector< AmbiguousResiduePtr > ambiguousResidue
DBSequencePtr dbSequencePtr
TextWriter & operator()(const std::string &label, const double &v)
SpectraDataPtr spectraDataPtr
Implementation of ResidueType from the mzIdentML schema.
ParamContainer additionalSearchParams
std::vector< int > msLevel
TextWriter & operator()(const std::string &label, const std::vector< object_type > &v)
long numDatabaseSequences
TextWriter & operator()(const Contact &cont)
double monoisotopicMassDelta
Information about an ontology or CV source and a short 'lookup' tag to refer to.
Implementation of AmbiguousResidueType from the mzIdentML schema.
std::string URI
the URI for the resource.
TextWriter & operator()(const ParamContainer ¶mContainer)
Implementation of SpectrumIdentificationResultType from the mzIdentML schema.
Implementation of ProteinDetectionHypothesisType from the mzIdentML schema.
Implementation of SpectraDataType from the mzIdentML schema.
TextWriter & operator()(const ProteinAmbiguityGroup &pag)
Implementation of ProviderType from the mzIdentML schema.
TextWriter(std::ostream &os, int depth=0)
TextWriter & operator()(const std::string &label, const float &v)
SearchDatabasePtr searchDatabasePtr
std::vector< FragmentArrayPtr > fragmentArray
TextWriter & operator()(const std::string &label, const bool &v)
AnalysisCollection analysisCollection
SpectrumIdentificationProtocolPtr spectrumIdentificationProtocolPtr
std::vector< BibliographicReferencePtr > bibliographicReference
long numSequencesSearched
std::vector< UserParam > userParams
a collection of uncontrolled user terms
std::vector< SpectrumIdentificationListPtr > inputSpectrumIdentifications
TextWriter & operator()(const Person &per)
TextWriter & operator()(const PeptideHypothesis &ph)
TextWriter & operator()(const Sample &sample)
PWIZ_API_DECL std::string value(const std::string &id, const std::string &name)
convenience function to extract a named value from an id string
Implementation of SubstitutionModificationType from the mzIdentML schema.
TextWriter & operator()(const MassTable &mt)
std::string id
the short label to be used as a reference tag with which to refer to this particular Controlled Vocab...
Implementation of TranslationTableType from the mzIdentML schema.
std::vector< SamplePtr > samples
std::vector< PeptideHypothesis > peptideHypothesis
std::vector< std::string > externalFormatDocumentation
std::vector< ProteinDetectionHypothesisPtr > proteinDetectionHypothesis
CVID units
an optional CV parameter for the unit term associated with the value, if any (e.g....
TextWriter & operator()(const Enzyme &enzyme)
TextWriter & operator()(const AmbiguousResidue &res)
std::vector< MassTablePtr > massTable
ProteinDetectionProtocolPtr proteinDetectionProtocolPtr
Implementation of SourceFileType from the mzIdentML schema.
TextWriter & operator()(const AnalysisProtocolCollection &apc)
std::vector< SpectrumIdentificationPtr > spectrumIdentification
double calculatedMassToCharge
TranslationTablePtr translationTablePtr
std::vector< SpectraDataPtr > inputSpectra
TextWriter & operator()(const float value)
Implementation of AbstractOrganizationType from the mzIdentML schema.
Implementation of IonTypeType from the mzIdentML schema.
Implementation of ProteinDetectionType from the mzIdentML schema.
std::vector< EnzymePtr > enzymes
std::vector< FilterPtr > databaseFilters
std::string version
the version of the CV from which the referred-to terms are drawn.
TextWriter & operator()(const Identifiable &id)
TextWriter & operator()(const Inputs &inputs)
TextWriter & operator()(const UserParam &userParam)
Implementation of EnzymeType from the mzIdentML schema.
TextWriter & operator()(const IonType &it)
TextWriter & operator()(const ContactPtr cont)
TextWriter & operator()(const BibliographicReference &br)
std::vector< ModificationPtr > modification
std::string peptideSequence
TextWriter & operator()(const std::string &label, const object_type &v)
std::vector< PeptideEvidencePtr > peptideEvidence
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
Parent class representing extensions of the IdentifiableType from the mzIdentML schema.
Implementation for the BibliographicReferenceType tag in the mzIdentML schema.
TextWriter & operator()(const AnalysisData &ad)
std::vector< SpectrumIdentificationListPtr > spectrumIdentificationList
Implementation of PeptideHypothesisType from the mzIdentML schema.
Implementation of ModificationType from the mzIdentML schema.
TextWriter & operator()(const FragmentArray &fa)
std::string unitsName() const
convenience function to return string for the units
Implementation of DatabaseTranslationType from the mzIdentML schema.
ParamContainer filterType
bool empty() const
returns true iff the element contains no params or param groups
Implementation of ProteinDetectionListType from the mzIdentML schema.
TextWriter & operator()(const Provider &provider)
std::vector< std::string > externalFormatDocumentation
TextWriter & operator()(const AnalysisSampleCollection &asc)
Implementation of FragmentArrayType from the mzIdentML schema.
ContactRolePtr contactRolePtr
std::string makeDelimitedListString(const std::vector< object_type > &objects, const char *delimiter=" ")
const std::string & version() const
returns the version of this mzIdentML document; for a document created programmatically,...
Implementation of AnalysisProtocolCollectionType from the mzIdentML schema.
TextWriter & operator()(const IdentData &mzid)
ProteinDetectionListPtr proteinDetectionListPtr
Implementation of AnalysisCollectionType from the mzIdentML schema.
std::vector< ResiduePtr > residues
TextWriter & operator()(const std::string &label, const ContactPtr cont)
std::vector< MeasurePtr > fragmentationTable
TextWriter & operator()(const ProteinDetection &pd)
Implementation of PeptideType from the mzIdentML schema.
Implementation of SpectrumIdentificationProtocolType from the mzIdentML schema.
TextWriter & operator()(const DatabaseTranslation &dt)
std::vector< boost::shared_ptr< Sample > > subSamples
TextWriter & operator()(const SpectrumIdentificationResult &sir)
boost::shared_ptr< Organization > parent
The base class for elements that may contain cvParams, userParams, or paramGroup references.
Implementation of SearchModificationType from the mzIdentML schema.
PeptideEvidencePtr peptideEvidencePtr
ParamContainer parentTolerance
ProteinDetectionListPtr proteinDetectionListPtr
Implementation of SequenceCollectionType from the mzIdentML schema.
TextWriter & operator()(const SpectrumIdentificationItem &sii)
AnalysisSoftwarePtr analysisSoftwarePtr
Implementation of MassTableType from the mzIdentML schema.
AnalysisSampleCollection analysisSampleCollection
DatabaseTranslationPtr databaseTranslation
TextWriter & operator()(const ProteinDetectionHypothesis &pdh)
std::vector< DBSequencePtr > dbSequences
TextWriter & operator()(const SearchDatabase &sd)
std::string makeDelimitedRefListString(const std::vector< boost::shared_ptr< object_type > > &objects, const char *delimiter=" ")
TextWriter & operator()(const Enzymes &ezs)
Implementation of DataCollectionType from the mzIdentML schema.
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
std::vector< SpectrumIdentificationItemPtr > spectrumIdentificationItemPtr
Implementation of SearchDatabaseType from the mzIdentML schema.
Implementation of the MzIdentMLType from the mzIdentML schema.
std::vector< ProteinAmbiguityGroupPtr > proteinAmbiguityGroup
Implementation of the SampleType from the mzIdentML schema.
double experimentalMassToCharge
SequenceCollection sequenceCollection
TextWriter & operator()(const CV &cv)
std::vector< SearchDatabasePtr > searchDatabase
std::vector< IonTypePtr > fragmentation
TextWriter & operator()(const AnalysisSoftwarePtr &asp)
proteome::Digestion::Specificity terminalSpecificity
boost::logic::tribool independent
TextWriter & operator()(const std::string &text)
TextWriter & operator()(const SpectrumIdentification &si)
std::vector< PeptidePtr > peptides
TextWriter & operator()(const SequenceCollection &sc)
TextWriter & operator()(const std::string &label, const ParamContainer ¶mContainer)
std::vector< double > values
TextWriter & operator()(const SpectrumIdentificationList &sil)
DataCollection dataCollection
Implementation of AnalysisDataType from the mzIdentML schema.
TextWriter & operator()(const Modification &mod)
TextWriter & operator()(const DBSequence &ds)
virtual bool empty() const
ParamContainer databaseName
Implementation of MeasureType from the mzIdentML schema.
TextWriter & operator()(const TranslationTable &tt)
ParamContainer enzymeName
Implementation of DBSequenceType from the mzIdentML schema.
TextWriter & operator()(const DataCollection &dc)
TextWriter & operator()(const Peptide &pep)
std::vector< char > residues
std::vector< SpectrumIdentificationResultPtr > spectrumIdentificationResult
TextWriter & operator()(const CVParam &cvParam)
ParamContainer fragmentTolerance
Implementation of FilterType from the mzIdentML schema.
DBSequencePtr dbSequencePtr
TextWriter & operator()(const Residue &res)
std::vector< char > residues
TextWriter & operator()(const boost::shared_ptr< object_type > &p)
TextWriter & operator()(const Filter &f)
Implementation of AnalysisSampleCollectionType from mzIdentML schema.
AnalysisProtocolCollection analysisProtocolCollection
std::vector< int > frames
std::vector< SpectrumIdentificationProtocolPtr > spectrumIdentificationProtocol
TextWriter & operator()(const SourceFile &sf)
ProteinDetection proteinDetection
TextWriter & operator()(const ContactRole &cr)
SpectrumIdentificationListPtr spectrumIdentificationListPtr
TextWriter & operator()(const SubstitutionModification &ds)
AnalysisData analysisData
double monoisotopicMassDelta
boost::shared_ptr< Contact > ContactPtr
Implementation of EnzymesType from the mzIdentML schema.
std::vector< AnalysisSoftwarePtr > analysisSoftwareList
Implementation of SpectrumIdentificationListType from the mzIdentML schema.
Parent class of all Identifiable objects that have ParamGroups.
represents a tag-value pair, where the tag comes from the controlled vocabulary
Implementation of SpectrumIdentificationType from the mzIdentML schema.
TextWriter & operator()(const SpectrumIdentificationProtocol &si)
std::vector< SubstitutionModificationPtr > substitutionModification
std::vector< ContactRolePtr > contactRole
TextWriter & operator()(const std::vector< object_type > &v)
std::vector< PeptideEvidencePtr > peptideEvidencePtr
std::string name
the name for the parameter.
TextWriter & operator()(const SearchModification &sm)
Implementation of ProteinAmbiguityGroupType from the mzIdentML schema.
std::vector< ContactPtr > auditCollection
TextWriter & operator()(const PeptideEvidence &pe)
std::vector< OrganizationPtr > affiliations
MassTablePtr massTablePtr
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms