Skip to main content

CPU-friendly sequence-only CRISCross off-target prediction with a scikit-learn-style API.

Project description

criscross

CPU-friendly sequence-only CRISCross off-target prediction with a scikit-learn-style API. The pretrained model weights ship inside the wheel (fp16 + zstd-compressed) so no extra downloads are required.

Install

pip install criscross

CPU-only install (no CUDA libraries pulled in):

pip install criscross --extra-index-url https://download.pytorch.org/whl/cpu

Quickstart

from criscross import sequence_model
import pandas as pd

# Single datapoint (dict)
prob = sequence_model.predict({
    "Guide_sequence":   "GCTCGGGGACACAGGATCCCTGG",     # 23 nt
    "off_target_512nt": "GCAG...TGCC",                 # 512 nt, RC for - strand
    "strand_id":        1,                             # 1 for +, 0 for -
})
print(prob)   # float in [0, 1]

# Dataset (DataFrame or CSV path)
df = pd.read_csv("examples/sample_input.csv")
probs = sequence_model.predict(df)           # -> np.ndarray, shape [N]
probs = sequence_model.predict("examples/sample_input.csv")  # same

Accepted inputs to predict(X)

X Returned
dict / pandas.Series with the 3 required keys float
(guide, off_target_512nt, strand_id) 3-tuple float
pandas.DataFrame with the 3 required columns np.ndarray shape [N]
list of dicts np.ndarray shape [N]
str / pathlib.Path pointing to a CSV with the 3 columns np.ndarray shape [N]

Required columns/keys:

key dtype meaning
Guide_sequence 23nt string sgRNA guide sequence
off_target_512nt 512nt string candidate off-target window, already reverse-complemented for - strand
strand_id int 0/1 1 for + strand, 0 for -

CLI

criscross predict --csv examples/sample_input.csv --out preds.csv

If the input CSV also has a label column (0/1), AUPRC is printed to stderr.

Loading a custom checkpoint

from criscross import sequence_model
sequence_model.load("path/to/my_model.pt")           # fp32 raw .pt
sequence_model.load("path/to/my_model.pt.zst")       # zstd-compressed fp16

Inspecting the model

sequence_model.config()    # hyperparameters used to build CRISCross(**config)
sequence_model.metadata()  # versions, training-time test_auprc, input/output signature, seed

Citation

If you use this package in research, please cite the upstream CRISCross work. This package is a CPU-only, sequence-only repackaging of that model.

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

criscross-0.1.0.tar.gz (70.3 MB view details)

Uploaded Source

Built Distribution

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

criscross-0.1.0-py3-none-any.whl (70.3 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: criscross-0.1.0.tar.gz
  • Upload date:
  • Size: 70.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for criscross-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56e0bfbedb45a46cdea6c2526329020072053a9b257be27fe8ed21e181d420c1
MD5 4b3df8ba96136fc6c5c80698b4cc61b3
BLAKE2b-256 c06b2de42c01983efa2216ef9b017991bcfb73b572dd69101ac87201e0611a4b

See more details on using hashes here.

File details

Details for the file criscross-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: criscross-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 70.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for criscross-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b455d4f4cb55bd2003f1225e3a5215d24819e5b9f94fe912e7c968df3bec474
MD5 8c93584eb0aa47fced678cc3a5504535
BLAKE2b-256 32bc3b113ed47dabf4184688595a89247cdc6ef8c25565ae4f146338045dd6a0

See more details on using hashes here.

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