OpenMS
XQuestResultXMLFile.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Eugen Netz $
6 // $Authors: Lukas Zimmermann, Eugen Netz $
7 // --------------------------------------------------------------------------
8 #pragma once
9 
10 #include <OpenMS/FORMAT/XMLFile.h>
15 
16 namespace OpenMS
17 {
18 
29  class OPENMS_DLLAPI XQuestResultXMLFile :
30  public Internal::XMLFile,
31  public ProgressLogger
32  {
33 public:
36 
43  void load(const String & filename,
44  std::vector< PeptideIdentification > & pep_ids,
45  std::vector< ProteinIdentification > & prot_ids
46  );
47 
53  void store(const String& filename,
54  const std::vector<ProteinIdentification>& poid,
55  const std::vector<PeptideIdentification>& peid) const;
56 
61  int getNumberOfHits() const;
62 
67  double getMinScore() const;
68 
73  double getMaxScore() const;
74 
84  static void writeXQuestXMLSpec(const String& out_file, const String& base_name,
85  const OPXLDataStructs::PreprocessedPairSpectra& preprocessed_pair_spectra,
86  const std::vector< std::pair<Size, Size> >& spectrum_pairs,
87  const std::vector< std::vector< OPXLDataStructs::CrossLinkSpectrumMatch > >& all_top_csms,
88  const PeakMap& spectra, const bool& test_mode = false);
89 
97  static void writeXQuestXMLSpec(const String& out_file, const String& base_name,
98  const std::vector< std::vector< OPXLDataStructs::CrossLinkSpectrumMatch > >& all_top_csms,
99  const PeakMap& spectra, const bool& test_mode = false);
100 
101 
102 
103 private:
104 
110  static String getxQuestBase64EncodedSpectrum_(const PeakSpectrum& spec, const String& header, const bool& test_mode = false);
111 
118  static void wrap_(const String& input, Size width, String& output);
119 
120  int n_hits_;
121  double min_score_;
122  double max_score_;
123  };
124 } // namespace OpenMS
Base class for loading/storing XML files that have a handler derived from XMLHandler.
Definition: XMLFile.h:23
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:46
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:27
A more convenient string class.
Definition: String.h:34
Used to load and store xQuest result files.
Definition: XQuestResultXMLFile.h:32
int n_hits_
Total number of hits within the result file.
Definition: XQuestResultXMLFile.h:120
double getMinScore() const
Returns minimum score among the hits in the file.
static void wrap_(const String &input, Size width, String &output)
A helper function, that takes one string containing one line and wraps it into several lines of a giv...
double max_score_
Maximum score encountered in file.
Definition: XQuestResultXMLFile.h:122
void load(const String &filename, std::vector< PeptideIdentification > &pep_ids, std::vector< ProteinIdentification > &prot_ids)
Load the content of the xquest.xml file into the provided data structures.
static String getxQuestBase64EncodedSpectrum_(const PeakSpectrum &spec, const String &header, const bool &test_mode=false)
Transforms a PeakSpectrum into a base64 encoded string, which is the format used in spec....
static void writeXQuestXMLSpec(const String &out_file, const String &base_name, const OPXLDataStructs::PreprocessedPairSpectra &preprocessed_pair_spectra, const std::vector< std::pair< Size, Size > > &spectrum_pairs, const std::vector< std::vector< OPXLDataStructs::CrossLinkSpectrumMatch > > &all_top_csms, const PeakMap &spectra, const bool &test_mode=false)
Writes spec.xml output containing matching peaks between heavy and light spectra after comparing and ...
double min_score_
Minimum score encountered in file.
Definition: XQuestResultXMLFile.h:121
void store(const String &filename, const std::vector< ProteinIdentification > &poid, const std::vector< PeptideIdentification > &peid) const
Stores the identifications in a xQuest XML file.
static void writeXQuestXMLSpec(const String &out_file, const String &base_name, const std::vector< std::vector< OPXLDataStructs::CrossLinkSpectrumMatch > > &all_top_csms, const PeakMap &spectra, const bool &test_mode=false)
Writes spec.xml output containing spectra for visualization. This version of the function is meant to...
int getNumberOfHits() const
Returns the total number of hits in the file.
double getMaxScore() const
Returns maximum score among the hits in the file.
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
The PreprocessedPairSpectra struct represents the result of comparing a light and a heavy labeled spe...
Definition: OPXLDataStructs.h:278