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.19.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.19-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.19-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.19-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.19-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.19-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.19-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.19.tar.gz.

File metadata

  • Download URL: naapam-0.1.19.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.19.tar.gz
Algorithm Hash digest
SHA256 d56f54ba4a357db671b0ec28fca5fbba5f6fccc832fdad0af9c10b867997ab75
MD5 560052e3bb054a0c6b0d9d53404d2ba1
BLAKE2b-256 99757095f91e5036d8d9d43bdd6901e97049516075060fc5342ecafb8202bc7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.19.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.19-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for naapam-0.1.19-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 42c315e08cd85b4301c7b40b021100619f8d332e06d824ca240ef69d3573456a
MD5 831635fa6998cd887efa8471a3797efb
BLAKE2b-256 c310008e8b35140fa1b26097b17527a82413795ac4cc401ef89d2ef03411c267

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.19-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.19-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for naapam-0.1.19-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9419aa83b7fecf4f4028821ea73da921623e1fa754c6d79673c92c9e8a318f5f
MD5 b9727165b15955a338a1a1473e22996a
BLAKE2b-256 2f0c856248df94fe2e552b89e228983a7c709dc520ae0deb9c49aef0bf1572d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.19-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.19-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for naapam-0.1.19-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 13d7ebfd14d7023dd75536f9436bd77c20a390963b54406816cb7e059ad04337
MD5 0f1e34741d247f925391b37db9b49746
BLAKE2b-256 9e58c70f2d14551b93b87db8a29bdd884c71d791cbd2d6c33cb4e592775f2012

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.19-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.19-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for naapam-0.1.19-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c0328187dffa01d1a1f19f85f20086d7cd45b86627feb86ff9a2befb9206f660
MD5 b02801c4127697aeac00095624a618a1
BLAKE2b-256 84eb3af78a7113e6f4e85c6cfe68f8053ba6b7ee44547dfb9c3f32a81c453cc9

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.19-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.19-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for naapam-0.1.19-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bc7e4ca2e9cde9ca0ceec3a7bbc047ecef98fb22ecb6cc32c4688f9bb1968d15
MD5 8007078aaa8a1feb2d524c5bb271a313
BLAKE2b-256 f5c8de5573aa0485a70f1cd572f95ae1a56fac5ec143a8631d465a2fb58dfb61

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.19-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.19-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for naapam-0.1.19-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fe4568eff4e58da2e764bb0cac12cf7fc4f233b14a57d1de33951eb43fc27478
MD5 9a0d76c21c01e94da16e963e9b18adcd
BLAKE2b-256 2c37edc5ccb5e3825bfc7341af17aa940feb7e67d6f07213ac5633c5a60e008c

See more details on using hashes here.

Provenance

The following attestation bundles were made for naapam-0.1.19-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