Skip to content

Commit 13d4e0e

Browse files
authored
Merge pull request #256 from UC-Davis-molecular-computing/dev
Dev
2 parents 786c809 + fea3b32 commit 13d4e0e

4 files changed

Lines changed: 684 additions & 83 deletions

File tree

examples/domain_colors.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import scadnano as sc
2+
3+
4+
def create_design() -> sc.Design:
5+
helices = [sc.Helix(max_offset=100) for _ in range(4)]
6+
design = sc.Design(helices=helices, grid=sc.square)
7+
8+
red = sc.Color(255, 0, 0)
9+
dark_red = sc.Color(150, 0, 0)
10+
green = sc.Color(0, 255, 0)
11+
dark_green = sc.Color(0, 150, 0)
12+
blue = sc.Color(0, 0, 255)
13+
dark_blue = sc.Color(0, 0, 150)
14+
black = sc.Color(0, 0, 0)
15+
16+
design.draw_strand(0, 0) \
17+
.extension_5p(num_bases=5).with_domain_color(red) \
18+
.move(8).with_domain_color(green) \
19+
.loopout(1, 5).with_domain_color(dark_blue) \
20+
.move(-8).with_domain_color(dark_red) \
21+
.cross(2) \
22+
.move(8).with_domain_color(dark_green) \
23+
.cross(3) \
24+
.move(-8) \
25+
.extension_3p(num_bases=5).with_domain_color(black) \
26+
.with_color(blue)
27+
28+
return design
29+
30+
if __name__ == '__main__':
31+
d = create_design()
32+
d.write_scadnano_file(directory='output_designs')
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"version": "0.17.7",
3+
"grid": "square",
4+
"helices": [
5+
{"max_offset": 100, "grid_position": [0, 0]},
6+
{"max_offset": 100, "grid_position": [0, 1]},
7+
{"max_offset": 100, "grid_position": [0, 2]},
8+
{"max_offset": 100, "grid_position": [0, 3]}
9+
],
10+
"strands": [
11+
{
12+
"color": "#0000ff",
13+
"domains": [
14+
{"extension_num_bases": 5, "color": "#ff0000"},
15+
{"helix": 0, "forward": true, "start": 0, "end": 8, "color": "#00ff00"},
16+
{"loopout": 5, "color": "#000096"},
17+
{"helix": 1, "forward": false, "start": 0, "end": 8, "color": "#960000"},
18+
{"helix": 2, "forward": true, "start": 0, "end": 8, "color": "#009600"},
19+
{"helix": 3, "forward": false, "start": 0, "end": 8},
20+
{"extension_num_bases": 5, "color": "#000000"}
21+
]
22+
}
23+
]
24+
}

0 commit comments

Comments
 (0)