This function creates a volcano plot for one comparison group
volcano_plot(
pvalues_df,
comparison,
p_cutoff = 0.05,
fc_cutoff = 1,
label_rows = NULL,
p_col_suffix = "pvalue",
padj_col_suffix = "padj",
fc_col_suffix = "logFC",
cutoff_criteria = "pvalue",
label_col = "label",
label_size = 3,
text_size = 10,
marker_alpha = 0.7,
marker_size = 3,
marker_outline_colour = "white",
marker_outline_width = 0.5,
sig_names = NULL,
colour_col = FALSE,
colours = c("salmon", "steelblue", "limegreen", "grey60"),
drop_unused_cols = TRUE,
fc_line = TRUE,
p_line = TRUE,
line_colours = c("black", "black")
)
The pvalues data frame. This must contain a pvalue, padj, and logFC column as well as a label column.
The comparison (column_prefix) to use.
The cut-off for adjusted pvalue significance (default = 0.05).
The cut-off for fold change significance (default = 1).
Row numbers or names of values to be annotated/labelled (default = NULL).
The suffix word to define columns containing p values (default = 'pvalues').
The suffix word to define columns containing adjusted
p values (default = 'padj'). If NULL these will be calculated using
padjust_method
.
The optional suffix word to define columns containing log fold change values (default = 'logFC').
Whether to use pvalue or padj for the colour coding significance cutoff.
Optional column name in 'pvalues_df' for labelling markers. If NULL the rownames of pvalues are used.
The font size of labels (default = 3)
The font size of text (default = 10)
The alpha parameter for markers (default = 0.7).
The size of markers (default = 3)
Colour for marker outline (default = white)
Width for marker outline (default = 0.5)
A character vector of labels to be used for:
non-significant; adjusted p < p_cutoff; |Fold Change| > fc_cutoff; and
finally adjusted p < p_cutoff.
If NULL c('Not Significant', paste('Padj <', p_cutoff)
,
paste('|FC| >', fc_cutoff)
,
paste('Padj <', p_cutoff, 'and |FC| >', fc_cutoff)
) is used.
Logical whether colour coding has been passed in through `pvalues_df$col`.
A character vector of colours to be used. This can be of length 3, 4, 7 or 8 depending on the colour coding desired.
If length is 3, c(a,b,c): Only the significant wings are highlighted (where p>p_cutoff and abs(fc)>fc_cutoff) on the graph:
a: padj <= p_cutoff & fc <= -1*fc_cutoff
b: padj <= p_cutoff & fc >= fc_cutoff
c: padj > p_cutoff | abs(fc) < fc_cutoff
If length is 4, c(a,b,c,d):
a: padj <= p_cutoff & abs(fc) >= fc_cutoff
b: padj <= p_cutoff & abs(fc) < fc_cutoff
c: padj > p_cutoff & abs(fc) >= fc_cutoff
d: padj < p_cutoff & abs(fc) < fc_cutoff
If length is 8 c(a,b,c,d,e,f,g,h): Each significance group is colour-coded
a: padj <= p_cutoff & fc <= -1*fc_cutoff
b: padj <= p_cutoff & -1*fc_cutoff < fc <= 0
c: padj <= p_cutoff & 0 < fc < fc_cutoff
d: padj <= p_cutoff & fc >= fc_cutoff
e: padj > p_cutoff & fc <= -1*fc_cutoff
f: padj > p_cutoff & -1*fc_cutoff < fc <= 0
g: padj > p_cutoff & 0 < fc < fc_cutoff
h: padj > p_cutoff & fc >= fc_cutoff
Logical whether to drop colours not used from legend (default=T).
Logical whether to add vertical dashed line at fc_cutoff (default = TRUE).
Logical whether to add horizontal dashed line at p_cutoff (default = TRUE).
A character vector stating the colour of lines to be used for fc_line and p_line respectively (default = c('black', 'black')).
Returns a single volcano plot.
Lewis, Myles J., et al. (2019). Molecular portraits of early rheumatoid arthritis identify clinical and treatment response phenotypes. Cell reports, 28:9
# NOT RUN {
data("example_data")
volcano_plot(syn_example_p,
"Fibroid_Lymphoid",
label_col = "Gene",
label_rows=c("SLAMF6"),
fc_col_suffix="log2FoldChange")
# }
Run the code above in your browser using DataLab