OpenMS  3.0.0
MzIdentMLHandler.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-2022.
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: Mathias Walzer $
32 // $Authors: Mathias Walzer, Andreas Bertsch $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
38 
48 
49 #include <vector>
50 #include <map>
51 
52 namespace OpenMS
53 {
54  class ProgressLogger;
55 
56  namespace Internal
57  {
58 
68  class OPENMS_DLLAPI MzIdentMLHandler :
69  public XMLHandler
70  {
71 public:
74  MzIdentMLHandler(const Identification& id, const String& filename, const String& version, const ProgressLogger& logger);
77  MzIdentMLHandler(const std::vector<ProteinIdentification>& pro_id, const std::vector<PeptideIdentification>& pep_id, const String& filename, const String& version, const ProgressLogger& logger);
78 
80  MzIdentMLHandler(Identification& id, const String& filename, const String& version, const ProgressLogger& logger);
82  MzIdentMLHandler(std::vector<ProteinIdentification>& pro_id, std::vector<PeptideIdentification>& pep_id, const String& filename, const String& version, const ProgressLogger& logger);
83 
85  ~MzIdentMLHandler() override;
87 
88 
89  // Docu in base class
90  void endElement(const XMLCh* const /*uri*/, const XMLCh* const /*local_name*/, const XMLCh* const qname) override;
91 
92  // Docu in base class
93  void startElement(const XMLCh* const /*uri*/, const XMLCh* const /*local_name*/, const XMLCh* const qname, const xercesc::Attributes& attributes) override;
94 
95  // Docu in base class
96  void characters(const XMLCh* const chars, const XMLSize_t length) override;
97 
98  //Docu in base class
99  void writeTo(std::ostream& os) override;
100 
101 protected:
104 
109 
110  //~ PeakMap* ms_exp_;
111 
114 
118  std::vector<ProteinIdentification>* pro_id_;
120  std::vector<PeptideIdentification>* pep_id_;
121 
123  const std::vector<ProteinIdentification>* cpro_id_;
124  const std::vector<PeptideIdentification>* cpep_id_;
125 
128 
131 
133  void handleCVParam_(const String& parent_parent_tag, const String& parent_tag, const String& accession, /* const String& name, */ /* const String& value, */ const xercesc::Attributes& attributes, const String& cv_ref /* , const String& unit_accession="" */);
134 
136  void handleUserParam_(const String& parent_parent_tag, const String& parent_tag, const String& name, const String& type, const String& value);
137 
139  void writeMetaInfos_(String& s, const MetaInfoInterface& meta, UInt indent) 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 
148  void writeEnzyme_(String& s, DigestionEnzymeProtein enzy, UInt miss, UInt indent) const;
149 
151  void writeModParam_(String& s, const std::vector<String>& mod_names, bool fixed, UInt indent) const;
152 
154  void writeFragmentAnnotations_(String& s, const std::vector<PeptideHit::PeakAnnotation>& annotations, UInt indent, bool is_ppxl) const;
155 
157  String trimOpenMSfileURI(const String file) const;
158 
160  void writePeptideHit(const PeptideHit& hit,
161  std::vector<PeptideIdentification>::const_iterator& it,
162  std::map<String, String>& pep_ids,
163  String cv_ns, std::set<String>& sen_set,
164  std::map<String, String>& sen_ids,
165  std::map<String, std::vector<String> >& pep_evis,
166  std::map<String, double>& pp_identifier_2_thresh,
167  String& sidres);
168 
170  void writeXLMSPeptideHit(const PeptideHit& hit,
171  std::vector<PeptideIdentification>::const_iterator& it,
172  String ppxl_linkid, std::map<String, String>& pep_ids,
173  String cv_ns, std::set<String>& sen_set,
174  std::map<String, String>& sen_ids,
175  std::map<String, std::vector<String> >& pep_evis,
176  std::map<String, double>& pp_identifier_2_thresh,
177  double ppxl_crosslink_mass,
178  std::map<String, String>& ppxl_specref_2_element,
179  String& sid, bool alpha_peptide);
180 
181 private:
184  MzIdentMLHandler& operator=(const MzIdentMLHandler& rhs);
185  std::map<String, AASequence> pep_sequences_;
186  std::map<String, String> pp_identifier_2_sil_;
187  std::map<String, String> sil_2_sdb_;
188  std::map<String, String> sil_2_sdat_;
189  std::map<String, String> ph_2_sdat_;
190  std::map<String, String> sil_2_sip_;
194 
195  };
196  } // namespace Internal
197 } // namespace OpenMS
OpenMS::Internal::MzIdentMLHandler::sil_2_sdb_
std::map< String, String > sil_2_sdb_
mapping spectrumidentificationlist to the search data bases
Definition: MzIdentMLHandler.h:187
OpenMS::Internal::MzIdentMLHandler::pep_id_
std::vector< PeptideIdentification > * pep_id_
Identification Item for peptides.
Definition: MzIdentMLHandler.h:120
OpenMS::Internal::MzIdentMLHandler::cpep_id_
const std::vector< PeptideIdentification > * cpep_id_
Definition: MzIdentMLHandler.h:124
OpenMS::ControlledVocabulary
Representation of a controlled vocabulary.
Definition: ControlledVocabulary.h:54
OpenMS::Internal::XMLHandler
Base class for XML handlers.
Definition: XMLHandler.h:323
ControlledVocabulary.h
OpenMS::Internal::MzIdentMLHandler::cv_
ControlledVocabulary cv_
Controlled vocabulary (psi-ms from OpenMS/share/OpenMS/CV/psi-ms.obo)
Definition: MzIdentMLHandler.h:106
OpenMS::Internal::MzIdentMLHandler
XML STREAM handler for MzIdentMLFile.
Definition: MzIdentMLHandler.h:68
OpenMS::Internal::MzIdentMLHandler::pp_identifier_2_sil_
std::map< String, String > pp_identifier_2_sil_
mapping peptide/proteinidentification identifier_ to spectrumidentificationlist
Definition: MzIdentMLHandler.h:186
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::Internal::MzIdentMLHandler::sil_2_sip_
std::map< String, String > sil_2_sip_
mapping spectrumidentificationlist to the search protocol (where the params are at)
Definition: MzIdentMLHandler.h:190
OpenMS::Internal::MzIdentMLHandler::current_spectrum_id_
SpectrumIdentification current_spectrum_id_
SpectrumIdentification Item.
Definition: MzIdentMLHandler.h:127
IdentificationHit.h
OpenMS::ProteinHit
Representation of a protein hit.
Definition: ProteinHit.h:58
OpenMS::Internal::MzIdentMLHandler::ph_2_sdat_
std::map< String, String > ph_2_sdat_
mapping identification runs (mapping PeptideIdentifications and ProteinIdentifications via ....
Definition: MzIdentMLHandler.h:189
OpenMS::Internal::MzIdentMLHandler::current_mod_location_
Int current_mod_location_
Definition: MzIdentMLHandler.h:192
OpenMS::Internal::MzIdentMLHandler::actual_protein_
ProteinHit actual_protein_
Definition: MzIdentMLHandler.h:193
XMLHandler.h
Identification.h
OpenMS::Internal::MzIdentMLHandler::actual_peptide_
AASequence actual_peptide_
Definition: MzIdentMLHandler.h:191
OpenMS::Internal::MzIdentMLHandler::unimod_
ControlledVocabulary unimod_
Controlled vocabulary for modifications (unimod from OpenMS/share/OpenMS/CV/unimod....
Definition: MzIdentMLHandler.h:108
OpenMS::Int
int Int
Signed integer type.
Definition: Types.h:102
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
DigestionEnzymeProtein.h
OpenMS::Internal::MzIdentMLHandler::cid_
const Identification * cid_
Definition: MzIdentMLHandler.h:122
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:52
OpenMS::Internal::MzIdentMLHandler::current_id_hit_
IdentificationHit current_id_hit_
IdentificationHit Item.
Definition: MzIdentMLHandler.h:130
OpenMS::MetaInfoInterface
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:60
ProteinHit.h
ProteinIdentification.h
OpenMS::DigestionEnzymeProtein
Representation of a digestion enzyme for proteins (protease)
Definition: DigestionEnzymeProtein.h:48
OpenMS::Internal::MzIdentMLHandler::pro_id_
std::vector< ProteinIdentification > * pro_id_
internal Identification Item for proteins
Definition: MzIdentMLHandler.h:118
OpenMS::IdentificationHit
Represents a object which can store the information of an analysisXML instance.
Definition: IdentificationHit.h:48
OpenMS::Internal::MzIdentMLHandler::pep_sequences_
std::map< String, AASequence > pep_sequences_
Definition: MzIdentMLHandler.h:185
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
OpenMS::Internal::MzIdentMLHandler::tag_
String tag_
XML tag parse element.
Definition: MzIdentMLHandler.h:113
AASequence.h
OpenMS::ControlledVocabulary::CVTerm
Representation of a CV term.
Definition: ControlledVocabulary.h:60
OpenMS::Identification
Represents a object which can store the information of an analysisXML instance.
Definition: Identification.h:52
OpenMS::SpectrumIdentification
Represents a object which can store the information of an analysisXML instance.
Definition: SpectrumIdentification.h:49
OpenMS::Internal::MzIdentMLHandler::cpro_id_
const std::vector< ProteinIdentification > * cpro_id_
Definition: MzIdentMLHandler.h:123
OpenMS::AASequence
Representation of a peptide/protein sequence.
Definition: AASequence.h:111
OpenMS::Internal::MzIdentMLHandler::logger_
const ProgressLogger & logger_
Progress logger.
Definition: MzIdentMLHandler.h:103
PeptideIdentification.h
OpenMS::Internal::MzIdentMLHandler::id_
Identification * id_
Identification Item.
Definition: MzIdentMLHandler.h:116
StandardTypes.h
OpenMS::Internal::MzIdentMLHandler::sil_2_sdat_
std::map< String, String > sil_2_sdat_
mapping spectrumidentificationlist to the search input
Definition: MzIdentMLHandler.h:188
OpenMS::PeptideHit
Representation of a peptide hit.
Definition: PeptideHit.h:55