OpenMS
Loading...
Searching...
No Matches
PepXMLFile.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: Chris Bielow, Hendrik Weisser $
6// $Authors: Chris Bielow, Hendrik Weisser $
7// --------------------------------------------------------------------------
8
9#pragma once
10
20
21#include <vector>
22#include <map>
23#include <set>
24
25
26namespace OpenMS
27{
38 class OPENMS_DLLAPI PepXMLFile :
39 protected Internal::XMLHandler,
41 {
42public:
43
46
48 ~PepXMLFile() override;
49
67 void load(const std::string& filename,
68 std::vector<ProteinIdentification>& proteins,
70 const std::string& experiment_name,
71 const SpectrumMetaDataLookup& lookup);
72
79 void load(const std::string& filename,
80 std::vector<ProteinIdentification>& proteins,
82 const std::string& experiment_name = "");
83
89 void store(const std::string& filename, std::vector<ProteinIdentification>& protein_ids,
90 PeptideIdentificationList& peptide_ids, const std::string& mz_file = "",
91 const std::string& mz_name = "", bool peptideprophet_analyzed = false, double rt_tolerance = 0.01);
92
101 {
102 keep_native_name_ = keep;
103 }
104
106 void setPreferredFixedModifications(const std::vector<const ResidueModification*>& mods);
107
109 void setPreferredVariableModifications(const std::vector<const ResidueModification*>& mods);
110
112 void setParseUnknownScores(bool parse_unknown_scores);
113
114protected:
115
117 void onEndElement(const char16_t* qname) override;
118
120 void onStartElement(const char16_t* qname, const Internal::XMLAttributes& attributes) override;
121
122private:
123
126
129
131 bool isExperimentOfInterest_(std::string base_name);
132
134 {
135 private:
136
137 std::string aminoacid_;
138 double massdiff_;
139 double mass_;
141 std::string description_;
142 std::string terminus_;
143 bool is_protein_terminus_; // "true" if protein terminus, "false" if peptide terminus
145 std::vector<std::string> errors_;
147
148 const ResidueModification* lookupModInPreferredMods_(const std::vector<const ResidueModification*>& preferred_fixed_mods,
149 const std::string& aminoacid,
150 double massdiff,
151 const std::string& description,
153 double tolerance);
154
155 public:
157
163 const std::string& aminoacid, const std::string& massdiff, const std::string& mass,
164 std::string variable, const std::string& description, std::string terminus, const std::string& protein_terminus,
165 const std::vector<const ResidueModification*>& preferred_fixed_mods,
166 const std::vector<const ResidueModification*>& preferred_var_mods,
167 double tolerance);
168
170
171 virtual ~AminoAcidModification() = default;
172
174
175 std::string toUnimodLikeString() const;
176
177 const std::string& getDescription() const;
178
179 bool isVariable() const;
180
182
183 double getMassDiff() const;
184
185 double getMass() const;
186
187 const std::string& getTerminus() const;
188
189 const std::string& getAminoAcid() const;
190
191 const std::vector<std::string>& getErrors() const;
192 };
193
195 std::vector<ProteinIdentification>* proteins_;
196
199
202
204 std::string exp_name_;
205
207 std::string search_engine_;
208
211 std::string experiment_label_;
212 std::string swath_assay_;
213 std::string status_;
214
216 bool use_precursor_data_{};
217
219 std::map<Size, Size> scan_map_;
220
223
226
229
232
234 bool search_summary_{};
235
237 bool wrong_experiment_{};
238
240 std::vector<std::string> base_names_;
241 std::vector<std::string> matched_base_names_;
242
244 bool checked_base_name_{};
245
247 bool has_decoys_{};
248
250 bool parse_unknown_scores_{};
251
253 std::string decoy_prefix_;
254
257
260
262 std::vector<std::vector<ProteinIdentification>::iterator> current_proteins_;
263
266
268 std::string enzyme_;
270
273
276
279
281 std::string current_sequence_;
282
284 double rt_{}, mz_{};
285
287 Size scannr_{};
288
290 Int charge_{};
291
293 UInt search_id_{};
294
296 std::string prot_id_;
297
300
302 double hydrogen_mass_{};
303
305 std::vector<std::pair<const ResidueModification*, Size> > current_modifications_;
306
308 std::vector<AminoAcidModification> fixed_modifications_;
309
311 std::vector<AminoAcidModification> variable_modifications_;
312
315 std::vector<const ResidueModification*> preferred_fixed_modifications_;
316
319 std::vector<const ResidueModification*> preferred_variable_modifications_;
320
322
323 static const double mod_tol_;
324 static const double xtandem_artificial_mod_tol_;
325
328 bool lookupAddFromHeader_(double modification_mass,
329 Size modification_position,
330 std::vector<AminoAcidModification> const& header_mods);
331
332 //static std::vector<int> getIsotopeErrorsFromIntSetting_(int intSetting);
333 };
334} // namespace OpenMS
DateTime Class.
Definition DateTime.h:31
Representation of an element.
Definition Element.h:34
Xerces-free, lightweight view over the attribute list of an XML element.
Definition XMLAttributes.h:32
Base class for loading and storing XML files via Xerces, with optional schema validation and transpar...
Definition XMLFile.h:40
Base class for XML handlers.
Definition XMLHandler.h:42
Used to load and store PepXML files.
Definition PepXMLFile.h:41
std::string enzyme_
Enzyme name associated with the current identification run.
Definition PepXMLFile.h:268
static const double xtandem_artificial_mod_tol_
Definition PepXMLFile.h:324
bool search_score_summary_
Are we currently in an "search_score_summary" element (should be skipped)?
Definition PepXMLFile.h:231
std::string exp_name_
Name of the associated experiment (filename of the data file without extension, with '/' as path sepa...
Definition PepXMLFile.h:204
std::string swath_assay_
Definition PepXMLFile.h:212
std::string decoy_prefix_
In case it has decoys, what is the prefix?
Definition PepXMLFile.h:253
void setParseUnknownScores(bool parse_unknown_scores)
sets if during load, unknown scores should be parsed
static const double mod_tol_
Definition PepXMLFile.h:323
PeptideHit peptide_hit_
PeptideHit instance currently being processed.
Definition PepXMLFile.h:278
std::vector< AminoAcidModification > variable_modifications_
Variable aminoacid modifications as parsed from the header.
Definition PepXMLFile.h:311
void store(const std::string &filename, std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids, const std::string &mz_file="", const std::string &mz_name="", bool peptideprophet_analyzed=false, double rt_tolerance=0.01)
Stores idXML as PepXML file.
void keepNativeSpectrumName(bool keep)
Whether we should keep the native spectrum name of the pepXML.
Definition PepXMLFile.h:100
PeptideIdentification current_peptide_
PeptideIdentification instance currently being processed.
Definition PepXMLFile.h:272
std::vector< std::pair< const ResidueModification *, Size > > current_modifications_
The modifications of the current peptide hit (position is 1-based)
Definition PepXMLFile.h:305
std::string search_engine_
Set name of search engine.
Definition PepXMLFile.h:207
std::string status_
Definition PepXMLFile.h:213
void load(const std::string &filename, std::vector< ProteinIdentification > &proteins, PeptideIdentificationList &peptides, const std::string &experiment_name="")
load function with empty defaults for some parameters (see above)
std::vector< std::vector< ProteinIdentification >::iterator > current_proteins_
References to currently active ProteinIdentifications.
Definition PepXMLFile.h:262
std::vector< const ResidueModification * > preferred_fixed_modifications_
Definition PepXMLFile.h:315
PeptideIdentificationList * peptides_
Pointer to the list of identified peptides.
Definition PepXMLFile.h:198
std::string current_sequence_
Sequence of the current peptide hit.
Definition PepXMLFile.h:281
~PepXMLFile() override
Destructor.
void onStartElement(const char16_t *qname, const Internal::XMLAttributes &attributes) override
Docu in base class.
PeptideHit::PepXMLAnalysisResult current_analysis_result_
Analysis result instance currently being processed.
Definition PepXMLFile.h:275
std::vector< std::string > matched_base_names_
Definition PepXMLFile.h:241
std::vector< const ResidueModification * > preferred_variable_modifications_
Definition PepXMLFile.h:319
bool analysis_summary_
Are we currently in an "analysis_summary" element (should be skipped)?
Definition PepXMLFile.h:225
const SpectrumMetaDataLookup * lookup_
Pointer to wrapper for looking up spectrum meta data.
Definition PepXMLFile.h:201
PepXMLFile()
Constructor.
std::string current_base_name_
current base name
Definition PepXMLFile.h:256
bool keep_native_name_
Whether we should keep the native spectrum name of the pepXML.
Definition PepXMLFile.h:228
std::vector< std::string > base_names_
Distinct "base_name"s of all runs / of the runs of the experiment of interest (with '/' as path separ...
Definition PepXMLFile.h:240
std::string prot_id_
Identifier linking PeptideIdentifications and ProteinIdentifications.
Definition PepXMLFile.h:296
std::string current_ms_run_path_
spectra file path of the current msms_run_summary (base_name + raw_data extension)
Definition PepXMLFile.h:259
std::vector< ProteinIdentification > * proteins_
Pointer to the list of identified proteins.
Definition PepXMLFile.h:195
DateTime date_
Date the pepXML file was generated.
Definition PepXMLFile.h:299
std::vector< AminoAcidModification > fixed_modifications_
Fixed aminoacid modifications as parsed from the header.
Definition PepXMLFile.h:308
bool lookupAddFromHeader_(double modification_mass, Size modification_position, std::vector< AminoAcidModification > const &header_mods)
Element hydrogen_
Hydrogen data (for mass types)
Definition PepXMLFile.h:222
void readRTMZCharge_(const Internal::XMLAttributes &attributes)
Read RT, m/z, charge information from attributes of "spectrum_query".
ProteinIdentification::SearchParameters params_
Search parameters of the current identification run.
Definition PepXMLFile.h:265
void onEndElement(const char16_t *qname) override
Docu in base class.
void load(const std::string &filename, std::vector< ProteinIdentification > &proteins, PeptideIdentificationList &peptides, const std::string &experiment_name, const SpectrumMetaDataLookup &lookup)
Loads peptide sequences with modifications out of a PepXML file.
void setPreferredFixedModifications(const std::vector< const ResidueModification * > &mods)
sets the preferred fixed modifications
std::map< Size, Size > scan_map_
Mapping between scan number in the pepXML file and index in the corresponding MSExperiment.
Definition PepXMLFile.h:219
std::string experiment_label_
Definition PepXMLFile.h:211
std::string enzyme_cuttingsite_
Definition PepXMLFile.h:269
std::string native_spectrum_name_
Several optional attributes of spectrum_query.
Definition PepXMLFile.h:210
void setPreferredVariableModifications(const std::vector< const ResidueModification * > &mods)
sets the preferred variable modifications
void makeScanMap_()
Fill scan_map_.
bool isExperimentOfInterest_(std::string base_name)
Does the run with this "base_name" belong to the experiment of interest (see load())?...
Analysis Result (containing search engine / prophet results)
Definition PeptideHit.h:201
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
Represents the set of candidates (SpectrumMatches) identified for a single precursor spectrum.
Definition PeptideIdentification.h:66
Representation of a modification on an amino acid residue.
Definition ResidueModification.h:55
TermSpecificity
Position where the modification is allowed to occur.
Definition ResidueModification.h:74
Helper class for looking up spectrum meta data.
Definition SpectrumMetaDataLookup.h:117
int Int
Signed integer type.
Definition Types.h:72
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
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
double massdiff_
Definition PepXMLFile.h:138
const std::string & getAminoAcid() const
double mass_
Definition PepXMLFile.h:139
std::string aminoacid_
Definition PepXMLFile.h:137
const std::string & getTerminus() const
bool is_protein_terminus_
Definition PepXMLFile.h:143
AminoAcidModification(const std::string &aminoacid, const std::string &massdiff, const std::string &mass, std::string variable, const std::string &description, std::string terminus, const std::string &protein_terminus, const std::vector< const ResidueModification * > &preferred_fixed_mods, const std::vector< const ResidueModification * > &preferred_var_mods, double tolerance)
const ResidueModification * getRegisteredMod() const
const std::string & getDescription() const
const ResidueModification * registered_mod_
Definition PepXMLFile.h:146
AminoAcidModification & operator=(const AminoAcidModification &rhs)=default
std::string terminus_
Definition PepXMLFile.h:142
const ResidueModification * lookupModInPreferredMods_(const std::vector< const ResidueModification * > &preferred_fixed_mods, const std::string &aminoacid, double massdiff, const std::string &description, const ResidueModification::TermSpecificity term_spec, double tolerance)
AminoAcidModification(const AminoAcidModification &rhs)=default
std::vector< std::string > errors_
Definition PepXMLFile.h:145
ResidueModification::TermSpecificity term_spec_
Definition PepXMLFile.h:144
bool is_variable_
Definition PepXMLFile.h:140
const std::vector< std::string > & getErrors() const
std::string description_
Definition PepXMLFile.h:141
Search parameters of the DB search.
Definition ProteinIdentification.h:194