Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve cas9 documentation #259

Open
manulera opened this issue Sep 5, 2024 · 6 comments
Open

Improve cas9 documentation #259

manulera opened this issue Sep 5, 2024 · 6 comments

Comments

@manulera
Copy link
Collaborator

manulera commented Sep 5, 2024

Currently the functions do not have docstrings, and it's hard to understand how to use them.

@JeffXiePL
Copy link
Collaborator

Hi Manu, thought I would join in here and say that I'm sure how to use the CRISPR functions either. I have looked at the tests but I couldn't understand why the tests worked but my example here didn't. Could you please take a look if you have time?

@manulera
Copy link
Collaborator Author

manulera commented Sep 16, 2024

Hi @JeffXiePL,

Yes, as mentioned before the crispr module is not very well documented yet.

For documentation purposes (in case someone is interested / documents this in the hackathon),
to design a gRNA we have to take into account three things:

  1. The protospacer sequence: the sequence that is homologous to the target sequence, and after which the Cas9 enzyme will cut.
  2. The PAM sequence: a sequence that must be present in the target sequence, after the protospacer sequence, for Cas9 this sequence is "NGG",
    but it can be different for other enzymes.
  3. The scaffold sequence: the sequence that is needed for the gRNA to bind to the Cas9 enzyme.

I think that's roughly correct, but a great place to learn more about CRISPR is this AddGene post.

As for pydna, the cas9 takes the protospacer sequence as an argument to instantiate the class, so you can either:

  1. Provide the full gRNA sequence and use the protospacer function to get the protospacer sequence.
  2. Provide the protospacer sequence and instantiate the cas9 class directly.

Below is a minimal example for both cases:

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))

Hopefully this is useful for the hackathon

@JeffXiePL
Copy link
Collaborator

Thank you so much for the detailed explanation! This makes a lot more sense now, and I'll work on the CRIPSR module in the upcoming days and the hackathon.

@dgruano
Copy link
Contributor

dgruano commented Sep 23, 2024

I'm also planning on improving the CRISPR module functions and documentation! See #215

@manulera
Copy link
Collaborator Author

manulera commented Oct 3, 2024

@hiyama341

@hiyama341
Copy link
Collaborator

I'm down for working on this too :)

hiyama341 added a commit to hiyama341/pydna that referenced this issue Oct 3, 2024
manulera added a commit that referenced this issue Oct 4, 2024
* fourth trt

* final file added

* update: added installation of pydna

* update: added CRIPSR examples in notebooks issue #259

* update: added google badge issue #266

* Polished Example CRISPR notebook

---------

Co-authored-by: Manuel Lera-Ramirez <[email protected]>
manulera added a commit that referenced this issue Oct 8, 2024
* fourth trt

* final file added

* update: added installation of pydna

* update: added CRIPSR examples in notebooks issue #259

* update: added google badge issue #266

* Polished Example CRISPR notebook

---------

Co-authored-by: Manuel Lera-Ramirez <[email protected]>
@dgruano dgruano mentioned this issue Oct 11, 2024
manulera added a commit that referenced this issue Oct 24, 2024
* added new translation function

* new orfs method for Seq based on three_frame_orfs function

* new orfs_to_features method for Dseqrecord

* new extract_from_text functions that also returns the intervening text between sequences

* bugfix orfs for Seq and Dsecrecord

* added crispr tests

* added pairwise for older Python versions

* older type hint

* Deploying to gh-pages from @ da3e7e9 🚀

* Deploying to gh-pages from @ 5be4f9d 🚀

* Deploying to gh-pages from @ b37a17c 🚀

* Deploying to gh-pages from @ 11aae3c 🚀

* Deploying to gh-pages from @ 0f95223 🚀

* try to build docs locally on gh-pages

* try to build gh pages

* try to build gh pages

* fix

* added sphinx ext

* Deploying to gh-pages from @ bc08a36 🚀

* try fix docs

* build docs

* clean

* redirect docs badge to action

* redirect docs badge to action

* fix readme links

* fix readme

* fix

* try to fix test error

* fix bug that recognized parts of re enzyme names as other enzymes

* added comment with number of enzymes

* changed number of expected enzymes to the correct number 621

* more informative error msg

* closes #216 (2)

* closes #196

* vscode and poetry settings added

* fix test

* add locations_overlap to utils

* Issue 238 (#239)

* closes #238

* fix notebook

* closes #240

* atomically write default config

* optimisation for #237

* fix python 3.8 typing

* include neb calculator and its tests

* fix design and add tests

* example commit for #176

* Documentation notebooks 2 (#272)

* Documentation notebooks (#271)

* added documentation for dseq.py

* fixed docs for Dseq.py

* fixed docs for Dseq.py

* add hook

* fix exclusions and run hook

* strip outputs of Dseq.ipynb

* update Dseq notebook

* placed notebooks in docs

* added looped and shifted methods in Dseq docs

* added docs for importing files using pydna

* added some Dseqrecord docs

* added docs+examples for Dseq_Features

* added origin spanning feats and removing feats for Dseq_Features

* some comments and todos

* added restriction page

* updated Importing_Seq page

* updated Dseq_Feature Page w/examples

* added restrict+ligate notebook

* added some PCR notes

* added examples, prints

* added tm and design

* fixed tm_default docs

* added gibson assembly

* some comments on current progress

* gibson

* fixed comments, added gibson example and CRISPR

* added Restriction example

* added Gibson example

* closes #256

* run pre-commit

* alternative example for gibson

* gibson updated example

* modified crispr

* modified crispr

* feedback changes for #260

* best practices for qualifiers

---------

Co-authored-by: Pei-Lun Xie <[email protected]>
Co-authored-by: Pei-Lun Xie <[email protected]>

* remove unnecessary file

* remove dir exclusions

* exclude test notebooks

---------

Co-authored-by: Pei-Lun Xie <[email protected]>
Co-authored-by: Pei-Lun Xie <[email protected]>

* update contribution guidelines (#274)

* update CI action to enforce hooks (#277)

* update CI action to enforce hooks

* update action

* update: Added google badge to all notebooks issue #266  (#275)

* fourth trt

* final file added

* update: added installation of pydna

* added seguid stamp to Genbank sequence files

* fix test sequence file

* dependabot monthly

* New CRISPR example notebook (#260) (#284)

* fourth trt

* final file added

* update: added installation of pydna

* update: added CRIPSR examples in notebooks issue #259

* update: added google badge issue #266

* Polished Example CRISPR notebook

---------

Co-authored-by: Manuel Lera-Ramirez <[email protected]>

* Updated notebooks (#295)

* updated example_restriction (#285)

Co-authored-by: Pei-Lun Xie <[email protected]>

* small fixes (#294)

* allow run all on notebooks that have pip install for google colab

---------

Co-authored-by: Pei-Lun Xie <[email protected]>

* progress towards #261

* WIP

* remove code image from README for #261

* more README updates + make requirements.txt

* add requirements file

* fix configuration

* typing for PrettyTable

* typing for codon dicts

* typing for Seq

* typing for FakeSeq

* typing for Genbank

* typing for sequence_picker module

* typing for common_sub_strings module

* typing for Assembly.__init__ and Assembly.__repr__

* Bump pillow from 10.3.0 to 10.4.0

Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.3.0 to 10.4.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](python-pillow/Pillow@10.3.0...10.4.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump autopep8 from 2.1.0 to 2.3.1

Bumps [autopep8](https://github.com/hhatto/autopep8) from 2.1.0 to 2.3.1.
- [Release notes](https://github.com/hhatto/autopep8/releases)
- [Commits](hhatto/autopep8@v2.1.0...v2.3.1)

---
updated-dependencies:
- dependency-name: autopep8
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump black from 24.4.2 to 24.8.0

Bumps [black](https://github.com/psf/black) from 24.4.2 to 24.8.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](psf/black@24.4.2...24.8.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump sphinx-rtd-theme from 2.0.0 to 3.0.0

Bumps [sphinx-rtd-theme](https://github.com/readthedocs/sphinx_rtd_theme) from 2.0.0 to 3.0.0.
- [Changelog](https://github.com/readthedocs/sphinx_rtd_theme/blob/master/docs/changelog.rst)
- [Commits](readthedocs/sphinx_rtd_theme@2.0.0...3.0.0)

---
updated-dependencies:
- dependency-name: sphinx-rtd-theme
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump prettytable from 3.10.0 to 3.11.0

Bumps [prettytable](https://github.com/jazzband/prettytable) from 3.10.0 to 3.11.0.
- [Release notes](https://github.com/jazzband/prettytable/releases)
- [Changelog](https://github.com/jazzband/prettytable/blob/main/CHANGELOG.md)
- [Commits](prettytable/prettytable@3.10.0...3.11.0)

---
updated-dependencies:
- dependency-name: prettytable
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* closes #261 (#297)

* tests for #281 #279, add type to pcr (#298)

* update codecov action for #242

* Issue 270 (#301)

* closes #270

* closes #269 by adding an example notebook + extra tests

* closes #288, includes the graphics in docs notebook

* added example.ipynb to tests folder

* removed example.ipynb

* deal with Tm = 0

* fix notebook export related to #279

* New docs (#304)

* new docs

* update action

* update action

* fix typo in action

* update README + closes #305

* improve docs

* document how docs work

* fix autogen_docs.sh

* fix crispr docstring

* Fix link in README (#310)

* Fix action (#311)

* fix action

* fix action

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: BjornFJohansson <[email protected]>
Co-authored-by: BjornFJohansson <[email protected]>
Co-authored-by: Pei-Lun Xie <[email protected]>
Co-authored-by: Jerry Xu <[email protected]>
Co-authored-by: Pei-Lun Xie <[email protected]>
Co-authored-by: Lucas Levassor <[email protected]>
Co-authored-by: Kawin <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Daniel García Ruano <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants