Skip to content

Cell trees (GPU)

The CPU twin is bixverse.trees.

trees

GPU Bonsai.

Returns the bixverse.trees.BonsaiTree the CPU bonsai returns. Only Sanity moves to the GPU, gene chunk by gene chunk; the tree search and the layout stay on the CPU.

bonsai

bonsai(
    sc: SingleCells | MetaCells,
    *,
    hvg: ndarray | Sequence[int] | None = None,
    bonsai_params: BonsaiParams | None = None,
    verbose: Verbose = True,
) -> BonsaiTree

A Bonsai tree over the cells or meta cells with Sanity on the GPU.

Parameters:

Name Type Description Default
sc SingleCells | MetaCells

The experiment or meta cells.

required
hvg ndarray | Sequence[int] | None

0-based candidate genes. None takes every gene.

None
bonsai_params BonsaiParams | None

The parameters. None uses the defaults.

None
verbose Verbose

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

True

Returns:

Type Description
BonsaiTree

The BonsaiTree, leaves in the kept cell or meta cell order.

Raises:

Type Description
ValueError

On a gene index out of range, or if no gene survives the signal-to-noise filter.

BixverseError

Without a GPU adapter that runs plane operations.

References

de Groot, et al., Nat. Biotechnol., 2026; Breda, et al., Nat. Biotechnol., 2021.