OpenMS
Loading...
Searching...
No Matches
Percolator.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 <memory>
17#include <vector>
18
19namespace OpenMS
20{
76 class OPENMS_DLLAPI Percolator : public DefaultParamHandler
77 {
78 public:
80 ~Percolator() override;
81
82 Percolator(const Percolator&) = delete;
83 Percolator& operator=(const Percolator&) = delete;
84
103 void rescore(std::vector<PeptideIdentification>& peptide_ids,
104 const StringList& feature_names = {});
105
135
179 const StringList& feature_set,
180 const std::string& enzyme,
181 int min_charge,
182 int max_charge,
183 const std::string& score_type = "q-value");
184
195 const StringList& feature_set,
196 const std::string& enzyme,
197 int min_charge,
198 int max_charge);
199
215 const PercolatorModel& model,
216 PeptideIdentificationList& reference_ids,
217 const StringList& feature_set,
218 const std::string& enzyme,
219 int min_charge,
220 int max_charge,
221 const std::string& score_type = "q-value");
222
242 const std::vector<std::vector<double>>& getSvmWeights() const;
243
260 double getPi0() const;
261
277
297
345 RescoreOutput score(const RescoreInput& input, const PercolatorModel& model);
346
366 RescoreOutput score(const RescoreInput& input, const PercolatorModel& model, const RescoreInput& reference);
367
407 const std::vector<PeptideIdentification>& peptide_ids,
408 bool flatten_hits,
409 RescoreInput& input);
410
430 static void saveModel(const PercolatorModel& model, const std::string& filename);
431
445 static PercolatorModel loadModel(const std::string& filename);
446
447 protected:
448 void updateMembers_() override;
449
450 private:
452 struct ReferenceScale_;
455 RescoreOutput score_(const RescoreInput& input, const PercolatorModel& model, ReferenceScale_* scale);
456
457 struct Impl;
458 std::unique_ptr<Impl> impl_;
459 };
460}
A base class for all classes handling default parameters.
Definition DefaultParamHandler.h:66
Container for peptide identifications from multiple spectra.
Definition PeptideIdentificationList.h:66
In-process Percolator: semi-supervised target/decoy rescoring with q-values + PEPs.
Definition Percolator.h:77
bool usedDefaultDirection() const
Whether the last rescore()/train() call replaced the learned model by the default direction.
static PercolatorModel loadModel(const std::string &filename)
Deserialize a PercolatorModel written by saveModel().
RescoreOutput score_(const RescoreInput &input, const PercolatorModel &model, ReferenceScale_ *scale)
Size rescorePSMs(PeptideIdentificationList &peptide_ids, const StringList &feature_set, const std::string &enzyme, int min_charge, int max_charge, const std::string &score_type="q-value")
Rescore search engine PSMs in place on the standard Percolator (.pin) feature set.
RescoreOutput score(const RescoreInput &input, const PercolatorModel &model, const RescoreInput &reference)
Score feature rows with a pre-trained model on the scale of a reference set (e.g. its training set).
~Percolator() override
Percolator & operator=(const Percolator &)=delete
PercolatorModel train(const RescoreInput &input)
Train a Percolator model on feature rows. No scoring.
Size scorePSMs(PeptideIdentificationList &peptide_ids, const PercolatorModel &model, PeptideIdentificationList &reference_ids, const StringList &feature_set, const std::string &enzyme, int min_charge, int max_charge, const std::string &score_type="q-value")
Rescore PSMs with a model trained on other PSMs (trainPSMs()), on the scale of those (reference_ids,...
static void fillPINCompatibleFields(const std::vector< PeptideIdentification > &peptide_ids, bool flatten_hits, RescoreInput &input)
Fill PIN-compatible optional fields on a RescoreInput.
std::unique_ptr< Impl > impl_
Definition Percolator.h:458
double getPi0() const
Pi0 (null fraction) from the last rescore()/score() call.
RescoreOutput score(const RescoreInput &input, const PercolatorModel &model)
Score feature rows using a pre-trained model. No training.
const std::vector< std::vector< double > > & getSvmWeights() const
SVM weights trained in the last rescore()/train() call.
PercolatorModel trainPSMs(PeptideIdentificationList &peptide_ids, const StringList &feature_set, const std::string &enzyme, int min_charge, int max_charge)
Train a model on search engine PSMs (the .pin features of rescorePSMs()), for scorePSMs() on other PS...
RescoreOutput rescore(const RescoreInput &input)
Rescore a feature matrix domain-agnostically.
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
static void saveModel(const PercolatorModel &model, const std::string &filename)
Serialize a PercolatorModel to a plain-text file.
Percolator(const Percolator &)=delete
void rescore(std::vector< PeptideIdentification > &peptide_ids, const StringList &feature_names={})
Rescore PSMs in place. Domain-specific convenience wrapper over rescore(RescoreInput).
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< std::string > StringList
Vector of String.
Definition TypeAliases.h:39
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Trained Percolator model: averaged SVM weights in raw feature space.
Definition PercolatorTypes.h:93
Input to domain-agnostic Percolator::rescore.
Definition PercolatorTypes.h:27
Output from Percolator::rescore. Aligned 1:1 with RescoreInput::features.
Definition PercolatorTypes.h:70