-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
4,919 additions
and
4,919 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,131 +1,131 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# How to Model CRISPR-Cas9 Experiments in pydna\n", | ||
"\n", | ||
"> Visit the full library documentation [here](https://pydna-group.github.io/pydna/)\n", | ||
"\n", | ||
"The pydna package can simulate CRISPR-Cas9 editing, which allows one to cut DNA sequences at specific sites using guide RNAs (gRNAs) that direct the Cas9 protein. This page will guide you through the process of using the `pydna.crispr` module to model a CRISPR-Cas9 cut on a DNA sequence.\n", | ||
"\n", | ||
"The `pydna.crispr` module contains the `cas9` class to simulate the biological activites of the Cas9 protein and the guideRNA, which should be imported. In addtion, the `Dseqrecord` class has also been imported to generate an example target_sequence." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/pydna-group/pydna/blob/master/docs/notebooks/CRISPR.ipynb\">\n", | ||
" <img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/>\n", | ||
"</a>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%%capture\n", | ||
"# Install pydna (only when running on Colab)\n", | ||
"import sys\n", | ||
"if 'google.colab' in sys.modules:\n", | ||
" %pip install pydna\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from pydna.crispr import cas9, protospacer\n", | ||
"from pydna.dseqrecord import Dseqrecord" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"The target sequence and guideRNA (gRNA) sequence needs to be generated. Note the the sequence can be passed as a `Dseqrecord` object." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"cutting with enzyme 1: (Dseqrecord(-17), Dseqrecord(-6))\n", | ||
"protospacer: GTTACTTTACCCGACGTCCC\n", | ||
"cutting with enzyme 2: (Dseqrecord(-17), Dseqrecord(-6))\n", | ||
"cutting with no PAM in target: ()\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from pydna.dseqrecord import Dseqrecord\n", | ||
"from pydna.crispr import cas9, protospacer\n", | ||
"\n", | ||
"# <----protospacer---><-------scaffold----------------->\n", | ||
"guide = \"GTTACTTTACCCGACGTCCCgttttagagctagaaatagcaagttaaaataagg\"\n", | ||
"target = \"GTTACTTTACCCGACGTCCCaGG\"\n", | ||
"# <->\n", | ||
"# PAM\n", | ||
"\n", | ||
"# Create an enzyme object with the protospacer\n", | ||
"enzyme = cas9(\"GTTACTTTACCCGACGTCCC\")\n", | ||
"\n", | ||
"target_dseq = Dseqrecord(target)\n", | ||
"\n", | ||
"# Cut using the enzyme\n", | ||
"print('cutting with enzyme 1:', target_dseq.cut(enzyme))\n", | ||
"\n", | ||
"\n", | ||
"# Get the protospacer from the full gRNA sequence\n", | ||
"gRNA_protospacers = protospacer(Dseqrecord(guide), cas=cas9)\n", | ||
"# Print the protospacer (it's a list because often plasmids contain multiple gRNAs)\n", | ||
"print('protospacer:', gRNA_protospacers[0])\n", | ||
"gRNA_protospacer = gRNA_protospacers[0]\n", | ||
"\n", | ||
"# Create an enzyme from the protospacer\n", | ||
"enzyme2 = cas9(gRNA_protospacer)\n", | ||
"\n", | ||
"# Simulate the cut\n", | ||
"print('cutting with enzyme 2:', target_dseq.cut(enzyme2))\n", | ||
"\n", | ||
"\n", | ||
"# Note that without the PAM, the cut will not be made.\n", | ||
"\n", | ||
"target_noPAM_dseq = Dseqrecord(\"GTTACTTTACCCGACGTCCCaaa\")\n", | ||
"print(\"cutting with no PAM in target:\", target_noPAM_dseq.cut(enzyme2))" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# How to Model CRISPR-Cas9 Experiments in pydna\n", | ||
"\n", | ||
"> Visit the full library documentation [here](https://pydna-group.github.io/pydna/)\n", | ||
"\n", | ||
"The pydna package can simulate CRISPR-Cas9 editing, which allows one to cut DNA sequences at specific sites using guide RNAs (gRNAs) that direct the Cas9 protein. This page will guide you through the process of using the `pydna.crispr` module to model a CRISPR-Cas9 cut on a DNA sequence.\n", | ||
"\n", | ||
"The `pydna.crispr` module contains the `cas9` class to simulate the biological activites of the Cas9 protein and the guideRNA, which should be imported. In addtion, the `Dseqrecord` class has also been imported to generate an example target_sequence." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/pydna-group/pydna/blob/master/docs/notebooks/CRISPR.ipynb\">\n", | ||
" <img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/>\n", | ||
"</a>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%%capture\n", | ||
"# Install pydna (only when running on Colab)\n", | ||
"import sys\n", | ||
"if 'google.colab' in sys.modules:\n", | ||
" %pip install pydna\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from pydna.crispr import cas9, protospacer\n", | ||
"from pydna.dseqrecord import Dseqrecord" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"The target sequence and guideRNA (gRNA) sequence needs to be generated. Note the the sequence can be passed as a `Dseqrecord` object." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"cutting with enzyme 1: (Dseqrecord(-17), Dseqrecord(-6))\n", | ||
"protospacer: GTTACTTTACCCGACGTCCC\n", | ||
"cutting with enzyme 2: (Dseqrecord(-17), Dseqrecord(-6))\n", | ||
"cutting with no PAM in target: ()\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from pydna.dseqrecord import Dseqrecord\n", | ||
"from pydna.crispr import cas9, protospacer\n", | ||
"\n", | ||
"# <----protospacer---><-------scaffold----------------->\n", | ||
"guide = \"GTTACTTTACCCGACGTCCCgttttagagctagaaatagcaagttaaaataagg\"\n", | ||
"target = \"GTTACTTTACCCGACGTCCCaGG\"\n", | ||
"# <->\n", | ||
"# PAM\n", | ||
"\n", | ||
"# Create an enzyme object with the protospacer\n", | ||
"enzyme = cas9(\"GTTACTTTACCCGACGTCCC\")\n", | ||
"\n", | ||
"target_dseq = Dseqrecord(target)\n", | ||
"\n", | ||
"# Cut using the enzyme\n", | ||
"print('cutting with enzyme 1:', target_dseq.cut(enzyme))\n", | ||
"\n", | ||
"\n", | ||
"# Get the protospacer from the full gRNA sequence\n", | ||
"gRNA_protospacers = protospacer(Dseqrecord(guide), cas=cas9)\n", | ||
"# Print the protospacer (it's a list because often plasmids contain multiple gRNAs)\n", | ||
"print('protospacer:', gRNA_protospacers[0])\n", | ||
"gRNA_protospacer = gRNA_protospacers[0]\n", | ||
"\n", | ||
"# Create an enzyme from the protospacer\n", | ||
"enzyme2 = cas9(gRNA_protospacer)\n", | ||
"\n", | ||
"# Simulate the cut\n", | ||
"print('cutting with enzyme 2:', target_dseq.cut(enzyme2))\n", | ||
"\n", | ||
"\n", | ||
"# Note that without the PAM, the cut will not be made.\n", | ||
"\n", | ||
"target_noPAM_dseq = Dseqrecord(\"GTTACTTTACCCGACGTCCCaaa\")\n", | ||
"print(\"cutting with no PAM in target:\", target_noPAM_dseq.cut(enzyme2))" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Oops, something went wrong.