Quickstart

Use the Python / R toggle on any code block below to switch languages — Python for Scanpy and other Python packages, R for Seurat and Bioconductor packages. Your choice applies to the whole page and is remembered next time.

1. Install

pip install autozyme
# CRAN release pending; install from the public GitHub repo for now
remotes::install_github("ElliotXie/autozyme", subdir = "autozyme_r")

autozyme itself has no hard dependencies on any upstream package. Patches activate only when their upstream is importable in your environment.

2. Activate

Activate one patch family. You’ll see a one-line banner confirming what was bound:

import autozyme
autozyme.activate("scanpy")          # or "cell2location", "scvelo", "sccoda", ...
[autozyme] activated scanpy -> 13 target(s) in scanpy 1.11.5
library(autozyme)
activate("seurat")                   # or "cellchat", "infercnv", ...
[autozyme] activated seurat -> 17 target(s) in Seurat 5.4.0

3. Use your tool exactly as before

import scanpy as sc
sc.pp.normalize_total(adata, target_sum=1e4)   # uses the fast version
sc.tl.pca(adata, n_comps=50)                   # uses the fast version
library(Seurat)
obj <- NormalizeData(obj)                      # uses the fast version
obj <- RunPCA(obj, npcs = 50)                  # uses the fast version

The patched functions have identical signatures to upstream — no rewrite required. They run faster, produce output within the declared concordance gate, and write a one-line provenance marker to stderr so your Methods section is auditable.

See the full patch catalog for per-function speedups, accuracy thresholds, and tested upstream versions.

What just happened

  1. import autozyme (Python) or library(autozyme) (R) found available patches without activating anything.
  2. activate("scanpy") or activate("seurat") loaded one patch family and rebound the upstream functions to AutoZyme’s fast versions.
  3. Your normal scanpy or Seurat calls now hit those fast versions.

Verify it worked

autozyme.status()
# {'scanpy': 'active', 'cell2location': 'inactive', ...}

autozyme.inspect("scanpy")
# {'name': 'scanpy', 'status': 'active', 'targets': [
#    {'upstream': 'scanpy.preprocessing',
#     'attr': 'normalize_total',
#     'currently_bound_to_fast': True},
#    ... ]}
status()
# seurat   cellchat   infercnv
# active   inactive   inactive

inspect("seurat")
# $name
# [1] "seurat"
# $status
# [1] "active"

Opt out anytime

# per-call (namespace-fn patches only)
sc.pp.normalize_total(adata, zyme=False)

# per-block (works for everything, including class-method patches)
with autozyme.disabled():
    sc.tl.pca(adata)   # uses upstream's original

# per-package
autozyme.deactivate("scanpy")

# session-wide via env var (set BEFORE import)
import os; os.environ["AUTOZYME_DISABLED"] = "1"
import autozyme   # no patch activates
# per-call (namespace-function patches only)
nichenetr::predict_ligand_activities(..., zyme = FALSE)

# per-block
autozyme::with_disabled({
  Seurat::RunPCA(obj)   # uses upstream's original
})

# per-package
deactivate("seurat")

# session-wide via env var (set BEFORE library(autozyme))
Sys.setenv(AUTOZYME_DISABLED = "1")
library(autozyme)       # no patch activates

Next steps