Skip to content

Commit

Permalink
modified crispr
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffXiePL committed Sep 13, 2024
1 parent 7b02e56 commit 2f0752c
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions docs/notebooks/CRISPR.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The target sequence and guideRNA (gRNA) sequence needs to be generated. Note the the gRNA sequence can be passed as a string."
"The target sequence and guideRNA (gRNA) sequence needs to be generated. Note the the sequence can be passed as a `Dseqrecord` object."
]
},
{
Expand All @@ -39,17 +39,17 @@
"name": "stdout",
"output_type": "stream",
"text": [
"0\n"
"[]\n"
]
}
],
"source": [
"# Defining the target sequence\n",
"sequence = Dseqrecord(\"GGTCTCACCTTACCGTTGACGGACGATCGATTTGAC\")\n",
"sequence = Dseqrecord(\"GTTACTTTACCCGACGTCCCCGG\")\n",
"\n",
"# Defining the guide RNA sequence\n",
"gRNA_sequence = protospacer(sequence)\n",
"print(len(gRNA_sequence))"
"gRNA_sequence = protospacer(guide_construct = sequence, cas=cas9)\n",
"print(gRNA_sequence)"
]
},
{
Expand All @@ -58,26 +58,23 @@
"metadata": {},
"outputs": [
{
"ename": "IndexError",
"evalue": "list index out of range",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[21], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# Initializing the Cas9 protein\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m enzyme \u001b[38;5;241m=\u001b[39m cas9(\u001b[43mgRNA_sequence\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m)\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m# Simulating the CRISPR-Cas9 cut\u001b[39;00m\n\u001b[1;32m 5\u001b[0m cut_products \u001b[38;5;241m=\u001b[39m gRNA_sequence(enzyme)\n",
"\u001b[0;31mIndexError\u001b[0m: list index out of range"
"name": "stdout",
"output_type": "stream",
"text": [
"0\n"
]
}
],
"source": [
"# Initializing the Cas9 protein\n",
"enzyme = cas9(gRNA_sequence[0])\n",
"enzyme = cas9(protospacer=gRNA_sequence[0])\n",
"\n",
"# Simulating the CRISPR-Cas9 cut\n",
"cut_products = gRNA_sequence(enzyme)\n",
"# Simulating the CRISPR-Cas9 cut by searching for the cut sites\n",
"cas9_sites = enzyme.search(sequence)\n",
"print(len(cas9_sites))\n",
"\n",
"# The cut_products will contain the fragments resulting from the cut\n",
"for fragment in cut_products:\n",
"# The cas9_sites will contain the fragments resulting from the cut\n",
"for fragment in cas9_sites:\n",
" print(fragment.format(\"fasta\"))"
]
}
Expand Down

0 comments on commit 2f0752c

Please sign in to comment.