pylimma.vooma_lm_fit
- pylimma.vooma_lm_fit(y, design=None, prior_weights=None, block=None, sample_weights=False, var_design=None, var_group=None, prior_n=10, predictor=None, span=None, legacy_span=False, plot=False, save_plot=False, keep_elist=True, *, key='pylimma', voom_key='vooma', weights_layer='vooma_weights', layer=None)[source]
Combined vooma + lmFit with iterative refinement.
Applies vooma-style mean-variance modelling to expression data, then fits a linear model. If block correlation or sample weights are requested, performs one iteration to refine the estimates.
- Parameters:
y (ndarray) – Expression matrix (log-scale), shape (n_genes, n_samples).
design (ndarray, optional) – Design matrix. If None, uses an intercept-only model.
prior_weights (ndarray, optional) – Prior observation weights. Cannot be combined with sample_weights.
block (ndarray, optional) – Block factor for correlated samples.
sample_weights (bool, default False) – If True, estimate sample-specific quality weights.
var_design (ndarray, optional) – Design matrix for variance model (used with sample_weights).
var_group (ndarray, optional) – Factor defining variance groups (used with sample_weights).
prior_n (float, default 10) – Prior sample size for array weights estimation.
span (float, optional) – LOWESS span. If None, chosen adaptively.
legacy_span (bool, default False) – If True, use legacy span selection algorithm.
save_plot (bool, default False) – If True, include trend data in output.
keep_elist (bool, default True) – If True, include expression data with weights in output (dict return path only; AnnData input always writes the weights layer regardless).
key (str, default "pylimma") – AnnData
adata.unskey for the fit slots (mirrorslm_fit()).voom_key (str, default "vooma") – AnnData
adata.unskey for ancillary metadata (span, sample_weights, voom_xy, voom_line). Keeps the fit and the voom-like ancillaries in separate uns buckets, matching thevooma()+lm_fit()split.weights_layer (str, default "vooma_weights") – AnnData output layer for the computed observation weights.
layer (str, optional) – AnnData input layer to read expression from. Defaults to
adata.X.predictor (ndarray | None)
plot (bool)
- Returns:
For AnnData input: mutates adata (weights layer, fit in
adata.uns[key], ancillaries inadata.uns[voom_key]) and returnsNone. For ndarray / EList / dict input: returns a dict with the fit plus span, targets (if requested), EList (if keep_elist), and voom_xy / voom_line (if save_plot).- Return type:
dict or None
Notes
This function combines vooma() and lm_fit() with optional iterative refinement of sample weights and intra-block correlation.