
Derive TME meta-programs by clustering Hallmarks across NMF factors
derive_meta_programs.RdHierarchically clusters Hallmark gene sets by their NES profile across NMF
factors to identify recurrent transcriptional programs in the TME.
Optionally annotates each NMF factor with a Bagaev et al. (2021) MFP
subtype (IE, IE/F, F, D) when Z, annot, and
cancer_name are all supplied.
Arguments
- gsea_results
A list of GSEA result data frames (one per NMF factor), as returned by
compute_factor_gsea().- k
Integer. Number of meta-programs (clusters) to extract. If
NULL(default), estimated automatically from the dendrogram.- file_name
Optional character. File path prefix for saving output plots.
- plot
Logical. If
TRUE(default), saves a clustering heatmap.
Value
A list with:
meta_programs: Named list mapping meta-program labels to character vectors of Hallmark names.hallmark_clusters: Data frame with columnsHallmark,meta_program, andmean_NES.heatmap: Thepheatmapobject.k: The number of meta-programs used.factor_mfp: (Only whenZ,annot, andcancer_nameare provided) Data frame with columnsfactor,best_MFP,cor_IE,cor_IEF,cor_F,cor_D,n_samples.