Skip to contents

This function enables in-silico gene expression perturbation analysis for user-selected genes using a co-expression network. It applies primary perturbations to the selected genes, propagates the signal throughout their co-expression neighborhood, and computes cell-cell transition probabilities.

Usage

CustomPerturbation(
  seurat_obj,
  selected_features,
  perturb_dir,
  perturbation_name,
  graph,
  group.by = NULL,
  group_name = NULL,
  n_connections = NULL,
  random_connections = FALSE,
  exclude_grey_genes = FALSE,
  delta_scale = 0.2,
  corr_sigma = 0.05,
  n_threads = 4,
  use_velocyto = TRUE,
  use_graph_tp = FALSE,
  use_counts_tp = FALSE,
  layer = "counts",
  slot = "counts",
  assay = "RNA",
  wgcna_name = NULL
)

Arguments

seurat_obj

A Seurat object containing the gene expression and co-expression data.

selected_features

A character vector of gene names to perturb (e.g. candidate driver genes).

perturb_dir

A numeric value determining the type of perturbation to apply:

  • negative for knock-down,

  • positive for knock-in,

  • 0 for knock-out.

perturbation_name

A string representing the name of the in-silico perturbation. This will be stored as a new assay in the Seurat object.

graph

Name of the cell-cell graph in Graphs(seurat_obj), used for transition probability calculations.

group.by

Optional. A string specifying the column in seurat_obj@meta.data used for cell grouping.

group_name

Optional. A string or vector specifying the group(s) within group.by to use for perturbation. If NULL, perturbation is applied to all cells.

n_connections

Number of co-expressed genes to include alongside the selected features. If NULL, defaults to the median module size.

random_connections

Logical. If TRUE, selects random non-selected genes instead of the most strongly co-expressed genes.

exclude_grey_genes

Logical. If TRUE, excludes grey (unassigned) genes from the co-expression network.

delta_scale

A numeric scaling factor controlling the influence of the propagated perturbation. Default is 0.2.

corr_sigma

A numeric scaling factor for adjusting the correlation matrix during transition probability calculations. Default is 0.05.

n_threads

Number of threads to use for parallel computation during correlation calculations. Default is 4.

use_velocyto

Logical. If TRUE, leverages velocyto.R functions for transition probabilities. Default is TRUE.

use_graph_tp

Logical. If TRUE, transition probabilities are computed using the cell-cell graph specified in graph. Default is FALSE.

use_counts_tp

Logical. If TRUE, transition probabilities are computed using the raw counts layer. Default is FALSE.

layer

Layer in the assay used for the perturbation. Default is 'counts'.

slot

Slot to extract data for aggregation (e.g., "counts", "data", or "scale.data"). Default is 'counts'.

assay

Name of the assay in seurat_obj containing the expression data. Default is 'RNA'.

wgcna_name

Optional. Name of the hdWGCNA experiment in seurat_obj@misc. If NULL, defaults to the active WGCNA experiment.

Value

A Seurat object containing the in-silico perturbation results as a new assay.

Details

Following co-expression network analysis with hdWGCNA, GenePerturbation allows us to perform in-silico perturbation of any set of user-specified genes. This analysis consists of several key steps:

  1. Apply a primary perturbation to the selected genes (e.g. knock-in, knock-down, or knock-out).

  2. Apply a secondary perturbation to their co-expressed neighbors using a signal propagation algorithm. Given the gene-gene co-expression network from hdWGCNA, the perturbation signal is propagated iteratively using the network adjacency matrix.

  3. Compute cell-cell transition probabilities to quantify how the perturbation shifts cellular states in the latent space or graph.

The result is stored as a new assay in the Seurat object with normalized simulated expression data and computed transition probabilities.