volcano_plot: Make a volcano plot comparing the gene expression of selected...

View source: R/volcano_plot.R

volcano_plotR Documentation

Make a volcano plot comparing the gene expression of selected groups of cells from one or more preprocessed Seurat objects

Description

Make a volcano plot comparing the gene expression of selected groups of cells from one or more preprocessed Seurat objects

Usage

volcano_plot(
  SO,
  assay = "RNA",
  volcano.data = NULL,
  negative.group.cells,
  positive.group.cells,
  negative.group.name = "negative.group",
  positive.group.name = "positive.group",
  meta.cols = NULL,
  x.axis.symmetric = T,
  x.axis.extension = 0,
  y.axis.pseudo.log = F,
  pseudo.log.sigma = 1,
  inf.fc.shift = 2,
  pt.size = 1,
  pt.alpha = 0.8,
  font.size = 14,
  pval.tick = NULL,
  min.pct = 0.1,
  max.iter = 10000,
  max.overlaps = 50,
  label.neg.pos.sep = T,
  label.col = "black",
  label.face = "italic",
  font.family = "sans",
  label.size = 4,
  labels.topn = 30,
  label.features = NULL,
  topn.metric = c("p.value", "fc", "both"),
  nudge.x = 0,
  nudge.y = 0,
  p.plot = c("adj.p.val", "p.val"),
  p.adjust = c("bonferroni", "holm", "hochberg", "hommel", "BH", "BY", "fdr", "none"),
  p.cut = NA,
  p.signif = 0.001,
  fc.cut = NA,
  features.exclude = NULL,
  save.path.interactive = NULL,
  gsea.param = NULL,
  interactive.only = F,
  use.limma = F,
  ...
)

Arguments

SO

one or more Seurat object(s); provide multiple objects as a (named) list

assay

which assay to get expression data from

volcano.data

optionally provide a data frame with data that have been calculated before with this function. e.g. if only style element of the returned plot are to be modified, providing this data frame will avoid to re-calculate DE genes

negative.group.cells

vector of cell names for the negative group of cells; genes which are expressed at higher level in this group will have a negative sign (minus); use Seurat::Cells() or Seurat::WhichCells() to select or use filter operations on SO@meta.data to select cells

positive.group.cells

vector of cell names for the positive group of cells; genes which are expressed at higher level in this group will have a positive sign (plus); use Seurat::Cells() or Seurat::WhichCells() to select or use filter operations on SO@meta.data to select cells

negative.group.name

name for the negative group of cells; this will appear on plot axes

positive.group.name

name for the positive group of cells; this will appear on plot axes

meta.cols

which meta.cols to keep in SO for interactive plotting

x.axis.symmetric

logical; make the x-axis which indicates log-fold changes symmetric (same range in plus and minus direction)

x.axis.extension

numeric; positive or negative value to extend the x-axis by

y.axis.pseudo.log

logical; use a pseudo-log y-axis for -log10(pvalue); may be helpful to better visualize and label dense area of genes in the plot; done with scales::pseudo_log_trans

pseudo.log.sigma

numeric; adjustment to the pseudo-log tranasformation; passed to scales::pseudo_log_trans

inf.fc.shift

numeric; genes with an infinite fold-change (happens when a gene not expressed at all in one group) are not left infinite but will be put at: "largest finite fold-change +/- inf.fc.shift"; such genes are indicated specifically

pt.size

numeric; point size passed to ggplot2::geom_point

pt.alpha

numeric; point opacity (alpha value) passed to ggplot2::geom_point

font.size

numeric; font size of point labels; passed as base_size to ggplot2::theme_bw() and as size = 5/14*font.size to ggplot2::geom_text (5/14 is the conversion between how geom_text handles the size argument and how theme does it)

pval.tick

NULL or numeric, if not NULL: plot an extra y-axis-tick to indicate a significance level in the linear space (not -log10); e.g.: pval.tick = 0.01 will plot an axis-tick at p = 0.01

min.pct

numeric; only consider genes for the volcano plot which are expressed at least by this fraction of cells in both groups (negative.group.cells, positive.group.cells)

max.iter

max.iter passed to ggrepel::geom_text_repel

max.overlaps

max.overlaps passed to ggrepel::geom_text_repel

label.neg.pos.sep

logical whether to label genes with negative and positive fold change separately; this will make sure that labels on the left (negative log fc) point to the left and labels on the right (positive log fc) point to the right

label.col

font color of labels

label.face

font face of labels

font.family

font family (font type) of labels, e.g. Courier or Sans

label.size

size of labels

labels.topn

numeric; how many labels (roughly) to plot based on the selected metric

label.features

character vector; select genes which are to be labeled; OR: "significant" which will let p.signif come into usage

topn.metric

which metric to use for selection of top genes for labeling ()

nudge.x

nudge.x passed to ggrepel::geom_text_repel; shift labels into x-direction; for genes with negative fold change -nudge.x will be used; genes with positive fold change use nudge.x

nudge.y

nudge.x passed to ggrepel::geom_text_repel; shift labels into y-direction;

p.plot

which p-value to use for plotting, adjusted p-value or unadjusted p-value

p.adjust

method for p-value adjustment

p.cut

plot a horizontal line at this p-value; in combination with fc.cut all genes above this cut (and above fc.cut) are counted and the number is plotted

p.signif

a significance level from which on genes are labeled; supply label.features = "significant" to make use of this

fc.cut

plot vertical lines at these fold changes (plus and minus); in combination with p.cut all genes above this cut (and above p.cut) are counted and the number is plotted

features.exclude

character vector of features to exclude from plotting; you may supply regular expressions like "^RPL" and/or "^RPS" to exclude all ribosomal genes

save.path.interactive

path on disk where to save data for interactive analysis of the volcano plot; this will initiate a directory with a shiny script and an rds file of with SO and DE genes

gsea.param

list of length 2, each index holding a numeric vector of length 2: fold change (list index 1) and p-value (list index 2) limits for GSEA; first entry of each vector applies for genes with negative fold change, second entry for genes with positive fold change; 2 GSEA will be run separately on genes with negative and positive fold change; if argument is NULL no GSEA is performed; the function called for GSEA is scexpr::fgsea_on_msigdbr which uses all gene sets from msigdb(r) by default and runs fgsea for GSEA; alternative arguments to scexpr::fgsea_on_msigdbr can be supplied in ... (except for gene.ranks)

interactive.only

logical; do calculations only for interactive analysis and only return these values

use.limma

logical; use limma for DE gene detection; intended for subsequent use MetaVolcanoR which relies on values returned from limma

...

arguments to scexpr::feature_plot like col.pal.d = setNames(c("grey90", scexpr::col_pal()c(2,3)), c("other", "name1", "name2")), order.discrete = "^other", plot.title = F, etc


Close-your-eyes/scexpr documentation built on April 21, 2023, 10:27 a.m.