pylimma.genas

pylimma.genas(fit, coef=(0, 1), subset='all', plot=False, alpha=0.4, *, key='pylimma')[source]

Estimate the biological correlation between two contrasts.

Port of R limma’s genas(fit, coef=c(1,2), subset="all", plot=FALSE, alpha=0.4). Fits a multivariate-t model and returns the technical correlation, biological covariance matrix, biological correlation, LR deviance, p-value, and the number of genes used.

Parameters:
  • fit (MArrayLM / dict) – Fit from lm_fit() followed by e_bayes().

  • coef (sequence of two ints, default (0, 1)) – Zero-based coefficient indices (R uses 1-based).

  • subset ({"all", "Fpval", "p.union", "p.int", "logFC", "predFC"}) – Gene-subset rule used to pre-filter before fitting. Matches R’s .whichGenes; "n" is accepted as a backwards-compat alias for "all".

  • plot (bool, default False) – Ignored; pylimma does not emit the R genas plot.

  • alpha (float, default 0.4) – Ignored in the non-plotting port.

  • key (str)

Return type:

dict

Returns:

  • dict with keys technical_correlation, covariance_matrix

  • (the biological covariance V0 = L D L'), biological_correlation,

  • deviance, p_value, n.

Notes

Deliberate divergence from R for subset=”logFC” and subset=”predFC”. R’s genas.R writes its re-centred coefficients to a fit$coeff slot (partial match on the read-side only - R’s $<- does not partial-match), so the fit$coefficients slot that feeds the downstream MLE is never actually re-centred. This is a latent bug in R limma; pylimma applies the re-centring as the author’s code clearly intended. For subset in {"all", "Fpval", "p.union", "p.int"} pylimma matches R’s numerical output to within optimiser tolerance. See known_diff_genas_recentring.md in the memory index.