OpenMS  2.4.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-2018.
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  AASequence alpha; // longer peptide
75  AASequence beta; // shorter peptide (empty for mono-link), tie bracker: mass then lexicographical
76  std::pair<SignedSize, SignedSize> cross_link_position; // index in alpha, beta or between alpha, alpha in loop-links
82 
84  {
85  if (!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 
120 
122  double score;
123 
126 
128  double xquest_score;
129  double pre_score;
130  double percTIC;
131  double wTIC;
132  double wTICold;
133  double int_sum;
134  double intsum_alpha;
135  double intsum_beta;
138 
139  double match_odds;
145  double xcorrx_max;
146  double xcorrc_max;
151 
157 
167 
169 
170  std::vector<PeptideHit::PeakAnnotation> frag_annotations;
171 
173  };
174 
180  {
181  bool operator() (const CrossLinkSpectrumMatch& a, const CrossLinkSpectrumMatch& b)
182  {
183  if (a.score == b.score)
184  {
185  // in rare cases when the sequences are the same, multiple candidates with different cross-linked positions can have the same score
186  // that leads to ambigious sorting and may cause differences between compilers
187  // in those cases we prefer higher positions (just like the score),
188  // 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)
190  {
192  }
194  }
195  return a.score < b.score;
196  }
197  };
198 
209  struct XLPrecursor
210  {
212  unsigned int alpha_index;
213  unsigned int beta_index;
214  };
215 
216  // comparator for sorting XLPrecursor vectors and using upper_bound and lower_bound using only a precursor mass
223  {
224  bool operator() (const XLPrecursor& a, const XLPrecursor& b) const
225  {
226  return a.precursor_mass < b.precursor_mass;
227  }
228  bool operator() (const XLPrecursor& a, const double& b) const
229  {
230  return a.precursor_mass < b;
231  }
232  bool operator() (const double& a, const XLPrecursor& b) const
233  {
234  return a < b.precursor_mass;
235  }
236  };
237 
244  {
245  INTERNAL = 0,
246  C_TERM = 1,
247  N_TERM = 2
248  };
249 
261  {
262  double peptide_mass;
265  };
266 
273  {
274  bool operator() (const AASeqWithMass a, const AASeqWithMass b) const
275  {
276  return a.peptide_mass < b.peptide_mass;
277  }
278  bool operator() (const AASeqWithMass a, const double b) const
279  {
280  return a.peptide_mass < b;
281  }
282  bool operator() (const double a, const AASeqWithMass b) const
283  {
284  return a < b.peptide_mass;
285  }
286  };
287 
295  {
296 
297  MSExperiment spectra_linear_peaks; // merge spectrum of linear peaks (present in both spectra)
298  MSExperiment spectra_xlink_peaks; // Xlink peaks in the light spectrum (linear peaks between spectra_light_different and spectra heavy_to_light)
300 
301  // 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).
303  {
304  for (Size i = 0; i != size; ++i)
305  {
306  spectra_linear_peaks.addSpectrum(PeakSpectrum());
307  spectra_xlink_peaks.addSpectrum(PeakSpectrum());
308  spectra_all_peaks.addSpectrum(PeakSpectrum());
309  }
310  }
311  };
312 
313  }; // class
314 } // namespace OpenMS
The AASeqWithMassComparator is a comparator for AASeqWithMass objects.
Definition: OPXLDataStructs.h:272
Size matched_xlink_alpha
Definition: OPXLDataStructs.h:149
double percTIC
Definition: OPXLDataStructs.h:130
double wTIC
Definition: OPXLDataStructs.h:131
A more convenient string class.
Definition: String.h:57
ProteinProteinCrossLinkType
The ProteinProteinCrossLinkType enum enumerates possible types of Protein-Protein cross-linking react...
Definition: OPXLDataStructs.h:55
double match_odds_alpha
Definition: OPXLDataStructs.h:140
void addSpectrum(const MSSpectrum &spectrum)
adds a spectrum to the list
unsigned int beta_index
Definition: OPXLDataStructs.h:213
MSExperiment spectra_xlink_peaks
Definition: OPXLDataStructs.h:298
double num_iso_peaks_mean
Definition: OPXLDataStructs.h:152
double num_iso_peaks_mean_xlinks_beta
Definition: OPXLDataStructs.h:156
The XLPrecursorComparator is a comparator for XLPrecursors, that allows direct comparison of the XLPr...
Definition: OPXLDataStructs.h:222
std::vector< PeptideHit::PeakAnnotation > frag_annotations
Definition: OPXLDataStructs.h:170
double ppm_error_abs_sum_linear_beta
Definition: OPXLDataStructs.h:159
double total_current
Definition: OPXLDataStructs.h:136
Representation of a peptide/protein sequence.
Definition: AASequence.h:107
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
double ppm_error_abs_sum_linear
Definition: OPXLDataStructs.h:162
int precursor_correction
Definition: OPXLDataStructs.h:168
double intsum_alpha
Definition: OPXLDataStructs.h:134
double xcorrx_max
Definition: OPXLDataStructs.h:145
The CrossLinkSpectrumMatch struct represents a PSM between a ProteinProteinCrossLink and a spectrum i...
Definition: OPXLDataStructs.h:112
double ppm_error_abs_sum_xlinks
Definition: OPXLDataStructs.h:163
double ppm_error_abs_sum_xlinks_alpha
Definition: OPXLDataStructs.h:160
double xcorrc_max
Definition: OPXLDataStructs.h:146
Size scan_index_heavy
Definition: OPXLDataStructs.h:119
PreprocessedPairSpectra(Size size)
Definition: OPXLDataStructs.h:302
double ppm_error_abs_sum_xlinks_beta
Definition: OPXLDataStructs.h:161
double num_iso_peaks_mean_xlinks_alpha
Definition: OPXLDataStructs.h:155
AASequence peptide_seq
Definition: OPXLDataStructs.h:263
double num_iso_peaks_mean_linear_beta
Definition: OPXLDataStructs.h:154
double pre_score
Definition: OPXLDataStructs.h:129
Definition: OPXLDataStructs.h:47
The PreprocessedPairSpectra struct represents the result of comparing a light and a heavy labeled spe...
Definition: OPXLDataStructs.h:294
double num_iso_peaks_mean_linear_alpha
Definition: OPXLDataStructs.h:153
double score
final score
Definition: OPXLDataStructs.h:122
Comparator to sort CrossLinkSpectrumMatches by the main score.
Definition: OPXLDataStructs.h:179
TermSpecificity
Position where the modification is allowed to occur.
Definition: ResidueModification.h:95
Size matched_xlink_beta
Definition: OPXLDataStructs.h:150
double match_odds_beta
Definition: OPXLDataStructs.h:141
double wTICold
Definition: OPXLDataStructs.h:132
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
double peptide_mass
Definition: OPXLDataStructs.h:262
double match_odds
Definition: OPXLDataStructs.h:139
MSExperiment spectra_linear_peaks
Definition: OPXLDataStructs.h:297
double ppm_error_abs_sum
Definition: OPXLDataStructs.h:166
double xquest_score
counts, scores and other data for xQuest-like output
Definition: OPXLDataStructs.h:128
double intsum_beta
Definition: OPXLDataStructs.h:135
bool empty() const
check if sequence is empty
MSSpectrum PeakSpectrum
Spectrum consisting of raw data points or peaks.
Definition: StandardTypes.h:44
double ppm_error_abs_sum_beta
Definition: OPXLDataStructs.h:165
double precursor_error_ppm
Definition: OPXLDataStructs.h:137
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
unsigned int alpha_index
Definition: OPXLDataStructs.h:212
MSExperiment spectra_all_peaks
Definition: OPXLDataStructs.h:299
double ppm_error_abs_sum_alpha
Definition: OPXLDataStructs.h:164
The XLPrecursor struct represents a cross-link candidate in the process of filtering candidates by pr...
Definition: OPXLDataStructs.h:209
double log_occupancy_alpha
Definition: OPXLDataStructs.h:143
double ppm_error_abs_sum_linear_alpha
Definition: OPXLDataStructs.h:158
double int_sum
Definition: OPXLDataStructs.h:133
Size matched_linear_beta
Definition: OPXLDataStructs.h:148
Size peptide_id_index
Definition: OPXLDataStructs.h:172
The AASeqWithMass struct represents a normal peptide with its precomputed mass.
Definition: OPXLDataStructs.h:260
Size matched_linear_alpha
Definition: OPXLDataStructs.h:147
PeptidePosition position
Definition: OPXLDataStructs.h:264
ProteinProteinCrossLink cross_link
structure of the cross-link
Definition: OPXLDataStructs.h:115
float precursor_mass
Definition: OPXLDataStructs.h:211
double log_occupancy
Definition: OPXLDataStructs.h:142
PeptidePosition
The PeptidePosition enum.
Definition: OPXLDataStructs.h:243
Size scan_index_light
reference to pair of spectra
Definition: OPXLDataStructs.h:118
double log_occupancy_beta
Definition: OPXLDataStructs.h:144
Size rank
rank among the matches to the same spectrum
Definition: OPXLDataStructs.h:125