Interpret a flashier matrix factorization. After one call you get a view: a named samples × factors activity matrix and a named features × factors effects matrix that share factor columns and reconstruct the fit. From a view you can rank the features that drive each factor, plot activity across samples, summarize and test factors against sample metadata, back-project a group contrast into feature units, and check posterior uncertainty, stability and held-out prediction.
Installation
Requires R 4.3 or later and flashier 1.0.60 or later. The install pulls the pinned flashier commit (willwerscheid/flashier@fd44811). CRAN flashier 1.0.7 is not enough: it rejects data with an all-missing row or column, which masked factor_holdout() creates, and it lacks flash_plot_scree(). The committed article tables and every recorded basis_id come from flashier 1.0.60.
install.packages("remotes")
remotes::install_github("mdmanurung/flashier-utils")Optional packages unlock some functions: psych and clue for factor_replicability() and factor_stability(); limma or variancePartition for the matching test_factor_association() engines; gbcd for fit_gbcd_programs(); fastTopics for test_gom_de(); harmony for harmony_assignments(). Each page in the function reference names what it needs.
Quick start
Use the GTEx association z-scores bundled with flashier. Tissues occupy columns; SNP–gene pairs occupy rows.
library(flashier.utils)
data("gtex", package = "flashier")
set.seed(1)
fit <- flashier::flash(gtex, greedy_Kmax = 3, backfit = TRUE, verbose = 0)
view <- standardize_factors(fit, sample_side = "columns",
feature_scale = "association_z_score")
plot_factor_activity(view)
factor_features(view, factor = "F1", select = "largest", n = 5)Your matrix needs unique row and column names. Tell standardize_factors() which side holds samples and what the values measure; the package records both and never preprocesses or rescales your data. Keep the native fit as well as the view: uncertainty functions need the fit, everything else takes the view.
Workflow
| Step | Functions |
|---|---|
| Remove batch shifts before fitting |
correct_feature_batch(), harmony_assignments()
|
| Fit, or standardize an existing fit |
fit_ebmf(), standardize_factors(), factor_activity(), factor_effects(), factor_pve()
|
| Interpret factors |
factor_features(), plot_factor_features(), plot_factor_weights(), plot_factor_activity(), plot_factor_scatter(), plot_factor_data(), plot_factor_embedding(), plot_factor_pve()
|
| Relate factors to metadata |
summarize_factor_activity(), compare_factor_groups(), test_factor_association(), backproject_contrast()
|
| Check uncertainty and reproducibility |
factor_uncertainty(), factor_intervals(), factor_stability(), factor_replicability(), factor_holdout()
|
| Transfer programs to new data |
project_factor_activity(), project_factor_features()
|
Four focused tutorials
| Task | Tutorial |
|---|---|
| Beginner: native fit, extraction, features, one plot | Get started |
| Coordinates, uncertainty, group contrasts, nonnegative programs | Advanced use |
| Different priors: prediction, program agreement and known truth | Compare priors |
| Real-data interpretation and reference transfer | Pancreas programs |
The first uses bundled GTEx data; the middle two use explicit simulations. The pancreas example uses attributed published Jamboree data, prepared once outside package builds (about 86 MB downloaded):
Set the same variable before running the case study. No data are downloaded by package builds. The plot gallery shows seventeen plotting recipes from one simulated fit, Robustness checks lists eight checks to run before naming a factor, Batch correction before fitting removes cell-state-specific batch shifts, and the function reference lists complete arguments.
Lifecycle
The package is experimental. Function names and arguments can still change before a 1.0 release; the 2.0.0 line already removed single-value arguments and renamed provenance() and test_factors(). Every breaking change is listed in NEWS.md, and a renamed function keeps its old name as a deprecated alias for one release. The scientific contracts (named views, preserved orientation, conditional uncertainty semantics) are the part that is kept stable. The flashier version is pinned in DESCRIPTION; behaviour against other versions is not promised.
Limits
Unnamed fits are rejected. Native intercepts without role metadata remain ordinary factors. Group summaries are descriptive; association tests require explicit independent units. Conditional posterior uncertainty does not replace regression standard errors or biological replication. Compatibility is tested against the pinned flashier version, not every historical or future object format.
Migrating from 1.x
Version 2.0 exposes 24 public functions and makes the rest internal. Nine core functions changed positional argument order, so use named arguments, such as factor_features(view, factor = "F1", select = "largest", n = 5). Defaults and calculations are unchanged; NEWS lists the removed exports and affected signatures.
Original authors and citations
flashier is by Jason Willwerscheid, Peter Carbonetto, Wei Wang and Matthew Stephens.
ebnm is by Jason Willwerscheid, Matthew Stephens and Peter Carbonetto. The adapted singlecelljamboreeR feature helpers are by Peter Carbonetto and Matthew Stephens. Plotting and reconstruction workflows credit David Zemmour and the Zemmour Lab.
Cite the methods used in your analysis with citation("flashier"), citation("ebnm") and the relevant optional packages. Original authors and sources lists the full credits and licenses. Mikhael Manurung maintains flashier.utils.
Code of Conduct
Please note that the flashier.utils project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.