Closed ekfchan closed 5 years ago
Hi, Thanks for reaching out. I would like to redirect you to a previous issue: https://github.com/FunGeST/Palimpsest/issues/10
The variable mycol
is defined early in the mutational signature analysis and consistently followed throughout the example script for further analysis including palimpsest_DissectSigs()
& palimpsest_clonalitySigsCompare()
.
Hope this helps in clarifying your doubt.
Best, Jay
Hi Jay, shouldn't mycol
be a local variable within these two functions rather than having the functions search for them globally?
Thanks.
I am not sure I completely understand the problem you are facing here.
The user is, of course, free to define mycol
at any step of the script.
The RUNNING_PALIMPSEST_EXAMPLE script follows the logic of performing complete analysis on a given dataset. We start with defining mycol
representing each signature extracted at the beginning and being consistent with mycol
variable throughout the further analysis and visualizations.
Best,
Jay
Hi Jay, Sorry I wasn't clear. I am not following the RUNNING_PALIMPSEST_EXAMPLE script. As such, I never defined mycol
. So when I called palimpsest_DissectSigs
, it failed because mycol
was not defined. More specifically, palimpsest_DissectSigs
takes the following arguments (per your code https://github.com/FunGeST/Palimpsest/blob/master/R/palimpsest_plotting.R):
palimpsest_DissectSigs <- function(vcf=NULL,
signatures_exp_clonal=NULL,
signatures_exp_subclonal=NULL,
sig_cols=NULL,
resdir=NULL)
As such, I called the function as follows, where cosmiccol
is a named vector of colours and mysigs
is a vector of signature names:
> palimpsest_DissectSigs(vcf=my.vcf, signatures_exp_clonal = clonal.sig, signatures_exp_subclonal = subclonal.sig, sig_cols = cosmiccol[mysigs], resdir=resdir.)
> cosmiccol
Signature.1 Signature.2 Signature.3 Signature.4 Signature.5 Signature.6 Signature.7
"#8DD3C7" "#984EA3" "#7FC97F" "#FB8072" "#D95F02" "#F1E2CC" "#FB9A99"
Signature.8 Signature.9 Signature.10 Signature.11 Signature.12 Signature.13 Signature.14
"#A65628" "#FFF2AE" "#CAB2D6" "#F0027F" "#1F78B4" "#4DAF4A" "#BEAED4"
Signature.15 Signature.16 Signature.17 Signature.18 Signature.19 Signature.20 Signature.21
"#CCCCCC" "#E31A1C" "#FDB462" "#E6F5C9" "#D9D9D9" "#666666" "#FFD92F"
Signature.22 Signature.23 Signature.24 Signature.25 Signature.26 Signature.27 Signature.28
"#E41A1C" "#377EB8" "#386CB0" "#FFFFB3" "#E5D8BD" "#A6CEE3" "#FFFFCC"
Signature.29 Signature.30
"#B15928" "#FDDAEC"
> mysigs
[1] "Signature.1" "Signature.3" "Signature.5" "Signature.8" "Signature.9" "Signature.12"
[7] "Signature.16" "Signature.17" "Signature.18" "Signature.30"
As you can see, I have supplied a value to the sig_cols
argument. But in the code, this argument is not used. Instead, it uses the default value to sig_col
which is mycol
.
barplot(ptt,col=mycol[rownames(mat)],las=1,ylab="Proportion of mutations",names.arg=c(paste("clonal\nn=",nearly,sep=""),paste("subclonal\nn=",nlate,sep="")),xlim=c(0,4.5))
title(paste("p=",chisq.test(mat)$p.value))
legend("topright",legend=rownames(mat),fill=mycol[rownames(mat)],bty="n")
Does this make sense?
Thanks so much for bringing this to our notice.
We have pushed the quick fix and replaced the couple of lines of code with sig_cols
and the issue should be sorted now.
Best, Jay
Yup, that fixed it. Thanks!
Oh, actually, the issue is still present in palimpsest_clonalitySigsCompare()
, specifically in the line:
legend(-3.8,-1.35,legend = names(mycol),ncol = 5,fill=mycol,border = mycol,bty = "n",cex=1)
Thanks. It should be fixed now.
Hi Jay & Palimpsest Dev Team,
I think
palimpsest_DissectSigs()
&palimpsest_clonalitySigsCompare()
are expecting the variablemycol
to be in the global environment as it is not defined within the functions ...?Thanks.