Closed jeff-meng closed 5 years ago
mutsig <- system.file("extdata", "../MutSig2CV/sig_genes.txt", package = "maftools")
This code did not find your sig_gene.txt, where is it?
@ShixiangWang, thanks for your reply. I'm 100% certain that the filepath "../MutSig2CV/sig_genes.txt" is correct.
I later copied the file to the working directory and used
mutsig <- system.file("extdata", "sig_genes.txt", package = "maftools")
and I got the same result.
mutsig [1] ""
Could you use
mutsig <- "../MutSig2CV/sig_genes.txt"
There is not sig_genes.txt
in maftools.
@ShixiangWang
When I use mutsig <- "../MutSig2CV/sig_genes.txt"
,
ms = data.table::fread(input = mutsig, sep = '\t', stringsAsFactors = FALSE, header = TRUE)
works and I get
ms rank gene longname codelen nnei nncd nsil 1: 1 TP53 tumor protein p53 1890 12 0 0 2: 2 BRAF v-raf murine sarcoma viral oncogene homolog B1 2371 5 0 3 3: 3 KCNQ2 potassium voltage-gated channel, KQT-like subfamily, member 2 2747 39 0 0 4: 4 NRAS neuroblastoma RAS viral (v-ras) oncogene homolog 941 4 2 0 5: 5 ZKSCAN1 zinc finger with KRAB and SCAN domains 1 1712 41 0 1
nmis nstp nspl nind nnon npat nsite pCV pCL pFN p q 1: 14 3 1 1 19 17 16 7.507203e-13 4e-05 0.02799 3.330669e-16 6.093792e-12 2: 42 0 0 1 43 35 9 1.130012e-04 1e-05 0.00022 2.440942e-08 2.232974e-04 3: 7 0 2 0 9 9 9 2.956467e-08 1e+00 0.75000 5.421180e-07 3.306197e-03 4: 10 0 0 0 10 9 3 5.656094e-03 1e-05 0.17022 1.000447e-06 4.576044e-03 5: 1 0 0 3 4 4 2 5.679787e-03 1e-04 0.98069 8.736183e-06 3.196744e-02
However, oncoplot(maf = comb_maf, colors = col, mutsig = mutsig, mutsigQval = 0.1, ...
still gives the same error:
Following genes from provided gene list are missing from MAF: [1] "IDH1" Ignoring them. Error in oncoplot(maf = comb_maf, colors = col, mutsig = mutsig, mutsigQval = 0.1, : object 'ms.smg' not found
Please check the following code.
mutsigQval = 0.1
ms = data.table::fread(input = mutsig, sep = '\t', stringsAsFactors = FALSE, header = TRUE)
ms$q = as.numeric(gsub(pattern = "^<", replacement = "", x = as.character(ms$q)))
mach.epsi = .Machine$double.eps
ms$q = ifelse(test = ms$q == 0, yes = mach.epsi, no = ms$q)
ms[,FDR := -log10(as.numeric(as.character(q)))]
ms.smg = ms[q < as.numeric(as.character(mutsigQval))]
@ShixiangWang All of the code you gave me worked, but the oncoplot function still gave the same error. Then I quit RStudio and started it back up again. And oncoplot produced a plot. However, the q-value bars are thicker than the bars for mutations and misaligned with the rest of the plot.
Here's the right half of the resulting oncoplot:
Could you reproduce this plot problem with sample data provided by maftools?
library(maftools)
#path to TCGA LAML MAF file
laml.maf = system.file('extdata', 'tcga_laml.maf.gz', package = 'maftools')
#clinical information containing survival information and histology. This is optional
laml.clin = system.file('extdata', 'tcga_laml_annot.tsv', package = 'maftools')
laml = read.maf(maf = laml.maf,
clinicalData = laml.clin,
verbose = FALSE)
#MutSig results
laml.mutsig = system.file("extdata", "LAML_sig_genes.txt.gz", package = "maftools")
oncoplot(
maf = laml,
mutsig = laml.mutsig,
mutsigQval = 0.01,
)
All code come from https://bioconductor.org/packages/devel/bioc/vignettes/maftools/inst/doc/oncoplots.html.
Thank you @ShixiangWang for debugging. @jeff-meng could you please install the tool from GitHub and try again ?
Thanks @ShixiangWang and @PoisonAlien! The sample code involving LAML works perfectly, but my code still makes MutSig q-value bars that are too wide. I tried commenting out the oncoplot "gene" argument that specifies my selection of genes to display, and the resulting plot looked fine. So I think the problem is that the q-value plotting is not compatible with gene selection. I would really appreciate it if you can fix this!
oncoplot(maf = comb_maf, colors = col, mutsig = mutsig, mutsigQval = 0.1,
#genes=cm_genes,
keepGeneOrder = T, GeneOrderSort = F, #don't sort samples by gene mut
removeNonMutated=F,
clinicalFeatures = c("Response", "Sample_source"), sortByAnnotation = TRUE, annotationOrder=c("CR","PR","SD","PD","SPP"),
annotationColor = annot_colors)
@jeff-meng May you provide regarding data files and send to @PoisonAlien so he can fix this bug?
Thanks, @ShixiangWang and @PoisonAlien. I would provide my data, but more conveniently, I reproduced the problem with the demo LAML data:
laml.maf = system.file('extdata', 'tcga_laml.maf.gz', package = 'maftools')
laml.clin = system.file('extdata', 'tcga_laml_annot.tsv', package = 'maftools')
laml = read.maf(maf = laml.maf,
clinicalData = laml.clin,
verbose = FALSE)
laml.mutsig = system.file("extdata", "LAML_sig_genes.txt.gz", package = "maftools")
oncoplot(
maf = laml,
mutsig = laml.mutsig,
mutsigQval = 0.01,
genes=c("BRAF", "NRAS", "HRAS", "KRAS","NF1", "TP53", "CDKN2A")
)
and I get:
Hi,
Thing is if you're passing significant gene list, it will plot all the genes below threshold - hence genes
or top
arguments wont work. If you really want to restrict then you could use exprsTbl
argument.
Something like below,
> laml.mutsig = system.file("extdata", "LAML_sig_genes.txt.gz", package = "maftools")
> ms_res = data.table::fread(input = laml.mutsig)
> ms_res = ms_res[,.(gene, q)]
> ms_res[, q := -log10(q)]
> head(ms_res)
gene q
1: FLT3 12.64176
2: DNMT3A 12.64176
3: NPM1 12.64176
4: IDH2 12.64176
5: IDH1 12.64176
6: TET2 12.64176
> oncoplot(maf = laml, exprsTbl = ms_res)
#You can include `top` or `genes` argument
Let me know if this helps. You may have to install from GiHub again for the fixes.
Thanks, @PoisonAlien !
Now I see that it was silly of my to provide a gene list of interested that contained gene with MutSig q > 0.1 and at the same time specify a mutsigQval cutoff of 0.1. I downloaded the latest Maftools and the trick with exprsTbl works! I just needed to add a line to your code above to rename "gene" as "genes":
colnames(ms_res)[1] = "genes"
Still, I wonder if you could make the oncoplot argument "mutsig" work with gene selection by "genes". With the "genes" argument present, even when I set the mutsigQval threshold to 1, oncoplot still displays only genes with q < 0.1
Yes. That was the point of using mutsig option to pre-select the genes based on q-value threshold. But if you still think it will be an additional value, then I will push the changes.
Hi! I tried to load the "sig_genes.txt" file from MutSig with
mutsig <- system.file("extdata", "../MutSig2CV/sig_genes.txt", package = "maftools")
but then mutsig returns "":and
oncoplot(maf = comb_maf, colors = col, mutsig = mutsig, mutsigQval = 0.1, ...
returnsI tried to debug a bit by running
ms = data.table::fread(input = mutsig, sep = '\t', stringsAsFactors = FALSE, header = TRUE)
but I gotThen I tried to load the "sig_genes.txt" file directly into Oncoplot using
oncoplot(maf = comb_maf, colors = col, mutsig = "../MutSig2CV/sig_genes.txt", mutsigQval = 0.1,...
but I got the same error:Any idea what's wrong and how to resolve this? Thank you!
Here's my sessionInfo: