Skip to content

Commit

Permalink
Merge pull request #256 from UC-Davis-molecular-computing/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dave-doty committed Dec 4, 2022
2 parents 786c809 + fea3b32 commit 13d4e0e
Show file tree
Hide file tree
Showing 4 changed files with 684 additions and 83 deletions.
32 changes: 32 additions & 0 deletions examples/domain_colors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import scadnano as sc


def create_design() -> sc.Design:
helices = [sc.Helix(max_offset=100) for _ in range(4)]
design = sc.Design(helices=helices, grid=sc.square)

red = sc.Color(255, 0, 0)
dark_red = sc.Color(150, 0, 0)
green = sc.Color(0, 255, 0)
dark_green = sc.Color(0, 150, 0)
blue = sc.Color(0, 0, 255)
dark_blue = sc.Color(0, 0, 150)
black = sc.Color(0, 0, 0)

design.draw_strand(0, 0) \
.extension_5p(num_bases=5).with_domain_color(red) \
.move(8).with_domain_color(green) \
.loopout(1, 5).with_domain_color(dark_blue) \
.move(-8).with_domain_color(dark_red) \
.cross(2) \
.move(8).with_domain_color(dark_green) \
.cross(3) \
.move(-8) \
.extension_3p(num_bases=5).with_domain_color(black) \
.with_color(blue)

return design

if __name__ == '__main__':
d = create_design()
d.write_scadnano_file(directory='output_designs')
24 changes: 24 additions & 0 deletions examples/output_designs/domain_colors.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "0.17.7",
"grid": "square",
"helices": [
{"max_offset": 100, "grid_position": [0, 0]},
{"max_offset": 100, "grid_position": [0, 1]},
{"max_offset": 100, "grid_position": [0, 2]},
{"max_offset": 100, "grid_position": [0, 3]}
],
"strands": [
{
"color": "#0000ff",
"domains": [
{"extension_num_bases": 5, "color": "#ff0000"},
{"helix": 0, "forward": true, "start": 0, "end": 8, "color": "#00ff00"},
{"loopout": 5, "color": "#000096"},
{"helix": 1, "forward": false, "start": 0, "end": 8, "color": "#960000"},
{"helix": 2, "forward": true, "start": 0, "end": 8, "color": "#009600"},
{"helix": 3, "forward": false, "start": 0, "end": 8},
{"extension_num_bases": 5, "color": "#000000"}
]
}
]
}
Loading

0 comments on commit 13d4e0e

Please sign in to comment.