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
204 const std::vector<std::vector<double>>& getSvmWeights() const;
205
222 double getPi0() const;
223
239
259
304 RescoreOutput score(const RescoreInput& input, const PercolatorModel& model);
305
345 const std::vector<PeptideIdentification>& peptide_ids,
346 bool flatten_hits,
347 RescoreInput& input);
348
368 static void saveModel(const PercolatorModel& model, const std::string& filename);
369
383 static PercolatorModel loadModel(const std::string& filename);
384
385 protected:
386 void updateMembers_() override;
387
388 private:
389 struct Impl;
390 std::unique_ptr<Impl> impl_;
391 };
392}
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().
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.
~Percolator() override
Percolator & operator=(const Percolator &)=delete
PercolatorModel train(const RescoreInput &input)
Train a Percolator model on feature rows. No scoring.
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:390
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.
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