pylimma.array_weights_quick

pylimma.array_weights_quick(y, fit, *, layer=None)[source]

Compute approximate array quality weights from a linear model fit.

Faithful port of R limma’s arrayWeightsQuick(). Computes 1 / colMeans(res*res / (sigma^2 * (1 - h))) where h is the leverage diagonal of the design’s hat matrix and res is the residual matrix from the fit.

Parameters:
  • y (array_like) – Expression matrix, shape (n_genes, n_samples).

  • fit (dict) – Linear model fit (from lm_fit()) carrying coefficients, design, and sigma. If fit carries observation weights a warning is emitted (matches R: spot quality weights are not taken into account).

  • layer (str | None)

Returns:

Approximate array quality weights, shape (n_samples,).

Return type:

ndarray