Skip to content

feat: export an R script that reproduces the app - #149

Merged
mcanouil merged 5 commits into
feat/nacho-3from
feat/reproduce-in-r
Oct 15, 2026
Merged

mcanouil merged 5 commits into
feat/nacho-3from
feat/reproduce-in-r

Conversation

@mcanouil

Copy link
Copy Markdown
Owner

The Export page now has a "Reproduce in R" card.
It shows an R script that repeats the analysis of the app, and downloads it as nacho-reproduce.R.

The Export page: below the Data and Report cards, the Reproduce in R card has an R script button and the start of the script.

The script loads the data with load_rcc() and the settings stored in the object, then calls normalise() with the method, background and number of RUVg factors chosen in the app.
The thresholds set in the app are written into the script as YAML and read back with read_thresholds(), so the script is a single file.
For the example data, it starts from GSE74821 and runs as it is.
For other data, it keeps the folder the object was loaded from, or asks for the paths when the files were uploaded or the folder is gone, and names the sample sheet columns.

The tests run the generated script and check that it gives the same counts, quality-control table and thresholds as the app.
write_thresholds() now builds its text with a new internal thresholds_yaml(), which the script uses too.

The Export page shows and downloads an R script that repeats the
analysis of the app: load_rcc() with the settings of the object, or the
example data, then normalise() with the method, background and
thresholds chosen in the app. The thresholds are written into the
script and read back with read_thresholds(), so it is one file.
The thresholds come from thresholds_yaml(), which write_thresholds() now uses too, and the example data is recognised from a cached fingerprint of its load time and samples, which normalise() leaves alone.
An unknown instrument is left to load_rcc(), the folder the object was loaded from is kept unless it was an upload, and the script says that it loads every file of the folder.
…he script

The R script for an upload says which columns the sample sheet needs, and its tests no longer depend on where they run.
An object reopened in a later session can hold a folder that no longer exists, so the script asks for the path instead.
@mcanouil mcanouil added the Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses label Oct 15, 2026
@mcanouil mcanouil self-assigned this Oct 15, 2026
@mcanouil
mcanouil marked this pull request as ready for review October 15, 2026 13:51
@mcanouil
mcanouil merged commit 88b3c48 into feat/nacho-3 Oct 15, 2026
10 checks passed
@mcanouil
mcanouil deleted the feat/reproduce-in-r branch October 15, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant