OpenMS
Loading...
Searching...
No Matches
ProSEAlgorithm.h File Reference
#include <OpenMS/CONCEPT/ProgressLogger.h>
#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
#include <OpenMS/ANALYSIS/ID/FragmentIndex.h>
#include <OpenMS/ANALYSIS/ID/FragmentIonLikelihoodModel.h>
#include <OpenMS/ANALYSIS/ID/OpenSearchModificationAnalysis.h>
#include <OpenMS/CHEMISTRY/EnzymaticDigestion.h>
#include <OpenMS/CHEMISTRY/ModifiedPeptideGenerator.h>
#include <OpenMS/FORMAT/FASTAFile.h>
#include <OpenMS/KERNEL/MSExperiment.h>
#include <OpenMS/METADATA/PeptideIdentificationList.h>
#include <algorithm>
#include <functional>
#include <iosfwd>
#include <limits>
#include <map>
#include <memory>
#include <string>
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

class  ProSEAlgorithm
 Fragment-index-based peptide database search algorithm (experimental). More...
 
struct  ProSEAlgorithm::RunStatistics
 Per-run identification statistics for the end-of-search report. More...
 
struct  ProSEAlgorithm::SharedSearchStats
 Configuration, database and fragment-index facts shared across all input files of one ProSE invocation. More...
 
struct  ProSEAlgorithm::PercolatorRescoring
 Outcome of the Percolator rescoring of one search run (see rescoreWithPercolator() and the parameter 'rescore'). More...
 
struct  ProSEAlgorithm::PercolatorTraining
 Options of Percolator's training for the rescoring (the parameters 'rescoring:...'; the defaults are ProSE's training: all PSMs, 10 iterations) More...
 
struct  ProSEAlgorithm::SearchResult
 Comprehensive search result including modification analysis. More...
 
struct  ProSEAlgorithm::MultiFileSearchResult
 Multi-file search result bundle. More...
 
struct  ProSEAlgorithm::MergedResult
 The pooled evaluation of a multi-file search (the ProSE tool's -out_merged). More...
 
struct  ProSEAlgorithm::SearchContext
 Prepared per-database state shared across multiple spectrum files. More...
 
struct  ProSEAlgorithm::AnnotatedHit_
 Slimmer structure as storing all scored candidates in PeptideHit objects takes too much space. More...
 
struct  ProSEAlgorithm::CandidatePoolStats_
 Running summary of the complete candidate pool of one spectrum. More...
 
struct  ProSEAlgorithm::DeisotopingSettings_
 MS2 deisotoping rule of preprocessSpectra_(). More...
 
struct  ProSEAlgorithm::DecoyStrategy_
 Resolved decoy handling for one concrete input database. More...
 
struct  ProSEAlgorithm::LocalFragmentEvidence_
 Local fragment evidence of one candidate (annotate:local_fragment_evidence). More...
 
struct  ProSEAlgorithm::CoIsolatedPSM_
 The PSM of a precursor co-isolated with the selected one (chimeric:enabled), until its residual spectrum is built. More...
 
struct  ProSEAlgorithm::MzRecalibration_
 An m/z error model of a run (calibration:recalibrate), fitted to the calibration PSMs and subtracted from the spectra before the main search. More...
 
struct  ProSEAlgorithm::MzRecalibration_::Chunk
 
struct  ProSEAlgorithm::MzRecalibration_::AtRT
 
struct  ProSEAlgorithm::CalibrationResult_
 Result of a calibration pass. More...
 
struct  ProSEAlgorithm::ReuseRun_
 rescore_reuse: a run that trains models: its index in the search (the random halves depend on it) and its PSMs More...
 
struct  ProSEAlgorithm::ProteinMapping_
 The protein occurrences of the sequences of a search's hits (peptide:protein_mapping = index). More...
 
struct  ProSEAlgorithm::SpectraCounts_
 

Namespaces

namespace  OpenMS
 Main OpenMS namespace.
 

Class Documentation

◆ OpenMS::ProSEAlgorithm::RunStatistics

struct OpenMS::ProSEAlgorithm::RunStatistics

Per-run identification statistics for the end-of-search report.

Populated by collectRunStatistics_() once a single spectrum file has been searched (post-FDR), plus a few fields captured at well-defined points during search() (target/decoy counts pre-FDR, achieved q-value, timing). All counts refer to one input file. Cross-file/shared facts (database, fragment index, configuration) live in SharedSearchStats instead.

Class Members
double achieved_psm_fdr = -1.0 max retained q-value after FDR (<0 = n/a)
map< Int, Size > charge_histogram precursor charge -> PSM count
Size charge_out_of_range_spectra = 0 MS2 spectra not searched: their charge is outside precursor:min/max_charge.
Size decoy_psms = 0 decoy PSMs in the final IDs (after FDR, if applied)
bool fdr_applied = false true if PSM-level FDR filtering ran
double frag_err_mad = 0.0
double frag_err_median = 0.0
double frag_err_recommended = 0.0
bool frag_tol_valid = false true if fragment-error estimate present

The same of the annotated b and y fragment peaks (without neutral losses) of these PSMs; within the searched fragment tolerance (unmatched peaks have no error)

double hyperscore_max = 0.0
double hyperscore_median = 0.0
double hyperscore_min = 0.0
string input_file spectrum file this run searched (basename or path)
Size matched_spectra = 0 spectra with >=1 retained PSM in the final IDs (after FDR, if applied)
map< Size, Size > missed_cleavage_histogram missed cleavages -> PSM count
Size ms2_spectra = 0 number of MS2 spectra in the input
double prec_err_mad = 0.0
double prec_err_median = 0.0
double prec_err_recommended = 0.0
bool prec_tol_valid = false true if precursor-error estimate present

Mass error estimate (ppm) of the top hits of the target PSMs (at least 10): the median of the signed errors (observed minus theoretical; of the precursor corrected by the hit's isotope error, in an open search of the PSMs without a delta mass, within 0.05 Da of zero, only), their median absolute deviation from it (unscaled), and the recommended symmetric tolerance ceil(|median| + 3 * 1.4826 * MAD)

Size profile_spectra = 0 MS2 spectra recorded as profile (not centroided) spectra.
vector< pair< string, DataValue > > recalibration

calibration: the 'calibration:*' records of the search parameters (the measured errors; with calibration:recalibrate the mode, the models and the residual errors), as name without the prefix and value; empty without a calibration

bool score_stats_valid = false true if hyperscore_* below are meaningful
double seconds_calibration = 0.0 calibration pass wall time (0 if disabled)
double seconds_fdr = 0.0

FDR filtering wall time (0 if not applied)

double seconds_search = 0.0 scoring + post-processing wall time
Size target_psms = 0 target PSMs in the final IDs (after FDR, if applied)
Size unique_peptides = 0 distinct peptide sequences among top hits
Size unique_proteins = 0 distinct protein accessions among top hits

◆ OpenMS::ProSEAlgorithm::SharedSearchStats

struct OpenMS::ProSEAlgorithm::SharedSearchStats

Configuration, database and fragment-index facts shared across all input files of one ProSE invocation.

Computed once (the fragment index is built once and reused), so these costs/counts must NOT be summed per file. Populated by the multi-file searchWithModificationAnalysis() overloads.

Class Members
bool calibration_enabled = false
bool chunked = false
string database_file FASTA path (empty for in-memory db)
Size db_decoy_proteins = 0 decoy entries in the searched (augmented) db
Size db_target_proteins = 0 target entries in the searched (augmented) db
string decoy_mode "generated" | "external" | "none (target-only)"
string enzyme
vector< string > fixed_mods
double fragment_tol = 0.0
string fragment_tol_unit
Size indexed_fragments = 0 theoretical fragments in the index (summed over chunks)
Size indexed_peptides = 0 peptides in the fragment index (summed over chunks)
vector< string > ion_series
Int max_charge = 0
Int min_charge = 0
Size missed_cleavages = 0
bool open_search = false
bool peptide_mass_mode = false
double precursor_tol_lower = 0.0
string precursor_tol_unit
double precursor_tol_upper = 0.0
double protein_fdr_threshold = 0.0
double psm_fdr_threshold = 0.0
string recalibrate calibration:recalibrate ("none", or empty, when the spectra are not corrected)
double seconds_index_build = 0.0 decoy generation + fragment index build wall time
double seconds_output = 0.0 of seconds_total, the wall time after the search of the files: the outputs (set by the caller)
double seconds_qpx_extended = 0.0 of seconds_output, ProSE's -qpx_extended work: the spectra and predictions of the PSMs (set by the caller)
double seconds_total = 0.0 whole-search wall time (set by the caller)
vector< string > variable_mods

◆ OpenMS::ProSEAlgorithm::PercolatorRescoring

struct OpenMS::ProSEAlgorithm::PercolatorRescoring

Outcome of the Percolator rescoring of one search run (see rescoreWithPercolator() and the parameter 'rescore').

With 'rescore' off nothing is attempted: applied is false and skipped_reason empty.

Class Members
bool applied = false True if the PSMs were rescored.
string model

With 'rescore_reuse:mode' other than per_file: the models that scored the PSMs, as a phrase to show to the user (empty: trained on the run itself)

string skipped_reason Why the PSMs were not rescored, as a sentence to show to the user (empty if applied or not attempted)
string warning

A caveat of an applied rescoring, as a sentence to show to the user (empty if none): Percolator's sanity check replaced the learned model by the best single feature (Percolator::usedDefaultDirection())

◆ OpenMS::ProSEAlgorithm::PercolatorTraining

struct OpenMS::ProSEAlgorithm::PercolatorTraining

Options of Percolator's training for the rescoring (the parameters 'rescoring:...'; the defaults are ProSE's training: all PSMs, 10 iterations)

Class Members
bool calc_mass_feature = false Percolator trains on CalcMass ('rescoring:calc_mass_feature'; off, as the tool's default and OpenMS develop since #10717)
double curve_min_gain = 0.002 learning_curve: relative gain below which a fold stops
int curve_start = 100000 learning_curve: rows of the first sample
bool fixed_enzyme_termini = false protein termini are enzymatic sites for enzN/enzC ('rescoring:fixed_enzyme_termini'; UNSAFE: breaks FDR control with Met clipping, keep false)
int iterations = 10 iterations of the cross-validation training
bool peptide_level = true also Percolator's peptide-level q-values and PEPs (parameter 'rescoring:peptide_level', default)
bool single_cneg = false one Cneg candidate instead of three
string solver = "newton" Percolator's SVM solver (parameter 'rescore_solver', default 'newton')
int subset_max_train = 0 train on at most this many PSMs (drawn by spectrum, then all are scored; 0 = all)
string subset_mode = "out_of_fold" with a cap: Percolator's 'subset_mode' ("out_of_fold" | "out_of_fold_avg" | "in_sample" | "learning_curve")
double tron_epsilon = 1e-7 stopping tolerance of the SVM solver (TRON)
string use_pi0 = "true" pi0 estimate in the q-values and PEPs ('rescoring:use_pi0': true, false (the executable with TDC), auto)
bool warm_start = false SVM trainings start from the previous iteration's weights.

◆ OpenMS::ProSEAlgorithm::SearchResult

struct OpenMS::ProSEAlgorithm::SearchResult

Comprehensive search result including modification analysis.

This structure contains all outputs from an open search including:

  • Standard protein and peptide identifications
  • Delta mass statistics table (histogram of mass shifts)
  • PTM statistics table (mapped modifications with residue analysis)
  • Per-run identification statistics for the end-of-search report
Class Members
ExitCodes exit_code = ExitCodes::EXECUTION_OK
PeptideIdentificationList inference_only_peptide_ids

The PSMs whose q-values pass FDR:protein_inference_PSM but not FDR:PSM (targets and decoys, with the q-value as main score): the protein inference and the picked-protein FDR use them with peptide_ids, but they are not reported (see applyCompleteSetProteinFDR()). The multi-file searches fill it with FDR:protein > 0 and an FDR:PSM filter below FDR:protein_inference_PSM, and mergeFileResults() moves it out; the single-file searchWithModificationAnalysis() overloads use it for their protein FDR and return it empty.

bool is_open_search = false
OpenSearchAnalysisResult modification_analysis
PeptideIdentificationList peptide_ids
PercolatorRescoring percolator Outcome of the Percolator rescoring of this run (parameter 'rescore')
PeptideIdentificationList pre_fdr_peptide_ids

the PSMs before rescoring and FDR:PSM; only filled with setKeepPreFdrPsms(true)

vector< ProteinIdentification > protein_ids
RunStatistics stats

◆ OpenMS::ProSEAlgorithm::MultiFileSearchResult

struct OpenMS::ProSEAlgorithm::MultiFileSearchResult

Multi-file search result bundle.

Returned by the file-list searchWithModificationAnalysis() overloads. Holds one SearchResult per input file (in per_file, in input order) and a single aggregate result whose peptide_ids are the concatenation of all per-file PSMs and whose modification_analysis is computed once on the pooled set of PSMs.

Special cases for aggregate:

  • When the input list contains exactly one file, aggregate is left almost-empty (only is_open_search and exit_code are set) — the single-file pooled aggregate would just duplicate per_file[0] and re-run modification analysis on the same PSMs. Callers should use per_file[0] for the result in this case.
  • When every per-file run failed, aggregate.exit_code is set to the first non-OK per-file exit code (so callers can inspect it without walking the per_file vector).
  • When the caller passed build_pooled_aggregate = false, the pooled PSM copy is not retained: aggregate is left almost-empty (only is_open_search and exit_code), exactly as in the single-file case. In OPEN search the pooling still happens internally because the aggregate modification analysis needs it, so aggregate.modification_analysis is populated as usual and only aggregate.protein_ids / aggregate.peptide_ids are released afterwards. In closed search nothing is pooled at all.
  • With 'rescore', a file that Percolator cannot rescore on its own (e.g. fewer than 100 PSMs) gets the scores of a model trained on the files it rescored on their own, or if there are none, all files are rescored together (see rescoreFilesTogether_()). Only if that fails, the runs report different search engines (Percolator / ProSE): the pooled copies of the runs then all get ProSE's engine, so that IDMergerAlgorithm merges them (see mergeFileResults() for the scores); the runs of per_file stay as they are.

The aggregate's protein_ids template is taken from the first successful per-file result (search parameters are identical across files by construction), with the primary MS run path overwritten to list every input file. Its PSMs carry the meta value 'id_merge_index', the input position of their file (see poolSearchedFiles_()).

Class Members
SearchResult aggregate
bool decoy_is_prefix = true Position of decoy_string (true = prefix, false = suffix).
string decoy_string

Effective decoy marker resolved from the shared database, for a caller-side merged-PSM protein-FDR step (e.g. the ProSE TOPP tool's -out_merged path). Empty when the search was target-only (decoys=ignore).

bool have_decoys = false True when the searched databases contained decoys (FDR possible).
vector< SearchResult > per_file
SharedSearchStats shared

Configuration / database / fragment-index facts shared across all input files (the index is built once and reused), for the end-of-search report.

◆ OpenMS::ProSEAlgorithm::MergedResult

struct OpenMS::ProSEAlgorithm::MergedResult

The pooled evaluation of a multi-file search (the ProSE tool's -out_merged).

Class Members
vector< unordered_map< string, double > > file_peptide_q_values

With rescoring: per input (index as 'id_merge_index') and peptide (unmodified sequence), the input's own 'peptide q-value', which splitMergedPsms() gives the PSMs back (the pooled PSMs have the one across the inputs)

PeptideIdentificationList peptide_ids PSMs of all files; meta value 'id_merge_index' = input position of the file.
bool protein_fdr_applied = false picked-protein FDR applied and its filter at FDR:protein (and, with remove_decoys, the decoys removed)
vector< ProteinIdentification > protein_ids

one pooled run; empty if no file succeeded

◆ OpenMS::ProSEAlgorithm::SearchContext

struct OpenMS::ProSEAlgorithm::SearchContext

Prepared per-database state shared across multiple spectrum files.

Holds the (decoy-augmented) protein database and the built FragmentIndex so that searching N spectrum files against the same FASTA pays the index build cost only once. Construct via prepareContext() and pass to the context-taking search() overload.

Class Members
vector< FASTAEntry > db
bool decoy_is_prefix = true Position of decoy_string (true = prefix, false = suffix).
string decoy_string

Effective decoy marker carried by db (auto-detected for external decoys, or the configured prefix for internally generated ones). Empty when the search is target-only. Feeds PeptideIndexing and the protein-level FDR so they recognise the same decoys that were searched.

bool electron_ions = false

True when fragment_index also holds c and z+1 ions for electron-activated spectra (ions:by_activation); only those spectra are matched against them. See prepareContext(). search() does not add them to a context: for such spectra and a context without these ions, it builds a temporary index for the call.

FragmentIndex fragment_index
bool have_decoys = false

True when db contains decoy entries (generated or external), i.e. target-decoy FDR is possible.

bool release_fragment_index_after_scoring = false

When true, the context-taking search() overload will release fragment_index (via clear()) after scoreSpectraAgainstIndex_ returns, reclaiming its heap footprint before the PeptideIndexing Aho-Corasick pass — which is otherwise the RSS high-water mark on large databases. Set by single-use callers (e.g. the internal search(spectra, fasta_db, ...) wrapper that creates a throw-away ctx). Default false preserves the reuse contract for callers that built ctx via prepareContext() and want to run multiple search() calls against it.

◆ OpenMS::ProSEAlgorithm::DeisotopingSettings_

struct OpenMS::ProSEAlgorithm::DeisotopingSettings_

MS2 deisotoping rule of preprocessSpectra_().

Filled from the parameters fragment:deisotope_* by updateMembers_(), whose defaults are the Sage-like rule (min_peaks = 2, charge_cap_precursor: charges up to the precursor charge, at most 3, and sum_intensity). The member defaults are the behaviour before these parameters existed (envelopes of at least three peaks, charges 1-3 in every spectrum, the monoisotopic peak keeps its own intensity); the preprocessSpectra_() overload without settings uses them.

Class Members
bool charge_cap_precursor {false} fragment:deisotope_charge_cap = precursor
unsigned int min_peaks {3} fragment:deisotope_min_peaks
bool sum_intensity {false} fragment:deisotope_sum_intensity

◆ OpenMS::ProSEAlgorithm::DecoyStrategy_

struct OpenMS::ProSEAlgorithm::DecoyStrategy_

Resolved decoy handling for one concrete input database.

Produced by resolveDecoyStrategy_() and consumed by buildDecoyAugmentedDB_() and the downstream PeptideIndexing / FDR steps, so the same decoys that are searched are also the ones scored.

Class Members
string decoy_string effective marker for PeptideIndexing + protein FDR
bool generate {false} reverse target proteins to synthesise decoys
bool have_decoys {false} searched DB will contain decoys (FDR possible)
bool is_prefix {true} position of decoy_string
bool strip_existing {false} drop pre-existing decoy entries before searching
bool strip_is_prefix {true} position of strip_string
string strip_string marker of pre-existing decoys to strip

◆ OpenMS::ProSEAlgorithm::LocalFragmentEvidence_

struct OpenMS::ProSEAlgorithm::LocalFragmentEvidence_

Local fragment evidence of one candidate (annotate:local_fragment_evidence).

Class Members
double chance_match_surprise = 0.0
double mass_competition_evidence = 0.0

◆ OpenMS::ProSEAlgorithm::CoIsolatedPSM_

struct OpenMS::ProSEAlgorithm::CoIsolatedPSM_

The PSM of a precursor co-isolated with the selected one (chimeric:enabled), until its residual spectrum is built.

Class Members
Size parent = 0 index of its spectrum in the searched spectra
Precursor precursor the co-isolated precursor: that of the spectrum with its m/z and charge
vector< UInt32 > removed the peaks of the spectrum that its residual spectrum leaves out (ascending)

◆ OpenMS::ProSEAlgorithm::MzRecalibration_::Chunk

struct OpenMS::ProSEAlgorithm::MzRecalibration_::Chunk
Class Members
double intercept
Size points
double rt
double slope

◆ OpenMS::ProSEAlgorithm::ReuseRun_

struct OpenMS::ProSEAlgorithm::ReuseRun_

rescore_reuse: a run that trains models: its index in the search (the random halves depend on it) and its PSMs

Class Members
Size file_index
PeptideIdentificationList * peptide_ids
const vector< ProteinIdentification > * protein_ids

◆ OpenMS::ProSEAlgorithm::SpectraCounts_

struct OpenMS::ProSEAlgorithm::SpectraCounts_

The MS2 spectra of a spectrum file, those recorded as profile spectra and those that are not searched because their precursor charge lies outside of precursor:min_charge..max_charge (FragmentIndex::precursorCharges())

Class Members
Size charge_out_of_range = 0
Size ms2 = 0
Size profile = 0