OpenMS
OPXLDataStructs.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, 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: Eugen Netz $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
17 //#include <numeric>
18 
19 namespace OpenMS
20 {
21  class OPENMS_DLLAPI OPXLDataStructs
22  {
23 
24  public:
25 
30  {
31  CROSS = 0,
32  MONO = 1,
33  LOOP = 2,
34  NUMBER_OF_CROSS_LINK_TYPES
35  };
36 
47  {
48  const AASequence *alpha = nullptr;
49  const AASequence *beta = nullptr;
50  std::pair<SignedSize, SignedSize> cross_link_position;
51  double cross_linker_mass = 0;
53  ResidueModification::TermSpecificity term_spec_alpha = ResidueModification::TermSpecificity::ANYWHERE;
54  ResidueModification::TermSpecificity term_spec_beta = ResidueModification::TermSpecificity::ANYWHERE;
55  int precursor_correction = 0;
56 
58  {
59  if (beta && !beta->empty()) return CROSS;
60 
61  if (cross_link_position.second == -1) return MONO;
62 
63  return LOOP;
64  }
65 
66  bool operator==(const ProteinProteinCrossLink & other) const
67  {
68  return alpha == other.alpha &&
69  beta == other.beta &&
70  cross_link_position == other.cross_link_position &&
71  cross_linker_mass == other.cross_linker_mass &&
72  cross_linker_name == other.cross_linker_name &&
73  term_spec_alpha == other.term_spec_alpha &&
74  term_spec_beta == other.term_spec_beta &&
75  precursor_correction == other.precursor_correction;
76  }
77  };
78 
87  {
90 
92  Size scan_index_light = 0;
93  Size scan_index_heavy = 0;
94 
96  double score = 0;
97 
99  Size rank = 0;
100 
102  double xquest_score = 0;
103  double pre_score = 0;
104  double percTIC = 0;
105  double wTIC = 0;
106  double wTICold = 0;
107  double int_sum = 0;
108  double intsum_alpha = 0;
109  double intsum_beta = 0;
110  double total_current = 0;
111  double precursor_error_ppm = 0;
112 
113  double match_odds = 0;
114  double match_odds_alpha = 0;
115  double match_odds_beta = 0;
116  double log_occupancy = 0;
117  double log_occupancy_alpha = 0;
118  double log_occupancy_beta = 0;
119  double xcorrx_max = 0;
120  double xcorrc_max = 0;
121  Size matched_linear_alpha = 0;
122  Size matched_linear_beta = 0;
123  Size matched_xlink_alpha = 0;
124  Size matched_xlink_beta = 0;
125 
126  double num_iso_peaks_mean = 0;
127  double num_iso_peaks_mean_linear_alpha = 0;
128  double num_iso_peaks_mean_linear_beta = 0;
129  double num_iso_peaks_mean_xlinks_alpha = 0;
130  double num_iso_peaks_mean_xlinks_beta = 0;
131 
132  double ppm_error_abs_sum_linear_alpha = 0;
133  double ppm_error_abs_sum_linear_beta = 0;
134  double ppm_error_abs_sum_xlinks_alpha = 0;
135  double ppm_error_abs_sum_xlinks_beta = 0;
136  double ppm_error_abs_sum_linear = 0;
137  double ppm_error_abs_sum_xlinks = 0;
138  double ppm_error_abs_sum_alpha = 0;
139  double ppm_error_abs_sum_beta = 0;
140  double ppm_error_abs_sum = 0;
141 
142  int precursor_correction = 0;
143 
144  double precursor_total_intensity = 0;
145  double precursor_target_intensity = 0;
146  double precursor_signal_proportion = 0;
147  Size precursor_target_peak_count = 0;
148  Size precursor_residual_peak_count = 0;
149 
150  std::vector<PeptideHit::PeakAnnotation> frag_annotations;
151 
152  Size peptide_id_index = 0;
153  };
154 
160  {
161  bool operator() (const CrossLinkSpectrumMatch& a, const CrossLinkSpectrumMatch& b)
162  {
163  if (a.score == b.score)
164  {
165  // in rare cases when the sequences are the same, multiple candidates with different cross-linked positions can have the same score
166  // that leads to ambiguous sorting and may cause differences between compilers
167  // in those cases we prefer higher positions (just like the score),
168  // 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)
170  {
172  }
174  }
175  return a.score < b.score;
176  }
177  };
178 
189  struct XLPrecursor
190  {
191  float precursor_mass{};
192  unsigned int alpha_index = 0;
193  unsigned int beta_index = 0;
196  };
197 
198  // comparator for sorting XLPrecursor vectors and using upper_bound and lower_bound using only a precursor mass
205  {
206  bool operator() (const XLPrecursor& a, const XLPrecursor& b) const
207  {
208  return a.precursor_mass < b.precursor_mass;
209  }
210  bool operator() (const XLPrecursor& a, const double& b) const
211  {
212  return a.precursor_mass < b;
213  }
214  bool operator() (const double& a, const XLPrecursor& b) const
215  {
216  return a < b.precursor_mass;
217  }
218  };
219 
226  {
227  INTERNAL = 0,
228  C_TERM = 1,
229  N_TERM = 2
230  };
231 
243  {
244  double peptide_mass = 0;
246  PeptidePosition position = PeptidePosition::INTERNAL;
248  };
249 
256  {
257  bool operator() (const AASeqWithMass& a, const AASeqWithMass& b) const
258  {
259  return a.peptide_mass < b.peptide_mass;
260  }
261  bool operator() (const AASeqWithMass& a, const double& b) const
262  {
263  return a.peptide_mass < b;
264  }
265  bool operator() (const double& a, const AASeqWithMass& b) const
266  {
267  return a < b.peptide_mass;
268  }
269  };
270 
278  {
279 
283 
284  // 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).
286  {
287  for (Size i = 0; i != size; ++i)
288  {
289  spectra_linear_peaks.addSpectrum(PeakSpectrum());
290  spectra_xlink_peaks.addSpectrum(PeakSpectrum());
291  spectra_all_peaks.addSpectrum(PeakSpectrum());
292  }
293  }
294  };
295 
296  }; // class
297 } // namespace OpenMS
Representation of a peptide/protein sequence.
Definition: AASequence.h:86
bool empty() const
check if sequence is empty
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:45
void addSpectrum(const MSSpectrum &spectrum)
adds a spectrum to the list
Definition: OPXLDataStructs.h:22
String alpha_seq
Definition: OPXLDataStructs.h:194
String unmodified_seq
Definition: OPXLDataStructs.h:247
double score
final score
Definition: OPXLDataStructs.h:96
String beta_seq
Definition: OPXLDataStructs.h:195
ProteinProteinCrossLinkType
The ProteinProteinCrossLinkType enum enumerates possible types of Protein-Protein cross-linking react...
Definition: OPXLDataStructs.h:30
float precursor_mass
Definition: OPXLDataStructs.h:191
AASequence peptide_seq
Definition: OPXLDataStructs.h:245
double peptide_mass
Definition: OPXLDataStructs.h:244
ProteinProteinCrossLink cross_link
structure of the cross-link
Definition: OPXLDataStructs.h:89
PeptidePosition
The PeptidePosition enum.
Definition: OPXLDataStructs.h:226
std::vector< PeptideHit::PeakAnnotation > frag_annotations
Definition: OPXLDataStructs.h:150
The AASeqWithMass struct represents a normal peptide with its precomputed mass.
Definition: OPXLDataStructs.h:243
The CrossLinkSpectrumMatch struct represents a PSM between a ProteinProteinCrossLink and a spectrum i...
Definition: OPXLDataStructs.h:87
The XLPrecursor struct represents a cross-link candidate in the process of filtering candidates by pr...
Definition: OPXLDataStructs.h:190
TermSpecificity
Position where the modification is allowed to occur.
Definition: ResidueModification.h:72
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
MSSpectrum PeakSpectrum
Spectrum consisting of raw data points or peaks.
Definition: StandardTypes.h:17
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
The AASeqWithMassComparator is a comparator for AASeqWithMass objects.
Definition: OPXLDataStructs.h:256
Comparator to sort CrossLinkSpectrumMatches by the main score.
Definition: OPXLDataStructs.h:160
The PreprocessedPairSpectra struct represents the result of comparing a light and a heavy labeled spe...
Definition: OPXLDataStructs.h:278
PreprocessedPairSpectra(Size size)
Definition: OPXLDataStructs.h:285
MSExperiment spectra_all_peaks
Definition: OPXLDataStructs.h:282
MSExperiment spectra_xlink_peaks
Xlink peaks in the light spectrum (linear peaks between spectra_light_different and spectra heavy_to_...
Definition: OPXLDataStructs.h:281
MSExperiment spectra_linear_peaks
merge spectrum of linear peaks (present in both spectra)
Definition: OPXLDataStructs.h:280
The XLPrecursorComparator is a comparator for XLPrecursors, that allows direct comparison of the XLPr...
Definition: OPXLDataStructs.h:205