Skip to main content

Perturb-seq guide assignment — Python bindings to the kaichi-core Rust library

Project description

kaichi — Python

CRISPR guide assignment for Perturb-seq, as a Python library.

Install

pip install kaichi

Wheels are available for Linux x86_64, macOS arm64, and macOS x86_64 (Python ≥ 3.11).

Quick start

import kaichi

result = kaichi.assign("gRNA_counts.h5ad", model="poisson_gauss")
print(result)
# pyarrow Table: cell_barcode, guide_id, umi_count,
#                assignment_confidence, is_unassigned,
#                is_multi_infected, n_guides_detected

Convert to pandas or polars:

df = result.to_pandas()

API

kaichi.assign(path, model="poisson_gauss", n_jobs=None)

Parameter Type Default Description
path str | Path Path to an .h5ad guide-count file
model str "poisson_gauss" Assignment model (see table below)
n_jobs int | None None Worker threads; None = half of logical cores

Returns a pyarrow.Table with one row per cell.

Output columns

Column Type Notes
cell_barcode string
guide_id string null if unassigned
umi_count uint32 null if unassigned
assignment_confidence float32 posterior probability or proportion; null if unassigned
is_unassigned bool
is_multi_infected bool cell passes threshold for more than one guide
n_guides_detected uint8 guides above threshold, regardless of final assignment

is_unassigned and is_multi_infected are mutually exclusive.

Models

Model Type When to use
umi Threshold Fast baseline; assign any guide ≥ N UMIs
max Deterministic Assign the single highest-count guide; ties → unassigned
ratio Threshold Assign if top guide UMIs / total UMIs > fraction
poisson_gauss EM mixture Good default; Poisson background, log-normal signal
poisson EM mixture Depth-normalised Poisson mixture
neg_binomial EM mixture Like poisson but handles overdispersed counts; recommended for noisy libraries
binomial EM mixture Models guide fraction (count / total guide UMIs)
beta2 EM mixture 2-component Beta mixture on per-cell max guide proportion
beta3 EM mixture 3-component Beta mixture; separates low / intermediate / high
quantiles Rank-based Assign top Q% of cells per guide by proportion

Mixture models fit one model per guide in parallel and assign cells where the posterior probability of the signal component exceeds min_confidence (default 0.8 for count-based models, 0.5 for Beta models).

Input format

An .h5ad file with:

  • obs_names — cell barcodes
  • var_names — guide IDs
  • X — sparse count matrix (cells × guides)

This is the crispr_gene_expression feature-barcode matrix produced by Cell Ranger.

Version

import kaichi
print(kaichi.__version__)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kaichi-0.1.0.tar.gz (84.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

kaichi-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

kaichi-0.1.0-cp311-abi3-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

kaichi-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file kaichi-0.1.0.tar.gz.

File metadata

  • Download URL: kaichi-0.1.0.tar.gz
  • Upload date:
  • Size: 84.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kaichi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6322b11e8d8ae49dbf1c72df4886fe80af1fbfad71cb311d031ec92b9d206693
MD5 e924ee1ec86fc927dd740ee7ade604b4
BLAKE2b-256 d8c5a05efc04cd8067ab8d25629e777b9caf121f55cede37039a50c38287b245

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaichi-0.1.0.tar.gz:

Publisher: release.yml on atchox/kaichi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kaichi-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kaichi-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9c190c7191463baca2cff8c52dede5776fbdae207f0d975aebb4eb3293ffb68d
MD5 4a5fd4bdbadc5ca4c4c7e2dd17191f42
BLAKE2b-256 0f1c2527d24ae3d50bcd28342a113cc1d6a92f25e3fc4821ea9309f73bd78fe0

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaichi-0.1.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on atchox/kaichi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kaichi-0.1.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kaichi-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 11b3566298ad678eb7095e384726690a20bc6bdc8cb58e031bf02e0981d5c90f
MD5 fa2e6e69d7d0afb744d1fa32dd486146
BLAKE2b-256 b4f6e546db115042ad44e8fdeeab296a526c7cee4237ccbe8852c9d6792469e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaichi-0.1.0-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on atchox/kaichi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kaichi-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kaichi-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f8d4abf229ab9fd7869511973c37294a47cd89f373d32bdfeefa1bbc8cdb2d32
MD5 daf0481a806a7c6f96d1bfbfc384da0d
BLAKE2b-256 75d82f91ffdf2bbe9e345196b006f16574883a0a62366c345885ebfa46099695

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaichi-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on atchox/kaichi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page