Skip to content

Commit

Permalink
Merge pull request #100 from UC-Davis-molecular-computing/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dave-doty authored Jul 3, 2020
2 parents 053a7a6 + 386f4cb commit 6af1a46
Show file tree
Hide file tree
Showing 4 changed files with 257 additions and 18 deletions.
54 changes: 38 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ If you find scadnano useful in a scientific project, please cite its associated

This module is used to write Python scripts outputting `.dna` 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 scadnano.

Early versions of this project didn't have well-defined versions. However, we will try to announce breaking changes (and possibly new features) under the [GitHub releases page](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/releases). The version numbers in this Python library repo and the [web interface repo](https://github.com/UC-Davis-molecular-computing/scadnano/releases) won't always advance at the same time. However, when a breaking change is made, this will increment the minor or major version numbers in both libraries (version numbers are major.minor.patch, i.e., version 0.9.2 has minor version number 9).
Early versions of this project didn't have well-defined versions. However, we will try to announce breaking changes (and possibly new features) under the [GitHub releases page](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/releases). The version numbers in this Python library repo and the [web interface repo](https://github.com/UC-Davis-molecular-computing/scadnano/releases) won't always advance at the same time.

Following [semantic versioning](https://semver.org/), version numbers are major.minor.patch, i.e., version 0.9.2 has minor version number 9. Prior to version 1.0.0, when a breaking change is made, this will increment the minor version (for example, going from 0.9.4 to 0.10.0). After version 1.0.0, breaking changes will increment the major version.



Expand All @@ -40,7 +42,7 @@ The scadnano Python package requires Python version 3.7 or later. If you do not
Once Python is installed, there are two ways you can install the scadnano Python package:


1. pip
1. pip (recommended)

Use [pip](https://pypi.org/project/pip/) to install the package by executing the following at the command line:
```console
Expand All @@ -56,7 +58,7 @@ Once Python is installed, there are two ways you can install the scadnano Python

2. download

As a simple alternative, you can download and place the following files (located in the [scadnano/](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/tree/master/scadnano) subfolder)
As a simple alternative (in case you run into trouble using pip), you can download and place the following files (located in the [scadnano/](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/tree/master/scadnano) subfolder)
in your PYTHONPATH (e.g., in the same directory as the scripts you are running):

* *required*: [scadnano.py](https://raw.githubusercontent.com/UC-Davis-molecular-computing/scadnano-python-package/master/scadnano/scadnano.py)
Expand All @@ -76,7 +78,7 @@ Once Python is installed, there are two ways you can install the scadnano Python

Consider the following design:

![](https://github.com/UC-Davis-molecular-computing/scadnano/blob/master/doc-images/screenshot-initial.png)
![](https://raw.githubusercontent.com/UC-Davis-molecular-computing/scadnano/master/doc-images/screenshot-initial.png)

The following Python script produces this design.

Expand Down Expand Up @@ -130,28 +132,48 @@ Running the code above produces the `.dna` JSON file shown in the [web interface


## 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 DNADesign. 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.
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 DNADesign. 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
# helices
helices = [sc.Helix(max_offset=48), sc.Helix(max_offset=48)]
import scadnano as sc
import modifications as mod


def main():
# helices
helices = [sc.Helix(max_offset=48), sc.Helix(max_offset=48)]

# whole design
design = sc.DNADesign(helices=helices, strands=[], grid=sc.square)

# left staple
design.strand(1, 8).to(24).cross(0).to(8)

# right staple
design.strand(0, 40).to(24).cross(1).to(40).with_modification_5p(mod.biotin_5p)

# whole design
design = sc.DNADesign(helices=helices, strands=[], grid=sc.square)
# scaffold
design.strand(1, 24).to(8).cross(0).to(40).loopout(1, 3).to(24).as_scaffold()

# deletions and insertions added to design are added to both strands on a helix
design.add_deletion(helix=1, offset=20)
design.add_insertion(helix=0, offset=14, length=1)
design.add_insertion(helix=0, offset=26, length=2)

# also assigns complement to strands other than scaf bound to it
design.assign_dna(scaf, 'AACGT' * 18)

# left staple
design.strand(1, 8).to(24).cross(0).to(8)
return design

# right staple
design.strand(0, 40).to(24).cross(1).to(40).with_modification_5p(mod.biotin_5p)

# scaffold
design.strand(1, 24).to(8).cross(0).to(40).loopout(1, 3).to(24).as_scaffold()
if __name__ == '__main__':
design = main()
design.write_scadnano_file(directory='output_designs')
```

Documentation is available in the [API docs](https://scadnano-python-package.readthedocs.io/en/latest/#scadnano.DNADesign.strand).

The code for adding insertions, deletions, and assigning DNA would be the same as in the original script.




Expand Down
217 changes: 217 additions & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
alabaster==0.7.12
anaconda-client==1.7.2
anaconda-navigator==1.9.7
anaconda-project==0.8.3
asn1crypto==0.24.0
astroid==2.2.5
astropy==3.2.1
atomicwrites==1.3.0
attrs==19.1.0
Babel==2.7.0
backcall==0.1.0
backports.functools-lru-cache==1.5
backports.os==0.1.1
backports.shutil-get-terminal-size==1.0.0
backports.tempfile==1.0
backports.weakref==1.0.post1
beautifulsoup4==4.7.1
bitarray==0.9.3
bkcharts==0.2
bleach==3.1.0
bokeh==1.2.0
boto==2.49.0
Bottleneck==1.2.1
certifi==2019.6.16
cffi==1.12.3
chardet==3.0.4
Click==7.0
cloudpickle==1.2.1
clyent==1.2.2
colorama==0.4.1
comtypes==1.1.7
conda==4.7.5
conda-build==3.18.7
conda-package-handling==1.3.11
conda-verify==3.4.2
contextlib2==0.5.5
cryptography==2.7
cycler==0.10.0
Cython==0.29.12
cytoolz==0.9.0.1
dask==2.1.0
decorator==4.4.0
defusedxml==0.6.0
distributed==2.1.0
docutils==0.14
entrypoints==0.3
et-xmlfile==1.0.1
fastcache==1.1.0
filelock==3.0.12
Flask==1.0.3
future==0.17.1
gevent==1.4.0
glob2==0.7
greenlet==0.4.15
h5py==2.9.0
heapdict==1.0.0
html5lib==1.0.1
idna==2.8
imageio==2.5.0
imagesize==1.1.0
importlib-metadata==0.17
ipykernel==5.1.1
ipython==7.6.1
ipython-genutils==0.2.0
ipywidgets==7.5.0
isort==4.3.21
itsdangerous==1.1.0
jdcal==1.4.1
jedi==0.13.3
Jinja2==2.10.1
joblib==0.13.2
jsonschema==3.0.1
jupyter==1.0.0
jupyter-client==5.3.1
jupyter-console==6.0.0
jupyter-core==4.5.0
jupyterlab==0.35.4
jupyterlab-server==0.2.0
keyring==18.0.0
kiwisolver==1.1.0
lazy-object-proxy==1.4.1
libarchive-c==2.8
llvmlite==0.29.0
locket==0.2.0
lxml==4.3.4
MarkupSafe==1.1.1
matplotlib==3.1.0
mccabe==0.6.1
menuinst==1.4.16
mistune==0.8.4
mkl-fft==1.0.12
mkl-random==1.0.2
mkl-service==2.0.2
mock==3.0.5
more-itertools==7.0.0
mpmath==1.1.0
msgpack==0.6.1
multipledispatch==0.6.0
navigator-updater==0.2.1
nbconvert==5.5.0
nbformat==4.4.0
networkx==2.3
nltk==3.4.5
nose==1.3.7
notebook==5.7.8
numba==0.44.1
numexpr==2.6.9
numpy==1.16.4
numpydoc==0.9.1
olefile==0.46
openpyxl==2.6.2
packaging==19.0
pandas==0.24.2
pandocfilters==1.4.2
parso==0.5.0
partd==1.0.0
path.py==12.0.1
pathlib2==2.3.4
patsy==0.5.1
pep8==1.7.1
pickleshare==0.7.5
Pillow==6.2.0
pkginfo==1.5.0.1
pluggy==0.12.0
ply==3.11
prometheus-client==0.7.1
prompt-toolkit==2.0.9
psutil==5.6.3
py==1.8.0
pycodestyle==2.5.0
pycosat==0.6.3
pycparser==2.19
pycrypto==2.6.1
pycurl==7.43.0.3
pyflakes==2.1.1
Pygments==2.4.2
pylint==2.3.1
pyodbc==4.0.26
pyOpenSSL==19.0.0
pyparsing==2.4.0
pyreadline==2.1
pyrsistent==0.14.11
PySocks==1.7.0
pytest==5.0.1
pytest-arraydiff==0.3
pytest-astropy==0.5.0
pytest-doctestplus==0.3.0
pytest-openfiles==0.3.2
pytest-remotedata==0.3.1
python-dateutil==2.8.0
pytz==2019.1
PyWavelets==1.0.3
pywin32==223
pywinpty==0.5.5
PyYAML==5.1.1
pyzmq==18.0.0
QtAwesome==0.5.7
qtconsole==4.5.1
QtPy==1.8.0
readme-renderer==24.0
requests==2.22.0
requests-toolbelt==0.9.1
rope==0.14.0
ruamel-yaml==0.15.46
scadnano==0.1.0
scikit-image==0.15.0
scikit-learn==0.21.2
scipy==1.2.1
seaborn==0.9.0
Send2Trash==1.5.0
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.12.0
snowballstemmer==1.9.0
sortedcollections==1.1.2
sortedcontainers==2.1.0
soupsieve==1.8
Sphinx==2.1.2
sphinx-rtd-theme==0.4.3
sphinxcontrib-applehelp==1.0.1
sphinxcontrib-devhelp==1.0.1
sphinxcontrib-htmlhelp==1.0.2
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.2
sphinxcontrib-serializinghtml==1.1.3
sphinxcontrib-websupport==1.1.2
spyder==3.3.6
spyder-kernels==0.5.1
SQLAlchemy==1.3.5
statsmodels==0.10.0
sympy==1.4
tables==3.5.2
tblib==1.4.0
terminado==0.8.2
testpath==0.4.2
toolz==0.10.0
tornado==6.0.3
tqdm==4.32.1
traitlets==4.3.2
twine==3.1.1
unicodecsv==0.14.1
urllib3==1.24.2
wcwidth==0.1.7
webencodings==0.5.1
Werkzeug==0.15.4
widgetsnbextension==3.5.0
win-inet-pton==1.1.0
win-unicode-console==0.5
wincertstore==0.2
wrapt==1.11.2
wxPython==4.0.6
xlrd==1.2.0
XlsxWriter==1.1.8
xlwings==0.15.8
xlwt==1.3.0
zict==1.0.0
zipp==0.5.1
2 changes: 1 addition & 1 deletion scadnano/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

# The following line *must* be the last in the module, exactly as formatted:
# XXX: REMEMBER TO CHANGE VERSION IN scadnano.py also, for users who do not install from PyPI
__version__ = "0.9.4"
__version__ = "0.9.5"
2 changes: 1 addition & 1 deletion scadnano/scadnano.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
from ._version import __version__
except ImportError:
# this is so scadnano.py file works without _version.py being present, in case user downloads it
__version__ = "0.9.4"
__version__ = "0.9.5"

StrandLabel = TypeVar('StrandLabel')
DomainLabel = TypeVar('DomainLabel')
Expand Down

0 comments on commit 6af1a46

Please sign in to comment.