decoupler.pp.prune

Contents

decoupler.pp.prune#

decoupler.pp.prune(features, net, tmin=5, verbose=False)#

Removes sources of a net with less than tmin targets shared with mat.

Parameters:
  • features (ndarray | None) – Column names of mat.

  • net (DataFrame) – Dataframe in long format. Must include source and target columns, and optionally a weight column.

  • tmin (int (default: 5)) – Minimum number of targets per source. Sources with fewer targets will be removed.

  • verbose (bool (default: False)) – Whether to display progress messages and additional execution details.

Return type:

DataFrame

Returns:

Filtered net in long format.

Example

import decoupler as dc

adata, net = dc.ds.toy()
X, obs_names, var_names = dc.pp.extract(adata)
dc.pp.prune(var_names, net, tmin=3)