scBIOT
scBIOT is a Python library for optimal-transport integration and analysis of single-cell RNA, ATAC, spatial, and paired or unpaired multi-omics data. Version 1.2.0 provides a compact parameter interface, scalable centroid integration, linear-autoencoder embeddings, label transfer, and transport-aware downstream analysis for AnnData objects.
Highlights
- Batteries-included preprocessing: scATAC-seq peak processing, iterative LSI, and gene activity annotation.
- Accurate atlas integration: high-fidelity alignment with rare cell-type protection.
- Unified scBIOT framework: one interface for RNA, ATAC, spatial, temporal, and multi-omics integration.
- Fast integration via Optimal Transport (OT): scalable alignment for large single-cell datasets.
- Linear autoencoders: PCA-like single-dataset embeddings and reference-to-query coembedding.
- Scales to 100M cells locally: memory-efficient processing with centroid-level OT.
- Label transfer: across multi-omics modalities and between spatial data and scRNA-seq references.
- Transport-aware analysis: gene transport scores, trajectory diagnostics, and plotting utilities.
- Spatiotemporal dynamics: spatial/time-aware integration and lineage-specific velocity fields.
Installation
pip install scbiot
The default installation contains the AE and optimal-transport pipeline without benchmarking frameworks, Jupyter, or FAISS. Add only the features you need:
# Jupyter kernel for the tutorial notebooks
pip install "scbiot[notebooks]"
# FAISS acceleration: choose one backend
pip install "scbiot[cpu]"
pip install "scbiot[gpu]" # Linux with CUDA 12
# scIB benchmarking utilities
pip install "scbiot[analysis]"
# Analysis, GPU FAISS, and notebooks together
pip install "scbiot[full]"
# Documentation toolchain
pip install "scbiot[docs]"
Do not install the cpu and gpu FAISS extras together. Without either extra,
scBIOT uses its scikit-learn fallback where available; centroid interpolation
requires a FAISS backend. On Linux, the GPU extra uses PyTorch 2.10 with CUDA
12.8 and FAISS GPU 1.14; use an NVIDIA 570-series or newer driver. See the
installation guide
for details.
Data availability
Prepared tutorial inputs are archived in the scBIOT Figshare collection. Inputs not present there are linked to their original providers in the data-source documentation.
Quick start
- Detailed documentation is published on Read the Docs.
- The
tutorials/directory contains runnable end-to-end notebooks.
The example below deterministically holds out batch B4 as an unlabeled query
and retains the original cell_type column for evaluation:
import scanpy as sc
import scbiot as scb
adata = sc.read(
"lung_atlas.h5ad",
backup_url="https://figshare.com/ndownloader/files/24539942",
)
LABEL_KEY = "semi_cell_type"
UNLABELED = "Unknown"
QUERY_BATCH = "B4"
RANDOM_STATE = 0
# The downloaded AnnData contains batch, cell_type, and a counts layer.
required_obs = {"batch", "cell_type"}
missing_obs = required_obs.difference(adata.obs.columns)
if missing_obs:
raise KeyError(f"Missing required obs columns: {sorted(missing_obs)}")
if "counts" not in adata.layers:
raise KeyError("Missing required adata.layers['counts']")
# Build the semi-supervised label column used by both AE and supBIOT.
batch = adata.obs["batch"].astype("string")
query_mask = batch.eq(QUERY_BATCH).fillna(False)
if not query_mask.any() or query_mask.all():
raise ValueError(f"QUERY_BATCH={QUERY_BATCH!r} does not define a valid query")
adata.obs[LABEL_KEY] = adata.obs["cell_type"].astype("string")
adata.obs.loc[query_mask, LABEL_KEY] = UNLABELED
# 1. Learn the v1.2 linear-autoencoder representation.
adata = scb.pp.autoencoder(
adata,
input_key="counts",
out_key="X_ae",
batch_key="batch",
random_state=RANDOM_STATE,
)
# 2. Align batches in the autoencoder representation with optimal transport.
adata, metrics = scb.ot.integrate(
adata,
obsm_key="X_ae",
batch_key="batch",
out_key="X_supbiot",
label_key=LABEL_KEY,
unlabeled_category=UNLABELED,
random_state=RANDOM_STATE,
)
print(metrics)
# 3. Transfer reference labels to the unlabeled query cells.
adata = scb.ot.supbiot(
adata,
use_rep="X_supbiot",
input_rep_key="X_ae",
label_key=LABEL_KEY,
unlabeled_category=UNLABELED,
pred_label_key="pred_cell_type",
pred_conf_key="pred_confidence",
min_conf=0.0,
random_state=RANDOM_STATE,
)
sc.pp.neighbors(adata, use_rep="X_supbiot")
sc.tl.umap(adata, random_state=RANDOM_STATE)
# Combine known reference labels and transferred query labels for visualization.
adata.obs["supbiot_cell_type"] = adata.obs[LABEL_KEY].astype("string")
adata.obs.loc[query_mask, "supbiot_cell_type"] = adata.obs.loc[
query_mask, "pred_cell_type"
].astype("string")
sc.pl.umap(adata, color=["batch", "supbiot_cell_type", "pred_confidence"])
Scaling options
Replace step 2 above with one of the following calls, then continue with step 3. For a faster approximate OT run on large datasets, enable the approximate solver:
adata, metrics = scb.ot.integrate(
adata,
obsm_key="X_ae",
batch_key="batch",
out_key="X_supbiot",
label_key=LABEL_KEY,
unlabeled_category=UNLABELED,
approximate=True,
random_state=RANDOM_STATE,
)
For ultra-large datasets, use centroid-level OT:
adata, metrics = scb.ot.integrate(
adata,
obsm_key="X_ae",
batch_key="batch",
out_key="X_supbiot",
label_key=LABEL_KEY,
unlabeled_category=UNLABELED,
centroid=True,
random_state=RANDOM_STATE,
)
For cross-modality reference mapping in v1.2.0, use
scb.pp.autoencoder_map(reference, query, out_key="X_ae"), then integrate
X_ae and transfer labels with scb.ot.supbiot.
See the dedicated documentation for multi-omics and spatiotemporal dynamics.
Metadata
Release files for scbiot 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scbiot-1.2.1.tar.gz | 6.0 MB | Without provenance | Details for scbiot-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scbiot-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for scbiot-1.2.1-py3-none-any.whl |
Total release size: 6.2 MB
Release files / scbiot-1.2.1.tar.gz
| Download URL | scbiot-1.2.1.tar.gz |
|---|---|
| Size | 6.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fec0f3062c6fd61f9c723d46981225f6a865671d9809ad1e421f0fe0b0b4b6e
|
|
BLAKE2b-256 checksum How to use checksums |
d7175d191361461b4f34718dcffc59f9d014edf26a2a117bbe0fde451a54a94d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Release files / scbiot-1.2.1-py3-none-any.whl
| Download URL | scbiot-1.2.1-py3-none-any.whl |
|---|---|
| Size | 154.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0d40eb59c791ff99e67562795279d5d9c844398bd268b72fa096f1a6e25dfb9
|
|
BLAKE2b-256 checksum How to use checksums |
534844da3d1c1d1dcea218b8fe8c521d5c8cf3bc61a7e83cf8bac8d5f5e7d842
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Security for scbiot 1.2.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.