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

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

generate plate map #210

Closed dave-doty closed 2 years ago

dave-doty commented 2 years ago

If IDT fields are specified with plate and well positions, scadnano should be able to write a plate map showing strand names in the well positions.

TODO: draw a mockup figure of how this should look.

dave-doty commented 2 years ago

Release notes

Plate maps

You can now print a plate map of all or some of the strands in the design that have Strand.idt.plate and Strand.idt.well specified.

For example, the following code:

import scadnano as sc

helices = [sc.Helix(max_offset=100)]
design = sc.Design(helices=helices, strands=[], grid=sc.square)
design.draw_strand(0, 0).move(10).with_name('strand 0').with_idt(plate='plate 1', well='A1')
design.draw_strand(0, 10).move(10).with_name('strand 1').with_idt(plate='plate 1', well='A2')
design.draw_strand(0, 20).move(10).with_name('strand 2').with_idt(plate='plate 1', well='B2')
design.draw_strand(0, 30).move(10).with_name('strand 3').with_idt(plate='plate 1', well='B3')
design.draw_strand(0, 40).move(10).with_name('strand 4').with_idt(plate='plate 1', well='D7')

# plate_maps = design.plate_maps_markdown(well_marker='X', strands=[design.strands[0], design.strands[3]])
plate_maps = design.plate_maps_markdown()
plate_map = plate_maps['plate 1']
print(plate_map)

prints the following Markdown representation of the plate:

## plate 1
|     | 1        | 2        | 3        | 4   | 5   | 6   | 7        | 8   | 9   | 10   | 11   | 12   |
|-----|----------|----------|----------|-----|-----|-----|----------|-----|-----|------|------|------|
| A   | strand 0 | strand 1 |          |     |     |     |          |     |     |      |      |      |
| B   |          | strand 2 | strand 3 |     |     |     |          |     |     |      |      |      |
| C   |          |          |          |     |     |     |          |     |     |      |      |      |
| D   |          |          |          |     |     |     | strand 4 |     |     |      |      |      |
| E   |          |          |          |     |     |     |          |     |     |      |      |      |
| F   |          |          |          |     |     |     |          |     |     |      |      |      |
| G   |          |          |          |     |     |     |          |     |     |      |      |      |
| H   |          |          |          |     |     |     |          |     |     |      |      |      |

One can specify only a subset of strands, and use a different entry than the strand's name:

plate_maps = design.plate_maps_markdown(well_marker='X', strands=[design.strands[0], design.strands[3]])

which prints

## plate 1
|     | 1   | 2   | 3   | 4   | 5   | 6   | 7   | 8   | 9   | 10   | 11   | 12   |
|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------|------|------|
| A   | X   |     |     |     |     |     |     |     |     |      |      |      |
| B   |     |     | X   |     |     |     |     |     |     |      |      |      |
| C   |     |     |     |     |     |     |     |     |     |      |      |      |
| D   |     |     |     |     |     |     |     |     |     |      |      |      |
| E   |     |     |     |     |     |     |     |     |     |      |      |      |
| F   |     |     |     |     |     |     |     |     |     |      |      |      |
| G   |     |     |     |     |     |     |     |     |     |      |      |      |
| H   |     |     |     |     |     |     |     |     |     |      |      |      |