Skip to content

Meta cells (GPU)

The CPU twin is bixverse.metacells.

metacells

GPU SEACells.

Returns the bixverse.metacells.MetaCells the CPU generate_seacells returns. Both Frank-Wolfe solves run on the GPU; kernel construction, archetype initialisation, the kNN and the aggregation are the CPU steps.

generate_seacells

generate_seacells(
    sc: ScOrScSubset,
    seacell_params: SeacellsParams,
    *,
    embd_to_use: str = "pca",
    no_embd_to_use: int | None = None,
    cells_to_use: Sequence[str] | None = None,
    regenerate_knn: bool = False,
    target_size: float = 100000.0,
    seed: int = 42,
    verbose: Verbose = True,
    backend: Backend = "wgpu",
) -> MetaCells

SEACells with the fit on the GPU.

Inputs, kNN reuse and the result are those of bixverse.metacells.generate_seacells.

Parameters:

Name Type Description Default
sc ScOrScSubset

The experiment or a subset of it.

required
seacell_params SeacellsParams

The SEACells and kNN parameters; n_sea_cells has no default.

required
embd_to_use str

The embedding, "pca" or a name in sc.cache.embeddings.

'pca'
no_embd_to_use int | None

Leading embedding dimensions to use. None for all.

None
cells_to_use Sequence[str] | None

Cell ids to restrict the meta cells to.

None
regenerate_knn bool

Build the kNN on the embedding.

False
target_size float

Library size to normalise the meta cells to.

100000.0
seed int

Seed.

42
verbose Verbose

0 (False) silent, 1 (True) progress, 2 extra detail where the method has it.

True
backend Backend

"wgpu" (any GPU), or "mlx" (Apple Silicon, needs a source build with the mlx feature; see mlx_available()).

'wgpu'

Raises:

Type Description
ValueError

If the embedding is missing, or it or the kNN is stale.

BixverseError

Without a GPU adapter, or with backend="mlx" on a build without the MLX twins.

References

Persad, et al., Nat Biotechnol, 2023.