OpenMS
Loading...
Searching...
No Matches
NuXLIonLikelihood.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: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
15
16#include <array>
17#include <cstdint>
18#include <vector>
19
20namespace OpenMS
21{
40 {
41 public:
43
44 enum Group : std::uint8_t { LINEAR = 0, XL_UNSHIFTED = 1, XL_SHIFTED = 2, XL_UNLOCALIZED = 3, GROUPS = 4 };
45
47 struct Outcomes
48 {
49 std::vector<Model::Ion> ions;
50 std::vector<std::uint8_t> groups;
51 };
52
59
61 struct Features
62 {
63 double llr = 0.0;
64 double llr_shifted = 0.0;
65 double explained_presence = 0.0;
67 };
68
70 NuXLIonLikelihood(double tolerance, bool ppm, int max_fragment_charge = 2);
71
73 void setSpectra(const PeakMap& spectra);
74
84 Evidence match(Size scan, const AASequence& peptide, int precursor_charge, const std::vector<double>& shifts, int site) const;
85
87 void resetFold(Size fold);
88
90 void addTraining(Size fold, const Evidence& evidence);
91
93 void finalize();
94
96 Features score(Size fold, const Outcomes& outcomes) const;
97
99 static AASequence reversedSequence(const AASequence& peptide);
100
101 private:
102 Outcomes matchHypothesis_(Size scan, const AASequence& peptide, int precursor_charge, const std::vector<double>& shifts, int site) const;
103
105 bool ppm_;
109 std::array<std::array<Model, GROUPS>, 2> models_;
110 };
111} // namespace OpenMS
Definition AASequence.h:96
Compact peak lists of the spectra of one run: per peak only its m/z and its intensity-rank bin.
Definition FragmentIonLikelihoodModel.h:92
Per-run likelihood model of fragment ion presence, intensity rank and mass error, learned from confid...
Definition FragmentIonLikelihoodModel.h:64
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
Self-trained fragment ion likelihood for protein-nucleic acid cross-links (after ProSE's ion priors).
Definition NuXLIonLikelihood.h:40
std::vector< std::uint8_t > groups
Group of each ion.
Definition NuXLIonLikelihood.h:50
double explained_presence
sum of P(present) of the matched ions / sum over all ions
Definition NuXLIonLikelihood.h:65
std::array< std::array< Model, GROUPS >, 2 > models_
Definition NuXLIonLikelihood.h:109
double llr_shifted
the part of llr from XL_SHIFTED and XL_UNLOCALIZED ions
Definition NuXLIonLikelihood.h:64
int max_fragment_charge_
Definition NuXLIonLikelihood.h:106
Features score(Size fold, const Outcomes &outcomes) const
Features of a hit scored by the models of fold.
Definition NuXLIonLikelihood.cpp:177
void finalize()
Finalize the models of both folds.
Definition NuXLIonLikelihood.cpp:169
static AASequence reversedSequence(const AASequence &peptide)
Reversed sequence of the noise hypothesis (all but the C-terminal residue)
Definition NuXLIonLikelihood.cpp:46
Evidence match(Size scan, const AASequence &peptide, int precursor_charge, const std::vector< double > &shifts, int site) const
Match the ions of a hit and of its reversed sequence.
Definition NuXLIonLikelihood.cpp:135
Model::PeakLists peaks_
Definition NuXLIonLikelihood.h:107
Outcomes matchHypothesis_(Size scan, const AASequence &peptide, int precursor_charge, const std::vector< double > &shifts, int site) const
Definition NuXLIonLikelihood.cpp:58
void addTraining(Size fold, const Evidence &evidence)
Add a confident hit to the models of fold.
Definition NuXLIonLikelihood.cpp:153
Outcomes signal
Definition NuXLIonLikelihood.h:56
Group
Definition NuXLIonLikelihood.h:44
@ XL_UNSHIFTED
Definition NuXLIonLikelihood.h:44
@ GROUPS
Definition NuXLIonLikelihood.h:44
@ XL_SHIFTED
Definition NuXLIonLikelihood.h:44
@ XL_UNLOCALIZED
Definition NuXLIonLikelihood.h:44
@ LINEAR
Definition NuXLIonLikelihood.h:44
bool ppm_
Definition NuXLIonLikelihood.h:105
void resetFold(Size fold)
Clear the models of fold.
Definition NuXLIonLikelihood.cpp:148
double tolerance_
Definition NuXLIonLikelihood.h:104
double top_predicted_observed
fraction of the 6 ions with the highest P(present) that matched
Definition NuXLIonLikelihood.h:66
Outcomes noise
empty if the reversed sequence equals the sequence
Definition NuXLIonLikelihood.h:57
TheoreticalSpectrumGenerator tsg_
Definition NuXLIonLikelihood.h:108
std::vector< Model::Ion > ions
Definition NuXLIonLikelihood.h:49
double llr
summed log-likelihood ratio of all ions
Definition NuXLIonLikelihood.h:63
void setSpectra(const PeakMap &spectra)
Compact copies of the spectra the hits refer to (by scan index)
Definition NuXLIonLikelihood.cpp:36
Matched ions of a hit and of its noise hypothesis.
Definition NuXLIonLikelihood.h:55
Features of one hit.
Definition NuXLIonLikelihood.h:62
Matched ions of one hypothesis (hit or its reversed sequence)
Definition NuXLIonLikelihood.h:48
Generates theoretical spectra for peptides with various options.
Definition TheoreticalSpectrumGenerator.h:45
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