INNER CODE UNIT · Python
fit_LFC
scverse/PyDESeq2 · src/pydeseq2/dds.py:899
def fit_LFC(self) -> None:
"""Fit log fold change (LFC) coefficients.
In the 2-level setting, the intercept corresponds to the base mean, while the second is the actual LFC coefficient, in natural log scale.
"""
# Check that MAP dispersions are available. If not, compute them.
if "dispersions" not in self.var:
self.fit_MAP_dispersions()
# Convert design matrix to numpy for speed
design_matrix = self.obsm["design_matrix"].values
if not self.quiet:
print("Fitting LFCs...", file=sys.stderr)
start = time.time()
mle_lfcs_, mu_, hat_diagonals_, converged_ = self.inference.irls(
counts=self.X[:, self.non_zero_idx],
size_factors=self.obs["size_factors"].to_numpy(),