Main
In this code, we mainly build the mutation tree.
Prepare data
suppressPackageStartupMessages(library(tidyverse))
## Warning in system("timedatectl", intern = TRUE): running command 'timedatectl'
## had status 1
sampABlist = readRDS("data/sampABlist.rds")
GC01 = readRDS("data/GC01.rds")
GC01 = GC01 %>% mutate(Chromosome = str_c("chr", Chromosome) ) %>%
mutate(mutation_id = str_c(Chromosome, Start_Position, Reference_Allele, sep = ":"))
#get all adjust maf.
ccf.data.dscat = sampABlist$entire %>%
mutate(mutation_id = str_c(chr , from , ref , sep = ":")) %>%
dplyr::select(mutation_id, ends_with("ccf") & !starts_with("merge") ) %>%
column_to_rownames(var = "mutation_id")
colnames(ccf.data.dscat) = str_remove( colnames(ccf.data.dscat), "ccf" )
#Filtering mutations which max CCF across samples <= 0.2
ccf.data.dscat.row = apply(ccf.data.dscat, 1, max)
ccf.data.dscat = ccf.data.dscat[ ccf.data.dscat.row>=0.2, ]
ccf.data.dscat[ccf.data.dscat >1] = 1
The heatmap fo all mutations
library(RColorBrewer)
library(pheatmap)
setcolor = colorRampPalette( brewer.pal(n = 7, name = "PuRd") )(7)
pheatmap::pheatmap(ccf.data.dscat, show_rownames = F, color = setcolor )