Repository navigation
Fragment index search engine - #8219
Conversation
So far MultiPeaks only single charged!
…OpenMS into feature/fi_search_engine # Conflicts: # src/openms/source/ANALYSIS/ID/FragmentIndex.cpp
…Scorer are now relocated to FragmentIndex. BuildMinHeap was replaced by std::partial_sort
…dex3D and reformate structs. Fix query bug
- Replaced all push_back with emplace_back and added reserves
- build now parallelized; - added tests
Refactoring FragmentIndex
…engine # Conflicts: # src/openms/include/OpenMS/ANALYSIS/ID/sources.cmake
WalkthroughAdds an experimental fragment-index (FI) peptide-search implementation: new public classes Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant CLI as TOPP:PeptideDataBaseSearchFI
participant Algo as PeptideSearchEngineFIAlgorithm
participant FI as FragmentIndex
participant TSG as TheoreticalSpectrumGenerator
participant IO as FileHandler/IDXML
User->>CLI: run --in mzML --database FASTA --out idXML
CLI->>Algo: search(in_mzML, in_db, prot_ids, pep_ids)
rect rgb(240,250,255)
Algo->>FI: build(FASTA entries)
FI->>TSG: getPrefixAndSuffixIonsMZ(peptide, charge)
TSG-->>FI: fragment m/z list
FI-->>Algo: index built
end
rect rgb(240,255,240)
Algo->>Algo: preprocess spectra (filter/deisotope/normalize)
loop per spectrum
Algo->>FI: querySpectrum(spectrum)
FI-->>Algo: candidate matches
Algo->>Algo: score & annotate (HyperScore, ranks)
end
end
Algo-->>CLI: prot_ids, pep_ids, ExitCode
CLI->>IO: store(out.idXML)
IO-->>CLI: done
CLI-->>User: exit
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 12
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cpp (1)
175-178: Fix DEBUG logs: references to out-of-scope variables break debug builds.Within
createIonCentricFragmentAnnotationsForUnshiftedIons(...), theDEBUG_OpenNuXLblocks referencefixed_and_variable_modified_peptideandaas, which are not in scope here. IfDEBUG_OpenNuXLis defined, this will not compile. Suggest removing the peptide output or passing required context as parameters.Apply this minimal, safe diff to avoid the undefined identifiers while keeping useful logging:
#ifdef DEBUG_OpenNuXL - const AASequence& peptide_sequence = fixed_and_variable_modified_peptide.getSuffix(ion_number); - OPENMS_LOG_DEBUG << "Annotating ion: " << ion_name << " at position: " << fragment_mz << " " << peptide_sequence.toString() << " intensity: " << fragment_intensity << endl; + OPENMS_LOG_DEBUG << "Annotating ion(y): " << ion_name + << " m/z: " << fragment_mz + << " intensity: " << fragment_intensity + << " ion_number: " << ion_number << endl; #endif#ifdef DEBUG_OpenNuXL - const AASequence& peptide_sequence = aas.getPrefix(ion_number); - OPENMS_LOG_DEBUG << "Annotating ion: " << ion_name << " at position: " << fragment_mz << " " << peptide_sequence.toString() << " intensity: " << fragment_intensity << endl; + OPENMS_LOG_DEBUG << "Annotating ion(b): " << ion_name + << " m/z: " << fragment_mz + << " intensity: " << fragment_intensity + << " ion_number: " << ion_number << endl; #endif#ifdef DEBUG_OpenNuXL - const AASequence& peptide_sequence = aas.getPrefix(ion_number); - OPENMS_LOG_DEBUG << "Annotating ion: " << ion_name << " at position: " << fragment_mz << " " << peptide_sequence.toString() << " intensity: " << fragment_intensity << endl; + OPENMS_LOG_DEBUG << "Annotating ion(a): " << ion_name + << " m/z: " << fragment_mz + << " intensity: " << fragment_intensity + << " ion_number: " << ion_number << endl; #endifAlso applies to: 202-205, 232-234
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.h (1)
202-205: Bug: invalid String initialization (likely UB/segfault).
String localization_scores = 0;should be an empty String.Apply:
- String localization_scores = 0; + String localization_scores;
🧹 Nitpick comments (55)
src/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cpp (6)
37-45: Include for std::fabs.
equal_by_massusesstd::fabsbut<cmath>isn’t included locally.Apply:
#include <algorithm> +#include <cmath>
160-181: Guard against short/empty spec strings.
t[1]is accessed without checkingt.size() >= 2.- char target_nucleotide = t[0]; - if (t[1] != ':') + if (t.size() < 2) + { + OPENMS_LOG_WARN << "Too short fragment_adduct string: " << t << endl; + return NucleotideToFragmentAdductMap(); + } + char target_nucleotide = t[0]; + if (t[1] != ':') { OPENMS_LOG_WARN << "Missing ':'. Wrong format of fragment_adduct string: " << t << endl; return NucleotideToFragmentAdductMap(); }
230-241: Broken DEBUG block: wrong identifier.
precursor_to_fragment_adductsis undefined here; should benucleotide_to_fragment_adducts. This will fail whenDEBUG_OpenNuXLis defined.- for (auto const & p2fas : precursor_to_fragment_adducts) + for (auto const & p2fas : nucleotide_to_fragment_adducts)
307-309: Use OpenMS logging instead of std::cout.
Aligns with project logging and verbosity controls.- cout << "Mandatory cross-linking nt/sugar: " << *must_xl.begin() << " in precursor adduct: " << exp_pc_adduct << endl; + OPENMS_LOG_INFO << "Mandatory cross-linking nt/sugar: " << *must_xl.begin() + << " in precursor adduct: " << exp_pc_adduct << endl;
318-319: Clarify log message.
Message says “1 = true, >1 = false” but printsnt_count. Slightly confusing; consider printing a boolean flag or rephrasing.
405-426: Micro‑allocations for default marker ions.
You construct identicalEmpiricalFormulaobjects repeatedly. Consider static locals to avoid repeated parsing when this path is hot.src/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cpp (2)
80-108: Use tolerance for duplicate m/z comparison to avoid floating-point equality pitfalls.Exact double equality can miss near-duplicates caused by rounding or small calc diffs; use an absolute m/z tolerance.
Apply:
static void removeDuplicatedPeaks(MSSpectrum& spec) { if (spec.empty()) return; std::vector<Size> indices_to_keep; indices_to_keep.push_back(0); // Always keep the first peak for (Size i = 1; i < spec.size(); ++i) { // Compare the current peak's m/z with the last kept peak's m/z - if (spec[i].getMZ() != spec[indices_to_keep.back()].getMZ()) + if (std::fabs(spec[i].getMZ() - spec[indices_to_keep.back()].getMZ()) > 1e-6) { indices_to_keep.push_back(i); }And add (outside this hunk) near the includes:
#include <cmath>
25-25: Unify debug macro name.Both
DEBUG_OpenNuXLandOPENUXL_DEBUGare used; standardize to one macro to avoid confusion and dead code.Also applies to: 503-508, 742-746
src/openms/source/APPLICATIONS/ToolHandler.cpp (1)
153-154: Alphabetical order violation in tool list.Per file comment, keep tools alphabetically sorted. “PeptideDataBaseSearchFI” should come before “PeptideIndexer”.
Apply:
- tools_map["PeptideIndexer"] = Internal::ToolDescription("PeptideIndexer", cat_ID_proc); - tools_map["PeptideDataBaseSearchFI"] = Internal::ToolDescription("PeptideDataBaseSearchFI", cat_ID_search); + tools_map["PeptideDataBaseSearchFI"] = Internal::ToolDescription("PeptideDataBaseSearchFI", cat_ID_search); + tools_map["PeptideIndexer"] = Internal::ToolDescription("PeptideIndexer", cat_ID_proc);Also mirror this in doc/doxygen (TOPP.doxygen).
src/topp/executables.cmake (1)
102-104: Optional: keep list alphabetically consistent.Consider placing PeptideDataBaseSearchFI before PeptideIndexer for consistency with ToolHandler.
-PeptideIndexer -PeptideDataBaseSearchFI +PeptideDataBaseSearchFI +PeptideIndexersrc/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h (4)
21-29: Typos and clarity in class brief.“skiped” -> “skipped”; clarify bottom‑up/top‑down sentence.
- * The FI has two options: Bottom-up and Top Down. In later digestion is skiped and the fragments have a direct - * reference to the mass of the proteins instead of digested peptides. + * The FI supports bottom‑up and top‑down modes. In the latter, digestion is skipped and fragments reference + * the parent protein mass directly instead of digested peptides.
67-85: Consider merging/compacting candidates instead of raw concatenation.
operator+=blindly appends; if the same peptide appears across charges/isotope errors, merge counts to reduce memory beforetrimHits.
171-180: Type choice for m/z values.Storing fragment m/z as float may lose precision for high‑res data; consider double if memory allows.
37-37: Style nit: remove redundant blank line (CodeFactor).- struct Peptide { - + struct Peptide {src/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cpp (1)
38-42: Update START_SECTION signature to current API.
The displayed signature is outdated vs the header (missing nt_groups, can_xl). Update to avoid confusion.-START_SECTION((static NuXLModificationMassesResult initModificationMassesNA(StringList target_nucleotides, StringList mappings, StringList restrictions, StringList modifications, String sequence_restriction, bool cysteine_adduct, Int max_length=4))) +START_SECTION((static NuXLModificationMassesResult initModificationMassesNA(const StringList& target_nucleotides, + const StringList& nt_groups, + const std::set<char>& can_xl, + const StringList& mappings, + const StringList& modifications, + String sequence_restriction = "", + bool cysteine_adduct = false, + Int max_length = 4)))src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.h (2)
60-76: Use Doxygen style and document parameters.
Promote the block comment to proper Doxygen and clarify nt_groups/can_xl semantics.- /* @brief generate all combinations of precursor adducts + /** @brief Generate all combinations of precursor adducts. + * + * @param target_nucleotides List like "U=C10H14N5O7P" (nt -> monophosphate formula). + * @param nt_groups Groups of nucleotides (e.g., "ACGT", "ACGU") used to prevent mixing groups. + * @param can_xl Set of cross-linkable nucleotide symbols (must be present at least once). + * @param mappings Rules like "A->X" (possibly multiple targets per source). + * @param modifications Precursor losses/gains per nt, e.g. "U:+H2O-H2O". + * @param sequence_restriction Concatenated restriction sequences; if empty, combinations are generated. + * @param cysteine_adduct Whether to add DTT adduct (C4H8S2O2). + * @param max_length Maximum oligo length. + */
78-80: Typo in comment.
qery -> query.- /// return true if qery is not in sequence + /// return true if query is not in sequencesrc/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cpp (2)
47-57: Fix typos in comments.
“ios” -> “ions”.- // only add special ios if there is not already a peak + // only add special ions if there is not already a peak ... - // only add special ios if there is not already a peak + // only add special ions if there is not already a peak
239-254: Fix typo in comments.
“aleardy” -> “already”.- // currently, also contains z=1 precursor peaks which we aleardy added before + // currently, also contains z=1 precursor peaks which we already added before ... - // currently, also contains z=1 and 2 precursor peaks which we aleardy added before + // currently, also contains z=1 and 2 precursor peaks which we already added beforesrc/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cpp (4)
56-58: Resolve leftover FIXME or add context.
The comment suggests uncertainty about the cysteine adduct string. Either reference the source/derivation or remove the FIXME.- const String cysteine_adduct_string("C4H8S2O2");//FIXME: why is this changed from ancestor? + const String cysteine_adduct_string("C4H8S2O2"); // DTT adduct; aligns with NuXL publications (document source)
120-136: Minor spelling in comments.
“cominatorial” -> “combinatorial”.- // but keep cominatorial cases: e.g., both A->X and A->A provided. + // but keep combinatorial cases: e.g., both A->X and A->A provided.
270-273: Minor spelling in log line.
“occured” -> “occurred”; rephrase for grammar.- << " occured several times. Did you specify it multiple times in the ini file?. Will consider skip this entry." << endl; + << " occurred multiple times. Did you specify it more than once in the ini file? Skipping this entry." << endl;
450-456: Prefer integral index for enumeration.
Use size_t (or Size) for the adduct index counter.- double index = 1; + Size index = 1;src/openms/include/OpenMS/CHEMISTRY/TheoreticalSpectrumGenerator.h (3)
65-72: Clarify API contract and Doxygen details.
State that peaks are appended (not cleared), that output is sorted, and that enabled ion-type flags are honored. Add precondition on charge.- /** - * Generates a simple tandem MS Spectrum, - * @param[out] spectrum Each peak is only represented as a single m/z value - * @param peptide The input peptide - * @param charge The max charge of the peaks - */ + /** + * Generate prefix/suffix ion m/z values and append them to spectrum. + * Honors the add_[abcyxz]_ions_ flags; does not clear the container; result is sorted ascending. + * @param[out] spectrum Appended with single-precision m/z values only (no intensities/annotations). + * @param peptide Input peptide sequence. + * @param charge Maximum fragment charge (must be >= 1). + */
73-75: Typo: “Acessors”.- /** @name Acessors + /** @name Accessors
113-114: Document helper purpose and visibility.
Briefly document ion-direction behavior. Consider making it private if not intended for subclasses.- /// helper for getPrefixAndSuffixIonsMZ. For given Ion-Type and charge calculates a peaks + /// Helper for getPrefixAndSuffixIonsMZ: appends N- (a/b/c) or C-terminal (x/y/z) ladders for a given charge.src/topp/PeptideDataBaseSearchFI.cpp (2)
92-94: Remove unused ProgressLogger.Local progresslogger is never used. Drop it.
- ProgressLogger progresslogger; - progresslogger.setLogType(log_type_);
101-106: Map algorithm exit codes to TOPP exit codes.Return granular errors instead of INTERNAL_ERROR for everything.
- if (e != PeptideSearchEngineFIAlgorithm::ExitCodes::EXECUTION_OK) - { - return TOPPBase::ExitCodes::INTERNAL_ERROR; - } + switch (e) + { + case PeptideSearchEngineFIAlgorithm::ExitCodes::EXECUTION_OK: break; + case PeptideSearchEngineFIAlgorithm::ExitCodes::INPUT_FILE_EMPTY: return TOPPBase::ExitCodes::INPUT_FILE_EMPTY; + case PeptideSearchEngineFIAlgorithm::ExitCodes::ILLEGAL_PARAMETERS: return TOPPBase::ExitCodes::ILLEGAL_PARAMETERS; + case PeptideSearchEngineFIAlgorithm::ExitCodes::UNEXPECTED_RESULT: return TOPPBase::ExitCodes::UNEXPECTED_RESULT; + default: return TOPPBase::ExitCodes::INTERNAL_ERROR; + }src/tests/class_tests/openms/source/FragmentIndex_test.cpp (5)
136-145: Remove unused variable.found_all_peaks is never used.
- bool found_all_peaks = false;
271-279: Duplicate param assignment.fragment:max_mz is set twice; keep only the larger bound.
-param.setValue("fragment:max_mz", 90000); param.setValue("fragment:max_mz", 5000000); // That we definitively create all peptides
358-360: Remove unused variable.tsg2 is declared but never used.
-TheoreticalSpectrumGenerator tsg2;
379-384: Make test deterministic.rand() introduces flakiness; seed it.
for (auto& peak : b_y_ions) { + static bool seeded = (std::srand(1), true); float factor = (rand() % 90 - 45) * 0.001; peak.setMZ(peak.getMZ()+factor); // theo_spec.push_back(peak); }
317-317: Tidy whitespace.Remove redundant blank lines flagged by linter.
Also applies to: 176-176
src/openms/source/CHEMISTRY/TheoreticalSpectrumGenerator.cpp (2)
1197-1204: Use OpenMS logging, not std::cout.Replace cout with OPENMS_LOG_WARN.
- cout << "Warning: Attempt at creating Prefix and Suffix Ions Spectrum from empty string!" << endl; + OPENMS_LOG_WARN << "Attempt at creating Prefix and Suffix Ions Spectrum from empty sequence!" << std::endl;
1160-1194: Optional: reserve and avoid resorting elsewhere.If this API is hot, reserve expected capacity and consider letting caller sort only once across peptides.
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp (1)
325-341: Robustness when precursor charge <= 1.Clamping max theoretical fragment charge avoids empty spectra and negative bounds.
- tsg.getSpectrum(theoretical_spec, ah.sequence, 1, std::min((int)charge - 1, 2)); + const int max_z = std::max(1, std::min((int)charge - 1, 2)); + tsg.getSpectrum(theoretical_spec, ah.sequence, 1, max_z);src/openms/source/ANALYSIS/ID/FragmentIndex.cpp (19)
10-10: Remove unused header include.The
AAIndexheader is included but not used anywhere in the implementation.#include <OpenMS/ANALYSIS/ID/FragmentIndex.h> -#include <OpenMS/CHEMISTRY/AAIndex.h> #include <OpenMS/CHEMISTRY/AASequence.h>
18-18: Remove unused header include.The
SimpleTSGXLMSheader is included but commented out in the code and not used.#include <OpenMS/CHEMISTRY/ProteaseDigestion.h> #include <OpenMS/CHEMISTRY/TheoreticalSpectrumGenerator.h> -#include <OpenMS/CHEMISTRY/SimpleTSGXLMS.h> #include <OpenMS/CONCEPT/Constants.h>
30-30: Remove unused header include.The
QC/QCBase.hheader is included but not used anywhere in the implementation.#include <OpenMS/KERNEL/Peak1D.h> #include <OpenMS/MATH/MathFunctions.h> -#include <OpenMS/QC/QCBase.h> #include <functional>
31-31: Remove unused header include.The
<functional>header is included but not used in the implementation.#include <OpenMS/MATH/MathFunctions.h> -#include <functional>
5-5: Missing maintainer field.The
$Maintainer:field is empty. Please add the maintainer name to track responsibility for this module.-// $Maintainer: $ +// $Maintainer: Timo Sachsenberg $
69-69: Address TODO comment regarding memory optimization.The TODO comment indicates a potential memory optimization by streaming FASTA from disk. This could be significant for large databases.
Would you like me to create an issue to track implementing FASTA streaming for memory optimization?
73-73: Magic number should be documented or made configurable.The reserve factor of 5 is a magic number without clear justification. Consider documenting the rationale or making it configurable.
- fi_peptides_.reserve(fasta_entries.size() * 5 * modifications_variable_.size()); //TODO: Calculate the average cleavage site number for the most important model organisms + // Reserve estimate: avg peptides per protein (5) * variable modifications + // TODO: Calculate the average cleavage site number for the most important model organisms + const size_t AVG_PEPTIDES_PER_PROTEIN = 5; + fi_peptides_.reserve(fasta_entries.size() * AVG_PEPTIDES_PER_PROTEIN * modifications_variable_.size());
95-96: Consider usingstd::string::nposcomparison directly.The find check can be simplified using the inequality operator.
- if (protein.sequence.substr(digested_peptide.first, digested_peptide.second).find('X') != string::npos) + if (protein.sequence.substr(digested_peptide.first, digested_peptide.second).find('X') != std::string::npos)
121-121: Address TODO comment about performance optimization.The TODO references issue #6859 for integrating mass window check into ModPepGen. This could improve performance by avoiding unnecessary modified peptide generation.
Would you like me to review issue #6859 and help implement the mass window check integration into ModifiedPeptideGenerator?
161-161: Address TODO comment and fix typo.The TODO comment questions the memory reservation calculation and contains a typo ("senese" should be "sense").
- fi_fragments_.reserve(fi_peptides_.size() * 2 * peptide_min_length_); //TODO: Does this make senese? + // Reserve estimate: each peptide generates ~2 fragments per amino acid (b and y ions) + fi_fragments_.reserve(fi_peptides_.size() * 2 * peptide_min_length_); //TODO: Validate this estimation with actual data
252-253: Redundant sorting may indicate parallelization issue.The comment and code suggest uncertainty about parallel sorting safety. If the buckets are independent, this re-sort shouldn't be necessary.
Consider either:
- Remove the redundant sort if parallelization is confirmed safe
- Or serialize the bucket min_mz insertion to ensure order
- OPENMS_LOG_INFO << "Sorting by bucket min m/z:" << bucketsize_ << endl; - //Resort in case the parallelization block above messed something up TODO: check if this can happen - std::sort( bucket_min_mz_.begin(), bucket_min_mz_.end()); + // bucket_min_mz_ is already sorted as it follows fi_fragments_ order + OPENMS_LOG_INFO << "Created " << bucket_min_mz_.size() << " buckets with size " << bucketsize_ << endl;
232-232: Consider more robust bucket size calculation.Using
sqrt(n)for bucket size is common but may not be optimal for all dataset sizes. MSFragger's approach mentioned in the TODO might offer better performance.Would you like me to research MSFragger's bucketing approach and propose an implementation that could improve query performance?
298-299: Redundant boundary check for fragment mass tolerance.The condition can be simplified since we're checking a range.
- if ((adjusted_mass >= left_iter->fragment_mz_ - frag_tol ) && adjusted_mass <= (left_iter->fragment_mz_+ frag_tol)) + if (std::abs(adjusted_mass - left_iter->fragment_mz_) <= frag_tol)
379-382: Inefficient duplicate check for minimum matched peaks.The minimum matched peaks check is performed twice - once after sorting and again in the loop.
- if (init_hits.hits_.size() > 0 ) - { - if (init_hits.hits_[0].num_matched_ < min_matched_peaks_) - init_hits.hits_.resize(0); - } - - - for (auto hit_iter = init_hits.hits_.rbegin(); hit_iter != init_hits.hits_.rend(); ++hit_iter) - { - if (hit_iter->num_matched_ >= min_matched_peaks_) // search for the first element that should be included - { - init_hits.hits_.resize(init_hits.hits_.size() - (distance(init_hits.hits_.rbegin(), hit_iter))); - break; - } - } + // Remove all hits below minimum matched peaks threshold + auto it = std::lower_bound(init_hits.hits_.begin(), init_hits.hits_.end(), min_matched_peaks_, + [](const SpectrumMatch& sm, uint32_t threshold) { + return sm.num_matched_ > threshold; + }); + init_hits.hits_.erase(it, init_hits.hits_.end());
534-534: Fix parameter description typo.The description for
fragment:mass_tolerance_unitis incomplete.- defaults_.setValue("fragment:mass_tolerance_unit", "ppm", "Unit of fragment m"); + defaults_.setValue("fragment:mass_tolerance_unit", "ppm", "Unit of fragment mass tolerance");
576-577: Fix inconsistent parameter naming.The parameters
open_precursor_window_lower_andopen_precursor_window_upper_have trailing underscores, which is inconsistent with other parameter names.- defaults_.setValue("open_precursor_window_lower_", -100.0, "lower bound of the open precursor window"); - defaults_.setValue("open_precursor_window_upper_", 200.0, "upper bound of the open precursor window"); + defaults_.setValue("open_precursor_window_lower", -100.0, "lower bound of the open precursor window"); + defaults_.setValue("open_precursor_window_upper", 200.0, "upper bound of the open precursor window");And update the corresponding lines in
updateMembers_():- open_precursor_window_lower_ = param_.getValue("open_precursor_window_lower_"); - open_precursor_window_upper_ = param_.getValue("open_precursor_window_upper_"); + open_precursor_window_lower_ = param_.getValue("open_precursor_window_lower"); + open_precursor_window_upper_ = param_.getValue("open_precursor_window_upper");
565-565: Remove obsolete TODO comment.The
is_build_flag seems intentional for lazy building. If this design is final, remove the TODO.- is_build_ = false; // TODO: remove this and build on construction + is_build_ = false; // Fragment index is built on demand, not on construction
147-147: Replace cout with OPENMS_LOG for consistency.Use OpenMS logging instead of direct cout for consistency with the rest of the codebase.
- OPENMS_LOG_WARN << skipped_peptides << " peptides skipped due to unkown AA \n"; + OPENMS_LOG_WARN << skipped_peptides << " peptides skipped due to unknown AA" << std::endl;Also fix the typo "unkown" → "unknown".
82-83: Replace std::cout with OPENMS_LOG for consistency.Multiple places use
std::coutinstead of the OpenMS logging framework.- std::cout << "Generating peptides..." << std::endl; + OPENMS_LOG_INFO << "Generating peptides..." << std::endl;- std::cout << "Sorting peptides..." << std::endl; + OPENMS_LOG_INFO << "Sorting peptides..." << std::endl;- std::cout << "done." << std::endl; + OPENMS_LOG_INFO << "done." << std::endl;- std::cout << "Sorting fragments..." << std::endl; + OPENMS_LOG_INFO << "Sorting fragments..." << std::endl;Also applies to: 149-150, 155-156, 223-224
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (36)
CHANGELOG(2 hunks)src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h(1 hunks)src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h(1 hunks)src/openms/include/OpenMS/ANALYSIS/ID/sources.cmake(2 hunks)src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.h(1 hunks)src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.h(1 hunks)src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.h(1 hunks)src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.h(1 hunks)src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.h(1 hunks)src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.h(1 hunks)src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.h(1 hunks)src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.h(1 hunks)src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.h(1 hunks)src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.h(1 hunks)src/openms/include/OpenMS/CHEMISTRY/TheoreticalSpectrumGenerator.h(3 hunks)src/openms/include/OpenMS/METADATA/ProteinModificationSummary.h(1 hunks)src/openms/source/ANALYSIS/ID/FragmentIndex.cpp(1 hunks)src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp(1 hunks)src/openms/source/ANALYSIS/ID/sources.cmake(2 hunks)src/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cpp(1 hunks)src/openms/source/ANALYSIS/NUXL/NuXLFDR.cpp(1 hunks)src/openms/source/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.cpp(1 hunks)src/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cpp(1 hunks)src/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cpp(1 hunks)src/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cpp(1 hunks)src/openms/source/ANALYSIS/NUXL/NuXLPresets.cpp(1 hunks)src/openms/source/ANALYSIS/NUXL/NuXLReport.cpp(1 hunks)src/openms/source/APPLICATIONS/ToolHandler.cpp(1 hunks)src/openms/source/CHEMISTRY/TheoreticalSpectrumGenerator.cpp(1 hunks)src/openms/source/METADATA/ProteinModificationSummary.cpp(1 hunks)src/tests/class_tests/openms/executables.cmake(1 hunks)src/tests/class_tests/openms/source/FragmentIndex_test.cpp(1 hunks)src/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cpp(1 hunks)src/topp/OpenNuXL.cpp(1 hunks)src/topp/PeptideDataBaseSearchFI.cpp(1 hunks)src/topp/executables.cmake(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/openms/**/*.{cpp,h,hpp,cc,cxx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms
Files:
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.hsrc/openms/source/ANALYSIS/NUXL/NuXLFDR.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.cppsrc/openms/source/ANALYSIS/NUXL/NuXLReport.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.hsrc/openms/include/OpenMS/METADATA/ProteinModificationSummary.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.hsrc/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cppsrc/openms/source/ANALYSIS/NUXL/NuXLPresets.cppsrc/openms/source/METADATA/ProteinModificationSummary.cppsrc/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.hsrc/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cppsrc/openms/source/APPLICATIONS/ToolHandler.cppsrc/openms/include/OpenMS/CHEMISTRY/TheoreticalSpectrumGenerator.hsrc/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.hsrc/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.hsrc/openms/source/ANALYSIS/ID/FragmentIndex.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.hsrc/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.hsrc/openms/source/CHEMISTRY/TheoreticalSpectrumGenerator.cpp
src/openms/include/OpenMS/**/*.h
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Add Doxygen comments for new public methods and classes
Files:
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.hsrc/openms/include/OpenMS/METADATA/ProteinModificationSummary.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.hsrc/openms/include/OpenMS/CHEMISTRY/TheoreticalSpectrumGenerator.hsrc/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.hsrc/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.h
src/tests/class_tests/openms/**/*.cpp
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Write unit tests for new functionality
Files:
src/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cppsrc/tests/class_tests/openms/source/FragmentIndex_test.cpp
🧠 Learnings (12)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Applied to files:
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.hsrc/openms/source/ANALYSIS/NUXL/NuXLFDR.cppsrc/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.cppsrc/openms/source/ANALYSIS/NUXL/NuXLReport.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.hsrc/openms/include/OpenMS/METADATA/ProteinModificationSummary.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.hsrc/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cppsrc/openms/include/OpenMS/ANALYSIS/ID/sources.cmakesrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cppsrc/topp/OpenNuXL.cppsrc/openms/source/ANALYSIS/NUXL/NuXLPresets.cppsrc/openms/source/METADATA/ProteinModificationSummary.cppsrc/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.hsrc/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use appropriate OpenMS containers and algorithms
Applied to files:
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.hsrc/openms/source/ANALYSIS/NUXL/NuXLFDR.cppsrc/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.cppsrc/openms/source/ANALYSIS/NUXL/NuXLReport.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.hsrc/openms/include/OpenMS/METADATA/ProteinModificationSummary.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.hsrc/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cppsrc/topp/OpenNuXL.cppsrc/openms/source/ANALYSIS/NUXL/NuXLPresets.cppsrc/openms/source/METADATA/ProteinModificationSummary.cppsrc/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.hsrc/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Be mindful of memory usage when processing large datasets
Applied to files:
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.hsrc/openms/source/ANALYSIS/NUXL/NuXLFDR.cppsrc/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.cppsrc/openms/source/ANALYSIS/NUXL/NuXLReport.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.hsrc/openms/include/OpenMS/METADATA/ProteinModificationSummary.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.hsrc/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cppsrc/topp/OpenNuXL.cppsrc/openms/source/ANALYSIS/NUXL/NuXLPresets.cppsrc/openms/source/METADATA/ProteinModificationSummary.cppsrc/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.hsrc/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Follow the established error handling patterns
Applied to files:
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.hsrc/openms/source/ANALYSIS/NUXL/NuXLFDR.cppsrc/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.cppsrc/openms/source/ANALYSIS/NUXL/NuXLReport.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.hsrc/openms/include/OpenMS/METADATA/ProteinModificationSummary.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.hsrc/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cppsrc/topp/OpenNuXL.cppsrc/openms/source/ANALYSIS/NUXL/NuXLPresets.cppsrc/openms/source/METADATA/ProteinModificationSummary.cppsrc/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.hsrc/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Consider algorithmic complexity for data processing operations
Applied to files:
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.hsrc/openms/source/ANALYSIS/NUXL/NuXLFDR.cppsrc/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.cppsrc/openms/source/ANALYSIS/NUXL/NuXLReport.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.hsrc/openms/include/OpenMS/METADATA/ProteinModificationSummary.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.hsrc/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cppsrc/topp/OpenNuXL.cppsrc/openms/source/ANALYSIS/NUXL/NuXLPresets.cppsrc/openms/source/METADATA/ProteinModificationSummary.cppsrc/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.hsrc/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality
Applied to files:
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.hsrc/openms/source/ANALYSIS/NUXL/NuXLFDR.cppsrc/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.cppsrc/openms/source/ANALYSIS/NUXL/NuXLReport.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.hsrc/openms/include/OpenMS/METADATA/ProteinModificationSummary.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.hsrc/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cppsrc/tests/class_tests/openms/executables.cmakesrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cppsrc/topp/OpenNuXL.cppsrc/openms/source/ANALYSIS/NUXL/NuXLPresets.cppsrc/openms/source/METADATA/ProteinModificationSummary.cppsrc/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.hsrc/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cppsrc/tests/class_tests/openms/source/FragmentIndex_test.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms
Applied to files:
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.hsrc/openms/source/ANALYSIS/NUXL/NuXLFDR.cppsrc/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.cppsrc/openms/source/ANALYSIS/NUXL/NuXLReport.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.hsrc/openms/include/OpenMS/METADATA/ProteinModificationSummary.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.hsrc/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cppsrc/topp/OpenNuXL.cppsrc/openms/source/ANALYSIS/NUXL/NuXLPresets.cppsrc/openms/source/METADATA/ProteinModificationSummary.cppsrc/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.hsrc/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.h
📚 Learning: 2025-08-14T10:19:54.371Z
Learnt from: jpfeuffer
PR: OpenMS/OpenMS#8167
File: src/topp/Digestor.cpp:200-226
Timestamp: 2025-08-14T10:19:54.371Z
Learning: In OpenMS (C++ bioinformatics framework), use boost random libraries instead of std library random distributions for cross-platform reproducible random number generation, as std library distributions are not reproducible across platforms.
Applied to files:
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.hsrc/openms/source/ANALYSIS/NUXL/NuXLFDR.cppsrc/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.cppsrc/openms/source/ANALYSIS/NUXL/NuXLReport.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.hsrc/openms/include/OpenMS/METADATA/ProteinModificationSummary.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.hsrc/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cppsrc/topp/OpenNuXL.cppsrc/openms/source/ANALYSIS/NUXL/NuXLPresets.cppsrc/openms/source/METADATA/ProteinModificationSummary.cppsrc/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.hsrc/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Be aware of OpenMS dependencies and external libraries
Applied to files:
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.hsrc/openms/source/ANALYSIS/NUXL/NuXLFDR.cppsrc/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.cppsrc/openms/source/ANALYSIS/NUXL/NuXLReport.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.hsrc/openms/include/OpenMS/METADATA/ProteinModificationSummary.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.hsrc/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cppsrc/topp/OpenNuXL.cppsrc/openms/source/ANALYSIS/NUXL/NuXLPresets.cppsrc/openms/source/METADATA/ProteinModificationSummary.cppsrc/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.hsrc/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes
Applied to files:
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLReport.hsrc/openms/source/ANALYSIS/NUXL/NuXLFDR.cppsrc/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLPresets.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.cppsrc/openms/source/ANALYSIS/NUXL/NuXLReport.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFDR.hsrc/openms/include/OpenMS/METADATA/ProteinModificationSummary.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentIonGenerator.hsrc/openms/source/ANALYSIS/NUXL/NuXLAnnotateAndLocate.cppsrc/openms/include/OpenMS/ANALYSIS/ID/sources.cmakesrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLModificationsGenerator.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLConstants.hsrc/openms/source/ANALYSIS/NUXL/NuXLFragmentIonGenerator.cppsrc/topp/OpenNuXL.cppsrc/openms/source/ANALYSIS/NUXL/NuXLPresets.cppsrc/openms/source/METADATA/ProteinModificationSummary.cppsrc/openms/source/ANALYSIS/NUXL/NuXLModificationsGenerator.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotateAndLocate.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLFragmentAdductDefinition.hsrc/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cppsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.hsrc/openms/include/OpenMS/ANALYSIS/NUXL/NuXLParameterParsing.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/*Test.cpp : Follow naming convention: `ClassNameTest.cpp` for `ClassName`
Applied to files:
src/tests/class_tests/openms/source/NuXLModificationsGenerator_test.cpp
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
PR: OpenMS/OpenMS#8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.
Applied to files:
src/tests/class_tests/openms/executables.cmake
🧬 Code graph analysis (8)
src/tests/class_tests/openms/source/FragmentIndex_test.cpp (4)
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h (1)
OpenMS(21-92)src/openms/include/OpenMS/CHEMISTRY/TheoreticalSpectrumGenerator.h (1)
OpenMS(17-155)src/openms/source/ANALYSIS/NUXL/NuXLParameterParsing.cpp (2)
getModifications(471-497)getModifications(471-471)src/openms/source/ANALYSIS/ID/FragmentIndex.cpp (7)
getPeptides(645-648)getPeptides(645-645)querySpectrum(447-497)querySpectrum(447-448)FragmentIndex(502-600)clear(60-66)clear(60-60)
src/openms/source/APPLICATIONS/ToolHandler.cpp (1)
src/openms/include/OpenMS/DATASTRUCTURES/ToolDescription.h (1)
ToolDescription(110-131)
src/openms/include/OpenMS/CHEMISTRY/TheoreticalSpectrumGenerator.h (1)
src/openms/source/CHEMISTRY/TheoreticalSpectrumGenerator.cpp (4)
getPrefixAndSuffixIonsMZ(1160-1195)getPrefixAndSuffixIonsMZ(1160-1160)addPrefixAndSuffixIons_(1197-1256)addPrefixAndSuffixIons_(1197-1197)
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h (2)
src/openms/source/ANALYSIS/ID/FragmentIndex.cpp (27)
clear(60-66)clear(60-60)FragmentIndex(502-600)isBuild(640-643)isBuild(640-640)getPeptides(645-648)getPeptides(645-645)addSpecialPeptide(53-57)addSpecialPeptide(53-53)build(158-256)build(158-158)getPeptidesInPrecursorRange(258-266)getPeptidesInPrecursorRange(258-259)query(268-312)query(268-270)querySpectrum(447-497)querySpectrum(447-448)updateMembers_(602-638)updateMembers_(602-602)generatePeptides(70-156)generatePeptides(70-70)queryPeaks(314-346)queryPeaks(314-317)searchDifferentPrecursorRanges(406-445)searchDifferentPrecursorRanges(406-409)trimHits(348-404)trimHits(348-348)src/openms/source/CHEMISTRY/TheoreticalSpectrumGenerator.cpp (2)
updateMembers_(1258-1292)updateMembers_(1258-1258)
src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h (2)
src/openms/include/OpenMS/ANALYSIS/NUXL/NuXLAnnotatedHit.h (1)
OpenMS(15-223)src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp (9)
PeptideSearchEngineFIAlgorithm(51-157)search(431-568)search(431-431)updateMembers_(159-203)updateMembers_(159-159)preprocessSpectra_(206-250)preprocessSpectra_(206-206)postProcessHits_(252-429)postProcessHits_(252-270)
src/openms/source/ANALYSIS/ID/FragmentIndex.cpp (2)
src/tests/class_tests/openms/source/FragmentIndex_test.cpp (3)
charge(86-149)charge(86-86)querySpectrum(262-262)src/openms/source/CHEMISTRY/TheoreticalSpectrumGenerator.cpp (2)
updateMembers_(1258-1292)updateMembers_(1258-1258)
src/topp/PeptideDataBaseSearchFI.cpp (2)
src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h (1)
OpenMS(21-130)src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp (1)
PeptideSearchEngineFIAlgorithm(51-157)
src/openms/source/CHEMISTRY/TheoreticalSpectrumGenerator.cpp (3)
src/topp/OpenNuXL.cpp (3)
peptide(1124-1173)peptide(1124-1126)mono_weight(1130-1130)src/openms/source/CHEMISTRY/TheoreticalSpectrumGeneratorXLMS.cpp (2)
mono_weight(263-263)mono_weight(298-298)src/openms/include/OpenMS/CHEMISTRY/Residue.h (6)
getInternalToAIon(80-86)getInternalToBIon(88-94)getInternalToCIon(96-101)getInternalToXIon(103-109)getInternalToYIon(111-116)getInternalToZIon(118-124)
🪛 GitHub Check: CodeFactor
src/tests/class_tests/openms/source/FragmentIndex_test.cpp
[notice] 317-317: src/tests/class_tests/openms/source/FragmentIndex_test.cpp#L317
Redundant blank line at the start of a code block should be deleted. (whitespace/blank_line)
[notice] 176-176: src/tests/class_tests/openms/source/FragmentIndex_test.cpp#L176
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
[notice] 37-37: src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h#L37
Redundant blank line at the start of a code block should be deleted. (whitespace/blank_line)
src/openms/source/ANALYSIS/ID/FragmentIndex.cpp
[notice] 300-300: src/openms/source/ANALYSIS/ID/FragmentIndex.cpp#L300
Redundant blank line at the start of a code block should be deleted. (whitespace/blank_line)
[notice] 403-403: src/openms/source/ANALYSIS/ID/FragmentIndex.cpp#L403
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)
[notice] 239-239: src/openms/source/ANALYSIS/ID/FragmentIndex.cpp#L239
Redundant blank line at the start of a code block should be deleted. (whitespace/blank_line)
[notice] 72-72: src/openms/source/ANALYSIS/ID/FragmentIndex.cpp#L72
Redundant blank line at the start of a code block should be deleted. (whitespace/blank_line)
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp
[notice] 252-430: src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp#L252-L430
Complex Method
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
- GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
- GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
- GitHub Check: build-and-test (macos-13, xcode, 14.2)
- GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
- GitHub Check: cppcheck-test
| /** @brief Delete fragment index. Sets is_build=false*/ | ||
| void clear(); | ||
|
|
||
|
|
||
| /** Return index range of all possible Peptides/Proteins, such that a vector can be created fitting that range (safe some memory) | ||
| * @param precursor_mass The mono-charged precursor mass (M+H) | ||
| * @param window Defines the lower and upper bound for the precusor mass. For closed search it only contains the tolerance. In case of open search | ||
| * it contains both tolerance and open-search-window | ||
| * @return a pair of indexes defining all possible peptides which the current peak could hit | ||
| */ | ||
| std::pair<size_t, size_t> getPeptidesInPrecursorRange(float precursor_mass, | ||
| const std::pair<float, float>& window); | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
Range semantics mismatch leaks out-of-window candidates (off-by-one).
getPeptidesInPrecursorRange returns a half‑open interval [first, second), but downstream uses second as inclusive and sizes +1. This can include one peptide beyond the upper bound and wastes space.
Apply in FragmentIndex.cpp:
- candidates_iso_error.hits_.resize(candidates_range.second - candidates_range.first + 1);
+ candidates_iso_error.hits_.resize(candidates_range.second - candidates_range.first);And in query(...):
- if(left_iter->peptide_idx_ > peptide_idx_range.second) break;
+ if(left_iter->peptide_idx_ >= peptide_idx_range.second) break;And in the DEBUG check:
- if (left_iter->peptide_idx_ < peptide_idx_range.first || left_iter->peptide_idx_ > peptide_idx_range.second)
+ if (left_iter->peptide_idx_ < peptide_idx_range.first || left_iter->peptide_idx_ >= peptide_idx_range.second)🏁 Script executed:
#!/bin/bash
# Verify no other inclusive uses slipped in
rg -nP -C2 --type=cpp '\bgetPeptidesInPrecursorRange\(|peptide_idx_range\.(first|second)\b|hits_\.resize\(|>=\s*peptide_idx_range\.second|>\s*peptide_idx_range\.second' src/openms/source/ANALYSIS/ID/FragmentIndex.cppLength of output: 2474
Fix off-by-one: treat peptide range as half-open [first, second) in FragmentIndex.cpp
getPeptidesInPrecursorRange returns a half-open interval but downstream code treats second as inclusive, allowing one out-of-range peptide and an extra allocation. Apply the changes below:
Apply in FragmentIndex.cpp:
- candidates_iso_error.hits_.resize(candidates_range.second - candidates_range.first + 1);
+ candidates_iso_error.hits_.resize(candidates_range.second - candidates_range.first);- if(left_iter->peptide_idx_ > peptide_idx_range.second) break;
+ if(left_iter->peptide_idx_ >= peptide_idx_range.second) break;- if (left_iter->peptide_idx_ < peptide_idx_range.first || left_iter->peptide_idx_ > peptide_idx_range.second)
+ if (left_iter->peptide_idx_ < peptide_idx_range.first || left_iter->peptide_idx_ >= peptide_idx_range.second)Committable suggestion skipped: line range outside the PR's diff.
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (6)
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp (3)
136-141: Resolved: valid strings now set on the correct vector.The open_search option fix looks correct and matches the earlier review.
279-282: Resolved: shrink_to_fit() applied to inner vector, not the outer container.This removes the data race and unnecessary cost flagged earlier.
572-581: Confirm header signature of postProcessHits_.Ensure PeptideSearchEngineFIAlgorithm.h declares postProcessHits_ with Size top_hits matching implementation and callsite.
#!/bin/bash # Show header and impl signatures for postProcessHits_ rg -nP 'postProcessHits_\\s*\\(' src/openms/include src/openms/source -C2src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h (3)
94-121: Doxygen coverage on public API looks good.Thanks for documenting the new public class and methods.
176-183: Specify half‑open range contract [first, second). Also fix downstream off‑by‑one.Document explicitly that second is exclusive, and align FragmentIndex.cpp accordingly.
- * @return a pair of indexes defining all possible peptides which the current peak could hit + * @return Half‑open index range [first, second) of candidate peptides.Outside this header (in FragmentIndex.cpp), apply:
- candidates_iso_error.hits_.resize(candidates_range.second - candidates_range.first + 1); + candidates_iso_error.hits_.resize(candidates_range.second - candidates_range.first); - if(left_iter->peptide_idx_ > peptide_idx_range.second) break; + if(left_iter->peptide_idx_ >= peptide_idx_range.second) break; - if (left_iter->peptide_idx_ < peptide_idx_range.first || left_iter->peptide_idx_ > peptide_idx_range.second) + if (left_iter->peptide_idx_ < peptide_idx_range.first || left_iter->peptide_idx_ >= peptide_idx_range.second)
39-50: Avoid truncation: use Size for peptide subsequence indices.uint16_t can overflow for long proteins and conflicts with size_t-based APIs elsewhere.
- Peptide(UInt32 protein_idx, UInt32 modification_idx, std::pair<uint16_t , uint16_t> sequence, float precursor_mz): + Peptide(UInt32 protein_idx, UInt32 modification_idx, std::pair<Size, Size> sequence, float precursor_mz): @@ - std::pair<uint16_t , uint16_t> sequence_; ///< The substring of the protein at position protein_idx + std::pair<Size, Size> sequence_; ///< The substring (start, length) within the proteinUpdate FragmentIndex.cpp constructor/emplace_back sites accordingly (they already pass size_t).
🧹 Nitpick comments (9)
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp (4)
230-231: Thread-safety of filter functors inside OMP loop.WindowMower and NLargest instances are shared across threads. If they hold scratch state, this is a data race. Prefer per-thread copies.
-#pragma omp parallel for default(none) shared(exp, fragment_mass_tolerance, fragment_mass_tolerance_unit_ppm, window_mower_filter, nlargest_filter) +#pragma omp parallel for default(none) shared(exp, fragment_mass_tolerance, fragment_mass_tolerance_unit_ppm) for (SignedSize exp_index = 0; exp_index < (SignedSize)exp.size(); ++exp_index) { + WindowMower window_mower_filter_local = window_mower_filter; // or set same Param here + NLargest nlargest_filter_local = nlargest_filter; ... - window_mower_filter.filterPeakSpectrum(exp[exp_index]); - nlargest_filter.filterPeakSpectrum(exp[exp_index]); + window_mower_filter_local.filterPeakSpectrum(exp[exp_index]); + nlargest_filter_local.filterPeakSpectrum(exp[exp_index]);If these classes are documented as thread-safe, ignore. Otherwise, please adjust.
Also applies to: 244-249
79-81: Fix truncated help text.Minor text nit: “Unit of fragment m” → “Unit of fragment mass tolerance.”
- defaults_.setValue("fragment:mass_tolerance_unit", "ppm", "Unit of fragment m"); + defaults_.setValue("fragment:mass_tolerance_unit", "ppm", "Unit of fragment mass tolerance.");
365-373: Use 1-based ranks or call assignRanks().OpenMS typically uses rank starting at 1. Current code sets rank beginning at 0.
- { - std::vector<PeptideHit>& hits = pi.getHits(); - for (Size r = 0; r < hits.size(); ++r) - { - hits[r].setRank(static_cast<UInt>(r)); - } - } + pi.assignRanks();Or, if manual: setRank(static_cast(r + 1)).
197-201: Remove or wire unused “peptide:motif” and commented modification params.Reduce dead code and parameter surface: either use motif/mod-params in post-processing or drop them from this class (FragmentIndex already owns most search params).
Also applies to: 573-587
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h (5)
23-28: Header docs: fix typos and clarify description.Minor nits: “skiped” → “skipped”; clarify axes phrasing; singular/plural fixes.
- /** @brief Generates from a set of Fasta files a 2D-datastructure which stores all theoretical masses of all - * b and y ions from all peptides generated from the Fasta file. The datastructure is build such that on one axis - * the fragments are sorted by their own mass and the axis by the mass of their precursor/protein. - * The FI has two options: Bottom-up and Top Down. In later digestion is skiped and the fragments have a direct - * reference to the mass of the proteins instead of digested peptides. + /** @brief Builds a 2D index of theoretical fragment masses (b/y ions) derived from FASTA peptides. + * One axis is sorted by fragment m/z; the other is grouped by precursor mass (peptide/protein). + * Supports bottom‑up and top‑down modes. In the latter, digestion is skipped and fragments reference protein mass.
60-61: Doxygen marker spacing.Use “///<” (no space) to attach to member for proper rendering.
- int16_t isotope_error_{}; /// < The isotope_error used for the performed search + int16_t isotope_error_{}; ///< The isotope error used for the performed search
209-216: Consider making querySpectrum const; fix brief text.Method appears read‑only; const enables safe concurrent queries.
- void querySpectrum(const MSSpectrum& spectrum, - SpectrumMatchesTopN& sms); + /// Queries a complete experimental spectrum against the index. + void querySpectrum(const MSSpectrum& spectrum, + SpectrumMatchesTopN& sms) const;Adjust the .cpp signature accordingly.
33-34: Style: remove redundant blank line after ‘public:’.Tiny formatting nit flagged by CodeFactor.
248-252: Fix minor typos in comments (smalles → smallest, independend → independent, comibnations → combinations).Purely cosmetic, no behavior change.
Also applies to: 299-311
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h(1 hunks)src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h(1 hunks)src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h
🧰 Additional context used
📓 Path-based instructions (2)
src/openms/**/*.{cpp,h,hpp,cc,cxx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms
Files:
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cppsrc/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
src/openms/include/OpenMS/**/*.h
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Add Doxygen comments for new public methods and classes
Files:
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
🧠 Learnings (3)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes
Applied to files:
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings
Applied to files:
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Applied to files:
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
🧬 Code graph analysis (1)
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h (1)
src/openms/source/ANALYSIS/ID/FragmentIndex.cpp (27)
clear(60-66)clear(60-60)FragmentIndex(502-600)isBuild(640-643)isBuild(640-640)getPeptides(645-648)getPeptides(645-645)addSpecialPeptide(53-57)addSpecialPeptide(53-53)build(158-256)build(158-158)getPeptidesInPrecursorRange(258-266)getPeptidesInPrecursorRange(258-259)query(268-312)query(268-270)querySpectrum(447-497)querySpectrum(447-448)updateMembers_(602-638)updateMembers_(602-602)generatePeptides(70-156)generatePeptides(70-70)queryPeaks(314-346)queryPeaks(314-317)searchDifferentPrecursorRanges(406-445)searchDifferentPrecursorRanges(406-409)trimHits(348-404)trimHits(348-348)
🪛 GitHub Check: CodeFactor
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp
[notice] 252-430: src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp#L252-L430
Complex Method
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
[notice] 37-37: src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h#L37
Redundant blank line at the start of a code block should be deleted. (whitespace/blank_line)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
- GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
- GitHub Check: build-and-test (macos-13, xcode, 14.2)
- GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
- GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
- GitHub Check: cppcheck-test
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp (2)
136-141: open_search valid strings are now correct.Vector is populated properly; validator will work.
253-271: Header/impl/caller now aligned on top_hits.Signature uses Size top_hits; matches call-site.
🧹 Nitpick comments (10)
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp (10)
79-81: Fix truncated help text."Unit of fragment m" appears cut off.
- defaults_.setValue("fragment:mass_tolerance_unit", "ppm", "Unit of fragment m"); + defaults_.setValue("fragment:mass_tolerance_unit", "ppm", "Unit of fragment mass tolerance.");
274-282: Inner-vector shrink_to_fit fixed; consider moving outside OMP for perf.Safe now (per‑scan element only) but shrink_to_fit can allocate; running it in parallel for every scan can add overhead.
#pragma omp parallel for default(none) shared(annotated_hits, top_hits) for (SignedSize scan_index = 0; scan_index < (SignedSize)annotated_hits.size(); ++scan_index) { ... - annotated_hits[scan_index].shrink_to_fit(); } +// Optionally after the loop (serial): +for (auto& v : annotated_hits) v.shrink_to_fit();
298-383: Add default(none) and explicit shared/private to the second OMP loop.Current pragma omits data scoping; be explicit to prevent accidental capture changes across compilers.
-#pragma omp parallel for +#pragma omp parallel for default(none) shared(exp, annotated_hits, peptide_ids, annotate_psm_)
303-315: Guard missing precursor to avoid out-of-range access.Some MS2 can lack precursor info.
- double mz = spec.getPrecursors()[0].getMZ(); + if (spec.getPrecursors().empty()) { continue; } + double mz = spec.getPrecursors()[0].getMZ();
324-343: Use the same TSG parameters/ion toggles here as in scoring.Post‑processing creates theoretical spectra with default ion settings; can diverge from scoring and skew error medians.
- TheoreticalSpectrumGenerator tsg; + TheoreticalSpectrumGenerator tsg; + Param tsg_param = tsg.getParameters(); + tsg_param.setValue("add_first_prefix_ion", "true"); + tsg_param.setValue("add_metainfo", "true"); + tsg_param.setValue("add_y_ions", param_.getValue("add_y_ions")); + tsg_param.setValue("add_b_ions", param_.getValue("add_b_ions")); + tsg_param.setValue("add_a_ions", param_.getValue("add_a_ions")); + tsg_param.setValue("add_c_ions", param_.getValue("add_c_ions")); + tsg_param.setValue("add_x_ions", param_.getValue("add_x_ions")); + tsg_param.setValue("add_z_ions", param_.getValue("add_z_ions")); + tsg.setParameters(tsg_param);
347-350: Clamp charge for precursor error calculation.AASequence::getMZ(0) is invalid; charge can be 0.
- double theo_mz = ah.sequence.getMZ(charge); + Size charge_for_error = std::max<Size>(1, charge); + double theo_mz = ah.sequence.getMZ(charge_for_error);
352-366: Division by sequence length: guard length zero.Extremely unlikely, but safe to avoid NaN if an empty AASequence slips in.
- double seq_length = (double)ah.sequence.size(); - ah.prefix_fraction = (double)detail.matched_b_ions/seq_length; - ah.suffix_fraction = (double)detail.matched_y_ions/seq_length; + const double seq_length = static_cast<double>(ah.sequence.size()); + if (seq_length > 0.0) { + ah.prefix_fraction = static_cast<double>(detail.matched_b_ions) / seq_length; + ah.suffix_fraction = static_cast<double>(detail.matched_y_ions) / seq_length; + } else { + ah.prefix_fraction = 0.0; + ah.suffix_fraction = 0.0; + }
517-518: Honor report_top_hits_ in index query (if supported).Currently TODO; pass top N to FragmentIndex::querySpectrum to avoid scoring excess candidates.
- fragment_index_.querySpectrum(exp_spectrum, top_sms); // TODO: expose top N as argument here and use report_top_hits_ + fragment_index_.querySpectrum(exp_spectrum, top_sms /*, report_top_hits_*/); // if API supports
523-534: Guard mod_candidates indexing.Ensure applyVariableModifications returns at least one candidate; otherwise fallback to unmodified.
- ModifiedPeptideGenerator::applyVariableModifications(variable_modifications, unmod_candidate, modifications_max_variable_mods_per_peptide_, mod_candidates); - mod_candidate = mod_candidates[sms_pep.modification_idx_]; + ModifiedPeptideGenerator::applyVariableModifications(variable_modifications, unmod_candidate, modifications_max_variable_mods_per_peptide_, mod_candidates); + if (mod_candidates.empty() || sms_pep.modification_idx_ >= mod_candidates.size()) + { + mod_candidate = unmod_candidate; + } + else + { + mod_candidate = mod_candidates[sms_pep.modification_idx_]; + }
252-430: Complex method: split postProcessHits_.Refactor into helpers: (1) trimAndSortTopN, (2) buildPeptideIdentifications, (3) finalizeProteinIdentification, to reduce cyclomatic complexity and ease testing.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/openms/**/*.{cpp,h,hpp,cc,cxx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms
Files:
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp
🧬 Code graph analysis (1)
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp (1)
src/openms/include/OpenMS/DATASTRUCTURES/ListUtils.h (1)
detail(229-254)
🪛 GitHub Check: CodeFactor
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp
[notice] 252-430: src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp#L252-L430
Complex Method
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
- GitHub Check: build-and-test (macos-13, xcode, 14.2)
- GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
- GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
- GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
- GitHub Check: cppcheck-test
🔇 Additional comments (3)
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp (3)
421-430: Good feature export for downstream tools.Extra features are named and concatenated consistently; Percolator-friendly.
142-149: Incorrect — trailing underscores are intentional and used consistently.The keys with trailing '_' are defined and consumed with the same names across the codebase (e.g. src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp:142-143; src/openms/source/ANALYSIS/ID/FragmentIndex.cpp:576-577, 636-637, 419-420; src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h:322-323). Values will propagate as written; no change required.
Likely an incorrect or invalid review comment.
500-571: Ensure FragmentIndex::querySpectrum is thread-safe
querySpectrum is a non-const member that may modify internal state—unsafe when sharing one FragmentIndex across threads. Either make querySpectrum const (no shared mutation) or give each thread its own index or per-thread workspace.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (6)
src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h (6)
24-51: Duplicate class Doxygen block.Two identical class descriptions exist back-to-back. Keep one to avoid Doxygen noise.
Apply this diff:
@@ -/** - @brief 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: - - Configure parameters via DefaultParamHandler (mass tolerances, enzyme, charges, etc.) - - Call search() with an input mzML file and a FASTA database to populate identification - outputs (ProteinIdentification and PeptideIdentificationList) - - Intended for educational/prototyping use and to demonstrate FI-backed searching - - Notes: - - Used by the PeptideDataBaseSearchFI TOPP tool - - Experimental; interfaces and behavior may change -*/
57-57: Add brief Doxygen for the public constructor.Public API requires Doxygen per project guidelines.
Apply this diff:
- PeptideSearchEngineFIAlgorithm(); + /// Construct with default parameters (see getParameters()). + PeptideSearchEngineFIAlgorithm();
138-140: Fix unit parameter docs: they are strings ("ppm"/"Da"), not booleans.Current text suggests true/false; implementation uses string comparison.
Apply this diff:
- * @param precursor_mass_tolerance_unit_ppm Precursor tolerance unit ("true"->ppm, "false"->Da). - * @param fragment_mass_tolerance_unit_ppm Fragment tolerance unit ("true"->ppm, "false"->Da). + * @param precursor_mass_tolerance_unit_ppm Precursor tolerance unit ("ppm" or "Da"). + * @param fragment_mass_tolerance_unit_ppm Fragment tolerance unit ("ppm" or "Da").Optionally rename parameters to *_unit for clarity in a follow-up.
165-167: Unify types with domain semantics (charges, missed cleavages).Charges and missed cleavages are signed Int elsewhere (including function signatures). Using Size here causes unnecessary conversions.
Apply this diff:
- Size precursor_min_charge_; - Size precursor_max_charge_; + Int precursor_min_charge_; + Int precursor_max_charge_; @@ - Size peptide_missed_cleavages_; + Int peptide_missed_cleavages_;Ensure updateMembers_ assignments stay consistent (they already use Int).
Also applies to: 188-189
118-120: Minor: expand preprocessSpectra_ Doxygen to mention normalization and peak selection.Matches implementation (mower, NLargest, deisotope). Keeps header self-describing.
Proposed tweak:
- /// @brief filter, deisotope, decharge spectra + /// @brief Filter, normalize, deisotope, and (mono)charge fragment spectra; keep top-N peaks per window.
5-7: Fill Maintainer field in header banner.Matches repository convention.
Example:
-// $Maintainer: $ +// $Maintainer: OpenMS Team $
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/openms/**/*.{cpp,h,hpp,cc,cxx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms
Files:
src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h
src/openms/include/OpenMS/**/*.h
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Add Doxygen comments for new public methods and classes
Files:
src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h
🧠 Learnings (2)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes
Applied to files:
src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings
Applied to files:
src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h
🧬 Code graph analysis (1)
src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h (4)
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h (1)
OpenMS(21-92)src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp (9)
PeptideSearchEngineFIAlgorithm(51-158)search(433-570)search(433-433)updateMembers_(160-204)updateMembers_(160-160)preprocessSpectra_(207-251)preprocessSpectra_(207-207)postProcessHits_(253-431)postProcessHits_(253-271)src/openms/source/ANALYSIS/ID/FragmentIndex.cpp (2)
updateMembers_(602-638)updateMembers_(602-602)src/openms/include/OpenMS/METADATA/PeptideHit.h (1)
PeakAnnotation(84-97)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
- GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
- GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
- GitHub Check: build-and-test (macos-13, xcode, 14.2)
- GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
- GitHub Check: cppcheck-test
| #pragma once | ||
|
|
||
| #include <OpenMS/CONCEPT/ProgressLogger.h> | ||
| #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h> |
There was a problem hiding this comment.
Wrong include path for DefaultParamHandler (breaks build).
OpenMS places DefaultParamHandler under CONCEPT, not DATASTRUCTURES.
Apply this diff:
-#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
+#include <OpenMS/CONCEPT/DefaultParamHandler.h>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h> | |
| #include <OpenMS/CONCEPT/DefaultParamHandler.h> |
🤖 Prompt for AI Agents
In src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h around
line 12, the include for DefaultParamHandler uses the wrong path
(OpenMS/DATASTRUCTURES/DefaultParamHandler.h) which breaks the build; update the
include to use the correct OpenMS/CONCEPT/DefaultParamHandler.h path, ensure the
header name is unchanged and adjust any include-ordering or whitespace to match
project style.
| #include <OpenMS/CHEMISTRY/ModifiedPeptideGenerator.h> | ||
| #include <OpenMS/KERNEL/MSExperiment.h> | ||
| #include <OpenMS/DATASTRUCTURES/StringView.h> | ||
| #include <OpenMS/METADATA/PeptideIdentificationList.h> | ||
|
|
There was a problem hiding this comment.
Missing direct includes for used types; avoid transitive dependencies.
AASequence and PeptideHit::PeakAnnotation are used by value; also String and (optionally) ProteinIdentification are referenced. Add explicit includes and drop unused StringView.
Apply this diff:
-#include <OpenMS/CHEMISTRY/ModifiedPeptideGenerator.h>
-#include <OpenMS/KERNEL/MSExperiment.h>
-#include <OpenMS/DATASTRUCTURES/StringView.h>
-#include <OpenMS/METADATA/PeptideIdentificationList.h>
+#include <OpenMS/CHEMISTRY/AASequence.h>
+#include <OpenMS/CHEMISTRY/ModifiedPeptideGenerator.h>
+#include <OpenMS/DATASTRUCTURES/String.h>
+#include <OpenMS/DATASTRUCTURES/ListUtils.h>
+#include <OpenMS/KERNEL/MSExperiment.h>
+#include <OpenMS/METADATA/PeptideHit.h>
+#include <OpenMS/METADATA/PeptideIdentificationList.h>
+// optional but recommended to avoid relying on a forward decl:
+#include <OpenMS/METADATA/ProteinIdentification.h>If you prefer forward declaration instead of including ProteinIdentification, add after the namespace open:
namespace OpenMS
{
+ class ProteinIdentification;There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
src/tests/class_tests/openms/source/FragmentIndex_test.cpp (1)
42-47: Tests rely on private members; will not compile unless core switches them to protected (or exposes accessors).The harness touches
fi_peptides_,fi_fragments_, andbucketsize_. If these remain private (default in class scope), this test won’t compile. Either:
- Move those members under a
protected:section inFragmentIndex, or- Provide test-only accessors (or declare the test class as
friend), or- Refactor tests to use only public APIs.
This was already raised earlier; keeping it here to block until resolved.
Minimal header change example:
class FragmentIndex : public DefaultParamHandler { public: ... - // (members here are private by default) +protected: + // expose only what the tests need; keep remaining internals private + std::vector<Peptide> fi_peptides_; + std::vector<Fragment> fi_fragments_; + size_t bucketsize_{0}; + private: ... };Verification script to confirm visibility before running CI:
#!/bin/bash # Expect: members are under a 'protected:' section rg -nP -C2 '(protected:).*?(fi_peptides_|fi_fragments_|bucketsize_)' src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
🧹 Nitpick comments (9)
src/pyOpenMS/pxds/PeptideSearchEngineFIAlgorithm.pxd (3)
43-51: Add enum doc so values show up in pyOpenMS help()Small doc improves discoverability in Python.
Apply this diff:
cdef enum PeptideSearchEngineFIAlgorithm_ExitCodes "OpenMS::PeptideSearchEngineFIAlgorithm::ExitCodes": - #wrap-attach: + #wrap-attach: # PeptideSearchEngineFIAlgorithm + # wrap-doc: + # Exit codes returned by search(): + # - EXECUTION_OK: finished without errors + # - INPUT_FILE_EMPTY: no spectra found in input + # - UNEXPECTED_RESULT: internal invariant broken + # - UNKNOWN_ERROR: uncaught exception + # - ILLEGAL_PARAMETERS: invalid parameterization EXECUTION_OK INPUT_FILE_EMPTY UNEXPECTED_RESULT UNKNOWN_ERROR ILLEGAL_PARAMETERS
14-23: Tighten class doc: note GIL behavior and outputsMention GIL release and that outputs are by-reference containers the caller must provide.
Apply this diff:
- # - Call search() with an input mzML file and a FASTA database to populate identification - # outputs (ProteinIdentification and PeptideIdentificationList) + # - Call search() with an input mzML file and a FASTA database to populate identification + # outputs (vector[ProteinIdentification] and vector[PeptideIdentification]) provided + # by the caller. The method may release the Python GIL during execution.
27-31: Consider a Python-friendly wrapper (optional)Expose a convenience
def search(self, in_mzML, in_db)that returns(prot_ids, pep_ids, exit_code)and handles container allocation/conversion.I can draft a
.pxihelper insrc/pyOpenMS/pxi/PeptideSearchEngineFIAlgorithm.pxiif desired.src/tests/class_tests/openms/source/FragmentIndex_test.cpp (6)
67-83: Avoid white-box dependency; prefer public accessor for peptide order check.Use
getPeptides()instead of touchingfi_peptides_directly to reduce coupling.Apply this diff:
bool peptidesSorted() { - float last_mz = std::numeric_limits<float>::lowest(); - for (const auto& pep : fi_peptides_) + const auto& peptides = getPeptides(); + float last_mz = std::numeric_limits<float>::lowest(); + for (const auto& pep : peptides) { if (pep.precursor_mz_ >= last_mz) { last_mz = pep.precursor_mz_; } else { return false; } } return true; }
123-139: Use the peptide’s protein_idx instead of hard-coding entries[0].The current code breaks if the index contains peptides from multiple proteins (it already does in other sections).
Apply this diff:
- const AASequence unmod_peptide = AASequence::fromString(entries[0].sequence.substr(pep.sequence_.first, pep.sequence_.second)); + const auto& protein_seq = entries.at(pep.protein_idx).sequence; + const AASequence unmod_peptide = AASequence::fromString( + protein_seq.substr(pep.sequence_.first, pep.sequence_.second));Optionally assert preconditions up-front:
- bool testQuery(const UInt32 charge, const bool precursor_mz_known, const std::vector<FASTAFile::FASTAEntry>& entries) + bool testQuery(const UInt32 charge, const bool precursor_mz_known, const std::vector<FASTAFile::FASTAEntry>& entries) { + TEST_EQUAL(!entries.empty(), true) // fetch parameters for modification generation
152-164: Potential flakiness: candidates may be trimmed before the self-hit is retained. Increase max_processed_hits in the caller.
querySpectrumtrims candidates; for large peptide spaces, the self-hit could be dropped. Set a highmax_processed_hitsin the test setup.Apply this in the query test setup (see Lines 298–306):
params.setValue("fragment:max_charge", 4); params.setValue("precursor:min_charge", 1); params.setValue("precursor:max_charge", 4); params.setValue("fragment:min_mz", 0); // ensure all peptides/fragments are generated for exhaustive self-hit checks params.setValue("fragment:max_mz", 5000000); +// avoid trimming out true positives in tests +params.setValue("max_processed_hits", 100000); queryTest.setParameters(params);If flakiness persists, also bump
report:top_hits.
287-317: Good end-to-end charge handling test; add one param to de-risk trimming.Looping charges 1–4 with known/unknown precursor charge is valuable. Consider also setting
max_processed_hitshigh here (see earlier suggestion) to avoid candidate trimming.
319-367: Also assert the reported isotope_error_ equals the applied shift.You vary the precursor by −3..3 isotopes but don’t check
hit.isotope_error_. Add that check to fully validate behavior.Apply this diff inside the loop:
for (int iso = -3; iso <= 3; ++iso) { ... bool found = false; for (const auto& hit : sms.hits_){ auto result = isoTest.getPeptides()[hit.peptide_idx_]; auto psize = peptide.size(); TEST_EQUAL(result.sequence_.first, 5) TEST_EQUAL(result.sequence_.second, psize) + TEST_EQUAL(hit.isotope_error_, iso) found = true; } TEST_TRUE(found); }
371-430: Tolerance test: also assert precursor charge detection.You already pin zero isotope error; assert
hit.precursor_charge_ == 1for completeness.Apply this diff:
if ((sequence.first == 5) && (sequence.second == peptide.size()) && (hit.isotope_error_ == 0)) { found = true; + TEST_EQUAL(hit.precursor_charge_, 1) TEST_TRUE(hit.num_matched_ >= theo_spec.size()); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/pyOpenMS/pxds/PeptideSearchEngineFIAlgorithm.pxd(1 hunks)src/tests/class_tests/openms/source/FragmentIndex_test.cpp(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/tests/class_tests/openms/**/*.cpp
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Write unit tests for new functionality
Files:
src/tests/class_tests/openms/source/FragmentIndex_test.cpp
🧠 Learnings (2)
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality
Applied to files:
src/tests/class_tests/openms/source/FragmentIndex_test.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
PR: OpenMS/OpenMS#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings
Applied to files:
src/pyOpenMS/pxds/PeptideSearchEngineFIAlgorithm.pxd
🧬 Code graph analysis (1)
src/tests/class_tests/openms/source/FragmentIndex_test.cpp (3)
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h (1)
OpenMS(21-92)src/openms/include/OpenMS/CHEMISTRY/TheoreticalSpectrumGenerator.h (1)
OpenMS(17-155)src/openms/source/ANALYSIS/ID/FragmentIndex.cpp (5)
getPeptides(645-648)getPeptides(645-645)querySpectrum(447-497)querySpectrum(447-448)FragmentIndex(502-600)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-and-test (macos-13, xcode, 14.2)
- GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
- GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
- GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
- GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
- GitHub Check: cppcheck-test
🔇 Additional comments (4)
src/pyOpenMS/pxds/PeptideSearchEngineFIAlgorithm.pxd (1)
27-31: Keep PeptideIdentificationList — it’s the established peptide containerPeptideIdentificationList is a dedicated cppclass (src/pyOpenMS/pxds/PeptideIdentificationList.pxd) and is used widely across pxds headers; there is no ProteinIdentificationList alias — proteins are represented as libcpp_vector[ProteinIdentification] in many APIs (e.g. IdXMLFile.pxd, PeptideIndexing.pxd). Do not change the signature to libcpp_vector[PeptideIdentification] (breaks the typed interface). If symmetry is required, add a ProteinIdentificationList wrapper and update all call sites (breaking change).
Likely an incorrect or invalid review comment.
src/tests/class_tests/openms/source/FragmentIndex_test.cpp (3)
179-271: Build() section is solid; good coverage across enzyme, size/mass limits, missed cleavages, and mods.The expected peptide vectors are explicit and assertions check both content and ordering invariants.
Please confirm that the modification index enumeration used in
FragmentIndex::buildmatchesModifiedPeptideGenerator::applyVariableModificationsorder; otherwisemodification_idx_mapping in tests can drift across releases.
273-283: clear() test is correct and minimal.Asserts post-condition (
getPeptides().empty()) afterclear(). LGTM.
24-38: Nice high-level doc of what’s validated.Clear invariants and coverage notes improve maintainability of the tests.
|
I added bindings and tests. would still be good to have a proper test for the TOPP tool (has only been tested and benchmarked in thesis). I will merge now, as it has already been reviewed and only affects its own components (no core OpenMS stuff). |
Description
revived old PR
Checklist
How can I get additional information on failed tests during CI
Click to expand
If your PR is failing you can check outIf you click in the column that lists the failed tests you will get detailed error messages.
Advanced commands (admins / reviewer only)
Click to expand
/reformat(experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.rebuild jenkinswill retrigger Jenkins-based CI buildsSummary by CodeRabbit
New Features
Tests
Chores