
Run SCENIC GRN inference
scenic_grn_sc.RdRuns SCENIC GRN inference on the provided genes using the specified
transcription factors as predictors. Returns a ScenicGrn object
containing the TF-gene importance matrix for further processing.
Usage
scenic_grn_sc(
object,
tf_ids,
scenic_params = params_scenic(),
genes_to_take = NULL,
cells_to_take = NULL,
streaming = NULL,
random_seed = 42L,
.verbose = TRUE
)Arguments
- object
SingleCells,MetaCells(or potentially other) class.- tf_ids
Character vector. Transcription factor gene identifiers to use as predictors. Must be a subset of gene identifiers present in the object.
- scenic_params
List. SCENIC parameters, see
params_scenic().- genes_to_take
Optional character vector. Target gene identifiers. If
NULL, genes are selected automatically viascenic_gene_filter_sc()using themin_countsandmin_cellsthresholds inscenic_params.- cells_to_take
Optional string vector. Cell identifiers to restrict to. If
NULL, defaults to all filtered cells in the class.- streaming
Optional Boolean. Shall the data be streamed in. Useful for larger data sets where you wish to avoid loading in the whole data. If
NULL, will automatically detect. Ignored when applied toMetaCells.- random_seed
Integer. Used for reproducibility. Defaults to
42L.- .verbose
Boolean or integer. Controls verbosity and returns run times.
FALSE-> quiet,TRUEor1L-> normal verbosity,2L-> detailed verbosity.
Details
TF identifiers that are not found in the object's gene list are silently
dropped with a warning indicating how many were removed. TF indices are
intersected with the target gene indices so that TFs not passing the gene
filter are excluded from the predictor set but remain as potential targets
if present in genes_to_take. You have the option to generate the TF-gene
importance values with three distinct methods. For the random_forest and
the extratrees version, a batching strategy is applied in the default
settings. Correlated genes are identified and clustered together via
k-means clustering on the feature loadings of the PCA. These are then
divided into batches of gene_batch_size and the regression learners
are leveraging multi-target regression to fit all genes in the batch in one
go. This massively accelerates the algorithm and the importance values per
gene-TF pair are calculated then individually. Due to the batching by
similar gene, the signal dilution is limited. If you wish to run the
traditional approach, you can set gene_batch_size to 1L or use the
grnboost2 learner that can only fit one gene at a given time.
Examples
# TF to gene importances from a small random forest
sc <- demo_single_cells()
res <- scenic_grn_sc(
sc,
tf_ids = get_gene_names(sc)[1:5],
scenic_params = params_scenic(
min_counts = 100L,
learner_params = list(n_trees = 20L)
),
.verbose = FALSE
)
res
#> ScenicGrn (GRN results)
#> No genes: 50
#> No TFs: 5
#> Applied learner: randomforest
#> TF to gene generated: FALSE
#> CisTarget res generated: FALSE
unlink(sc@dir_data, recursive = TRUE, force = TRUE)