OpenMS
TraMLHandler.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Hannes Roest $
6 // $Authors: Andreas Bertsch, Hannes Roest $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
17 
18 #include <iosfwd>
19 #include <map>
20 
21 namespace OpenMS
22 {
23  namespace Internal
24  {
25 
31  class OPENMS_DLLAPI TraMLHandler :
32  public XMLHandler
33  {
34 public:
35 
36  TraMLHandler() = delete;
37  TraMLHandler(const TraMLHandler & rhs) = delete;
38  TraMLHandler & operator=(const TraMLHandler & rhs) = delete;
39 
40  typedef std::vector<ReactionMonitoringTransition::Product> ProductListType;
41  typedef std::vector<ReactionMonitoringTransition::Configuration> ConfigurationListType;
42 
46  TraMLHandler(const TargetedExperiment & exp, const String & filename, const String & version, const ProgressLogger & logger);
47 
49  TraMLHandler(TargetedExperiment & exp, const String & filename, const String & version, const ProgressLogger & logger);
50 
52  ~TraMLHandler() override;
54 
55 
56  // Docu in base class
57  void endElement(const XMLCh * const /*uri*/, const XMLCh * const /*local_name*/, const XMLCh * const qname) override;
58 
59  // Docu in base class
60  void startElement(const XMLCh * const /*uri*/, const XMLCh * const /*local_name*/, const XMLCh * const qname, const xercesc::Attributes & attributes) override;
61 
62  // Docu in base class
63  void characters(const XMLCh * const chars, const XMLSize_t length) override;
64 
65  //Docu in base class
66  void writeTo(std::ostream & os) override;
67 
68 protected:
69 
72 
75 
77 
79 
81 
83 
85 
87 
89 
91 
93 
95 
97 
99 
101 
103 
105 
107 
108  std::vector<ReactionMonitoringTransition::Product> actual_intermediate_products_;
109 
111 
113 
115 
117  void handleCVParam_(const String & parent_parent_tag, const String & parent_tag, const CVTerm & cv_term);
118 
120  void handleUserParam_(const String & parent_parent_tag, const String & parent_tag, const String & name, const String & type, const String & value);
121 
123  void writeUserParam_(std::ostream & os, const MetaInfoInterface & meta, UInt indent) const;
124 
125  void writeUserParams_(std::ostream & os, const std::vector<MetaInfoInterface> & meta, UInt indent) const;
126 
127  void writeCVParams_(std::ostream & os, const CVTermList & cv_terms, UInt indent) const;
128  void writeCVParams_(std::ostream & os, const CVTermListInterface & cv_terms, UInt indent) const;
129 
130  void writeCVList_(std::ostream & os, const std::map<String, std::vector<CVTerm>> & cv_terms, UInt indent) const;
131 
132  // subfunctions of write
133  void writeTarget_(std::ostream & os, const std::vector<IncludeExcludeTarget>::const_iterator & it) const;
134 
135  void writeRetentionTime_(std::ostream& os, const TargetedExperimentHelper::RetentionTime& rt) const;
136 
137  void writeProduct_(std::ostream & os, const std::vector<ReactionMonitoringTransition::Product>::const_iterator & prod_it) const;
138 
139  void writeConfiguration_(std::ostream & os, const std::vector<ReactionMonitoringTransition::Configuration>::const_iterator & cit) const;
140 
142  ControlledVocabulary::CVTerm getChildWithName_(const String & parent_accession, const String & name) const;
143 
145  //void writeSourceFile_(std::ostream& os, const String& id, const SourceFile& software);
146 
147  };
148  } // namespace Internal
149 } // namespace OpenMS
150 
151 
Interface to the controlled vocabulary term list.
Definition: CVTermListInterface.h:33
Representation of controlled vocabulary term list.
Definition: CVTermList.h:28
Representation of controlled vocabulary term.
Definition: CVTerm.h:27
Definition: ControlledVocabulary.h:29
This class stores a SRM/MRM transition.
Definition: IncludeExcludeTarget.h:28
XML handler for TraMLFile.
Definition: TraMLHandler.h:33
ControlledVocabulary::CVTerm getChildWithName_(const String &parent_accession, const String &name) const
Looks up a child CV term of parent_accession with the name name. If no such term is found,...
ReactionMonitoringTransition::Product actual_product_
Definition: TraMLHandler.h:110
std::vector< ReactionMonitoringTransition::Product > actual_intermediate_products_
Definition: TraMLHandler.h:108
std::vector< ReactionMonitoringTransition::Configuration > ConfigurationListType
Definition: TraMLHandler.h:41
void writeCVList_(std::ostream &os, const std::map< String, std::vector< CVTerm >> &cv_terms, UInt indent) const
TargetedExperiment::Peptide actual_peptide_
Definition: TraMLHandler.h:96
ReactionMonitoringTransition actual_transition_
Definition: TraMLHandler.h:100
TraMLHandler(const TargetedExperiment &exp, const String &filename, const String &version, const ProgressLogger &logger)
Constructor for a write-only handler.
TargetedExperiment::RetentionTime actual_rt_
Definition: TraMLHandler.h:94
TargetedExperiment::Interpretation actual_interpretation_
Definition: TraMLHandler.h:106
void writeTo(std::ostream &os) override
Writes the contents to a stream.
const TargetedExperiment * cexp_
Definition: TraMLHandler.h:80
TraMLHandler(TargetedExperiment &exp, const String &filename, const String &version, const ProgressLogger &logger)
Constructor for a read-only handler.
const ProgressLogger & logger_
Progress logger.
Definition: TraMLHandler.h:71
ControlledVocabulary cv_
Controlled vocabulary (psi-ms from OpenMS/share/OpenMS/CV/psi-ms.obo)
Definition: TraMLHandler.h:74
String tag_
Definition: TraMLHandler.h:76
void writeUserParam_(std::ostream &os, const MetaInfoInterface &meta, UInt indent) const
Writes user terms.
std::vector< ReactionMonitoringTransition::Product > ProductListType
Definition: TraMLHandler.h:40
CVTermList actual_validation_
Definition: TraMLHandler.h:104
TargetedExperiment::Contact actual_contact_
Definition: TraMLHandler.h:84
TargetedExperiment::Publication actual_publication_
Definition: TraMLHandler.h:82
SourceFile actual_sourcefile_
Definition: TraMLHandler.h:114
void writeUserParams_(std::ostream &os, const std::vector< MetaInfoInterface > &meta, UInt indent) const
ReactionMonitoringTransition::Configuration actual_configuration_
Definition: TraMLHandler.h:112
TargetedExperiment * exp_
Definition: TraMLHandler.h:78
void writeCVParams_(std::ostream &os, const CVTermList &cv_terms, UInt indent) const
~TraMLHandler() override
Destructor.
TargetedExperiment::Compound actual_compound_
Definition: TraMLHandler.h:98
void startElement(const XMLCh *const, const XMLCh *const, const XMLCh *const qname, const xercesc::Attributes &attributes) override
void writeCVParams_(std::ostream &os, const CVTermListInterface &cv_terms, UInt indent) const
TargetedExperiment::Instrument actual_instrument_
Definition: TraMLHandler.h:86
void writeRetentionTime_(std::ostream &os, const TargetedExperimentHelper::RetentionTime &rt) const
TraMLHandler(const TraMLHandler &rhs)=delete
void writeConfiguration_(std::ostream &os, const std::vector< ReactionMonitoringTransition::Configuration >::const_iterator &cit) const
void writeTarget_(std::ostream &os, const std::vector< IncludeExcludeTarget >::const_iterator &it) const
void characters(const XMLCh *const chars, const XMLSize_t length) override
void endElement(const XMLCh *const, const XMLCh *const, const XMLCh *const qname) override
void handleUserParam_(const String &parent_parent_tag, const String &parent_tag, const String &name, const String &type, const String &value)
Handles user terms.
void writeProduct_(std::ostream &os, const std::vector< ReactionMonitoringTransition::Product >::const_iterator &prod_it) const
TargetedExperiment::Prediction actual_prediction_
Definition: TraMLHandler.h:88
void handleCVParam_(const String &parent_parent_tag, const String &parent_tag, const CVTerm &cv_term)
Handles CV terms.
TraMLHandler & operator=(const TraMLHandler &rhs)=delete
Software actual_software_
Definition: TraMLHandler.h:90
TargetedExperiment::Protein actual_protein_
Definition: TraMLHandler.h:92
IncludeExcludeTarget actual_target_
Definition: TraMLHandler.h:102
Base class for XML handlers.
Definition: XMLHandler.h:302
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:35
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:27
This class stores a SRM/MRM transition.
Definition: ReactionMonitoringTransition.h:32
Description of the software used for processing.
Definition: Software.h:24
Description of a file location, used to store the origin of (meta) data.
Definition: SourceFile.h:22
A more convenient string class.
Definition: String.h:34
Represents a compound (small molecule)
Definition: TargetedExperimentHelper.h:296
Represents a peptide (amino acid sequence)
Definition: TargetedExperimentHelper.h:333
This class stores a retention time structure that is used in TargetedExperiment (representing a TraML...
Definition: TargetedExperimentHelper.h:99
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:39
unsigned int UInt
Unsigned integer type.
Definition: Types.h:64
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Representation of a CV term.
Definition: ControlledVocabulary.h:35
Definition: TargetedExperimentHelper.h:39
Definition: TargetedExperimentHelper.h:402
Definition: TargetedExperimentHelper.h:436
Product ion interpretation.
Definition: TargetedExperimentHelper.h:478
Definition: TargetedExperimentHelper.h:453
Definition: TargetedExperimentHelper.h:73
Definition: TargetedExperimentHelper.h:419
Represents a product ion.
Definition: TargetedExperimentHelper.h:546