How to Model CRISPR-Cas9 Experiments in pydna
Visit the full library documentation here
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.
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.
# Install pydna (only when running on Colab)
import sys
if 'google.colab' in sys.modules:
%%capture
# Install the current development version of pydna (comment to install pip version)
!pip install git+https://github.com/BjornFJohansson/pydna@dev_bjorn
# Install pip version instead (uncomment to install)
# !pip install pydna
from pydna.crispr import cas9, protospacer
from pydna.dseqrecord import Dseqrecord
The target sequence and guideRNA (gRNA) sequence needs to be generated. Note the the sequence can be passed as a Dseqrecord
object.
from pydna.dseqrecord import Dseqrecord
from pydna.crispr import cas9, protospacer
# <----protospacer---><-------scaffold----------------->
guide = "GTTACTTTACCCGACGTCCCgttttagagctagaaatagcaagttaaaataagg"
target = "GTTACTTTACCCGACGTCCCaGG"
# <->
# PAM
# Create an enzyme object with the protospacer
enzyme = cas9("GTTACTTTACCCGACGTCCC")
target_dseq = Dseqrecord(target)
# Cut using the enzyme
print('cutting with enzyme 1:', target_dseq.cut(enzyme))
# Get the protospacer from the full gRNA sequence
gRNA_protospacers = protospacer(Dseqrecord(guide), cas=cas9)
# Print the protospacer (it's a list because often plasmids contain multiple gRNAs)
print('protospacer:', gRNA_protospacers[0])
gRNA_protospacer = gRNA_protospacers[0]
# Create an enzyme from the protospacer
enzyme2 = cas9(gRNA_protospacer)
# Simulate the cut
print('cutting with enzyme 2:', target_dseq.cut(enzyme2))
# Note that without the PAM, the cut will not be made.
target_noPAM_dseq = Dseqrecord("GTTACTTTACCCGACGTCCCaaa")
print("cutting with no PAM in target:", target_noPAM_dseq.cut(enzyme2))
cutting with enzyme 1: (Dseqrecord(-17), Dseqrecord(-6))
protospacer: GTTACTTTACCCGACGTCCC
cutting with enzyme 2: (Dseqrecord(-17), Dseqrecord(-6))
cutting with no PAM in target: ()