fix(MSstats+): Fix download analysis code#209
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR adds optional anomaly-score processing in Spectronaut conversion (run-order loading and anomaly parameters) and makes MSstats protein summarization method configurable; it also conditionally appends an AnomalyScores quality-metrics plot when enabled. ChangesAnomaly-score integration across data conversion and preprocessing
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ 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: 2
🤖 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 `@R/utils.R`:
- Around line 980-987: The else branch building the codes string uses hardcoded
SpectronauttoMSstatsFormat parameters (filter_with_Qvalue = TRUE, qvalue_cutoff
= 0.01, removeProtein_with1Feature = TRUE and fewMeasurements="remove") which
diverges from the if-branch and from getData() runtime behavior that use
input$q_val, input$q_cutoff, input$remove and do not include fewMeasurements;
update the else branch that appends to codes so it uses the same input variables
(input$q_val, input$q_cutoff, input$remove) and remove or align the
fewMeasurements argument to match the converter_args used in getData() and the
if branch, ensuring SpectronauttoMSstatsFormat invocations are consistent across
both branches.
- Around line 966-978: The anomalyModelFeatures vector passed into
SpectronauttoMSstatsFormat uses column names that violate MSstats+ requirements
(they start with "F." and include spaces/dots), so update the entries in
anomalyModelFeatures inside the call to SpectronauttoMSstatsFormat to use the
exact precursor-level column names present in your Spectronaut output and that
conform to MSstats+ naming (e.g., remove leading "F.", remove dots/spaces and
match parentheses style like FGShapeQualityScore(MS2) if that is the real
column), or replace them with other valid precursor-level feature column names;
verify the exact column names in your input data and ensure anomalyModelFeatures
contains those exact strings before calling SpectronauttoMSstatsFormat.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Motivation and Context
This PR fixes generation of the R code users download from MSstatsShiny so it correctly supports Spectronaut anomaly-score computation and makes the protein summarization method configurable. Generated reproducible code now conditionally includes anomaly-score processing (loading run-order, anomaly-model parameters, parallel/core settings) when enabled, and uses the UI-selected summarization method instead of a hardcoded "TMP".
Detailed Changes
R/utils.R — getDataCode()
filetype == 'spec') the generated conversion call to SpectronauttoMSstatsFormat() is now conditional oncalculate_anomaly_scores:run_order_path.R/utils.R — preprocessDataCode()
qc_input$summaryMethodwith fallback to"TMP"instead of being hardcoded.loadpage_input$calculate_anomaly_scoresis true, appended generated plotting code callsMSstats::MSstatsQualityMetricsPlot()for metric = "AnomalyScores" withisPlotly = TRUE.No exported function signatures were changed.
Unit Tests
calculateAnomalyScores = TRUE.runOrderreference/path is present.anomalyModelFeaturesvector is present.n_trees(100) is present.Coding Guidelines Observations