Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight Key gene with different color and shape, break x-axis #120

Open
rana228 opened this issue Sep 2, 2023 · 2 comments
Open

Highlight Key gene with different color and shape, break x-axis #120

rana228 opened this issue Sep 2, 2023 · 2 comments

Comments

@rana228
Copy link

rana228 commented Sep 2, 2023

Hi Kevin,

Thank you for developing such an amazing package.

I have been using this for a long time.

I was able to generate the volcano plot but I would also like to place my gene labels on right side instead of on the dots to improve the label visibility.
Also as you can see in the plot, Lmo4 gene has high expression so it is placed far from other genes which doesn't look nice. So is there a way to break the axis like in ggbreak pakage to place it closer to rest of the genes.

Could you please help me out with this issue.

Thank you for your help.

Here is the code:

keyvals <- ifelse(
  res$logFC <= -0.3, 'grey',
  ifelse(res$logFC >= 0.3, 'royalblue',
         'black'))
keyvals[is.na(keyvals)] <- 'black'
names(keyvals)[keyvals == 'royalblue'] <- 'UP'
names(keyvals)[keyvals == 'black'] <- 'Neutral'
names(keyvals)[keyvals == 'grey'] <- 'Down'

p1 <- EnhancedVolcano(res,
                lab = rownames(res),
                x = 'logFC',
                y = 'FDR',
                selectLab = c("Tcf7","Socs3","JunB","Lmo4"),
                xlim= c(-1,6),
                title = 'WT versus OE',
                pCutoff = 5e-02,
                FCcutoff = 0.3,
                pointSize = 3,
                labSize = 8,
                #shapeCustom = keyvals.shape,
                #shape = c(6, 4, 2, 11),
                colCustom = keyvals,
                colAlpha = 1,
                legendPosition = 'NULL',
                legendLabSize = 15,
                legendIconSize = 5.0,
                drawConnectors = TRUE,
                widthConnectors = 1,
                arrowheads = FALSE,
                #directionConnectors= "x",
                min.segment.length= 0,
                #max.overlaps = "Inf",
                colConnectors = 'black',
                gridlines.major = TRUE,
                gridlines.minor = FALSE,
                border = 'partial',
                borderWidth = 1,
                borderColour = 'black')


# Modify scale_x_continuous() --------------------------------------------------
p1 + 
  scale_y_continuous(breaks = c(seq(0,30, 5)), # Modify x-axis tick intervals    
                     limits = c(0, 30))

@rana228 rana228 changed the title Highlight Key gene with different color and shape Highlight Key gene with different color and shape, break x-axis Sep 2, 2023
@junli1988
Copy link

Have you found a way to break the x-axis? I have a similar problem with one knocked-out gene being lower than everything else.

@rana228
Copy link
Author

rana228 commented Jan 3, 2024

Hi @junli1988,

Sorry for the late reply. You can use ggbreak package (https://cran.r-project.org/web/packages/ggbreak/vignettes/ggbreak.html) to break the axis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants