gg_volcanoplot: Volcano plot with ggplot2

View source: R/gg_plots.R

gg_volcanoplotR Documentation

Volcano plot with ggplot2

Description

Volcano plot with ggplot2

Usage

gg_volcanoplot(
  fold_change.vn,
  adjusted_pvalue.vn,
  adjust_method.c = "",
  adjust_thresh.n = 0.05,
  label.vc = "",
  title.c = "",
  xlab.c = "Fold Change",
  signif_palette.vc = c(yes = RColorBrewer::brewer.pal(9, "Greens")[8], no =
    RColorBrewer::brewer.pal(9, "Greys")[7]),
  signif_shape.vi = c(yes = 16, no = 1),
  class_name.vc = "",
  class_color.vc = "",
  size.ls = list(class.i = 5, lab.i = 16, point.i = 3, tick.i = 14, title.i = 20),
  figure.c = c("interactive", "interactive_plotly", "my_volcanoplot.pdf",
    "my_volcanoplot.html")[2]
)

Arguments

fold_change.vn

Numeric vector: fold changes

adjusted_pvalue.vn

Numeric vector: (adjusted) p-values

adjust_method.c

Character: method for multiple testing correction

adjust_thresh.n

Numeric: significance threshold

label.vc

Character (vector): either the name of a character column from the data or a character vector of the same length as the row number of the data, containing the feature labeling

title.c

Character: plot title

xlab.c

Character: x label (default: "Fold Change")

signif_palette.vc

Character vector: color palette (default 'green4' for significant features and 'gray' otherwise

signif_shape.vi

Integer vector: shapes for significant (respectively, non significant) features; default is 16 (respectively, 1)

class_name.vc

Character vector: names of the two compared class labels

class_color.vc

Character vector: colors of the two compared class labels

size.ls

List of sizes for classes (default: 5), xy labels (default: 16), points (default: 3), ticks (default: 14) and title (default: 20)

figure.c

Character: either 'interactive' (respectively, 'interactive_plotly') for interactive display with ggplot2 (respectively, with plotly::ggplotly [default]), or 'my_volcanoplot.pdf' (respectively 'my_volcanoplot.html') for figure saving (only the extension matters) with ggplot2 (respectively, with plotly::ggplotly)

Value

invisible ggplot2 object

Examples

sacurine.eset <- phenomis::reading(system.file("extdata/W4M00001_Sacurine-statistics", package = "phenomis"))
sacurine.eset <- phenomis::correcting(sacurine.eset, figure.c = "none")
sacurine.eset <- sacurine.eset[, Biobase::pData(sacurine.eset)[, "sampleType"] != "pool"]
sacurine.eset <- phenomis::transforming(sacurine.eset)
sacurine.eset <- phenomis::hypotesting(sacurine.eset, test.c = "wilcoxon",
                                      factor_names.vc = "gender",
                                      figure.c = "none", report.c = "none")
fold.vn <- Biobase::fData(sacurine.eset)[, "wilcoxon_gender_Female.Male_diff"]
fdr.vn <- Biobase::fData(sacurine.eset)[, "wilcoxon_gender_Female.Male_BH"]
feat.vc <- Biobase::featureNames(sacurine.eset)
phenomis::gg_volcanoplot(fold.vn,
                         fdr.vn,
                         label.vc = feat.vc,
                         adjust_method.c = "BH")
feat_signif.vc <-  sapply(seq_along(feat.vc),
                          function(feat.i)
                           ifelse(fdr.vn[feat.i] <= 0.05, feat.vc[feat.i], ""))
phenomis::gg_volcanoplot(fold.vn,
                         fdr.vn,
                         label.vc = feat_signif.vc,
                         adjust_method.c = "BH",
                         figure.c = "interactive")

SciDoPhenIA/phenomis documentation built on June 9, 2022, 11:54 p.m.