Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
TraMLHandler.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2017.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Hannes Roest $
32 // $Authors: Andreas Bertsch, Hannes Roest $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_FORMAT_HANDLERS_TRAMLHANDLER_H
36 #define OPENMS_FORMAT_HANDLERS_TRAMLHANDLER_H
37 
44 
45 namespace OpenMS
46 {
47  namespace Internal
48  {
49 
55  class OPENMS_DLLAPI TraMLHandler :
56  public XMLHandler
57  {
58 public:
59 
60  typedef std::vector<ReactionMonitoringTransition::Product> ProductListType;
61  typedef std::vector<ReactionMonitoringTransition::Configuration> ConfigurationListType;
62 
65  TraMLHandler(const TargetedExperiment & exp, const String & filename, const String & version, const ProgressLogger & logger);
67 
69  TraMLHandler(TargetedExperiment & exp, const String & filename, const String & version, const ProgressLogger & logger);
70 
72  virtual ~TraMLHandler();
74 
75 
76  // Docu in base class
77  virtual void endElement(const XMLCh * const /*uri*/, const XMLCh * const /*local_name*/, const XMLCh * const qname);
78 
79  // Docu in base class
80  virtual void startElement(const XMLCh * const /*uri*/, const XMLCh * const /*local_name*/, const XMLCh * const qname, const xercesc::Attributes & attributes);
81 
82  // Docu in base class
83  virtual void characters(const XMLCh * const chars, const XMLSize_t length);
84 
85  //Docu in base class
86  virtual void writeTo(std::ostream & os);
87 
88 protected:
89 
92 
95 
97 
99 
101 
103 
105 
107 
109 
111 
113 
115 
117 
119 
121 
123 
125 
127 
128  std::vector<ReactionMonitoringTransition::Product> actual_intermediate_products_;
129 
131 
133 
135 
137  void handleCVParam_(const String & parent_parent_tag, const String & parent_tag, const CVTerm & cv_term);
138 
140  void handleUserParam_(const String & parent_parent_tag, const String & parent_tag, const String & name, const String & type, const String & value);
141 
143  void writeUserParam_(std::ostream & os, const MetaInfoInterface & meta, UInt indent) const;
144 
145  void writeUserParams_(std::ostream & os, const std::vector<MetaInfoInterface> & meta, UInt indent) const;
146 
147  template <typename CVTList>
148  void writeCVParams_(std::ostream & os, const CVTList & cv_terms, UInt indent) const
149  {
150  for (Map<String, std::vector<CVTerm> >::const_iterator it = cv_terms.getCVTerms().begin();
151  it != cv_terms.getCVTerms().end(); ++it)
152  {
153  for (std::vector<CVTerm>::const_iterator cit = it->second.begin(); cit != it->second.end(); ++cit)
154  {
155  os << String(2 * indent, ' ') << "<cvParam cvRef=\"" << cit->getCVIdentifierRef() << "\" accession=\"" << cit->getAccession() << "\" name=\"" << cit->getName() << "\"";
156  if (cit->hasValue() && !cit->getValue().isEmpty() && !cit->getValue().toString().empty())
157  {
158  os << " value=\"" << cit->getValue().toString() << "\"";
159  }
160 
161  if (cit->hasUnit())
162  {
163  os << " unitCvRef=\"" << cit->getUnit().cv_ref << "\" unitAccession=\"" << cit->getUnit().accession << "\" unitName=\"" << cit->getUnit().name << "\"";
164  }
165  os << "/>" << "\n";
166  }
167  }
168  }
169 
170  // subfunctions of write
171  void writeTarget_(std::ostream & os, const std::vector<IncludeExcludeTarget>::const_iterator & it) const;
172 
173  void writeProduct_(std::ostream & os, const std::vector<ReactionMonitoringTransition::Product>::const_iterator & prod_it) const;
174 
175  void writeConfiguration_(std::ostream & os, const std::vector<ReactionMonitoringTransition::Configuration>::const_iterator & cit) const;
176 
178  ControlledVocabulary::CVTerm getChildWithName_(const String & parent_accession, const String & name) const;
179 
181  //void writeSourceFile_(std::ostream& os, const String& id, const SourceFile& software);
182 
183 private:
184 
185  TraMLHandler();
186  TraMLHandler(const TraMLHandler & rhs);
187  TraMLHandler & operator=(const TraMLHandler & rhs);
188  };
189  } // namespace Internal
190 } // namespace OpenMS
191 
192 #endif // OPENMS_FORMAT_HANDLERS_TRAMLHANDLER_H
193 
TargetedExperiment::Prediction actual_prediction_
Definition: TraMLHandler.h:108
TargetedExperiment::Peptide actual_peptide_
Definition: TraMLHandler.h:116
Representation of a CV term.
Definition: ControlledVocabulary.h:61
A more convenient string class.
Definition: String.h:57
TargetedExperiment::Protein actual_protein_
Definition: TraMLHandler.h:112
String tag_
Definition: TraMLHandler.h:96
Representation of controlled vocabulary term list.
Definition: CVTermList.h:53
Software actual_software_
Definition: TraMLHandler.h:110
std::vector< ReactionMonitoringTransition::Configuration > ConfigurationListType
Definition: TraMLHandler.h:61
Definition: TargetedExperimentHelper.h:437
void writeCVParams_(std::ostream &os, const CVTList &cv_terms, UInt indent) const
Definition: TraMLHandler.h:148
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
TargetedExperiment::RetentionTime actual_rt_
Definition: TraMLHandler.h:114
XML handler for TraMLFile.
Definition: TraMLHandler.h:55
Base class for XML handlers.
Definition: XMLHandler.h:110
Description of a file location, used to store the origin of (meta) data.
Definition: SourceFile.h:47
Definition: TargetedExperimentHelper.h:524
Definition: TargetedExperimentHelper.h:409
Description of the software used for processing.
Definition: Software.h:49
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
TargetedExperiment::Instrument actual_instrument_
Definition: TraMLHandler.h:106
Representation of a controlled vocabulary.
Definition: ControlledVocabulary.h:55
ReactionMonitoringTransition::Product actual_product_
Definition: TraMLHandler.h:130
Definition: TargetedExperimentHelper.h:64
Definition: TargetedExperimentHelper.h:607
TargetedExperiment::Compound actual_compound_
Definition: TraMLHandler.h:118
IncludeExcludeTarget actual_target_
Definition: TraMLHandler.h:122
Representation of controlled vocabulary term.
Definition: CVTerm.h:51
const ProgressLogger & logger_
Progress logger.
Definition: TraMLHandler.h:91
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:56
TargetedExperiment::Contact actual_contact_
Definition: TraMLHandler.h:104
Definition: TargetedExperimentHelper.h:181
ControlledVocabulary cv_
Controlled vocabulary (psi-ms from OpenMS/share/OpenMS/CV/psi-ms.obo)
Definition: TraMLHandler.h:94
ReactionMonitoringTransition::Configuration actual_configuration_
Definition: TraMLHandler.h:132
TargetedExperiment::Interpretation actual_interpretation_
Definition: TraMLHandler.h:126
This class stores a SRM/MRM transition.
Definition: IncludeExcludeTarget.h:53
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:62
Definition: TargetedExperimentHelper.h:465
Definition: TargetedExperimentHelper.h:142
Definition: TargetedExperimentHelper.h:493
ReactionMonitoringTransition actual_transition_
Definition: TraMLHandler.h:120
Definition: TargetedExperimentHelper.h:111
TargetedExperiment::Publication actual_publication_
Definition: TraMLHandler.h:102
TargetedExperiment * exp_
Definition: TraMLHandler.h:98
std::vector< ReactionMonitoringTransition::Product > ProductListType
Definition: TraMLHandler.h:60
std::vector< ReactionMonitoringTransition::Product > actual_intermediate_products_
Definition: TraMLHandler.h:128
Map class based on the STL map (containing several convenience functions)
Definition: Map.h:51
Definition: TargetedExperimentHelper.h:266
SourceFile actual_sourcefile_
Definition: TraMLHandler.h:134
CVTermList actual_validation_
Definition: TraMLHandler.h:124
This class stores a SRM/MRM transition.
Definition: ReactionMonitoringTransition.h:56
const TargetedExperiment * cexp_
Definition: TraMLHandler.h:100

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:04 using doxygen 1.8.13