Skip to content

Commit

Permalink
Merge pull request #162 from UC-Davis-molecular-computing/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dave-doty authored Jan 15, 2021
2 parents e0cd9c8 + 05e76b9 commit b6cd698
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
The scadnano Python package
([source code repository here](https://github.com/UC-Davis-molecular-computing/scadnano-python-package))
is a library for programmatically creating and editing these nanostructures.
The scadnano project is developed and maintained by the UC Davis Molecular Computing group.
Note that [cadnano](https://cadnano.org) is a separate project, developed and maintained by the [Douglas lab](https://bionano.ucsf.edu/) at UCSF.

If you find scadnano useful in a scientific project, please cite its associated paper:

Expand All @@ -16,6 +18,18 @@ If you find scadnano useful in a scientific project, please cite its associated
[ [paper](https://doi.org/10.4230/LIPIcs.DNA.2020.9) | [BibTeX](https://web.cs.ucdavis.edu/~doty/papers/scadnano.bib) ]


## Table of contents

* [Overview](#overview)
* [Reporting issues](#reporting-issues)
* [Installation](#installation)
* [Example](#example)
* [Abbreviated syntax with chained methods](#abbreviated-syntax-with-chained-methods)
* [Tutorial](#tutorial)
* [API documentation](#api-documentation)
* [Other examples](#other-examples)
* [Contributing](#contributing)

## Overview

This package is used to write Python scripts outputting `.sc` files readable by [scadnano](https://scadnano.org), a web application useful for displaying and manually editing these structures. The purpose of this module is to help automate some of the task of creating DNA designs, as well as making large-scale changes to them that are easier to describe programmatically than to do by hand in the scadnano web interface.
Expand Down Expand Up @@ -199,7 +213,7 @@ if __name__ == '__main__':
Running the code above produces a `.sc` file that, if loaded into scadnano, should appear as in the screenshot above. The [web interface README](https://github.com/UC-Davis-molecular-computing/scadnano/blob/master/README.md#terminology) explains many of the terms used in the code (domain, helix, loopout, insertion, etc.).


## abbreviated syntax with chained methods
## Abbreviated syntax with chained methods
Instead of explicitly creating variables and objects representing each domain in each strand, there is a shorter syntax using chained method calls. Instead of the above, create only the helices first, then create the Design. Then strands can be added using a shorter syntax, to describe how to draw the strand starting at the 5' end and moving to the 3' end. The following is a modified version of the above script using these chained methods

```python
Expand Down
21 changes: 13 additions & 8 deletions scadnano/scadnano.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
The :mod:`scadnano` Python module is a library for describing synthetic DNA nanostructures
(e.g., DNA origami).
Installation instructions are at the
`GitHub repository <https://github.com/UC-Davis-molecular-computing/scadnano-python-package>`_.
`GitHub repository <https://github.com/UC-Davis-molecular-computing/scadnano-python-package#installation>`_.
The scadnano project is developed and maintained by the UC Davis Molecular Computing group.
Note that `cadnano <https://cadnano.org>`_ is a separate project,
developed and maintained by the `Douglas lab <https://bionano.ucsf.edu/>`_ at UCSF.
This module is used to write Python scripts creating files readable
by `scadnano <https://scadnano.org/>`_, a web application useful for displaying
Expand Down Expand Up @@ -50,7 +54,7 @@
# commented out for now to support Py3.6, which does not support this feature
# from __future__ import annotations

__version__ = "0.15.0" # version line; WARNING: do not remove or change this line or comment
__version__ = "0.15.1" # version line; WARNING: do not remove or change this line or comment

import dataclasses
from abc import abstractmethod, ABC, ABCMeta
Expand Down Expand Up @@ -409,11 +413,11 @@ class M13Variant(enum.Enum):
p7249 = "p7249"
""""Standard" variant of M13mp18; 7249 bases long, available from, for example
https://www.tilibit.com/collections/scaffold-dna/products/single-stranded-scaffold-dna-type-p7249
https://www.neb.com/products/n4040-m13mp18-single-stranded-dna
http://www.bayoubiolabs.com/biochemicat/vectors/pUCM13/
https://www.tilibit.com/collections/scaffold-dna/products/single-stranded-scaffold-dna-type-p7249
"""

p7560 = "p7560"
Expand All @@ -439,9 +443,9 @@ def m13(rotation: int = 5587, variant: M13Variant = M13Variant.p7249) -> str:
`GenBank <https://www.ncbi.nlm.nih.gov/nuccore/X02513.1>`_.
By default, returns the "standard" variant of consisting of 7249 bases, sold by companies such as
`New England Biolabs <https://www.neb.com/~/media/nebus/page%20images/tools%20and%20resources/interactive%20tools/dna%20sequences%20and%20maps/m13mp18_map.pdf>`_
and
`Tilibit <https://cdn.shopify.com/s/files/1/1299/5863/files/Product_Sheet_single-stranded_scaffold_DNA_type_7249_M1-10.pdf?14656642867652657391>`_.
and
`New England Biolabs <https://www.neb.com/~/media/nebus/page%20images/tools%20and%20resources/interactive%20tools/dna%20sequences%20and%20maps/m13mp18_map.pdf>`_
The actual M13 DNA strand itself is circular,
so assigning this sequence to the scaffold :any:`Strand` in a :any:`Design`
Expand Down Expand Up @@ -2493,7 +2497,7 @@ class Strand(_JSONSerializable, Generic[StrandLabel, DomainLabel]):
scaffold_strand.set_scaffold()
Both will give the strand the same color that
`cadnano <https://cadnano.org/>`_
`cadnano <https://cadnano.org>`_
uses for the scaffold.
"""

Expand Down Expand Up @@ -4342,7 +4346,8 @@ def strand(self, helix: int, offset: int) -> StrandBuilder:
return StrandBuilder(self, helix, offset)

def assign_m13_to_scaffold(self, rotation: int = 5587, variant: M13Variant = M13Variant.p7249) -> None:
"""Assigns the scaffold to be the sequence of M13: :py:func:`m13` with the given `rotation`.
"""Assigns the scaffold to be the sequence of M13: :py:func:`m13` with the given `rotation`
and :any:`M13Variant`.
Raises :any:`IllegalDesignError` if the number of scaffolds is not exactly 1.
"""
Expand Down
4 changes: 2 additions & 2 deletions tutorial/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ We do this by creating a "precursor" design, which is not the final design, and

The scaffold is a good starting point. It is one long strand, but we won't specify it as such. Instead, we will specify it by drawing one strand on each helix, spanning the full length, and then modifying these strands with crossovers, eventually joining them into one long strand.

We can use the function [Design.strand](https://scadnano-python-package.readthedocs.io/en/latest/#scadnano.Design.strand) to draw strands. It takes two integer arguments: a helix and an offset, and uses "chained method calls" to give a short syntax for specifying strands. In this case, depending on the helix, we either want the strand (in order from 5' end to 3' end) to start at offset 0 and move forward (right) 288, or start at offset 288 and move in reverse by 288 (i.e., move by -288). The bottommost helix, 23, is an exception, where we want the "nick" to be, so we actually want to draw two strands, with a break between them at the halfway point 144:
We can use the function [Design.strand](https://scadnano-python-package.readthedocs.io/en/latest/#scadnano.Design.strand) to draw strands. It takes two integer arguments: a helix and an offset, and uses "chained method calls" to give a short syntax for specifying strands. In this case, depending on the helix, we either want the strand (in order from 5' end to 3' end) to start at offset 0 and move forward (right) by 288, or start at offset 288 and move in reverse by 288 (i.e., move by -288). The bottommost helix, 23, is an exception, where we want the "nick" to be, so we actually want to draw two strands, with a break between them at the halfway point 144:


```python
Expand Down Expand Up @@ -554,7 +554,7 @@ Finally, you will want to export the DNA sequences of the staples. One way to do

```python
for strand in design.strands:
if strand != design.scaffold:
if not strand.is_scaffold:
print(strand.dna_sequence)
```

Expand Down

0 comments on commit b6cd698

Please sign in to comment.