OpenMS
Loading...
Searching...
No Matches
OPXLDataStructs.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- 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
18#include <functional>
19//#include <numeric>
20
21namespace OpenMS
22{
23 class OPENMS_DLLAPI OPXLDataStructs
24 {
25
26 public:
27
32 {
33 CROSS = 0,
34 MONO = 1,
35 LOOP = 2,
36 NUMBER_OF_CROSS_LINK_TYPES
37 };
38
49 {
50 const AASequence *alpha = nullptr;
51 const AASequence *beta = nullptr;
52 std::pair<SignedSize, SignedSize> cross_link_position;
53 double cross_linker_mass = 0;
55 ResidueModification::TermSpecificity term_spec_alpha = ResidueModification::TermSpecificity::ANYWHERE;
56 ResidueModification::TermSpecificity term_spec_beta = ResidueModification::TermSpecificity::ANYWHERE;
57 int precursor_correction = 0;
58
60 {
61 if (beta && !beta->empty()) return CROSS;
62
63 if (cross_link_position.second == -1) return MONO;
64
65 return LOOP;
66 }
67
68 bool operator==(const ProteinProteinCrossLink & other) const
69 {
70 return alpha == other.alpha &&
71 beta == other.beta &&
72 cross_link_position == other.cross_link_position &&
73 cross_linker_mass == other.cross_linker_mass &&
74 cross_linker_name == other.cross_linker_name &&
75 term_spec_alpha == other.term_spec_alpha &&
76 term_spec_beta == other.term_spec_beta &&
77 precursor_correction == other.precursor_correction;
78 }
79 };
80
89 {
92
94 Size scan_index_light = 0;
95 Size scan_index_heavy = 0;
96
98 double score = 0;
99
101 Size rank = 0;
102
104 double xquest_score = 0;
105 double pre_score = 0;
106 double percTIC = 0;
107 double wTIC = 0;
108 double wTICold = 0;
109 double int_sum = 0;
110 double intsum_alpha = 0;
111 double intsum_beta = 0;
112 double total_current = 0;
113 double precursor_error_ppm = 0;
114
115 double match_odds = 0;
116 double match_odds_alpha = 0;
117 double match_odds_beta = 0;
118 double log_occupancy = 0;
119 double log_occupancy_alpha = 0;
120 double log_occupancy_beta = 0;
121 double xcorrx_max = 0;
122 double xcorrc_max = 0;
123 Size matched_linear_alpha = 0;
124 Size matched_linear_beta = 0;
125 Size matched_xlink_alpha = 0;
126 Size matched_xlink_beta = 0;
127
128 double num_iso_peaks_mean = 0;
129 double num_iso_peaks_mean_linear_alpha = 0;
130 double num_iso_peaks_mean_linear_beta = 0;
131 double num_iso_peaks_mean_xlinks_alpha = 0;
132 double num_iso_peaks_mean_xlinks_beta = 0;
133
134 double ppm_error_abs_sum_linear_alpha = 0;
135 double ppm_error_abs_sum_linear_beta = 0;
136 double ppm_error_abs_sum_xlinks_alpha = 0;
137 double ppm_error_abs_sum_xlinks_beta = 0;
138 double ppm_error_abs_sum_linear = 0;
139 double ppm_error_abs_sum_xlinks = 0;
140 double ppm_error_abs_sum_alpha = 0;
141 double ppm_error_abs_sum_beta = 0;
142 double ppm_error_abs_sum = 0;
143
144 int precursor_correction = 0;
145
146 double precursor_total_intensity = 0;
147 double precursor_target_intensity = 0;
148 double precursor_signal_proportion = 0;
149 Size precursor_target_peak_count = 0;
150 Size precursor_residual_peak_count = 0;
151
152 std::vector<PeptideHit::PeakAnnotation> frag_annotations;
153
154 Size peptide_id_index = 0;
155 };
156
162 {
163 bool operator() (const CrossLinkSpectrumMatch& a, const CrossLinkSpectrumMatch& b)
164 {
165 if (a.score == b.score)
166 {
167 // in rare cases when the sequences are the same, multiple candidates with different cross-linked positions can have the same score
168 // that leads to ambiguous sorting and may cause differences between compilers
169 // in those cases we prefer higher positions (just like the score),
170 // 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)
172 {
174 }
176 }
177 return a.score < b.score;
178 }
179 };
180
192 {
193 float precursor_mass{};
194 unsigned int alpha_index = 0;
195 unsigned int beta_index = 0;
198 };
199
200 // comparator for sorting XLPrecursor vectors and using upper_bound and lower_bound using only a precursor mass
207 {
208 bool operator() (const XLPrecursor& a, const XLPrecursor& b) const
209 {
210 return a.precursor_mass < b.precursor_mass;
211 }
212 bool operator() (const XLPrecursor& a, const double& b) const
213 {
214 return a.precursor_mass < b;
215 }
216 bool operator() (const double& a, const XLPrecursor& b) const
217 {
218 return a < b.precursor_mass;
219 }
220 };
221
228 {
229 INTERNAL = 0,
230 C_TERM = 1,
231 N_TERM = 2
232 };
233
245 {
246 double peptide_mass = 0;
248 PeptidePosition position = PeptidePosition::INTERNAL;
250 };
251
258 {
259 bool operator() (const AASeqWithMass& a, const AASeqWithMass& b) const
260 {
261 return a.peptide_mass < b.peptide_mass;
262 }
263 bool operator() (const AASeqWithMass& a, const double& b) const
264 {
265 return a.peptide_mass < b;
266 }
267 bool operator() (const double& a, const AASeqWithMass& b) const
268 {
269 return a < b.peptide_mass;
270 }
271 };
272
280 {
281
285
286 // 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).
288 {
289 for (Size i = 0; i != size; ++i)
290 {
291 spectra_linear_peaks.addSpectrum(PeakSpectrum());
292 spectra_xlink_peaks.addSpectrum(PeakSpectrum());
293 spectra_all_peaks.addSpectrum(PeakSpectrum());
294 }
295 }
296 };
297
298 }; // class
299} // namespace OpenMS
300
301namespace std
302{
304 template<>
305 struct hash<OpenMS::OPXLDataStructs::ProteinProteinCrossLink>
306 {
307 std::size_t operator()(const OpenMS::OPXLDataStructs::ProteinProteinCrossLink& link) const noexcept
308 {
309 std::size_t seed = 0;
310
311 // Hash pointers (alpha and beta) - these are compared by pointer value in operator==
312 OpenMS::hash_combine(seed, OpenMS::hash_int(reinterpret_cast<std::uintptr_t>(link.alpha)));
313 OpenMS::hash_combine(seed, OpenMS::hash_int(reinterpret_cast<std::uintptr_t>(link.beta)));
314
315 // Hash cross_link_position (pair of SignedSize)
316 OpenMS::hash_combine(seed, OpenMS::hash_int(link.cross_link_position.first));
317 OpenMS::hash_combine(seed, OpenMS::hash_int(link.cross_link_position.second));
318
319 // Hash cross_linker_mass (double)
320 OpenMS::hash_combine(seed, OpenMS::hash_float(link.cross_linker_mass));
321
322 // Hash cross_linker_name (String, which is std::string)
323 OpenMS::hash_combine(seed, OpenMS::fnv1a_hash_string(link.cross_linker_name));
324
325 // Hash term_spec_alpha and term_spec_beta (enums)
326 OpenMS::hash_combine(seed, OpenMS::hash_int(static_cast<int>(link.term_spec_alpha)));
327 OpenMS::hash_combine(seed, OpenMS::hash_int(static_cast<int>(link.term_spec_beta)));
328
329 // Hash precursor_correction (int)
330 OpenMS::hash_combine(seed, OpenMS::hash_int(link.precursor_correction));
331
332 return seed;
333 }
334 };
335} // namespace std
Representation of a peptide/protein sequence.
Definition AASequence.h:88
bool empty() const
check if sequence is empty
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
void addSpectrum(const MSSpectrum &spectrum)
adds a spectrum to the list
The representation of a 1D spectrum.
Definition MSSpectrum.h:44
Definition OPXLDataStructs.h:24
String alpha_seq
Definition OPXLDataStructs.h:196
String unmodified_seq
Definition OPXLDataStructs.h:249
double score
final score
Definition OPXLDataStructs.h:98
String beta_seq
Definition OPXLDataStructs.h:197
ProteinProteinCrossLinkType
The ProteinProteinCrossLinkType enum enumerates possible types of Protein-Protein cross-linking react...
Definition OPXLDataStructs.h:32
float precursor_mass
Definition OPXLDataStructs.h:193
AASequence peptide_seq
Definition OPXLDataStructs.h:247
double peptide_mass
Definition OPXLDataStructs.h:246
ProteinProteinCrossLink cross_link
structure of the cross-link
Definition OPXLDataStructs.h:91
PeptidePosition
The PeptidePosition enum.
Definition OPXLDataStructs.h:228
std::vector< PeptideHit::PeakAnnotation > frag_annotations
Definition OPXLDataStructs.h:152
The AASeqWithMass struct represents a normal peptide with its precomputed mass.
Definition OPXLDataStructs.h:245
The CrossLinkSpectrumMatch struct represents a PSM between a ProteinProteinCrossLink and a spectrum i...
Definition OPXLDataStructs.h:89
The XLPrecursor struct represents a cross-link candidate in the process of filtering candidates by pr...
Definition OPXLDataStructs.h:192
TermSpecificity
Position where the modification is allowed to occur.
Definition ResidueModification.h:74
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
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::size_t hash_int(T value) noexcept
Hash for an integer type.
Definition HashUtils.h:107
void hash_combine(std::size_t &seed, std::size_t value) noexcept
Combine a hash value with additional data using golden ratio mixing.
Definition HashUtils.h:87
std::size_t hash_float(T value) noexcept
Hash for a floating point type (float or double).
Definition HashUtils.h:142
std::size_t fnv1a_hash_string(const std::string &s) noexcept
FNV-1a hash for a string.
Definition HashUtils.h:70
STL namespace.
The AASeqWithMassComparator is a comparator for AASeqWithMass objects.
Definition OPXLDataStructs.h:258
Comparator to sort CrossLinkSpectrumMatches by the main score.
Definition OPXLDataStructs.h:162
The PreprocessedPairSpectra struct represents the result of comparing a light and a heavy labeled spe...
Definition OPXLDataStructs.h:280
PreprocessedPairSpectra(Size size)
Definition OPXLDataStructs.h:287
MSExperiment spectra_all_peaks
Definition OPXLDataStructs.h:284
MSExperiment spectra_xlink_peaks
Xlink peaks in the light spectrum (linear peaks between spectra_light_different and spectra heavy_to_...
Definition OPXLDataStructs.h:283
MSExperiment spectra_linear_peaks
merge spectrum of linear peaks (present in both spectra)
Definition OPXLDataStructs.h:282
The XLPrecursorComparator is a comparator for XLPrecursors, that allows direct comparison of the XLPr...
Definition OPXLDataStructs.h:207