kevinblighe / EnhancedVolcano

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

Position of labels #71

Closed BaluPai closed 3 years ago

BaluPai commented 3 years ago

Hi Kevin,

Thanks for this awesome Plotting tool. Indeed helpful. I have a small issue regarding the labels. As I plot most of the labels orient towards one side. Using the connectors, the connectors and labels again orient to only one side. But on the tutorial, I see that they are quite randomly distributed.

Your help or suggestion is appreciated.

Custom

EnhancedVolcano(res, lab = rownames(res), x = 'log2FoldChange', y = 'pvalue', xlim = c(-30, 30), title = 'MN Stem', subtitle = "Differential expression",

selectLab = c('TWIST2_32owz.2', 'SOX21_1vma.4','SOX21-AS1_1vmb.3',

       # 'GFAP_2ihr.4','GFAP_60gdm.1','POU3F1_1ccp.2', 'COL3A1_2uqj.2', 'XIST_64zyp.1', 'H19_21qbz.2')

xlab = bquote(~Log[2]~ 'fold change'), pCutoff = 10e-6, FCcutoff = 5, cutoffLineType = 'twodash', cutoffLineWidth = 0.8, pointSize = 3.0, labSize = 4.0, colAlpha = 0.7, legendLabels=c('Not sig.','Log (base 2) FC','p-value', 'p-value & Log (base 2) FC'), legendPosition = 'right', legendLabSize = 12, legendIconSize = 5.0, gridlines.major = FALSE, gridlines.minor = FALSE,

drawConnectors = TRUE,

widthConnectors = 0.5,

colConnectors = 'black',

typeConnectors = 'open',

labCol = 'black', labFace = 'bold',

boxedLabels = TRUE,

parseLabels = TRUE,

borderWidth = 1.5, borderColour = 'black', selectLab = rownames(res)[which(names(keyvals) %in% c('high', 'low'))], )

Best regards, Balu

kevinblighe commented 3 years ago

Hey Balu,

The direction of the connectors should be random - what is adding these to the plot is the package ggrepel, which is used by EnhancedVolcano. You could try to increase the label size or extend the length of the connectors to see if that 'upsets' the directionality; otherwise, I have no concrete solution for this right now.

Kind regards, Kevin

BaluPai commented 3 years ago

Hi Kevin,

Thanks for the input. I had tried to do that, it did not help unfortunately. Also I did try to tweak with the ggrepel , still the same :-(

Best regards, Balu

kevinblighe commented 3 years ago

Sorry about that. You could also try to alter the cut-offs / thresholds to see if that changes anything.

ggrepel had one or more key changes in the previous release, which indirectly affects EnhancedVolcano.

kevinblighe commented 3 years ago

Hi, this should now automatically work, i.e., labels should no longer be 'cropped' at the side. Please try the GitHub version. Also, I now always recommend to enable drawConnectors.

There were some changes to ggrepel which have caused a few hiccups here, but overall these will make ggrepel and EnhancedVolcano better in the long term.

Kevin

BaluPai commented 3 years ago

Thanks Kevin,

I will try it out soon.

Best regards Balu

blogeman commented 3 years ago

Thanks @kevinblighe for making and maintaining this tool. I originally had the same problem as @BaluPai, in that the labels were being forced to one side as opposed to maximizing repulsion. Updating EnhancedVolcano to the development version solved the problem.

Leaving this comment for others.

kevinblighe commented 3 years ago

Thanks for adding this comment @blogeman . Yes, the arrow functionality should now be updated in the development version, and will be available in the official Bioconductor release when the next Bioconductor version (3.13) is released.