OpenMS  3.0.0
XQuestResultXMLHandler.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: Eugen Netz $
32 // $Authors: Lukas Zimmermann $
33 // --------------------------------------------------------------------------
34 #pragma once
35 
42 
43 namespace OpenMS
44 {
45  namespace Internal
46  {
49  class OPENMS_DLLAPI XQuestResultXMLHandler :
50  public XMLHandler
51  {
52  public:
53 
55  static std::map< Size, String > enzymes;
56 
58  static std::map<String, UInt> months;
59 
61  XQuestResultXMLHandler(const String & filename,
62  std::vector< PeptideIdentification > & pep_ids,
63  std::vector< ProteinIdentification > & prot_ids
64  );
65 
67  XQuestResultXMLHandler(const std::vector<ProteinIdentification>& pro_id,
68  const std::vector<PeptideIdentification>& pep_id,
69  const String& filename,
70  const String& version
71  );
72 
73  ~XQuestResultXMLHandler() override;
74 
75  // Docu in base class
76  void endElement(const XMLCh * const uri, const XMLCh * const local_name, const XMLCh * const qname) override;
77 
78  // Docu in base class
79  void startElement(const XMLCh * const uri, const XMLCh * const local_name, const XMLCh * const qname, const xercesc::Attributes & attributes) override;
80 
85  double getMinScore() const;
86 
91  double getMaxScore() const;
92 
97  UInt getNumberOfHits() const;
98 
99  //Docu in base class
100  void writeTo(std::ostream& os) override;
101 
102  // TODO move these to StringUtils?
111  static StringList splitByNth(const String& input, const char separator, const Size n);
112 
125  static StringList splitByMiddle(const String& input, const char separator);
126 
127  private:
128 
129 
130  // Decoy string used by xQuest, initialize to a default value
131  String decoy_string_ = "decoy_";
135 
136  // Main data structures that are populated during loading the file
137  std::vector< PeptideIdentification >* pep_ids_;
138  std::vector< ProteinIdentification >* prot_ids_;
139 
140  // internal ID items for writing files
141  const std::vector<ProteinIdentification>* cpro_id_;
142  const std::vector<PeptideIdentification>* cpep_id_;
143 
145 
146  // Keeps track of the minscore and maxscore encountered
147  double min_score_;
148  double max_score_;
149 
152 
154  std::set< String > accessions_;
155 
158 
160  std::set< UInt > charges_;
163 
164  // Current Retention time of spectrum pair
165  double rt_light_;
166  double rt_heavy_;
167 
168  // Current experimental m/z of spectrum pair
169  double mz_light_;
170  double mz_heavy_;
171 
172  // primary MS run path
175 
177  std::vector< PeptideIdentification > current_spectrum_search_;
178 
180  std::map<String, DataValue> peptide_id_meta_values_;
181 
187  inline void extractDateTime_(const String & xquest_datetime_string, DateTime & date_time) const;
188 
195  void addMetaValues_(MetaInfoInterface & meta_info_interface);
196 
202  void getLinkPosition_(const xercesc::Attributes & attributes, std::pair<SignedSize, SignedSize> & pair);
203 
209  void setPeptideEvidence_(const String & prot_string, PeptideHit & pep_hit);
210 
211  };
212  } // namespace Internal
213 } // namespace OpenMS
OpenMS::Internal::XQuestResultXMLHandler::current_spectrum_search_
std::vector< PeptideIdentification > current_spectrum_search_
The current spectrum search.
Definition: XQuestResultXMLHandler.h:177
OpenMS::Internal::XQuestResultXMLHandler::spectrum_index_heavy_
int spectrum_index_heavy_
Definition: XQuestResultXMLHandler.h:133
OpenMS::Internal::XMLHandler
Base class for XML handlers.
Definition: XMLHandler.h:323
OpenMS::Internal::XQuestResultXMLHandler::ms_run_path_
StringList ms_run_path_
Definition: XQuestResultXMLHandler.h:173
OpenMS::Internal::XQuestResultXMLHandler::min_precursor_charge_
UInt min_precursor_charge_
Definition: XQuestResultXMLHandler.h:161
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
OpenMS::Internal::XQuestResultXMLHandler::cross_linker_name_
String cross_linker_name_
Definition: XQuestResultXMLHandler.h:134
OpenMS::Internal::XQuestResultXMLHandler::min_score_
double min_score_
Definition: XQuestResultXMLHandler.h:147
XMLHandler.h
OpenMS::Internal::XQuestResultXMLHandler::rt_light_
double rt_light_
Definition: XQuestResultXMLHandler.h:165
OpenMS::ProteaseDB
Database for enzymes that digest proteins (proteases)
Definition: ProteaseDB.h:52
OpenMS::Internal::XQuestResultXMLHandler::spectrum_input_file_
String spectrum_input_file_
Definition: XQuestResultXMLHandler.h:174
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
PeptideHit.h
OpenMS::Internal::XQuestResultXMLHandler::rt_heavy_
double rt_heavy_
Definition: XQuestResultXMLHandler.h:166
OpenMS::Internal::XQuestResultXMLHandler::spectrum_index_light_
int spectrum_index_light_
Definition: XQuestResultXMLHandler.h:132
OpenMS::Internal::XQuestResultXMLHandler::mz_light_
double mz_light_
Definition: XQuestResultXMLHandler.h:169
ProteaseDB.h
OpenMS::MetaInfoInterface
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:60
OpenMS::Internal::XQuestResultXMLHandler::cpro_id_
const std::vector< ProteinIdentification > * cpro_id_
Definition: XQuestResultXMLHandler.h:141
ProteinIdentification.h
OpenMS::Internal::XQuestResultXMLHandler::peptide_id_meta_values_
std::map< String, DataValue > peptide_id_meta_values_
Stores the attributes of a record (peptide identification)
Definition: XQuestResultXMLHandler.h:180
OpenMS::Internal::XQuestResultXMLHandler::max_score_
double max_score_
Definition: XQuestResultXMLHandler.h:148
OpenMS::Internal::XQuestResultXMLHandler::charges_
std::set< UInt > charges_
Keeps track of the charges of the hits.
Definition: XQuestResultXMLHandler.h:160
OpenMS::Internal::XQuestResultXMLHandler::max_precursor_charge_
UInt max_precursor_charge_
Definition: XQuestResultXMLHandler.h:162
OpenMS::Internal::XQuestResultXMLHandler::months
static std::map< String, UInt > months
Maps String encoding month to the numeric value.
Definition: XQuestResultXMLHandler.h:58
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
OpenMS::Internal::XQuestResultXMLHandler::enzymes
static std::map< Size, String > enzymes
Maps enzyme_num in xQuest result file to the enzyme name used by OpenMS.
Definition: XQuestResultXMLHandler.h:55
OpenMS::Internal::XQuestResultXMLHandler::prot_ids_
std::vector< ProteinIdentification > * prot_ids_
Definition: XQuestResultXMLHandler.h:138
OpenMS::Internal::XQuestResultXMLHandler::n_hits_
UInt n_hits_
Total no. of hits found in the result XML file.
Definition: XQuestResultXMLHandler.h:144
OpenMS::Internal::XQuestResultXMLHandler
XMLHandler for the result files of XQuest.
Definition: XQuestResultXMLHandler.h:49
OpenMS::Internal::XQuestResultXMLHandler::is_openpepxl_
bool is_openpepxl_
Whether or not current xquest result tag comes from OpenPepXL (xQuest otherwise)
Definition: XQuestResultXMLHandler.h:151
OpenMS::Internal::XQuestResultXMLHandler::accessions_
std::set< String > accessions_
Set of all protein accessions that are within the ProteinHits.
Definition: XQuestResultXMLHandler.h:154
OpenMS::Internal::XQuestResultXMLHandler::enzymes_db_
ProteaseDB * enzymes_db_
The enzyme database for enzyme lookup.
Definition: XQuestResultXMLHandler.h:157
OpenMS::Internal::XQuestResultXMLHandler::mz_heavy_
double mz_heavy_
Definition: XQuestResultXMLHandler.h:170
MetaInfoInterface.h
OpenMS::Internal::XQuestResultXMLHandler::cpep_id_
const std::vector< PeptideIdentification > * cpep_id_
Definition: XQuestResultXMLHandler.h:142
OpenMS::Internal::XQuestResultXMLHandler::pep_ids_
std::vector< PeptideIdentification > * pep_ids_
Definition: XQuestResultXMLHandler.h:137
PeptideIdentification.h
OpenMS::DateTime
DateTime Class.
Definition: DateTime.h:58
OpenMS::PeptideHit
Representation of a peptide hit.
Definition: PeptideHit.h:55