OpenMS
XQuestResultXMLHandler.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: Eugen Netz $
6 // $Authors: Lukas Zimmermann $
7 // --------------------------------------------------------------------------
8 #pragma once
9 
16 
17 namespace OpenMS
18 {
19  namespace Internal
20  {
23  class OPENMS_DLLAPI XQuestResultXMLHandler :
24  public XMLHandler
25  {
26  public:
27 
29  static std::map< Size, String > enzymes;
30 
32  static std::map<String, UInt> months;
33 
35  XQuestResultXMLHandler(const String & filename,
36  std::vector< PeptideIdentification > & pep_ids,
37  std::vector< ProteinIdentification > & prot_ids
38  );
39 
41  XQuestResultXMLHandler(const std::vector<ProteinIdentification>& pro_id,
42  const std::vector<PeptideIdentification>& pep_id,
43  const String& filename,
44  const String& version
45  );
46 
48 
49  // Docu in base class
50  void endElement(const XMLCh * const uri, const XMLCh * const local_name, const XMLCh * const qname) override;
51 
52  // Docu in base class
53  void startElement(const XMLCh * const uri, const XMLCh * const local_name, const XMLCh * const qname, const xercesc::Attributes & attributes) override;
54 
59  double getMinScore() const;
60 
65  double getMaxScore() const;
66 
72 
73  //Docu in base class
74  void writeTo(std::ostream& os) override;
75 
76  // TODO move these to StringUtils?
85  static StringList splitByNth(const String& input, const char separator, const Size n);
86 
99  static StringList splitByMiddle(const String& input, const char separator);
100 
101  private:
102 
103 
104  // Decoy string used by xQuest, initialize to a default value
105  String decoy_string_ = "decoy_";
109 
110  // Main data structures that are populated during loading the file
111  std::vector< PeptideIdentification >* pep_ids_;
112  std::vector< ProteinIdentification >* prot_ids_;
113 
114  // internal ID items for writing files
115  const std::vector<ProteinIdentification>* cpro_id_;
116  const std::vector<PeptideIdentification>* cpep_id_;
117 
119 
120  // Keeps track of the minscore and maxscore encountered
121  double min_score_;
122  double max_score_;
123 
126 
128  std::set< String > accessions_;
129 
132 
134  std::set< UInt > charges_;
137 
138  // Current Retention time of spectrum pair
139  double rt_light_;
140  double rt_heavy_;
141 
142  // Current experimental m/z of spectrum pair
143  double mz_light_;
144  double mz_heavy_;
145 
146  // primary MS run path
149 
151  std::vector< PeptideIdentification > current_spectrum_search_;
152 
154  std::map<String, DataValue> peptide_id_meta_values_;
155 
161  inline void extractDateTime_(const String & xquest_datetime_string, DateTime & date_time) const;
162 
169  void addMetaValues_(MetaInfoInterface & meta_info_interface);
170 
176  void getLinkPosition_(const xercesc::Attributes & attributes, std::pair<SignedSize, SignedSize> & pair);
177 
183  void setPeptideEvidence_(const String & prot_string, PeptideHit & pep_hit);
184 
185  };
186  } // namespace Internal
187 } // namespace OpenMS
DateTime Class.
Definition: DateTime.h:33
Base class for XML handlers.
Definition: XMLHandler.h:302
XMLHandler for the result files of XQuest.
Definition: XQuestResultXMLHandler.h:25
double getMinScore() const
Returns the minimum score encountered in the file.
XQuestResultXMLHandler(const std::vector< ProteinIdentification > &pro_id, const std::vector< PeptideIdentification > &pep_id, const String &filename, const String &version)
Constructor for a write-only handler for internal identification structures.
void endElement(const XMLCh *const uri, const XMLCh *const local_name, const XMLCh *const qname) override
double max_score_
Definition: XQuestResultXMLHandler.h:122
void writeTo(std::ostream &os) override
Writes the contents to a stream.
static std::map< Size, String > enzymes
Maps enzyme_num in xQuest result file to the enzyme name used by OpenMS.
Definition: XQuestResultXMLHandler.h:29
UInt getNumberOfHits() const
Returns the total number of hits in the file.
const std::vector< ProteinIdentification > * cpro_id_
Definition: XQuestResultXMLHandler.h:115
ProteaseDB * enzymes_db_
The enzyme database for enzyme lookup.
Definition: XQuestResultXMLHandler.h:131
void addMetaValues_(MetaInfoInterface &meta_info_interface)
Assigns all meta values stored in the peptide_id_attributes member to an meta info interface.
UInt n_hits_
Total no. of hits found in the result XML file.
Definition: XQuestResultXMLHandler.h:118
std::set< String > accessions_
Set of all protein accessions that are within the ProteinHits.
Definition: XQuestResultXMLHandler.h:128
std::map< String, DataValue > peptide_id_meta_values_
Stores the attributes of a record (peptide identification)
Definition: XQuestResultXMLHandler.h:154
std::set< UInt > charges_
Keeps track of the charges of the hits.
Definition: XQuestResultXMLHandler.h:134
void getLinkPosition_(const xercesc::Attributes &attributes, std::pair< SignedSize, SignedSize > &pair)
Gets the link location of a xQuest xlinkPositionString.
void setPeptideEvidence_(const String &prot_string, PeptideHit &pep_hit)
Sets the peptide evidence for Alpha and Beta.
double min_score_
Definition: XQuestResultXMLHandler.h:121
static StringList splitByMiddle(const String &input, const char separator)
counts occurrences of the separator and splits the string into two at the middle
void extractDateTime_(const String &xquest_datetime_string, DateTime &date_time) const
Extracts the DateTime from datetime string from xQuest.
std::vector< ProteinIdentification > * prot_ids_
Definition: XQuestResultXMLHandler.h:112
String cross_linker_name_
Definition: XQuestResultXMLHandler.h:108
double mz_heavy_
Definition: XQuestResultXMLHandler.h:144
double rt_heavy_
Definition: XQuestResultXMLHandler.h:140
String spectrum_input_file_
Definition: XQuestResultXMLHandler.h:148
StringList ms_run_path_
Definition: XQuestResultXMLHandler.h:147
static StringList splitByNth(const String &input, const char separator, const Size n)
splits the input string at the nth occurrence of the separator
const std::vector< PeptideIdentification > * cpep_id_
Definition: XQuestResultXMLHandler.h:116
double mz_light_
Definition: XQuestResultXMLHandler.h:143
std::vector< PeptideIdentification > current_spectrum_search_
The current spectrum search.
Definition: XQuestResultXMLHandler.h:151
UInt min_precursor_charge_
Definition: XQuestResultXMLHandler.h:135
UInt max_precursor_charge_
Definition: XQuestResultXMLHandler.h:136
int spectrum_index_light_
Definition: XQuestResultXMLHandler.h:106
XQuestResultXMLHandler(const String &filename, std::vector< PeptideIdentification > &pep_ids, std::vector< ProteinIdentification > &prot_ids)
Constructor for a read-only handler for internal identification structures.
static std::map< String, UInt > months
Maps String encoding month to the numeric value.
Definition: XQuestResultXMLHandler.h:32
bool is_openpepxl_
Whether or not current xquest result tag comes from OpenPepXL (xQuest otherwise)
Definition: XQuestResultXMLHandler.h:125
void startElement(const XMLCh *const uri, const XMLCh *const local_name, const XMLCh *const qname, const xercesc::Attributes &attributes) override
std::vector< PeptideIdentification > * pep_ids_
Definition: XQuestResultXMLHandler.h:111
double rt_light_
Definition: XQuestResultXMLHandler.h:139
int spectrum_index_heavy_
Definition: XQuestResultXMLHandler.h:107
double getMaxScore() const
Returns the maximum score encountered in the file.
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:35
Representation of a peptide hit.
Definition: PeptideHit.h:31
Database for enzymes that digest proteins (proteases)
Definition: ProteaseDB.h:27
A more convenient string class.
Definition: String.h:34
unsigned int UInt
Unsigned integer type.
Definition: Types.h:64
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19