Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
PepXMLFile.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-2017.
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: Chris Bielow, Hendrik Weisser $
32 // $Authors: Chris Bielow, Hendrik Weisser $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
40 #include <OpenMS/FORMAT/XMLFile.h>
44 
45 #include <vector>
46 #include <map>
47 #include <set>
48 
49 
50 namespace OpenMS
51 {
59  class OPENMS_DLLAPI PepXMLFile :
60  protected Internal::XMLHandler,
61  public Internal::XMLFile
62  {
63 public:
64 
66  PepXMLFile();
67 
69  ~PepXMLFile() override;
70 
83  void load(const String& filename,
84  std::vector<ProteinIdentification>& proteins,
85  std::vector<PeptideIdentification>& peptides,
86  const String& experiment_name,
87  const SpectrumMetaDataLookup& lookup);
88 
95  void load(const String& filename,
96  std::vector<ProteinIdentification>& proteins,
97  std::vector<PeptideIdentification>& peptides,
98  const String& experiment_name = "");
99 
105  void store(const String& filename, std::vector<ProteinIdentification>& protein_ids,
106  std::vector<PeptideIdentification>& peptide_ids, const String& mz_file = "",
107  const String& mz_name = "", bool peptideprophet_analyzed = false);
108 
116  void keepNativeSpectrumName(bool keep)
117  {
118  keep_native_name_ = keep;
119  }
120 
121 protected:
122 
124  void endElement(const XMLCh* const /*uri*/, const XMLCh* const /*local_name*/, const XMLCh* const qname) override;
125 
127  void startElement(const XMLCh* const /*uri*/, const XMLCh* const /*local_name*/, const XMLCh* const qname, const xercesc::Attributes& attributes) override;
128 
129 private:
130 
132  void makeScanMap_();
133 
135  void readRTMZCharge_(const xercesc::Attributes& attributes);
136 
149  void matchModification_(const double mass, const String& origin, String& modification_description);
150 
152  {
155  double mass;
156  bool variable;
159 
161  mass(0),
162  variable(false)
163  {
164  }
165 
167  aminoacid(rhs.aminoacid),
168  massdiff(rhs.massdiff),
169  mass(rhs.mass),
170  variable(rhs.variable),
171  description(rhs.description),
172  terminus(rhs.terminus)
173  {
174  }
175 
177  {
178  }
179 
181  {
182  if (this != &rhs)
183  {
184  aminoacid = rhs.aminoacid;
185  massdiff = rhs.massdiff;
186  mass = rhs.mass;
187  variable = rhs.variable;
188  description = rhs.description;
189  terminus = rhs.terminus;
190  }
191  return *this;
192  }
193 
194  };
195 
197  std::vector<ProteinIdentification>* proteins_;
198 
200  std::vector<PeptideIdentification>* peptides_;
201 
204 
207 
210 
216 
219 
221  std::map<Size, Size> scan_map_;
222 
225 
228 
231 
234 
237 
240 
243 
246 
249 
251  std::vector<std::vector<ProteinIdentification>::iterator> current_proteins_;
252 
255 
258 
261 
264 
267 
270 
272  double rt_, mz_;
273 
276 
279 
282 
285 
288 
290  std::vector<std::pair<String, Size> > current_modifications_;
291 
293  std::vector<AminoAcidModification> fixed_modifications_;
294 
296  std::vector<AminoAcidModification> variable_modifications_;
297 
299 
300  static const double mod_tol_;
301  static const double xtandem_artificial_mod_tol_;
302  };
303 
304 } // namespace OpenMS
305 
AminoAcidModification & operator=(const AminoAcidModification &rhs)
Definition: PepXMLFile.h:180
A more convenient string class.
Definition: String.h:57
std::vector< std::vector< ProteinIdentification >::iterator > current_proteins_
References to currently active ProteinIdentifications.
Definition: PepXMLFile.h:251
Helper class for looking up spectrum meta data.
Definition: SpectrumMetaDataLookup.h:141
double mass
Definition: PepXMLFile.h:155
AminoAcidModification()
Definition: PepXMLFile.h:160
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
String exp_name_
Name of the associated experiment (filename of the data file, extension will be removed) ...
Definition: PepXMLFile.h:206
std::vector< ProteinIdentification > * proteins_
Pointer to the list of identified proteins.
Definition: PepXMLFile.h:197
Base class for XML handlers.
Definition: XMLHandler.h:148
Element hydrogen_
Hydrogen data (for mass types)
Definition: PepXMLFile.h:224
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
String terminus
Definition: PepXMLFile.h:158
String massdiff
Definition: PepXMLFile.h:154
double rt_
RT and m/z of current PeptideIdentification.
Definition: PepXMLFile.h:272
AminoAcidModification(const AminoAcidModification &rhs)
Definition: PepXMLFile.h:166
std::vector< AminoAcidModification > fixed_modifications_
Fixed aminoacid modifications.
Definition: PepXMLFile.h:293
ProteinIdentification::SearchParameters params_
Search parameters of the current identification run.
Definition: PepXMLFile.h:254
String status_
Definition: PepXMLFile.h:215
Search parameters of the DB search.
Definition: ProteinIdentification.h:103
bool search_score_summary_
Are we currently in an "search_score_summary" element (should be skipped)?
Definition: PepXMLFile.h:233
Used to load and store PepXML files.
Definition: PepXMLFile.h:59
String current_base_name_
current base name
Definition: PepXMLFile.h:248
String current_sequence_
Sequence of the current peptide hit.
Definition: PepXMLFile.h:269
Definition: PepXMLFile.h:151
String description
Definition: PepXMLFile.h:157
bool seen_experiment_
Have we seen the experiment of interest at all?
Definition: PepXMLFile.h:242
bool use_precursor_data_
Get RT and m/z for peptide ID from precursor scan (should only matter for RT)?
Definition: PepXMLFile.h:218
bool search_summary_
Are we currently in an "search_summary" element (should be skipped)?
Definition: PepXMLFile.h:236
Representation of an element.
Definition: Element.h:53
const SpectrumMetaDataLookup * lookup_
Pointer to wrapper for looking up spectrum meta data.
Definition: PepXMLFile.h:203
double hydrogen_mass_
Mass of a hydrogen atom (monoisotopic/average depending on case)
Definition: PepXMLFile.h:287
UInt search_id_
ID of current search result.
Definition: PepXMLFile.h:278
Representation of a peptide hit.
Definition: PeptideHit.h:54
std::map< Size, Size > scan_map_
Mapping between scan number in the pepXML file and index in the corresponding MSExperiment.
Definition: PepXMLFile.h:221
static const double mod_tol_
Definition: PepXMLFile.h:300
String experiment_label_
Definition: PepXMLFile.h:213
std::vector< PeptideIdentification > * peptides_
Pointer to the list of identified peptides.
Definition: PepXMLFile.h:200
bool wrong_experiment_
Do current entries belong to the experiment of interest (for pepXML files that bundle results from di...
Definition: PepXMLFile.h:239
Int charge_
Precursor ion charge.
Definition: PepXMLFile.h:275
DateTime date_
Date the pepXML file was generated.
Definition: PepXMLFile.h:284
Analysis Result (containing search engine / prophet results)
Definition: PeptideHit.h:194
void keepNativeSpectrumName(bool keep)
Whether we should keep the native spectrum name of the pepXML.
Definition: PepXMLFile.h:116
String swath_assay_
Definition: PepXMLFile.h:214
std::vector< std::pair< String, Size > > current_modifications_
The modifications of the current peptide hit (position is 1-based)
Definition: PepXMLFile.h:290
DateTime Class.
Definition: DateTime.h:54
String native_spectrum_name_
Several optional attributes of spectrum_query.
Definition: PepXMLFile.h:212
String prot_id_
Identifier linking PeptideIdentifications and ProteinIdentifications.
Definition: PepXMLFile.h:281
std::vector< AminoAcidModification > variable_modifications_
Variable aminoacid modifications.
Definition: PepXMLFile.h:296
Base class for loading/storing XML files that have a handler derived from XMLHandler.
Definition: XMLFile.h:48
PeptideHit peptide_hit_
PeptideHit instance currently being processed.
Definition: PepXMLFile.h:266
PeptideIdentification current_peptide_
PeptideIdentification instance currently being processed.
Definition: PepXMLFile.h:260
String aminoacid
Definition: PepXMLFile.h:153
bool checked_base_name_
Have we checked the "base_name" attribute in the "msms_run_summary" element?
Definition: PepXMLFile.h:245
bool analysis_summary_
Are we currently in an "analysis_summary" element (should be skipped)?
Definition: PepXMLFile.h:227
static const double xtandem_artificial_mod_tol_
Definition: PepXMLFile.h:301
String search_engine_
Set name of search engine.
Definition: PepXMLFile.h:209
virtual ~AminoAcidModification()
Definition: PepXMLFile.h:176
int Int
Signed integer type.
Definition: Types.h:102
String enzyme_
Enzyme name associated with the current identification run.
Definition: PepXMLFile.h:257
PeptideHit::PepXMLAnalysisResult current_analysis_result_
Analysis result instance currently being processed.
Definition: PepXMLFile.h:263
bool keep_native_name_
Whether we should keep the native spectrum name of the pepXML.
Definition: PepXMLFile.h:230
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:62
bool variable
Definition: PepXMLFile.h:156

OpenMS / TOPP release 2.3.0 Documentation generated on Wed Apr 18 2018 19:29:07 using doxygen 1.8.14