Skip to contents

Visualize differentially expressed genes

Usage

VizDEGs(
  degs,
  plot_type = c("volcano_pct", "volcano_log2fc", "jitter_pct", "jitter_log2fc", "violin",
    "box", "bar", "ridge", "dim", "heatmap", "dot"),
  order_by = "desc(abs(avg_log2FC))",
  genes = 10,
  outprefix = NULL,
  devpars = list(res = 100),
  more_formats = c(),
  save_code = FALSE,
  show_row_names = TRUE,
  show_column_names = TRUE,
  ...
)

Arguments

degs

DEGs from RunSeuratDEAnalysis

plot_type

Type of plot to generate One of 'volcano_pct', 'volcano_log2fc', 'jitter_log2fc', 'jitter_pct', 'violin', 'box', 'bar', 'ridge', 'dim', 'heatmap', 'dot'

order_by

An expression in string to order the genes

genes

Number of genes genes to visualize (based on the 'order_by' expression) Or an expression in string to filter the genes (passed by dplyr::filter) Only works when plot_type is not a volcano plot

outprefix

Prefix of the output file

devpars

List of parameters to save the plot

more_formats

Additional formats to save the plot in addition to 'png'

save_code

Whether to save the code to reproduce the plot

show_row_names

Whether to show row names in the heatmap

show_column_names

Whether to show column names in the heatmap

...

Additional arguments to pass to the plot function

  • For 'volcano_pct' and 'volcano_log2fc', additional arguments to pass to 'scplotter::VolcanoPlot'

  • For 'jitter_pct' and 'jitter_log2fc', additional arguments to pass to 'plotthis::JitterPlot'

  • For 'violin', 'box', 'bar', 'ridge', 'dim', 'heatmap', 'dot', additional arguments to pass to 'scplotter::FeatureStatPlot'

Value

A ggplot object if 'outprefix' is NULL, otherwise, save the plot to the output directory

Examples

# \donttest{
degs <- RunSeuratDEAnalysis(scplotter::pancreas_sub, "SubCellType")
VizDEGs(degs, plot_type = "volcano_pct")

VizDEGs(degs, plot_type = "volcano_log2fc")

VizDEGs(degs, plot_type = "jitter_log2fc")

VizDEGs(degs, plot_type = "violin", genes = 2)

VizDEGs(degs, plot_type = "violin", stack = TRUE, genes = 2)

VizDEGs(degs, plot_type = "box", genes = 2)

VizDEGs(degs, plot_type = "bar", genes = 2, x_text_angle = 90)

VizDEGs(degs, plot_type = "ridge", genes = 2)
#> Picking joint bandwidth of 0.196
#> Picking joint bandwidth of 0.377
#> Picking joint bandwidth of 0.26
#> Picking joint bandwidth of 0.222
#> Picking joint bandwidth of 0.213
#> Picking joint bandwidth of 0.327
#> Picking joint bandwidth of 0.219
#> Picking joint bandwidth of 0.246
#> Picking joint bandwidth of 0.243
#> Picking joint bandwidth of 0.274
#> Picking joint bandwidth of 0.249
#> Picking joint bandwidth of 0.196
#> Picking joint bandwidth of 0.377
#> Picking joint bandwidth of 0.26
#> Picking joint bandwidth of 0.222
#> Picking joint bandwidth of 0.213
#> Picking joint bandwidth of 0.327
#> Picking joint bandwidth of 0.219
#> Picking joint bandwidth of 0.246
#> Picking joint bandwidth of 0.243
#> Picking joint bandwidth of 0.274
#> Picking joint bandwidth of 0.249

VizDEGs(degs, plot_type = "dim", genes = 1)

VizDEGs(degs, plot_type = "heatmap", genes = 5)

VizDEGs(degs, plot_type = "dot", genes = 5)

# }