| OpenMS 2.5.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-2020.
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
37 #include <OpenMS/KERNEL/StandardTypes.h>
38 #include <OpenMS/METADATA/PeptideHit.h>
39 #include <OpenMS/KERNEL/MSExperiment.h>
40 #include <OpenMS/CHEMISTRY/ResidueModification.h>
41 #include <OpenMS/FORMAT/FASTAFile.h>
42 #include <OpenMS/CHEMISTRY/EnzymaticDigestion.h>
43 //#include <numeric>
44
45 namespace OpenMS
46 {
47 class OPENMS_DLLAPI OPXLDataStructs
48 {
49
50 public:
51
55 enum ProteinProteinCrossLinkType
56 {
57 CROSS = 0,
58 MONO = 1,
59 LOOP = 2,
60 NUMBER_OF_CROSS_LINK_TYPES
61 };
62
72 struct ProteinProteinCrossLink
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;
78 String cross_linker_name;
79 ResidueModification::TermSpecificity term_spec_alpha;
80 ResidueModification::TermSpecificity term_spec_beta;
81 int precursor_correction = 0;
82
83 ProteinProteinCrossLinkType getType() const
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
112 struct CrossLinkSpectrumMatch
113 {
115 ProteinProteinCrossLink cross_link;
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
185 struct CLSMScoreComparator
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)
195 if (a.cross_link.cross_link_position.first == b.cross_link.cross_link_position.first)
196 {
197 return a.cross_link.cross_link_position.second < b.cross_link.cross_link_position.second;
198 }
199 return a.cross_link.cross_link_position.first < b.cross_link.cross_link_position.first;
200 }
201 return a.score < b.score;
202 }
203 };
204
215 struct XLPrecursor
216 {
217 float precursor_mass;
218 unsigned int alpha_index;
219 unsigned int beta_index;
220 String alpha_seq;
221 String beta_seq;
222 };
223
224 // comparator for sorting XLPrecursor vectors and using upper_bound and lower_bound using only a precursor mass
230 struct XLPrecursorComparator
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
251 enum PeptidePosition
252 {
253 INTERNAL = 0,
254 C_TERM = 1,
255 N_TERM = 2
256 };
257
268 struct AASeqWithMass
269 {
270 double peptide_mass;
271 AASequence peptide_seq;
272 PeptidePosition position;
273 String unmodified_seq;
274 };
275
281 struct AASeqWithMassComparator
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
303 struct PreprocessedPairSpectra
304 {
305
306 MSExperiment spectra_linear_peaks;
307 MSExperiment spectra_xlink_peaks;
308 MSExperiment spectra_all_peaks;
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).
311 PreprocessedPairSpectra(Size size)
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
OpenMS::OPXLDataStructs::AASeqWithMass::position
PeptidePosition position
Definition: OPXLDataStructs.h:272
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::OPXLDataStructs::PreprocessedPairSpectra::spectra_linear_peaks
MSExperiment spectra_linear_peaks
merge spectrum of linear peaks (present in both spectra)
Definition: OPXLDataStructs.h:306
OpenMS::OPXLDataStructs::ProteinProteinCrossLink::getType
ProteinProteinCrossLinkType getType() const
Definition: OPXLDataStructs.h:83
OpenMS::OPXLDataStructs::AASeqWithMassComparator
The AASeqWithMassComparator is a comparator for AASeqWithMass objects.
Definition: OPXLDataStructs.h:281
OpenMS::OPXLDataStructs::AASeqWithMass
The AASeqWithMass struct represents a normal peptide with its precomputed mass.
Definition: OPXLDataStructs.h:268
OpenMS::OPXLDataStructs::AASeqWithMass::peptide_seq
AASequence peptide_seq
Definition: OPXLDataStructs.h:271
OpenMS::OPXLDataStructs::CrossLinkSpectrumMatch
The CrossLinkSpectrumMatch struct represents a PSM between a ProteinProteinCrossLink and a spectrum i...
Definition: OPXLDataStructs.h:112
OpenMS::OPXLDataStructs::XLPrecursor
The XLPrecursor struct represents a cross-link candidate in the process of filtering candidates by pr...
Definition: OPXLDataStructs.h:215
OpenMS::MSExperiment::addSpectrum
void addSpectrum(const MSSpectrum &spectrum)
adds a spectrum to the list
OpenMS::OPXLDataStructs::XLPrecursor::alpha_seq
String alpha_seq
Definition: OPXLDataStructs.h:220
OpenMS::OPXLDataStructs::ProteinProteinCrossLink::term_spec_beta
ResidueModification::TermSpecificity term_spec_beta
Definition: OPXLDataStructs.h:80
OpenMS::PeakSpectrum
MSSpectrum PeakSpectrum
Spectrum consisting of raw data points or peaks.
Definition: StandardTypes.h:44
OpenMS::OPXLDataStructs::PeptidePosition
PeptidePosition
The PeptidePosition enum.
Definition: OPXLDataStructs.h:251
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
OpenMS::OPXLDataStructs::XLPrecursor::precursor_mass
float precursor_mass
Definition: OPXLDataStructs.h:217
OpenMS::OPXLDataStructs::ProteinProteinCrossLinkType
ProteinProteinCrossLinkType
The ProteinProteinCrossLinkType enum enumerates possible types of Protein-Protein cross-linking react...
Definition: OPXLDataStructs.h:55
StandardTypes.h
OpenMS::OPXLDataStructs::AASeqWithMass::unmodified_seq
String unmodified_seq
Definition: OPXLDataStructs.h:273
OpenMS::OPXLDataStructs::ProteinProteinCrossLink
The ProteinProteinCrossLink struct represents a cross-link between two peptides in OpenPepXL...
Definition: OPXLDataStructs.h:72
OpenMS::OPXLDataStructs::PreprocessedPairSpectra::spectra_all_peaks
MSExperiment spectra_all_peaks
Definition: OPXLDataStructs.h:308
OpenMS::OPXLDataStructs::XLPrecursor::beta_index
unsigned int beta_index
Definition: OPXLDataStructs.h:219
OpenMS::OPXLDataStructs::AASeqWithMass::peptide_mass
double peptide_mass
Definition: OPXLDataStructs.h:270
OpenMS::OPXLDataStructs::ProteinProteinCrossLink::beta
const AASequence * beta
shorter peptide (empty for mono-link), tie breaker: mass then lexicographical
Definition: OPXLDataStructs.h:75
OpenMS::OPXLDataStructs::CrossLinkSpectrumMatch::cross_link
ProteinProteinCrossLink cross_link
structure of the cross-link
Definition: OPXLDataStructs.h:115
OpenMS::OPXLDataStructs::PreprocessedPairSpectra::PreprocessedPairSpectra
PreprocessedPairSpectra(Size size)
Definition: OPXLDataStructs.h:311
OpenMS::OPXLDataStructs::CrossLinkSpectrumMatch::frag_annotations
std::vector< PeptideHit::PeakAnnotation > frag_annotations
Definition: OPXLDataStructs.h:176
OpenMS::OPXLDataStructs::CLSMScoreComparator
Comparator to sort CrossLinkSpectrumMatches by the main score.
Definition: OPXLDataStructs.h:185
OpenMS::AASequence
Representation of a peptide/protein sequence.
Definition: AASequence.h:113
OpenMS::OPXLDataStructs
Definition: OPXLDataStructs.h:47
PeptideHit.h
FASTAFile.h
OpenMS::OPXLDataStructs::PreprocessedPairSpectra
The PreprocessedPairSpectra struct represents the result of comparing a light and a heavy labeled spe...
Definition: OPXLDataStructs.h:303
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::OPXLDataStructs::XLPrecursorComparator
The XLPrecursorComparator is a comparator for XLPrecursors, that allows direct comparison of the XLPr...
Definition: OPXLDataStructs.h:230
MSExperiment.h
OpenMS::OPXLDataStructs::PreprocessedPairSpectra::spectra_xlink_peaks
MSExperiment spectra_xlink_peaks
Xlink peaks in the light spectrum (linear peaks between spectra_light_different and spectra heavy_to_...
Definition: OPXLDataStructs.h:307
OpenMS::OPXLDataStructs::ProteinProteinCrossLink::cross_link_position
std::pair< SignedSize, SignedSize > cross_link_position
index in alpha, beta or between alpha, alpha in loop-links
Definition: OPXLDataStructs.h:76
OpenMS::OPXLDataStructs::ProteinProteinCrossLink::cross_linker_name
String cross_linker_name
Definition: OPXLDataStructs.h:78
OpenMS::OPXLDataStructs::ProteinProteinCrossLink::term_spec_alpha
ResidueModification::TermSpecificity term_spec_alpha
Definition: OPXLDataStructs.h:79
OpenMS::ResidueModification::TermSpecificity
TermSpecificity
Position where the modification is allowed to occur.
Definition: ResidueModification.h:95
OpenMS::OPXLDataStructs::CrossLinkSpectrumMatch::score
double score
final score
Definition: OPXLDataStructs.h:122
OpenMS::OPXLDataStructs::ProteinProteinCrossLink::alpha
const AASequence * alpha
longer peptide
Definition: OPXLDataStructs.h:74
OpenMS::AASequence::empty
bool empty() const
check if sequence is empty
EnzymaticDigestion.h
OpenMS::OPXLDataStructs::ProteinProteinCrossLink::operator==
bool operator==(const ProteinProteinCrossLink &other) const
Definition: OPXLDataStructs.h:92
OpenMS::OPXLDataStructs::ProteinProteinCrossLink::cross_linker_mass
double cross_linker_mass
Definition: OPXLDataStructs.h:77
OpenMS::OPXLDataStructs::XLPrecursor::beta_seq
String beta_seq
Definition: OPXLDataStructs.h:221
OpenMS::OPXLDataStructs::ProteinProteinCrossLink::precursor_correction
int precursor_correction
Definition: OPXLDataStructs.h:81
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
ResidueModification.h
OpenMS::OPXLDataStructs::XLPrecursor::alpha_index
unsigned int alpha_index
Definition: OPXLDataStructs.h:218