OpenMS  2.8.0
OPXLDataStructs.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-2021.
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: Eugen Netz $
32 // $Authors: Eugen Netz $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
43 //#include <numeric>
44 
45 namespace OpenMS
46 {
47  class OPENMS_DLLAPI OPXLDataStructs
48  {
49 
50  public:
51 
56  {
57  CROSS = 0,
58  MONO = 1,
59  LOOP = 2,
60  NUMBER_OF_CROSS_LINK_TYPES
61  };
62 
73  {
74  const AASequence *alpha = nullptr;
75  const AASequence *beta = nullptr;
76  std::pair<SignedSize, SignedSize> cross_link_position;
77  double cross_linker_mass = 0;
81  int precursor_correction = 0;
82 
84  {
85  if (beta && !beta->empty()) return CROSS;
86 
87  if (cross_link_position.second == -1) return MONO;
88 
89  return LOOP;
90  }
91 
92  bool operator==(const ProteinProteinCrossLink & other) const
93  {
94  return alpha == other.alpha &&
95  beta == other.beta &&
96  cross_link_position == other.cross_link_position &&
97  cross_linker_mass == other.cross_linker_mass &&
98  cross_linker_name == other.cross_linker_name &&
99  term_spec_alpha == other.term_spec_alpha &&
100  term_spec_beta == other.term_spec_beta &&
101  precursor_correction == other.precursor_correction;
102  }
103  };
104 
113  {
116 
118  Size scan_index_light = 0;
119  Size scan_index_heavy = 0;
120 
122  double score = 0;
123 
125  Size rank = 0;
126 
128  double xquest_score = 0;
129  double pre_score = 0;
130  double percTIC = 0;
131  double wTIC = 0;
132  double wTICold = 0;
133  double int_sum = 0;
134  double intsum_alpha = 0;
135  double intsum_beta = 0;
136  double total_current = 0;
137  double precursor_error_ppm = 0;
138 
139  double match_odds = 0;
140  double match_odds_alpha = 0;
141  double match_odds_beta = 0;
142  double log_occupancy = 0;
143  double log_occupancy_alpha = 0;
144  double log_occupancy_beta = 0;
145  double xcorrx_max = 0;
146  double xcorrc_max = 0;
147  Size matched_linear_alpha = 0;
148  Size matched_linear_beta = 0;
149  Size matched_xlink_alpha = 0;
150  Size matched_xlink_beta = 0;
151 
152  double num_iso_peaks_mean = 0;
153  double num_iso_peaks_mean_linear_alpha = 0;
154  double num_iso_peaks_mean_linear_beta = 0;
155  double num_iso_peaks_mean_xlinks_alpha = 0;
156  double num_iso_peaks_mean_xlinks_beta = 0;
157 
158  double ppm_error_abs_sum_linear_alpha = 0;
159  double ppm_error_abs_sum_linear_beta = 0;
160  double ppm_error_abs_sum_xlinks_alpha = 0;
161  double ppm_error_abs_sum_xlinks_beta = 0;
162  double ppm_error_abs_sum_linear = 0;
163  double ppm_error_abs_sum_xlinks = 0;
164  double ppm_error_abs_sum_alpha = 0;
165  double ppm_error_abs_sum_beta = 0;
166  double ppm_error_abs_sum = 0;
167 
168  int precursor_correction = 0;
169 
170  double precursor_total_intensity = 0;
171  double precursor_target_intensity = 0;
172  double precursor_signal_proportion = 0;
173  Size precursor_target_peak_count = 0;
174  Size precursor_residual_peak_count = 0;
175 
176  std::vector<PeptideHit::PeakAnnotation> frag_annotations;
177 
178  Size peptide_id_index = 0;
179  };
180 
186  {
187  bool operator() (const CrossLinkSpectrumMatch& a, const CrossLinkSpectrumMatch& b)
188  {
189  if (a.score == b.score)
190  {
191  // in rare cases when the sequences are the same, multiple candidates with different cross-linked positions can have the same score
192  // that leads to ambiguous sorting and may cause differences between compilers
193  // in those cases we prefer higher positions (just like the score),
194  // because the lower position might be an N-term link, which is usually less likely and all other positions are equal (because the score is equal)
196  {
198  }
200  }
201  return a.score < b.score;
202  }
203  };
204 
215  struct XLPrecursor
216  {
218  unsigned int alpha_index;
219  unsigned int beta_index;
222  };
223 
224  // comparator for sorting XLPrecursor vectors and using upper_bound and lower_bound using only a precursor mass
231  {
232  bool operator() (const XLPrecursor& a, const XLPrecursor& b) const
233  {
234  return a.precursor_mass < b.precursor_mass;
235  }
236  bool operator() (const XLPrecursor& a, const double& b) const
237  {
238  return a.precursor_mass < b;
239  }
240  bool operator() (const double& a, const XLPrecursor& b) const
241  {
242  return a < b.precursor_mass;
243  }
244  };
245 
252  {
253  INTERNAL = 0,
254  C_TERM = 1,
255  N_TERM = 2
256  };
257 
269  {
270  double peptide_mass;
274  };
275 
282  {
283  bool operator() (const AASeqWithMass& a, const AASeqWithMass& b) const
284  {
285  return a.peptide_mass < b.peptide_mass;
286  }
287  bool operator() (const AASeqWithMass& a, const double& b) const
288  {
289  return a.peptide_mass < b;
290  }
291  bool operator() (const double& a, const AASeqWithMass& b) const
292  {
293  return a < b.peptide_mass;
294  }
295  };
296 
304  {
305 
309 
310  // pre-initialize so we can simply std::swap the spectra (no synchronization in multi-threading context needed as we get no reallocation of the PeakMaps).
312  {
313  for (Size i = 0; i != size; ++i)
314  {
315  spectra_linear_peaks.addSpectrum(PeakSpectrum());
316  spectra_xlink_peaks.addSpectrum(PeakSpectrum());
317  spectra_all_peaks.addSpectrum(PeakSpectrum());
318  }
319  }
320  };
321 
322  }; // class
323 } // namespace OpenMS
Representation of a peptide/protein sequence.
Definition: AASequence.h:112
bool empty() const
check if sequence is empty
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:73
void addSpectrum(const MSSpectrum &spectrum)
adds a spectrum to the list
Definition: OPXLDataStructs.h:48
String alpha_seq
Definition: OPXLDataStructs.h:220
String unmodified_seq
Definition: OPXLDataStructs.h:273
double score
final score
Definition: OPXLDataStructs.h:122
String beta_seq
Definition: OPXLDataStructs.h:221
ProteinProteinCrossLinkType
The ProteinProteinCrossLinkType enum enumerates possible types of Protein-Protein cross-linking react...
Definition: OPXLDataStructs.h:56
unsigned int alpha_index
Definition: OPXLDataStructs.h:218
float precursor_mass
Definition: OPXLDataStructs.h:217
PeptidePosition position
Definition: OPXLDataStructs.h:272
AASequence peptide_seq
Definition: OPXLDataStructs.h:271
double peptide_mass
Definition: OPXLDataStructs.h:270
ProteinProteinCrossLink cross_link
structure of the cross-link
Definition: OPXLDataStructs.h:115
PeptidePosition
The PeptidePosition enum.
Definition: OPXLDataStructs.h:252
std::vector< PeptideHit::PeakAnnotation > frag_annotations
Definition: OPXLDataStructs.h:176
unsigned int beta_index
Definition: OPXLDataStructs.h:219
The AASeqWithMass struct represents a normal peptide with its precomputed mass.
Definition: OPXLDataStructs.h:269
The CrossLinkSpectrumMatch struct represents a PSM between a ProteinProteinCrossLink and a spectrum i...
Definition: OPXLDataStructs.h:113
The XLPrecursor struct represents a cross-link candidate in the process of filtering candidates by pr...
Definition: OPXLDataStructs.h:216
TermSpecificity
Position where the modification is allowed to occur.
Definition: ResidueModification.h:96
A more convenient string class.
Definition: String.h:60
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
MSSpectrum PeakSpectrum
Spectrum consisting of raw data points or peaks.
Definition: StandardTypes.h:44
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
The AASeqWithMassComparator is a comparator for AASeqWithMass objects.
Definition: OPXLDataStructs.h:282
Comparator to sort CrossLinkSpectrumMatches by the main score.
Definition: OPXLDataStructs.h:186
The PreprocessedPairSpectra struct represents the result of comparing a light and a heavy labeled spe...
Definition: OPXLDataStructs.h:304
PreprocessedPairSpectra(Size size)
Definition: OPXLDataStructs.h:311
MSExperiment spectra_all_peaks
Definition: OPXLDataStructs.h:308
MSExperiment spectra_xlink_peaks
Xlink peaks in the light spectrum (linear peaks between spectra_light_different and spectra heavy_to_...
Definition: OPXLDataStructs.h:307
MSExperiment spectra_linear_peaks
merge spectrum of linear peaks (present in both spectra)
Definition: OPXLDataStructs.h:306
The XLPrecursorComparator is a comparator for XLPrecursors, that allows direct comparison of the XLPr...
Definition: OPXLDataStructs.h:231