From ad92d1602a5a5e103e971ac153daf5326d2d1015 Mon Sep 17 00:00:00 2001 From: Kdreval Date: Tue, 30 Jan 2024 11:31:04 -0800 Subject: [PATCH] bug fix: keep only relevant annotations in prettyOncoplot --- R/prettyOncoplot.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/R/prettyOncoplot.R b/R/prettyOncoplot.R index d937539..e2d320e 100644 --- a/R/prettyOncoplot.R +++ b/R/prettyOncoplot.R @@ -691,6 +691,13 @@ prettyOncoplot = function(maf_df, drop = FALSE ] } + + # Only keep the annotation colors for the remaining patients + for(column in colnames(metadata_df)){ + remaining <- unique(metadata_df[column] %>% mutate_if(is.factor, as.character)) %>% pull() + colours[[column]] <- (colours[column] %>% unname %>% unlist)[remaining] + } + ch = ComplexHeatmap::oncoPrint(mat[intersect(genes, genes_kept),patients_kept], alter_fun = alter_fun, top_annotation = top_annotation,