Comments (9)
Hi Anthony, did you post on Biostars, too?
I have not seen this error, previously. Can you show me the code that you used to run EnhancedVolcano()
?
from enhancedvolcano.
Yes sorry for posting twice was not sure the best place to ask.
I am using standard output from the DeSeq2 res command. I am trying to make a key variable MYC stand out more. I have been able to overwrite the colour scheme and change the shape of this variable alone also (see attached PDF). I would like it to stand out more. Hence why I would like to shade it.
ExampleVolcano.pdf
#Adding Custom Colours
keyvals <- ifelse(
res$log2FoldChange < -log2(1.5) & res$padj < (0.05), 'royalblue',
ifelse(res$log2FoldChange > log2(1.5) & res$padj < (0.05), 'red',
'black'))
keyvals[is.na(keyvals)] <- 'black'
names(keyvals)[keyvals == 'red'] <- 'high'
names(keyvals)[keyvals == 'black'] <- 'mid'
names(keyvals)[keyvals == 'royalblue'] <- 'low'
#Making 2 variables a different shape to stand out
# define different cell-types that will change shape
celltype1 <- c('ENSG00000136997')
celltype2 <- c('ENSG00000007516')
# create custom key-value pairs for different cell-types
# this can be achieved with nested ifelse statements
keyvals.shape <- ifelse(
rownames(res) %in% celltype1, 11,
ifelse(rownames(res) %in% celltype2, 1,
1))
keyvals.shape[is.na(keyvals.shape)] <- 1
names(keyvals.shape)[keyvals.shape == 1] <- "All other genes"
names(keyvals.shape)[keyvals.shape == 11] <- 'MYC'
names(keyvals.shape)[keyvals.shape == 1] <- NULL
#Define variable to be shaded
celltype3 <- c('ENSG00000132688')
#Enhanced volcano plot
library(EnhancedVolcano)
EnhancedVolcano(res, lab = rownames(res),
x = 'log2FoldChange', y = 'padj',
selectLab = celltype1, xlim = c(-10, 10), xlab = bquote(~Log[2]~ 'fold change'),
ylab = bquote(~-Log[10]~adjusted~italic(P)),
pCutoff = 0.05, FCcutoff = log2(1.5), pointSize = c(ifelse(rownames(res) %in% c('ENSG00000136997') , 5, 1)), labSize = 3.0, colAlpha = 5 ,colCustom = keyvals, shapeCustom = keyvals.shape,
labCol = 'black',
labFace = 'bold',
boxedLabels = T,
gridlines.major = FALSE,
gridlines.minor = FALSE,
shade = celltype3,
shadeLabel = 'MYC',
shadeAlpha = 1/2,
shadeFill = 'purple',
shadeSize = 4,
shadeBins = 5,
legend=c('NS', 'Log2 FC', 'Adjusted p-value', 'Adjusted p-value & Log2 FC'))
The above attached PDF is produced but with the following warning and no shading.
Warning message:
Computation failed in stat_density2d()
:
missing value where TRUE/FALSE needed
Thank you for the quick reply.
from enhancedvolcano.
Thanks for sharing. Can you confirm your version of R and also this package? A change brought about in R 4.0.0 has already caused functionality to change across many packages.
Also, is this line necessary?
names(keyvals.shape)[keyvals.shape == 1] <- NULL
The 'shade' functionality is a part of the package that I have considered removing, as I am not overly content with it. If you are just looking to highlight your gene, ENSG00000132688, is the selectLab
and boxedLabels
functionality enough?
selectLab
and boxedLabels
should work together, though, as exemplified here:
https://github.com/kevinblighe/EnhancedVolcano#shade-certain-variables
Is ENSG00000132688 definitely in your data?
from enhancedvolcano.
R version 3.6.3 (2020-02-29)
packageVersion("EnhancedVolcano")
‘1.4.0’
That line was not necessary thank you.
I have used the selectLab and boxedLabels together and it works very well. I would have liked to highlight it a bit more. Instead of shading, would it be possible to colour this key variable alone a single colour while also maintaining my custom colour scheme.
Thank you again for the help. I am new to R as I said and this package has been quite easy to use.
Yes the variable I am trying to shade is for sure in my data.
from enhancedvolcano.
I'm not sure what else to suggest. If possible, upgrade to R 4.0.0, which will in turn pull in the 'newest' version of EnhancedVolcano, too.
You could also try to paste a mini-table here that acts as a reproducible example that I can debug here. Or, feel free to email me some data if you prefer to keep the data private.
from enhancedvolcano.
That would be cool if I could email you. In regards to my last comment: Instead of shading, would it be possible to colour this key variable alone a single colour while also maintaining my custom colour scheme.
Thanks again for all the help.
from enhancedvolcano.
You should be able to label it its own colour via the colCustom
argument, which works much the same as shapeCustom
. Also take a look at the example here, where you could change the size of point for the key gene:
https://github.com/kevinblighe/EnhancedVolcano#highlighting-key-variables-via-custom-point-sizes
from enhancedvolcano.
Note: need to improve point shading / highlighting. geom_path may be an option.
from enhancedvolcano.
Hey @AnthonyDohertyTCD , this has now been implemented. You'll have to install the GitHub version for now; otherwise, in a few days, it will be on the Bioconductor Devel branch (and official branch when the next version of Bioconductor is released).
An example here:
https://github.com/kevinblighe/EnhancedVolcano#encircle--highlight-certain-variables
from enhancedvolcano.
Related Issues (20)
- [Bug Report] pvalue of zero are no longer transform to the machine minimum number MAC M1 HOT 2
- Errors when using EnhancedVolcano with plotly::ggplotly HOT 1
- Volcano plot labels do not show up in new window HOT 1
- "Bringing forward" certain variables to unmasked these variables
- lab does not properly output labels when column name is input HOT 2
- Change point border color? HOT 1
- y axis scale
- Highlight Key gene with different color and shape, break x-axis HOT 2
- Error about fonts when saving figure in pdf
- Two-segment Axis?
- Fix the following mappings: `colour`
- Adding labels to points not labelled by default.
- I cannot increase the length of the connectors
- Labels for infinite values do not show up anymore HOT 1
- while adjusting shape of plotted points ,accepts four possible values: Error in `[[<-.data.frame`(`*tmp*`, i, value = c(NS = 1, FC = 2, P = 3, : replacement has 4 rows, data has 3 HOT 1
- geom_hline/vline warnings with ylim/xlim zoom
- Point size varying with baseMean
- Issue with selectLab
- Issue with drawConnectors
- readme requires updating
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enhancedvolcano.