Skip to contents

Wraps fast_mnn_sc() as an ScStep.

Usage

step_fast_mnn_sc(
  batch_column,
  batch_hvg_genes,
  fastmnn_params = params_sc_fastmnn(),
  use_precomputed_pca = FALSE,
  seed = 42L,
  .verbose = TRUE
)

Arguments

batch_column

String. The column with the batch information in the obs data of the class.

batch_hvg_genes

Integer vector. These are the highly variable genes, identified by a batch-aware method. Please refer to find_hvg_batch_aware_sc() for more details. These genes have to be 0-indexed!

fastmnn_params

A list, please see params_sc_fastmnn(). The list has the following parameters:

  • sigma - Numeric. Bandwidth of the Gaussian smoothing kernel (as proportion of space radius).

  • cos_norm - Logical. Apply cosine normalisation before computing distances.

  • var_adj - Logical. Apply variance adjustment to avoid kissing effects.

  • no_pcs - Integer. Number of PCs to use for MNN calculations.

  • knn - List of kNN parameters. See params_knn_defaults() for available parameters and their defaults.

  • pca - List of PCA parameters, see params_sc_pca() for available parameters and their defaults.

use_precomputed_pca

Boolean. Should the PCA in the object be used if found. If you decide to do this, make sure that you have run the PCA on the batch-aware HVG ideally.

seed

Integer. Random seed.

.verbose

Boolean or integer. Controls verbosity and returns run times. FALSE -> quiet, TRUE or 1L -> normal verbosity, 2L -> detailed verbosity.

Value

An ScStep.

Examples

# fastMNN wants the batch aware genes handed to it up front
step_fast_mnn_sc(
  batch_column = "batch_index",
  batch_hvg_genes = 0:29L
) %>>%
  step_neighbours_sc(embd_to_use = "mnn")
#> <ScPipeline> 2 steps
#>   1. fast_mnn    batch_column = "batch_index", batch_hvg_genes = <integer>, fastmnn_params = <list>, use_precomputed_pca = FALSE, seed = 42L, .verbose = TRUE
#>   2. neighbours  embd_to_use = "mnn", no_embd_to_use = NULL, modality = c("rna", "adt"), neighbours_params = <list>, seed = 42L, .verbose = TRUE