OpenMS
Loading...
Searching...
No Matches
NuXLRescoring.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
13
14#include <algorithm>
15#include <array>
16#include <limits>
17#include <string_view>
18#include <vector>
19
20namespace OpenMS
21{
24 {
31 struct ScoreGap
32 {
33 float best = -std::numeric_limits<float>::infinity();
34 float second = -std::numeric_limits<float>::infinity();
35 std::string_view best_sequence;
36
37 void add(float score, std::string_view sequence)
38 {
39 if (sequence == best_sequence) { best = std::max(best, score); return; }
40 if (score > best)
41 {
42 second = best; // the old best has another sequence and is at least as good as every other hit seen so far
43 best = score;
44 best_sequence = sequence;
45 return;
46 }
47 second = std::max(second, score);
48 }
49
51 float bestOtherThan(std::string_view sequence) const { return sequence == best_sequence ? second : best; }
52 };
53
55 static constexpr double TRAIN_FDR = 0.05;
56
69 static std::array<std::vector<Size>, 2> confidentHitsPerHalf(const PeptideIdentificationList& peptide_ids, double fdr,
70 std::array<std::array<Size, 2>, 2>& counts);
71
73 static constexpr double DELTA_WEIGHT = 1.0;
74 static constexpr double ION_LLR_WEIGHT = 0.3;
75
83 static void rescoreHits(PeptideIdentificationList& peptide_ids);
84 };
85} // namespace OpenMS
Container for peptide identifications from multiple spectra.
Definition PeptideIdentificationList.h:66
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Best score of the hits of a spectrum and the best score of a different (unmodified) peptide sequence.
Definition NuXLRescoring.h:32
float best
Definition NuXLRescoring.h:33
void add(float score, std::string_view sequence)
Definition NuXLRescoring.h:37
float bestOtherThan(std::string_view sequence) const
best score of a sequence other than sequence (-inf if there is none)
Definition NuXLRescoring.h:51
std::string_view best_sequence
Definition NuXLRescoring.h:35
float second
best score of a sequence other than best_sequence
Definition NuXLRescoring.h:34
Helpers of NuXL:rescoring: the delta score, the training hits of the self-trained ion likelihood,...
Definition NuXLRescoring.h:24
static constexpr double ION_LLR_WEIGHT
Definition NuXLRescoring.h:74
static constexpr double DELTA_WEIGHT
Weights of the native score (PXD048145, RNA-UV): see rescoreHits()
Definition NuXLRescoring.h:73
static constexpr double TRAIN_FDR
FDR threshold of the training hits of the self-trained ion likelihood.
Definition NuXLRescoring.h:55
static void rescoreHits(PeptideIdentificationList &peptide_ids)
NuXL:rescoring native: score = NuXL:score + DELTA_WEIGHT * NuXL:delta_score (cross-links only)
Definition NuXLRescoring.cpp:61
static std::array< std::vector< Size >, 2 > confidentHitsPerHalf(const PeptideIdentificationList &peptide_ids, double fdr, std::array< std::array< Size, 2 >, 2 > &counts)
Training hits of self-trained models.
Definition NuXLRescoring.cpp:15