Repository navigation
(feat,osw): Port pyprophet inference context methods - #9280
Conversation
…ta structures Co-authored-by: Copilot <[email protected]>
…, and gene-level context inference Co-authored-by: Copilot <[email protected]>
…ptidoform, and level contexts Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…eptidoform contexts
…rotein contexts Co-authored-by: Copilot <[email protected]>
…mplementations Co-authored-by: Copilot <[email protected]>
…eInference, PeptidoformInference, and ProteinInference to sources list
…ference, and PeptidoformInference Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…ion inference options Co-authored-by: Copilot <[email protected]>
…e and add legacy support
…OpenMS into add/pyprophet_inference_contexts
…ameters for error estimation and context inference Co-authored-by: Copilot <[email protected]>
|
@singjc The following names might be missing from the
Please consider applying the following patch: --- AUTHORS 2026-05-09 01:58:40.283853501 +0000
+++ AUTHORS.new 2026-05-09 01:58:45.337413289 +0000
@@ -109,6 +109,7 @@
- Sandro Andreotti
- Santhil
- Simon Gene Gottlieb
+ - singjc
- Steffen Sass
- Stephan Aiche
- Sven Nahnsen |
…otein, and gene inference
…_inference_contexts
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR adds OpenSWATH multi-level inference: data contracts and configs, peptidoform Bayesian inference, level-context error-estimation, OSW SQLite readers/writers, a TOPP tool (OpenSwathInfer) to run tasks, tests, and CMake/docs updates. ChangesOpenSWATH Multi-Level Inference System
Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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: 4
🧹 Nitpick comments (8)
src/openms/include/OpenMS/ANALYSIS/OPENSWATH/ProteinInference.h (2)
24-30: ⚡ Quick winThree near-identical wrapper classes — consider consolidating.
ProteinInference,PeptideInference, andGeneInferenceare stateless classes whoseinfer(...)const methods only differ in a singleconfig.level == InferenceLevel::{Protein,Peptide,Gene}precondition before delegating toLevelContextInference::infer. This duplicates three header/source pairs and adds ABI surface for no behavioral benefit, since the actual dispatch is already driven byconfig.level.Possible consolidations:
- Drop the wrappers and call
LevelContextInference::inferdirectly fromOpenSwathInfer.cpp(the level is already inconfig.level).- Or keep one entry point and expose three
statichelpers (inferPeptide/inferProtein/inferGene) onLevelContextInferencethat set/check the level and forward.Either avoids the maintenance burden of keeping three header/source/
sources.cmakeentries in sync. Also note the methods are currently non-static conston stateless classes — if the wrappers are kept, preferstaticto matchLevelContextInference::infer.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openms/include/OpenMS/ANALYSIS/OPENSWATH/ProteinInference.h` around lines 24 - 30, The three near-identical wrapper classes ProteinInference, PeptideInference, and GeneInference duplicate ABI and logic; consolidate by removing two wrappers and either call LevelContextInference::infer(...) directly from OpenSwathInfer.cpp (since config.level already drives behavior) or implement a single entrypoint (e.g., keep one wrapper or add three static helpers on LevelContextInference like inferProtein/inferPeptide/inferGene) that validate config.level and forward to LevelContextInference::infer; if you keep wrappers, make their infer methods static (not instance const) to reflect stateless behavior and remove the extra header/source/sources.cmake entries.
27-29: 💤 Low valueAdd
[in]parameter direction tags.Single-line
///doc lacks parameter direction annotations and the@throws Exception::Preconditionthrown for mismatchedconfig.level. Same applies to the siblingPeptideInference.handGeneInference.h. As per coding guidelines: "Use[in],[out], or[in,out]parameter direction tags for all Doxygen parameters".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openms/include/OpenMS/ANALYSIS/OPENSWATH/ProteinInference.h` around lines 27 - 29, Update the Doxygen comment for the method infer in class ProteinInference (function signature infer(const std::vector<LevelContextInputRow>& input, const LevelContextInferenceConfig& config) const) to include parameter direction tags for both parameters (e.g., `@param[in] input` and `@param[in] config`) and add the `@throws Exception::Precondition` clause documenting the mismatch case for `config.level`; apply the same change to the corresponding infer declarations in PeptideInference.h and GeneInference.h so all three headers include `[in]` tags and the throws annotation.src/tests/class_tests/openms/source/OSWFileInference_test.cpp (1)
37-47: 💤 Low value
scalarInt64_should bail whensqlite3_stepdoes not yield a row.
TEST_EQUALin OpenMS class tests is non-fatal, so whensqlite3_stepreturns anything other thanSQLITE_ROWthe helper still callssqlite3_column_int64on a non-data statement and returns0. That can silently mask query/schema regressions (a legitimate failure becomes a0 == expectedmismatch with no diagnostic). Returning a sentinel/throwing on non-ROW makes the failure mode obvious.🛡️ Proposed fix
Int64 scalarInt64_(const String& filename, const String& query) { SqliteConnector conn(filename, SqliteConnector::SqlOpenMode::READ_ONLY); sqlite3_stmt* stmt = nullptr; conn.prepareStatement(&stmt, query); const int state = sqlite3_step(stmt); TEST_EQUAL(state, SQLITE_ROW) - const Int64 value = sqlite3_column_int64(stmt, 0); + const Int64 value = (state == SQLITE_ROW) ? sqlite3_column_int64(stmt, 0) : Int64{-1}; sqlite3_finalize(stmt); return value; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/tests/class_tests/openms/source/OSWFileInference_test.cpp` around lines 37 - 47, The helper scalarInt64_ currently calls sqlite3_column_int64 even when sqlite3_step(stmt) != SQLITE_ROW (TEST_EQUAL is non-fatal), which can mask failures; update scalarInt64_ to check the step result and if it is not SQLITE_ROW immediately finalize the statement and fail fast (either throw a descriptive exception or use a fatal test macro) instead of returning 0, ensuring sqlite3_finalize(stmt) is always called before bailing; reference sqlite3_step, sqlite3_column_int64, sqlite3_finalize, and TEST_EQUAL in your changes.src/openms/include/OpenMS/ANALYSIS/OPENSWATH/LevelContextInference.h (1)
31-55: ⚡ Quick winDocument parameter directions and exception contract.
The Doxygen block lacks
[in]direction tags on@paramand does not list the precondition exceptions thrown by the implementation. The implementation inLevelContextInference.cppthrowsException::PreconditionforInferenceLevel::Peptidoform, for missingrun_idin run-specific mode, and for empty/all-NaN target/decoy distributions — none of these are visible from the header. As per coding guidelines: "Use[in],[out], or[in,out]parameter direction tags for all Doxygen parameters" and "Document possible exceptions in Doxygen comments using@throwsor@exceptiontags".📝 Proposed Doxygen update
- `@param` input Compact input rows selected for one inference level - `@param` config Inference and error-estimation configuration - - `@return` Result rows containing the original entity and score plus derived - p-value, q-value, and PEP estimates + `@param`[in] input Compact input rows selected for one inference level + `@param`[in] config Inference and error-estimation configuration + + `@return` Result rows containing the original entity and score plus derived + p-value, q-value, and PEP estimates + + `@throws` Exception::Precondition if `@p` config.level is InferenceLevel::Peptidoform, + if `@p` config.context is RunSpecific and any input row is missing a run_id, + or if the target/decoy score distribution is empty / contains only non-finite values. */🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openms/include/OpenMS/ANALYSIS/OPENSWATH/LevelContextInference.h` around lines 31 - 55, Update the Doxygen for LevelContextInference::infer to mark parameters with direction tags (e.g., `@param` [in] input and `@param` [in] config) and add `@throws/`@exception entries documenting the precondition violations thrown by the implementation: Exception::Precondition for when config.level == InferenceLevel::Peptidoform, for missing/empty RUN_ID when config.mode is run-specific, and for empty or all-NaN target/decoy score distributions; reference the classes/types LevelContextInputRow and LevelContextInferenceConfig in the descriptions so callers can locate the preconditions.src/openms/source/ANALYSIS/OPENSWATH/LevelContextInference.cpp (2)
117-203: ⚡ Quick winDead computation:
statMetrics_results are discarded, and its innerfdr/fnr/tnlocals are never stored.
statMetrics_produces aMetricsstruct whose only field (svalues) is computed but the call at line 281 throws the result away with(void)statMetrics_(...). Inside the loop (lines 138-191),fdr,fnr, andtnare recomputed every iteration, never written to any output container, andtnis even silenced with(void)tn;. The retained comment ("Keep the PyProphet metric construction order even though only p/q/pep are returned") acknowledges this is intentional for porting fidelity, but it leaves dead numerics in a hot path of the new inference and obscures what the function actually contributes.Recommend either:
- Drop the line 281 call entirely (and remove
statMetrics_/Metricsif no caller remains), sincepvalues/qvalues/pepsare already produced byMath::MultipleTesting::qValue/lfdr.- Or, if s-values are needed for parity with PyProphet output, propagate them through
ErrorStatisticsand the publicLevelContextResultRowinstead of computing-and-discarding.Either way, the unused
fdr/fnr/tnarithmetic and the(void)tn;line should go.Also applies to: 280-281
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openms/source/ANALYSIS/OPENSWATH/LevelContextInference.cpp` around lines 117 - 203, The call to statMetrics_ and its internal fdr/fnr/tn math are dead: statMetrics_ (and Metrics) only fills svalues but its result is discarded where invoked, while fdr/fnr/tn are never stored (tn even silenced). Either remove the unused call and delete statMetrics_/Metrics (and any dead math in LevelContextInference) if you rely solely on Math::MultipleTesting::qValue/lfdr for p/q/pep, or modify ErrorStatistics and LevelContextResultRow to carry the svalues produced by statMetrics_ so the function's results are propagated; in both cases eliminate the unused per-iteration computations (fdr/fnr/tn and the “(void)tn;” line) from statMetrics_ if you choose removal or refactor them into stored fields if you choose propagation.
337-389: ⚖️ Poor tradeoffRun-specific grouping triple-copies input rows.
input→indexed_rows(vector ofpair<Size, LevelContextInputRow>) →grouped_rows(map<Int64, vector<pair<Size, LevelContextInputRow>>>). For large peptide/protein inference workloads this materializes the entire input three times in memory. A vector of indices grouped perrun_id(or storing pointers/reference_wrapperinindexed_rows) achieves the same and avoids the copies.Minor since correctness is unaffected and the rows are compact, but worth tightening if inference is run on whole-experiment OSW DBs.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openms/source/ANALYSIS/OPENSWATH/LevelContextInference.cpp` around lines 337 - 389, The code currently copies LevelContextInputRow into indexed_rows and then again into grouped_rows, tripling memory; change this to group indices (Size) or pointers instead: in LevelContextInference::infer replace indexed_rows (vector<pair<Size, LevelContextInputRow>>) with a vector<Size> (or vector<pair<Size, const LevelContextInputRow*>>) and build grouped_rows as map<Int64, vector<Size>> (or vector<const LevelContextInputRow*>), then modify or overload assignErrorStatistics_ (referenced by name assignErrorStatistics_) to accept the new index/pointer-based grouping along with the original input vector so it can look up rows by index (use the existing results vector and config.error unchanged); ensure run-specific validation still checks run_id via input[index] and update the try/catch that reports RUN_ID to use the index-based grouping.src/tests/class_tests/openms/source/LevelContextInference_test.cpp (1)
179-182: ⚡ Quick winUse the test framework’s numeric assertions instead of booleanized
std::fabschecks.These assertions bypass the active tolerance helpers and make failures harder to diagnose. Please use
TEST_REAL_SIMILARwith the appropriate tolerance settings here, orFuzzyDiffif you want fixture-style fuzzy matching.As per coding guidelines "Use FuzzyDiff for numeric comparisons in tests; use whitelist for unstable lines."
Also applies to: 204-207, 220-220
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/tests/class_tests/openms/source/LevelContextInference_test.cpp` around lines 179 - 182, The test uses booleanized fabs checks for numeric comparisons (peptide_row->score, peptide_row->pvalue, peptide_row->qvalue, peptide_row->pep) which bypass the framework's tolerance helpers; replace each TEST_EQUAL(std::fabs(...) < tol, true) with the test framework's numeric assertion (e.g. TEST_REAL_SIMILAR or the FuzzyDiff helper) using appropriate tolerances (match the existing tol values like 1e-8 and 5e-4) so failures show diffs; apply the same replacement pattern for the other occurrences flagged (the checks around the peptide_row fields at lines noted in the comment).src/openms/include/OpenMS/FORMAT/OSWFile.h (1)
112-142: ⚡ Quick winDocument the new OSW inference API with full Doxygen blocks.
These are new public header methods, but they currently only have short
///summaries. Please switch them to/** ... */docs with@brief,@param[in],@return, and any relevant@throwsso the generated API docs stay complete and consistent.As per coding guidelines "Add Doxygen comments for new public methods and classes" and "Include parameter direction tags
[in],[out],[in,out]for all Doxygen method parameters."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openms/include/OpenMS/FORMAT/OSWFile.h` around lines 112 - 142, Convert the short "///" summaries for the new public methods into full Doxygen blocks using "/** ... */" and include `@brief`, `@param`[in] (or [out]/[in,out] where applicable), `@return` and any relevant `@throws` tags; specifically update readIPFPrecursorData(const PeptidoformInferenceConfig& config), readIPFTransitionData(const PeptidoformInferenceConfig& config), readIPFAlignmentData(const PeptidoformInferenceConfig& config), the historical overload readIPFAlignmentData(double ipf_max_alignment_pep), writeIPFResults(const String& output_filename, const std::vector<IPFResultRow>& results), readLevelContextData(InferenceLevel level, InferenceContext context), writeLevelContextResults(const String& output_filename, InferenceLevel level, InferenceContext context, const std::vector<LevelContextResultRow>& results) and readRunBasenames(); for each comment add a short `@brief` describing the purpose, `@param`[in] entries for all input parameters (note `@param`[out] only if returning via arguments), `@return` describing the returned container and contents, and `@throws` if the method can raise exceptions (e.g. IO or DB errors) so the public API docs are complete and consistent with the project's Doxygen conventions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/openms/source/ANALYSIS/OPENSWATH/PeptidoformInference.cpp`:
- Around line 48-57: The code incorrectly treats row.feature_id ==
row.alignment_group_id as a sentinel for “no alignment group”; change the
sentinel to a dedicated marker (e.g. alignment_group_id < 0) or make
alignment_group_id optional so real DENSE_RANK group IDs aren’t conflated with
feature IDs. Update the checks around row.feature_id and row.alignment_group_id
(both the block that pushes to result vs grouped_rows and the similar check at
lines ~379-381) to test the new sentinel (e.g. if alignment_group_id is missing
or <0 then result.push_back(row) else
grouped_rows[alignment_group_id].push_back(&row)); ensure any code that
constructs rows sets the reserved negative value or the optional explicitly for
“no group.”
- Around line 191-202: The fallback currently inserts synthetic bm_rows with
impossible evidence (true-state evidence = 0.0), which
applyBM()/precursorInference() treats as a forced-zero posterior; change the
synthetic evidence to neutral values instead of impossible ones: in the block
that pushes into bm_rows (using variables rows, missing_rows_added, bm_rows)
replace the hard-coded 0.0 and 1.0 evidence entries with a neutral probability
(e.g. 0.5) for both true and false synthetic rows so the fallback provides
non-informative/neutral evidence rather than excluding the feature.
In `@src/openms/source/FORMAT/OSWFile.cpp`:
- Around line 63-106: The readers currently call createIPFIndexes_ and
createLevelContextIndexes_ which call tryCreateIndexIfTableExists_ and reopen
the DB as READWRITE, mutating input OSWs; change the behavior so read-only read*
APIs never create indexes: either (A) make createIPFIndexes_ and
createLevelContextIndexes_ no-ops when the SqliteConnector reports read-only
(add and use a isReadOnly()/isReadOnlyMode flag on SqliteConnector or check its
open mode), or (B) move all index creation out of these readers into an explicit
update/upgrade path (e.g., a new ensureIndexesForWrite()/upgradeIndexes
function) that callers invoke only when they intend to write; update
tryCreateIndexIfTableExists_ to respect the read-only flag and return without
executing DDL when read-only.
- Around line 818-821: The code currently calls
requireTable_("SCORE_TRANSITION") when either config.ipf_ms1_scoring or
config.ipf_ms2_scoring is true, which incorrectly blocks MS1-only runs; change
the precondition to only require the SCORE_TRANSITION table when MS2 scoring is
enabled (i.e., when config.ipf_ms2_scoring is true) by updating the if condition
that wraps the requireTable_ call in OSWFile.cpp so it checks
config.ipf_ms2_scoring (or config.ipf_ms1_scoring && config.ipf_ms2_scoring)
instead of config.ipf_ms1_scoring || config.ipf_ms2_scoring.
---
Nitpick comments:
In `@src/openms/include/OpenMS/ANALYSIS/OPENSWATH/LevelContextInference.h`:
- Around line 31-55: Update the Doxygen for LevelContextInference::infer to mark
parameters with direction tags (e.g., `@param` [in] input and `@param` [in] config)
and add `@throws/`@exception entries documenting the precondition violations
thrown by the implementation: Exception::Precondition for when config.level ==
InferenceLevel::Peptidoform, for missing/empty RUN_ID when config.mode is
run-specific, and for empty or all-NaN target/decoy score distributions;
reference the classes/types LevelContextInputRow and LevelContextInferenceConfig
in the descriptions so callers can locate the preconditions.
In `@src/openms/include/OpenMS/ANALYSIS/OPENSWATH/ProteinInference.h`:
- Around line 24-30: The three near-identical wrapper classes ProteinInference,
PeptideInference, and GeneInference duplicate ABI and logic; consolidate by
removing two wrappers and either call LevelContextInference::infer(...) directly
from OpenSwathInfer.cpp (since config.level already drives behavior) or
implement a single entrypoint (e.g., keep one wrapper or add three static
helpers on LevelContextInference like inferProtein/inferPeptide/inferGene) that
validate config.level and forward to LevelContextInference::infer; if you keep
wrappers, make their infer methods static (not instance const) to reflect
stateless behavior and remove the extra header/source/sources.cmake entries.
- Around line 27-29: Update the Doxygen comment for the method infer in class
ProteinInference (function signature infer(const
std::vector<LevelContextInputRow>& input, const LevelContextInferenceConfig&
config) const) to include parameter direction tags for both parameters (e.g.,
`@param[in] input` and `@param[in] config`) and add the `@throws
Exception::Precondition` clause documenting the mismatch case for
`config.level`; apply the same change to the corresponding infer declarations in
PeptideInference.h and GeneInference.h so all three headers include `[in]` tags
and the throws annotation.
In `@src/openms/include/OpenMS/FORMAT/OSWFile.h`:
- Around line 112-142: Convert the short "///" summaries for the new public
methods into full Doxygen blocks using "/** ... */" and include `@brief`,
`@param`[in] (or [out]/[in,out] where applicable), `@return` and any relevant
`@throws` tags; specifically update readIPFPrecursorData(const
PeptidoformInferenceConfig& config), readIPFTransitionData(const
PeptidoformInferenceConfig& config), readIPFAlignmentData(const
PeptidoformInferenceConfig& config), the historical overload
readIPFAlignmentData(double ipf_max_alignment_pep), writeIPFResults(const
String& output_filename, const std::vector<IPFResultRow>& results),
readLevelContextData(InferenceLevel level, InferenceContext context),
writeLevelContextResults(const String& output_filename, InferenceLevel level,
InferenceContext context, const std::vector<LevelContextResultRow>& results) and
readRunBasenames(); for each comment add a short `@brief` describing the purpose,
`@param`[in] entries for all input parameters (note `@param`[out] only if returning
via arguments), `@return` describing the returned container and contents, and
`@throws` if the method can raise exceptions (e.g. IO or DB errors) so the public
API docs are complete and consistent with the project's Doxygen conventions.
In `@src/openms/source/ANALYSIS/OPENSWATH/LevelContextInference.cpp`:
- Around line 117-203: The call to statMetrics_ and its internal fdr/fnr/tn math
are dead: statMetrics_ (and Metrics) only fills svalues but its result is
discarded where invoked, while fdr/fnr/tn are never stored (tn even silenced).
Either remove the unused call and delete statMetrics_/Metrics (and any dead math
in LevelContextInference) if you rely solely on
Math::MultipleTesting::qValue/lfdr for p/q/pep, or modify ErrorStatistics and
LevelContextResultRow to carry the svalues produced by statMetrics_ so the
function's results are propagated; in both cases eliminate the unused
per-iteration computations (fdr/fnr/tn and the “(void)tn;” line) from
statMetrics_ if you choose removal or refactor them into stored fields if you
choose propagation.
- Around line 337-389: The code currently copies LevelContextInputRow into
indexed_rows and then again into grouped_rows, tripling memory; change this to
group indices (Size) or pointers instead: in LevelContextInference::infer
replace indexed_rows (vector<pair<Size, LevelContextInputRow>>) with a
vector<Size> (or vector<pair<Size, const LevelContextInputRow*>>) and build
grouped_rows as map<Int64, vector<Size>> (or vector<const
LevelContextInputRow*>), then modify or overload assignErrorStatistics_
(referenced by name assignErrorStatistics_) to accept the new
index/pointer-based grouping along with the original input vector so it can look
up rows by index (use the existing results vector and config.error unchanged);
ensure run-specific validation still checks run_id via input[index] and update
the try/catch that reports RUN_ID to use the index-based grouping.
In `@src/tests/class_tests/openms/source/LevelContextInference_test.cpp`:
- Around line 179-182: The test uses booleanized fabs checks for numeric
comparisons (peptide_row->score, peptide_row->pvalue, peptide_row->qvalue,
peptide_row->pep) which bypass the framework's tolerance helpers; replace each
TEST_EQUAL(std::fabs(...) < tol, true) with the test framework's numeric
assertion (e.g. TEST_REAL_SIMILAR or the FuzzyDiff helper) using appropriate
tolerances (match the existing tol values like 1e-8 and 5e-4) so failures show
diffs; apply the same replacement pattern for the other occurrences flagged (the
checks around the peptide_row fields at lines noted in the comment).
In `@src/tests/class_tests/openms/source/OSWFileInference_test.cpp`:
- Around line 37-47: The helper scalarInt64_ currently calls
sqlite3_column_int64 even when sqlite3_step(stmt) != SQLITE_ROW (TEST_EQUAL is
non-fatal), which can mask failures; update scalarInt64_ to check the step
result and if it is not SQLITE_ROW immediately finalize the statement and fail
fast (either throw a descriptive exception or use a fatal test macro) instead of
returning 0, ensuring sqlite3_finalize(stmt) is always called before bailing;
reference sqlite3_step, sqlite3_column_int64, sqlite3_finalize, and TEST_EQUAL
in your changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b64f7d31-096c-4b85-a959-0fff4aeedda8
📒 Files selected for processing (25)
doc/doxygen/public/TOPP.doxygensrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/GeneInference.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/LevelContextInference.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathInferenceConfig.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathInferenceData.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/PeptideInference.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/PeptidoformInference.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/ProteinInference.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/sources.cmakesrc/openms/include/OpenMS/FORMAT/OSWFile.hsrc/openms/source/ANALYSIS/OPENSWATH/GeneInference.cppsrc/openms/source/ANALYSIS/OPENSWATH/LevelContextInference.cppsrc/openms/source/ANALYSIS/OPENSWATH/PeptideInference.cppsrc/openms/source/ANALYSIS/OPENSWATH/PeptidoformInference.cppsrc/openms/source/ANALYSIS/OPENSWATH/ProteinInference.cppsrc/openms/source/ANALYSIS/OPENSWATH/sources.cmakesrc/openms/source/APPLICATIONS/ToolHandler.cppsrc/openms/source/FORMAT/OSWFile.cppsrc/tests/class_tests/openms/data/PyProphet_inference_test.oswsrc/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/LevelContextInference_test.cppsrc/tests/class_tests/openms/source/OSWFileInference_test.cppsrc/tests/class_tests/openms/source/PeptidoformInference_test.cppsrc/topp/OpenSwathInfer.cppsrc/topp/executables.cmake
…ove error handling for alignment candidate
…nference configuration
…ntinel values for negative group ids
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/openms/source/ANALYSIS/OPENSWATH/PeptidoformInference.cpp`:
- Around line 78-85: The propagation gate is incorrectly using per-transition
PEP (row_ptr->pep) instead of precursor-level confidence; change the conditional
in the propagation block so it checks row_ptr->precursor_peakgroup_pep against
confidence_threshold (i.e., use row_ptr->precursor_peakgroup_pep <=
confidence_threshold) when deciding whether to create and push the propagated
TransitionInferenceRow (the code that clones *row_ptr, sets
propagated.feature_id = target_feature_id and pushes to propagated_rows should
remain unchanged).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 934ecd51-061f-4691-9551-c0ac0a9df4d5
📒 Files selected for processing (5)
src/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathInferenceConfig.hsrc/openms/source/ANALYSIS/OPENSWATH/PeptidoformInference.cppsrc/openms/source/FORMAT/OSWFile.cppsrc/openms/source/MATH/STATISTICS/KernelDensityEstimation.cppsrc/tests/class_tests/openms/source/KernelDensityEstimation_test.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
- src/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathInferenceConfig.h
…on group and rename protein-level inference
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathProteinInference.h`:
- Around line 27-29: The Doxygen for the infer method is missing required tags;
update the comment for infer(const std::vector<LevelContextInputRow>& input,
const LevelContextInferenceConfig& config) const to include an `@brief` describing
its purpose, `@param`[in] tags for both input (vector of LevelContextInputRow) and
config (LevelContextInferenceConfig), an `@return` describing the returned
std::vector<LevelContextResultRow>, and a `@throws` documenting that it may throw
Exception::Precondition (with brief condition when thrown); place these tags
above the infer declaration so tools and users get complete API docs.
- Around line 19-23: The class Doxygen comment for OpenSwathProteinInference is
missing a required `@brief` tag; update the class comment block in
OpenSwathProteinInference.h to include an explicit `@brief` line describing the
class purpose (e.g., "@brief OpenSwath protein-level context inference.") so it
complies with the coding guidelines, leaving the rest of the `@ingroup` and other
tags unchanged and ensuring the `@brief` appears immediately after the /**
opening.
In `@src/tests/class_tests/openms/source/OSWFileInference_test.cpp`:
- Line 43: The TEST_EQUAL macro invocation is missing a terminating semicolon
which causes a compile error; update the test line invoking TEST_EQUAL(state,
SQLITE_ROW) to end with a semicolon so the statement becomes a valid expression
(i.e., add ';' after TEST_EQUAL(state, SQLITE_ROW)) in the
OSWFileInference_test.cpp test function.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1749ab71-b5ec-4a70-ae91-1df330a8bb98
📒 Files selected for processing (13)
src/openms/include/OpenMS/ANALYSIS/OPENSWATH/GeneInference.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/LevelContextInference.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathInferenceConfig.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathInferenceData.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathProteinInference.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/PeptideInference.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/PeptidoformInference.hsrc/openms/include/OpenMS/ANALYSIS/OPENSWATH/sources.cmakesrc/openms/source/ANALYSIS/OPENSWATH/OpenSwathProteinInference.cppsrc/openms/source/ANALYSIS/OPENSWATH/sources.cmakesrc/tests/class_tests/openms/source/LevelContextInference_test.cppsrc/tests/class_tests/openms/source/OSWFileInference_test.cppsrc/topp/OpenSwathInfer.cpp
✅ Files skipped from review due to trivial changes (3)
- src/openms/include/OpenMS/ANALYSIS/OPENSWATH/GeneInference.h
- src/openms/include/OpenMS/ANALYSIS/OPENSWATH/sources.cmake
- src/openms/include/OpenMS/ANALYSIS/OPENSWATH/PeptidoformInference.h
🚧 Files skipped from review as they are similar to previous changes (6)
- src/openms/source/ANALYSIS/OPENSWATH/sources.cmake
- src/openms/include/OpenMS/ANALYSIS/OPENSWATH/LevelContextInference.h
- src/openms/include/OpenMS/ANALYSIS/OPENSWATH/PeptideInference.h
- src/topp/OpenSwathInfer.cpp
- src/tests/class_tests/openms/source/LevelContextInference_test.cpp
- src/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathInferenceData.h
| /// Infer protein-level statistics for the provided rows. | ||
| std::vector<LevelContextResultRow> infer(const std::vector<LevelContextInputRow>& input, | ||
| const LevelContextInferenceConfig& config) const; |
There was a problem hiding this comment.
Complete method documentation with required Doxygen tags.
The method documentation is missing several required elements:
@brieftag (mandatory, not auto-generated)[in]parameter direction tags forinputandconfig@returndescription@throwsdocumentation (the implementation throwsException::Precondition)
📝 Proposed fix
- /// Infer protein-level statistics for the provided rows.
+ /**
+ `@brief` Infer protein-level statistics for the provided rows.
+
+ `@param`[in] input Vector of level-context input rows containing analyte scores
+ `@param`[in] config Inference configuration (must have config.level == InferenceLevel::Protein)
+ `@return` Vector of level-context result rows with computed statistics
+ `@throws` Exception::Precondition if config.level != InferenceLevel::Protein
+ */
std::vector<LevelContextResultRow> infer(const std::vector<LevelContextInputRow>& input,
const LevelContextInferenceConfig& config) const;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/openms/include/OpenMS/ANALYSIS/OPENSWATH/OpenSwathProteinInference.h`
around lines 27 - 29, The Doxygen for the infer method is missing required tags;
update the comment for infer(const std::vector<LevelContextInputRow>& input,
const LevelContextInferenceConfig& config) const to include an `@brief` describing
its purpose, `@param`[in] tags for both input (vector of LevelContextInputRow) and
config (LevelContextInferenceConfig), an `@return` describing the returned
std::vector<LevelContextResultRow>, and a `@throws` documenting that it may throw
Exception::Precondition (with brief condition when thrown); place these tags
above the infer declaration so tools and users get complete API docs.
…re values are within [0.0, 1.0] feat(OSWFileInference): refactor row counting to use a temporary view for filtered queries
…ation and adjust PEP validation
|
|
||
| @ingroup TargetedQuantitation | ||
| */ | ||
| class OPENMS_DLLAPI PeptideInference |
There was a problem hiding this comment.
I wonder if we should put this into a different namespace (pyprophet?) @jpfeuffer @singjc .
We now have basicproteininference, the bayesian one, and percolator that might do overlapping tasks +
the ones from pyprophet.
What do you guys think?
There was a problem hiding this comment.
Ahh, I did initially have ProteinInference, but renamed to OpenSwathProteinInference to avoid conflict with the existing ProteinInference in QUANTITATION. I can do the same for the PeptidoformInference, PeptideInference and GeneInference?
I think at a another stage, we would could compare and see if we could use some of the existing inferences for OpenSwath results. At some point we did have an undergrad student try to use the bayesian one (EPIFANY) for protein inference in OpenSwath, but I don't think the results were optimal at the time..
…vels - Introduced OpenSwathGeneInference class for gene-level context inference. - Introduced OpenSwathPeptideInference class for peptide-level context inference. - Introduced OpenSwathPeptidoformInference class for peptidoform-level context inference. - Updated source files and headers to reflect the new class names and structures. - Modified tests to utilize the new OpenSwath inference classes. - Ensured proper integration of new classes within the existing OpenMS framework.
…9374) The TOPP tool OpenSwathInfer was already listed under 'New tools' in the TOPP tools section and doc/doxygen/public/TOPP.doxygen was already updated by the originating PR, but the corresponding OpenMS Library additions were missing from the 'Added' sub-section. Add entries for: - OpenSwathInferenceData (row types and enums) - OpenSwathInferenceConfig (configuration structs) - LevelContextInference (shared context inference) - OpenSwathGeneInference, OpenSwathPeptideInference, OpenSwathProteinInference - OpenSwathPeptidoformInference (IPF) - OSWFile new inference methods - KernelDensityEstimation bandwidth fallback for degenerate inputs Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]>
Description
This PR ports over the peptidoform, peptide, protein and gene inference methods implemented in PyProphet for OpenSWATH analysis. The changes add new data structures, configuration options, and core inference classes, as well as extending the
OSWFileinterface to read and write inference data.Main changes:
1. New inference data structures and configuration:
OpenSwathInferenceData.hdefining inference levels, contexts, and row types for peptidoform, peptide, protein, and gene inference, including helper functions for string conversion.OpenSwathInferenceConfig.hwith configuration structs for error estimation and inference at different levels, closely mirroring PyProphet CLI defaults.2. Core inference classes:
PeptidoformInference,PeptideInference,ProteinInference,GeneInference, andLevelContextInferenceclasses, each encapsulating logic for their respective inference tasks and exposing clear interfaces for statistical estimation. [1] [2] [3] [4] [5]3. OSW file interface extensions:
OSWFileto support reading and writing of all new inference data types and results, and to provide run/basename mapping utilities. [1] [2] [3]4. Build system integration:
sources.cmaketo include all new headers for compilation and installation. [1] [2] [3]5. Documentation:
TOPP_OpenSwathInfer.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
Documentation