Apply In-Silico Perturbation
ApplyPerturbation.RdThis function applies an in-silico perturbation (knock-out, knock-down, or knock-in) to selected features in a Seurat object.
Usage
ApplyPerturbation(
seurat_obj,
exp,
features,
perturb_dir,
cells_use = NULL,
group.by = NULL,
layer = "counts",
slot = "counts",
assay = "RNA"
)Arguments
- seurat_obj
A Seurat object containing the dataset.
- exp
A features-by-cells matrix (typically a sparse matrix) containing the observed expression data.
- features
Character vector. The selected features to apply the perturbation on.
- perturb_dir
Numeric. Determines the type of perturbation to apply. Negative values for knock-down, positive for knock-in, and 0 for knock-out.
- cells_use
Character vector. Specific cells to apply the perturbation to. If
NULL, defaults to handling internally.- group.by
Character. Column in
seurat_obj@meta.dataused to group cells for modeling.- layer
Character. The Seurat v5 layer to extract data from. Default is
'counts'.- slot
Character. The Seurat v4 slot to extract data from. Default is
'counts'.- assay
Character. The assay in
seurat_objcontaining expression information. Default is'RNA'.
Details
The function models the baseline expression of target features using a Zero-Inflated
Negative Binomial (ZINB) distribution to capture dropout and overdispersion characteristics
typical of single-cell RNA-seq data .
It samples from this distribution, scales the values by perturb_dir, and updates the
original expression matrix. Any perturbed counts that fall below zero are strictly bounded to zero.