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