Learn R Programming

volcano3D (version 1.2.0)

volcano_plot: Creates a single volcano plot

Description

This function creates a volcano plot for one comparison group

Usage

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")
)

Arguments

pvalues_df

The pvalues data frame. This must contain a pvalue, padj, and logFC column as well as a label column.

comparison

The comparison (column_prefix) to use.

p_cutoff

The cut-off for adjusted pvalue significance (default = 0.05).

fc_cutoff

The cut-off for fold change significance (default = 1).

label_rows

Row numbers or names of values to be annotated/labelled (default = NULL).

p_col_suffix

The suffix word to define columns containing p values (default = 'pvalues').

padj_col_suffix

The suffix word to define columns containing adjusted p values (default = 'padj'). If NULL these will be calculated using padjust_method.

fc_col_suffix

The optional suffix word to define columns containing log fold change values (default = 'logFC').

cutoff_criteria

Whether to use pvalue or padj for the colour coding significance cutoff.

label_col

Optional column name in 'pvalues_df' for labelling markers. If NULL the rownames of pvalues are used.

label_size

The font size of labels (default = 3)

text_size

The font size of text (default = 10)

marker_alpha

The alpha parameter for markers (default = 0.7).

marker_size

The size of markers (default = 3)

marker_outline_colour

Colour for marker outline (default = white)

marker_outline_width

Width for marker outline (default = 0.5)

sig_names

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.

colour_col

Logical whether colour coding has been passed in through `pvalues_df$col`.

colours

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

drop_unused_cols

Logical whether to drop colours not used from legend (default=T).

fc_line

Logical whether to add vertical dashed line at fc_cutoff (default = TRUE).

p_line

Logical whether to add horizontal dashed line at p_cutoff (default = TRUE).

line_colours

A character vector stating the colour of lines to be used for fc_line and p_line respectively (default = c('black', 'black')).

Value

Returns a single volcano plot.

References

Lewis, Myles J., et al. (2019). Molecular portraits of early rheumatoid arthritis identify clinical and treatment response phenotypes. Cell reports, 28:9

Examples

Run this code
# 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