Skip to contents

This function generates kNN data using GPU-accelerated algorithms via the bixverse.gpu package, then turns it into a SingleCellConnectivity for downstream clustering. See generate_gpu_knn_sc() for the three searches on offer. This function lives in a separate package from the CPU-based find_neighbours_sc() so that users without GPU hardware do not need to install the GPU dependencies.

Usage

find_neighbours_gpu_sc(
  object,
  embd_to_use = "pca",
  no_embd_to_use = NULL,
  modality = c("rna", "adt", "atac"),
  knn_method = c("nndescent", "cagra", "exhaustive", "ivf"),
  nn_params = params_nn_gpu(),
  k = 15L,
  graph_params = bixverse::params_knn_graph_defaults(),
  seed = 42L,
  gpu_method = lifecycle::deprecated(),
  ivf_params = lifecycle::deprecated(),
  dist_metric = lifecycle::deprecated(),
  snn_params = lifecycle::deprecated(),
  backend = c("wgpu", "mlx"),
  .verbose = TRUE
)

Arguments

object

SingleCells (or SingleCellsMultiModal) class.

embd_to_use

String. The embedding to use.

no_embd_to_use

Optional integer. Number of embedding dimensions to use. If NULL all will be used.

modality

String. One of c("rna", "adt", "atac"). "adt" needs a SingleCellsMultiModal, "atac" a SingleCellsMultiModal or a SingleCellsAtac.

knn_method

String. One of c("nndescent", "cagra", "exhaustive", "ivf").

nn_params

List. Output of params_nn_gpu().

k

Integer. Number of neighbours.

graph_params

List. Output of bixverse::params_knn_graph_defaults(). Controls how the kNN is turned into the connectivities graph.

seed

Integer. For reproducibility.

gpu_method

[Deprecated] Use knn_method.

ivf_params

[Deprecated] Use nn_params.

dist_metric

[Deprecated] Use params_nn_gpu(dist_metric = ).

snn_params

[Deprecated] Use graph_params.

backend

String. One of c("wgpu", "mlx"). "mlx" runs the search on Apple Silicon via MLX and needs a build with the MLX backend, see mlx_available().

.verbose

Boolean. Controls verbosity.

Value

The object with added kNN matrix and connectivities graph in the selected modality slot.