CRISPR-centipede
Sensor-based per-variant effect scoring for base-editing tiling screens — the gRNA-only, frequentist companion to CRISPR-millipede. Where CRISPR-millipede models installed alleles from direct target amplicon-sequencing with a Bayesian linear model, CRISPR-centipede regresses a per-guide phenotype on per-guide editing values using ridge regression, and reports a per-variant effect-score table shaped like a millipede sigma table.
CRISPR-centipede is blind to how the editing was measured — it works the same whether the editing comes from a guide's self-edited protospacer, an attached sensor/surrogate, or a predictive model. Per guide it needs only:
- editing information — a per-variant editing value (a guides × variants matrix);
- counts in both populations — an enriched and a baseline read count;
- coordinates — an optional coordinate per variant (only for position-aware estimators and plots).
Converting any particular assay (e.g. CRISPR-Correct observed mutations) into an editing matrix is done upstream, outside this package.
Install
pip install crispr-centipede # once published
# or, from source:
cd CRISPR-centipede && pip install -e .
Python >=3.8,<3.12; depends only on numpy / scipy / pandas / scikit-learn / matplotlib.
Pipeline
import pandas as pd
import crispr_centipede as cc
# 1) Build a dataset: per-replicate editing matrix (guides x variants) + per-guide counts.
rep0 = cc.CentipedeReplicate(
editing=editing_df0, # DataFrame, index=guide id, columns=variant ids, values in [0,1]
enriched=high_counts0, # Series, index=guide id
baseline=low_counts0, # Series, index=guide id
)
ds = cc.CentipedeDataset([rep0, rep1, ...], coordinates=None) # coordinates optional (parsed from ids if absent)
# 2) Model: ridge (default) with Wald / hat-matrix-df / permutation inference.
spec = cc.CentipedeModelSpecification(estimator="ridge", inference=("wald", "hatdf", "perm"))
group = cc.CentipedeModelExperimentalGroup(ds, spec)
group.summary # per-variant: PIP, Coefficient, Coefficient StdDev, wald_p, p_hatdf, p_perm, ...
group.metadata # {alpha, cv_r2, n_guides, edf}
group.save("my_screen") # -> my_screen_summary.csv + my_screen_result.pkl
# 3) Visualize (generic per-variant plots).
cc.visualization.plot_coefficient_board(group.summary)
Variant ids are opaque labels. If they follow the "{position}{ref}>{alt}" convention (e.g. "24A>G"),
centipede can parse a coordinate from them; otherwise pass coordinates={variant: position, ...}. Coordinates
are only needed by the position-aware estimators (sliding/segmented/fused) and plots — plain ridge/OLS
don't use them.
Have your data as one combined frame (variant-frequency columns + count columns)? Use
cc.CentipedeDataset.from_design_matrix(df, enriched_col=..., baseline_col=...).
Editing as counts, per-population edited counts, and a coverage filter
Instead of a [0,1] frequency you can pass raw counts and let the package compute the frequency
(editing = presort_edited / presort_total). You may also supply the per-population edited counts to get
per-variant editing rates, and apply a global guide-coverage filter (a guide failing a threshold on the
pooled, summed-across-replicate count is dropped from every replicate):
ds = cc.CentipedeDataset.from_arrays(
presort_edited=[edited_df0, ...], # list[DataFrame]: guides x variants edited-read counts
presort_total=[total_s0, ...], # list[Series]: per-guide total reads (the denominator)
enriched=[high0, ...], baseline=[low0, ...], # phenotype counts (Series per replicate)
enriched_edited=[high_edited0, ...], # optional: edited counts in the enriched population
baseline_edited=[low_edited0, ...], # optional: edited counts in the baseline population
coordinates=variant_coords,
min_enriched=10, min_baseline=10, # optional global coverage filter (also min_presort_total)
)
ds.variant_enrichment() # per-variant editing-weighted mean response (model-free "plain enrichment")
ds.population_editing_rate("enriched") # per-variant pooled edited/total in the enriched population
ds.editing_rate_lfc() # per-variant log2(enriched rate / baseline rate)
ds.subset_guides(guide_ids) # restrict every replicate to a guide subset
Output (group.summary)
Indexed by variant id; columns mirror a CRISPR-millipede sigma table plus ridge-native fields:
| column | meaning |
|---|---|
Coefficient |
standardized ridge β (effect per SD of editing) |
Coefficient StdDev |
bootstrap standard error |
PIP |
bootstrap sign-stability ∈ [0,1] |
wald_p |
analytic ridge Wald p (anti-conservative under shrinkage) |
p_hatdf |
hat-matrix df-corrected t-test p (calibrated) |
p_perm, p_perm_fwer |
permutation p (per-feature; max-β FWER) |
max_edit_freq, n_guides_edited |
coverage diagnostics |
Alternative estimators (non-default)
estimator="ols" (unbiased, valid t-test), or the position-aware variants "fused" / "sliding" /
"segmented" via CentipedeModelSpecification(estimator=..., extra={...}).
Count normalization (optional)
count_normalization rescales the enriched (High) counts by a single pooled factor before scoring, to remove the
enriched-vs-baseline library-size imbalance — the guide-count analog of CRISPR-millipede's WT-allele normalization:
None(default) — no rescaling."total"— factorΣ baseline / Σ enrichedover the fitted guides (pins whole-librarylog2(H'/L')≈ 0)."null_anchor"— factor computed overnull_anchor_guide_ids(your negative-control guides), pinning their pooledlog2(H'/L')≈ 0. The controls define the scale only; they are not added as design rows.
# score relative to a negative-control null
cc.ridge_scores(ds, count_normalization="null_anchor", null_anchor_guide_ids=neg_control_ids,
editing_threshold=None, coedit_threshold=None, degree=None)
Under the mean-centered Normal-Ridge/OLS fit this is ~a constant shift of the response, so β and hit calls change only at second order — its role is to anchor the reported response/β scale to a defined null, not to reshape the fit.
What this package is not
It does not include the Bayesian allele model (that's CRISPR-millipede), the parsing of any particular assay's raw output (do that upstream), nor the genome-coordinate β-logo track plotting (that lives with the analysis project and calls this package for the per-variant scores).
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crispr_centipede-1.0.0.tar.gz.
File metadata
- Download URL: crispr_centipede-1.0.0.tar.gz
- Upload date:
- Size: 36.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.4.1 CPython/3.12.10 Linux/5.4.0-204-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27893959353e74274df653cc27e423a25bbef02ca3e577d78080fadbd36f3dab
|
|
| MD5 |
b80a1a7cb95b33f4c7ebacc8e714058c
|
|
| BLAKE2b-256 |
8cfb04668ed28670ea4d085c90796136b2898fadf4dbfaa450ac6f03384c0ccc
|
File details
Details for the file crispr_centipede-1.0.0-py3-none-any.whl.
File metadata
- Download URL: crispr_centipede-1.0.0-py3-none-any.whl
- Upload date:
- Size: 41.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/2.4.1 CPython/3.12.10 Linux/5.4.0-204-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6cff0bab756257aca73c587861957a75ad8d29c58f2c4228175aa9763d5cf00
|
|
| MD5 |
cd73f6b07c5e5d205ffc517f161a7bb2
|
|
| BLAKE2b-256 |
96b409e98163db2a31007228b72d105cce3ace7a0ce24ccb56d0ff1cad2f8224
|