Skip to contents

A targeted counterpart to ModulePerturbation. Direct perturbation and gene-network propagation are restricted to cells selected by target.by and target_name. All other cells remain expression-identical to baseline. Cell-transition probabilities use the original shared graph, with targeted cells as sources and all cells retained as possible destinations.

Usage

TargetModulePerturbation(
  seurat_obj,
  mod,
  perturb_dir,
  perturbation_name,
  target.by,
  target_name,
  graph = "RNA_snn",
  group.by = NULL,
  n_hubs = 5,
  perturb_mode = "zinb",
  n_iters = 3,
  expand_module = 0,
  delta_scale = 0.2,
  row_normalize = FALSE,
  prune_network = FALSE,
  prune_percentile = 0.95,
  corr_sigma = 0.05,
  use_velocyto = FALSE,
  layer = "counts",
  slot = "counts",
  assay = "RNA",
  n_workers = 1,
  custom_network = NULL,
  custom_modules = NULL,
  custom_weights = NULL,
  wgcna_name = NULL
)

Arguments

seurat_obj

Seurat object containing an hdWGCNA experiment.

mod

Co-expression module to perturb.

perturb_dir

Perturbation direction/magnitude passed to ApplyPerturbation.

perturbation_name

Name of the new perturbation assay.

target.by

Metadata column defining the cells eligible for perturbation.

target_name

One or more values in target.by to perturb.

graph

Existing shared cell-cell graph, for example "RNA_snn".

group.by

Optional metadata column used only for ZINB model fitting within the targeted cells. It does not select cells.

n_hubs

Number of module hub genes receiving the primary perturbation.

perturb_mode

"zinb" or "multiplicative".

n_iters

Number of gene-network propagation iterations.

expand_module

Number of high-kME grey genes added to a small module.

delta_scale

Per-iteration propagation scale.

row_normalize

Whether to row-normalize the gene network.

prune_network

Whether to prune weak gene-network edges.

prune_percentile

Edge-weight percentile used when pruning.

corr_sigma

Transition correlation softmax scale.

use_velocyto

Retained for call compatibility. Targeted transitions currently require FALSE so the shared graph can be source-masked before the sparse correlation calculation.

layer

Baseline expression layer used for primary perturbation.

slot

Seurat-v4 equivalent of layer.

assay

Baseline assay.

n_workers

Workers used by the ZINB primary perturbation.

custom_network

Optional gene-by-gene network.

custom_modules

Optional data.frame with gene_name and module columns.

custom_weights

Optional module-table column used to rank hub genes.

wgcna_name

hdWGCNA experiment name; defaults to active_wgcna.

Value

The input Seurat object with a targeted perturbation assay, a <perturbation_name>_tp transition graph, a logical source-cell metadata column, and targeting provenance in @misc$targeted_perturbations.