Skip to content

scdef.tl.find_sensible_top_factors

find_sensible_top_factors(model: scDEF, n_eff_parents_max: float = 1.5, min_best_parent_prob: Optional[float] = None, min_clear_children: int = 2, ignore_root: bool = True, use_filtered: bool = True, recompute: bool = False, store: bool = True) -> list[str]

Return factors marked as sensible top factors in factor_obs.

The annotation is computed in scdef.tools.factor.factor_diagnostics and materialized on model.adata.uns['factor_obs'] as is_sensible_top_factor.

The per-factor counterpart of find_sensible_top_layer: that one picks a layer, this one names the factors within it that carry the merge. The shared thresholds mean the same thing in both.

Parameters:

Name Type Description Default
model scDEF

fitted scDEF model. Diagnostics are computed on the fly if adata.uns['factor_obs'] is missing.

required
n_eff_parents_max float

a child counts as clear when its effective number of parents is at most this.

1.5
min_best_parent_prob Optional[float]

additionally require a child's best-parent probability to reach this. Defaults to not requiring it.

None
min_clear_children int

number of clear best-parent children a factor needs to qualify as a sensible top factor.

2
ignore_root bool

skip a width-1 root layer, which would otherwise always qualify.

True
use_filtered bool

consider only the factors the model currently keeps.

True
recompute bool

re-run factor_diagnostics before reading the annotation, rather than reusing whatever is cached.

False
store bool

write the refreshed annotation back to adata.uns['factor_obs']. Set False to leave the stored diagnostics untouched.

True

Returns:

Type Description
list[str]

Names of the factors flagged is_sensible_top_factor.