Skip to content

Commit

Permalink
Merge pull request #234 from UC-Davis-molecular-computing/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dave-doty authored May 22, 2023
2 parents bbbf16f + 307d098 commit 892dee4
Show file tree
Hide file tree
Showing 7 changed files with 594 additions and 190 deletions.
18 changes: 9 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Contributing to the dsd Python package
# Contributing to the nuad Python package
First off, thanks for taking the time to contribute!

The following is a set of guidelines for contributing to dsd.
The following is a set of guidelines for contributing to nuad.
Feel free to propose changes to this document in a pull request,
or post questions as issues on the [issues page](https://github.com/UC-Davis-molecular-computing/dsd/issues).
or post questions as issues on the [issues page](https://github.com/UC-Davis-molecular-computing/nuad/issues).



Expand All @@ -22,13 +22,13 @@ or post questions as issues on the [issues page](https://github.com/UC-Davis-mol
### Python
First, read the [README](README.md) to familiarize yourself with the package from a user's perspective.

The dsd Python package requires at least Python 3.6.
The nuad Python package requires at least Python 3.6.

### What to install

Follow the [installation instructions](README.md#installation) to install the correct version of Python if you don't have it already.

I suggest using a powerful IDE such as [PyCharm](https://www.jetbrains.com/pycharm/download/download-thanks.html). [Visual Studio Code](https://code.visualstudio.com/) is also good with the right plugins. The dsd Python package uses type hints, and these tools are very helpful in giving static analysis warnings about the code that may represent errors that will manifest at run time.
I suggest using a powerful IDE such as [PyCharm](https://www.jetbrains.com/pycharm/download/download-thanks.html). [Visual Studio Code](https://code.visualstudio.com/) is also good with the right plugins. The nuad Python package uses type hints, and these tools are very helpful in giving static analysis warnings about the code that may represent errors that will manifest at run time.


### git
Expand All @@ -54,11 +54,11 @@ We use [git](https://git-scm.com/docs/gittutorial) and [GitHub](https://guides.g
The first step is cloning the repository so you have it available locally.

```
git clone https://github.com/UC-Davis-molecular-computing/dsd.git
git clone https://github.com/UC-Davis-molecular-computing/nuad.git
```

Changes to the dsd package should be pushed to the
[`dev`](https://github.com/UC-Davis-molecular-computing/dsd/tree/dev) branch. So switch to the `dev` branch:
Changes to the nuad package should be pushed to the
[`dev`](https://github.com/UC-Davis-molecular-computing/nuad/tree/dev) branch. So switch to the `dev` branch:

```
git checkout dev
Expand Down Expand Up @@ -112,7 +112,7 @@ For any more significant change that is made (e.g., closing an issue, adding a n

## Pushing to the repository main branch and documenting changes (done less frequently)

Less frequently, pull requests (abbreviated PR) can be made from `dev` to `main`, but make sure that `dev` is working before merging to `main`, since changes to the docstrings automatically update [readthedocs](https://dsddna.readthedocs.io/en/latest/), which is the site hosting the API documentation. That is, changes to main immediately affect users reading online documentation, so it is critical that these work. Eventually we will automatically upload to PyPI, so this will also affect users installing via pip.
Less frequently, pull requests (abbreviated PR) can be made from `dev` to `main`, but make sure that `dev` is working before merging to `main`, since changes to the docstrings automatically update [readthedocs](https://nuad.readthedocs.io/en/latest/), which is the site hosting the API documentation. That is, changes to main immediately affect users reading online documentation, so it is critical that these work. Eventually we will automatically upload to PyPI, so this will also affect users installing via pip.

**WARNING:** Always wait for the checks to complete. This is important to ensure that unit tests pass.

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ In more detail, there are five main types of objects you create to describe your

- There are two types of `Domain`'s with no associated `DomainPool`. One type is a `Domain` with the field `fixed` set to `True` by calling the method `Domain.set_fixed_sequence()`, which has some fixed DNA sequence that cannot be changed. A fixed `Domain` has no `DomainPool`.)

- The other type is a `Domain` with the field `dependent` set the `True` (by assigning the field directly). Such a domain is dependent for its sequence on the sequence of some other `Domain` with `dependent = False` that either contains it as a subsequence, or is contained in it as a subsequence. For example, one can declare the domain `a` is independent (has `dependent = False`), with length 8, and has dependent subdomains `b` and `c` of length 5 and 3. `a` would have a `DomainPool`, and if `a` is assigned sequence AAACCGTT, then `b` is automatically assigned sequence AAACC, and `c` is automatically assigned sequence GTT. Such subdomains are assigned via the field `Domain.subdomains`; see the API documentation for more details: https://dnadsd.readthedocs.io/en/latest/#constraints.Domain.dependent and https://dnadsd.readthedocs.io/en/latest/#constraints.Domain.subdomains.
- The other type is a `Domain` with the field `dependent` set the `True` (by assigning the field directly). Such a domain is dependent for its sequence on the sequence of some other `Domain` with `dependent = False` that either contains it as a subsequence, or is contained in it as a subsequence. For example, one can declare the domain `a` is independent (has `dependent = False`), with length 8, and has dependent subdomains `b` and `c` of length 5 and 3. `a` would have a `DomainPool`, and if `a` is assigned sequence AAACCGTT, then `b` is automatically assigned sequence AAACC, and `c` is automatically assigned sequence GTT. Such subdomains are assigned via the field `Domain.subdomains`; see the API documentation for more details: https://nuad.readthedocs.io/en/latest/#constraints.Domain.dependent and https://nuad.readthedocs.io/en/latest/#constraints.Domain.subdomains.

- `Strand`: A `Strand` contains an ordered list `domains` of `Domain`'s, together with an identification of which `Domain`'s are starred in this `Strand`, the latter specified as a set `starred_domain_indices` of indices (starting at 0) into the list `domains`. For example, the `Strand` consisting of `Domain`'s `a`, `b*`, `c`, `b`, `d*`, in that order, would have `domains = [a, b, c, b, d]` and `starred_domain_indices = {1, 4}`.

Expand All @@ -146,7 +146,7 @@ In more detail, there are five main types of objects you create to describe your

- `DomainConstraint`: This only looks at a single `Domain`. In practice this is not used much, since there's not much information in a `Domain` other than its DNA sequence, so a `SequenceConstraint` or `NumpyConstraint` typically would already have filtered out any DNA sequence not satisfying such a constraint.

- `StrandConstraint`: This evaluates a whole `Strand`. A common example is that NUPACK's `pfunc` should indicate a complex free energy above a certain threshold, indicating the `Strand` has little secondary structure. This example constraint is available in the library by calling [nupack_strand_complex_free_energy_constraint](https://dnadsd.readthedocs.io/en/latest/#constraints.nupack_strand_complex_free_energy_constraint).
- `StrandConstraint`: This evaluates a whole `Strand`. A common example is that NUPACK's `pfunc` should indicate a complex free energy above a certain threshold, indicating the `Strand` has little secondary structure. This example constraint is available in the library by calling [nupack_strand_complex_free_energy_constraint](https://nuad.readthedocs.io/en/latest/#constraints.nupack_strand_complex_free_energy_constraint).

- `DomainPairConstraint`: This evaluates a pair of `Domain`'s.

Expand All @@ -170,7 +170,7 @@ In more detail, there are five main types of objects you create to describe your

The search algorithm evaluates the constraints, and for each violated constraint, it turns the `excess` value into a "score" by first passing it through the "score transfer function", which by default squares the value, and then multiplies by the value `Constraint.weight` (by default 1). The goal of the search is to minimize the sum of scores across all violated `Constraint`'s. The reason that the score is squared is that this leads the search algorithm to (slightly) favor reducing the excess of constraint violations that are "more in excess", i.e., it would reduce the total score more to reduce an excess from 4 to 3 (reducing the score from 4<sup>2</sup>=16 to 3<sup>2</sup>=9, a reduction of 16-9=7) than to reduce an excess from 2 to 1 (which reduces 2<sup>2</sup>=4 to 1<sup>2</sup>=1, a reduction of only 4-1=3).

The full search algorithm is described in the [API documentation for the function nuad.search.search_for_dna_sequences](https://dnadsd.readthedocs.io/en/latest/#search.search_for_dna_sequences).
The full search algorithm is described in the [API documentation for the function nuad.search.search_for_sequences](https://nuad.readthedocs.io/en/latest/#search.search_for_sequences).


## Constraint evaluations must be pure functions of their inputs
Expand Down
2 changes: 1 addition & 1 deletion nuad/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '0.4.1' # version line; WARNING: do not remove or change this line or comment
version = '0.4.2' # version line; WARNING: do not remove or change this line or comment
Loading

0 comments on commit 892dee4

Please sign in to comment.