11# pepdiff
22
3- Differential abundance analysis for PRM proteomics data.
3+ Differential abundance analysis for phosphoproteomics data.
44
55## Purpose
66
77Identify peptides with significant abundance changes between experimental conditions. Answers: "What's differentially abundant?"
88
99## Project Status
1010
11- ** v2 implementation complete ** (Feb 2026). The package includes :
11+ ** v1.0.0 released ** (Feb 2026). The package is feature-complete with :
1212- S3 classes: ` pepdiff_data ` and ` pepdiff_results `
1313- Three analysis methods: GLM (Gamma + emmeans), ART, pairwise
1414- Four pairwise tests: wilcoxon, bootstrap_t, bayes_t, rankprod
15+ - GLM fit diagnostics with ` plot_fit_diagnostics() `
1516- Plot methods for both classes
16- - 257 passing tests, ` devtools::check() ` passes with 0 errors/warnings
17- - Legacy functions preserved with deprecation warnings
18-
19- ** Next:** Vignettes (see ` vignette_plan.md ` and ` vignette_prompt.md ` )
17+ - Six vignettes covering all workflows
18+ - pkgdown documentation site: https://teammaclean.github.io/pepdiff/
19+ - ` devtools::check() ` passes with 0 errors/warnings
2020
2121** Companion to peppwR:**
2222- peppwR: "How many samples do I need?" (power analysis, planning)
@@ -28,6 +28,17 @@ Identify peptides with significant abundance changes between experimental condit
2828CSV → read_pepdiff() → pepdiff_data → compare() → pepdiff_results → plots
2929```
3030
31+ ## Documentation
32+
33+ - ** Getting Started** : ` vignettes/basic_workflow.Rmd `
34+ - ** GLM Analysis** : ` vignettes/glm_analysis.Rmd `
35+ - ** ART Analysis** : ` vignettes/art_analysis.Rmd `
36+ - ** Pairwise Tests** : ` vignettes/pairwise_tests.Rmd `
37+ - ** Checking Model Fit** : ` vignettes/checking_fit.Rmd `
38+ - ** Diagnostic Plots** : ` vignettes/diagnostic_plots.Rmd `
39+
40+ Online: https://teammaclean.github.io/pepdiff/
41+
3142## Design Constraints
3243
3344### Cross-Sectional Factorial Designs Only
@@ -72,7 +83,7 @@ Analysis results from `compare()`. Results in **long format** (tidy).
7283- ` results ` - tibble (long): peptide, gene_id, comparison, [ factor levels] , fold_change, log2_fc, test, p_value, fdr, significant
7384- ` comparisons ` - tibble: comparison definitions
7485- ` method ` - "glm", "art", or "pairwise"
75- - ` diagnostics ` - tibble (nested): peptide, converged, deviance, model, residuals
86+ - ` diagnostics ` - tibble (nested): peptide, converged, deviance, residuals, std_residuals, fitted
7687- ` params ` - list: alpha, fdr_method, formula, etc.
7788- ` data ` - the pepdiff_data object used
7889- ` call ` - original function call
@@ -102,7 +113,7 @@ Three methods:
102113| --------| -------| ----------|
103114| ` "glm" ` (default) | Gamma GLM + emmeans | Most proteomics data |
104115| ` "art" ` | Aligned Rank Transform | Non-parametric alternative |
105- | ` "pairwise" ` | Direct two-group tests | Legacy mode |
116+ | ` "pairwise" ` | Direct two-group tests | Simple comparisons |
106117
107118** Simple interface:**
108119``` r
@@ -126,6 +137,13 @@ compare(data,
126137- ` "bayes_t" ` - Bayes factor t-test
127138- ` "rankprod" ` - Rank products
128139
140+ ### Diagnostics
141+
142+ ``` r
143+ plot_fit_diagnostics(results )
144+ # Returns 4-panel diagnostic plot for GLM model fit assessment
145+ ```
146+
129147### Plots
130148
131149** Class methods:**
@@ -134,7 +152,8 @@ compare(data,
134152
135153** Individual functions:**
136154- ` plot_pca() ` , ` plot_distributions() ` , ` plot_missingness() `
137- - ` plot_volcano() ` , ` plot_heatmap() ` , ` plot_upset() ` , ` plot_pvalue_hist() ` , ` plot_fc_distribution() `
155+ - ` plot_volcano() ` , ` plot_heatmap() ` , ` plot_pvalue_hist() ` , ` plot_fc_distribution() `
156+ - ` plot_fit_diagnostics() ` - GLM model fit assessment
138157
139158## File Structure
140159
146165 tests.R # Pairwise statistical tests (wilcoxon, bootstrap_t, etc.)
147166 results.R # pepdiff_results class, print/summary methods
148167 plots.R # All plot functions and plot methods
168+ diagnostics.R # plot_fit_diagnostics() and helpers
149169 utils.R # Helpers, validation, internal utilities
150170 legacy.R # Deprecated compare.data.frame method
151171 legacy-pepdiff.R # Original v1 functions (preserved for compatibility)
@@ -158,7 +178,16 @@ tests/testthat/
158178 test-tests.R # Statistical test implementations
159179 test-results.R # Results class tests
160180 test-plots.R # Plot output tests
181+ test-diagnostics.R # Diagnostics function tests
161182 test-legacy.R # Backwards compatibility tests
183+
184+ vignettes/
185+ basic_workflow.Rmd # Getting started guide
186+ glm_analysis.Rmd # GLM method deep dive
187+ art_analysis.Rmd # ART method guide
188+ pairwise_tests.Rmd # Pairwise comparison methods
189+ checking_fit.Rmd # GLM diagnostics guide
190+ diagnostic_plots.Rmd # Visualization options
162191```
163192
164193## Error Handling
@@ -168,7 +197,7 @@ tests/testthat/
168197If GLM/ART doesn't converge for a peptide:
169198- Peptide excluded from results
170199- Tracked in ` diagnostics ` slot
171- - Warning in ` print() ` : "⚠ X peptides excluded (model did not converge)"
200+ - Warning in ` print() ` : "X peptides excluded (model did not converge)"
172201
173202** Philosophy:** Fail is fail. User needs to know they may need a different design.
174203
@@ -188,72 +217,16 @@ Benjamini-Hochberg applied **within each comparison**, not globally across all c
188217- Explicit namespace calls for non-base functions (` dplyr::filter() ` )
189218- Keep test implementations in sync with peppwR (wilcoxon, bootstrap_t, bayes_t, rankprod)
190219
191- ### Development Workflow
192-
193- We use the ** Discuss → TDD → Ralph Loop** workflow. See ` semi-autonomous-feature-development.md ` for details.
194-
195- ** Summary:**
196- 1 . ** Discuss** : Reach shared understanding of the task/feature
197- 2 . ** TDD** : Write failing test that captures the requirement, commit it
198- 3 . ** Clear Context** : ` /clear ` or new session to maximize implementation context
199- 4 . ** Ralph Loop** : Autonomous implementation with self-contained prompt
200- 5 . ** Smoke Test** : Human final verification
201-
202- ### Ralph Loop Prompt Template
203-
204- ```
205- /ralph-loop "Implement [feature] for pepdiff.
206-
207- ## Failing Test
208- tests/testthat/test-[feature].R
209-
210- ## Relevant Files
211- - R/[file].R
212- - [other files]
213-
214- ## Verification
215- Rscript -e 'devtools::test(filter = "[feature]")'
216- Must show: OK
217-
218- ## Success Criteria
219- All tests pass, devtools::check() has 0 errors." --completion-promise "FEATURE-COMPLETE" --max-iterations 20
220- ```
221-
222- ### Key Principles
223-
224- - ** Tests are the contract** : No ambiguity about completion
225- - ** Small tasks** : Better speed and accuracy than large tasks
226- - ** Context in files** : Specs live in test files, not conversation history
227- - ** Clear before execute** : Maximize context for implementation work
228-
229- ## Package Checks
230-
231- ### Routine Development (fast)
232-
233- Skip vignettes during routine checks:
220+ ### Package Checks
234221
235222``` r
223+ # Fast check (skip vignettes)
236224devtools :: check(vignettes = FALSE )
237- ```
238225
239- Or from command line:
240-
241- ``` bash
242- Rscript -e " devtools::check(vignettes = FALSE)"
243- ```
244-
245- ### Run Tests Only
246-
247- ``` r
226+ # Run tests only
248227devtools :: test()
249- # Or specific test file:
250- devtools :: test(filter = " compare" )
251- ```
252-
253- ### Full Check (before release)
254228
255- ``` r
256- devtools :: build_vignettes()
229+ # Full check
257230devtools :: check()
258231```
259232
@@ -264,10 +237,10 @@ devtools::check()
264237- readr - CSV import
265238- ggplot2, cowplot - core plotting
266239- emmeans - GLM contrast extraction
240+ - ARTool - ART method
267241- stringr, forcats - string/factor utilities
268242
269243### Suggests
270- - ARTool - ART method
271244- ComplexHeatmap - heatmaps (Bioconductor)
272245- RankProd - rank products (Bioconductor)
273246- UpSetR - upset plots
@@ -276,9 +249,3 @@ devtools::check()
276249- knitr, rmarkdown - vignettes
277250
278251Note: bayes_t uses a native JZS approximation (no BayesFactor dependency)
279-
280- ---
281-
282- ## Reference
283-
284- Full specification: ` pepdiff_v2_spec.md `
0 commit comments