COMPASS, a pan-cancer foundation model, outperforms 22 methods across 16 clinical cohorts by analyzing tumor transcriptomes through immune concepts.