Add ferx as NLME fitting backend - #58
Conversation
Integrate ferx (FeRx-NLME/ferx-r) as a new model-fitting backend
alongside pharmpy, PsN, and nlmixr2.
New functions:
- luna_run_ferx(): run ferx models, save results as {id}-fit.rds
- luna_ferx_info(): print convergence/OFV summary from saved results
ferx paths added to: luna_check(), get_status(), get_all_results(),
update_cache(), runs_as_table().
Includes example project (example-4-ferx) with 3 busulfan models
and a full workflow vignette, plus 22 unit tests using mockery stubs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| c(list(model = model_file, data = data_path), dots)) | ||
|
|
||
| result_file <- file.path(folder, paste0(id, "-fit.rds")) | ||
| saveRDS(result, result_file) |
There was a problem hiding this comment.
Would consider not saving fit results as .rds, but using ferx-builtin saving feature. FeRx itself has an output= argument that allows saving to a cross-environment file format with .fitrx extension (essentially a zip file with yaml and json in it). This would be more universal and forward-looking (perhaps someone wants to use luna from command line).
Code review —
|
|
The patch breaks existing NONMEM execution paths: Review findings:
|
Switch ferx result storage from saveRDS/{id}-fit.rds to ferx's native
.fitrx format via ferx_fit(output=) and ferx_load_fit(). Revert
luna_check() NONMEM validation from soft-fail (cli_alert_warning +
return FALSE) back to cli_abort() per PR review.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Kept ferx dispatch in luna_check and luna_run while incorporating main's code review improvements (tryCatch, cli_alert_warning, nmfe path resolution). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
luna_run_ferx()(run models, save{id}-fit.rds),luna_ferx_info()(print convergence/OFV summary)luna_check(),get_status(),get_all_results(),update_cache(),runs_as_table()example-4-ferx) with 3 busulfan models (1-cmt, 2-cmt, 2-cmt+WT allometry) and workflow vignetteone_cpt_infusion→one_cpt_iv,two_cpt_infusion→two_cpt_iv)Configuration
Set in project YAML:
Test plan
devtools::test(filter = "ferx")— all 22 tests passvignettes/example-4-ferx/luna_workflow_ferx.Rwith ferx installed🤖 Generated with Claude Code