Skip to main content

PyPI Docs CI

bixverse

A single cell suite for Python, with the numerics in Rust (bixverse-rs).

It works on the store, not in memory, so it scales past what fits in RAM. On top sit a minibatch loader and a barebone scVI that train straight off that store, and a separate wheel with GPU twins of the expensive methods.

Docs, API reference and 22 vignettes: https://gregorlueg.github.io/bixverse-rs/

Install

uv pip install bixverse                         # the suite
uv pip install "bixverse[embed,plots]"          # plus UMAP & co and matplotlib plots
uv pip install "bixverse[gpu]"                  # plus the GPU twins
uv pip install "bixverse[torch]"                # scVI on torch; also [mlx], [jax]
uv pip install "bixverse[sparse]"               # scipy, for the scipy_csr exports

Use

from pathlib import Path

import bixverse as bv
import bixverse.embed

sc = bv.io.load_mtx(
    Path("experiments/pbmc3k"),
    bv.io.get_cell_ranger_params(bv.io.download_pbmc3k()),
)

bv.pp.find_hvg(sc, hvg_no=2000)
bv.pp.calculate_pca(sc, no_pcs=30)
bv.graph.find_neighbours(sc)
bv.graph.find_clusters(sc, res=1.0, name="leiden_clusters")
bv.embed.umap(sc)

bv.pl.embedding_plot(sc, "umap", "leiden_clusters", discrete=True)
markers = bv.de.find_all_markers(sc, "leiden_clusters")

bv.io.save(sc)
sc = bv.io.load_existing("experiments/pbmc3k")

An experiment is a directory and SingleCells a handle on it. Counts sit in two compressed binary files, cell-major and gene-major, memory-mapped on read, so each method pulls what it needs from the right one. obs and var live in a DuckDB next to them and come back as polars frames. QC doesn't delete anything: sc.set_cells_to_keep() decides which cells every later step sees. Functions take the experiment first and write into it, and the cache tracks what has gone stale.

Everything reports progress by default. verbose takes 0 (False) for silent, 1 (True) for progress and 2 for extra detail where the method has it. logging.getLogger("bixverse").setLevel(logging.WARNING) silences the Python log lines but not what Rust prints.

What's in it

Module Contents
bv.io h5ad, 10x h5, MTX and in-memory loaders, saving, h5ad and Cell Ranger writers, archives, example data
bv.qc gene set proportions, MAD outlier calls, fixed thresholds
bv.pp HVGs, PCA, Pearson residuals and scTransform, MAGIC
bv.graph kNN (the ann-search-rs indices), neighbour graphs, Leiden and Louvain, fast clustering
bv.embed UMAP, t-SNE, PHATE, densMAP, den-SNE, ForceAtlas2 (embed extra)
bv.integrate fastMNN, Harmony v1 and v2, Seurat CCA and RPCA, BBKNN, kBET and friends
bv.doublets Scrublet, boosted doublet detection, scDblFinder, empty droplets, CellSweep
bv.de markers, pseudobulk with edgeR QL, NEBULA, Milo, MELD
bv.annotate scType, Symphony reference mapping
bv.metacells SEACells, SuperCells, hdWGCNA-style and MetaCells2 meta cells
bv.traj, bv.trees Palantir, PAGA, gene trends; Bonsai cell trees
bv.pathways, bv.nmf module scores, AUCell, VISION, Hotspot, SCENIC, decoupler-style activities; consensus NMF
bv.mm ADT counts, DSB and CLR, WNN
bv.lr, bv.dialogue CellPhoneDB, NicheNet-style ligand-receptor; DIALOGUE
bv.pl matplotlib plots (plots extra) and the extract_* frames behind them
bv.pipeline chained steps with >>, per-group pipelines
bv.params every parameter set as a frozen dataclass

SingleCellsSubset handles sub-clustering, MetaCells and SingleCellsMultiModal go through the same functions.

GPU

bixverse-gpu is its own wheel, on wgpu. Each module mirrors its CPU namesake, takes the same objects and writes the same cache slots (bar Harmony and fastMNN, which write harmony_gpu and mnn_gpu), so a pipeline swaps one import for the other:

import bixverse_gpu as bvg

bvg.pp.calculate_pca(sc, 30)
bvg.graph.find_neighbours(sc)

bvg.gpu_available() probes for an adapter. Without one the twins raise bixverse.BixverseError.

Loader and scVI

CellLoader streams shuffled minibatches off the cell-major store. A feeder thread decodes ahead of your training step with the GIL released, and nothing gets materialised in memory.

reader = bv.CellReader(str(sc.cells_path))
loader = bv.CellLoader(reader, batch_size=256, layer="norm", seed=42)

for batch in loader:
    x = batch.scipy_csr()  # (256, n_genes) CSR

Pass an index array for a train / validation split and genes= to subset or reorder the columns. cell_ids on a batch joins per-cell covariates back on after the shuffle. Batches are sparse by default and you want that: a dense batch pays a zero-fill and a scatter over batch_size * n_genes floats, however few counts it holds. A few things to watch:

  • Cell-major stores only. A gene-major file raises on construction.
  • Ctrl-C can't interrupt a batch mid-decode, because the GIL is released while the feeder works.
  • The reader hints random access: right for a shuffled loader, wrong for a sequential full scan.

bixverse.nn trains scVI off the same store on torch, MLX or JAX, with scvi-tools 1.5.1's defaults, and a trained scvi-tools module loads into it and reproduces its loss.

import bixverse.nn as bvnn

fit = bvnn.train_scvi(reader, cells, hvg, batch, backend="torch")
latent = bvnn.scvi_latent(fit, reader, cells, batch)

The docs have the validation against scvi-tools.

Vignettes

22 notebooks. Start with "Thinking the bixverse way" and "Analysing PBMCs". Each is a jupytext .py in docs/vignettes/ with its executed .ipynb next to it, and the data sets download themselves on first use.

uv sync --group dev --group vignettes
uv run python dev/vignettes.py execute                   # all of them
uv run python dev/vignettes.py execute pbmc_single_cell  # or by name

Development

uv sync --group dev
uv run maturin develop --release
uv run pytest tests -q

The tests/*_r.py parity tests run dev/sc_*_fixtures.R and skip without Rscript and bixverse 0.9.0 or later. The GPU wheel builds from gpu/.

Metadata

Release files for bixverse 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for bixverse 0.3.1
File Interpreter ABI Platform Actions
bixverse-0.3.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for bixverse-0.3.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
bixverse-0.3.1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for bixverse-0.3.1-cp311-abi3-macosx_11_0_arm64.whl
bixverse-0.3.1-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for bixverse-0.3.1-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 30.3 MB

Release files / bixverse-0.3.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL bixverse-0.3.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 10.9 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
7a97ad3829fe001adda9c3a6b0691cb2e09ee420881b6327a253bcfb52f63623
BLAKE2b-256 checksum
How to use checksums
a5de4a37801f50c9c83e4250ad50894faf1a3e11180e69cffefa306ca2b9b622
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / bixverse-0.3.1-cp311-abi3-macosx_11_0_arm64.whl

Download URL bixverse-0.3.1-cp311-abi3-macosx_11_0_arm64.whl
Size 9.2 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2b52ae85ddd1a9406c619f8ea26a5f2cb7f3a2579f28c63a263324ac68b6c8cf
BLAKE2b-256 checksum
How to use checksums
26c3910c01ca72ec953a013c7525ac8163789f5ba8a6f4a9ad3aef632b12cf1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / bixverse-0.3.1-cp311-abi3-macosx_10_12_x86_64.whl

Download URL bixverse-0.3.1-cp311-abi3-macosx_10_12_x86_64.whl
Size 10.3 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
353cae7c7ef2304e8c7dfe5d1bf3a1010df503a35af5ed5f640b2e53b65cfc5b
BLAKE2b-256 checksum
How to use checksums
648c030e1449e7ea133508744e708591dda203c23bee132f8da0a852ce1f7371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for bixverse 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for bixverse-0.3.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page