netmap.downstream.final_downstream.filter_clusters_by_cell_count

netmap.downstream.final_downstream.filter_clusters_by_cell_count(grn_adata: AnnData, metric_tag: float, top_fraction: float) Tuple[Dict[str, float] | None, AnnData]

Filter features (genes/edges) based on cell count differences between two clusters, selecting the top fraction of features for each cluster.

Parameters:
  • grn_adata (AnnData) – AnnData object containing feature metadata in .var. Must include columns cell_count_<metric_tag>_0 and cell_count_<metric_tag>_1.

  • metric_tag (str) – Identifier (suffix) for the cell count metric, e.g. ‘0.95’ → columns cell_count_0.95_0 and cell_count_0.95_1.

  • top_fraction (float) – Fraction (0–1) of top features to retain per cluster. For example, 0.2 retains the top 20% of features.

Returns:

filtered_adata – Subset of the input AnnData object containing only the top-selected features.

Return type:

AnnData