Skip to contents

Compute explicitly display-only empirical activity percentiles

Usage

factor_activity_percentile(
  fit,
  reference_samples = NULL,
  factors = NULL,
  na_action = "fail"
)

Arguments

fit

Native fit or matched representation.

reference_samples

Named reference sample IDs; NULL uses all samples.

factors

Selected original factor IDs.

na_action

Only fail is supported for finite factor representations.

Value

Matrix with display-only class and reference/basis metadata. Values are 100 * ecdf(reference)(activity); ties retain native ECDF behavior.

Details

Origin: ADAPTED / call_only. Credits stats::ecdf display workflow; use factor_provenance("factor_activity_percentile") for audited sources and runtime versions. Input units and basis are retained; display/conditional results do not establish biological replication.

Author

David Zemmour / Zemmour Lab (ImmGenT workflows). Full source and dependency credits: https://github.com/mdmanurung/flashier-utils/blob/main/CREDITS.md.

Examples

if (FALSE) {
set.seed(3)
X <- tcrossprod(matrix(rnorm(48), 24, 2), matrix(rnorm(32), 16, 2)) +
  matrix(rnorm(384, sd = 0.2), 24, 16)
dimnames(X) <- list(paste0("s", 1:24), paste0("g", 1:16))
fit <- fit_ebmf(X, "rows",
  max_factors = 2, seed = 4, verbose = 0,
  ebnm_fn = list(ebnm::ebnm_normal, ebnm::ebnm_point_laplace),
  nullcheck = FALSE, backfit = TRUE, feature_scale = "simulated_centered_intensity"
)
view <- standardize_factors(fit)
head(factor_activity_percentile(view, reference_samples = rownames(X)[1:12], factors = "F1"))
}