Skip to contents

Generate a box plot to show gene expression (CPM) This is the function to generate a box plot to show CPM levels of DE genes among selected treatment samples and control samples.

Usage

plot_counts(
  data = NULL,
  genes = NULL,
  group_by = NULL,
  treatment_samples = NULL,
  control_samples = NULL,
  color_by = NULL,
  normalisation = NULL,
  batch = 1
)

Arguments

data

A tidyseurat object merged with metadata. Must contain columns "Well_ID", "Row", "Column".

genes

Genes to be plotted

group_by

A column that specifies the treatment group in the input data

treatment_samples

Value in the column "combined_id" representing replicates of treatment samples in the data

control_samples

Value in the column "combined_id" representing replicates of control samples in the data

color_by

A column that specifies the group coloring

normalisation

One of "raw", "logNorm", "cpm", "clr", "SCT", "DESeq2", "edgeR", "RUVg", "RUVs", "RUVr", "limma_voom"

batch

To indicate patch factor

Value

a ggplot2 object

Examples

data(mini_mac)
genes <- mini_mac@tools$diff_exprs$Staurosporine_10$gene[1:6]
p <- plot_counts(mini_mac, genes = genes, group_by = "combined_id", 
treatment_samples = "Staurosporine_10", 
control_samples = "DMSO_0",
normalisation = "clr")
#> Normalizing layer: counts
#> Normalizing across cells