Hello,
Thank you Kevin for this amazing EnhancedVolcano package! The overall result looks great. There's just one thing I am having difficulties fine-tuning, which is the length/dimension of the connectors of gene labels. I've searched around and I found a couple posts on this but the functions suggested are not working. Could you please help me understand what I might be doing wrong?
When I set the length of connectors (lengthConnectors = unit(1, 'npc')), the only thing that changes is the size of the arrowhead, not the connector line itself. This function is described to control "Length (size) of the connector arrowheads". Which is why if I turn off the arrowheads (arrowheads = FALSE), then this function doesn't have any effect. I was able to tune the width of the connector line through (widthConnectors = 1), but not the actual length of the connector lines.
Is there any way I can achieve this?
resddsCPM.df <- as.data.frame(resddsCPM)
keyvals <- ifelse(resddsCPM$padj > 0.05, 'grey30',
ifelse(resddsCPM$log2FoldChange < -1, 'firebrick3',
ifelse(resddsCPM$log2FoldChange > 1, 'royalblue', 'grey30')))
names(keyvals)[keyvals == 'royalblue'] <- 'Up'
names(keyvals)[keyvals == 'grey30'] <- 'Non-DEG'
names(keyvals)[keyvals == 'firebrick3'] <- 'Down'
#Highlight Genes of Interest
selected = c("IL1B", "FGF5", "IL1A")
#Plot Volcano
enhvolc <- EnhancedVolcano(resddsCPM.df, x = "log2FoldChange", y = "padj", lab = resddsCPM.df$geneID,
pCutoff = 0.05, FCcutoff = 1,
title = NULL,
subtitle = NULL,
caption = NULL,
xlab = bquote(~Log[2]~"(Fold Change)"),
ylab = bquote(~-Log[10] ~ "(" * italic(P[adj]) * ")"),
drawConnectors = TRUE,
pointSize = 1.2,
colAlpha = 0.5,
colCustom = keyvals,
arrowheads = FALSE,
lengthConnectors = unit(1, 'npc'),
xlim = c(-11, 11),
ylim = c(0, -log10(10e-306)),
selectLab = selected
)
enhvolc
Thank you for your help!
Peter
Thanks for your patience and help Kevin.
I've tried playing around with the min.segment.length, but unfortunately all it does is set a threshold for the length over which Connectors will be drawn. If the distance from a point and the gene label were 0.5cm and threshold is at 1cm, it simply doesnt draw the Connector. Instead, I was trying to find a way to enforce the Connector to extend until the desired length (say, 1 cm). From your feedback I realize there might not be an option within ggrepel to do this straightfoward.
Maybe if there was a way within EnhancedVolcano to define the distance at which gene labels appear from their corresponding points, then min.segment.length would work well. With this, I could force the gene labels to be shifted exactly 2 cm away from their corresponding datapoints, then call out min.segment.length to graph connectors with a 2 cm length.
Could you offer any advice if this would be feasible?
Thank you again for your help,
Pedro
Boa tarde, não sei cara. Me parece que não existe solução facil. Eu experimentei com tantas soluções potenciais desta página (https://ggrepel.slowkow.com/articles/examples.html) mas tudo me parecia variavle e não consistente. Apos, tirei a toalha e deixei a EnhancedVolcano como é.
Compreendo perfeitamente e agradeço toda a dedicação em servir a comunidade cientifica. Obrigado Kevin pela magnifica ferramenta!
Valeu cara!