sesame
sesame copied to clipboard
Legend for visualizeRegion/visualizeGene/visualizeProbes
Is there a way to add the legend (color scale) when using visualizeRegion/visualizeGene/visualizeProbes? Thanks!
Yes, you can add it with WLegendV or WLegendH to the resulting grid objects. something like
visualizeProbes(...) + WLegendV('betas', TopRightOf())
Thanks for pointing to the WLegendV function. I tried it with visualizeGene() but it showed the "Error in objs[[1]] : subscript out of bounds" message. Do you think it has something to do with the betas object, which was generated by openSesame()?
Can you try the following example?
betas <- sesameDataGet('HM450.10.TCGA.PAAD.normal')
visualizeGene('DNMT1', betas, platform='HM450') + WLegendV("betas", TopRightOf("betas"))
Yes, this example works fine. I noticed that there were some probes with NAs and I thought thoese might be an issue. So I removed probes with NA, however, the subscript out of bounds error still occurred. If not adding WLegendV(), the figure was generated without any issue.
One possibility is that there is no beta value heatmap after removing the NAs. If so, yeah, the legend might be struggling to find the original color scale.
I would also suspect so. Below is what the heatmap looks like after removing the NAs. Yet, the "subscript out of bound" error persisted.
OK. If you can share with me an example to reproduce this, I can troubleshoot more.
I extracted the beta values of 16 probes associated with the FMR1 gene as shown in this table. I tried to use this matrix as input for visualizeGene() and WLegendV() but the error message showed up on my end. Appreciate if you could look into the issue.
can you try
betas = read_tsv("~/Downloads/test_betas.txt")
b2 = as.matrix(betas[,2:7])
rownames(b2) = betas[[1]]
visualizeGene("FMR1", b2, platform="EPIC") + WLegendV("betas", TopRightOf("betas"))
It works now. I guess the trick is in the data type of betas/b2. Thanks Wanding for your help.
Just a note here. It worked for me if I first saved the probes to be plotted in a variable named "betas" and then plotted it using the "betas" variable. I tried to name it as "temp_betas" but it didn't work.