Skip to content

Commit

Permalink
Merge branch '309-account-for-helix-group-rotation-properly-in-oxdnao…
Browse files Browse the repository at this point in the history
…xview-export' of https://github.com/UC-Davis-molecular-computing/scadnano-python-package into 309-account-for-helix-group-rotation-properly-in-oxdnaoxview-export
  • Loading branch information
dave-doty committed Oct 21, 2024
2 parents 20226d3 + a6fef70 commit 3d4ec8c
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 52 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
with:
activate-conda: true
- name: Install openpyxl,tabulate with conda
run: conda install openpyxl=3.0.10 tabulate=0.8.10
run: conda install openpyxl=3.1 tabulate=0.9
- name: Install docutils with conda
run: conda install docutils=0.16
run: conda install docutils=0.18
- name: Test with unittest
run: python -m unittest -v tests/scadnano_tests.py
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ channels:
- defaults
dependencies:
- python=3.7
- xlwt=1.3.0=py37_0
- pip
- pip:
- sphinx
Expand Down
2 changes: 0 additions & 2 deletions examples/1_staple_1_helix_origami_roll.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import math

import scadnano as sc

def create_design() -> sc.Design:
Expand Down
24 changes: 24 additions & 0 deletions examples/2_staple_2_helix_helixgroup_geometry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import scadnano as sc


def create_design() -> sc.Design:
group0 = sc.HelixGroup(grid=sc.square)
group1 = sc.HelixGroup(grid=sc.square, geometry=sc.Geometry(bases_per_turn=18),
position=sc.Position3D(0, 3, 0))
groups = {"group 0": group0, "group 1": group1}
helices = [sc.Helix(idx=idx, max_offset=40, group=group) for idx, group in
[(0, "group 0"), (1, "group 1")]]
design = sc.Design(helices=helices, groups=groups, strands=[])
design.draw_strand(0, 0).move(40)
design.draw_strand(0, 40).move(-40)
design.draw_strand(1, 0).move(40)
design.draw_strand(1, 40).move(-40)

return design


if __name__ == '__main__':
d = create_design()
d.write_scadnano_file(directory='output_designs')
d.from_scadnano_file('output_designs/2_staple_2_helix_helixgroup_geometry.sc')
print(f'design: {d.to_json()}')
2 changes: 1 addition & 1 deletion examples/idt-plates-explicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def main() -> None:
design = create_design()
design.write_scadnano_file(directory='output_designs')
design.write_idt_bulk_input_file(directory='idt')
design.write_idt_plate_excel_file(directory='idt', use_default_plates=False, only_strands_with_idt=True)
design.write_idt_plate_excel_file(directory='idt', use_default_plates=False, only_strands_with_vendor_fields=True)


if __name__ == '__main__':
Expand Down
46 changes: 46 additions & 0 deletions examples/output_designs/2_staple_2_helix_helixgroup_geometry.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"version": "0.19.4",
"groups": {
"group 0": {
"position": {"x": 0, "y": 0, "z": 0},
"grid": "square"
},
"group 1": {
"position": {"x": 0, "y": 3, "z": 0},
"grid": "square",
"geometry": {
"bases_per_turn": 18
}
}
},
"helices": [
{"group": "group 0", "grid_position": [0, 0]},
{"group": "group 1", "grid_position": [0, 0]}
],
"strands": [
{
"color": "#f74308",
"domains": [
{"helix": 0, "forward": true, "start": 0, "end": 40}
]
},
{
"color": "#57bb00",
"domains": [
{"helix": 0, "forward": false, "start": 0, "end": 40}
]
},
{
"color": "#888888",
"domains": [
{"helix": 1, "forward": true, "start": 0, "end": 40}
]
},
{
"color": "#32b86c",
"domains": [
{"helix": 1, "forward": false, "start": 0, "end": 40}
]
}
]
}
129 changes: 85 additions & 44 deletions scadnano/scadnano.py

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions tests/scadnano_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ def test_write_idt_plate_excel_file(self) -> None:
# add 10 strands in excess of 3 plates
for plate_type in [sc.PlateType.wells96, sc.PlateType.wells384]:
num_strands = 3 * plate_type.num_wells_per_plate() + 10
filename = f'test_excel_export_{plate_type.num_wells_per_plate()}.xlsx'
filename = f'tests/test_excel_export_{plate_type.num_wells_per_plate()}.xlsx'
max_offset = num_strands * strand_len
helices = [sc.Helix(max_offset=max_offset) for _ in range(1)]
design = sc.Design(helices=helices, strands=[], grid=sc.square)
Expand All @@ -1307,7 +1307,10 @@ def test_write_idt_plate_excel_file(self) -> None:

self.assertEqual(expected_wells + 1, sheet.max_row)

os.remove(filename)
try:
os.remove(filename)
except PermissionError as e:
print(f'could not remove file "{filename}" due to permission error')

def test_export_dna_sequences_extension_5p(self) -> None:
design = sc.Design(helices=[sc.Helix(max_offset=100)])
Expand Down
Binary file added tests/test_excel_export_384.xlsx
Binary file not shown.
Binary file removed tests/test_excel_export_96.xls
Binary file not shown.
Binary file added tests/test_excel_export_96.xlsx
Binary file not shown.

0 comments on commit 3d4ec8c

Please sign in to comment.