From 174793b0e5419d88e8213d3638948cf769808c63 Mon Sep 17 00:00:00 2001 From: Kdreval Date: Tue, 2 Jul 2024 20:52:20 -0700 Subject: [PATCH] bug fix: handling of noncoding variants --- R/prettyOncoplot.R | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/R/prettyOncoplot.R b/R/prettyOncoplot.R index c927d8e..a382a52 100644 --- a/R/prettyOncoplot.R +++ b/R/prettyOncoplot.R @@ -249,6 +249,24 @@ prettyOncoplot = function(maf_df, colnames(tsb.include) = tsbs[!tsbs %in% colnames(mat_origin)] rownames(tsb.include) = rownames(mat_origin) mat_origin = cbind(mat_origin, tsb.include) + }else if(length(include_noncoding) > 0){ + print( + "You requested to include noncoding mutations and remove non-mutated patients ..." + ) + these_have_noncoding <- maf_df %>% + filter( + Tumor_Sample_Barcode %in% patients, + Hugo_Symbol %in% names(include_noncoding), + Variant_Classification %in% unname(include_noncoding) + ) %>% + distinct( + Tumor_Sample_Barcode, Hugo_Symbol, Variant_Classification, Start_Position, End_Position + ) %>% + pull(Tumor_Sample_Barcode) + tsb.include = matrix(data = 0, nrow = nrow(mat_origin), ncol = length(these_have_noncoding[!these_have_noncoding %in% colnames(mat_origin)])) + colnames(tsb.include) = these_have_noncoding[!these_have_noncoding %in% colnames(mat_origin)] + rownames(tsb.include) = rownames(mat_origin) + mat_origin = cbind(mat_origin, tsb.include) } write.table(mat_origin, file = onco_matrix_path, quote = F, sep = "\t") }