INNER CODE UNIT · Python
refit
scverse/PyDESeq2 · src/pydeseq2/dds.py:1003
def refit(self) -> None:
"""Refit Cook outliers.
Replace values that are filtered out based on the Cooks distance with imputed values, and then re-run the whole DESeq2 pipeline on replaced values.
"""
# Replace outlier counts
self._replace_outliers()
if not self.quiet:
print(
f"Replacing {sum(self.var['replaced'])} outlier genes.\n",
file=sys.stderr,
)
if sum(self.var["replaced"]) > 0:
# Refit dispersions and LFCs for genes that had outliers replaced
self._refit_without_outliers()
else:
# Store the fact that no sample was refitted