feat(diann): Enable DIANN 2.0 for DIANNtoMSstatsPTMFormat#125
feat(diann): Enable DIANN 2.0 for DIANNtoMSstatsPTMFormat#125tonywu1999 merged 5 commits intodevelfrom
Conversation
📝 WalkthroughWalkthroughAdds a new public parameter Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRsPoem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@man/DIANNtoMSstatsPTMFormat.Rd`:
- Around line 62-66: The sentence "Run should be the same as filename." is
misplaced in the pg_qvalue_cutoff help text; remove that sentence from the
pg_qvalue_cutoff description in man/DIANNtoMSstatsPTMFormat.Rd and instead add
it to the annotation parameter documentation (either by fixing upstream in
MSstatsConvert::DIANNtoMSstatsFormat or by adding a local `@param` annotation
override in R/converters.R). Update the documentation for the annotation
parameter to include "Run should be the same as filename." and ensure
pg_qvalue_cutoff retains only its q-value cutoff description (function/parameter
references: pg_qvalue_cutoff, annotation, MSstatsConvert::DIANNtoMSstatsFormat,
R/converters.R).
- Line 68: The documentation typo in the `useUniquePeptide` description
("pepties") must be corrected; either fix it upstream in
MSstatsConvert::DIANNtoMSstatsFormat or override it locally by adding a `@param`
useUniquePeptide docstring in R/converters.R that replaces the inherited text
with the correct phrase (e.g. "Should unique peptides be removed?"); update the
`DIANNtoMSstatsPTMFormat` documentation by ensuring the corrected `@param` is
present so the generated Rd shows "peptides" instead of "pepties".
In `@R/converters.R`:
- Around line 50-70: Add arrow to DESCRIPTION under Suggests and guard the
example block that calls arrow::read_parquet so R CMD check won’t warn when
arrow isn’t installed; wrap the DIANN 2.0 example (the calls around
arrow::read_parquet and related example code that demonstrates
DIANNtoMSstatsPTMFormat) in an if (requireNamespace("arrow", quietly = TRUE)) {
... } conditional (or use requireNamespace check before calling
arrow::read_parquet) so the example is skipped when arrow is absent, and update
DESCRIPTION to include arrow in Suggests.
- Line 88: The package uses the quantificationColumn argument when calling
MSstatsConvert::DIANNtoMSstatsFormat (e.g., in functions referencing
quantificationColumn) which requires MSstatsConvert >= 1.19.1; update the
DESCRIPTION's Imports field to include MSstatsConvert (>= 1.19.1) so
installations pull a compatible version and avoid runtime failures when
DIANNtoMSstatsFormat is invoked. Ensure the package namespace and any NAMESPACE
imports remain correct after updating DESCRIPTION.
---
Duplicate comments:
In `@man/DIANNtoMSstatsPTMFormat.Rd`:
- Around line 127-147: The example for DIANNtoMSstatsPTMFormat includes an
unguarded call to arrow::read_parquet() which will break R CMD check if arrow
isn't installed; modify the converter that generates the roxygen example for the
DIANNtoMSstatsPTMFormat documentation so that the example block is wrapped in
\dontrun{} (or conditionally checks for requireNamespace("arrow", quietly=TRUE))
and emits the guarded code (e.g., wrap the arrow::read_parquet() and downstream
example calls including DIANNtoMSstatsPTMFormat and head(msstatsptm_format$PTM)
in the dontrun or conditional) so the auto-generated man page no longer contains
unguarded arrow calls.
d95980c to
4c2f863
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
R/converters.R (1)
50-70:⚠️ Potential issue | 🟠 MajorDIANN 2.0 example still missing
\dontrun{}guard — will failR CMD checkwithoutarrowinstalled.
arrowis correctly listed inSuggests(DESCRIPTION), butSuggestspackages are not guaranteed to be available duringR CMD check. The example at Line 53 callsarrow::read_parquet()unconditionally, which will produce an error whenarrowis absent.Wrap the DIANN 2.0 block in
\dontrun{}:📄 Proposed fix
+#' \dontrun{ #' # Example DIANN 2.0 #' input = system.file("tinytest/raw_data/DIANN/diann_2_ptm.parquet", #' package = "MSstatsPTM") #' input = arrow::read_parquet(input) #' annot = system.file("tinytest/raw_data/DIANN/annotation_diann_2.0_ptm.csv", #' package = "MSstatsPTM") #' annot = data.table::fread(annot) #' fasta_path = system.file("extdata", "diann.fasta", #' package="MSstatsPTM") #' #' msstatsptm_format = DIANNtoMSstatsPTMFormat( #' input, #' annot, #' protein_id_col = "Protein.Names", #' fasta_path = fasta_path, #' fasta_protein_name = "entry_name", #' use_log_file = FALSE, #' quantificationColumn = "auto" #' ) #' #' head(msstatsptm_format$PTM) +#' }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@R/converters.R` around lines 50 - 70, The example DIANN 2.0 block calls arrow::read_parquet() unconditionally and will fail R CMD check if arrow is not installed; wrap the entire example block (the lines showing usage of DIANNtoMSstatsPTMFormat, arrow::read_parquet, system.file calls and head(msstatsptm_format$PTM)) inside a \dontrun{} section so it is skipped during checks when Suggested packages are unavailable, ensuring the example remains but is not executed during R CMD check.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@R/converters.R`:
- Around line 50-70: The example DIANN 2.0 block calls arrow::read_parquet()
unconditionally and will fail R CMD check if arrow is not installed; wrap the
entire example block (the lines showing usage of DIANNtoMSstatsPTMFormat,
arrow::read_parquet, system.file calls and head(msstatsptm_format$PTM)) inside a
\dontrun{} section so it is skipped during checks when Suggested packages are
unavailable, ensuring the example remains but is not executed during R CMD
check.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
inst/tinytest/raw_data/DIANN/annotation_diann_2.0_ptm.csvis excluded by!**/*.csvinst/tinytest/raw_data/DIANN/diann_2_ptm.parquetis excluded by!**/*.parquet
📒 Files selected for processing (3)
DESCRIPTIONR/converters.Rman/DIANNtoMSstatsPTMFormat.Rd
Motivation and Context
This PR enables DIANN 2.0 support in the DIANN PTM converter by adding a flexible quantificationColumn parameter to handle differing DIANN output formats across versions (1.8.x, 1.9.x, 2.x). It lets DIANNtoMSstatsPTMFormat accept DIANN 2.0 fragment-intensity parquet inputs (per-fragment columns) via an "auto" mode while preserving existing behavior for earlier DIANN versions.
Summary of the solution
Introduce a new public argument quantificationColumn (default "FragmentQuantCorrected") to DIANNtoMSstatsPTMFormat, propagate it into the underlying MSstatsConvert::DIANNtoMSstatsFormat calls for both PTM and optional PROTEIN paths, update documentation and examples to demonstrate DIANN 2.0 usage (including arrow::read_parquet), and update package metadata to suggest arrow and require a newer MSstatsConvert.
Detailed changes
R/converters.R
man/DIANNtoMSstatsPTMFormat.Rd
DESCRIPTION
Test data / examples
Unit tests added or modified
Coding guidelines (violations or notes)