Skip to contents

Fit gene expression programs (GEPs) with the GBCD method and return them as a view plus per-gene signature statistics. Needs the optional gbcd package at the pinned commit. Delegates fitting to that engine. No normalization runs.

Usage

fit_gbcd_programs(
  X,
  sample_side,
  kmax,
  feature_scale,
  preprocessing,
  prior = ebnm::ebnm_generalized_binary,
  dense_budget_bytes = 2 * 1024^3,
  keep_native = FALSE,
  ...
)

Arguments

X

Named finite numeric matrix or double sparse Matrix of normalized natural-log expression.

sample_side

"rows" or "columns": which side holds cells. Required.

kmax

Integer at least two; upstream initialization rank parameter. Final rank can exceed kmax; this wrapper imposes no claimed final-rank bound.

feature_scale

Non-unknown units for caller-prepared normalized, natural-log expression, including log1p when declared in preprocessing.

preprocessing

List with nonempty character scope and description, and log_base = "e".

prior

Nonnegative ebnm::ebnm_* prior for memberships (default generalized binary), or a custom function carrying attr(prior, "support") = "nonnegative" as an explicit caller declaration.

dense_budget_bytes

Positive workspace preflight budget; default 2 GiB. This estimates workspaces; it does not bound actual peak memory.

keep_native

Retain the upstream output for inspection (default FALSE).

...

Native maxiter1, maxiter2, maxiter3, control and verbose arguments.

Value

A gbcd_program_result with $representation (a view with factors GEP1, GEP2, ...), $signatures (per gene and program: effect, log2_fc, z_score, lfsr), $diagnostics, optional $native output and $analysis_metadata. Pass the representation to factor_features(), summarize_factor_activity() and the plot functions.

Details

Effects reconstruct the natural-log input scale. Baseline is retained as a varying factor, with zero offset. All activity supports remain unknown: upstream output labels do not establish prior lineage after sorting. Signature effect/log2_fc are EB-SNMF point estimates. z_score and lfsr come from a separate conditional linear-regression/ashr stage. Unavailable conditional statistics remain NA. Native FLASH PVE and posterior uncertainty are unavailable. Automatic refitting/projection priors cannot be inferred. Install stephenslab/gbcd@670e3afb50236303ddf99db33a3394abd4a711bd. A different or unknown installed source pin is refused before fitting.

Author

Mikhael Manurung (adapter). GBCD: Yusha Liu, Peter Carbonetto, Jason Willwerscheid and Matthew Stephens. No engine source is copied.

Examples

if (FALSE) { # \dontrun{
programs <- fit_gbcd_programs(X, "rows",
  kmax = 5,
  feature_scale = "natural_log",
  preprocessing = list(scope = "within_dataset", description = "log1p normalized counts", log_base = "e")
)
factor_features(programs$representation, "GEP1")
programs$signatures
} # }