INNER CODE UNIT · Python
cooks_cutoff
scverse/PyDESeq2 · src/pydeseq2/dds.py:1033
cooks_cutoff = f.ppf(0.99, num_vars, num_samples - num_vars)
# As in DESeq2, only take samples with 3 or more replicates when looking for
# max cooks.
use_for_max = n_or_more_replicates(self.obsm["design_matrix"], 3)
# If for a gene there are 3 samples or more that have more counts than the
# maximum cooks sample, don't count this gene as an outlier.
# Take into account whether we already replaced outliers
if (
self.refit_cooks
and (self.var["refitted"].sum() > 0)
and "replace_cooks" in self.layers.keys()
):
cooks_outlier = (
self.layers["replace_cooks"][use_for_max, :] > cooks_cutoff
).any(axis=0)