Skip to contents

Prepare the paired PBMC input

The Pando example uses the paired PBMC data packaged with scop. It keeps standard human chromosomes, normalizes RNA, and applies TF-IDF to ATAC. The LINGER and SCENIC+ examples below show how to pass paired counts and method-specific resources.

data(pbmcmultiome_sub, package = "scop")
paired <- pbmcmultiome_sub
peaks <- GenomicRanges::granges(paired[["peaks"]])
keep <- as.character(GenomeInfoDb::seqnames(peaks)) %in%
  GenomeInfoDb::standardChromosomes(peaks, species = "Homo sapiens")
paired[["peaks"]] <- subset(paired[["peaks"]], features = rownames(paired[["peaks"]])[keep])
paired <- Seurat::NormalizeData(paired, assay = "RNA", verbose = FALSE)
paired <- Signac::RunTFIDF(paired, assay = "peaks", verbose = FALSE)
table(paired$CellType)

Fit Pando interaction models

Pando 1.1.1 uses the archived grr package, which does not build on R 4.6 or later. On an earlier R release, install grr from the CRAN archive before preparing the Pando environment:

install.packages(
    "https://cran.r-project.org/src/contrib/Archive/grr/grr_0.9.5.tar.gz",
    repos = NULL, type = "source"
)
scop::PrepareEnv(modules = "pando", components = "r")

The same normalized PBMC object supplies the input. Pando selects variable target genes and uses its module thresholds.

pando_grn <- scop::RunGRN(
    paired, methods = "Pando", input_mode = "multiome",
    assay = "RNA", layer = "data", atac_assay = "peaks", atac_layer = "data",
    group.by = "CellType", groups = "B",
    resources = list(genome = "BSgenome.Hsapiens.UCSC.hg38"),
    return_type = "result", work_dir = file.path(tempdir(), "scop-pbmc-pando"),
    cores = 1L, seed = 1201L, verbose = FALSE
)
pando_native <- scop::GetGRN(pando_grn, group = "B", what = "native")
head(pando_native$coefficients)
head(scop::GetGRN(pando_grn, group = "B", layer = "tf_region"))
scop::GRNPlot(pando_grn, group = "B", type = "layered", top_n = 20L)

Pando’s native interaction coefficients retain estimate, pval, and padj. Its TF-region and region-gene projections describe membership in retained interactions. Those projected edges have score_type = "membership" and unknown sign. The native module and interaction tables remain available.

Prepare LINGER counts and reference resources

LINGER uses paired RNA and ATAC counts, sample labels, cell-type labels, and a matching bulk reference. Keep the bulk reference at a persistent path. The native workflow builds pseudobulks before training and needs at least 50 pseudobulks for its SHAP sampling step. Choose a sufficiently sized input and label design before starting training.

scop::PrepareEnv(modules = "linger", configure_runtime = FALSE)
linger_resources <- scop::PrepareDB(db = "LINGER", data_dir = "/path/to/LINGER/data_bulk")$LINGER
reference_tfs <- scan(file.path(linger_resources$bulk_reference, "TFName.txt"), what = "character", quiet = TRUE)
regulators_linger <- intersect(reference_tfs, rownames(paired[["RNA"]]))
linger_grn <- scop::RunGRN(
    paired, methods = "LINGER", input_mode = "multiome",
    assay = "RNA", layer = "counts", atac_assay = "peaks", atac_layer = "counts",
    regulators = regulators_linger,
    resources = linger_resources,
    method_args = list(label.by = "CellType", genome = "hg38"),
    return_type = "result", work_dir = "/path/to/new-linger-run",
    cores = 1L, seed = 1201L
)
scop::GetGRN(linger_grn, layer = "tf_region")
scop::GetGRN(linger_grn, what = "native")$training_coverage

The candidate regulators come from the reference TF list. sample.by and label.by refer to existing Seurat metadata columns. Omitting sample.by uses one sample. Native cell filters retain their selected cell IDs in the result, with requested IDs and exclusions recorded separately.

To resume an interrupted run, use a persistent work_dir for the first call. Find the linger-output directory containing prepare.completed.json and pass its path as method_args$resume_dir with the same inputs and settings. Keep the original run directory, including linger-input. LINGER copies the prepared inputs to a new run. It starts again at preprocessing and leaves the earlier directory in place.

The three LINGER layers retain native scores and unknown sign. The result records its LingerGRN version, training settings, and the requested seed.

Execute the official SCENIC+ workflow

The official SCENIC+ runner starts from a prepared cisTopic model, matching GEX AnnData, and at least two region sets. Prepare these inputs and the motif rankings, motif scores, motif annotations, gene annotation, and chromosome sizes for the selected genome. Both objects must contain the selected cell IDs. The selected Seurat RNA layer supplies expression; the GEX file supplies metadata.

The runner executes the official Snakemake workflow, including motif enrichment, network inference, eRegulons, and AUC. If the installed SCENIC+ package lacks the workflow files, set resources$workflow to the official Snakemake directory containing Snakefile and config.yaml. Use paths without spaces or shell metacharacters.

To continue an interrupted official run, start with a persistent work_dir. Select one group and set method_args$resume_dir to its official directory. Keep the original run directory, inputs, reference files, and settings. Snakemake reuses finished steps and reruns incomplete ones. If an abrupt stop leaves a Snakemake lock, use its standard unlock command after the original process has stopped. Keep the directory for this scop run only. Run standalone Snakemake workflows in a separate directory.

PrepareDB() uses the hg38 SCREEN v10 databases by default. It reuses local rankings, scores, and motif annotations or downloads missing files. Place genome_annotation.tsv and chromsizes.tsv in the reference directory. To supply custom paths, use data_dir = list(SCENICPlus = list(path = ..., genome_annotation = ..., chromsizes = ...)). Provide ranking_db, scores_db, and motif_annotation together to override the default reference set.

scop::PrepareEnv(modules = "scenicplus", configure_runtime = FALSE)
scenicplus_references <- scop::PrepareDB(
    db = "SCENICPlus", data_dir = "/path/to/scenicplus-references"
)$SCENICPlus
scenicplus_resources <- c(scenicplus_references, list(
    cistopic = "/path/to/selected_cistopic_model.pkl",
    gex = "/path/to/matching_gex.h5ad",
    region_sets = "/path/to/region_sets",
    workflow = "/path/to/scenicplus/src/scenicplus/snakemake"
))
scenicplus_grn <- scop::RunGRN(
    paired, methods = "SCENIC+", input_mode = "multiome",
    assay = "RNA", layer = "data", atac_assay = "peaks", atac_layer = "data",
    resources = scenicplus_resources, return_type = "result",
    work_dir = "/path/to/new-scenicplus-run", cores = 1L, seed = 1201L
)
scop::GetGRN(scenicplus_grn, what = "native")$direct
scop::GetGRN(scenicplus_grn, what = "native")$extended
scop::GetGRN(scenicplus_grn, what = "native")$auc

RunGRN(..., methods = "scenicplus") is the official execution route. The existing RunSCENICPlus(..., backend = "python") reads official outputs. Its result records execution_status = "imported". The existing C++ SCENICPlus-compatible workflow has its own implementation identity. Select the intended route explicitly when reproducing an analysis.

For each multiome method, use GetGRN to inspect native evidence before comparing networks. GRNPlot(type = "overlap", compare = ...) compares typed edge identities. The result retains each method’s original score definition.