Exporting IDT files with default values for idt fields no longer requires first modifying the Strand.idt field
It is no longer necessary to modify the design to set the field `Strand.idt` in each Strand before calling the methods that export DNA sequences in IDT-formatted files. For staple strands with no idt field, a reasonable default for each value will be chosen.
So it is now possible to do this:
python
import scadnano as sc
design = sc.Design(helices=[sc.Helix(max_offset=100) for _ in range(2)], grid=sc.square)
design.strand(0, 0).move(8).cross(1).move(-8)
design.strand(0, 16).move(-8).cross(1).move(8)
design.assign_dna(strands[0], 'A'*16)
design.assign_dna(strands[1], 'C'*16)
before the change, the next line would have skipped writing the two strands since they have no idt field set,
now, reasonable defaults are used, without requiring the side-effect of writing the field Strand.idt
design.write_idt_plate_excel_file()
to skip exporting strands that lack an idt field, specify the parameter only_strands_with_idt
below, only the newly added strand with T's will be exported; the previous two will not
design.strand(0, 24).move(8).cross(1).move(-8).with_idt('only_strand_to_export')
design.assign_dna(strands[2], 'T'*16)
design.write_idt_plate_excel_file(only_strands_with_idt=True)
This implies several changes in the API
- **BREAKING CHANGE:** Changed the export methods so that, by default (with no parameters specified), they behave differently. In particular, now by default they will export DNA sequences for *all staple strands* (i.e., non-scaffold), using the `idt` field of the Strand if it is present, and otherwise using reasonable defaults, the same defaults that previously were stored in the Strand by calling `Strand.set_default_idt()`.
- **BREAKING CHANGE:** Removed the following:
- field `Strand.use_default_idt`
- method `Strand.set_default_idt()`
- method `Design.set_default_idt()`
- parameter `use_idt_defaults` in function `origami_rectangle.create()`
Now, if you want to set a Strand to have an `idt` field, it must be explicit, although the `IDTFields` constructor only requires a `name` parameter, so it's as easy as `strand.idt = IDTFields('name_of_strand')` if you are happy with the defaults for other `idt` fields such as `idt.purification`.
- **BREAKING CHANGE:** Removed parameter `warning_on_non_idt_strands` from the IDT export methods on `Design`. Now, you can either ask those methods to skip exporting Strands lacking an `idt` field by setting the parameter `only_strands_with_idt` to True, or let all (non-scaffold) strands be exported by setting `only_strands_with_idt` to False (the default).
- Added parameter `export_scaffold` to DNA sequence export methods to allow the scaffold(s) to be exported (False by default).
`Crossover` class and bulk `Design.add_crossovers` method removed
- **BREAKING CHANGE:** (This one is unrelated to exporting IDT files; it is related to the circular strands implemented in [v0.13.4](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/releases/tag/v0.13.4).) Since circular strands make it easier to use the `Design.add_half_crossover` and `Design.add_full_crossover` methods, we have removed the method `Design.add_crossovers` and the type `Crossover`. Previously, that method helped avoid creating circular strands by allowing one to build up a list of Crossovers and add them in bulk, where adding them one at a time would have resulted in an intermediate circular strand, even if the final result had all linear strands. Now that circular strands are supported, this is no longer needed. The recommended method of adding many crossovers at once is simply to call `Design.add_half_crossover` and/or `Design.add_full_crossover` repeatedly, i.e., replace
python
crossovers = [
Crossover(helix=0, helix2=1, offset=16, forward=True, half=True),
Crossover(helix=0, helix2=1, offset=24, forward=False, half=True),
Crossover(helix=2, helix2=3, offset=32, forward=True),
Crossover(helix=2, helix2=3, offset=40, forward=False),
]
design.add_crossovers(crossovers)
with this instead:
python
design.add_half_crossover(helix=0, helix2=1, offset=16, forward=True)
design.add_half_crossover(helix=0, helix2=1, offset=24, forward=False)
design.add_full_crossover(helix=2, helix2=3, offset=32, forward=True)
design.add_full_crossover(helix=2, helix2=3, offset=40, forward=False)
Commits
- [[d2e924c](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/commit/d2e924cb79a75bea75e05d9e4fa226ea460e3eb8)]: closes #111: write_idt_plate_excel_file uses reasonable defaults even when some strands have no IDT field set; bumped version (David Doty) [157](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/pull/157)
- [[b52a046](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/commit/b52a0463164aefcd7e1a9eb6e9f796a91e18bbf4)]: updated examples to fully type annotate all functions and avoid name shadowing in if __name__=="__main__" blocks (David Doty) [#157](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/pull/157)
- [[87a47d5](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/commit/87a47d5da066a45dbc915b304bf92a494257ed24)]: fixed bug where scaffold property being lost when joining two strands (at least one of which was scaffold)by crossover; also reworked write_idt_plate_excel_file to work properly with default idt name if idt fields are not present in some strands (David Doty) [#157](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/pull/157)
- [[b17a6a1](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/commit/b17a6a1a3555001844ff13c87d4c51716ace76f8)]: minor documentation and identifier name updates (David Doty) [#157](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/pull/157)
- [[c6620df](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/commit/c6620dfbb87097892bac48a447e97cd25b2218e9)]: cleaned up old links in package docstring (David Doty) [#157](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/pull/157)
- [[e23f361](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/commit/e23f361d95ab14e20f92c09248b1c5ce41e40026)]: re-ran examples after last commit (David Doty) [#157](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/pull/157)
- [[0667935](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/commit/0667935c6e1fbe7d7b6436aa2cb6324dc7918ba1)]: inlined creation of empty design in tutorial script (David Doty) [#157](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/pull/157)
- [[424f478](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/commit/424f478cc49744c2397a62a4255aef6248e45c4d)]: Update scadnano.py (David Doty) [#157](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/pull/157)
- [[dd63418](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/commit/dd63418bd08a54331bde68c5fee444c2989d1ec7)]: made Loopout generic type parameterized by DomainLabel (David Doty) [#157](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/pull/157)
- [[7574058](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/commit/7574058a5cdb7b717a5da8d80b53f1295742e046)]: Update scadnano.py (David Doty) [#157](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/pull/157)
- [[9e32cd4](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/commit/9e32cd404cce18c1ac63c33517e2da2dedbe1527)]: fixed documentation of Strand.rotate_domains (David Doty) [#157](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/pull/157)
- [[3da17ec](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/commit/3da17ec4d3508b4b0d074ae5d7d902cf92f4c3a9)]: Merge branch 'dev' into write_idt_plate_excel_file-uses-reasonable-defaults (David Doty) [#157](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/pull/157)