View source: R/pipeline_functions.R
draw.volcanoPlot | R Documentation |
draw.volcanoPlot
draws the volcano plot to identify and visualize DE genes or DA drivers with fold change threshold and significant P-value from the input dataset.
The function will return a data.frame of these highlighted genes/drivers.
draw.volcanoPlot(
dat = NULL,
label_col = NULL,
logFC_col = NULL,
Pv_col = NULL,
logFC_thre = 0.1,
Pv_thre = 0.01,
show_plot = TRUE,
xlab = "log2 Fold Change",
ylab = "P-value",
show_label = FALSE,
label_cex = 0.5,
legend_cex = 0.8,
label_type = "distribute",
main = "",
pdf_file = NULL
)
dat |
data.frame, the master table created by function |
label_col |
character, the name of the column in |
logFC_col |
character, the name of the column in |
Pv_col |
character, the name of the column in |
logFC_thre |
numeric, the threshold of logFC. Genes or drivers with absolute logFC value higher than the threshold will be kept. Default is 0.1. |
Pv_thre |
numeric, the threshold of P-values. Genes or drivers with P-values lower than the threshold will be kept. Default is 0.01. |
show_plot |
logical, if TRUE, the plot will be shown in the plot pane. Default is TRUE. |
xlab |
character, a title for the X axis. |
ylab |
character, a title for the Y axis. |
show_label |
logical, if TRUE, labels of selected genes or drivers will be displayed in the plot. Default is FALSE. |
label_cex |
numeric, giving the amount by which the text of genes/drivers label should be magnified relative to the default. Default is 0.5. |
legend_cex |
numeric, giving the amount by which the text of legend should be magnified relative to the default. Default is 0.7. |
label_type |
character, users can choose between "origin" and "distribute". If "origin", all the labels will be displayed without location modification. If "distribute", location of labels will be rearranged to avoid overlap. Default is "distribute". |
main |
character, an overall title for the plot. |
pdf_file |
character, the path to save the plot as PDF file. If NULL, no PDF file will be created. Default is NULL. |
Top genes or drivers will be colored (blue for down-regulated and red for up-regulated) and labeled with their names. This function requires the input of master table and two thresholds of logFC and P-value.
Return a data.frame of selected significant genes or drivers, with columns contain label_col
, logFC_col
and Pv_col
.
analysis.par <- list()
analysis.par$out.dir.DATA <- system.file('demo1','driver/DATA/',package = "NetBID2")
NetBID.loadRData(analysis.par=analysis.par,step='ms-tab')
ms_tab <- analysis.par$final_ms_tab
sig_driver <- draw.volcanoPlot(dat=ms_tab,label_col='gene_label',
logFC_col='logFC.G4.Vs.others_DA',
Pv_col='P.Value.G4.Vs.others_DA',
logFC_thre=0.4,
Pv_thre=1e-7,
main='Volcano Plot for G4.Vs.others_DA',
show_label=FALSE,
label_type = 'origin',
label_cex = 0.5)
## Not run:
analysis.par <- list()
analysis.par$out.dir.DATA <- system.file('demo1','driver/DATA/',package = "NetBID2")
NetBID.loadRData(analysis.par=analysis.par,step='ms-tab')
ms_tab <- analysis.par$final_ms_tab
analysis.par$out.dir.PLOT <- getwd() ## directory for saving the pdf files
sig_driver <- draw.volcanoPlot(dat=ms_tab,label_col='gene_label',
logFC_col='logFC.G4.Vs.others_DA',
Pv_col='P.Value.G4.Vs.others_DA',
logFC_thre=0.4,
Pv_thre=1e-7,
main='Volcano Plot for G4.Vs.others_DA',
show_label=FALSE,
label_type = 'origin',
label_cex = 0.5)
sig_gene <- draw.volcanoPlot(dat=ms_tab,label_col='geneSymbol',
logFC_col='logFC.G4.Vs.others_DE',
Pv_col='P.Value.G4.Vs.others_DE',
logFC_thre=2,Pv_thre=1e-3,
main='Volcano Plot for G4.Vs.others_DE',
show_label=FALSE,
pdf_file=sprintf('%s/vocalno_nolabel_DE.pdf',
analysis.par$out.dir.PLOT))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.