kevinblighe / EnhancedVolcano

Publication-ready volcano plots with enhanced colouring and labeling
399 stars 81 forks source link

Add #66

Closed elcega closed 3 years ago

elcega commented 3 years ago

How can I define the gene names and plot them instead of the res geneIDs? OG_592 = "gene1" OG_232 = "gene2"

EnhancedVolcano(res,
    lab = rownames(res),
    x = 'log2FoldChange',
    y = 'pvalue',
    selectLab = c('OG_592','OG_232'),
    xlab = bquote(~Log[2]~ 'fold change'),
    pCutoff = 10e-14,
    FCcutoff = 2.0,
    pointSize = 4.0,
    labSize = 6.0,
    labCol = 'black',
    labFace = 'bold',
    boxedLabels = TRUE,
    colAlpha = 4/5,
    legendPosition = 'right',
    legendLabSize = 14,
    legendIconSize = 4.0,
    drawConnectors = TRUE,
    widthConnectors = 1.0,
    colConnectors = 'black')

https://ibb.co/GMLDysX

kevinblighe commented 3 years ago

Hi, I don't know what you want to do. If you need to change gene names, then please do that outside of EnhancedVolcano

elcega commented 3 years ago

So I did the following to add a custom label and worked :) It is quite useful in case we are working with geneIDs and would like to label with the known-name gene.

res_volcano<- as.data.frame(res)
rownames(res_volcano)[rownames(res_volcano) == "OG_592"] <- "Gene 1"

And now I can run the code with the name changed:

EnhancedVolcano(res,
    lab = rownames(res),
    x = 'log2FoldChange',
    y = 'pvalue',
    selectLab = c('Gene 1','OG_232'),
    xlab = bquote(~Log[2]~ 'fold change'),
    pCutoff = 10e-14,
    FCcutoff = 2.0,
    pointSize = 4.0,
    labSize = 6.0,
    labCol = 'black',
    labFace = 'bold',
    boxedLabels = TRUE,
    colAlpha = 4/5,
    legendPosition = 'right',
    legendLabSize = 14,
    legendIconSize = 4.0,
    drawConnectors = TRUE,
    widthConnectors = 1.0,
    colConnectors = 'black')