UC-Davis-molecular-computing / scadnano-python-package

Python scripting library for generating designs readable by scadnano.
https://scadnano.org
MIT License
14 stars 7 forks source link

Write idt plate excel file uses reasonable defaults #157

Closed dave-doty closed 3 years ago

dave-doty commented 3 years ago

Release notes for when this gets merged into master:

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:

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