Volcano Plot in R
1
1
Entering edit mode
2.6 years ago
sinha.puja ▴ 20

Hi, I am trying to make volcano plot using EnhancedVolcano: Publication-ready volcano plots with enhanced colouring and labeling and my data looks like as below:

head(db_P7_db_veh)
Gene_symbol log2FoldChange   pvalue  DEG
Cmklr1      0.9830351 1.08e-06   UP
Akirin2     -0.6085560 1.28e-05 DOWN
Tgm2      1.2431722 1.35e-05   UP
Atp11a      0.7794673 1.47e-05   UP

The code I used is:

EnhancedVolcano(db_P7_db_veh,
            lab = rownames(db_P7_db_veh),
            x = 'log2FoldChange',
            y = 'pvalue' ,
            selectLab = c('Fmo3','Rab3b', 'Gata5', 'Acta2'))

My question is that the code is making the plot but I am trying to add the gene labels for some of the genes as shown in the code but it is not plotting with the gene names as I needed. There is no error message also. So, if anyone can help me in that then it would be highly appreciated. Thanks in advance!

R • 1.5k views
ADD COMMENT
0
Entering edit mode

tagging Kevin Blighe

ADD REPLY
0
Entering edit mode

Thank you.

ADD REPLY
0
Entering edit mode
2.6 years ago

Hi,

It seems that you just need to use:

EnhancedVolcano(...,
  lab = db_P7_db_veh$Gene_symbol,
  ...)
ADD COMMENT
0
Entering edit mode

Thanks Kevin, it's working now. I have another question about maxoverlapconnectors when I am using maxoverlapsConnectors = Inf, my graph looks totally black with few spots of red and green because I get the following warning ggrepel: 1307 unlabeled data points (too many overlaps). Consider increasing max.overlaps

My code is below:

keyvals <- ifelse(
  db_P7_db_veh$log2FoldChange < -1.5 | db_P7_db_veh$pvalue < 0.05, 'green4',
  ifelse(db_P7_db_veh$log2FoldChange > 1.5 | db_P7_db_veh$pvalue < 0.05, 'red',
         'black'))
keyvals[is.na(keyvals)] <- 'black'
names(keyvals)[keyvals == 'red'] <- 'high'
names(keyvals)[keyvals == 'green4'] <- 'low'

EnhancedVolcano(db_P7_db_veh,
                lab = db_P7_db_veh$Gene_symbol,
                x = 'log2FoldChange',
                y = 'pvalue',
                selectLab = db_P7_db_veh$Gene_symbol[which(names(keyvals) %in% c('high', 'low'))],
                xlab = bquote(~Log[2]~ 'fold change'),
                pointSize = 2.5,
                labSize = 3.5,
                colCustom = keyvals,
                colAlpha = 0.5,
                legendPosition = 'right',
                legendLabSize = 15,
                legendIconSize = 5.0,
                drawConnectors = TRUE,
                widthConnectors = 1.0,
                colConnectors = 'black',
                arrowheads = FALSE,
                gridlines.major = TRUE,
                gridlines.minor = FALSE,
                border = 'partial',
                borderWidth = 1.5,
                borderColour = 'black',
                maxoverlapsConnectors = Inf)

Please help me in this. Thanks.

ADD REPLY
0
Entering edit mode

Yes, you may want to reduce the value of maxoverlapsConnectors, or, instead, increased the thresholds for statistical significance (pCutoff and FCcutoff) so that less genes are labelled

ADD REPLY
0
Entering edit mode

Thank you.

ADD REPLY
0
Entering edit mode

You are most welcome.

ADD REPLY

Login before adding your answer.

Traffic: 1575 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6