OpenMS
Loading...
Searching...
No Matches
ProSEAlgorithm Class Reference

Fragment-index-based peptide database search algorithm (experimental). More...

#include <OpenMS/ANALYSIS/ID/ProSEAlgorithm.h>

Inheritance diagram for ProSEAlgorithm:
DefaultParamHandler ProgressLogger

Classes

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

Public Types

enum class  ExitCodes {
  EXECUTION_OK , INPUT_FILE_EMPTY , UNEXPECTED_RESULT , UNKNOWN_ERROR ,
  ILLEGAL_PARAMETERS
}
 Exit codes. More...
 
using FileResultConsumer = std::function< void(Size, const SearchResult &)>
 The consumer of the files' results (setFileResultConsumer()): file index, result. Must only read the result.
 
- Public Types inherited from ProgressLogger
enum  LogType { CMD , GUI , NONE }
 Possible log types. More...
 

Public Member Functions

 ProSEAlgorithm ()
 
ExitCodes search (const std::string &in_spectra, const std::string &in_db, std::vector< ProteinIdentification > &prot_ids, PeptideIdentificationList &pep_ids) const
 Search spectra in a spectrum file (mzML or Bruker .d) against a protein database using an FI-backed workflow.
 
void annotatePsmQValues (PeptideIdentificationList &peptide_ids) const
 Annotate PSM q-values by target-decoy competition of the best hit of each spectrum, as FDR:PSM does.
 
bool applyDeferredPsmFDR (const std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids, bool rescored, double psm_fdr, PeptideIdentificationList *inference_only_psms=nullptr) const
 Apply the PSM-level FDR to PSMs that were rescored separately, e.g. with rescoreWithPercolator() on the result of a search with 'rescore' and the FDR filters off.
 
SearchResult searchWithModificationAnalysis (const std::string &in_spectra, const std::string &in_db, const std::string &output_base_name="") const
 Search with comprehensive results including modification analysis tables.
 
ExitCodes search (PeakMap &spectra, const std::vector< FASTAFile::FASTAEntry > &fasta_db, std::vector< ProteinIdentification > &prot_ids, PeptideIdentificationList &pep_ids) const
 In-memory search: search spectra against a protein database without file I/O.
 
SearchContext prepareContext (const std::vector< FASTAFile::FASTAEntry > &fasta_db) const
 Build a SearchContext (decoy-augmented database + FragmentIndex) for reuse.
 
SearchContext prepareContext (const std::vector< FASTAFile::FASTAEntry > &fasta_db, bool electron_ions) const
 Build a SearchContext whose FragmentIndex also holds c and z+1 ions.
 
ExitCodes search (PeakMap &spectra, SearchContext &ctx, std::vector< ProteinIdentification > &prot_ids, PeptideIdentificationList &pep_ids) const
 In-memory search using a pre-built SearchContext.
 
SearchResult searchWithModificationAnalysis (PeakMap &spectra, const std::vector< FASTAFile::FASTAEntry > &fasta_db, const std::string &output_base_name="") const
 In-memory search with modification analysis: no file I/O required.
 
MultiFileSearchResult searchWithModificationAnalysis (const std::vector< std::string > &in_spectra_files, const std::vector< FASTAFile::FASTAEntry > &fasta_db, const std::vector< std::string > &output_base_names={}, const std::string &aggregate_base_name="", bool build_pooled_aggregate=true) const
 Multi-file search with modification analysis (in-memory FASTA).
 
MultiFileSearchResult searchWithModificationAnalysis (const std::vector< std::string > &in_spectra_files, const std::string &in_db, const std::vector< std::string > &output_base_names={}, const std::string &aggregate_base_name="", bool build_pooled_aggregate=true) const
 Multi-file search with modification analysis (FASTA file path).
 
MergedResult mergeFileResults (MultiFileSearchResult &result, const StringList &in_spectra_files, bool remove_decoys=true) const
 Pools result (moving its PSMs out), infers proteins across files, applies FDR:protein of this instance with picked-protein FDR if decoy proteins were identified and then, by default, removes the decoys.
 
void setParameterNamePrefix (const std::string &prefix)
 
void setKeepPreFdrPsms (bool keep)
 
void setFileResultConsumer (FileResultConsumer consumer)
 Lets the multi-file searchWithModificationAnalysis() overloads hand each file's result to consumer as soon as it is final, e.g. to write it while the next file is searched.
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const std::string &name)
 Constructor with name that is displayed in error messages.
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor.
 
virtual ~DefaultParamHandler ()
 Destructor.
 
DefaultParamHandler & operator= (const DefaultParamHandler &rhs)
 Assignment operator.
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator.
 
void setParameters (const Param &param)
 Sets the parameters.
 
const Param & getParameters () const
 Non-mutable access to the parameters.
 
const Param & getDefaults () const
 Non-mutable access to the default parameters.
 
const std::string & getName () const
 Non-mutable access to the name.
 
void setName (const std::string &name)
 Mutable access to the name.
 
const std::vector< std::string > & getSubsections () const
 Non-mutable access to the registered subsections.
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor.
 
virtual ~ProgressLogger ()
 Destructor.
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor.
 
ProgressLogger & operator= (const ProgressLogger &other)
 Assignment Operator.
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE!
 
LogType getLogType () const
 Returns the type of progress log being used.
 
void setLogger (ProgressLoggerImpl *logger)
 Sets the logger to be used for progress logging.
 
void startProgress (SignedSize begin, SignedSize end, const std::string &label) const
 Initializes the progress display.
 
void setProgress (SignedSize value) const
 Sets the current progress.
 
void endProgress (UInt64 bytes_processed=0) const
 
void nextProgress () const
 increment progress by 1 (according to range begin-end)
 

Static Public Member Functions

static void stratumQValues (PeptideIdentificationList &peptide_ids)
 rescoring:stratum_q_values: grouped target-decoy competition on the best hit of every spectrum that has the meta value percolator_score; stratum 'protein_nterm' (an evidence at a protein N-terminus, or only Met-clipped evidences: aa_before M at start 1) or 'other'; q = (decoys + 1) / max(targets, 1) in percolator_score order (ties: decoys first), monotone. Sets the meta values 'stratum' and 'stratum_q_value'; a best hit without percolator_score gets only 'stratum_q_value' = 1.
 
static bool reuseTrainingDraw (UInt64 seed, Size file, Size spectrum, double fraction)
 rescore_reuse: whether spectrum spectrum (its index in the run) of file file is drawn for the training of the models at the sampling fraction fraction (rescore_reuse:max_train)
 
static bool reuseCalibrationDraw (UInt64 seed, Size file, Size spectrum, double fraction)
 
static bool applyCompleteSetProteinFDR (std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids, const std::string &decoy_string, bool decoy_is_prefix, double protein_fdr, bool remove_decoys, const PeptideIdentificationList &inference_only_psms)
 Finalize protein-level FDR on a COMPLETE protein set (a single input file, or a merged cross-file aggregate).
 
static std::string inferProteins (std::vector< ProteinIdentification > &protein_ids, const PeptideIdentificationList &peptide_ids, const PeptideIdentificationList &inference_only_psms=PeptideIdentificationList())
 The protein inference of the protein FDR (applyCompleteSetProteinFDR()) and of mergeFileResults().
 
static void removeUnreportedProteins (std::vector< ProteinIdentification > &protein_ids, const PeptideIdentificationList &peptide_ids, const PeptideIdentificationList &also_referencing=PeptideIdentificationList())
 Removes the proteins that no PSM references, and them from the protein groups.
 
static Size removeDuplicateProteins (std::vector< FASTAFile::FASTAEntry > &db, const std::string &source)
 Removes the repeated entries of a protein database, which searching would report twice (e.g. a FASTA file concatenated twice, or contaminants added twice).
 
static PercolatorRescoring rescoreWithPercolator (std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids, int threads, Size max_train_psms=0)
 Rescore the PSMs of one search run in-process with Percolator, as the parameter 'rescore' does in every search.
 
static std::string pinEnzymeName (const std::string &enzyme)
 The name of enzyme as PercolatorInfile computes the enzN/enzC/enzInt features of a .pin.
 
static std::string pinFeatureEnzyme (const std::string &enzyme, bool fixed_enzyme_termini)
 The enzyme argument of PercolatorInfile (store(), the in-process rescoring) for the enzN/enzC/enzInt features of the search's enzyme: its Percolator name (pinEnzymeName(); a ProteaseDB enzyme without one keeps its name, so that PercolatorInfile uses its cleavage rule) with "+termini" (fixed_enzyme_termini: protein termini and the position after an initial Met are cleavage sites) or "+keep_termini" (the features of ProSE int15, the default).
 
static PeakMap loadSpectra (const std::string &filename, const std::function< bool(const MSSpectrum &)> &keep={})
 The MS2 spectra of a spectrum file as the searches of this class read them.
 
static void splitMergedPsms (MergedResult &merged, MultiFileSearchResult &result)
 Makes the PSMs of each file of a multi-file search its part of the pooled result (mergeFileResults()), so that per-file outputs agree with the pooled one.
 
static void updateFinalStats (RunStatistics &stats, const PeptideIdentificationList &peptide_ids, const std::string &enzyme, bool fdr_applied)
 
static void releaseInParallel (SearchResult &result)
 
static std::string renderTotalTime (const SharedSearchStats &sh)
 The total time of a run, by part: "total <s>s | search of the file(s) <s>s | outputs <s>s (of which -qpx_extended <s>s)", from sh's seconds_total, seconds_output and seconds_qpx_extended (the last part only if positive). The end of the report of renderRunSummary(), and of ProSE's report of several files.
 
static void renderRunSummary (const RunStatistics &stats, const SharedSearchStats &shared, const OpenSearchModificationAnalysis::OpenSearchAnalysisResult &mod_analysis, bool is_open_search, std::ostream &os)
 
static void renderModificationSummary (const OpenSearchModificationAnalysis::OpenSearchAnalysisResult &mod_analysis, std::ostream &os)
 
static std::string renderRunSummaryYaml (const MultiFileSearchResult &mfres, const std::vector< std::pair< std::string, std::vector< std::string > > > &manifest, Size files_failed, Size files_total)
 
- Static Public Member Functions inherited from DefaultParamHandler
static void writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const std::string &key_prefix="")
 Writes all parameters to meta values.
 

Static Public Attributes

static constexpr const char * CHIMERIC_RANK = "chimeric_rank"
 
static constexpr double MIN_DECOYS_PER_TARGET = 0.5
 
static constexpr double MAX_DECOYS_PER_TARGET = 2.0
 See MIN_DECOYS_PER_TARGET.
 

Protected Types

enum class  DecoyMode_ { AUTO , GENERATE , IGNORE }
 How decoys are obtained/recognised for a search (parameter "decoys"). More...
 

Protected Member Functions

void updateMembers_ () override
 This method is used to update extra member variables at the end of the setParameters() method.
 
void annotateIonPriors_ (const PeakMap &spectra, const FragmentIonLikelihoodModel::PeakLists &evidence, std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids) const
 Learn per-run fragment ion likelihoods from confident PSMs and annotate every hit with them.
 
DecoyStrategy_ resolveDecoyStrategy_ (const std::vector< FASTAFile::FASTAEntry > &db) const
 Decide how to obtain/recognise decoys for db.
 
Param fragmentIndexParameters_ (bool electron_ions=false) const
 ProSE parameters made safe to hand to a FragmentIndex.
 
SpectrumGenerators_ spectrumGenerators_ () const
 Generators for scoring, annotation and calibration, configured from the ions:* parameters.
 
Size countElectronActivated_ (const PeakMap &spectra) const
 Number of spectra that ions:by_activation also scores with c and z+1 ions (0 if it is off)
 
std::vector< FASTAFile::FASTAEntry > buildDecoyAugmentedDB_ (const std::vector< FASTAFile::FASTAEntry > &fasta_db, const DecoyStrategy_ &strategy) const
 Build the searched database according to strategy.
 
std::vector< FASTAFile::FASTAEntry > buildDecoyAugmentedDB_ (std::vector< FASTAFile::FASTAEntry > &&fasta_db, const DecoyStrategy_ &strategy) const
 As above, but takes the entries of fasta_db over instead of copying them.
 
MultiFileSearchResult searchWithModificationAnalysis_ (const std::vector< std::string > &in_spectra_files, const std::vector< FASTAFile::FASTAEntry > &fasta_db_given, const std::string *in_db, const std::vector< std::string > &output_base_names, const std::string &aggregate_base_name, bool build_pooled_aggregate) const
 
void reportDecoyParity_ (const SearchContext &ctx) const
 
SearchContext prepareContext_ (std::vector< FASTAFile::FASTAEntry > &&fasta_db, bool electron_ions, const std::function< const PeakMap *(Size)> &searched_spectra={}) const
 
bool restrictIndexToSpectra_ () const
 
void buildFragmentIndex_ (SearchContext &ctx, const Param &params, const std::function< const PeakMap *(Size)> &searched_spectra) const
 
bool chimericSearch_ () const
 
void searchCoIsolated_ (const PeakMap &spectra, const std::vector< std::vector< AnnotatedHit_ > > &annotated_hits, FragmentIndex &fi, const std::vector< FASTAFile::FASTAEntry > &db, const SpectrumGenerators_ &generators, double fragment_tol, bool fragment_tol_ppm, bool open_search_mode, std::vector< CoIsolatedPSM_ > &psms, std::vector< std::vector< AnnotatedHit_ > > &hits, std::vector< CandidatePoolStats_ > &pool_stats) const
 Search the precursors co-isolated with the selected one in what the spectrum's other PSMs leave of it (chimeric:enabled), after the andes chimeric cascade.
 
std::vector< FASTAFile::FASTAEntry > buildCalibrationSample_ (const std::vector< FASTAFile::FASTAEntry > &full_db) const
 Build a strided protein sample for chunked calibration.
 
ExitCodes searchChunked_ (PeakMap &spectra, std::vector< FASTAFile::FASTAEntry > &full_db, const DecoyStrategy_ &strategy, std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids) const
 Chunked database search implementation.
 
void scoreSpectraAgainstIndex_ (const PeakMap &spectra, FragmentIndex &fi, const std::vector< FASTAFile::FASTAEntry > &db, const SpectrumGenerators_ &generators, double effective_fragment_tol, bool fragment_mass_tolerance_unit_ppm, bool open_search_mode, std::vector< std::vector< AnnotatedHit_ > > &annotated_hits, std::vector< CandidatePoolStats_ > &pool_stats, const std::string &progress_label, const PeakMap *query_spectra=nullptr) const
 Score all spectra against one FragmentIndex.
 
void postProcessHits_ (const PeakMap &exp, std::vector< std::vector< ProSEAlgorithm::AnnotatedHit_ > > &annotated_hits, const std::vector< CandidatePoolStats_ > &pool_stats, std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids, Size top_hits, const StringList &modifications_fixed, const StringList &modifications_variable, Int peptide_missed_cleavages, double precursor_mass_tolerance, double fragment_mass_tolerance, const std::string &precursor_mass_tolerance_unit_ppm, const std::string &fragment_mass_tolerance_unit_ppm, const Int precursor_min_charge, const Int precursor_max_charge, const std::string &enzyme, const std::string &database_name, const PeakMap *evidence_spectra=nullptr, const std::vector< Size > *evidence_parent=nullptr, bool defer_peak_annotations=false, const MzRecalibration_ *fragment_recalibration=nullptr) const
 Filter and annotate search results.
 
void annotateFragmentPeaks_ (const PeakMap &exp, PeptideIdentificationList &peptide_ids, double fragment_mass_tolerance, const std::string &fragment_mass_tolerance_unit_ppm, const MzRecalibration_ *fragment_recalibration=nullptr) const
 The fragment annotations that postProcessHits_() leaves out with defer_peak_annotations, for the hits of peptide_ids (by their "scan_index" in exp), computed as postProcessHits_() computes them (with fragment_recalibration, of the m/z as observed).
 
void annotatePeptDeepFeatures_ (const PeakMap &spectra, std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids) const
 Adds PeptDeep-prediction-derived rescoring features to the PSMs.
 
int scoringMaxCharge_ (int precursor_charge) const
 Fragment charges that score a candidate of the given precursor charge; also used by the calibration pass.
 
Size rescoreTopHits_ () const
 The hits per spectrum that Percolator rescores: rescoring:top_hits, or report:top_hits if that is 0.
 
Size searchTopHits_ () const
 
std::string paramName_ (const std::string &name) const
 Helper: name as the user sets the parameter (setParameterNamePrefix()), for messages.
 
bool keepPreRescoringPsms_ () const
 Whether a search keeps the PSMs of each file before the rescoring (SearchResult::pre_fdr_peptide_ids)
 
Size transferQuota_ () const
 
std::shared_ptr< const ReuseModel_ > trainReuseModel_ (const std::vector< ReuseRun_ > &runs, int threads) const
 
PercolatorRescoring rescoreWithReuseModel_ (std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids, Size file_index, const ReuseModel_ &model, bool check_shift, int threads, std::vector< std::vector< PeptideHit > > *dropped) const
 
void applyRescoredPsmFDR_ (std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids, bool has_decoys, RunStatistics &stats, bool rescored, PeptideIdentificationList *inference_only_psms) const
 
void finishDeferredRescoring_ (MultiFileSearchResult &mfres, const std::vector< Size > &deferred) const
 
double computeModMatchTolerance_ () const
 
CalibrationResult_ runCalibrationPass_ (PeakMap &spectra, FragmentIndex &fragment_index, const std::vector< FASTAFile::FASTAEntry > &db, const PeakMap *query_spectra=nullptr) const
 Run a fast calibration pass on a subset of spectra to estimate mass accuracy.
 
void applyRecalibration_ (const CalibrationResult_ &cal, PeakMap &spectra, PeakMap *query_spectra, PeakMap *evidence_spectra) const
 calibration:recalibrate: subtract the error models of cal from the MS2 spectra, in place.
 
void recordRecalibration_ (const CalibrationResult_ &cal, std::vector< ProteinIdentification > &protein_ids) const
 
PercolatorRescoring applyPsmFDR_ (std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids, bool has_decoys, RunStatistics &stats, PeptideIdentificationList *pre_fdr_psms=nullptr, PeptideIdentificationList *inference_only_psms=nullptr) const
 
void rescoreFilesTogether_ (MultiFileSearchResult &mfres, const std::vector< std::string > &in_spectra_files) const
 The end of a multi-file search with 'rescore' (with pool_rescoring_), for the files with PSMs that Percolator could not rescore on their own (e.g. fewer than 100 PSMs, or no decoy PSM).
 
void collectInferenceOnlyPsms_ (const PeptideIdentificationList &peptide_ids, double psm_fdr, PeptideIdentificationList &inference_only_psms) const
 
void collectRunStatistics_ (const PeakMap &spectra, const std::vector< ProteinIdentification > &protein_ids, const PeptideIdentificationList &peptide_ids, RunStatistics &stats) const
 
SpectraCounts_ countSpectra_ (const PeakMap &spectra) const
 Helper: the SpectraCounts_ of spectra.
 
void preprocessSearchedSpectra_ (PeakMap &spectra, const std::string &input, FragmentIonLikelihoodModel::PeakLists &ion_evidence, PeakMap *evidence_spectra, PeakMap *query_spectra) const
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor.
 

Static Protected Member Functions

static void preprocessSpectra_ (PeakMap &exp, double fragment_mass_tolerance, bool fragment_mass_tolerance_unit_ppm, bool deisotope_requested, Size peaks_keep_n, Int peaks_window_top, const std::string &window_type, const DeisotopingSettings_ &deisotoping, FragmentIonLikelihoodModel::PeakLists *ion_evidence=nullptr, bool ion_evidence_scored_peaks=false, PeakMap *evidence_spectra=nullptr, PeakMap *query_spectra=nullptr)
 filter, deisotope, decharge spectra
 
static void preprocessSpectra_ (PeakMap &exp, double fragment_mass_tolerance, bool fragment_mass_tolerance_unit_ppm, bool deisotope_requested, Size peaks_keep_n, Int peaks_window_top, const std::string &window_type="auto")
 preprocessSpectra_() with the DeisotopingSettings_ defaults (the behaviour before its parameters existed)
 
static AASequence reversedNoiseSequence_ (const AASequence &sequence)
 Reversed sequence keeping the C-terminal residue and every residue's modification: the noise hypothesis of a confident PSM.
 
static void filterLocalPeaks_ (MSSpectrum &spectrum, Size peaks_per_window)
 Keep the strongest peaks in each non-overlapping 100 Da window, including a short final window.
 
static std::vector< double > localPeakDensities_ (const MSSpectrum &spectrum)
 Peak counts per Da in a fixed +/-50 m/z window around each peak of a sorted spectrum.
 
static LocalFragmentEvidence_ localFragmentEvidence_ (const MSSpectrum &spectrum, const MSSpectrum &theoretical, const std::vector< double > &densities, double tolerance, bool ppm)
 Compute local fragment-match evidence on the spectrum before window/top-N peak filtering.
 
static LocalFragmentEvidence_ localFragmentEvidence_ (const MSSpectrum &spectrum, const MSSpectrum &theoretical, int max_charge, const std::vector< double > &densities, double tolerance, bool ppm, std::vector< double > &alternatives)
 
static LocalFragmentEvidence_ localFragmentEvidence_ (const MSSpectrum &spectrum, const MSSpectrum &theoretical, const std::vector< Int > &charges, int max_charge, const std::vector< double > &densities, double tolerance, bool ppm, std::vector< double > &alternatives)
 localFragmentEvidence_() with the charges of the peaks of theoretical given (charges, one per peak)
 
static bool isElectronActivated_ (const MSSpectrum &spectrum)
 True if the precursor of spectrum was activated by electrons (ETD, ECD, EThcD or ETciD)
 
static double calibrationPassWindow_ (double configured, bool ppm)
 The window the calibration pass searches with, from the configured one (ppm or Da)
 
static double measuredError_ (double offset, double sigma)
 The measured mass error |offset| + 4 sigma: the range that holds practically all correct matches.
 
static double measuredCoverage_ (const std::vector< double > &errors, bool fragment)
 
static MSSpectrum residualSpectrum_ (const MSSpectrum &spectrum, const std::vector< UInt32 > &removed, const Precursor &precursor)
 
static std::vector< SignedSize > scoringOrder_ (const PeakMap &spectra, const PeakMap *query_spectra)
 The order in which scoreSpectraAgainstIndex_() scores the spectra: the scan indices sorted by the neutral precursor mass of the first precursor (of query_spectra if given; an unknown charge counts as 1), ties by scan index; spectra without a finite mass at the end in scan order.
 
static std::vector< Size > transferSample_ (const PeptideIdentificationList &ids, Size max_psms, Size hits_per_spectrum)
 The spectra (positions in ids) of a seeded random sample of whole spectra with at most max_psms PSMs, counting at most hits_per_spectrum hits of a spectrum; in ascending order. A spectrum's place in the draw depends only on the spectrum (its reference, retention time and precursor m/z), so the sample of a list is also the sample of any of its sublists that contain it (the copy of a file reduced to it after the rescoring, see applyPsmFDR_()), and it is the same on every platform. Spectra without hits are left out.
 
static PercolatorRescoring rescoreWithPercolator_ (std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids, int threads, std::vector< std::vector< PeptideHit > > *dropped, const PercolatorTraining &training, const Param &extra, const ReuseScoring_ *reuse=nullptr)
 
static ProteinMapping_ buildProteinMapping_ (const FragmentIndex &index, const std::vector< FASTAFile::FASTAEntry > &db, std::vector< UInt32 > candidates, const Param &indexer_parameters)
 Collects the protein occurrences of the sequences of the index peptides candidates.
 
static bool applyProteinMapping_ (const ProteinMapping_ &mapping, const std::vector< FASTAFile::FASTAEntry > &db, const Param &indexer_parameters, std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids, std::string &fallback_reason)
 Writes what PeptideIndexing::run(db, protein_ids, peptide_ids) with indexer_parameters writes: the evidences, target_decoy and protein_references of every hit, the protein hits and the PeptideIndexer:* search parameters.
 
static bool accessionHasDecoyMarker_ (const std::string &accession, const std::string &marker, bool is_prefix)
 
static void removeProteinsReferencedByNeither_ (std::vector< ProteinIdentification > &protein_ids, const PeptideIdentificationList &peptide_ids, const PeptideIdentificationList &also_referencing)
 
static bool useSearchEngineScore_ (PeptideIdentificationList &ids)
 
static Size countDecoyEntries_ (const std::vector< FASTAFile::FASTAEntry > &db, const std::string &marker, bool is_prefix)
 Helper: the entries of db whose accession carries the decoy marker (accessionHasDecoyMarker_())
 
static void poolSearchedFiles_ (std::vector< SearchResult > &per_file, bool move_psms, const StringList &in_spectra_files, std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids)
 
static bool searched_ (const SearchResult &pf)
 Helper: whether the file of pf was searched (exit code EXECUTION_OK, with a run)
 
static int searchedFileOf_ (const PeptideIdentification &id, const std::vector< SearchResult > &per_file)
 
static void returnPooledPsms_ (PeptideIdentificationList &pooled, std::vector< SearchResult > &per_file)
 
static void capturePreFdrStats_ (const PeptideIdentificationList &peptide_ids, RunStatistics &stats)
 
static double maxRetainedScore_ (const PeptideIdentificationList &peptide_ids)
 
static void keepTopHits_ (PeptideIdentificationList &peptide_ids, Size n)
 
static void markRescoredByPercolator_ (std::vector< ProteinIdentification > &protein_ids, const Param &pp, const PercolatorTraining &training, const Percolator *perc=nullptr, const ReuseScoring_ *reuse=nullptr)
 
static bool hasPSMs_ (const PeptideIdentificationList &ids)
 Helper: whether a PSM of ids has a hit.
 
static void tdcQValues_ (PeptideIdentificationList &peptide_ids, bool plus_one=false)
 

Protected Attributes

bool peptdeep_enable_ {false}
 
std::string peptdeep_ms2_model_
 
std::string peptdeep_rt_model_
 
std::string peptdeep_instrument_ {"QE"}
 
double peptdeep_nce_ {-1.0}
 
std::string peptdeep_rt_model_type_ {"b_spline"}
 
int peptdeep_batch_size_ {500}
 
double precursor_mass_tolerance_lower_ {10.0}
 positive magnitude (default matches the param)
 
double precursor_mass_tolerance_upper_ {10.0}
 positive magnitude (default matches the param)
 
std::string precursor_mass_tolerance_unit_ {"ppm"}
 
Size precursor_min_charge_
 
Size precursor_max_charge_
 
double fragment_mass_tolerance_
 
std::string fragment_mass_tolerance_unit_
 
bool deisotope_requested_ {true}
 
bool scoring_multiple_charges_ {false}
 Resolved scoring:fragment_charges: score charges above 1.
 
int scoring_max_charge_ {2}
 Upper fragment charge bound (fragment:max_charge)
 
bool mass_accuracy_score_ {false}
 Resolved scoring:method: mass-accuracy weighted HyperScore.
 
double mass_error_sd_ppm_ {7.0}
 Width of the mass-accuracy kernel in ppm (scoring:mass_error_sd)
 
Size peaks_keep_n_ {0}
 NLargest cap on MS2 peaks before scoring; 0 = resolution-aware auto (peaks:keep_n)
 
Int peaks_window_top_ {20}
 WindowMower peaks-per-100Da before scoring (peaks:window_top)
 
std::string peaks_window_type_ {"auto"}
 Resolution-aware treatment of the final peak window.
 
DeisotopingSettings_ deisotoping_
 MS2 deisotoping rule (fragment:deisotope_*)
 
bool query_raw_spectrum_ {false}
 Retrieve candidates with the spectrum before deisotoping and local filtering (fragment:query_spectrum)
 
StringList modifications_fixed_
 
StringList modifications_variable_
 
Size modifications_max_variable_mods_per_peptide_
 
std::string enzyme_
 
DecoyMode_ decoy_mode_ {DecoyMode_::AUTO}
 
std::string decoy_prefix_
 
bool decoy_keep_termini_ = false
 decoy_method 'keep_termini'
 
bool decoy_parity_report_ = false
 decoy_parity_report
 
bool terminal_features_ = false
 rescoring:terminal_features (effective)
 
bool stratum_q_values_ = false
 rescoring:stratum_q_values (effective)
 
bool nterm_options_disabled_ = false
 both switched off by buildDecoyAugmentedDB_()
 
bool rescore_ {true}
 rescore: Percolator rescoring of every run before its PSM-level FDR
 
PercolatorTraining percolator_training_
 rescoring:...: options of Percolator's training
 
Param percolator_extra_
 rescore_method 'reset': Percolator's RESET parameters (empty: Percolator)
 
std::string reset_run_name_
 spectra file of the run being rescored (names its RESET stem table)
 
std::string reuse_mode_ {"per_file"}
 rescore_reuse:mode
 
Size reuse_max_train_ {250000}
 rescore_reuse:max_train
 
Size reuse_static_files_ {1}
 rescore_reuse:static_files
 
double reuse_max_shift_ {0.5}
 rescore_reuse:max_shift
 
Size max_train_psms_ {500000}
 percolator:max_train_psms (0: no cap)
 
double fdr_psm_ {0.0}
 
bool fdr_psm_by_scored_charges_ {true}
 FDR:PSM_groups: separate competitions per number of scored fragment charges.
 
double fdr_protein_ {0.0}
 
double fdr_protein_inference_psm_ {0.1}
 FDR:protein_inference_PSM: q-value cutoff of the PSMs of the protein inference.
 
StringList annotate_psm_
 
bool self_trained_ion_priors_ {false}
 annotate:self_trained_ion_priors
 
FragmentIonLikelihoodModel::ContextSet ion_prior_model_ {FragmentIonLikelihoodModel::ContextSet::RICH}
 annotate:ion_prior_model
 
bool ion_prior_scored_peaks_ {false}
 annotate:ion_prior_peaks == scored
 
int ion_prior_max_fragment_charge_ {2}
 annotate:ion_prior_max_fragment_charge (capped at precursor charge - 1)
 
double ion_prior_train_fdr_ {0.01}
 annotate:ion_prior_train_fdr: TDC q-value threshold of the training PSMs
 
Size ion_prior_min_psms_ {100}
 annotate:ion_prior_min_psms: training PSMs required per fold
 
bool ion_prior_feature_llr_ {true}
 annotate:ion_prior_features holds ion_prior_llr
 
bool ion_prior_feature_explained_ {true}
 annotate:ion_prior_features holds ion_prior_explained
 
bool ion_prior_feature_topk_ {false}
 annotate:ion_prior_features holds ion_prior_topk_observed
 
Size peptide_min_size_
 
Size peptide_max_size_
 
Size peptide_missed_cleavages_
 
EnzymaticDigestion::Specificity peptide_enzyme_specificity_ {EnzymaticDigestion::SPEC_FULL}
 
Size report_top_hits_
 
Size rescore_top_hits_ {0}
 rescoring:top_hits: the hits per spectrum that the Percolator rescoring gets (0 = report_top_hits_)
 
bool isotope_error_observed_minus_theoretical_ {true}
 
bool add_a_ions_ {false}
 
bool add_b_ions_ {true}
 
bool add_c_ions_ {false}
 
bool add_x_ions_ {false}
 
bool add_y_ions_ {true}
 
bool add_z_ions_ {false}
 
bool add_zp1_ions_ {false}
 
bool ions_by_activation_ {true}
 add c and z+1 ions for electron-activated spectra
 
bool protein_mapping_from_index_ {true}
 peptide:protein_mapping = index
 
Size database_chunk_size_ {0}
 0 = disabled; >0 = chunk DB into groups of this many proteins
 
bool calibration_enabled_ {false}
 
double calibration_subset_ratio_ {0.1}
 
bool chimeric_enabled_ {false}
 chimeric:enabled: also search the precursors co-isolated with the selected one
 
Size calibration_min_psms_ {50}
 
double calibration_sigma_factor_ {4.0}
 calibration:sigma_factor (fragment)
 
double calibration_precursor_sigma_factor_ {0.0}
 calibration:precursor_sigma_factor (0: the precursor window is kept)
 
double calibration_min_precursor_tol_ {0.0}
 calibration:min_precursor_tolerance (0: by unit)
 
double calibration_min_fragment_tol_ {0.0}
 calibration:min_fragment_tolerance (0: by unit)
 
std::string calibration_recalibrate_ {"none"}
 calibration:recalibrate: none | offset | linear
 
Size calibration_recalibrate_rt_chunks_ {1}
 calibration:recalibrate_rt_chunks
 
CalibrationResult_ last_calibration_result_
 
RunStatistics last_run_stats_
 
PercolatorRescoring last_percolator_
 
bool keep_pre_fdr_psms_ = false
 see setKeepPreFdrPsms()
 
FileResultConsumer file_result_consumer_
 see setFileResultConsumer()
 
std::string parameter_name_prefix_
 
bool pool_rescoring_ = false
 
Size pool_files_ = 0
 
PeptideIdentificationList pre_fdr_peptide_ids_
 
std::shared_ptr< void > released_hits_
 
std::shared_ptr< const ReuseModel_ > reuse_model_
 rescore_reuse: the models of a multi-file search ('static': trained on its first files; null otherwise)
 
bool reuse_defer_ = false
 rescore_reuse: the current search defers its rescoring and FDR:PSM to finishDeferredRescoring_()
 
Size reuse_file_index_ = 0
 rescore_reuse: the index of the file of the current search in a multi-file search (0 otherwise)
 
PeptideIdentificationList inference_only_peptide_ids_
 
double last_mod_match_tolerance_used_ {-1.0}
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters.
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes!
 
std::vector< std::string > subsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes!
 
std::string error_name_
 Name that is displayed in error messages during the parameter checking.
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;.
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;.
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImpl * current_logger_
 

Static Protected Attributes

static constexpr const char * OBSERVED_PRECURSOR_MZ = "observed_precursor_mz"
 
static constexpr const char * OBSERVED_COISOLATED_MZ = "observed_coisolated_mz"
 
static constexpr const char * SEARCH_ENGINE_SCORE = "ln(hyperscore)"
 
- Static Protected Attributes inherited from ProgressLogger
static std::atomic< int > recursion_depth_
 

Private Member Functions

bool isOpenSearchMode_ () const
 Helper function to determine if open search should be used based on tolerance.
 

Detailed Description

Fragment-index-based peptide database search algorithm (experimental).

Provides a self-contained search engine that matches MS/MS spectra against a protein database using an FI (Fragment Index). Typical usage:

Notes:

  • Used by the ProSE TOPP tool
  • Experimental; interfaces and behavior may change

Class Documentation

◆ 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::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::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::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::MergedResult

struct OpenMS::ProSEAlgorithm::MergedResult

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

Class Members
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::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::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::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::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::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::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::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::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

Member Typedef Documentation

◆ FileResultConsumer

using FileResultConsumer = std::function<void(Size, const SearchResult&)>

The consumer of the files' results (setFileResultConsumer()): file index, result. Must only read the result.

Member Enumeration Documentation

◆ DecoyMode_

enum class DecoyMode_
strongprotected

How decoys are obtained/recognised for a search (parameter "decoys").

Enumerator
AUTO 

ensure decoys: use those already present, otherwise generate

GENERATE 

always (re)generate decoys from the targets (strip existing first)

IGNORE 

search targets only; remove any decoys present in the database

◆ ExitCodes

enum class ExitCodes
strong

Exit codes.

Enumerator
EXECUTION_OK 
INPUT_FILE_EMPTY 
UNEXPECTED_RESULT 
UNKNOWN_ERROR 
ILLEGAL_PARAMETERS 

Constructor & Destructor Documentation

◆ ProSEAlgorithm()

Member Function Documentation

◆ accessionHasDecoyMarker_()

static bool accessionHasDecoyMarker_ ( const std::string &  accession,
const std::string &  marker,
bool  is_prefix 
)
staticprotected

Helper: does accession carry the decoy marker at the given position? Empty marker → false. Pure std::string (no String dependency).

◆ annotateFragmentPeaks_()

void annotateFragmentPeaks_ ( const PeakMap &  exp,
PeptideIdentificationList &  peptide_ids,
double  fragment_mass_tolerance,
const std::string &  fragment_mass_tolerance_unit_ppm,
const MzRecalibration_ *  fragment_recalibration = nullptr 
) const
protected

The fragment annotations that postProcessHits_() leaves out with defer_peak_annotations, for the hits of peptide_ids (by their "scan_index" in exp), computed as postProcessHits_() computes them (with fragment_recalibration, of the m/z as observed).

◆ annotateIonPriors_()

void annotateIonPriors_ ( const PeakMap &  spectra,
const FragmentIonLikelihoodModel::PeakLists &  evidence,
std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids 
) const
protected

Learn per-run fragment ion likelihoods from confident PSMs and annotate every hit with them.

Implements annotate:self_trained_ion_priors. The spectra are split into two folds by the parity of their scan_index. Each fold trains its own FragmentIonLikelihoodModel on its rank-one target hits at target-decoy competition q <= annotate:ion_prior_train_fdr of the native score, computed within the fold, with their reversed sequences matched against the same spectra as noise. Every hit is then scored by the model of the other fold (cross-fitting), so neither a PSM's own spectrum nor its label, nor any other label of its fold, enters the model that scores it; targets and decoys are scored alike. Both folds need annotate:ion_prior_min_psms training PSMs (a fold without a decoy hit has the estimate (0 + 1) / T); otherwise all features of the file are 0 and a warning is logged. This run-level gate is the one place where the labels of a fold reach its own features: at the boundary, a single label (in either fold) decides whether both folds get their cross-fitted features or all zeros. The gate treats targets and decoys alike, but it is not formally independent of the labels. Adds the feature names to the search parameters' extra_features and records the settings that determine the features (annotate:ion_prior_*) and the training set (ion_prior:*). Native scores and the retained candidates are unchanged. Call after PeptideIndexing (target/decoy labels) and before FDR (which overwrites the native scores). Does nothing when the ion priors are off, which includes target-only searches (decoys=ignore).

Parameters
[in]spectraPreprocessed spectra, indexed by the scan_index meta value of the PSMs (precursor activation selects the ion series).
[in]evidencePeak lists of the same spectra from preprocessSpectra_.
[in,out]protein_idsSearch parameters of protein_ids[0] receive the feature names and training facts.
[in,out]peptide_idsEvery hit receives the meta values of annotate:ion_prior_features (ion_prior_llr, ion_prior_explained, ion_prior_topk_observed).

◆ annotatePeptDeepFeatures_()

void annotatePeptDeepFeatures_ ( const PeakMap &  spectra,
std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids 
) const
protected

Adds PeptDeep-prediction-derived rescoring features to the PSMs.

No-op unless both peptdeep:ms2_model and peptdeep:rt_model are set. Warns and does nothing when OpenMS was built without ONNX support, so an ini file that requests the models still runs (without those features) on such a build.

◆ annotatePsmQValues()

void annotatePsmQValues ( PeptideIdentificationList &  peptide_ids) const

Annotate PSM q-values by target-decoy competition of the best hit of each spectrum, as FDR:PSM does.

Uses FalseDiscoveryRate (decoy hits are kept and annotated) and replaces hit scores by q-values; no filtering. With FDR:PSM_groups = 'scored_charges' and multiply charged fragments scored (scoring:fragment_charges), PSMs whose best hits were scored with different numbers of fragment charges compete separately, because HyperScore grows with the number of theoretical ions. With one group, or a group without target or decoy hits, all PSMs compete together.

Parameters
[in,out]peptide_idsPSMs with target_decoy annotations (PeptideIndexing).

◆ applyCompleteSetProteinFDR()

static bool applyCompleteSetProteinFDR ( std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids,
const std::string &  decoy_string,
bool  decoy_is_prefix,
double  protein_fdr,
bool  remove_decoys,
const PeptideIdentificationList &  inference_only_psms 
)
static

Finalize protein-level FDR on a COMPLETE protein set (a single input file, or a merged cross-file aggregate).

Runs protein inference (BasicProteinInferenceAlgorithm, see inferProteins()), picked-protein FDR (Savitski et al. 2015), threshold filtering at protein_fdr, then removes decoys and repairs indistinguishable-protein / protein-group / peptide-evidence references so the result stores as schema-valid, decoy-free idXML.

The inference and the picked-protein FDR use the reported PSMs (peptide_ids, e.g. those that pass FDR:PSM) together with inference_only_psms (e.g. those up to FDR:protein_inference_PSM), as ProteomicsLFQ infers proteins on PSMs of a looser cutoff before it filters them at its PSM FDR: more decoy proteins for the picked FDR, and the score of a protein is the best PEP of its PSMs (the raw search engine score without a PEP, see inferProteins()). The proteins and the indistinguishable groups are filtered at protein_fdr, each by its own q-value (the picked FDR of the groups counts a group once, however many targets it holds, so a group can be above the cutoff while its proteins are not), and only the proteins of the groups that pass stay. The reported PSMs stay as they are, but for the decoys that the finalization removes and the PSMs all of whose proteins the filter removed (as ProteomicsLFQ removes them: no reported PSM is left without a protein); the proteins and groups that none of them references afterwards (the decoys, and the proteins only inference_only_psms support) are removed.

Shared by the file-based single-file search() above, mergeFileResults() and the ProSE TOPP tool's single-file finalization, so the exact IDFilter sequence and ordering live in one place (they previously existed as copies that could drift).

Precondition: protein_ids is non-empty and the set is statistically complete — picked-protein FDR does not compose across runs. The caller gates on "decoys present" and "FDR requested"; this helper additionally skips (with a warning) when no decoy proteins survive inference, to avoid target-only q-values.

With remove_decoys false the decoys are kept, as mergeFileResults() keeps them: the picked-protein FDR keeps the decoy proteins, with q-values, the filter at protein_fdr applies to them as to the targets, the decoy PSMs stay, and only the references to the proteins the filter removed go.

Parameters
[in,out]protein_idsProtein identifications (operates on protein_ids[0]).
[in,out]peptide_idsThe reported PSMs; only the best hit of each is kept, decoy PSMs are removed (unless remove_decoys is false), and so are the PSMs whose proteins all fail the protein FDR.
[in]decoy_stringAccession marker identifying decoy proteins.
[in]decoy_is_prefixWhether decoy_string is a prefix (true) or suffix (false).
[in]protein_fdrPicked-protein q-value threshold (expected > 0).
[in]remove_decoysRemove the decoy PSMs and proteins (the finalization, as in the ProSE tool).
[in]inference_only_psmsPSMs that the inference and the picked-protein FDR use as well, but that are not reported (SearchResult::inference_only_peptide_ids); their identifiers are ignored. No default, so that a caller cannot drop the searches' inference-only PSMs unnoticed: pass the search result's (empty with FDR:PSM 0 or FDR:protein_inference_PSM at or below FDR:PSM), or an empty list for PSMs without them.
Returns
Whether the picked-protein FDR was applied: false if it was skipped (an empty decoy_string, or no decoy protein left after the inference, which uses the best hit of each PSM only).

◆ applyDeferredPsmFDR()

bool applyDeferredPsmFDR ( const std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids,
bool  rescored,
double  psm_fdr,
PeptideIdentificationList *  inference_only_psms = nullptr 
) const

Apply the PSM-level FDR to PSMs that were rescored separately, e.g. with rescoreWithPercolator() on the result of a search with 'rescore' and the FDR filters off.

For PSMs that rescoreWithPercolator() rescored (rescored), the scores are Percolator q-values already. Otherwise they get q-values by annotatePsmQValues() first (FDR:PSM_groups of this instance; without a decoy PSM the conservative 1/T), provided the run has decoy proteins (protein hits with 'target_decoy' "decoy"). The PSMs are then filtered at psm_fdr (IDFilter::filterHitsByScore); target and decoy PSMs are filtered alike, decoys are not removed (that is the protein FDR's finalization, see applyCompleteSetProteinFDR()).

The searches of this class do not call it: their own PSM-level FDR (after the rescoring with 'rescore') takes the decoys of the searched database, so that a run without a decoy PSM is filtered too, with q-values 1/T. Here the run's protein hits are all that tells whether the search had decoys.

Parameters
[in]protein_idsThe runs of the search; the first one tells whether there are decoys.
[in,out]peptide_idsPSMs of the run, rescored by rescoreWithPercolator() or with their search engine scores.
[in]rescoredWhether rescoreWithPercolator() rescored peptide_ids (its applied).
[in]psm_fdrPSM q-value threshold.
[out]inference_only_psmsIf given, receives the PSMs that the filter removes but whose q-values pass FDR:protein_inference_PSM of this instance, for the protein inference (SearchResult::inference_only_peptide_ids); left empty if nothing was filtered.
Returns
False if nothing was filtered: psm_fdr <= 0, no runs or no PSMs, or PSMs that were not rescored without decoy proteins to estimate the FDR with.

◆ applyProteinMapping_()

static bool applyProteinMapping_ ( const ProteinMapping_ &  mapping,
const std::vector< FASTAFile::FASTAEntry > &  db,
const Param &  indexer_parameters,
std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids,
std::string &  fallback_reason 
)
staticprotected

Writes what PeptideIndexing::run(db, protein_ids, peptide_ids) with indexer_parameters writes: the evidences, target_decoy and protein_references of every hit, the protein hits and the PeptideIndexer:* search parameters.

Returns
false, with fallback_reason set and nothing changed, if mapping cannot reproduce PeptideIndexing for these identifications (e.g. a hit whose sequence it does not hold); then PeptideIndexing has to run.

◆ applyPsmFDR_()

PercolatorRescoring applyPsmFDR_ ( std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids,
bool  has_decoys,
RunStatistics &  stats,
PeptideIdentificationList *  pre_fdr_psms = nullptr,
PeptideIdentificationList *  inference_only_psms = nullptr 
) const
protected

Helper: the PSM-level FDR of one search run, the last step of every search path. With 'rescore' on, rescores the PSMs with Percolator first (rescoreWithPercolator()). Then applies FDR:PSM to Percolator's q-values, or to target-decoy q-values of the search engine scores (annotatePsmQValues(); if has_decoys, also without a decoy PSM). The proteins of the run stay as PeptideIndexing produced them (the protein FDR reduces them to those of the reported PSMs, applyCompleteSetProteinFDR()). Fills the FDR fields of stats. If pre_fdr_psms is given, it receives the PSMs before the rescoring and FDR:PSM (see setKeepPreFdrPsms()), with report:top_hits hits per spectrum; Percolator rescores rescoring:top_hits hits per spectrum (see searchTopHits_()); inference_only_psms receives the PSMs between FDR:PSM and FDR:protein_inference_PSM (with FDR:protein only, see SearchResult::inference_only_peptide_ids; cleared otherwise).

Returns
The outcome of the rescoring (not applied, no reason with 'rescore' off).

◆ applyRecalibration_()

void applyRecalibration_ ( const CalibrationResult_ &  cal,
PeakMap &  spectra,
PeakMap *  query_spectra,
PeakMap *  evidence_spectra 
) const
protected

calibration:recalibrate: subtract the error models of cal from the MS2 spectra, in place.

The precursor m/z and the peaks of spectra and of the candidate-retrieval and fragment-evidence copies (where given) are corrected; the observed precursor m/z is kept as meta value OBSERVED_PRECURSOR_MZ of the precursor of spectra, which postProcessHits_() reports as the PSM's m/z. The m/z of the co-isolated precursors (CoIsolationDetector::META_MZ) are corrected by the precursor model too, the observed ones kept as OBSERVED_COISOLATED_MZ. The fragment annotations undo the fragment model (MzRecalibration_::uncorrect()). Nothing happens without a successful calibration or without active models.

◆ applyRescoredPsmFDR_()

void applyRescoredPsmFDR_ ( std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids,
bool  has_decoys,
RunStatistics &  stats,
bool  rescored,
PeptideIdentificationList *  inference_only_psms 
) const
protected

FDR:PSM on the PSMs of a run after its rescoring (see applyPsmFDR_()); the proteins of the run stay as the search produced them. A rescored run records rescoring:top_hits (if not 0) as 'Percolator:top_hits', a run that was not rescored keeps report:top_hits hits per spectrum. inference_only_psms (if not null) receives the PSMs between FDR:PSM and FDR:protein_inference_PSM.

◆ buildCalibrationSample_()

std::vector< FASTAFile::FASTAEntry > buildCalibrationSample_ ( const std::vector< FASTAFile::FASTAEntry > &  full_db) const
protected

Build a strided protein sample for chunked calibration.

Sample size is tied to database_chunk_size_ so the calibration FI never exceeds the user's declared memory budget. Crucial for immunopeptidomics (non-specific digestion) where a fixed-size 5000-protein sample would generate tens of GB of fragment index. Strided rather than first-N so small chunk_size values don't starve the calibration pool (#9182).

Note: very small chunk_size may still produce a calibration pool below calibration_min_psms_; calibration then no-ops silently (follow-up issue: pool PSMs across first-K chunks of the main search loop).

◆ buildDecoyAugmentedDB_() [1/2]

std::vector< FASTAFile::FASTAEntry > buildDecoyAugmentedDB_ ( const std::vector< FASTAFile::FASTAEntry > &  fasta_db,
const DecoyStrategy_ &  strategy 
) const
protected

Build the searched database according to strategy.

Optionally strips pre-existing decoys and/or generates fresh decoys by reversing the target proteins. Produces FASTA entries only — does not construct a FragmentIndex.

◆ buildDecoyAugmentedDB_() [2/2]

std::vector< FASTAFile::FASTAEntry > buildDecoyAugmentedDB_ ( std::vector< FASTAFile::FASTAEntry > &&  fasta_db,
const DecoyStrategy_ &  strategy 
) const
protected

As above, but takes the entries of fasta_db over instead of copying them.

◆ buildFragmentIndex_()

void buildFragmentIndex_ ( SearchContext &  ctx,
const Param &  params,
const std::function< const PeakMap *(Size)> &  searched_spectra 
) const
protected

Sets params on the fragment index of ctx and builds it from ctx.db; with searched_spectra and calibration, restricted to the peptides in the precursor windows of the calibration pass (calibrationPassWindow_())

◆ buildProteinMapping_()

static ProteinMapping_ buildProteinMapping_ ( const FragmentIndex &  index,
const std::vector< FASTAFile::FASTAEntry > &  db,
std::vector< UInt32 >  candidates,
const Param &  indexer_parameters 
)
staticprotected

Collects the protein occurrences of the sequences of the index peptides candidates.

Parameters
[in]indexThe searched fragment index (built from db); must still hold its peptides
[in]dbThe searched database
[in]candidatesIndices into FragmentIndex::getPeptides(): the candidates of the hits (in any order, repeats allowed)
[in]indexer_parametersThe parameters PeptideIndexing would run with

◆ calibrationPassWindow_()

static double calibrationPassWindow_ ( double  configured,
bool  ppm 
)
staticprotected

The window the calibration pass searches with, from the configured one (ppm or Da)

◆ capturePreFdrStats_()

static void capturePreFdrStats_ ( const PeptideIdentificationList &  peptide_ids,
RunStatistics &  stats 
)
staticprotected

Helper: capture statistics that must be read BEFORE FDR filtering, namely target/decoy PSM counts (via the "target_decoy" meta set by PeptideIndexing; "target+decoy" counts as target, matching OpenMS FDR semantics) and the HyperScore distribution (FDR overwrites each hit's score with its q-value). Fills stats.target_psms, stats.decoy_psms, stats.hyperscore_* and stats.score_stats_valid.

◆ chimericSearch_()

bool chimericSearch_ ( ) const
inlineprotected

Whether co-isolated precursors are searched (chimeric:enabled, which database:chunk_size > 0 does not support). The file-based searches then also read the survey scans.

◆ collectInferenceOnlyPsms_()

void collectInferenceOnlyPsms_ ( const PeptideIdentificationList &  peptide_ids,
double  psm_fdr,
PeptideIdentificationList &  inference_only_psms 
) const
protected

Helper: copies of the PSMs of peptide_ids whose q-values (main scores) are above psm_fdr and at most FDR:protein_inference_PSM, appended to inference_only_psms (nothing if that cutoff is not above psm_fdr).

◆ collectRunStatistics_()

void collectRunStatistics_ ( const PeakMap &  spectra,
const std::vector< ProteinIdentification > &  protein_ids,
const PeptideIdentificationList &  peptide_ids,
RunStatistics &  stats 
) const
protected

Helper: fill a RunStatistics with identification counts, distributions and per-run tolerance estimation for one searched file (post-FDR). Silent; rendering is done separately (ProSE TOPP tool or renderRunSummary()). Fields filled at other points (target/decoy counts, achieved FDR, timing) are left untouched.

◆ computeModMatchTolerance_()

double computeModMatchTolerance_ ( ) const
inlineprotected

Scalar tolerance passed to OpenSearchModificationAnalysis under asymmetric bounds. Uses the tighter of the two positive magnitudes — semantically correct for UniMod Δmass matching precision. OpenSearchModificationAnalysis internally clamps this at MAX_MOD_MAPPING_TOL_ = 0.02 Da; see spec §7 for rationale.

Zero on one side is a legal one-sided window (e.g., [0, 500] Da = "search only positive mass shifts"). In that case std::min() would collapse to 0, passing a useless zero tolerance into the mod analyzer — masked in ppm mode by the internal clamp, but genuinely broken in Da mode. Fall back to the non-zero side so the mod-matching precision reflects the configured tolerance.

◆ countDecoyEntries_()

static Size countDecoyEntries_ ( const std::vector< FASTAFile::FASTAEntry > &  db,
const std::string &  marker,
bool  is_prefix 
)
staticprotected

Helper: the entries of db whose accession carries the decoy marker (accessionHasDecoyMarker_())

◆ countElectronActivated_()

Size countElectronActivated_ ( const PeakMap &  spectra) const
protected

Number of spectra that ions:by_activation also scores with c and z+1 ions (0 if it is off)

◆ countSpectra_()

SpectraCounts_ countSpectra_ ( const PeakMap &  spectra) const
protected

Helper: the SpectraCounts_ of spectra.

◆ filterLocalPeaks_()

static void filterLocalPeaks_ ( MSSpectrum &  spectrum,
Size  peaks_per_window 
)
staticprotected

Keep the strongest peaks in each non-overlapping 100 Da window, including a short final window.

◆ finishDeferredRescoring_()

void finishDeferredRescoring_ ( MultiFileSearchResult &  mfres,
const std::vector< Size > &  deferred 
) const
protected

rescore_reuse joint/static: trains the models on the files of deferred (indices into mfres.per_file, searched with reuse_defer_), then rescores them and applies FDR:PSM

◆ fragmentIndexParameters_()

Param fragmentIndexParameters_ ( bool  electron_ions = false) const
protected

ProSE parameters made safe to hand to a FragmentIndex.

FragmentIndex declares its own (unused) boolean "decoys" flag with restrictions {true,false}. ProSE's "decoys" parameter is the richer auto/generate/ignore enum and manages decoys at the database level, so forwarding it verbatim would trip FragmentIndex's validation. This returns getParameters() with "decoys" overridden to "false".

Parameters
[in]electron_ionsAlso index c and z+1 ions, for electron-activated spectra (ions:by_activation).

◆ hasPSMs_()

static bool hasPSMs_ ( const PeptideIdentificationList &  ids)
staticprotected

Helper: whether a PSM of ids has a hit.

◆ inferProteins()

static std::string inferProteins ( std::vector< ProteinIdentification > &  protein_ids,
const PeptideIdentificationList &  peptide_ids,
const PeptideIdentificationList &  inference_only_psms = PeptideIdentificationList() 
)
static

The protein inference of the protein FDR (applyCompleteSetProteinFDR()) and of mergeFileResults().

Runs BasicProteinInferenceAlgorithm on the best hits of peptide_ids and inference_only_psms (copies that hold what the inference reads; the PSMs themselves stay unchanged) for the run protein_ids[0], with the algorithm's 'score_type': "PEP" if every PSM carries a posterior error probability (after Percolator rescoring the main score is the q-value, and the PEP is the meta value MS:1001493), so that a protein scores with the best PEP of its PSMs (as a posterior probability, 1 - PEP), as in ProteomicsLFQ. Otherwise "RAW", ProSE's score 'ln(hyperscore)' if every PSM carries it (as main score, or as a meta value after rescoring or FDR:PSM; e.g. a pooled set of which Percolator rescored only some files), else another raw search engine score that all PSMs carry, or the main score if they carry none.

Parameters
[in,out]protein_idsProtein identifications; protein_ids[0] gets the scores and the indistinguishable groups, and loses the proteins without PSMs.
[in]peptide_idsPSMs of the run.
[in]inference_only_psmsFurther PSMs of the run (their identifiers are ignored).
Returns
The 'score_type' used: "PEP", "RAW" or "" (the main score).

◆ isElectronActivated_()

static bool isElectronActivated_ ( const MSSpectrum &  spectrum)
staticprotected

True if the precursor of spectrum was activated by electrons (ETD, ECD, EThcD or ETciD)

◆ isOpenSearchMode_()

bool isOpenSearchMode_ ( ) const
inlineprivate

Helper function to determine if open search should be used based on tolerance.

◆ keepPreRescoringPsms_()

bool keepPreRescoringPsms_ ( ) const
inlineprotected

Whether a search keeps the PSMs of each file before the rescoring (SearchResult::pre_fdr_peptide_ids)

◆ keepTopHits_()

static void keepTopHits_ ( PeptideIdentificationList &  peptide_ids,
Size  n 
)
staticprotected

Helper: keeps the first n hits of each spectrum (the top n of the search engine score, in the order of postProcessHits_()); changes nothing if no spectrum has more.

◆ loadSpectra()

static PeakMap loadSpectra ( const std::string &  filename,
const std::function< bool(const MSSpectrum &)> &  keep = {} 
)
static

The MS2 spectra of a spectrum file as the searches of this class read them.

Sorted by RT, their peaks by m/z. An mzML file is read in chunks that the OpenMP threads of this thread (at most 16) parse in parallel, in one pass over the file; other files (Bruker .d, Thermo .raw), or an mzML file whose layout the chunks do not support (e.g. compressed), with FileHandler::loadExperiment(). For a second look at the spectra of a search, e.g. those of its PSMs (ProSE's -qpx_extended). A remote mzML file (http://, https://, ftp:// or s3://, see FileHandler::isRemote()) is streamed by MzMLFile.

Parameters
[in]filenameThe spectrum file (mzML, mzPeak, Bruker .d or Thermo .raw), or the remote location of an mzML file
[in]keepIf set, only the spectra it accepts are kept, so that the result holds only those in memory. It is called on several threads at once.
Returns
The spectra
Exceptions
Exception::BaseExceptionas FileHandler::loadExperiment() if the file cannot be read

◆ localFragmentEvidence_() [1/3]

static LocalFragmentEvidence_ localFragmentEvidence_ ( const MSSpectrum &  spectrum,
const MSSpectrum &  theoretical,
const std::vector< double > &  densities,
double  tolerance,
bool  ppm 
)
staticprotected

Compute local fragment-match evidence on the spectrum before window/top-N peak filtering.

Matches each intact theoretical ion to its nearest experimental peak. Surprise is sum(max(0, -log(2 * tolerance_Da * local_density))). Competition evidence is sum(1 / (1 + alternative_assignments + local_density)). Alternative hypotheses include all configured intact ions and generic H2O/NH3 losses, divided by the fragment charge. Losses only discount ambiguous matches; they are not scored as additional matches and do not require sequence-specific loss eligibility.

Parameters
[in]spectrumSorted experimental spectrum after zero-intensity removal and optional deisotoping, before window/top-N peak filtering.
[in]theoreticalSorted intact ions, with the TSG's aligned integer charge array.
[in]densitiesResult of localPeakDensities_(spectrum), reused for all candidates.
[in]tolerancePositive, finite matching tolerance.
[in]ppmWhether tolerance is given in ppm rather than Da.
Returns
Two additive annotations; zero without matches. Neither is a calibrated PSM p-value.

◆ localFragmentEvidence_() [2/3]

static LocalFragmentEvidence_ localFragmentEvidence_ ( const MSSpectrum &  spectrum,
const MSSpectrum &  theoretical,
const std::vector< Int > &  charges,
int  max_charge,
const std::vector< double > &  densities,
double  tolerance,
bool  ppm,
std::vector< double > &  alternatives 
)
staticprotected

localFragmentEvidence_() with the charges of the peaks of theoretical given (charges, one per peak)

◆ localFragmentEvidence_() [3/3]

static LocalFragmentEvidence_ localFragmentEvidence_ ( const MSSpectrum &  spectrum,
const MSSpectrum &  theoretical,
int  max_charge,
const std::vector< double > &  densities,
double  tolerance,
bool  ppm,
std::vector< double > &  alternatives 
)
staticprotected

localFragmentEvidence_() restricted to the ions of theoretical with charge <= max_charge, with a caller-owned buffer for the sorted alternative assignments (reused across candidates).

◆ localPeakDensities_()

static std::vector< double > localPeakDensities_ ( const MSSpectrum &  spectrum)
staticprotected

Peak counts per Da in a fixed +/-50 m/z window around each peak of a sorted spectrum.

◆ markRescoredByPercolator_()

static void markRescoredByPercolator_ ( std::vector< ProteinIdentification > &  protein_ids,
const Param &  pp,
const PercolatorTraining &  training,
const Percolator *  perc = nullptr,
const ReuseScoring_ *  reuse = nullptr 
)
staticprotected

Helper: marks protein_ids as post-processed by Percolator (with parameters pp and the options training), as PercolatorAdapter does; with perc (its last training: capped-training details, RESET) and reuse (rescore_reuse), what they did

◆ maxRetainedScore_()

static double maxRetainedScore_ ( const PeptideIdentificationList &  peptide_ids)
staticprotected

Helper: maximum top-hit score among retained PSMs. After PSM-FDR the score is the q-value, so this is the achieved FDR of the filtered set (-1.0 if empty).

◆ measuredCoverage_()

static double measuredCoverage_ ( const std::vector< double > &  errors,
bool  fragment 
)
staticprotected

The share of errors that their measured error covers (median and 1.4826 * MAD of errors): within median +/- 4 sigma (precursor), or |error| <= measuredError_() (fragment). 0 for no errors.

◆ measuredError_()

static double measuredError_ ( double  offset,
double  sigma 
)
staticprotected

The measured mass error |offset| + 4 sigma: the range that holds practically all correct matches.

◆ mergeFileResults()

MergedResult mergeFileResults ( MultiFileSearchResult &  result,
const StringList &  in_spectra_files,
bool  remove_decoys = true 
) const

Pools result (moving its PSMs out), infers proteins across files, applies FDR:protein of this instance with picked-protein FDR if decoy proteins were identified and then, by default, removes the decoys.

The evaluation of the ProSE tool's -out_merged, for the result of a multi-file searchWithModificationAnalysis() with the parameters of this instance:

  • Pooling: the pooled aggregate of the search (build_pooled_aggregate) is taken as it is. Without one (e.g. build_pooled_aggregate false, or a search of a single file, which builds none), the runs of the files that were searched (exit code EXECUTION_OK) are merged with IDMergerAlgorithm: the PSMs of the files are moved, their runs are copied and stay with the files. 'id_merge_index' is the input position of a PSM's file (its index in in_spectra_files, see poolSearchedFiles_()). The pooled run lists in_spectra_files as its primary MS run paths and gets the current date.
  • Cross-file protein inference (inferProteins(): a protein scores with the best PEP of its PSMs, or the best search engine score without PEPs) on the best hit of each pooled PSM.
  • Percolator ('rescore') rescored only some files with PSMs (which the multi-file search avoids, unless the model of the other files or of all files fails too; a warning names the others): each PSM keeps the q-value of its file (Percolator's, or target-decoy q-values of ProSE's score), on which FDR:PSM filtered it, but the proteins are scored by ProSE's score 'ln(hyperscore)' of all PSMs, as only the rescored ones have a PEP (on the inference's copies of the PSMs: the PSMs keep their scores). The pooled run reports ProSE's search engine. So that all PSMs of the pooled run have one main score type, the PSMs of a file that was not rescored and has no q-values yet (FDR:PSM 0) get the target-decoy q-values of ProSE's score of their file (annotatePsmQValues(); unfiltered), as with FDR:PSM > 0.
  • With FDR:protein > 0 and decoys in the searched database: applyCompleteSetProteinFDR(), whose inference also uses the PSMs of the files between FDR:PSM and FDR:protein_inference_PSM (per_file[i].inference_only_peptide_ids, which are moved out), with picked-protein FDR (Savitski et al. 2015) and the filter at FDR:protein, provided the inference identified decoy proteins (otherwise a warning, and nothing is filtered). The finalization then removes the decoys, the proteins without a pooled PSM and the references to removed proteins. With remove_decoys false the picked-protein FDR keeps the decoy proteins in the run, with q-values (FalseDiscoveryRate's add_decoy_proteins; the q-values of the targets are the same), and the filter applies to them as to the targets; the decoy PSMs and the decoy proteins that pass are kept, and only the references to the proteins the filter removed go (peptide evidences, indistinguishable proteins and protein groups), so that the result can still be stored, e.g. as idXML. Without the protein FDR the result keeps the targets and decoys.
Parameters
[in,out]resultThe search result. Its pooled aggregate's identifications are moved into the returned result; without an aggregate, the PSMs of the files that were searched are, while the runs of the files (per_file[i].protein_ids: search parameters, meta values such as PeptDeepRescoring::NCE_META_VALUE, primary MS run paths) stay as they are. The statistics, exit codes, Percolator outcomes and modification analyses stay, too. Unchanged if Exception::IllegalArgument is thrown. If the evaluation fails after the PSMs were moved out (an exception, which is passed on), the files get them back, in their order, as far as the evaluation changed them (at most only the best hit of each, and q-values as above); their PSMs between FDR:PSM and FDR:protein_inference_PSM are gone.
[in]in_spectra_filesThe input files of the search, in its order: one per entry of result.per_file. They are stored as primary MS run paths as given: for a remote location, pass its FileHandler::displayName().
[in]remove_decoysWhether the finalization of the protein FDR removes the decoy PSMs and proteins (default, as in the ProSE tool's -out_merged). False keeps those that pass, e.g. to show them; protein_fdr_applied of the result still tells whether the FDR was applied. No effect without the protein FDR.
Returns
The pooled run and PSMs; empty if no file was searched.
Exceptions
Exception::IllegalArgumentif in_spectra_files has not one entry per file of result.

◆ paramName_()

std::string paramName_ ( const std::string &  name) const
inlineprotected

Helper: name as the user sets the parameter (setParameterNamePrefix()), for messages.

◆ pinEnzymeName()

static std::string pinEnzymeName ( const std::string &  enzyme)
static

The name of enzyme as PercolatorInfile computes the enzN/enzC/enzInt features of a .pin.

PercolatorInfile knows only Percolator's lower-case enzyme names and treats every other name as "every site is enzymatic". This maps OpenMS's names (e.g. Trypsin/P to trypsinp, PepsinA to pepsin) and returns "no_enzyme" for an enzyme Percolator does not know. rescoreWithPercolator() and the ProSE tool's -out_pin use it.

◆ pinFeatureEnzyme()

static std::string pinFeatureEnzyme ( const std::string &  enzyme,
bool  fixed_enzyme_termini 
)
static

The enzyme argument of PercolatorInfile (store(), the in-process rescoring) for the enzN/enzC/enzInt features of the search's enzyme: its Percolator name (pinEnzymeName(); a ProteaseDB enzyme without one keeps its name, so that PercolatorInfile uses its cleavage rule) with "+termini" (fixed_enzyme_termini: protein termini and the position after an initial Met are cleavage sites) or "+keep_termini" (the features of ProSE int15, the default).

◆ poolSearchedFiles_()

static void poolSearchedFiles_ ( std::vector< SearchResult > &  per_file,
bool  move_psms,
const StringList &  in_spectra_files,
std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids 
)
staticprotected

Helper: pool the runs of the files of per_file that were searched (exit code EXECUTION_OK) with IDMergerAlgorithm into one run (protein_ids, one entry) that lists in_spectra_files as primary MS run paths, and their PSMs (peptide_ids). Copies the identifications, or with move_psms moves the PSMs out of per_file (leaving them empty) and copies the runs, which stay with the files. 'id_merge_index' of a PSM is the input position of its file (its index in per_file and in_spectra_files, per occurrence: the same file given twice has two), also when other files failed. Shared by the multi-file search's pooled aggregate and mergeFileResults().

◆ postProcessHits_()

void postProcessHits_ ( const PeakMap &  exp,
std::vector< std::vector< ProSEAlgorithm::AnnotatedHit_ > > &  annotated_hits,
const std::vector< CandidatePoolStats_ > &  pool_stats,
std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids,
Size  top_hits,
const StringList &  modifications_fixed,
const StringList &  modifications_variable,
Int  peptide_missed_cleavages,
double  precursor_mass_tolerance,
double  fragment_mass_tolerance,
const std::string &  precursor_mass_tolerance_unit_ppm,
const std::string &  fragment_mass_tolerance_unit_ppm,
const Int  precursor_min_charge,
const Int  precursor_max_charge,
const std::string &  enzyme,
const std::string &  database_name,
const PeakMap *  evidence_spectra = nullptr,
const std::vector< Size > *  evidence_parent = nullptr,
bool  defer_peak_annotations = false,
const MzRecalibration_ *  fragment_recalibration = nullptr 
) const
protected

Filter and annotate search results.

Trims per-spectrum candidate hits to the top N and converts them into PeptideIdentification objects, adding requested PSM annotations and populating protein-level search metadata.

Parameters
[in]expInput MS experiment providing spectra/metadata for annotation.
[in,out]annotated_hitsPer-spectrum candidate hits (trimmed to top_hits in-place).
[in]pool_statsPer-spectrum summary of the full candidate pool as collected by scoreSpectraAgainstIndex_(), used for the pool-derived PSM features (delta score, z-score, candidate count). Must match annotated_hits in size.
[out]protein_idsOutput container for protein-level identification and search metadata.
[out]peptide_idsOutput container for spectrum-level peptide identifications (PSMs).
[in]top_hitsNumber of top-scoring hits to retain per spectrum (searchTopHits_()).
[in]modifications_fixedFixed modifications (by name) used during the search.
[in]modifications_variableVariable modifications (by name) used during the search.
[in]peptide_missed_cleavagesAllowed missed cleavages in digestion.
[in]precursor_mass_tolerancePrecursor mass tolerance value.
[in]fragment_mass_toleranceFragment mass tolerance value.
[in]precursor_mass_tolerance_unit_ppmPrecursor tolerance unit ("true"->ppm, "false"->Da).
[in]fragment_mass_tolerance_unit_ppmFragment tolerance unit ("true"->ppm, "false"->Da).
[in]precursor_min_chargeMinimum precursor charge considered.
[in]precursor_max_chargeMaximum precursor charge considered.
[in]enzymeDigestion enzyme name.
[out]database_nameDatabase file name used for the search (stored in protein_ids).
[in]evidence_spectraPeak lists retained before local/top-N filtering, aligned with exp; required when annotate:local_fragment_evidence is enabled, otherwise unused.
[in]defer_peak_annotationsLeave out the fragment annotations (annotate:PSM fragment_annotation): the caller adds them with annotateFragmentPeaks_() to the hits it keeps.
[in]evidence_parentFor the spectra of exp after the first evidence_spectra->size() (the residual spectra of a chimeric search), the index of the spectrum whose peak list in evidence_spectra they use; else evidence_spectra must be as long as exp.
[in]fragment_recalibrationThe fragment model calibration:recalibrate subtracted from the peaks of exp (CalibrationResult_::appliedFragmentRecalibration()): the fragment annotations report the peaks' m/z as observed. nullptr: the peaks were not corrected.

◆ prepareContext() [1/2]

SearchContext prepareContext ( const std::vector< FASTAFile::FASTAEntry > &  fasta_db) const

Build a SearchContext (decoy-augmented database + FragmentIndex) for reuse.

Performs the database preparation and FragmentIndex construction steps so that subsequent calls to search(spectra, ctx, ...) can reuse the same index across many spectrum files. If decoy generation is enabled (parameter "decoys"), decoys are generated and shuffled into the returned context's db member exactly once here.

Parameters
[in]fasta_dbProtein sequence database as FASTA entries.
Returns
Prepared SearchContext containing the (possibly decoy-augmented) database and the built FragmentIndex.

Thread-safety: concurrent search() calls reading the same SearchContext are safe (per FragmentIndex query thread-safety contract) as long as calibration:enabled is off. A successful calibration sets the calibrated tolerances as query parameters of the context's FragmentIndex until the call returns, so calibrated searches must not share a context concurrently. Do not call prepareContext() concurrently on the same algorithm instance.

◆ prepareContext() [2/2]

SearchContext prepareContext ( const std::vector< FASTAFile::FASTAEntry > &  fasta_db,
bool  electron_ions 
) const

Build a SearchContext whose FragmentIndex also holds c and z+1 ions.

As prepareContext(fasta_db). With electron_ions, the index also holds c and z+1 ions, which ions:by_activation scores for electron-activated spectra (ETD, ECD, EThcD, ETciD). Only those spectra are matched against them, so other spectra get the same candidates as from prepareContext(fasta_db). Use it when the spectra to search contain such spectra: search() otherwise builds a temporary index with these ions for each call.

Parameters
[in]fasta_dbProtein sequence database as FASTA entries.
[in]electron_ionsAlso index c and z+1 ions.
Returns
Prepared SearchContext.

◆ prepareContext_()

SearchContext prepareContext_ ( std::vector< FASTAFile::FASTAEntry > &&  fasta_db,
bool  electron_ions,
const std::function< const PeakMap *(Size)> &  searched_spectra = {} 
) const
protected

◆ preprocessSearchedSpectra_()

void preprocessSearchedSpectra_ ( PeakMap &  spectra,
const std::string &  input,
FragmentIonLikelihoodModel::PeakLists &  ion_evidence,
PeakMap *  evidence_spectra,
PeakMap *  query_spectra 
) const
protected

Helper: preprocessSpectra_() with the settings of the search, after warning about spectra (of input; empty: not named) that cannot be searched as intended: no MS2 spectra (e.g. an MS1-only file), MS2 spectra recorded as profile spectra, MS2 spectra whose precursor charge lies outside of the charge range (not searched). ion_evidence is filled with annotate:self_trained_ion_priors only.

◆ preprocessSpectra_() [1/2]

static void preprocessSpectra_ ( PeakMap &  exp,
double  fragment_mass_tolerance,
bool  fragment_mass_tolerance_unit_ppm,
bool  deisotope_requested,
Size  peaks_keep_n,
Int  peaks_window_top,
const std::string &  window_type,
const DeisotopingSettings_ &  deisotoping,
FragmentIonLikelihoodModel::PeakLists *  ion_evidence = nullptr,
bool  ion_evidence_scored_peaks = false,
PeakMap *  evidence_spectra = nullptr,
PeakMap *  query_spectra = nullptr 
)
staticprotected

filter, deisotope, decharge spectra

deisotoping sets the envelope rule of the deisotoper (see DeisotopingSettings_).

With ion_evidence, a compact copy of every spectrum's peaks is kept for the self-trained ion priors (annotate:self_trained_ion_priors): the peaks after deisotoping, before the window and top-N filters, or, with ion_evidence_scored_peaks, the peaks that are scored. The lists are indexed like exp after its sort by RT.

With query_spectra, a copy of each spectrum after zero-intensity removal and m/z sorting, before deisotoping and local filtering, is kept for candidate retrieval (fragment:query_spectrum=raw); with evidence_spectra, a copy after deisotoping, before window/top-N filtering (annotate:local_fragment_evidence). Both are aligned with exp after its sort by RT.

◆ preprocessSpectra_() [2/2]

static void preprocessSpectra_ ( PeakMap &  exp,
double  fragment_mass_tolerance,
bool  fragment_mass_tolerance_unit_ppm,
bool  deisotope_requested,
Size  peaks_keep_n,
Int  peaks_window_top,
const std::string &  window_type = "auto" 
)
staticprotected

preprocessSpectra_() with the DeisotopingSettings_ defaults (the behaviour before its parameters existed)

◆ recordRecalibration_()

void recordRecalibration_ ( const CalibrationResult_ &  cal,
std::vector< ProteinIdentification > &  protein_ids 
) const
protected

Record a successful calibration cal in the search parameters of protein_ids[0] ('calibration:*'): the measured errors (offset, sigma, |offset| + 4 sigma), and with calibration:recalibrate the mode, the models and the residual errors

◆ releaseInParallel()

static void releaseInParallel ( SearchResult &  result)
static

Free the protein and peptide identifications of result with the OpenMP threads (destroyed one after the other, the hits of a file take tens of ms at the end of a run). Leaves them empty; the statistics are kept.

◆ removeDuplicateProteins()

static Size removeDuplicateProteins ( std::vector< FASTAFile::FASTAEntry > &  db,
const std::string &  source 
)
static

Removes the repeated entries of a protein database, which searching would report twice (e.g. a FASTA file concatenated twice, or contaminants added twice).

An entry whose accession (FASTA identifier) an entry before it has, with the same sequence, is removed (the first one stays, with its description); the number removed is logged as a warning that names source.

Parameters
[in,out]dbThe database, in file order.
[in]sourceThe database file (or another name of the database) for the messages.
Returns
The number of entries removed.
Exceptions
Exception::ParseErrorif two entries of one accession have different sequences: they cannot both be reported under it, and which one is meant is unknown. The message names the accession and source.

◆ removeProteinsReferencedByNeither_()

static void removeProteinsReferencedByNeither_ ( std::vector< ProteinIdentification > &  protein_ids,
const PeptideIdentificationList &  peptide_ids,
const PeptideIdentificationList &  also_referencing 
)
staticprotected

Helper of removeUnreportedProteins() with PSMs besides the reported ones: keeps the protein hits of each run of protein_ids that a PSM of the run (by identifier) in peptide_ids or also_referencing references, as IDFilter::removeUnreferencedProteins() does for one list (the protein groups are not updated)

◆ removeUnreportedProteins()

static void removeUnreportedProteins ( std::vector< ProteinIdentification > &  protein_ids,
const PeptideIdentificationList &  peptide_ids,
const PeptideIdentificationList &  also_referencing = PeptideIdentificationList() 
)
static

Removes the proteins that no PSM references, and them from the protein groups.

Keeps the protein hits of each run of protein_ids whose accession a peptide evidence of a hit of a PSM of the run (by identifier) in peptide_ids or also_referencing names (IDFilter::removeUnreferencedProteins() for one list), and updates the indistinguishable groups and the protein groups of each run (IDFilter::updateProteinGroups()). The protein FDR does this after its filters (applyCompleteSetProteinFDR()); a search leaves the proteins of a run as PeptideIndexing produced them (those of all hits, also of the PSMs that FDR:PSM removed).

◆ renderModificationSummary()

static void renderModificationSummary ( const OpenSearchModificationAnalysis::OpenSearchAnalysisResult &  mod_analysis,
std::ostream &  os 
)
static

Render the modification-discovery section (top PTMs, unknown delta masses) to os. Shared by the per-file and aggregate report blocks.

◆ renderRunSummary()

static void renderRunSummary ( const RunStatistics &  stats,
const SharedSearchStats &  shared,
const OpenSearchModificationAnalysis::OpenSearchAnalysisResult &  mod_analysis,
bool  is_open_search,
std::ostream &  os 
)
static

Render a human-readable single-run summary block (configuration recap, database/index stats, identification results, tolerance estimate, timing and — for open searches — modification discovery) to os. shared carries the configuration/db/index context (built once).

◆ renderRunSummaryYaml()

static std::string renderRunSummaryYaml ( const MultiFileSearchResult &  mfres,
const std::vector< std::pair< std::string, std::vector< std::string > > > &  manifest,
Size  files_failed,
Size  files_total 
)
static

Serialize the complete end-of-search report to a machine-readable YAML string: shared configuration/database/index facts, per-file identification statistics, the output-file manifest (label -> written paths) and failed/total file counts. Hand-rolled (no YAML library dependency); every string scalar is double-quoted so values containing ':' (e.g. Windows paths) or other YAML metacharacters round-trip safely, and non-finite numbers are emitted as null.

◆ renderTotalTime()

static std::string renderTotalTime ( const SharedSearchStats &  sh)
static

The total time of a run, by part: "total <s>s | search of the file(s) <s>s | outputs <s>s (of which -qpx_extended <s>s)", from sh's seconds_total, seconds_output and seconds_qpx_extended (the last part only if positive). The end of the report of renderRunSummary(), and of ProSE's report of several files.

◆ reportDecoyParity_()

void reportDecoyParity_ ( const SearchContext &  ctx) const
protected

prepareContext(fasta_db, electron_ions) that takes the entries of fasta_db over instead of copying them. With searched_spectra, the index holds only the peptides these spectra can reach (see FragmentIndex::build): the context then serves only one search of these spectra, without calibration. decoy_parity_report: logs the candidate counts of ctx's fragment index per label and subclass (no-op otherwise)

◆ rescoreFilesTogether_()

void rescoreFilesTogether_ ( MultiFileSearchResult &  mfres,
const std::vector< std::string > &  in_spectra_files 
) const
protected

The end of a multi-file search with 'rescore' (with pool_rescoring_), for the files with PSMs that Percolator could not rescore on their own (e.g. fewer than 100 PSMs, or no decoy PSM).

The files that Percolator rescored on their own keep their results. If there are some, a Percolator model is trained (Percolator::trainPSMs()) on their PSMs before the rescoring (SearchResult::pre_fdr_peptide_ids), at most at most 'percolator:max_train_psms' / (the input files) of each (transferQuota_(), transferSample_(): reproducible random spectra; a file rescored on its own keeps only these after its rescoring, unless setKeepPreFdrPsms()), and scores the other files (Percolator::scorePSMs()): on the scale of its training PSMs (the score a PSM would get among them, their PEP at that score). If Percolator rescored no file on its own, the PSMs of all files are rescored together, with one cross-validated model (rescoreWithPercolator(), with the cap). Back in its file, each PSM gets the q-value of target-decoy competition of the file's PSMs on the model's SVM score, (D + 1) / T as Percolator's own (tdcQValues_(); FDR per run), on which FDR:PSM filters (and FDR:protein_inference_PSM collects); the runs are marked as rescored by Percolator, and percolator.warning of each such file says how it was rescored. If that fails (e.g. fewer than 100 PSMs in all), the files keep their search engine scores (see mergeFileResults()). In any case the copies are released (unless setKeepPreFdrPsms()); the proteins of each file stay as the search produced them.

◆ rescoreTopHits_()

Size rescoreTopHits_ ( ) const
inlineprotected

The hits per spectrum that Percolator rescores: rescoring:top_hits, or report:top_hits if that is 0.

◆ rescoreWithPercolator()

static PercolatorRescoring rescoreWithPercolator ( std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids,
int  threads,
Size  max_train_psms = 0 
)
static

Rescore the PSMs of one search run in-process with Percolator, as the parameter 'rescore' does in every search.

Trains Percolator (Percolator::rescorePSMs) on the standard PIN feature set (PercolatorInfile::getStandardFeatureSet) plus the search engine features of the run (the search parameters' 'extra_features', or 'score' without them), with train_best_positive, target-decoy competition (post_processing_tdc), the PSMs for training up to max_train_psms (subset_max_train) and nonparametric PEPs, as the percolator executable. Percolator q-values become the main score (score type "q-value"; the SVM score and PEP are kept as meta values), only the best hit per spectrum is kept, and the runs are marked as post-processed by Percolator (search engine "Percolator", version "3.08-vendored", meta value 'percolator' and the "Percolator:*" search parameter meta values PercolatorAdapter writes).

The searches of this class call it for every run when the parameter 'rescore' is on (the default), before their PSM-level FDR, which then filters on the rescored PSMs' q-values. Call it directly only to rescore PSMs of a search with 'rescore' off, whose FDR filtering must then be off too (FDR:PSM and FDR:protein 0), so that Percolator gets all target and decoy PSMs.

The PSMs are not rescored, and stay unchanged, with fewer than 100 PSMs, without decoy PSMs or if Percolator fails; skipped_reason of the result then says why. Nothing is logged about the skip, so that the caller can report it with its context (e.g. the input file).

Parameters
[in,out]protein_idsThe runs of the search; the first one gives the enzyme and the search engine features. Marked as post-processed by Percolator if the PSMs were rescored.
[in,out]peptide_idsTarget and decoy PSMs of the run (with 'target_decoy' annotations and peptide evidences, as from PeptideIndexing).
[in]threadsThreads Percolator may use (values above 9 use 9, values <= 0 use 3); never more than OpenMP allows. Cross-validation trains 9 models at a time (3 folds x 3 Cneg values), so more than 9 do not help. The results do not depend on it.
[in]max_train_psmsThe most PSMs Percolator trains on (its subset_max_train; 0: all, the default); all are scored. The searches pass 'percolator:max_train_psms'.
Returns
Whether the PSMs were rescored, and if not, why.

◆ rescoreWithPercolator_()

static PercolatorRescoring rescoreWithPercolator_ ( std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids,
int  threads,
std::vector< std::vector< PeptideHit > > *  dropped,
const PercolatorTraining &  training,
const Param &  extra,
const ReuseScoring_ *  reuse = nullptr 
)
staticprotected

rescoreWithPercolator(); with dropped, the hits it drops are moved there (as memory allows) instead of destroyed; training: the options of Percolator's training (parameters 'rescoring:...' and 'rescore_solver'); extra: further Percolator parameters (rescore_method 'reset': the RESET parameters). With reuse, the PSMs are scored as it says instead of by a model trained on them.

◆ rescoreWithReuseModel_()

PercolatorRescoring rescoreWithReuseModel_ ( std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids,
Size  file_index,
const ReuseModel_ &  model,
bool  check_shift,
int  threads,
std::vector< std::vector< PeptideHit > > *  dropped 
) const
protected

rescore_reuse: rescores the PSMs of a run (file file_index of the search) with model, as rescoreWithPercolator_(); with check_shift, a run whose PSMs (targets and decoys, labels unused) differ from the training PSMs by more than reuse_max_shift_ is rescored by Percolator trained on it instead

◆ residualSpectrum_()

static MSSpectrum residualSpectrum_ ( const MSSpectrum &  spectrum,
const std::vector< UInt32 > &  removed,
const Precursor &  precursor 
)
staticprotected

The residual spectrum of a co-isolated PSM: spectrum without the peaks removed (ascending indices), with precursor as its precursor and without the meta values of CoIsolationDetector::annotate()

◆ resolveDecoyStrategy_()

DecoyStrategy_ resolveDecoyStrategy_ ( const std::vector< FASTAFile::FASTAEntry > &  db) const
protected

Decide how to obtain/recognise decoys for db.

Detects pre-existing decoys via the common-marker heuristic (OpenMS::DecoyHelper), falling back to the configured decoy_prefix for custom markers, then maps the "decoys" mode (auto/generate/ignore) onto a concrete DecoyStrategy_.

◆ restrictIndexToSpectra_()

bool restrictIndexToSpectra_ ( ) const
inlineprotected

Whether a single-use context may index only the peptides the searched spectra can reach: not with chimeric search, whose co-isolated precursors the index restriction does not know, and not with calibration:recalibrate linear, whose line in m/z may move a precursor further than any window. With calibration, the restriction covers the windows of the calibration pass and the shift of calibration:recalibrate offset (see buildFragmentIndex_()).

◆ returnPooledPsms_()

static void returnPooledPsms_ ( PeptideIdentificationList &  pooled,
std::vector< SearchResult > &  per_file 
)
staticprotected

Helper: moves the PSMs of pooled (empty afterwards) to their files of per_file (searchedFileOf_(); others are dropped), without 'id_merge_index', in their order, as PSMs of the files' runs (their identifiers), appended to the files' PSMs.

◆ reuseCalibrationDraw()

static bool reuseCalibrationDraw ( UInt64  seed,
Size  file,
Size  spectrum,
double  fraction 
)
static

rescore_reuse: whether spectrum spectrum of file file is drawn as a calibration spectrum (whose decoys set the scale of a model; never trained on) at the calibration fraction fraction: from the 5 % of the spectra whose draw is highest, so never a training spectrum (reuseTrainingDraw()) at any fraction

◆ reuseTrainingDraw()

static bool reuseTrainingDraw ( UInt64  seed,
Size  file,
Size  spectrum,
double  fraction 
)
static

rescore_reuse: whether spectrum spectrum (its index in the run) of file file is drawn for the training of the models at the sampling fraction fraction (rescore_reuse:max_train)

A seeded hash-uniform draw per spectrum (all PSMs of a spectrum together), independent of its position: a capped training sample is spread at random over the whole run, not its first spectra. The 5 % of the spectra whose draw is highest are calibration spectra and never drawn for training.

◆ reversedNoiseSequence_()

static AASequence reversedNoiseSequence_ ( const AASequence &  sequence)
staticprotected

Reversed sequence keeping the C-terminal residue and every residue's modification: the noise hypothesis of a confident PSM.

◆ runCalibrationPass_()

CalibrationResult_ runCalibrationPass_ ( PeakMap &  spectra,
FragmentIndex &  fragment_index,
const std::vector< FASTAFile::FASTAEntry > &  db,
const PeakMap *  query_spectra = nullptr 
) const
protected

Run a fast calibration pass on a subset of spectra to estimate mass accuracy.

Scores a TIC-ranked subset of spectra against the fragment index, collects precursor and fragment mass errors from high-confidence PSMs, and returns calibrated tolerances using median + 3*MAD estimation.

Parameters
[in]spectraPreprocessed MS/MS spectra (subset is selected internally by TIC).
[in,out]fragment_indexPre-built fragment index for candidate lookup.
[in]dbProtein database (for sequence reconstruction of candidates).
[in]query_spectraOptional spectra for candidate retrieval, aligned with spectra.
Returns
CalibrationResult_ with estimated tolerances, or success=false if insufficient PSMs.

◆ scoreSpectraAgainstIndex_()

void scoreSpectraAgainstIndex_ ( const PeakMap &  spectra,
FragmentIndex &  fi,
const std::vector< FASTAFile::FASTAEntry > &  db,
const SpectrumGenerators_ &  generators,
double  effective_fragment_tol,
bool  fragment_mass_tolerance_unit_ppm,
bool  open_search_mode,
std::vector< std::vector< AnnotatedHit_ > > &  annotated_hits,
std::vector< CandidatePoolStats_ > &  pool_stats,
const std::string &  progress_label,
const PeakMap *  query_spectra = nullptr 
) const
protected

Score all spectra against one FragmentIndex.

Shared by the non-chunked and chunked search paths. Appends per-scan AnnotatedHit_ entries to annotated_hits and prunes each spectrum to max(searchTopHits_(), 2) candidates to bound memory. Expects a pre-built FragmentIndex whose parameters already reflect any calibrated tolerances the caller wants to apply.

Parameters
[in]spectraPreprocessed MS2 spectra to score.
[in]fiPre-built FragmentIndex to query for candidates.
[in]dbDatabase the FragmentIndex was built from, used to reconstruct candidate sequences.
[in]generatorsGenerators for the theoretical spectrum of each candidate, chosen per spectrum.
[in]effective_fragment_tolFragment mass tolerance to score with (calibrated, if calibration ran).
[in]fragment_mass_tolerance_unit_ppmWhether effective_fragment_tol is in ppm rather than Da.
[in]open_search_modeWhether to record the precursor delta mass on each hit.
[in,out]annotated_hitsPer-spectrum candidate hits, one entry per spectrum.
[in,out]pool_statsPer-spectrum summary of the full (unpruned) candidate pool, one entry per spectrum. Accumulated rather than overwritten, so chunked callers can pass the same vector for every chunk.
[in]progress_labelLabel shown by the progress logger for this scoring pass.
[in]query_spectraOptional spectra for candidate retrieval, aligned with spectra (fragment:query_spectrum=raw); scoring always uses spectra.

◆ scoringMaxCharge_()

int scoringMaxCharge_ ( int  precursor_charge) const
inlineprotected

Fragment charges that score a candidate of the given precursor charge; also used by the calibration pass.

◆ scoringOrder_()

static std::vector< SignedSize > scoringOrder_ ( const PeakMap &  spectra,
const PeakMap *  query_spectra 
)
staticprotected

The order in which scoreSpectraAgainstIndex_() scores the spectra: the scan indices sorted by the neutral precursor mass of the first precursor (of query_spectra if given; an unknown charge counts as 1), ties by scan index; spectra without a finite mass at the end in scan order.

◆ search() [1/3]

ExitCodes search ( const std::string &  in_spectra,
const std::string &  in_db,
std::vector< ProteinIdentification > &  prot_ids,
PeptideIdentificationList &  pep_ids 
) const

Search spectra in a spectrum file (mzML or Bruker .d) against a protein database using an FI-backed workflow.

Populates protein and peptide identifications, including search meta data, PSM hits, and search engine annotations. Parameters are taken from this instance (DefaultParamHandler).

Parameters
[in]in_spectraInput path to the spectra file (mzML or Bruker .d) containing MS/MS spectra to search. An mzML file may also be a remote location (http://, https://, ftp:// or s3://, see FileHandler::isRemote()): it is streamed, and logged and stored (e.g. as primary MS run path) by its name without credentials and query (FileHandler::displayName()).
[in]in_dbInput path to the protein sequence database in FASTA format.
[out]prot_idsOutput container receiving search meta data and protein-level information.
[out]pep_idsOutput container receiving spectrum-level peptide identifications (PSMs).
Returns
ExitCodes indicating success (EXECUTION_OK) or the encountered error condition.

Side effects:

  • Updates ProgressLogger during processing.
  • Assigns identifiers and sets search engine name/version in prot_ids/pep_ids.

Errors:

  • May signal invalid parameters via ILLEGAL_PARAMETERS exit code.
  • May propagate OpenMS exceptions (e.g., I/O or parse errors) from underlying components.

◆ search() [2/3]

ExitCodes search ( PeakMap &  spectra,
const std::vector< FASTAFile::FASTAEntry > &  fasta_db,
std::vector< ProteinIdentification > &  prot_ids,
PeptideIdentificationList &  pep_ids 
) const

In-memory search: search spectra against a protein database without file I/O.

Same as the file-based search() but takes pre-loaded spectra and FASTA entries directly. Spectra are preprocessed in-place (filtered, deisotoped, normalized). With calibration:recalibrate, the precursor m/z and the peaks of the MS2 spectra also come back corrected by the measured m/z errors (the observed precursor m/z kept as meta value 'observed_precursor_mz' of the precursor).

Parameters
[in,out]spectraMS/MS spectra to search (preprocessed in-place; with calibration:recalibrate, m/z corrected).
[in]fasta_dbProtein sequence database as FASTA entries.
[out]prot_idsOutput protein-level identifications.
[out]pep_idsOutput spectrum-level peptide identifications (PSMs).
Returns
ExitCodes indicating success or error.

Internally this is a thin wrapper around prepareContext() + the context-taking search() overload, so the FragmentIndex is rebuilt on every call. For repeated searches against the same database, prefer calling prepareContext() once and reusing the resulting SearchContext.

◆ search() [3/3]

ExitCodes search ( PeakMap &  spectra,
SearchContext &  ctx,
std::vector< ProteinIdentification > &  prot_ids,
PeptideIdentificationList &  pep_ids 
) const

In-memory search using a pre-built SearchContext.

Searches spectra against the database and FragmentIndex held in ctx. The fragment index build cost (decoy generation, peptide/fragment generation, sorting, bucketing) is paid by prepareContext() and is not repeated here, making this overload the right choice when searching many spectrum files against the same database.

Parameters
[in,out]spectraMS/MS spectra to search (preprocessed in-place; with calibration:recalibrate, m/z corrected, as by the overload without a context).
[in,out]ctxPre-built SearchContext from prepareContext(). Taken by non-const reference because the underlying FragmentIndex query API is non-const, even though the index content is not modified during the search; the db member is also handed non-const to the downstream PeptideIndexing step (which requires a non-const reference).
[out]prot_idsOutput protein-level identifications.
[out]pep_idsOutput spectrum-level peptide identifications (PSMs).
Returns
ExitCodes indicating success or error.

◆ searchChunked_()

ExitCodes searchChunked_ ( PeakMap &  spectra,
std::vector< FASTAFile::FASTAEntry > &  full_db,
const DecoyStrategy_ &  strategy,
std::vector< ProteinIdentification > &  protein_ids,
PeptideIdentificationList &  peptide_ids 
) const
protected

Chunked database search implementation.

Splits full_db into chunks of database_chunk_size_ proteins, builds a FragmentIndex per chunk, scores all spectra against each chunk, and accumulates hits before a single post-processing pass. full_db is the already-resolved database (decoys generated/stripped per strategy); strategy carries the effective decoy marker for PeptideIndexing and FDR. Taken by non-const reference because PeptideIndexing::run() mutates it.

Returns
EXECUTION_OK on success; INPUT_FILE_EMPTY / UNEXPECTED_RESULT / UNKNOWN_ERROR on PeptideIndexing failure.

◆ searchCoIsolated_()

void searchCoIsolated_ ( const PeakMap &  spectra,
const std::vector< std::vector< AnnotatedHit_ > > &  annotated_hits,
FragmentIndex &  fi,
const std::vector< FASTAFile::FASTAEntry > &  db,
const SpectrumGenerators_ &  generators,
double  fragment_tol,
bool  fragment_tol_ppm,
bool  open_search_mode,
std::vector< CoIsolatedPSM_ > &  psms,
std::vector< std::vector< AnnotatedHit_ > > &  hits,
std::vector< CandidatePoolStats_ > &  pool_stats 
) const
protected

Search the precursors co-isolated with the selected one in what the spectrum's other PSMs leave of it (chimeric:enabled), after the andes chimeric cascade.

Runs one round per co-isolated precursor rank: round k searches the k-th co-isolated precursor (meta values of CoIsolationDetector::annotate()) of every spectrum with at least one hit, at its m/z and charge, against the spectrum without the peaks claimed so far. The best hit of the spectrum claims its peaks first, and the best hit of each co-isolated precursor (its winner) claims its peaks before the next round: every peak within the fragment tolerance of one of its theoretical ions. Hits with the best hit's peptide are left out. A co-isolated precursor is dropped when its winner repeats a PSM of the spectrum (the peptide and charge of a hit of the spectrum or of an earlier winner). The residual spectra are scored in batches and not kept.

Parameters
spectraThe searched spectra
annotated_hitsThe hits of each spectrum of spectra
fiThe fragment index of the search
dbThe searched database
generatorsTheoretical spectrum generators of the search
fragment_tolFragment mass tolerance
fragment_tol_ppmWhether fragment_tol is in ppm (else Da)
open_search_modeWhether the search is an open search
[out]psmsThe co-isolated PSMs, in spectrum order and, within a spectrum, in detection order
[out]hitsThe hits of each of psms (at most chimeric:top_hits and report:top_hits), the winner first
[out]pool_statsThe candidate-pool statistics of each of psms

◆ searched_()

static bool searched_ ( const SearchResult &  pf)
staticprotected

Helper: whether the file of pf was searched (exit code EXECUTION_OK, with a run)

◆ searchedFileOf_()

static int searchedFileOf_ ( const PeptideIdentification &  id,
const std::vector< SearchResult > &  per_file 
)
staticprotected

Helper: the file of per_file that a pooled PSM id comes from ('id_merge_index', see poolSearchedFiles_()), or -1 if it has none of a file that was searched

◆ searchTopHits_()

Size searchTopHits_ ( ) const
inlineprotected

The hits per spectrum that the search keeps (before the rescoring): without 'rescore' (or with decoys 'ignore', which leaves Percolator no decoys) report:top_hits; with it the hits Percolator rescores, and with a copy for a .pin (setKeepPreFdrPsms()) also the reported ones.

◆ searchWithModificationAnalysis() [1/4]

SearchResult searchWithModificationAnalysis ( const std::string &  in_spectra,
const std::string &  in_db,
const std::string &  output_base_name = "" 
) const

Search with comprehensive results including modification analysis tables.

This method performs a peptide database search and additionally returns structured modification analysis results for open search mode. This is the recommended method for modification discovery workflows.

The method automatically:

  • Detects open search mode based on precursor tolerance
  • Computes delta mass statistics
  • Maps delta masses to known modifications
  • Generates PTM statistics with residue localization
  • Writes TSV output files if output_base_name is provided
  • Applies FDR:protein as search() does, after the modification analysis
Parameters
in_spectraInput path to the spectra file (mzML or Bruker .d) containing MS/MS spectra
in_dbInput path to the protein sequence database in FASTA format
output_base_nameOptional base name for output files (TSV tables)
Returns
SearchResult containing identifications and modification analysis

Example usage:

Param p = algo.getParameters();
p.setValue("precursor:mass_tolerance_lower", 500.0); // Open search
p.setValue("precursor:mass_tolerance_upper", 500.0);
p.setValue("precursor:mass_tolerance_unit", "Da");
algo.setParameters(p);
auto result = algo.searchWithModificationAnalysis("spectra.mzML", "database.fasta", "output");
if (result.exit_code == ExitCodes::EXECUTION_OK && result.is_open_search)
{
// Access PTM statistics
for (const auto& ptm : result.modification_analysis.ptm_stats.entries)
{
std::cout << ptm.name << ": " << ptm.count << " PSMs" << std::endl;
}
// Access delta mass statistics
for (const auto& dm : result.modification_analysis.delta_mass_stats.entries)
{
std::cout << dm.delta_mass << " Da: " << dm.count << " PSMs" << std::endl;
}
}
const Param & getParameters() const
Non-mutable access to the parameters.
void setParameters(const Param &param)
Sets the parameters.
Management and storage of parameters / INI files.
Definition Param.h:46
void setValue(const std::string &key, const ParamValue &value, const std::string &description="", const std::vector< std::string > &tags=std::vector< std::string >())
Sets a value.
Fragment-index-based peptide database search algorithm (experimental).
Definition ProSEAlgorithm.h:59
SearchResult searchWithModificationAnalysis(const std::string &in_spectra, const std::string &in_db, const std::string &output_base_name="") const
Search with comprehensive results including modification analysis tables.

◆ searchWithModificationAnalysis() [2/4]

MultiFileSearchResult searchWithModificationAnalysis ( const std::vector< std::string > &  in_spectra_files,
const std::string &  in_db,
const std::vector< std::string > &  output_base_names = {},
const std::string &  aggregate_base_name = "",
bool  build_pooled_aggregate = true 
) const

Multi-file search with modification analysis (FASTA file path).

Convenience overload that loads the FASTA database from in_db and delegates to the in-memory multi-file overload. The database file path is recorded in each per-file ProteinIdentification's SearchParameters (and on the aggregate result).

build_pooled_aggregate is forwarded unchanged; see the in-memory overload for its exact effect on aggregate.

See also
searchWithModificationAnalysis(const std::vector<std::string>&, const std::vector<FASTAFile::FASTAEntry>&, const std::vector<std::string>&, const std::string&, bool) const

◆ searchWithModificationAnalysis() [3/4]

MultiFileSearchResult searchWithModificationAnalysis ( const std::vector< std::string > &  in_spectra_files,
const std::vector< FASTAFile::FASTAEntry > &  fasta_db,
const std::vector< std::string > &  output_base_names = {},
const std::string &  aggregate_base_name = "",
bool  build_pooled_aggregate = true 
) const

Multi-file search with modification analysis (in-memory FASTA).

Builds a single SearchContext (decoy generation + FragmentIndex) from fasta_db and reuses it across all input spectrum files. Each input file produces its own SearchResult including a per-file modification analysis (TSV written if a non-empty per-file base name is provided). An additional aggregate SearchResult is computed by pooling all per-file peptide identifications and running modification analysis once on the pooled set (see build_pooled_aggregate to skip retaining that second copy of every PSM).

Progress: the search of each input file is a progress step of its own, labelled "Searching &lt;file name&gt; (i of n)..." (i from 1, in input order). Consumers identify the per-file step by this label. Every start of a per-file step is balanced by its end, also if the search of the file fails or throws; the steps nested in it are not exception-safe (one that an exception leaves stays open). The steps of the search of the file (index build, filtering, scoring, ...) nest one level below it (depth 0 for the per-file step, depth 1 inside), but this nesting holds only with one OpenMP thread: with more, the background reading of the next mzML file shares the static step depth of the ProgressLogger, and the depths reported are not reliable. Chunk-major searches (database:chunk_size > 0 with a database of more proteins, decoys included, than the chunk size) emit no per-file step.

Parameters
[in]in_spectra_filesSpectrum file paths (mzML or Bruker .d). An mzML file may also be a remote location (http://, https://, ftp:// or s3://, see FileHandler::isRemote()): it is streamed, and logged and stored (e.g. as primary MS run path) by its name without credentials and query (FileHandler::displayName()).
[in]fasta_dbProtein sequence database as FASTA entries.
[in]output_base_namesOptional per-file base names for modification-analysis TSV outputs. Must be empty or have the same length as in_spectra_files. Empty entries skip TSV writing for that file.
[in]aggregate_base_nameOptional base name for the aggregate modification-analysis TSV output. Empty disables aggregate TSV writing (the aggregate analysis is still computed).
[in]build_pooled_aggregateWhether the pooled PSM set is retained in aggregate. Pooling copies every per-file PSM a second time, so callers that never read aggregate.peptide_ids should pass false. With false, aggregate.protein_ids and aggregate.peptide_ids come back empty (only is_open_search and exit_code are set); the aggregate modification analysis is unaffected — in open search the pooled set is still built internally, analyzed, and then released. Default true (unchanged behavior).
Returns
MultiFileSearchResult bundling per-file results and aggregate.

Errors:

◆ searchWithModificationAnalysis() [4/4]

SearchResult searchWithModificationAnalysis ( PeakMap &  spectra,
const std::vector< FASTAFile::FASTAEntry > &  fasta_db,
const std::string &  output_base_name = "" 
) const

In-memory search with modification analysis: no file I/O required.

Same as the file-based searchWithModificationAnalysis() but takes pre-loaded data.

Parameters
[in,out]spectraMS/MS spectra (preprocessed in-place; with calibration:recalibrate, m/z corrected).
[in]fasta_dbProtein sequence database as FASTA entries.
[in]output_base_nameOptional base name for TSV output files.
Returns
SearchResult containing identifications and modification analysis.

◆ searchWithModificationAnalysis_()

MultiFileSearchResult searchWithModificationAnalysis_ ( const std::vector< std::string > &  in_spectra_files,
const std::vector< FASTAFile::FASTAEntry > &  fasta_db_given,
const std::string *  in_db,
const std::vector< std::string > &  output_base_names,
const std::string &  aggregate_base_name,
bool  build_pooled_aggregate 
) const
protected

The multi-file searchWithModificationAnalysis() overloads: searches fasta_db_given, or, with in_db set, the database read from *in_db (while the first spectrum file is read in the background), whose entries the search then takes over instead of copying them.

◆ setFileResultConsumer()

void setFileResultConsumer ( FileResultConsumer  consumer)
inline

Lets the multi-file searchWithModificationAnalysis() overloads hand each file's result to consumer as soon as it is final, e.g. to write it while the next file is searched.

Called for every file but the last whose search succeeded, right after its search, unless the search changes the results of the files later: the rescoring is deferred (rescore_reuse 'joint' or 'static', for the files of the training), Percolator could not rescore the file on its own (with 'rescore', see rescoreFilesTogether_()), or the database is chunked. (The pooled aggregate is built from copies, after the consumers.) The results lack what the file-path overload sets after the search (SearchParameters::db of the first ProteinIdentification). The consumer runs on a helper thread with two of the OpenMP threads of the searching thread (one if it has fewer than 8), which the search takes back after the consumer returned, where it starts its next phase; the next file's search goes on meanwhile. Only one consumer runs at a time, and the search waits for the last one before it returns. If the searching thread has fewer threads than the machine has cores (then a read in the background takes threads from it, see BackgroundSpectra in the .cpp) or only one, the consumer runs on the searching thread itself, before the next file. Exceptions of the consumer are ignored: it handles its errors itself. An empty function (default) turns this off.

◆ setKeepPreFdrPsms()

void setKeepPreFdrPsms ( bool  keep)
inline

With keep = true, the multi-file searchWithModificationAnalysis() overloads also return the PSMs of each file before the rescoring ('rescore') and FDR:PSM, in SearchResult::pre_fdr_peptide_ids (e.g. for a Percolator .pin): the search engine scores, every reported hit and the decoys. Default: false (no copy).

◆ setParameterNamePrefix()

void setParameterNamePrefix ( const std::string &  prefix)
inline

The prefix under which the caller's user sets the parameters of this instance (e.g. 'Search:' in the ProSE tool): the messages of parameters it refuses name them with it (e.g. Search:precursor:min_charge). Set it before setParameters(). Default: none.

◆ spectrumGenerators_()

SpectrumGenerators_ spectrumGenerators_ ( ) const
protected

Generators for scoring, annotation and calibration, configured from the ions:* parameters.

◆ splitMergedPsms()

static void splitMergedPsms ( MergedResult &  merged,
MultiFileSearchResult &  result 
)
static

Makes the PSMs of each file of a multi-file search its part of the pooled result (mergeFileResults()), so that per-file outputs agree with the pooled one.

The pooled finalization of the protein FDR removes PSMs that the files still have: the PSMs all of whose proteins fail the protein FDR and, with its remove_decoys, the decoy PSMs; it also drops the peptide evidences of the proteins that failed. This moves the PSMs of merged (merged.peptide_ids, empty afterwards) into the files of result by their 'id_merge_index' (the input position of their file, which is removed), in their order, as the PSMs of the runs of the files (their identifiers). The proteins of each file become the proteins of the pooled run (merged.protein_ids) that its PSMs reference, with their pooled scores (e.g. the q-values of the protein FDR, with the pooled run's score type and inference engine) and the pooled indistinguishable groups and protein groups of these proteins (with their pooled scores), so that each file's outputs state why its proteins are there. Without a pooled run, the file keeps the proteins its PSMs reference (removeUnreportedProteins()). A file without a PSM in merged gets none. Store the pooled PSMs (e.g. as idXML) before.

Parameters
[in,out]mergedThe pooled result of result. Its PSMs are moved out.
[in,out]resultThe multi-file search that merged pools. The files that were searched (exit code EXECUTION_OK) get their PSMs from merged; the statistics stay (see updateFinalStats()).
Exceptions
Exception::IllegalArgument(and nothing changed) if a PSM of merged has no 'id_merge_index' of a file of result that was searched.

◆ stratumQValues()

static void stratumQValues ( PeptideIdentificationList &  peptide_ids)
static

rescoring:stratum_q_values: grouped target-decoy competition on the best hit of every spectrum that has the meta value percolator_score; stratum 'protein_nterm' (an evidence at a protein N-terminus, or only Met-clipped evidences: aa_before M at start 1) or 'other'; q = (decoys + 1) / max(targets, 1) in percolator_score order (ties: decoys first), monotone. Sets the meta values 'stratum' and 'stratum_q_value'; a best hit without percolator_score gets only 'stratum_q_value' = 1.

◆ tdcQValues_()

static void tdcQValues_ ( PeptideIdentificationList &  peptide_ids,
bool  plus_one = false 
)
staticprotected

Helper: target-decoy q-values of the PSMs of peptide_ids by their main scores, competing all together (FalseDiscoveryRate, decoys kept), and without a decoy PSM the conservative 1/T of the T PSMs instead of 0. With plus_one, the +1-corrected (D + 1) / T at every score, as Percolator estimates its q-values, also with decoys (for PSMs that Percolator scored, see rescoreFilesTogether_()).

◆ trainReuseModel_()

std::shared_ptr< const ReuseModel_ > trainReuseModel_ ( const std::vector< ReuseRun_ > &  runs,
int  threads 
) const
protected

rescore_reuse: trains the two cross-fitted models on PSMs of runs (see the parameter); throws if Percolator cannot train them

◆ transferQuota_()

Size transferQuota_ ( ) const
protected

The PSMs of a file rescored on its own that the model for the files too small for one of their own may train on (rescoreFilesTogether_()): percolator:max_train_psms / pool_files_ (no limit with max_train_psms 0)

◆ transferSample_()

static std::vector< Size > transferSample_ ( const PeptideIdentificationList &  ids,
Size  max_psms,
Size  hits_per_spectrum 
)
staticprotected

The spectra (positions in ids) of a seeded random sample of whole spectra with at most max_psms PSMs, counting at most hits_per_spectrum hits of a spectrum; in ascending order. A spectrum's place in the draw depends only on the spectrum (its reference, retention time and precursor m/z), so the sample of a list is also the sample of any of its sublists that contain it (the copy of a file reduced to it after the rescoring, see applyPsmFDR_()), and it is the same on every platform. Spectra without hits are left out.

◆ updateFinalStats()

static void updateFinalStats ( RunStatistics &  stats,
const PeptideIdentificationList &  peptide_ids,
const std::string &  enzyme,
bool  fdr_applied 
)
static

Recompute result-level statistics (matched count, unique peptide/protein counts, charge & missed-cleavage histograms, target/decoy counts and achieved PSM FDR) from a FINAL, post-processed PSM list. Use this when the identifications are mutated AFTER search() returns — e.g. the ProSE TOPP tool's Percolator rescoring + deferred FDR — so the report reflects what the user actually receives. Does NOT touch ms2_spectra, the HyperScore distribution (captured pre-FDR during the search) or any timing field. fdr_applied records whether a PSM-level FDR filter was applied; when true achieved_psm_fdr is set to the maximum retained q-value.

◆ updateMembers_()

void updateMembers_ ( )
overrideprotectedvirtual

This method is used to update extra member variables at the end of the setParameters() method.

Also call it at the end of the derived classes' copy constructor and assignment operator.

The default implementation is empty.

Reimplemented from DefaultParamHandler.

◆ useSearchEngineScore_()

static bool useSearchEngineScore_ ( PeptideIdentificationList &  ids)
staticprotected

Helper: makes SEARCH_ENGINE_SCORE the main score of every PSM of ids (IDScoreSwitcherAlgorithm; the former main score stays a meta value), if every PSM with hits has it (as main score or as meta value). Returns whether it did; otherwise ids is unchanged. For a set of PSMs of which Percolator rescored only some (see mergeFileResults()).

Member Data Documentation

◆ add_a_ions_

bool add_a_ions_ {false}
protected

◆ add_b_ions_

bool add_b_ions_ {true}
protected

◆ add_c_ions_

bool add_c_ions_ {false}
protected

◆ add_x_ions_

bool add_x_ions_ {false}
protected

◆ add_y_ions_

bool add_y_ions_ {true}
protected

◆ add_z_ions_

bool add_z_ions_ {false}
protected

◆ add_zp1_ions_

bool add_zp1_ions_ {false}
protected

◆ annotate_psm_

StringList annotate_psm_
protected

◆ calibration_enabled_

bool calibration_enabled_ {false}
protected

◆ calibration_min_fragment_tol_

double calibration_min_fragment_tol_ {0.0}
protected

calibration:min_fragment_tolerance (0: by unit)

◆ calibration_min_precursor_tol_

double calibration_min_precursor_tol_ {0.0}
protected

calibration:min_precursor_tolerance (0: by unit)

◆ calibration_min_psms_

Size calibration_min_psms_ {50}
protected

◆ calibration_precursor_sigma_factor_

double calibration_precursor_sigma_factor_ {0.0}
protected

calibration:precursor_sigma_factor (0: the precursor window is kept)

◆ calibration_recalibrate_

std::string calibration_recalibrate_ {"none"}
protected

calibration:recalibrate: none | offset | linear

◆ calibration_recalibrate_rt_chunks_

Size calibration_recalibrate_rt_chunks_ {1}
protected

calibration:recalibrate_rt_chunks

◆ calibration_sigma_factor_

double calibration_sigma_factor_ {4.0}
protected

calibration:sigma_factor (fragment)

◆ calibration_subset_ratio_

double calibration_subset_ratio_ {0.1}
protected

◆ chimeric_enabled_

bool chimeric_enabled_ {false}
protected

chimeric:enabled: also search the precursors co-isolated with the selected one

◆ CHIMERIC_RANK

constexpr const char* CHIMERIC_RANK = "chimeric_rank"
staticconstexpr

PSM meta value of a chimeric search (chimeric:enabled): 1 for a PSM of the selected precursor, 2 for one of a precursor co-isolated with it

◆ database_chunk_size_

Size database_chunk_size_ {0}
protected

0 = disabled; >0 = chunk DB into groups of this many proteins

◆ decoy_keep_termini_

bool decoy_keep_termini_ = false
protected

decoy_method 'keep_termini'

◆ decoy_mode_

DecoyMode_ decoy_mode_ {DecoyMode_::AUTO}
protected

◆ decoy_parity_report_

bool decoy_parity_report_ = false
protected

decoy_parity_report

◆ decoy_prefix_

std::string decoy_prefix_
protected

◆ deisotope_requested_

bool deisotope_requested_ {true}
protected

Resolved MS2 deisotoping request (param fragment:deisotope != "false"). preprocessSpectra_ still gates on Deisotoper::isToleranceSupported() so the deisotoper is never called out of range (it would throw -> terminate in the OpenMP region). See OpenMS#9619.

◆ deisotoping_

DeisotopingSettings_ deisotoping_
protected

MS2 deisotoping rule (fragment:deisotope_*)

◆ enzyme_

std::string enzyme_
protected

◆ fdr_protein_

double fdr_protein_ {0.0}
protected

◆ fdr_protein_inference_psm_

double fdr_protein_inference_psm_ {0.1}
protected

FDR:protein_inference_PSM: q-value cutoff of the PSMs of the protein inference.

◆ fdr_psm_

double fdr_psm_ {0.0}
protected

◆ fdr_psm_by_scored_charges_

bool fdr_psm_by_scored_charges_ {true}
protected

FDR:PSM_groups: separate competitions per number of scored fragment charges.

◆ file_result_consumer_

FileResultConsumer file_result_consumer_
protected

◆ fragment_mass_tolerance_

double fragment_mass_tolerance_
protected

◆ fragment_mass_tolerance_unit_

std::string fragment_mass_tolerance_unit_
protected

◆ inference_only_peptide_ids_

PeptideIdentificationList inference_only_peptide_ids_
mutableprotected

The PSMs of the most recent search(spectra, ctx, ...) that pass FDR:protein_inference_PSM but not FDR:PSM (only with FDR:protein, see SearchResult::inference_only_peptide_ids), bridged to the caller like last_run_stats_.

◆ ion_prior_feature_explained_

bool ion_prior_feature_explained_ {true}
protected

annotate:ion_prior_features holds ion_prior_explained

◆ ion_prior_feature_llr_

bool ion_prior_feature_llr_ {true}
protected

annotate:ion_prior_features holds ion_prior_llr

◆ ion_prior_feature_topk_

bool ion_prior_feature_topk_ {false}
protected

annotate:ion_prior_features holds ion_prior_topk_observed

◆ ion_prior_max_fragment_charge_

int ion_prior_max_fragment_charge_ {2}
protected

annotate:ion_prior_max_fragment_charge (capped at precursor charge - 1)

◆ ion_prior_min_psms_

Size ion_prior_min_psms_ {100}
protected

annotate:ion_prior_min_psms: training PSMs required per fold

◆ ion_prior_model_

annotate:ion_prior_model

◆ ion_prior_scored_peaks_

bool ion_prior_scored_peaks_ {false}
protected

annotate:ion_prior_peaks == scored

◆ ion_prior_train_fdr_

double ion_prior_train_fdr_ {0.01}
protected

annotate:ion_prior_train_fdr: TDC q-value threshold of the training PSMs

◆ ions_by_activation_

bool ions_by_activation_ {true}
protected

add c and z+1 ions for electron-activated spectra

◆ isotope_error_observed_minus_theoretical_

bool isotope_error_observed_minus_theoretical_ {true}
protected

report:isotope_error_convention: the PSMs report isotope_error as observed minus theoretical (true) or with the sign of the search offset, theoretical minus observed (false)

◆ keep_pre_fdr_psms_

bool keep_pre_fdr_psms_ = false
protected

◆ last_calibration_result_

CalibrationResult_ last_calibration_result_
mutableprotected

Most recent calibration result (valid after any search that invoked runCalibrationPass_). Stored for test observability and diagnostics. Marked mutable because it is pure diagnostic/telemetry state that doesn't affect the logical const-ness of search().

◆ last_mod_match_tolerance_used_

double last_mod_match_tolerance_used_ {-1.0}
mutableprotected

Scalar tolerance passed to OpenSearchModificationAnalysis on the most recent search() call. Stored for test observability: because the calibration writeback restores the tolerance members on exit (to avoid per-file state leaks in the multi-file wrapper), tests that want to verify "the mod analyzer received the calibrated value, not the user-configured one" can't just read the members post-search — they need to see what was actually passed to the analyzer. Default -1.0 (sentinel: no search has run yet).

◆ last_percolator_

PercolatorRescoring last_percolator_
mutableprotected

Percolator rescoring outcome of the most recent search(spectra, ctx, ...) call, bridged to SearchResult::percolator as last_run_stats_ is to SearchResult::stats.

◆ last_run_stats_

RunStatistics last_run_stats_
mutableprotected

Per-run statistics of the most recent search(spectra, ctx, ...) call. Bridges the const search() (which returns ExitCodes, not a SearchResult) to its callers, which copy this into SearchResult::stats. Reset at the start of each search() call. mutable for the same reason as above: pure diagnostic state, orthogonal to logical const-ness.

◆ mass_accuracy_score_

bool mass_accuracy_score_ {false}
protected

Resolved scoring:method: mass-accuracy weighted HyperScore.

◆ mass_error_sd_ppm_

double mass_error_sd_ppm_ {7.0}
protected

Width of the mass-accuracy kernel in ppm (scoring:mass_error_sd)

◆ MAX_DECOYS_PER_TARGET

constexpr double MAX_DECOYS_PER_TARGET = 2.0
staticconstexpr

See MIN_DECOYS_PER_TARGET.

◆ max_train_psms_

Size max_train_psms_ {500000}
protected

percolator:max_train_psms (0: no cap)

◆ MIN_DECOYS_PER_TARGET

constexpr double MIN_DECOYS_PER_TARGET = 0.5
staticconstexpr

With 'decoys' auto, the decoys of the database are reused only if there are at least this many decoys per target protein (and at most MAX_DECOYS_PER_TARGET); otherwise the search refuses the database (Exception::InvalidParameter)

◆ modifications_fixed_

StringList modifications_fixed_
protected

◆ modifications_max_variable_mods_per_peptide_

Size modifications_max_variable_mods_per_peptide_
protected

◆ modifications_variable_

StringList modifications_variable_
protected

◆ nterm_options_disabled_

bool nterm_options_disabled_ = false
mutableprotected

both switched off by buildDecoyAugmentedDB_()

◆ OBSERVED_COISOLATED_MZ

constexpr const char* OBSERVED_COISOLATED_MZ = "observed_coisolated_mz"
staticconstexprprotected

Meta value of a searched spectrum: the m/z of its co-isolated precursors (CoIsolationDetector::META_MZ) as observed, kept by applyRecalibration_() when it corrects them; searchCoIsolated_() reports them as OBSERVED_PRECURSOR_MZ

◆ OBSERVED_PRECURSOR_MZ

constexpr const char* OBSERVED_PRECURSOR_MZ = "observed_precursor_mz"
staticconstexprprotected

Meta value of the precursor of a searched spectrum: its m/z as observed, kept by applyRecalibration_() when calibration:recalibrate corrects the precursor m/z in place; postProcessHits_() reports it as the PSM's m/z

◆ parameter_name_prefix_

std::string parameter_name_prefix_
protected

◆ peaks_keep_n_

Size peaks_keep_n_ {0}
protected

NLargest cap on MS2 peaks before scoring; 0 = resolution-aware auto (peaks:keep_n)

◆ peaks_window_top_

Int peaks_window_top_ {20}
protected

WindowMower peaks-per-100Da before scoring (peaks:window_top)

◆ peaks_window_type_

std::string peaks_window_type_ {"auto"}
protected

Resolution-aware treatment of the final peak window.

◆ peptdeep_batch_size_

int peptdeep_batch_size_ {500}
protected

◆ peptdeep_enable_

bool peptdeep_enable_ {false}
protected

◆ peptdeep_instrument_

std::string peptdeep_instrument_ {"QE"}
protected

◆ peptdeep_ms2_model_

std::string peptdeep_ms2_model_
protected

◆ peptdeep_nce_

double peptdeep_nce_ {-1.0}
protected

◆ peptdeep_rt_model_

std::string peptdeep_rt_model_
protected

◆ peptdeep_rt_model_type_

std::string peptdeep_rt_model_type_ {"b_spline"}
protected

◆ peptide_enzyme_specificity_

EnzymaticDigestion::Specificity peptide_enzyme_specificity_ {EnzymaticDigestion::SPEC_FULL}
protected

◆ peptide_max_size_

Size peptide_max_size_
protected

◆ peptide_min_size_

Size peptide_min_size_
protected

◆ peptide_missed_cleavages_

Size peptide_missed_cleavages_
protected

◆ percolator_extra_

Param percolator_extra_
protected

rescore_method 'reset': Percolator's RESET parameters (empty: Percolator)

◆ percolator_training_

PercolatorTraining percolator_training_
protected

rescoring:...: options of Percolator's training

◆ pool_files_

Size pool_files_ = 0
mutableprotected

With pool_rescoring_: the input files of the multi-file search (for the share of the transfer model's training PSMs that a file rescored on its own keeps, transferQuota_())

◆ pool_rescoring_

bool pool_rescoring_ = false
mutableprotected

Set by the multi-file searches with 'rescore' while their files are searched: the PSMs of each file before the rescoring are kept (SearchResult::pre_fdr_peptide_ids) for rescoreFilesTogether_()

◆ pre_fdr_peptide_ids_

PeptideIdentificationList pre_fdr_peptide_ids_
mutableprotected

The PSMs of the most recent search(spectra, ctx, ...) before FDR:PSM (only with keep_pre_fdr_psms_), bridged to the caller like last_run_stats_.

◆ precursor_mass_tolerance_lower_

double precursor_mass_tolerance_lower_ {10.0}
mutableprotected

positive magnitude (default matches the param)

Calibration overwrites these with the calibrated magnitudes for the duration of search(); pure runtime-state mutation that does not affect the logical const-ness of search(), matching the mutable pattern used by last_calibration_result_.

◆ precursor_mass_tolerance_unit_

std::string precursor_mass_tolerance_unit_ {"ppm"}
protected

◆ precursor_mass_tolerance_upper_

double precursor_mass_tolerance_upper_ {10.0}
mutableprotected

positive magnitude (default matches the param)

◆ precursor_max_charge_

Size precursor_max_charge_
protected

◆ precursor_min_charge_

Size precursor_min_charge_
protected

◆ protein_mapping_from_index_

bool protein_mapping_from_index_ {true}
protected

peptide:protein_mapping = index

◆ query_raw_spectrum_

bool query_raw_spectrum_ {false}
protected

Retrieve candidates with the spectrum before deisotoping and local filtering (fragment:query_spectrum)

◆ released_hits_

std::shared_ptr<void> released_hits_
mutableprotected

The hits that the most recent rescoring dropped (all but the best per spectrum), destroyed by a helper thread meanwhile (see applyPsmFDR_()); the holder joins it when it goes (at the next rescoring of this object, or with the last copy of this object that shares it).

◆ report_top_hits_

Size report_top_hits_
protected

◆ rescore_

bool rescore_ {true}
protected

rescore: Percolator rescoring of every run before its PSM-level FDR

◆ rescore_top_hits_

Size rescore_top_hits_ {0}
protected

rescoring:top_hits: the hits per spectrum that the Percolator rescoring gets (0 = report_top_hits_)

◆ reset_run_name_

std::string reset_run_name_
mutableprotected

spectra file of the run being rescored (names its RESET stem table)

◆ reuse_defer_

bool reuse_defer_ = false
mutableprotected

rescore_reuse: the current search defers its rescoring and FDR:PSM to finishDeferredRescoring_()

◆ reuse_file_index_

Size reuse_file_index_ = 0
mutableprotected

rescore_reuse: the index of the file of the current search in a multi-file search (0 otherwise)

◆ reuse_max_shift_

double reuse_max_shift_ {0.5}
protected

rescore_reuse:max_shift

◆ reuse_max_train_

Size reuse_max_train_ {250000}
protected

rescore_reuse:max_train

◆ reuse_mode_

std::string reuse_mode_ {"per_file"}
protected

rescore_reuse:mode

◆ reuse_model_

std::shared_ptr<const ReuseModel_> reuse_model_
mutableprotected

rescore_reuse: the models of a multi-file search ('static': trained on its first files; null otherwise)

◆ reuse_static_files_

Size reuse_static_files_ {1}
protected

rescore_reuse:static_files

◆ scoring_max_charge_

int scoring_max_charge_ {2}
protected

Upper fragment charge bound (fragment:max_charge)

◆ scoring_multiple_charges_

bool scoring_multiple_charges_ {false}
protected

Resolved scoring:fragment_charges: score charges above 1.

◆ SEARCH_ENGINE_SCORE

constexpr const char* SEARCH_ENGINE_SCORE = "ln(hyperscore)"
staticconstexprprotected

ProSE's own PSM score (HyperScore, in log space): the main score of its PSMs, and after Percolator rescoring or FDR:PSM a meta value of this name (or with the suffix "_score", as FalseDiscoveryRate keeps it)

◆ self_trained_ion_priors_

bool self_trained_ion_priors_ {false}
protected

annotate:self_trained_ion_priors

◆ stratum_q_values_

bool stratum_q_values_ = false
mutableprotected

rescoring:stratum_q_values (effective)

◆ terminal_features_

bool terminal_features_ = false
mutableprotected

rescoring:terminal_features (effective)