Skip to main content

Chip-based CRISPR analysis

Project description

Introduction

---
title: Workflow
---
flowchart TD
  SP[(synthesize plasmids)] --> FP[(functional plasmids)] --> E[editing] --> SR[(sample reads)] --> A[alignment]

  FP --> A --> OEO[(observed editing outcomes)] --> C[correction] --> CEO[(corrected editing outcomes)]

  SP --> NP[(nonfunctional plasmids)] --> SR

  NP[(nonfunctional plasmids)] --> NCR[(negative control reads)] --> A2[alignment]

  FP --> A2 --> NCEO[(negative control editing outcomes)] --> C

We design the workflow naapam to decouple the CRISPR/Cas9 editing outcomes from the synthesis error of reference plasmids. We first give an overview of the workflow and left the techniqal details in Discriminate functional and nonfunctional plasmids, Sequence alignment and Correction observed editing outcomes by negative control.

As shown in the above diagram, we apply the hard classification on the synthesized plasmids to get functional and nonfunctional plasmids. We assume that only functional plasmids can be edited by the CRISPR/Cas9 system. Nonfunctional plasmids are transferred into the cell lines, but are not edited. Based on our assumption that only functional plasmids can be edited, we use functional plasmids as references to analyze editing outcomes.

For cell lines express Cas9, both nonfunctional plasmids and edited functional plasmids contribute to the editing outcomes in NGS reads. For the negative control (cell lines without Cas9), only nonfunctional plasmids contributes to the editing outcomes. The synthesis of plasmids is error-prone. A naive analysis often attributes these synthesis errors to the CRISPR/Cas9 system, and therefore overesitimates the editing efficiency and distorts the overall editing profile. A reasonable assumption is that the abundance of non-functional plasmids is similar in cell lines with and without Cas9. Therefore, we may correct the editing profiles for the cell lines with Cas9 based on those of the negative controls.

Discriminate functional and nonfunctional plasmids

block
  block:ID
    R1B["R1 barcode"]
    R1P["R1 primer"]
    TSS["G"]
    SG["sgRNA"]
    SC["scaffold"]
    TES["G"]
    T["target"]
    SEP["CAG"]
    B["barcode"]
    RCR2P["R2 primer'"]
    RCR2B["R2 barcode'"]
  end

We parse the components for each read in control samples. We discriminate functional and nonfunction plasmids based on the integrity and conservation of:

  • primer;
  • sgRNA;
  • scaffold;
  • barcode;
  • protospacer;
  • PAM;
  • transcription start and end sites markded by G;

We also require that barcode, sgRNA, protospacer are consistent (comes from the same plasmid design).

Sequence alignment

We use the bioconda package rearr (version 1.0.11) to align the NGS reads to the functional plasmids for discriminating their editing types. We package rearr together with naapam so you need not download it separately. Rearr use an efficient and accurate chimeric alignment engine to call editing outcome from raw reads. It is especially good at extracting predictable templated insertions resulted from stagger cleavage of CRISPR/Cas9 system (Precise and Predictable CRISPR Chromosomal Rearrangements Reveal Principles of Cas9-Mediated Nucleotide Insertion). See the documentation for more details about rearr.

Correction observed editing outcomes by negative control

Let $w_0$ be the observed wild type frequency of a functional plasmid in control sample. Let $e_0^{(i)}$ be the observed frequency of editing outcome $i$ (actually nonfunctional plasmids) in control sample. Then $w_0 + \sum_i e_0^{(i)} = 1$. Similarly, let $w$ be observed the wild type frequency of a functional plasmid in the sample with Cas9. Let $e^{(i)}$ be the observed frequency of editing outcome $i$ in the sample with Cas9. Then $w + \sum_i e^{(i)} = 1$. By the assumption that the abundance of non-functional plasmids is similar in cell lines with and without Cas9, the expected frequency of functional plasmids (wild type + edited) is $w_0$. For the editing outcome $i$, among its observed frequency $e^{(i)}$ in the cell line with Cas9, we expect that $e_0^{(i)}$ comes from nonfunctional plasmids. In summary, the corrected frequency of the editing outcome $i$ is $$ \frac{e^{(i)} - e_0^{(i)}}{w_0} $$ if wild type is included, and $$ \frac{e^{(i)} - e_0^{(i)}}{\sum_i (e^{(i)} - e_0^{(i)})} $$ if wild type is excluded. This method has been used in previous works High-throughput analysis of the activities of xCas9, SpCas9-NG and SpCas9 at matched and mismatched target sequences in human cells and Prediction of the sequence-specific cleavage activity of Cas9 variants.

Install

$ pip install naapam

Dependencies

  • bowtie2
  • gawk

Usage

Follow the notebooks in order:

  • align.ipynb
  • analysis.ipynb

Copy them out of the package by

from importlib import resources
import shutil

for file in ["align.ipynb", "analyze.ipynb"]:
    shutil.copyfile(src=resources.files("naapam.notebooks") / file, dst=file)

You need to config the directory and the plasmid file in the first block of the notebooks.

  • data_dir: contains the raw NGS reads.
  • root_dir: root directory for outputs.
  • plasmid_file: the design file of plasmids.
  • config_dir: directory for config files.
  • correct_dir: output directory of the corrected alignment results.

Copy examples of plasmid files out of the package for reference.

from importlib import resources
import shutil

for file in [
    "final_hgsgrna_libb_all_0811-NGG.csv",
    "final_hgsgrna_libb_all_0811_NAA_scaffold_nbt.csv",
]:
    shutil.copyfile(src=resources.files("naapam.plasmids") / file, dst=file)

Copy examples of config directory out of the package for reference.

from importlib import resources
import shutil

shutil.copytree(src=resources.files("naapam.filter_configs"), dst="filter_configs")

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

naapam-0.1.20.tar.gz (5.2 MB view details)

Uploaded Source

Built Distributions

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

naapam-0.1.20-cp314-cp314t-musllinux_1_2_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

naapam-0.1.20-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

naapam-0.1.20-cp314-cp314-musllinux_1_2_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

naapam-0.1.20-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

naapam-0.1.20-cp313-cp313-musllinux_1_2_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

naapam-0.1.20-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file naapam-0.1.20.tar.gz.

File metadata

  • Download URL: naapam-0.1.20.tar.gz
  • Upload date:
  • Size: 5.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for naapam-0.1.20.tar.gz
Algorithm Hash digest
SHA256 d10e944c5e0a32e53161efc923b5d2290155ce6ac9cd262892f066d353a72b9e
MD5 49abfd1ec83dfa7591902b875fab2607
BLAKE2b-256 f6c28c75cd756d722fe71183e0f39ed254d5c2ee8e559eebeefb50afdcf67ccb

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.20.tar.gz:

Publisher: release.yml on ljw20180420/naapam

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

File details

Details for the file naapam-0.1.20-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for naapam-0.1.20-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a0e8f5ae4f0418cbd3bcb8d415fd005c1643954e95b1178ef2194bffd4bad8a0
MD5 c11561de4c272ff3e24d4ab13bbf2cec
BLAKE2b-256 f9d0dae132e27c10d4b0b3af0bd47db2379baf7c08950889c0396b798b36ee23

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.20-cp314-cp314t-musllinux_1_2_x86_64.whl:

Publisher: release.yml on ljw20180420/naapam

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

File details

Details for the file naapam-0.1.20-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for naapam-0.1.20-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ffc5e428d2d6d33c426ef96537884960e52c89093f897d31237fa90c4902dd89
MD5 2d54f782f2b7fc018655e695384d479e
BLAKE2b-256 7d81ad34179ad4b4fcbbb1d0684090b60c774e6bc968a004528b0bcb1019d4a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.20-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on ljw20180420/naapam

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

File details

Details for the file naapam-0.1.20-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for naapam-0.1.20-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 78894822db1283ba994d5687be5f38e7fd9fa796d0d239f011e9840432a9f298
MD5 5c62cefc4ed529ed72d2859d47a0056c
BLAKE2b-256 2c28a559aea5c1ff9a738f92d2e9c6bb5e76fdd5ebed3d19a035d65682d48172

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.20-cp314-cp314-musllinux_1_2_x86_64.whl:

Publisher: release.yml on ljw20180420/naapam

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

File details

Details for the file naapam-0.1.20-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for naapam-0.1.20-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4ded8df1859507470c716f8df20cb336dd1a3de2ab3af9e9cac8b45c456fc44a
MD5 7bdeb3ea06e90e1b9eda60c8d6e7591d
BLAKE2b-256 4b29e10d9282632c3785e6df897796a263fcdd8c1b98799a042a6873aed32d6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.20-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on ljw20180420/naapam

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

File details

Details for the file naapam-0.1.20-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for naapam-0.1.20-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 be42a356d9147e4365ddd51fec280aa281c57c0e88808f8a4f6e50a15d5b9876
MD5 3a20314514d2acf4caed76fac93a3733
BLAKE2b-256 cdafb05ecfbf0698f02448e91341bf5995c2b30cc89b6539669be19c19f5c5c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.20-cp313-cp313-musllinux_1_2_x86_64.whl:

Publisher: release.yml on ljw20180420/naapam

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

File details

Details for the file naapam-0.1.20-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for naapam-0.1.20-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ae6630c2f136af57e2e8240f5e043ca3c62a1004c235f8c7a841b0855789243c
MD5 a6b130f26712438430e4bd3766fbb754
BLAKE2b-256 4dbce5fb676bdac163c0b9a5d4f66ca202df60ecb0ede598b3b42602de55f7a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.20-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on ljw20180420/naapam

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