kaleidocell.propose_mp_actions#

kaleidocell.propose_mp_actions(mp_dict, metrics_df, similarity_sorted, cluster_dict, sil_threshold=0.1, sim_threshold=0.2, overlap_threshold=0.6, sim_between_threshold=0.5)[source]#

Suggest DROP or MERGE actions for low-quality meta-programs.

A meta-program is proposed for DROP when both its silhouette score and mean within-cluster similarity are below their respective thresholds.

Two meta-programs are proposed for MERGE when at least one has a low silhouette, both have adequate similarity, and their gene sets are highly overlapping or their program clusters are highly similar.

Parameters:
  • mp_dict (dict) – {mp_name: pd.Series} from derive_nmf_metaprograms().

  • metrics_df (pd.DataFrame) – Output of get_metaprogram_metrics().

  • similarity_sorted (pd.DataFrame) – Cosine-similarity matrix (result["similarity_matrix_sorted"]).

  • cluster_dict (dict) – {cluster_id: [program_names]}.

  • sil_threshold (float, default 0.1) – Silhouette score below which a cluster is considered weak.

  • sim_threshold (float, default 0.2) – Mean-similarity below which a cluster is considered weak.

  • overlap_threshold (float, default 0.6) – Gene-overlap coefficient above which two MPs are considered redundant.

  • sim_between_threshold (float, default 0.5) – Mean between-cluster program similarity above which two MPs are considered redundant.

Returns:

Columns: action, mp or mps, reason.

Return type:

pd.DataFrame