Skip to contents

Visualize in-silico knockout results generated by RunscTenifoldKnk. Accepts scTenifoldKnk 2.0 single and joint knockout results, including predicted direction columns, and previously stored differential-regulation tables. Manifold plots require the upstream manifold method; heat alignment does not produce manifold coordinates. Transcriptome-wide screens return perturbation matrices instead of a differential-regulation table.

Usage

scTenifoldKnkPlot(
  object,
  tool_name = "scTenifoldKnk",
  plot_type = c("qq", "effect", "network", "manifold"),
  top_n = 20,
  FDR_threshold = 0.05,
  FC_threshold = 1,
  features = NULL,
  label = TRUE,
  nlabel = 10,
  pt.size = 2,
  pt.alpha = 0.85,
  label.size = 3.5,
  edge_top_n = 100,
  edge_threshold = NULL,
  arrow.length = 0.14,
  arrow.linewidth = 0.8,
  arrow.alpha = 0.8,
  start.pt.size = 2.2,
  end.pt.size = 3,
  manifold.aspect.ratio = 1,
  cols.sig = "#D7301F",
  cols.ns = "grey70",
  cols.ko = "#542788",
  xlab = NULL,
  ylab = NULL,
  title = NULL,
  theme_use = "theme_scop",
  theme_args = list(),
  verbose = TRUE,
  srt = NULL
)

Arguments

object

A Seurat object containing a scTenifoldKnk result in object@tools.

tool_name

Name of the srt@tools entry created by RunscTenifoldKnk.

plot_type

Plot type. "qq" shows the common scTenifoldKnk FC versus theoretical chi-square quantile plot. "effect" ranks top perturbed genes by FC. "network" draws a knockout-centered WT network subgraph from saved tensor networks using thisplot::GraphPlot. "manifold" draws paired WT-to-KO displacement arrows for selected genes in the non-linear manifold alignment space, showing how each gene's network context shifts after virtual knockout.

top_n

Number of top genes to show or label.

FDR_threshold

Adjusted p-value cutoff used to mark significant genes.

FC_threshold

FC cutoff used to mark significant genes.

features

Character vector of genes to show or label. For plot_type = "network" and "manifold", these genes are included in the displayed subset when present.

label

Whether to label genes.

nlabel

Number of labels to add when features = NULL.

pt.size

Point size.

pt.alpha

Point transparency.

label.size

Label text size.

edge_top_n

Maximum number of network edges to draw.

edge_threshold

Minimum absolute edge weight for plot_type = "network". If NULL, the largest edge_top_n edges are used.

arrow.length

Arrow head length for plot_type = "manifold".

arrow.linewidth

Arrow line width for plot_type = "manifold".

arrow.alpha

Arrow transparency for plot_type = "manifold".

start.pt.size

WT-position point size for plot_type = "manifold".

end.pt.size

KO-position point size for plot_type = "manifold".

manifold.aspect.ratio

Panel aspect ratio for plot_type = "manifold". Default 1 keeps the panel square. Set NULL to use the device aspect ratio.

cols.sig

Color for significant genes.

cols.ns

Color for non-significant genes.

cols.ko

Color for knocked-out genes.

xlab, ylab

Axis labels.

title

Plot title. If NULL, a default title is used.

theme_use

Theme function used to style the plot.

theme_args

Other arguments passed to theme_use.

verbose

Whether to print the message. Default is TRUE.

srt

Deprecated alias for object; supply exactly one of the two. It will be removed in scop 1.0.0.

Value

A ggplot object.

Examples

data(pancreas_sub)
gene_use <- "Pdx1"
counts <- GetAssayData5(pancreas_sub, assay = "RNA", layer = "counts")
detected <- names(sort(Matrix::rowSums(counts > 0), decreasing = TRUE))
features_use <- unique(c(gene_use, head(detected, 300)))

pancreas_sub <- RunscTenifoldKnk(
  pancreas_sub,
  gKO = gene_use,
  features = features_use,
  qc = FALSE,
  nc_nNet = 3,
  nc_nCells = 200,
  td_maxIter = 200,
  store_networks = TRUE,
  store_manifold = TRUE
)
#> ℹ [2026-11-12 06:13:32] Run the upstream scTenifoldKnk workflow
#> 
#> ── scTenifoldKnk Pipeline ──────────────────────────────────────────────────────
#> ℹ Step 2/7: CPM normalization
#> ℹ CPM normalization: 301 genes x 1000 cells
#> ✔ CPM normalization complete
#> ℹ Step 3/7: Building gene regulatory networks
#> ℹ Building 3 gene regulatory networks (200 cells each)
#> ✔ Network construction complete: 3 networks
#> ℹ Step 4/7: Tensor decomposition
#> ℹ [X] Tensor: 301 x 301 x 3 (K=3)
#> ✔ [X] CP decomposition complete (norm explained: 34.6%)
#> ℹ Step 5/7: Simulating Pdx1 knockout
#> ℹ Step 6/7: Manifold alignment
#> ℹ Manifold alignment: 301 shared genes, d=2
#> ✔ Manifold alignment complete: 2 dimensions
#> ℹ Step 7/7: Differential regulation analysis
#> ℹ Computing distances for 301 genes
#> ✔ Differential regulation complete: 7/301 significant genes (FDR < 0.05)
#> ✔ scTenifoldKnk pipeline complete
#> ✔ [2026-11-12 06:13:32] scTenifoldKnk results stored in `object@tools[[scTenifoldKnk]]`

scTenifoldKnkPlot(pancreas_sub, plot_type = "qq")


scTenifoldKnkPlot(pancreas_sub, plot_type = "effect")


scTenifoldKnkPlot(pancreas_sub, plot_type = "network")


scTenifoldKnkPlot(pancreas_sub, plot_type = "manifold")