OpenMS
Loading...
Searching...
No Matches
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
17
18namespace OpenMS
19{
20 namespace Internal
21 {
24 class OPENMS_DLLAPI XQuestResultXMLHandler :
25 public XMLHandler
26 {
27 public:
28
30 static std::map< Size, std::string > enzymes;
31
33 static std::map<std::string, UInt> months;
34
36 XQuestResultXMLHandler(const std::string & filename,
38 std::vector< ProteinIdentification > & prot_ids
39 );
40
42 XQuestResultXMLHandler(const std::vector<ProteinIdentification>& pro_id,
43 const PeptideIdentificationList& pep_id,
44 const std::string& filename,
45 const std::string& version
46 );
47
49
50 // Docu in base class
51 void endElement(const XMLCh * const uri, const XMLCh * const local_name, const XMLCh * const qname) override;
52
53 // Docu in base class
54 void startElement(const XMLCh * const uri, const XMLCh * const local_name, const XMLCh * const qname, const xercesc::Attributes & attributes) override;
55
60 double getMinScore() const;
61
66 double getMaxScore() const;
67
73
74 //Docu in base class
75 void writeTo(std::ostream& os) override;
76
77 // TODO move these to StringUtils?
86 static StringList splitByNth(const std::string& input, const char separator, const Size n);
87
100 static StringList splitByMiddle(const std::string& input, const char separator);
101
102 private:
103
104
105 // Decoy string used by xQuest, initialize to a default value
106 std::string decoy_string_ = "decoy_";
110
111 // Main data structures that are populated during loading the file
113 std::vector< ProteinIdentification >* prot_ids_;
114
115 // internal ID items for writing files
116 const std::vector<ProteinIdentification>* cpro_id_;
118
120
121 // Keeps track of the minscore and maxscore encountered
124
127
129 std::set< std::string > accessions_;
130
133
135 std::set< UInt > charges_;
138
139 // Current Retention time of spectrum pair
140 double rt_light_;
141 double rt_heavy_;
142
143 // Current experimental m/z of spectrum pair
144 double mz_light_;
145 double mz_heavy_;
146
147 // primary MS run path
150
152 std::vector< PeptideIdentification > current_spectrum_search_;
153
155 std::map<std::string, DataValue> peptide_id_meta_values_;
156
162 inline void extractDateTime_(const std::string & xquest_datetime_string, DateTime & date_time) const;
163
170 void addMetaValues_(MetaInfoInterface & meta_info_interface);
171
177 void getLinkPosition_(const xercesc::Attributes & attributes, std::pair<SignedSize, SignedSize> & pair);
178
184 void setPeptideEvidence_(const std::string & prot_string, PeptideHit & pep_hit);
185
186 };
187 } // namespace Internal
188} // namespace OpenMS
char16_t XMLCh
Definition ClassTest.h:30
DateTime Class.
Definition DateTime.h:31
Base class for XML handlers.
Definition XMLHandler.h:316
XMLHandler for the result files of XQuest.
Definition XQuestResultXMLHandler.h:26
double getMinScore() const
Returns the minimum score encountered in the file.
static std::map< Size, std::string > enzymes
Maps enzyme_num in xQuest result file to the enzyme name used by OpenMS.
Definition XQuestResultXMLHandler.h:30
void endElement(const XMLCh *const uri, const XMLCh *const local_name, const XMLCh *const qname) override
std::string spectrum_input_file_
Definition XQuestResultXMLHandler.h:149
double max_score_
Definition XQuestResultXMLHandler.h:123
void setPeptideEvidence_(const std::string &prot_string, PeptideHit &pep_hit)
Sets the peptide evidence for Alpha and Beta.
void writeTo(std::ostream &os) override
Writes the contents to a stream.
UInt getNumberOfHits() const
Returns the total number of hits in the file.
const std::vector< ProteinIdentification > * cpro_id_
Definition XQuestResultXMLHandler.h:116
static StringList splitByNth(const std::string &input, const char separator, const Size n)
splits the input string at the nth occurrence of the separator
void addMetaValues_(MetaInfoInterface &meta_info_interface)
Assigns all meta values stored in the peptide_id_attributes member to an meta info interface.
XQuestResultXMLHandler(const std::vector< ProteinIdentification > &pro_id, const PeptideIdentificationList &pep_id, const std::string &filename, const std::string &version)
Constructor for a write-only handler for internal identification structures.
UInt n_hits_
Total no. of hits found in the result XML file.
Definition XQuestResultXMLHandler.h:119
static StringList splitByMiddle(const std::string &input, const char separator)
counts occurrences of the separator and splits the string into two at the middle
std::set< std::string > accessions_
Set of all protein accessions that are within the ProteinHits.
Definition XQuestResultXMLHandler.h:129
std::set< UInt > charges_
Keeps track of the charges of the hits.
Definition XQuestResultXMLHandler.h:135
std::string cross_linker_name_
Definition XQuestResultXMLHandler.h:109
void getLinkPosition_(const xercesc::Attributes &attributes, std::pair< SignedSize, SignedSize > &pair)
Gets the link location of a xQuest xlinkPositionString.
static std::map< std::string, UInt > months
Maps std::string encoding month to the numeric value.
Definition XQuestResultXMLHandler.h:33
double min_score_
Definition XQuestResultXMLHandler.h:122
std::vector< ProteinIdentification > * prot_ids_
Definition XQuestResultXMLHandler.h:113
double mz_heavy_
Definition XQuestResultXMLHandler.h:145
double rt_heavy_
Definition XQuestResultXMLHandler.h:141
StringList ms_run_path_
Definition XQuestResultXMLHandler.h:148
double mz_light_
Definition XQuestResultXMLHandler.h:144
std::vector< PeptideIdentification > current_spectrum_search_
The current spectrum search.
Definition XQuestResultXMLHandler.h:152
UInt min_precursor_charge_
Definition XQuestResultXMLHandler.h:136
const ProteaseDB * enzymes_db_
The enzyme database for enzyme lookup.
Definition XQuestResultXMLHandler.h:132
UInt max_precursor_charge_
Definition XQuestResultXMLHandler.h:137
int spectrum_index_light_
Definition XQuestResultXMLHandler.h:107
XQuestResultXMLHandler(const std::string &filename, PeptideIdentificationList &pep_ids, std::vector< ProteinIdentification > &prot_ids)
Constructor for a read-only handler for internal identification structures.
bool is_openpepxl_
Whether or not current xquest result tag comes from OpenPepXL (xQuest otherwise)
Definition XQuestResultXMLHandler.h:126
void startElement(const XMLCh *const uri, const XMLCh *const local_name, const XMLCh *const qname, const xercesc::Attributes &attributes) override
PeptideIdentificationList * pep_ids_
Definition XQuestResultXMLHandler.h:112
const PeptideIdentificationList * cpep_id_
Definition XQuestResultXMLHandler.h:117
std::map< std::string, DataValue > peptide_id_meta_values_
Stores the attributes of a record (peptide identification)
Definition XQuestResultXMLHandler.h:155
double rt_light_
Definition XQuestResultXMLHandler.h:140
void extractDateTime_(const std::string &xquest_datetime_string, DateTime &date_time) const
Extracts the DateTime from datetime string from xQuest.
int spectrum_index_heavy_
Definition XQuestResultXMLHandler.h:108
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
Represents a single spectrum match (candidate) for a specific tandem mass spectrum (MS/MS).
Definition PeptideHit.h:52
Container for peptide identifications from multiple spectra.
Definition PeptideIdentificationList.h:66
Database for enzymes that digest proteins (proteases)
Definition ProteaseDB.h:32
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< std::string > StringList
Vector of String.
Definition ListUtils.h:44
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19