
Annotate NMF factors with Bagaev et al. (2021) MFP subtypes
map_factors_to_TME.RdFor a single cancer type, matches TCGA patients present in the NMF factor
score matrix Z to the Bagaev annotation, then computes Spearman
correlations between each factor and each one-hot-encoded MFP subtype
(IE, IE/F, F, D). The best-matching subtype per factor is returned; factors
with a maximum absolute correlation below 0.15 are labelled
"uncharacterized".
Arguments
- cancer_name
Character. Cancer type abbreviation matching the
TCGA_projectcolumn of the internal annotation (case-insensitive, e.g."skcm").- Z
Numeric matrix. Samples x factors NMF score matrix (row names = TCGA barcodes).
- plot
Logical. If TRUE (default), saves a boxplot of factor scores by MFP group.
- file_name
Optional character. File path prefix for saving output plots.