Making a legoplot of mutational signatures
1
## Prepare your own data
library(maftools)
laml.maf <- system.file("extdata", "tcga_laml.maf.gz", package = "maftools")
laml <- read.maf(maf = laml.maf)
laml.tnm <- trinucleotideMatrix(maf = laml, ref_genome = 'BSgenome.Hsapiens.UCSC.hg19',
prefix = 'chr', add = TRUE, useSyn = TRUE)
## Check the example data
library(barplot3d)
x=system.file("extdata", "signature_probabilities.txt", package = "barplot3d")
sigdata=read.table(x,header=TRUE,stringsAsFactors = FALSE)
## Make the order correct
ods = paste0(sigdata$Preceeding_base, "[",
substr(sigdata$Substitution_type, 1, 3),
"]", sigdata$Succeeding_base)
all(colnames(laml.tnm$nmf_matrix) %in% ods)
## Visualization
# For all samples
all_counts = rowSums(t(laml.tnm$nmf_matrix)[ods, ])
legoplot3d(contextdata=all_counts/sum(all_counts),
labels=TRUE,scalexy=20,sixcolors="sanger",
alpha=0.4,zsub="Probability")
Login before adding your answer.
Traffic: 2333 users visited in the last hour
What data are you trying to make this from? You should try to include some of that data in the post.
A 96 base substitution 3D bar plot