30#include <unordered_map>
31#include <unordered_set>
38class TheoreticalSpectrumGenerator;
63 static constexpr const char* CHIMERIC_RANK =
"chimeric_rank";
67 static constexpr double MIN_DECOYS_PER_TARGET = 0.5;
69 static constexpr double MAX_DECOYS_PER_TARGET = 2.0;
95 Size charge_out_of_range_spectra = 0;
99 bool fdr_applied =
false;
100 double achieved_psm_fdr = -1.0;
105 bool score_stats_valid =
false;
106 double hyperscore_min = 0.0;
107 double hyperscore_median = 0.0;
108 double hyperscore_max = 0.0;
113 bool prec_tol_valid =
false;
114 double prec_err_median = 0.0, prec_err_mad = 0.0, prec_err_recommended = 0.0;
117 bool frag_tol_valid =
false;
118 double frag_err_median = 0.0, frag_err_mad = 0.0, frag_err_recommended = 0.0;
119 double seconds_search = 0.0;
120 double seconds_calibration = 0.0;
121 double seconds_fdr = 0.0;
136 double precursor_tol_lower = 0.0, precursor_tol_upper = 0.0;
138 double fragment_tol = 0.0;
140 Int min_charge = 0, max_charge = 0;
142 std::vector<std::string>
fixed_mods, variable_mods, ion_series;
143 bool open_search =
false;
144 bool calibration_enabled =
false;
145 bool peptide_mass_mode =
false;
146 bool chunked =
false;
148 double psm_fdr_threshold = 0.0, protein_fdr_threshold = 0.0;
153 double seconds_index_build = 0.0;
154 double seconds_total = 0.0;
155 double seconds_output = 0.0;
156 double seconds_qpx_extended = 0.0;
167 bool applied =
false;
190 bool is_open_search =
false;
254 bool decoy_is_prefix =
true;
256 bool have_decoys =
false;
270 bool protein_fdr_applied =
false;
283 std::vector<FASTAFile::FASTAEntry>
db;
295 bool release_fragment_index_after_scoring =
false;
303 bool decoy_is_prefix =
true;
306 bool have_decoys =
false;
311 bool electron_ions =
false;
336 const std::string& in_db,
337 std::vector<ProteinIdentification>& prot_ids,
392 const std::string& decoy_string,
393 bool decoy_is_prefix,
416 static std::string
inferProteins(std::vector<ProteinIdentification>& protein_ids,
498 Size max_train_psms = 0);
597 const std::string& in_db,
598 const std::string& output_base_name =
"")
const;
618 const std::vector<FASTAFile::FASTAEntry>& fasta_db,
619 std::vector<ProteinIdentification>& prot_ids,
681 std::vector<ProteinIdentification>& prot_ids,
695 const std::vector<FASTAFile::FASTAEntry>& fasta_db,
696 const std::string& output_base_name =
"")
const;
749 const std::vector<std::string>& in_spectra_files,
750 const std::vector<FASTAFile::FASTAEntry>& fasta_db,
751 const std::vector<std::string>& output_base_names = {},
752 const std::string& aggregate_base_name =
"",
753 bool build_pooled_aggregate =
true)
const;
769 const std::vector<std::string>& in_spectra_files,
770 const std::string& in_db,
771 const std::vector<std::string>& output_base_names = {},
772 const std::string& aggregate_base_name =
"",
773 bool build_pooled_aggregate =
true)
const;
828 bool remove_decoys =
true)
const;
863 keep_pre_fdr_psms_ = keep;
880 double delta_mass = 0.0;
881 float prefix_fraction = 0;
882 float suffix_fraction = 0;
883 float mean_error = 0.0f;
884 int isotope_error = 0;
885 uint16_t applied_charge = 0;
886 uint16_t matched_prefix_ions = 0;
887 uint16_t matched_suffix_ions = 0;
921 double second_best = 0.0;
930 if (score > best) { second_best = best; best = score; }
931 else if (score > second_best) { second_best = score; }
933 sumsq += score * score;
974 unsigned int min_peaks{3};
975 bool charge_cap_precursor{
false};
976 bool sum_intensity{
false};
994 double fragment_mass_tolerance,
995 bool fragment_mass_tolerance_unit_ppm,
996 bool deisotope_requested,
998 Int peaks_window_top,
999 const std::string& window_type,
1002 bool ion_evidence_scored_peaks =
false,
1003 PeakMap* evidence_spectra =
nullptr,
1004 PeakMap* query_spectra =
nullptr);
1008 double fragment_mass_tolerance,
1009 bool fragment_mass_tolerance_unit_ppm,
1010 bool deisotope_requested,
1012 Int peaks_window_top,
1013 const std::string& window_type =
"auto");
1043 std::vector<ProteinIdentification>& protein_ids,
1069 bool generate{
false};
1070 bool strip_existing{
false};
1071 bool have_decoys{
false};
1073 bool is_prefix{
true};
1075 bool strip_is_prefix{
true};
1087 const std::vector<FASTAFile::FASTAEntry>& db)
const;
1105 struct SpectrumGenerators_;
1113 double chance_match_surprise = 0.0;
1114 double mass_competition_evidence = 0.0;
1140 const std::vector<double>& densities,
1141 double tolerance,
bool ppm);
1148 const std::vector<double>& densities,
1149 double tolerance,
bool ppm,
1150 std::vector<double>& alternatives);
1166 const std::vector<FASTAFile::FASTAEntry>& fasta_db,
1171 std::vector<FASTAFile::FASTAEntry>&& fasta_db,
1178 const std::function<
const PeakMap*(
Size)>& searched_spectra = {})
const;
1222 const std::vector<std::vector<AnnotatedHit_>>& annotated_hits,
1224 const std::vector<FASTAFile::FASTAEntry>& db,
1225 const SpectrumGenerators_& generators,
1226 double fragment_tol,
1227 bool fragment_tol_ppm,
1228 bool open_search_mode,
1229 std::vector<CoIsolatedPSM_>& psms,
1230 std::vector<std::vector<AnnotatedHit_>>& hits,
1231 std::vector<CandidatePoolStats_>& pool_stats)
const;
1251 const std::vector<FASTAFile::FASTAEntry>& full_db)
const;
1268 std::vector<FASTAFile::FASTAEntry>& full_db,
1270 std::vector<ProteinIdentification>& protein_ids,
1300 const std::vector<FASTAFile::FASTAEntry>& db,
1301 const SpectrumGenerators_& generators,
1302 double effective_fragment_tol,
1303 bool fragment_mass_tolerance_unit_ppm,
1304 bool open_search_mode,
1305 std::vector<std::vector<AnnotatedHit_>>& annotated_hits,
1306 std::vector<CandidatePoolStats_>& pool_stats,
1307 const std::string& progress_label,
1308 const PeakMap* query_spectra =
nullptr)
const;
1343 std::vector<std::vector<ProSEAlgorithm::AnnotatedHit_> >& annotated_hits,
1344 const std::vector<CandidatePoolStats_>& pool_stats,
1345 std::vector<ProteinIdentification>& protein_ids,
1350 Int peptide_missed_cleavages,
1351 double precursor_mass_tolerance,
1352 double fragment_mass_tolerance,
1353 const std::string& precursor_mass_tolerance_unit_ppm,
1354 const std::string& fragment_mass_tolerance_unit_ppm,
1355 const Int precursor_min_charge,
1356 const Int precursor_max_charge,
1357 const std::string& enzyme,
1358 const std::string& database_name,
1359 const PeakMap* evidence_spectra =
nullptr,
1360 const std::vector<Size>* evidence_parent =
nullptr)
const;
1370 std::vector<ProteinIdentification>& protein_ids,
1373 bool peptdeep_enable_{
false};
1376 std::string peptdeep_instrument_{
"QE"};
1377 double peptdeep_nce_{-1.0};
1378 std::string peptdeep_rt_model_type_{
"b_spline"};
1379 int peptdeep_batch_size_{500};
1384 mutable double precursor_mass_tolerance_lower_{10.0};
1385 mutable double precursor_mass_tolerance_upper_{10.0};
1386 std::string precursor_mass_tolerance_unit_{
"ppm"};
1399 bool deisotope_requested_{
true};
1400 bool scoring_multiple_charges_{
false};
1401 int scoring_max_charge_{2};
1402 bool mass_accuracy_score_{
false};
1403 double mass_error_sd_ppm_{7.0};
1408 return scoring_multiple_charges_ ? std::max(1, std::min(precursor_charge - 1, scoring_max_charge_)) : 1;
1412 std::string peaks_window_type_ {
"auto"};
1414 bool query_raw_spectrum_{
false};
1427 bool rescore_{
true};
1429 double fdr_psm_{0.0};
1430 bool fdr_psm_by_scored_charges_{
true};
1431 double fdr_protein_{0.0};
1432 double fdr_protein_inference_psm_{0.1};
1436 bool self_trained_ion_priors_{
false};
1438 bool ion_prior_scored_peaks_{
false};
1439 int ion_prior_max_fragment_charge_{2};
1440 double ion_prior_train_fdr_{0.01};
1442 bool ion_prior_feature_llr_{
true};
1443 bool ion_prior_feature_explained_{
true};
1444 bool ion_prior_feature_topk_{
false};
1455 bool isotope_error_observed_minus_theoretical_{
true};
1457 bool add_a_ions_{
false};
1458 bool add_b_ions_{
true};
1459 bool add_c_ions_{
false};
1460 bool add_x_ions_{
false};
1461 bool add_y_ions_{
true};
1462 bool add_z_ions_{
false};
1463 bool add_zp1_ions_{
false};
1464 bool ions_by_activation_{
true};
1465 bool protein_mapping_from_index_{
true};
1469 bool calibration_enabled_{
false};
1470 double calibration_subset_ratio_{0.1};
1471 bool chimeric_enabled_{
false};
1483 double precursor_shift{0};
1484 double precursor_spread{0};
1485 double cal_lower{0};
1486 double cal_upper{0};
1487 double fragment_tolerance{0};
1488 double fragment_shift{0};
1489 bool extreme_bias{
false};
1490 bool success{
false};
1508 bool keep_pre_fdr_psms_ =
false;
1511 std::string
paramName_(
const std::string& name)
const {
return parameter_name_prefix_ + name; }
1516 mutable bool pool_rescoring_ =
false;
1533 mutable double last_mod_match_tolerance_used_{-1.0};
1547 if (precursor_mass_tolerance_lower_ <= 0.0)
return precursor_mass_tolerance_upper_;
1548 if (precursor_mass_tolerance_upper_ <= 0.0)
return precursor_mass_tolerance_lower_;
1549 return std::min(precursor_mass_tolerance_lower_, precursor_mass_tolerance_upper_);
1567 const std::vector<FASTAFile::FASTAEntry>& db,
1568 const PeakMap* query_spectra =
nullptr)
const;
1596 std::vector<std::unordered_map<std::string_view, Size>>
entries;
1603 if (entries.empty())
return sequences.size();
1604 const auto& table = entries[std::hash<std::string_view>{}(sequence) % SHARDS];
1605 const auto entry = table.find(sequence);
1606 return entry == table.end() ? sequences.size() : entry->second;
1620 const std::vector<FASTAFile::FASTAEntry>& db,
1621 std::vector<UInt32> candidates,
1622 const Param& indexer_parameters);
1633 const std::vector<FASTAFile::FASTAEntry>& db,
1634 const Param& indexer_parameters,
1635 std::vector<ProteinIdentification>& protein_ids,
1637 std::string& fallback_reason);
1642 const std::string& marker,
bool is_prefix);
1653 static constexpr const char* SEARCH_ENGINE_SCORE =
"ln(hyperscore)";
1747 int min_charge = std::numeric_limits<int>::max();
1748 int max_charge = std::numeric_limits<int>::min();
1786 const std::vector<TransferStratum_>& strata)
const;
1799 const std::vector<ProteinIdentification>& protein_ids,
1835 const std::string& enzyme,
1853 bool is_open_search,
1869 const std::vector<std::pair<std::string, std::vector<std::string>>>& manifest,
1878 return FragmentIndex::isOpenSearchMode(precursor_mass_tolerance_lower_,
1879 precursor_mass_tolerance_upper_,
1880 precursor_mass_tolerance_unit_ ==
"ppm");
Definition AASequence.h:96
A base class for all classes handling default parameters.
Definition DefaultParamHandler.h:66
Specificity
when querying for valid digestion products, this determines if the specificity of the two peptide end...
Definition EnzymaticDigestion.h:41
Generates from a set of Fasta files a 2D-datastructure which stores all theoretical masses of all b a...
Definition FragmentIndex.h:36
Compact peak lists of the spectra of one run: per peak only its m/z and its intensity-rank bin.
Definition FragmentIonLikelihoodModel.h:82
ContextSet
Ion contexts and outcomes the model distinguishes.
Definition FragmentIonLikelihoodModel.h:60
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
The representation of a 1D spectrum.
Definition MSSpectrum.h:44
Combined result of open search modification analysis.
Definition OpenSearchModificationAnalysis.h:106
Management and storage of parameters / INI files.
Definition Param.h:46
Container for peptide identifications from multiple spectra.
Definition PeptideIdentificationList.h:66
Represents the set of candidates (SpectrumMatches) identified for a single precursor spectrum.
Definition PeptideIdentification.h:66
Precursor meta information.
Definition Precursor.h:37
Fragment-index-based peptide database search algorithm (experimental).
Definition ProSEAlgorithm.h:57
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.
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 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 std::vector< Size > stratifiedQuotas_(const std::vector< Size > &sizes, Size cap)
std::string enzyme_
Definition ProSEAlgorithm.h:1422
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 MSSpectrum residualSpectrum_(const MSSpectrum &spectrum, const std::vector< UInt32 > &removed, const Precursor &precursor)
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
PercolatorRescoring last_percolator_
Definition ProSEAlgorithm.h:1507
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().
FragmentIndex fragment_index
Definition ProSEAlgorithm.h:284
std::string fragment_tol_unit
Definition ProSEAlgorithm.h:139
Size peptide_max_size_
Definition ProSEAlgorithm.h:1447
static void updateFinalStats(RunStatistics &stats, const PeptideIdentificationList &peptide_ids, const std::string &enzyme, bool fdr_applied)
PercolatorRescoring percolator
Outcome of the Percolator rescoring of this run (parameter 'rescore')
Definition ProSEAlgorithm.h:193
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 exis...
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.
void rescoreFilesTogether_(MultiFileSearchResult &mfres, const std::vector< std::string > &in_spectra_files, const std::vector< TransferStratum_ > &strata) const
The end of a multi-file search with 'rescore' (with pool_rescoring_), for the files with PSMs that Pe...
Size precursor_max_charge_
Definition ProSEAlgorithm.h:1389
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 t...
Size precursor_min_charge_
Definition ProSEAlgorithm.h:1388
std::string decoy_prefix_
Definition ProSEAlgorithm.h:1425
RunStatistics stats
Definition ProSEAlgorithm.h:191
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 setParameterNamePrefix(const std::string &prefix)
Definition ProSEAlgorithm.h:856
Size report_top_hits_
Definition ProSEAlgorithm.h:1452
Size modifications_max_variable_mods_per_peptide_
Definition ProSEAlgorithm.h:1420
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 eve...
static void renderModificationSummary(const OpenSearchModificationAnalysis::OpenSearchAnalysisResult &mod_analysis, std::ostream &os)
std::string warning
Definition ProSEAlgorithm.h:172
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.
void setKeepPreFdrPsms(bool keep)
Definition ProSEAlgorithm.h:861
Precursor precursor
the co-isolated precursor: that of the spectrum with its m/z and charge
Definition ProSEAlgorithm.h:1193
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...
std::string input_file
spectrum file this run searched (basename or path)
Definition ProSEAlgorithm.h:92
SearchContext prepareContext_(std::vector< FASTAFile::FASTAEntry > &&fasta_db, bool electron_ions, const std::function< const PeakMap *(Size)> &searched_spectra={}) const
PeptideIdentificationList pre_fdr_peptide_ids
Definition ProSEAlgorithm.h:194
std::map< Int, Size > charge_histogram
precursor charge -> PSM count
Definition ProSEAlgorithm.h:103
SpectrumGenerators_ spectrumGenerators_() const
Generators for scoring, annotation and calibration, configured from the ions:* parameters.
StringList modifications_fixed_
Definition ProSEAlgorithm.h:1416
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).
std::string parameter_name_prefix_
Definition ProSEAlgorithm.h:1509
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())...
static void capturePreFdrStats_(const PeptideIdentificationList &peptide_ids, RunStatistics &stats)
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.
void annotatePsmQValues(PeptideIdentificationList &peptide_ids) const
Annotate PSM q-values by target-decoy competition of the best hit of each spectrum,...
static bool hasPSMs_(const PeptideIdentificationList &ids)
Helper: whether a PSM of ids has a hit.
std::vector< UInt32 > removed
the peaks of the spectrum that its residual spectrum leaves out (ascending)
Definition ProSEAlgorithm.h:1194
static int searchedFileOf_(const PeptideIdentification &id, const std::vector< SearchResult > &per_file)
std::vector< ProteinIdentification > protein_ids
Definition ProSEAlgorithm.h:187
bool restrictIndexToSpectra_() const
Definition ProSEAlgorithm.h:1183
bool chimericSearch_() const
Definition ProSEAlgorithm.h:1187
Size peptide_min_size_
Definition ProSEAlgorithm.h:1446
SpectraCounts_ countSpectra_(const PeakMap &spectra) const
Helper: the SpectraCounts_ of spectra.
std::vector< FASTAFile::FASTAEntry > buildDecoyAugmentedDB_(const std::vector< FASTAFile::FASTAEntry > &fasta_db, const DecoyStrategy_ &strategy) const
Build the searched database according to strategy.
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 agg...
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 instanc...
SearchResult aggregate
Definition ProSEAlgorithm.h:247
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).
void annotatePeptDeepFeatures_(const PeakMap &spectra, std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids) const
Adds PeptDeep-prediction-derived rescoring features to the PSMs.
std::string database_file
FASTA path (empty for in-memory db)
Definition ProSEAlgorithm.h:134
static AASequence reversedNoiseSequence_(const AASequence &sequence)
Reversed sequence keeping the C-terminal residue and every residue's modification: the noise hypothes...
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.
static StringList percolatorFeatureSet_(const ProteinIdentification &run, int min_charge, int max_charge)
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.
std::string strip_string
marker of pre-existing decoys to strip
Definition ProSEAlgorithm.h:1074
std::map< Size, Size > missed_cleavage_histogram
missed cleavages -> PSM count
Definition ProSEAlgorithm.h:104
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.
RunStatistics last_run_stats_
Definition ProSEAlgorithm.h:1503
std::string fragment_mass_tolerance_unit_
Definition ProSEAlgorithm.h:1393
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 ev...
StringList annotate_psm_
Definition ProSEAlgorithm.h:1434
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 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 bool rescoredOnItsOwn_(const SearchResult &pf)
Helper: whether the file of pf was searched and Percolator rescored it on its own (with 'rescore')
Param fragmentIndexParameters_(bool electron_ions=false) const
ProSE parameters made safe to hand to a FragmentIndex.
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.
OpenSearchModificationAnalysis::OpenSearchAnalysisResult modification_analysis
Definition ProSEAlgorithm.h:189
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 w...
std::vector< FASTAFile::FASTAEntry > db
Definition ProSEAlgorithm.h:283
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 ...
static bool accessionHasDecoyMarker_(const std::string &accession, const std::string &marker, bool is_prefix)
static void renderRunSummary(const RunStatistics &stats, const SharedSearchStats &shared, const OpenSearchModificationAnalysis::OpenSearchAnalysisResult &mod_analysis, bool is_open_search, std::ostream &os)
ExitCodes search(PeakMap &spectra, SearchContext &ctx, std::vector< ProteinIdentification > &prot_ids, PeptideIdentificationList &pep_ids) const
In-memory search using a pre-built SearchContext.
SharedSearchStats shared
Definition ProSEAlgorithm.h:260
bool isOpenSearchMode_() const
Helper function to determine if open search should be used based on tolerance.
Definition ProSEAlgorithm.h:1876
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 limitPreRescoringPsms_(std::vector< SearchResult > &per_file, Size i, std::vector< TransferStratum_ > &strata) const
In a multi-file search with 'rescore' (pool_rescoring_), right after file i of per_file was searched ...
PeptideIdentificationList inference_only_peptide_ids
Definition ProSEAlgorithm.h:200
void collectInferenceOnlyPsms_(const PeptideIdentificationList &peptide_ids, double psm_fdr, PeptideIdentificationList &inference_only_psms) const
std::string decoy_string
Definition ProSEAlgorithm.h:252
DecoyStrategy_ resolveDecoyStrategy_(const std::vector< FASTAFile::FASTAEntry > &db) const
Decide how to obtain/recognise decoys for db.
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)
DeisotopingSettings_ deisotoping_
MS2 deisotoping rule (fragment:deisotope_*)
Definition ProSEAlgorithm.h:1413
std::vector< FASTAFile::FASTAEntry > buildCalibrationSample_(const std::vector< FASTAFile::FASTAEntry > &full_db) const
Build a strided protein sample for chunked calibration.
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.
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.
static void returnPooledPsms_(PeptideIdentificationList &pooled, std::vector< SearchResult > &per_file)
static bool isElectronActivated_(const MSSpectrum &spectrum)
True if the precursor of spectrum was activated by electrons (ETD, ECD, EThcD or ETciD)
bool keepPreRescoringPsms_() const
Whether a search keeps the PSMs of each file before the rescoring (SearchResult::pre_fdr_peptide_ids)
Definition ProSEAlgorithm.h:1518
std::string paramName_(const std::string &name) const
Helper: name as the user sets the parameter (setParameterNamePrefix()), for messages.
Definition ProSEAlgorithm.h:1511
std::string decoy_mode
"generated" | "external" | "none (target-only)"
Definition ProSEAlgorithm.h:147
PeptideIdentificationList peptide_ids
Definition ProSEAlgorithm.h:188
std::string enzyme
Definition ProSEAlgorithm.h:135
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)
std::string skipped_reason
Why the PSMs were not rescored, as a sentence to show to the user (empty if applied or not attempted)
Definition ProSEAlgorithm.h:169
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
static Param percolatorParameters_(int threads, Size max_train_psms)
Helper: the Percolator parameters of rescoreWithPercolator() (training cap max_train_psms,...
static void tdcQValues_(PeptideIdentificationList &peptide_ids, bool plus_one=false)
ExitCodes
Exit codes.
Definition ProSEAlgorithm.h:73
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) const
Filter and annotate search results.
StringList modifications_variable_
Definition ProSEAlgorithm.h:1418
static double maxRetainedScore_(const PeptideIdentificationList &peptide_ids)
PeptideIdentificationList pre_fdr_peptide_ids_
Definition ProSEAlgorithm.h:1521
std::vector< SearchResult > per_file
Definition ProSEAlgorithm.h:246
double fragment_mass_tolerance_
Definition ProSEAlgorithm.h:1391
PeptideIdentificationList inference_only_peptide_ids_
Definition ProSEAlgorithm.h:1524
SearchContext prepareContext(const std::vector< FASTAFile::FASTAEntry > &fasta_db) const
Build a SearchContext (decoy-augmented database + FragmentIndex) for reuse.
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....
int scoringMaxCharge_(int precursor_charge) const
Fragment charges that score a candidate of the given precursor charge; also used by the calibration p...
Definition ProSEAlgorithm.h:1406
static void removeProteinsReferencedByNeither_(std::vector< ProteinIdentification > &protein_ids, const PeptideIdentificationList &peptide_ids, const PeptideIdentificationList &also_referencing)
std::vector< Size > draw
Definition ProSEAlgorithm.h:1752
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.
Size peptide_missed_cleavages_
Definition ProSEAlgorithm.h:1448
CalibrationResult_ last_calibration_result_
Definition ProSEAlgorithm.h:1496
double computeModMatchTolerance_() const
Definition ProSEAlgorithm.h:1545
static void poolSearchedFiles_(std::vector< SearchResult > &per_file, bool move_psms, const StringList &in_spectra_files, std::vector< ProteinIdentification > &protein_ids, PeptideIdentificationList &peptide_ids)
void collectRunStatistics_(const PeakMap &spectra, const std::vector< ProteinIdentification > &protein_ids, const PeptideIdentificationList &peptide_ids, RunStatistics &stats) const
std::vector< std::string > fixed_mods
Definition ProSEAlgorithm.h:142
static bool useSearchEngineScore_(PeptideIdentificationList &ids)
std::string peptdeep_ms2_model_
Definition ProSEAlgorithm.h:1374
static bool searched_(const SearchResult &pf)
Helper: whether the file of pf was searched (exit code EXECUTION_OK, with a run)
std::string precursor_tol_unit
Definition ProSEAlgorithm.h:137
DecoyMode_
How decoys are obtained/recognised for a search (parameter "decoys").
Definition ProSEAlgorithm.h:1054
static void markRescoredByPercolator_(std::vector< ProteinIdentification > &protein_ids, const Param &pp)
Helper: marks protein_ids as post-processed by Percolator (with parameters pp), as PercolatorAdapter ...
std::string peptdeep_rt_model_
Definition ProSEAlgorithm.h:1375
void preprocessSearchedSpectra_(PeakMap &spectra, const std::string &input, FragmentIonLikelihoodModel::PeakLists &ion_evidence, PeakMap *evidence_spectra, PeakMap *query_spectra) const
Result of a calibration pass.
Definition ProSEAlgorithm.h:1482
The PSM of a precursor co-isolated with the selected one (chimeric:enabled), until its residual spect...
Definition ProSEAlgorithm.h:1191
Resolved decoy handling for one concrete input database.
Definition ProSEAlgorithm.h:1068
MS2 deisotoping rule of preprocessSpectra_().
Definition ProSEAlgorithm.h:973
Local fragment evidence of one candidate (annotate:local_fragment_evidence).
Definition ProSEAlgorithm.h:1112
The pooled evaluation of a multi-file search (the ProSE tool's -out_merged).
Definition ProSEAlgorithm.h:265
Multi-file search result bundle.
Definition ProSEAlgorithm.h:245
Outcome of the Percolator rescoring of one search run (see rescoreWithPercolator() and the parameter ...
Definition ProSEAlgorithm.h:165
Per-run identification statistics for the end-of-search report.
Definition ProSEAlgorithm.h:91
Prepared per-database state shared across multiple spectrum files.
Definition ProSEAlgorithm.h:282
Comprehensive search result including modification analysis.
Definition ProSEAlgorithm.h:185
Configuration, database and fragment-index facts shared across all input files of one ProSE invocatio...
Definition ProSEAlgorithm.h:133
Definition ProSEAlgorithm.h:1806
Definition ProSEAlgorithm.h:1745
Base class for all classes that want to report their progress.
Definition ProgressLogger.h:28
Representation of a protein identification run.
Definition ProteinIdentification.h:55
int Int
Signed integer type.
Definition Types.h:72
uint32_t UInt32
Unsigned integer type (32bit)
Definition Types.h:33
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< std::string > StringList
Vector of String.
Definition TypeAliases.h:39
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Slimmer structure as storing all scored candidates in PeptideHit objects takes too much space.
Definition ProSEAlgorithm.h:872
static bool hasBetterScore(const AnnotatedHit_ &a, const AnnotatedHit_ &b)
Definition ProSEAlgorithm.h:890
double score
main score
Definition ProSEAlgorithm.h:879
AASequence sequence
Definition ProSEAlgorithm.h:873
Running summary of the complete candidate pool of one spectrum.
Definition ProSEAlgorithm.h:917
std::unordered_set< std::string > seen_candidates
Definition ProSEAlgorithm.h:925
void add(double score)
Fold one freshly scored candidate into the summary.
Definition ProSEAlgorithm.h:928
double deltaScore() const
Best minus runner-up over the full pool.
Definition ProSEAlgorithm.h:938
double zScore() const
How much of an outlier the best score is within its own candidate pool.
The protein occurrences of the sequences of a search's hits (peptide:protein_mapping = index).
Definition ProSEAlgorithm.h:1588
std::vector< std::string_view > sequences
The unmodified hit sequences (views into the database), one entry each.
Definition ProSEAlgorithm.h:1592
std::string fallback_reason
Why PeptideIndexing has to run instead; empty if the mapping applies.
Definition ProSEAlgorithm.h:1598
Size find(std::string_view sequence) const
The entry of sequence, or sequences.size() if there is none.
Definition ProSEAlgorithm.h:1601
std::vector< std::vector< std::pair< UInt32, UInt32 > > > occurrences
Per entry: its occurrences {protein index, position}, ascending (PeptideIndexing's evidence order)
Definition ProSEAlgorithm.h:1594
std::vector< std::unordered_map< std::string_view, Size > > entries
Sequence -> entry, in SHARDS hash tables.
Definition ProSEAlgorithm.h:1596