From 2b11342938f225b47d9fbdbfbfb8f0b910ee30d0 Mon Sep 17 00:00:00 2001 From: David Doty Date: Wed, 9 Aug 2023 14:04:52 -0700 Subject: [PATCH 01/10] bumped version --- scadnano/scadnano.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scadnano/scadnano.py b/scadnano/scadnano.py index a4b73ff..0246253 100644 --- a/scadnano/scadnano.py +++ b/scadnano/scadnano.py @@ -53,7 +53,7 @@ # needed to use forward annotations: https://docs.python.org/3/whatsnew/3.7.html#whatsnew37-pep563 from __future__ import annotations -__version__ = "0.18.0" # version line; WARNING: do not remove or change this line or comment +__version__ = "0.18.1" # version line; WARNING: do not remove or change this line or comment import collections import dataclasses From 123e0011a7591aaf3f85c18ab8394a7b90e8fc8d Mon Sep 17 00:00:00 2001 From: David Doty Date: Wed, 16 Aug 2023 12:53:12 -0700 Subject: [PATCH 02/10] closes #257: automatically set Helix rolls based on crossover locations (relax the rolls) --- examples/output_designs/relax_helix_rolls.sc | 40 ++ examples/relax_helix_rolls.py | 78 ++++ scadnano/scadnano.py | 220 ++++++++++- tests/scadnano_tests.py | 394 +++++++++++++++++++ 4 files changed, 724 insertions(+), 8 deletions(-) create mode 100644 examples/output_designs/relax_helix_rolls.sc create mode 100644 examples/relax_helix_rolls.py diff --git a/examples/output_designs/relax_helix_rolls.sc b/examples/output_designs/relax_helix_rolls.sc new file mode 100644 index 0000000..0b3a949 --- /dev/null +++ b/examples/output_designs/relax_helix_rolls.sc @@ -0,0 +1,40 @@ +{ + "version": "0.18.1", + "grid": "square", + "helices": [ + { + "max_offset": 60, + "grid_position": [0, 0], + "roll": 40.71428571400003, + "major_ticks": [0, 5, 13] + }, + { + "max_offset": 60, + "grid_position": [0, 1], + "roll": 72.85714285699999, + "major_ticks": [0, 5, 13] + }, + { + "max_offset": 60, + "grid_position": [1, 0], + "roll": 68.57142857100001, + "major_ticks": [0, 5, 13] + } + ], + "strands": [ + { + "color": "#f74308", + "domains": [ + {"helix": 0, "forward": true, "start": 0, "end": 5}, + {"helix": 1, "forward": false, "start": 0, "end": 5} + ] + }, + { + "color": "#57bb00", + "domains": [ + {"helix": 0, "forward": true, "start": 5, "end": 13}, + {"helix": 2, "forward": false, "start": 5, "end": 13} + ] + } + ] +} \ No newline at end of file diff --git a/examples/relax_helix_rolls.py b/examples/relax_helix_rolls.py new file mode 100644 index 0000000..bf16edd --- /dev/null +++ b/examples/relax_helix_rolls.py @@ -0,0 +1,78 @@ +import scadnano as sc +import modifications as mod +import dataclasses + + +def create_design() -> sc.Design: + # ''' + # 0123456789012345678901234567890123456789 + # 0 [---+[--------+[----------+ + # | | | + # 1 [---+<--------+<----------+ + # + # angle (fraction of 360) + # 5/10.5 + # (15-10.5)/10.5 = 4.5/10.5 + # (27-21)/10.5 = 6/10.5 + # ''' + # design2h = sc.Design(helices=[sc.Helix(max_offset=50) for _ in range(2)], grid=sc.square) + # # helix 0 forward + # design2h.draw_strand(0, 0).move(5).cross(1).move(-5) + # design2h.draw_strand(0, 5).move(10).cross(1).move(-10) + # design2h.draw_strand(0, 15).move(12).cross(1).move(-12) + # + # for helix in design2h.helices.values(): + # helix.major_ticks = [0, 5, 15, 27] + # + # design2h.relax_helix_rolls() + + ''' + 0 1 2 3 4 5 6 + 012345678901234567890123456789012345678901234567890123456789 + 0 [---+[--------+[----------+[------+[--------+[--------+ + | | | | | | + 1 [---+<--------+<----------+ | | | + | | | + 2 <------+<--------+<--------+ + + angle (fraction of 360) + 5/10.5 + (15-10.5)/10.5 = 4.5/10.5 + (27-21)/10.5 = 6/10.5 + ''' + helices = [sc.Helix(max_offset=60) for _ in range(3)] + helices[2].grid_position = (1, 0) + design3h = sc.Design(helices=helices, grid=sc.square) + + # helix 0 forward + design3h.draw_strand(0, 0).move(5).cross(1).move(-5) + design3h.draw_strand(0, 5).move(10).cross(1).move(-10) + design3h.draw_strand(0, 15).move(12).cross(1).move(-12) + design3h.draw_strand(0, 27).move(7).cross(2).move(-7) + design3h.draw_strand(0, 34).move(10).cross(2).move(-10) + design3h.draw_strand(0, 44).move(10).cross(2).move(-10) + + for helix in design3h.helices.values(): + helix.major_ticks = [0, 5, 15, 27, 34, 44, 54] + + design3h.relax_helix_rolls() + + # return design3h + + helices = [sc.Helix(max_offset=60) for _ in range(3)] + helices[2].grid_position = (1, 0) + design3h2 = sc.Design(helices=helices, grid=sc.square) + design3h2.draw_strand(0, 0).move(5).cross(1).move(-5) + design3h2.draw_strand(0, 5).move(8).cross(2).move(-8) + + for helix in design3h2.helices.values(): + helix.major_ticks = [0, 5, 13] + + design3h2.relax_helix_rolls() + + return design3h2 + + +if __name__ == '__main__': + d = create_design() + d.write_scadnano_file(directory='output_designs') diff --git a/scadnano/scadnano.py b/scadnano/scadnano.py index 0246253..5c7659b 100644 --- a/scadnano/scadnano.py +++ b/scadnano/scadnano.py @@ -62,6 +62,8 @@ import enum import itertools import re +import math +import cmath from builtins import ValueError from dataclasses import dataclass, field, InitVar, replace from typing import Iterator, Tuple, List, Sequence, Iterable, Set, Dict, Union, Optional, Type, cast, Any, \ @@ -328,9 +330,6 @@ class Grid(str, enum.Enum): Represents default patterns for laying out helices in the side view. Each :any:`Grid` except :py:data:`Grid.none` has an interpretation of a "grid position", which is a 2D integer coordinate (`h`, `v`). - (scadnano also allows a 3rd coordinate (`h`, `v`, `b`) specifying a "base offset" at which to position - the start of the :any:`Helix`, which is not relevant for the side view but will eventually be - supported to adjust the main view.) """ square = "square" @@ -1195,7 +1194,7 @@ def from_json(json_map: Dict[str, Any]) -> Position3D: z = json_map[position_z_key] return Position3D(x=x, y=y, z=z) - def __add__(self, other: 'Position3D') -> 'Position3D': + def __add__(self, other: Position3D) -> Position3D: """ :param other: other position to add to this one @@ -1204,7 +1203,7 @@ def __add__(self, other: 'Position3D') -> 'Position3D': """ return Position3D(self.x + other.x, self.y + other.y, self.z + other.z) - def clone(self) -> 'Position3D': + def clone(self) -> Position3D: """ :return: copy of this :any:`Position3D` @@ -1692,6 +1691,26 @@ def calculate_major_ticks(self, grid: Grid) -> List[int]: distance = default_major_tick_distance(grid) return list(range(self.major_tick_start, self.max_offset + 1, distance)) + def calculate_position(self, grid: Grid, geometry: Optional[Geometry] = None) -> Position3D: + """ + :param grid: + :any:`Grid` of this :any:`Helix` used to interpret the field :data:`Helix.grid_position`. + Must be None if :data:`Helix.grid_position` is None. + :param geometry: + :any:`Geometry` parameters to determine distance between helices in a grid. + Must be None if :data:`Helix.grid_position` is None. + :return: + Position of this :any:`Helix` in 3D space, based on its :data:`Helix.grid_position` + if it is not None, or its :data:`Helix.position` otherwise. + """ + if self.grid_position is None: + assert grid == Grid.none + return self.position + else: + assert grid is not None + assert geometry is not None + return grid_position_to_position(self.grid_position, grid, geometry) + @property def domains(self) -> List[Domain]: """ @@ -1735,8 +1754,184 @@ def backbone_angle_at_offset(self, offset: int, forward: bool, geometry: Geometr angle = self.roll + offset * degrees_per_base if not forward: angle += geometry.minor_groove_angle + angle %= 360 return angle + def crossovers(self) -> List[Tuple[int, int, bool]]: + """ + :return: + list of triples (`offset`, `helix_idx`, `forward`) of all crossovers incident to this + :any:`Helix`, where `offset` is the offset of the crossover and `helix_idx` is the + :data:`Helix.idx` of the other :any:`Helix` incident to the crossover. + """ + crossovers: List[Tuple[int, int, bool]] = [] + for domain in self.domains: + strand = domain.strand() + domains = strand.bound_domains() + num_domains = len(domains) + domain_idx = domains.index(domain) + + # if not first domain, then there is a crossover to the previous domain + if domain_idx > 0: + offset = domain.offset_5p() + other_domain = domains[domain_idx - 1] + other_helix_idx = other_domain.helix + crossovers.append((offset, other_helix_idx, domain.forward)) + + # if not last domain, then there is a crossover to the next domain + if domain_idx < num_domains - 1: + offset = domain.offset_3p() + other_domain = domains[domain_idx + 1] + other_helix_idx = other_domain.helix + crossovers.append((offset, other_helix_idx, domain.forward)) + + return crossovers + + def relax_roll(self, helices: Dict[int, Helix], grid: Grid, geometry: Geometry) -> None: + """ + Like :meth:`Design.relax_helix_rolls`, but only for this :any:`Helix`. + """ + angle = self.compute_relaxed_roll(helices, grid, geometry) + self.roll = angle + + def compute_relaxed_roll(self, helices: Dict[int, Helix], grid: Grid, geometry: Geometry) -> float: + """ + Like :meth:`Helix.relax_roll`, but just returns the new roll without altering this :any:`Helix`, + rather than changing the field :data:`Helix.roll`. + """ + angles = [] + for offset, helix_idx, forward in self.crossovers(): + other_helix = helices[helix_idx] + angle_of_other_helix = angle_from_helix_to_helix(self, other_helix, grid, geometry) + crossover_angle = self.backbone_angle_at_offset(offset, forward, geometry) + relative_angle = (crossover_angle, angle_of_other_helix) + angles.append(relative_angle) + angle = minimum_strain_angle(angles) + return angle + + +def angle_from_helix_to_helix(helix: Helix, other_helix: Helix, + grid: Optional[Grid] = None, geometry: Optional[Geometry] = None) -> float: + """ + Computes angle between `helix` and `other_helix` in degrees. + + :param helix: + first helix + :param other_helix: + second helix + :param grid: + :any:`Grid` to use when calculating Helix positions + :param geometry: + :any:`Geometry` to use when calculating Helix positions + :return: + angle between `helix` and `other_helix` in degrees. + """ + p1 = helix.calculate_position(grid, geometry) + p2 = other_helix.calculate_position(grid, geometry) + + # negate y_diff because y increases going down in the main view + y_diff = -(p2.y - p1.y) + x_diff = p2.x - p1.x + + angle = math.degrees(math.atan2(y_diff, x_diff)) + + # negate angle because we rotate clockwise + angle = -angle + + # subtract 90 since we define 0 angle to be up instead of right + angle += 90 + + # normalize to be in range [0, 360) + angle %= 360 + + return angle + + +def minimum_strain_angle(relative_angles: List[Tuple[float, float]]) -> float: + r""" + Computes the angle that minimizes the "strain" of all relative angles in the given list. + + A "relative angle" is a pair :math:`(\theta, \mu)`. The strain is set to 0 by setting + :math:`\theta = \mu`; more generally the strain is :math:`(\theta-\mu)^2`, where :math:`\theta-\mu` + is the "angular difference" (e.g., 10-350 is 20 since 350 is also -10 mod 360). + + The constraint is that in the list + [:math:`(\theta_1, \mu_1)`, :math:`(\theta_2, \mu_2)`, ..., :math:`(\theta_n, \mu_n)`], + we can rotate all angles :math:`\theta_i` by the same amount :math:`\theta`. + So this calculates the angle :math:`\theta` that minimizes + :math:`\sum_i [(\theta + \theta_i) - \mu_i]^2` + + :param relative_angles: + List of :math:`(\theta_i, \mu_i)` pairs, where :math:`\theta_i = \mu_i` means 0 strain, and angles + are in units of degrees. + :return: + angle :math:`\theta` by which to rotate all angles :math:`\theta_i` + (but not changing any "zero angle" :math:`\mu_i`) + such that :math:`\sum_i [(\theta + \theta_i) - \mu_i]^2` is minimized. + """ + adjusted_angles = [angle - zero_angle for angle, zero_angle in relative_angles] + ave_angle = average_angle(adjusted_angles) + min_strain_angle = -ave_angle + min_strain_angle %= 360 + return min_strain_angle + + +def angle_distance(x: float, y: float) -> float: + """ + :param x: angle in degrees + :param y: angle in degrees + :return: signed difference between angles `x` and `y`, in degrees, in range [-180, 180] + """ + a = (x - y) % 360 + b = (y - x) % 360 + diff = -a if a < b else b + return diff + + +def sum_squared_angle_distances(angles: List[float], angle: float) -> float: + """ + :param angles: list of angles in degrees + :param angle: angle in degrees + :return: sum of squared distances from each angle in `angles` to `angle` + """ + return sum(angle_distance(angle, a) ** 2 for a in angles) + + +def average_angle(angles: List[float]) -> float: + """ + Calculate the "circular mean" of the angles in `angles`. Note this coincides with the arithemtic mean + for certain lists of angles, e.g., [0, 10, 50], in a way that the circular mean calculated via + interpreting angles as unit vectors (https://en.wikipedia.org/wiki/Circular_mean) does not. + + This algorithm is due to Julian Panetta. (https://julianpanetta.com/) + + :param angles: + List of angles in degrees. + :return: + average angle of the list of angles, normalized to be between 0 and 360. + """ + num_angles = len(angles) + mean_angle = sum(angles) / num_angles + min_dist = float('inf') + optimal_angle = 0 + for n in range(num_angles): + candidate_angle = mean_angle + 360.0 * n / num_angles + candidate_dist = sum_squared_angle_distances(angles, candidate_angle) + if min_dist > candidate_dist: + min_dist = candidate_dist + optimal_angle = candidate_angle + + optimal_angle %= 360.0 + + # taking mod 360 sometimes results in 360.0 instead of 0.0. This is hacky but fixes it. + if abs(360.0 - optimal_angle) < 10 ** (-8): + optimal_angle = 0.0 + + # in case it's a nice round number, let's get rid of the floating-point error artifacts here + optimal_angle = round(optimal_angle, 9) + + return optimal_angle + def _is_close(x1: float, x2: float) -> bool: return abs(x1 - x2) < _floating_point_tolerance @@ -8164,9 +8359,6 @@ def strand_with_name(self, name: str) -> Optional[Strand]: return strand return None - def grid_of_helix(self, helix): - pass - def add_helix(self, idx: int, helix: Helix) -> None: """ Adds `helix` as a new :any:`Helix` with index `idx` to this Design. @@ -8192,6 +8384,18 @@ def add_helix(self, idx: int, helix: Helix) -> None: self._set_helices_grid_positions_or_positions() self._assign_default_helices_view_orders_to_groups() + def relax_helix_rolls(self) -> None: + """ + Sets all helix rolls to "relax" them based on their crossovers. + + This calculates the "strain" of each crossover c as the absolute value d_c of the distance between + the angle to the helix to which it is connected and the angle of that crossover given the + current helix roll. It minimizes sum_c d_c^2, i.e., minimize the sum of the squares of the strains. + """ + for helix in self.helices.values(): + helix_group = self.groups[helix.group] + helix.relax_roll(self.helices, helix_group.grid, self.geometry) + def _find_index_pair_same_object(elts: Union[List, Dict]) -> Optional[Tuple]: # return pair of indices representing same object in elts, or None if they do not exist diff --git a/tests/scadnano_tests.py b/tests/scadnano_tests.py index a8e3fd5..0091848 100644 --- a/tests/scadnano_tests.py +++ b/tests/scadnano_tests.py @@ -8135,3 +8135,397 @@ def test_base_pairs_on_forward_strand_ahead_of_reverse_strand(self) -> None: self.assertIn(3, base_pairs[0]) self.assertIn(4, base_pairs[0]) self.assertIn(5, base_pairs[0]) + + +class TestHelixRollRelax(unittest.TestCase): + + def setUp(self) -> None: + ''' + 0123456789012345678901234567890123456789 + 0 [---+[--------+[----------+ + | | | + 1 [---+<--------+<----------+ + + angle (fraction of 360) + 4/10.5 + (14-10.5)/10.5 = 3.5/10.5 + (26-21)/10.5 = 5/10.5 + ''' + self.design2h = sc.Design(helices=[sc.Helix(max_offset=50) for _ in range(2)]) + # helix 0 forward + self.design2h.draw_strand(0, 0).move(5).cross(1).move(-5) + self.design2h.draw_strand(0, 5).move(10).cross(1).move(-10) + self.design2h.draw_strand(0, 15).move(12).cross(1).move(-12) + + ''' + 0123456789012345678901234567890123456789 + 0 [---+[--------+[----------+ + | | | + 1 [---+ |<----------+ + | + 2 <--------+ + ''' + self.design3helix3strand = sc.Design(helices=[sc.Helix(max_offset=50) for _ in range(3)]) + # helix 0 forward + self.design3helix3strand.draw_strand(0, 0).move(5).cross(1).move(-5) + self.design3helix3strand.draw_strand(0, 5).move(10).cross(2).move(-10) + self.design3helix3strand.draw_strand(0, 15).move(12).cross(1).move(-12) + + def test_3_helix_2_crossovers(self) -> None: + ''' + 0 1 + 012345678901234 + 0 [---+[------+ + | | + 1 [---+ | + | + 2 <------+ + ''' + helices = [sc.Helix(max_offset=60) for _ in range(3)] + helices[2].grid_position = (1, 0) + design3h = sc.Design(helices=helices, grid=sc.square) + design3h.draw_strand(0, 0).move(5).cross(1).move(-5) + design3h.draw_strand(0, 5).move(8).cross(2).move(-8) + f1 = 4 / 10.5 + f2 = 12 / 10.5 + a1 = f1 * 360 % 360 + a2 = f2 * 360 % 360 + + # rules for angles: + # - add 150 if on reverse strand to account of minor groove + # - subtract angle of helix crossover is connecting to + + ave_h0 = (a1 - 180 + a2 - 90) / 2 # helix 1 at 180 degrees, helix 2 at 90 degrees + exp_h0_roll = (-ave_h0) % 360 + + ave_h1 = a1 + 150 # helix 0 at 0 degrees relative to helix 1 + exp_h1_roll = (-ave_h1) % 360 + + ave_h2 = a2 + 150 - (-90) # helix 0 at -90 degrees relative to helix 2 + exp_h2_roll = (-ave_h2) % 360 + + design3h.relax_helix_rolls() + + self.assertAlmostEqual(exp_h0_roll, design3h.helices[0].roll) + self.assertAlmostEqual(exp_h1_roll, design3h.helices[1].roll) + self.assertAlmostEqual(exp_h2_roll, design3h.helices[2].roll) + + def test_3_helix_6_crossover(self) -> None: + ''' + 0 1 2 3 4 5 6 + 012345678901234567890123456789012345678901234567890123456789 + 0 [---+[--------+[----------+[------+[--------+[--------+ + | | | | | | + 1 [---+<--------+<----------+ | | | + | | | + 2 <------+<--------+<--------+ + + angle (fraction of 360) + 4/10.5 + (15-10.5)/10.5 = 4.5/10.5 + (27-21)/10.5 = 6/10.5 + ''' + helices = [sc.Helix(max_offset=60) for _ in range(3)] + helices[2].grid_position = (1, 0) + design3h = sc.Design(helices=helices, grid=sc.square) + design3h.draw_strand(0, 0).move(5).cross(1).move(-5) + design3h.draw_strand(0, 5).move(10).cross(1).move(-10) + design3h.draw_strand(0, 15).move(12).cross(1).move(-12) + design3h.draw_strand(0, 27).move(7).cross(2).move(-7) + design3h.draw_strand(0, 34).move(10).cross(2).move(-10) + design3h.draw_strand(0, 44).move(10).cross(2).move(-10) + + f1 = 4 / 10.5 + f2 = 14 / 10.5 + f3 = 26 / 10.5 + f4 = 33 / 10.5 + f5 = 43 / 10.5 + f6 = 53 / 10.5 + a1 = f1 * 360 % 360 + a2 = f2 * 360 % 360 + a3 = f3 * 360 % 360 + a4 = f4 * 360 % 360 + a5 = f5 * 360 % 360 + a6 = f6 * 360 % 360 + + # rules for angles: + # - add 150 if on reverse strand to account of minor groove + # - subtract angle of helix crossover is connecting to + + ave_h0 = (a1 - 180 + a2 - 180 + a3 - 180 + a4 - 90 + a5 - 90 + a6 - 90) / 6 + exp_h0_roll = (-ave_h0) % 360 + + ave_h1 = (a1 + 150 + a2 + 150 + a3 + 150) / 3 + exp_h1_roll = (-ave_h1) % 360 + + ave_h2 = (a4 + 150 - (- 90) + a5 + 150 - (- 90) + a6 + 150 - (- 90)) / 3 + exp_h2_roll = (-ave_h2) % 360 + + design3h.relax_helix_rolls() + + self.assertAlmostEqual(exp_h0_roll, design3h.helices[0].roll) + self.assertAlmostEqual(exp_h1_roll, design3h.helices[1].roll) + self.assertAlmostEqual(exp_h2_roll, design3h.helices[2].roll) + + def test_2_helix_3_crossover(self) -> None: + f1 = 4 / 10.5 + f2 = 14 / 10.5 + f3 = 26 / 10.5 + a1 = f1 * 360 % 360 + a2 = f2 * 360 % 360 + a3 = f3 * 360 % 360 + + ave = (a1 + a2 + a3) / 3 + diff_from_optimal = 180 - ave + + self.design2h.relax_helix_rolls() + actual_h0_roll = self.design2h.helices[0].roll % 360 + actual_h1_roll = self.design2h.helices[1].roll % 360 + exp_h0_roll = diff_from_optimal % 360 + # add 180 since optimal roll of bottom helix is opposite that of top + # subtract minor_groove_angle since it's the reverse strand on the bottom helix + exp_h1_roll = (diff_from_optimal + 180 - self.design2h.geometry.minor_groove_angle) % 360 + self.assertAlmostEqual(exp_h0_roll, actual_h0_roll) + self.assertAlmostEqual(exp_h1_roll, actual_h1_roll) + + def test_helix_crossovers(self) -> None: + ############################################ + # 3-helix design with 3 strands + xs0 = self.design3helix3strand.helices[0].crossovers() + self.assertEqual(len(xs0), 3) + o0, h0, f0 = xs0[0] + o1, h1, f1 = xs0[1] + o2, h2, f2 = xs0[2] + self.assertEqual(o0, 4) + self.assertEqual(o1, 14) + self.assertEqual(o2, 26) + self.assertEqual(h0, 1) + self.assertEqual(h1, 2) + self.assertEqual(h2, 1) + self.assertEqual(f0, True) + self.assertEqual(f1, True) + self.assertEqual(f2, True) + + xs1 = self.design3helix3strand.helices[1].crossovers() + self.assertEqual(len(xs1), 2) + o0, h0, f0 = xs1[0] + o1, h1, f1 = xs1[1] + self.assertEqual(o0, 4) + self.assertEqual(o1, 26) + self.assertEqual(h0, 0) + self.assertEqual(h1, 0) + self.assertEqual(f0, False) + self.assertEqual(f1, False) + + xs2 = self.design3helix3strand.helices[2].crossovers() + self.assertEqual(len(xs2), 1) + o0, h0, f0 = xs2[0] + self.assertEqual(o0, 14) + self.assertEqual(h0, 0) + self.assertEqual(h0, False) + + ############################################ + # 2-helix design + xs0 = self.design2h.helices[0].crossovers() + self.assertEqual(len(xs0), 3) + o0, h0, f0 = xs0[0] + o1, h1, f1 = xs0[1] + o2, h2, f2 = xs0[2] + self.assertEqual(o0, 4) + self.assertEqual(o1, 14) + self.assertEqual(o2, 26) + self.assertEqual(h0, 1) + self.assertEqual(h1, 1) + self.assertEqual(h2, 1) + self.assertEqual(h0, True) + self.assertEqual(h1, True) + self.assertEqual(h2, True) + + xs1 = self.design2h.helices[1].crossovers() + self.assertEqual(len(xs1), 3) + o0, h0, f0 = xs1[0] + o1, h1, f1 = xs1[1] + o2, h2, f2 = xs1[2] + self.assertEqual(o0, 4) + self.assertEqual(o1, 14) + self.assertEqual(o2, 26) + self.assertEqual(h0, 0) + self.assertEqual(h1, 0) + self.assertEqual(h2, 0) + self.assertEqual(f0, False) + self.assertEqual(f1, False) + self.assertEqual(f2, False) + + def test_minimum_strain_angle_0_10_20_relative_to_0(self) -> None: + relative_angles = [ + (0, 0), + (10, 0), + (20, 0), + ] + act_min_strain_angle = sc.minimum_strain_angle(relative_angles) + exp_min_strain_angle = 350.0 + self.assertAlmostEqual(exp_min_strain_angle, act_min_strain_angle) + + def test_minimum_strain_angle_0_10_50_relative_to_0(self) -> None: + relative_angles = [ + (0, 0), + (10, 0), + (50, 0), + ] + act_min_strain_angle = sc.minimum_strain_angle(relative_angles) + exp_min_strain_angle = 340.0 + self.assertAlmostEqual(exp_min_strain_angle, act_min_strain_angle) + + def test_minimum_strain_angle_0_10_80_relative_to_0(self) -> None: + relative_angles = [ + (0, 0), + (10, 0), + (80, 0), + ] + act_min_strain_angle = sc.minimum_strain_angle(relative_angles) + exp_min_strain_angle = 330.0 + self.assertAlmostEqual(exp_min_strain_angle, act_min_strain_angle) + + def test_minimum_strain_angle_350_0_10_relative_to_0(self) -> None: + relative_angles = [ + (350, 0), + (0, 0), + (10, 0), + ] + act_min_strain_angle = sc.minimum_strain_angle(relative_angles) + exp_min_strain_angle = 0.0 + self.assertAlmostEqual(exp_min_strain_angle, act_min_strain_angle) + + def test_minimum_strain_angle_350_0_40_relative_to_0(self) -> None: + relative_angles = [ + (350, 0), + (0, 0), + (40, 0), + ] + act_min_strain_angle = sc.minimum_strain_angle(relative_angles) + exp_min_strain_angle = 350.0 + self.assertAlmostEqual(exp_min_strain_angle, act_min_strain_angle) + + def test_minimum_strain_angle_350_10_60_relative_to_0(self) -> None: + relative_angles = [ + (350, 0), + (10, 0), + (60, 0), + ] + act_min_strain_angle = sc.minimum_strain_angle(relative_angles) + exp_min_strain_angle = 340.0 + self.assertAlmostEqual(exp_min_strain_angle, act_min_strain_angle) + + def test_minimum_strain_angle_350_10_60_relative_to_0_and_20_0_310_relative_to_10(self) -> None: + relative_angles = [ + (350, 0), # -10 + (10, 0), # 10 + (60, 0), # 60 + ############ ave to 20 + (20, 10), # 10 + (0, 10), # -10 + (340, 10), # -30 + ############ ave to -10 + ############ total average is (20-10)/2 = 5, so 355 (-5) to correct it + ] + act_min_strain_angle = sc.minimum_strain_angle(relative_angles) + exp_min_strain_angle = 355.0 + self.assertAlmostEqual(exp_min_strain_angle, act_min_strain_angle) + + def test_minimum_strain_angle_179_181_relative_to_0(self) -> None: + relative_angles = [ + (179, 0), + (181, 0), + ] + act_min_strain_angle = sc.minimum_strain_angle(relative_angles) + exp_min_strain_angle = 180.0 + self.assertAlmostEqual(exp_min_strain_angle, act_min_strain_angle) + + def test_minimum_strain_angle_181_183_relative_to_0(self) -> None: + relative_angles = [ + (181, 0), + (183, 0), + ] + act_min_strain_angle = sc.minimum_strain_angle(relative_angles) + exp_min_strain_angle = 178.0 + self.assertAlmostEqual(exp_min_strain_angle, act_min_strain_angle) + + def test_minimum_strain_angle_174_179_184_relative_to_0(self) -> None: + relative_angles = [ + (174, 0), + (179, 0), + (184, 0), + ] + act_min_strain_angle = sc.minimum_strain_angle(relative_angles) + exp_min_strain_angle = 181.0 + self.assertAlmostEqual(exp_min_strain_angle, act_min_strain_angle) + + def test_average_angle_1_359(self) -> None: + angles = [1, 359] + act_ave_angle = sc.average_angle(angles) + exp_ave_angle = 0.0 + self.assertAlmostEqual(exp_ave_angle, act_ave_angle) + + def test_average_angle_10_350(self) -> None: + angles = [10, 350] + act_ave_angle = sc.average_angle(angles) + exp_ave_angle = 0.0 + self.assertAlmostEqual(exp_ave_angle, act_ave_angle) + + def test_average_angle_30_350(self) -> None: + angles = [30, 350] + act_ave_angle = sc.average_angle(angles) + exp_ave_angle = 10.0 + self.assertAlmostEqual(exp_ave_angle, act_ave_angle) + + def test_average_angle_0_10_20(self) -> None: + angles = [0, 10, 20] + act_ave_angle = sc.average_angle(angles) + exp_ave_angle = 10.0 + self.assertAlmostEqual(exp_ave_angle, act_ave_angle) + + def test_average_angle_0_0_90(self) -> None: + angles = [0, 0, 90] + act_ave_angle = sc.average_angle(angles) + # exp_ave_angle_radians = math.atan2(1, 2) + # exp_ave_angle = math.degrees(exp_ave_angle_radians) + exp_ave_angle = 30.0 + self.assertAlmostEqual(exp_ave_angle, act_ave_angle) + + def test_average_angle_0_45_90(self) -> None: + angles = [0, 45, 90] + act_ave_angle = sc.average_angle(angles) + # exp_ave_angle_radians = math.atan2(1, 2) + # exp_ave_angle = math.degrees(exp_ave_angle_radians) + exp_ave_angle = 45.0 + self.assertAlmostEqual(exp_ave_angle, act_ave_angle) + + def test_average_angle_0_10_50(self) -> None: + angles = [0, 10, 50] + act_ave_angle = sc.average_angle(angles) + exp_ave_angle = 20.0 + self.assertAlmostEqual(exp_ave_angle, act_ave_angle) + + def test_average_angle_0_10_80(self) -> None: + angles = [0, 10, 80] + act_ave_angle = sc.average_angle(angles) + exp_ave_angle = 30.0 + self.assertAlmostEqual(exp_ave_angle, act_ave_angle) + + def test_average_angle_350_0_40(self) -> None: + angles = [350, 0, 40] + act_ave_angle = sc.average_angle(angles) + exp_ave_angle = 10.0 + self.assertAlmostEqual(exp_ave_angle, act_ave_angle) + + def test_average_angle_330_40_50(self) -> None: + angles = [330, 40, 50] + act_ave_angle = sc.average_angle(angles) + exp_ave_angle = 20.0 + self.assertAlmostEqual(exp_ave_angle, act_ave_angle) + + def test_average_angle_330_40_80(self) -> None: + angles = [330, 40, 80] + act_ave_angle = sc.average_angle(angles) + exp_ave_angle = 30.0 + self.assertAlmostEqual(exp_ave_angle, act_ave_angle) From 5208be3013a063d9d2b182907bd22623d038c4e0 Mon Sep 17 00:00:00 2001 From: David Doty Date: Wed, 16 Aug 2023 13:57:55 -0700 Subject: [PATCH 03/10] fixed some unit tests --- tests/scadnano_tests.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/scadnano_tests.py b/tests/scadnano_tests.py index 0091848..1b832fb 100644 --- a/tests/scadnano_tests.py +++ b/tests/scadnano_tests.py @@ -3711,7 +3711,7 @@ def test_nick_on_extension(self) -> None: sc.Domain(0, True, 4, 8), sc.Extension(5) ]) - self.assertEquals(2, len(design.strands)) + self.assertEqual(2, len(design.strands)) self.assertIn(expected_strand1, design.strands) self.assertIn(expected_strand2, design.strands) @@ -7714,14 +7714,19 @@ def test_file_output(self) -> None: with tempfile.TemporaryDirectory() as tmpdir: # First, write to the directory, in which case the names should be the script name design.write_oxdna_files(directory=tmpdir) - self.assertEqual(top, open(tmpdir + '/' + scriptname + '.top').read()) - self.assertEqual(dat, open(tmpdir + '/' + scriptname + '.dat').read()) + with open(tmpdir + '/' + scriptname + '.top') as f: + self.assertEqual(top, f.read()) + with open(tmpdir + '/' + scriptname + '.dat') as f: + self.assertEqual(dat, f.read()) # Now, write, to a specific filename without extensions design.write_oxdna_files(directory=tmpdir, filename_no_extension='oxdna-Export with spaces in name') - self.assertEqual(top, open(tmpdir + '/oxdna-Export with spaces in name.top').read()) - self.assertEqual(dat, open(tmpdir + '/oxdna-Export with spaces in name.dat').read()) + with open(tmpdir + '/oxdna-Export with spaces in name.top') as f: + self.assertEqual(top, f.read()) + + with open(tmpdir + '/oxdna-Export with spaces in name.dat') as f: + self.assertEqual(dat, f.read()) class TestPlateMaps(unittest.TestCase): From c370a1f74c9a3bf71ab1413d082e9966a2707a45 Mon Sep 17 00:00:00 2001 From: David Doty Date: Wed, 16 Aug 2023 13:58:56 -0700 Subject: [PATCH 04/10] Update scadnano.py --- scadnano/scadnano.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scadnano/scadnano.py b/scadnano/scadnano.py index 5c7659b..e9e5034 100644 --- a/scadnano/scadnano.py +++ b/scadnano/scadnano.py @@ -63,7 +63,6 @@ import itertools import re import math -import cmath from builtins import ValueError from dataclasses import dataclass, field, InitVar, replace from typing import Iterator, Tuple, List, Sequence, Iterable, Set, Dict, Union, Optional, Type, cast, Any, \ From c26dbe6a7fcc0e8a863a151c844623fe7c27a73e Mon Sep 17 00:00:00 2001 From: David Doty Date: Wed, 16 Aug 2023 14:08:41 -0700 Subject: [PATCH 05/10] fixed dependencies --- .github/workflows/run_unit_tests.yml | 56 ++++++++++++++-------------- scadnano/scadnano.py | 4 +- setup.py | 10 ++--- tests/scadnano_tests.py | 2 +- 4 files changed, 35 insertions(+), 37 deletions(-) diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index a0baddf..ddd19b0 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -1,28 +1,28 @@ -name: Run Unit Tests - -on: pull_request - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Setup conda - uses: s-weigand/setup-conda@v1 - with: - activate-conda: true - - name: Install xlwt, xlrd, tabulate with conda - run: conda install xlwt=1.3.0 xlrd=2.0.1 tabulate=0.8.9 - - name: Install docutils with conda - run: conda install docutils=0.16 - - name: Test with unittest - run: python -m unittest -v tests/scadnano_tests.py +name: Run Unit Tests + +on: pull_request + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Setup conda + uses: s-weigand/setup-conda@v1 + with: + activate-conda: true + - name: Install xlwt, xlrd, tabulate with conda + run: conda install openpyxl=3.1.2 tabulate=0.9.0 + - name: Install docutils with conda + run: conda install docutils=0.16 + - name: Test with unittest + run: python -m unittest -v tests/scadnano_tests.py diff --git a/scadnano/scadnano.py b/scadnano/scadnano.py index 0246253..506d00f 100644 --- a/scadnano/scadnano.py +++ b/scadnano/scadnano.py @@ -7208,8 +7208,8 @@ def _add_new_excel_plate_sheet(plate_name: str, workbook: Any) -> Any: @staticmethod def _setup_excel_file(directory: str, filename: Optional[str]) -> Tuple[str, Any]: - import xlwt # type: ignore - plate_extension = f'xls' + import openpyxl # type: ignore + plate_extension = f'xlsx' if filename is None: filename_plate = _get_filename_same_name_as_running_python_script( directory, plate_extension, filename) diff --git a/setup.py b/setup.py index 144d4ad..9699682 100644 --- a/setup.py +++ b/setup.py @@ -51,11 +51,9 @@ def extract_version(filename: str): url="https://github.com/UC-Davis-molecular-computing/scadnano-python-package", long_description=long_description, long_description_content_type='text/markdown; variant=GFM', - python_requires='>=3.6', + python_requires='>=3.7', install_requires=[ - 'xlwt', - 'dataclasses>=0.6; python_version < "3.7"', - 'tabulate', + 'openpyxl', + 'tabulate', ], - tests_require=['xlrd'], -) + ) diff --git a/tests/scadnano_tests.py b/tests/scadnano_tests.py index a8e3fd5..aff33b4 100644 --- a/tests/scadnano_tests.py +++ b/tests/scadnano_tests.py @@ -8,7 +8,7 @@ import math from typing import Iterable, Union, Dict, Any -import xlrd # type: ignore +import openpyxl # type: ignore import scadnano as sc import scadnano.origami_rectangle as rect From 62c5dd56a5ce299cae2593b52fdbd6cbac5f6ea8 Mon Sep 17 00:00:00 2001 From: David Doty Date: Wed, 16 Aug 2023 14:15:38 -0700 Subject: [PATCH 06/10] changed unit test versions for openpyxl and tabulate to versions matching what is in Anaconda package repository --- .github/workflows/run_unit_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index ddd19b0..3e86097 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -20,8 +20,8 @@ jobs: uses: s-weigand/setup-conda@v1 with: activate-conda: true - - name: Install xlwt, xlrd, tabulate with conda - run: conda install openpyxl=3.1.2 tabulate=0.9.0 + - name: Install openpyxl,tabulate with conda + run: conda install openpyxl=3.0.10 tabulate=0.8.10 - name: Install docutils with conda run: conda install docutils=0.16 - name: Test with unittest From 7b963c545229d825ec5fabcedd90e802e9075f59 Mon Sep 17 00:00:00 2001 From: David Doty Date: Wed, 16 Aug 2023 14:26:51 -0700 Subject: [PATCH 07/10] added instructions for installing openpyxl and tabulate to README --- README.md | 626 ++++++++++++++++++++++--------------------- scadnano/scadnano.py | 13 +- 2 files changed, 324 insertions(+), 315 deletions(-) diff --git a/README.md b/README.md index 58ae270..5c0c63e 100644 --- a/README.md +++ b/README.md @@ -1,313 +1,315 @@ -# scadnano Python package - -![Python package](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/workflows/Python%20package/badge.svg) -[![Documentation Status](https://readthedocs.org/projects/scadnano-python-package/badge/?version=latest)](https://scadnano-python-package.readthedocs.io/en/latest/?badge=latest) - -[scadnano](http://scadnano.org) ("scriptable-cadnano") is a program for designing synthetic DNA structures such as DNA origami. -The scadnano Python package -([source code repository here](https://github.com/UC-Davis-molecular-computing/scadnano-python-package)) -is a library for programmatically creating and editing these nanostructures. -The scadnano project is developed and maintained by the UC Davis Molecular Computing group. -Note that [cadnano](https://cadnano.org) is a separate project, developed and maintained by the [Douglas lab](https://bionano.ucsf.edu/) at UCSF. - -If you find scadnano useful in a scientific project, please cite its associated paper: - -> scadnano: A browser-based, scriptable tool for designing DNA nanostructures. - David Doty, Benjamin L Lee, and Tristan Stérin. - DNA 2020: *Proceedings of the 26th International Conference on DNA Computing and Molecular Programming* - [ [paper](https://doi.org/10.4230/LIPIcs.DNA.2020.9) | [BibTeX](https://web.cs.ucdavis.edu/~doty/papers/scadnano.bib) ] - -*Note:* If you are reading this on the PyPI website, some of the links below won't work. Many are relative links intended to be read on the [GitHub README page](https://github.com/UC-Davis-molecular-computing/scadnano-python-package#readme). - - -## Table of contents - -* [Overview](#overview) -* [Reporting issues](#reporting-issues) -* [Installation](#installation) -* [Example](#example) -* [Abbreviated syntax with chained methods](#abbreviated-syntax-with-chained-methods) -* [StrandBuilder object for iteratively building up strands with many domains](#strandbuilder-object-for-iteratively-building-up-strands-with-many-domains) -* [Tutorial](#tutorial) -* [API documentation](#api-documentation) -* [Other examples](#other-examples) -* [Contributing](#contributing) - -## Overview - -This package is used to write Python scripts outputting `.sc` files readable by [scadnano](https://scadnano.org), a web application useful for displaying and manually editing these structures. The purpose of this module is to help automate some of the task of creating DNA designs, as well as making large-scale changes to them that are easier to describe programmatically than to do by hand in the scadnano web interface. - -We will try to announce breaking changes (and possibly new features) under the [GitHub releases page](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/releases). The version numbers in this Python library repo and the [web interface repo](https://github.com/UC-Davis-molecular-computing/scadnano/releases) won't always advance at the same time, and sometimes a feature is supported in one before the other. - -Following [semantic versioning](https://semver.org/), version numbers are major.minor.patch, i.e., version 0.9.2 has minor version number 9. Prior to version 1.0.0, when a breaking change is made, this will increment the minor version (for example, going from 0.9.4 to 0.10.0). After version 1.0.0, breaking changes will increment the major version. - - - - - -## Reporting issues - -Please report issues in the web interface at the [scadnano web interface GitHub repository](https://github.com/UC-Davis-molecular-computing/scadnano/issues), and report issues in the Python scripting library at the [scadnano Python package GitHub repository](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/issues). - - - - - - -## Installation - -Short version: type this at the command line: - -```console -pip install scadnano -``` - -Read below for troubleshooting suggestions if that didn't work. - -### Getting Python -The scadnano Python package requires Python version 3.7 or later (with a workaround available for version 3.6, but not for any lower version). - -To check your current version of Python, open a command line and type - -``` -python --version -``` - -If it is version 2.7 or below, type - -``` -python3 --version -``` - -If that fails, or reports Python version 3.5 or below, you will have to install a later version of Python (recommended at least 3.7). Follow [this link](https://www.python.org/downloads/) to install Python. You may also use an alternative Python distribution, such as [Anaconda](https://www.anaconda.com/products/individual#Downloads). - -If you are using Python 3.6 and do not wish to upgrade, you can install a package providing the required features: the [dataclasses backport](https://pypi.org/project/dataclasses/); see `pip` instructions below to see how to install it. -Python 3.7 provides the -[dataclasses module](https://docs.python.org/3/library/dataclasses.html) automatically. - - - -### Installing the scadnano Python package - -Once Python is installed (and the dataclasses backport if you have Python version 3.6), there are two ways you can install the scadnano Python package: - -1. pip (recommended) - - Use [pip](https://pypi.org/project/pip/) to install the package by executing the following at the command line: - ```console - pip install scadnano - ``` - - If it worked, you should be able to open a Python interpreter and import the scadnano module: - - ```console - Python 3.7.9 (default, Aug 31 2020, 17:10:11) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32 - Type "help", "copyright", "credits" or "license" for more information. - >>> import scadnano as sc - >>> print(sc.Domain(helix=1, forward=True, start=0, end=8)) - Domain(, helix=1, forward=True, start=0, end=8) - >>> - ``` - - ### Troubleshooting - If the above does not work for you, here are some things to try. - - If your Python installation does not already have pip installed, you may have to install it. - Executing [this Python script](https://bootstrap.pypa.io/get-pip.py) should work; - see also - https://docs.python.org/3/installing/index.html - or - https://www.liquidweb.com/kb/install-pip-windows/. - - Once pip is installed, or if you believe it is already installed, check your version of `pip` by typing - ``` - pip --version - ``` - It should say something like - ``` - pip 19.3.1 from ...lib\site-packages\pip (python 3.8) - ``` - If the version of Python at the end is Python 3.7 or higher, you are good. If it is version 2.7 or lower, type - ``` - pip3 --version - ``` - If that works and shows Python 3.7 or higher, you are good, but you should type `pip3` in the subsequent instructions instead of `pip`. - - If it shows Python 3.6, install the [dataclasses backport module](https://pypi.org/project/dataclasses/) via - ``` - pip install dataclasses - ``` - If it shows Python 3.5 or lower, then you will need to upgrade your Python version (recommended Python 3.7 or higher). - - -2. download - - As a simple alternative (in case you run into trouble using pip), you can download and place the following files in your [PYTHONPATH](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH) (e.g., in the same directory as the scripts you are running). **Note:** If you are reading this on the PyPI website or anywhere other than GitHub, the links below won't work. They are relative links intended to be read on the [GitHub README page](https://github.com/UC-Davis-molecular-computing/scadnano-python-package#readme). - - * *required*: [scadnano.py](scadnano/scadnano.py) - * *optional*: [modifications.py](scadnano/modifications.py); This contains some common DNA modifications such as biotin and Cy3. - * *optional*: [origami_rectangle.py](scadnano/origami_rectangle.py); This can help create origami rectangles, but it is not necessary to use scadnano. - - To download them, right-click on "Raw" near the top and select (in Chrome or Firefox) "Save link as...": - ![](images/download_raw_screenshot.png) - - The scadnano package uses the Python package [xlwt](https://pypi.org/project/xlwt/) to write Excel files, so xlwt must be installed in order to call the method [`Design.write_idt_plate_excel_file()`](https://scadnano-python-package.readthedocs.io/#scadnano.Design.write_idt_plate_excel_file) to export an Excel file with DNA sequences. To install xlwt, type `pip install xlwt` at the command line. (If you instead use pip to install the scadnano package, xlwt will be automatically installed.) - - - - - - - -## Example - -Consider the following design: - -![](https://raw.githubusercontent.com/UC-Davis-molecular-computing/scadnano/master/doc-images/screenshot-initial.png) - -The following Python script produces this design. - -```python -import scadnano as sc -import modifications as mod - - -def create_design() -> sc.Design: - # helices - helices = [sc.Helix(max_offset=48), sc.Helix(max_offset=48)] - - # left staple - stap_left_domain1 = sc.Domain(helix=1, forward=True, start=8, end=24) - stap_left_domain0 = sc.Domain(helix=0, forward=False, start=8, end=24) - stap_left = sc.Strand(domains=[stap_left_domain1, stap_left_domain0]) - - # right staple - stap_right_domain0 = sc.Domain(helix=0, forward=False, start=24, end=40) - stap_right_domain1 = sc.Domain(helix=1, forward=True, start=24, end=40) - stap_right = sc.Strand(domains=[stap_right_domain0, stap_right_domain1]) - stap_right.set_modification_5p(mod.biotin_5p) - - # scaffold - scaf_domain1_left = sc.Domain(helix=1, forward=False, start=8, end=24) - scaf_domain0 = sc.Domain(helix=0, forward=True, start=8, end=40) - loopout = sc.Loopout(length=3) - scaf_domain1_right = sc.Domain(helix=1, forward=False, start=24, end=40) - scaf = sc.Strand(domains=[scaf_domain1_left, scaf_domain0, loopout, scaf_domain1_right], is_scaffold=True) - - # whole design - design = sc.Design(helices=helices, strands=[scaf, stap_left, stap_right], grid=sc.square) - - # deletions and insertions added to design are added to both strands on a helix - design.add_deletion(helix=1, offset=20) - design.add_insertion(helix=0, offset=14, length=1) - design.add_insertion(helix=0, offset=26, length=2) - - # also assigns complement to strands other than scaf bound to it - design.assign_dna(scaf, 'AACGT' * 18) - - return design - - -if __name__ == '__main__': - design = create_design() - design.write_scadnano_file(directory='output_designs') -``` - -Running the code above produces a `.sc` file that, if loaded into scadnano, should appear as in the screenshot above. The [web interface README](https://github.com/UC-Davis-molecular-computing/scadnano/blob/master/README.md#terminology) explains many of the terms used in the code (domain, helix, loopout, insertion, etc.). - - -## Abbreviated syntax with chained methods -Instead of explicitly creating variables and objects representing each domain in each strand, there is a shorter syntax using chained method calls. Instead of the above, create only the helices first, then create the Design. Then strands can be added using a shorter syntax, to describe how to draw the strand starting at the 5' end and moving to the 3' end. The following is a modified version of the above `create_design` function using these chained methods: - -```python -def create_design() -> sc.Design: - # helices - helices = [sc.Helix(max_offset=48), sc.Helix(max_offset=48)] - - # whole design - design = sc.Design(helices=helices, grid=sc.square) - - # for absolute offsets, call method "to" - # left staple - design.draw_strand(1, 8).to(24).cross(0).to(8) - - # for relative offsets, call method "move" - # right staple - design.draw_strand(0, 40).move(-16).cross(1).move(16).with_modification_5p(mod.biotin_5p) - - # scaffold - design.draw_strand(1, 24).move(-16).cross(0).move(32).loopout(1, 3).move(-16).as_scaffold() - - # deletions and insertions added to design are added to both strands on a helix - design.add_deletion(helix=1, offset=20) - design.add_insertion(helix=0, offset=14, length=1) - design.add_insertion(helix=0, offset=26, length=2) - - # also assigns complement to strands other than scaf bound to it - design.assign_dna(design.scaffold, 'AACGT' * 18) - - return design -``` - -Documentation is available in the [API docs](https://scadnano-python-package.readthedocs.io/en/latest/#scadnano.Design.draw_strand). - - -## StrandBuilder object for iteratively building up strands with many domains - -The method [`Design.draw_strand`](https://scadnano-python-package.readthedocs.io/en/latest/#scadnano.Design.draw_strand), as well as all those that follow it in a chained method call (e.g., `move`, `cross`, etc.) all return an instance of the class [`StrandBuilder`](https://scadnano-python-package.readthedocs.io/en/latest/#scadnano.StrandBuilder). -Above, that `StrandBuilder` instance is anonymous, i.e., never assigned to a variable. -Some long strands may be easier to specify with loops, for example an M13 scaffold strand for an origami. -If so, then to use the above methods, assign the `StrandBuilder` object to a variable, and call the relevant methods on that object to build up the strand in each iteration of the loop. -For example, the following modification of the above `create_design` function creates a linear scaffold strand that zig-zags back and forth across 32 helices: - -```python -def create_design() -> sc.Design: - num_helices = 32 - helices = [sc.Helix(max_offset=200) for _ in range(num_helices)] - design = sc.Design(helices=helices, grid=sc.square) - strand_builder = design.draw_strand(0, 0) - for helix in range(num_helices): - # move forward if on an even helix, otherwise move in reverse - move_distance = 200 if helix % 2 == 0 else -200 - strand_builder.move(move_distance) - if helix < 31: # crossover to next helix, unless it's the last helix - strand_builder.cross(helix + 1) - strand_builder.as_scaffold() - return design -``` - - - - - - -## API Documentation - -Online documentation of the package API (which classes, methods, functions, and constants are provided by the package) is located here: -https://scadnano-python-package.readthedocs.io - - - - - -## Tutorial - -A [tutorial](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/blob/master/tutorial/tutorial.md) shows how to create a "standard" 24-helix DNA origami rectangle using the scadnano Python package. - - - - - -## Other examples - -*Note:* If you are reading this on the PyPI website, the links below won't work. They are relative links intended to be read on the [GitHub README page](https://github.com/UC-Davis-molecular-computing/scadnano-python-package#readme). - -Several example scripts are located in the -[examples/](examples) subfolder. -Their output is contained in the -[examples/output_designs/](examples/output_designs) subfolder. - - - -## Contributing +# scadnano Python package + +![Python package](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/workflows/Python%20package/badge.svg) +[![Documentation Status](https://readthedocs.org/projects/scadnano-python-package/badge/?version=latest)](https://scadnano-python-package.readthedocs.io/en/latest/?badge=latest) + +[scadnano](http://scadnano.org) ("scriptable-cadnano") is a program for designing synthetic DNA structures such as DNA origami. +The scadnano Python package +([source code repository here](https://github.com/UC-Davis-molecular-computing/scadnano-python-package)) +is a library for programmatically creating and editing these nanostructures. +The scadnano project is developed and maintained by the UC Davis Molecular Computing group. +Note that [cadnano](https://cadnano.org) is a separate project, developed and maintained by the [Douglas lab](https://bionano.ucsf.edu/) at UCSF. + +If you find scadnano useful in a scientific project, please cite its associated paper: + +> scadnano: A browser-based, scriptable tool for designing DNA nanostructures. + David Doty, Benjamin L Lee, and Tristan Stérin. + DNA 2020: *Proceedings of the 26th International Conference on DNA Computing and Molecular Programming* + [ [paper](https://doi.org/10.4230/LIPIcs.DNA.2020.9) | [BibTeX](https://web.cs.ucdavis.edu/~doty/papers/scadnano.bib) ] + +*Note:* If you are reading this on the PyPI website, some of the links below won't work. Many are relative links intended to be read on the [GitHub README page](https://github.com/UC-Davis-molecular-computing/scadnano-python-package#readme). + + +## Table of contents + +* [Overview](#overview) +* [Reporting issues](#reporting-issues) +* [Installation](#installation) +* [Example](#example) +* [Abbreviated syntax with chained methods](#abbreviated-syntax-with-chained-methods) +* [StrandBuilder object for iteratively building up strands with many domains](#strandbuilder-object-for-iteratively-building-up-strands-with-many-domains) +* [Tutorial](#tutorial) +* [API documentation](#api-documentation) +* [Other examples](#other-examples) +* [Contributing](#contributing) + +## Overview + +This package is used to write Python scripts outputting `.sc` files readable by [scadnano](https://scadnano.org), a web application useful for displaying and manually editing these structures. The purpose of this module is to help automate some of the task of creating DNA designs, as well as making large-scale changes to them that are easier to describe programmatically than to do by hand in the scadnano web interface. + +We will try to announce breaking changes (and possibly new features) under the [GitHub releases page](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/releases). The version numbers in this Python library repo and the [web interface repo](https://github.com/UC-Davis-molecular-computing/scadnano/releases) won't always advance at the same time, and sometimes a feature is supported in one before the other. + +Following [semantic versioning](https://semver.org/), version numbers are major.minor.patch, i.e., version 0.9.2 has minor version number 9. Prior to version 1.0.0, when a breaking change is made, this will increment the minor version (for example, going from 0.9.4 to 0.10.0). After version 1.0.0, breaking changes will increment the major version. + + + + + +## Reporting issues + +Please report issues in the web interface at the [scadnano web interface GitHub repository](https://github.com/UC-Davis-molecular-computing/scadnano/issues), and report issues in the Python scripting library at the [scadnano Python package GitHub repository](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/issues). + + + + + + +## Installation + +Short version: type this at the command line: + +```console +pip install scadnano +``` + +Read below for troubleshooting suggestions if that didn't work. + +### Getting Python +The scadnano Python package requires Python version 3.7 or later (with a workaround available for version 3.6, but not for any lower version). + +To check your current version of Python, open a command line and type + +``` +python --version +``` + +If it is version 2.7 or below, type + +``` +python3 --version +``` + +If that fails, or reports Python version 3.5 or below, you will have to install a later version of Python (recommended at least 3.7). Follow [this link](https://www.python.org/downloads/) to install Python. You may also use an alternative Python distribution, such as [Anaconda](https://www.anaconda.com/products/individual#Downloads). + +If you are using Python 3.6 and do not wish to upgrade, you can install a package providing the required features: the [dataclasses backport](https://pypi.org/project/dataclasses/); see `pip` instructions below to see how to install it. +Python 3.7 provides the +[dataclasses module](https://docs.python.org/3/library/dataclasses.html) automatically. + + + +### Installing the scadnano Python package + +Once Python is installed (and the dataclasses backport if you have Python version 3.6), there are two ways you can install the scadnano Python package: + +1. pip (recommended) + + Use [pip](https://pypi.org/project/pip/) to install the package by executing the following at the command line: + ```console + pip install scadnano + ``` + + If it worked, you should be able to open a Python interpreter and import the scadnano module: + + ```console + Python 3.7.9 (default, Aug 31 2020, 17:10:11) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32 + Type "help", "copyright", "credits" or "license" for more information. + >>> import scadnano as sc + >>> print(sc.Domain(helix=1, forward=True, start=0, end=8)) + Domain(, helix=1, forward=True, start=0, end=8) + >>> + ``` + + ### Troubleshooting + If the above does not work for you, here are some things to try. + + If your Python installation does not already have pip installed, you may have to install it. + Executing [this Python script](https://bootstrap.pypa.io/get-pip.py) should work; + see also + https://docs.python.org/3/installing/index.html + or + https://www.liquidweb.com/kb/install-pip-windows/. + + Once pip is installed, or if you believe it is already installed, check your version of `pip` by typing + ``` + pip --version + ``` + It should say something like + ``` + pip 19.3.1 from ...lib\site-packages\pip (python 3.8) + ``` + If the version of Python at the end is Python 3.7 or higher, you are good. If it is version 2.7 or lower, type + ``` + pip3 --version + ``` + If that works and shows Python 3.7 or higher, you are good, but you should type `pip3` in the subsequent instructions instead of `pip`. + + If it shows Python 3.6, install the [dataclasses backport module](https://pypi.org/project/dataclasses/) via + ``` + pip install dataclasses + ``` + If it shows Python 3.5 or lower, then you will need to upgrade your Python version (recommended Python 3.7 or higher). + + +2. download + + As a simple alternative (in case you run into trouble using pip), you can simply download the scadnano.py file. However, you need to first install two packages that are required by scadnano: Install [openpyxl](https://pypi.org/project/openpyxl/) and [tabulate](https://pypi.org/project/tabulate/) by typing the following at the command line: `pip install openpyxl tabulate`. + + Download and place the following files in your [PYTHONPATH](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH) (e.g., in the same directory as the scripts you are running). **Note:** If you are reading this on the PyPI website or anywhere other than GitHub, the links below won't work. They are relative links intended to be read on the [GitHub README page](https://github.com/UC-Davis-molecular-computing/scadnano-python-package#readme). + + - *required*: [scadnano.py](scadnano/scadnano.py) + - *optional*: [modifications.py](scadnano/modifications.py); This contains some common DNA modifications such as biotin and Cy3. + - *optional*: [origami_rectangle.py](scadnano/origami_rectangle.py); This can help create origami rectangles, but it is not necessary to use scadnano. + + To download them, right-click on "Raw" near the top and select (in Chrome or Firefox) "Save link as...": + ![](images/download_raw_screenshot.png) + + The scadnano package uses the Python package [xlwt](https://pypi.org/project/xlwt/) to write Excel files, so xlwt must be installed in order to call the method [`Design.write_idt_plate_excel_file()`](https://scadnano-python-package.readthedocs.io/#scadnano.Design.write_idt_plate_excel_file) to export an Excel file with DNA sequences. To install xlwt, type `pip install xlwt` at the command line. (If you instead use pip to install the scadnano package, xlwt will be automatically installed.) + + + + + + + +## Example + +Consider the following design: + +![](https://raw.githubusercontent.com/UC-Davis-molecular-computing/scadnano/master/doc-images/screenshot-initial.png) + +The following Python script produces this design. + +```python +import scadnano as sc +import modifications as mod + + +def create_design() -> sc.Design: + # helices + helices = [sc.Helix(max_offset=48), sc.Helix(max_offset=48)] + + # left staple + stap_left_domain1 = sc.Domain(helix=1, forward=True, start=8, end=24) + stap_left_domain0 = sc.Domain(helix=0, forward=False, start=8, end=24) + stap_left = sc.Strand(domains=[stap_left_domain1, stap_left_domain0]) + + # right staple + stap_right_domain0 = sc.Domain(helix=0, forward=False, start=24, end=40) + stap_right_domain1 = sc.Domain(helix=1, forward=True, start=24, end=40) + stap_right = sc.Strand(domains=[stap_right_domain0, stap_right_domain1]) + stap_right.set_modification_5p(mod.biotin_5p) + + # scaffold + scaf_domain1_left = sc.Domain(helix=1, forward=False, start=8, end=24) + scaf_domain0 = sc.Domain(helix=0, forward=True, start=8, end=40) + loopout = sc.Loopout(length=3) + scaf_domain1_right = sc.Domain(helix=1, forward=False, start=24, end=40) + scaf = sc.Strand(domains=[scaf_domain1_left, scaf_domain0, loopout, scaf_domain1_right], is_scaffold=True) + + # whole design + design = sc.Design(helices=helices, strands=[scaf, stap_left, stap_right], grid=sc.square) + + # deletions and insertions added to design are added to both strands on a helix + design.add_deletion(helix=1, offset=20) + design.add_insertion(helix=0, offset=14, length=1) + design.add_insertion(helix=0, offset=26, length=2) + + # also assigns complement to strands other than scaf bound to it + design.assign_dna(scaf, 'AACGT' * 18) + + return design + + +if __name__ == '__main__': + design = create_design() + design.write_scadnano_file(directory='output_designs') +``` + +Running the code above produces a `.sc` file that, if loaded into scadnano, should appear as in the screenshot above. The [web interface README](https://github.com/UC-Davis-molecular-computing/scadnano/blob/master/README.md#terminology) explains many of the terms used in the code (domain, helix, loopout, insertion, etc.). + + +## Abbreviated syntax with chained methods +Instead of explicitly creating variables and objects representing each domain in each strand, there is a shorter syntax using chained method calls. Instead of the above, create only the helices first, then create the Design. Then strands can be added using a shorter syntax, to describe how to draw the strand starting at the 5' end and moving to the 3' end. The following is a modified version of the above `create_design` function using these chained methods: + +```python +def create_design() -> sc.Design: + # helices + helices = [sc.Helix(max_offset=48), sc.Helix(max_offset=48)] + + # whole design + design = sc.Design(helices=helices, grid=sc.square) + + # for absolute offsets, call method "to" + # left staple + design.draw_strand(1, 8).to(24).cross(0).to(8) + + # for relative offsets, call method "move" + # right staple + design.draw_strand(0, 40).move(-16).cross(1).move(16).with_modification_5p(mod.biotin_5p) + + # scaffold + design.draw_strand(1, 24).move(-16).cross(0).move(32).loopout(1, 3).move(-16).as_scaffold() + + # deletions and insertions added to design are added to both strands on a helix + design.add_deletion(helix=1, offset=20) + design.add_insertion(helix=0, offset=14, length=1) + design.add_insertion(helix=0, offset=26, length=2) + + # also assigns complement to strands other than scaf bound to it + design.assign_dna(design.scaffold, 'AACGT' * 18) + + return design +``` + +Documentation is available in the [API docs](https://scadnano-python-package.readthedocs.io/en/latest/#scadnano.Design.draw_strand). + + +## StrandBuilder object for iteratively building up strands with many domains + +The method [`Design.draw_strand`](https://scadnano-python-package.readthedocs.io/en/latest/#scadnano.Design.draw_strand), as well as all those that follow it in a chained method call (e.g., `move`, `cross`, etc.) all return an instance of the class [`StrandBuilder`](https://scadnano-python-package.readthedocs.io/en/latest/#scadnano.StrandBuilder). +Above, that `StrandBuilder` instance is anonymous, i.e., never assigned to a variable. +Some long strands may be easier to specify with loops, for example an M13 scaffold strand for an origami. +If so, then to use the above methods, assign the `StrandBuilder` object to a variable, and call the relevant methods on that object to build up the strand in each iteration of the loop. +For example, the following modification of the above `create_design` function creates a linear scaffold strand that zig-zags back and forth across 32 helices: + +```python +def create_design() -> sc.Design: + num_helices = 32 + helices = [sc.Helix(max_offset=200) for _ in range(num_helices)] + design = sc.Design(helices=helices, grid=sc.square) + strand_builder = design.draw_strand(0, 0) + for helix in range(num_helices): + # move forward if on an even helix, otherwise move in reverse + move_distance = 200 if helix % 2 == 0 else -200 + strand_builder.move(move_distance) + if helix < 31: # crossover to next helix, unless it's the last helix + strand_builder.cross(helix + 1) + strand_builder.as_scaffold() + return design +``` + + + + + + +## API Documentation + +Online documentation of the package API (which classes, methods, functions, and constants are provided by the package) is located here: +https://scadnano-python-package.readthedocs.io + + + + + +## Tutorial + +A [tutorial](https://github.com/UC-Davis-molecular-computing/scadnano-python-package/blob/master/tutorial/tutorial.md) shows how to create a "standard" 24-helix DNA origami rectangle using the scadnano Python package. + + + + + +## Other examples + +*Note:* If you are reading this on the PyPI website, the links below won't work. They are relative links intended to be read on the [GitHub README page](https://github.com/UC-Davis-molecular-computing/scadnano-python-package#readme). + +Several example scripts are located in the +[examples/](examples) subfolder. +Their output is contained in the +[examples/output_designs/](examples/output_designs) subfolder. + + + +## Contributing If you wish to contribute to scadnano, please see the [CONTRIBUTING document](CONTRIBUTING.md) to contribute to the scadnano Python package. There is also a [CONTRIBUTING document](https://github.com/UC-Davis-molecular-computing/scadnano/blob/master/CONTRIBUTING.md) for the web interface. \ No newline at end of file diff --git a/scadnano/scadnano.py b/scadnano/scadnano.py index 506d00f..818785b 100644 --- a/scadnano/scadnano.py +++ b/scadnano/scadnano.py @@ -72,6 +72,13 @@ from math import sqrt, sin, cos, pi from random import randint +# we import like this so that we can use openpyxl.Workbook in the type hints, but still allow +# someone to use the library without having openpyxl installed +try: + import openpyxl +except ImportError as e: + raise e + default_scadnano_file_extension = 'sc' """Default filename extension when writing a scadnano file.""" @@ -7199,7 +7206,7 @@ def _write_plates_assuming_explicit_plates_in_each_strand(self, directory: str, workbook.save(filename_plate) @staticmethod - def _add_new_excel_plate_sheet(plate_name: str, workbook: Any) -> Any: + def _add_new_excel_plate_sheet(plate_name: str, workbook: openpyxl.Workbook) -> openpyxl.Workbook: worksheet = workbook.add_sheet(plate_name) worksheet.write(0, 0, 'Well Position') worksheet.write(0, 1, 'Name') @@ -7207,7 +7214,7 @@ def _add_new_excel_plate_sheet(plate_name: str, workbook: Any) -> Any: return worksheet @staticmethod - def _setup_excel_file(directory: str, filename: Optional[str]) -> Tuple[str, Any]: + def _setup_excel_file(directory: str, filename: Optional[str]) -> Tuple[str, openpyxl.Workbook]: import openpyxl # type: ignore plate_extension = f'xlsx' if filename is None: @@ -7215,7 +7222,7 @@ def _setup_excel_file(directory: str, filename: Optional[str]) -> Tuple[str, Any directory, plate_extension, filename) else: filename_plate = _create_directory_and_set_filename(directory, filename) - workbook = xlwt.Workbook() + workbook = openpyxl.Workbook() return filename_plate, workbook def _write_plates_default(self, directory: str, filename: Optional[str], strands: List[Strand], From f45d3f08a08c8d2e72bef997cfc071378469110b Mon Sep 17 00:00:00 2001 From: David Doty Date: Wed, 16 Aug 2023 15:04:46 -0700 Subject: [PATCH 08/10] fixes #234: export new Excel format --- examples/idt-plates-explicit.py | 5 +- examples/idt/idt-plates-explicit.xls | Bin 26112 -> 0 bytes examples/idt/idt-plates-explicit.xlsx | Bin 0 -> 11408 bytes .../output_designs/idt-plates-explicit.sc | 4196 ++++++++--------- scadnano/scadnano.py | 35 +- tests/scadnano_tests.py | 12 +- tests/test_excel_export_96.xls | Bin 0 -> 11599 bytes 7 files changed, 2126 insertions(+), 2122 deletions(-) delete mode 100644 examples/idt/idt-plates-explicit.xls create mode 100644 examples/idt/idt-plates-explicit.xlsx create mode 100644 tests/test_excel_export_96.xls diff --git a/examples/idt-plates-explicit.py b/examples/idt-plates-explicit.py index ff3b583..eb23cae 100644 --- a/examples/idt-plates-explicit.py +++ b/examples/idt-plates-explicit.py @@ -3,6 +3,7 @@ ROWS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'] COLS = list(range(1, 13)) + def create_design() -> sc.Design: num_strands = 208 start = 0 @@ -11,7 +12,7 @@ def create_design() -> sc.Design: row_idx = 0 col_idx = 0 - for s in range(1, num_strands+1): + for s in range(1, num_strands + 1): ss_f = sc.Domain(helix=0, forward=True, start=start, end=start + 10) ss_r = sc.Domain(helix=1, forward=False, start=start, end=start + 10) @@ -44,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) + design.write_idt_plate_excel_file(directory='idt', use_default_plates=False, only_strands_with_idt=True) if __name__ == '__main__': diff --git a/examples/idt/idt-plates-explicit.xls b/examples/idt/idt-plates-explicit.xls deleted file mode 100644 index ee65bffc67dd204ee6b0a94145e9a3a491071366..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 26112 zcmeI52XtN4m4=UOV{G~b)4|vj(+pU$+yG-gNtQ%21`ABbhIkSZ2MCa4NSTlj(tGa- z6VemXd+$A@_X6p?_dq=V_n*zx@tHeWVM=CZEkFCctG)04owD~n=Se!x@adbITW)ym zKDVaoaYCA!{DzjqpRP!&FTZT#oPXeB$Ya>h#~7CPO;3HYr>5uVb*HqqN4Be9 zFY)Vcetoso@9^tNdmii8Hp@9+0%ANHzwt7Y~y7cuiUWdmNZLAyfOW5^PH4^%LI75 zXU{@W@qwg1UerloXk+Pq#R*q5$XdH-fE#PoE zV++p!o^@*r&%)c%yxG@irA*ax$CTD>+_Y)Vn#-@c^y*75zf7&K-f+*2Gg4Z+@m}}d zc-bWzCF=F7V6M7)!xfu0_RmUbqBo(xy|Ia5U5AH7O7SW^bsX6sJL5Coy zMkiH^X=|7}YJuU?r=(JiO{$hir3N$_4Sb9V+CVivsai@~V`@Te&>v%yo*sJxZM>FQ z6+=>2o}{!=4Gk#D5!D5fNu(Br2^CSHZwIW95q&B0BuRhDP#^m6Vz?~P7q`@ zFWIU>M*K+&L31P~n2w_{TF6KMkyU^0oB8s!S{o~5WFUe;0u(opF-NVC zF$bi#a55m|z3AU{3u?mm zJP)rKS4eNLjoU!117%8?RX`{eHB6^Ng^Vny{<*83JuDLDxD~Qk2`X<7o!-eBt&J2i zXMr)RE#k&;VLN5!x_MvLjRx2TQVLazm;Mo)~;^1Mz98Cf6&N(2i>b0p9?ZiOsoft!l4F8Yg* zPDcuvv)~Gm0-4&QmLywM$eabwP7_g9oi#Nm*=Qjn3v3bJZ>sa zGqNx~DH|jUx|wrDc)g8ytL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N?7)^xJ1jb9{xHv^17dT<(lF51});R-Nn}x>K)siV?~! z84c3xvNV}^6rQqVaz_jwf5T&5J*4YqX@^YIC_*pgjxZuO>!FnCg-&l%c8>BVQA^4d9$8>~Djy(<`>V^~|L8Tev9W~rS*Yp= ze1PgQmWkqN0}ee$vD<4Tda9>b`)SoX7A%2<9dibt=TR0aVDlf0`%_N)dcOt z?iMDqv&2~@JFDQIABig+G{(L6oBWI7wiFtaK7h;K5xs0eZ3m~BRE)oi3Nh9VP9^l2 z_Nvr16Q3wSF(^i5WEpwC@}qL9P-)ao3hSjaV+P{+Q~ug{Zxwns2hA*rYo=$7Pw)bz zeaOO9NT>+|EjRXLiNlRGKPs8XeUMP}??lt={E7A5muKE&gSxHU9WxD+qp#7xXTmP! z{lzF-9h#W1y2zLa6KX>g7H-@H&H!((^Mj3UnUEh2^wJiOpRHB+)%tWz9GBs`SuGC^ zj__^OlhY2ZpTAE7WvqFP<QuJ9V%*4XZ(G+50bXW?7%NeKHUf7)LX5%C9v&Z-|!8yiyaW-o-V_RvMMfei~zW&jQ~wy*Q;Xr&KYwhi7+4 z^{1=VY0B>kFGXKru3F@DmXJCWjv_PS4ApaUk(~-1+IG8{jKUAVXKz{zy5ZP~>c8)+tmT zUkXD=sGQ*Mmr}a7liQJnTF8Eg_)vq1qL}(R^uc}gkpk@QFYcZUn7el$=8oIF|9XJW zRK*h`T-6vl-Jtu7{c%(P;y3V$gr9*!=KD?iwO$*hjeLpDR1s9mN4A{^k=@w@9vd=# zl1qI!hU0X!mP8v`TK+u~vN=tN{mRgXb{mEABq|q%mUVRPc;c~|cOrPEo(c-lC$oKsDX|yahu2 z|Ics!t^M}^Ldobqq=zsC&!RqqDi|Bs==zYY97X7bxWwKw|RTLbWh z`2U7Z{lkT`MF9nvP=z0_m Design: try: design = Design.from_scadnano_json_map(json_map) return design - except KeyError as e: - raise IllegalDesignError(f'I was expecting a JSON key but did not find it: {e}') + except KeyError as error: + raise IllegalDesignError(f'I was expecting a JSON key but did not find it: {error}') @staticmethod def _check_mutually_exclusive_fields(json_map: dict) -> None: @@ -7199,22 +7199,24 @@ def _write_plates_assuming_explicit_plates_in_each_strand(self, directory: str, for row, strand in enumerate(strands_in_plate): if strand.idt is None: raise ValueError(f'cannot export strand {strand} to IDT because it has no idt field') - worksheet.write(row + 1, 0, strand.idt.well) - worksheet.write(row + 1, 1, strand.idt_export_name()) - worksheet.write(row + 1, 2, strand.idt_dna_sequence()) + worksheet.cell(row + 2, 1).value = strand.idt.well + worksheet.cell(row + 2, 2).value = strand.idt_export_name() + worksheet.cell(row + 2, 3).value = strand.idt_dna_sequence() workbook.save(filename_plate) + # TODO: fix types when openpyxl supports type hints @staticmethod - def _add_new_excel_plate_sheet(plate_name: str, workbook: openpyxl.Workbook) -> openpyxl.Workbook: - worksheet = workbook.add_sheet(plate_name) - worksheet.write(0, 0, 'Well Position') - worksheet.write(0, 1, 'Name') - worksheet.write(0, 2, 'Sequence') + def _add_new_excel_plate_sheet(plate_name: str, + workbook: 'openpyxl.Workbook') -> 'openpyxl.Worksheet': + worksheet = workbook.create_sheet(title=plate_name) + worksheet.cell(1, 1).value = 'Well Position' + worksheet.cell(1, 2).value = 'Name' + worksheet.cell(1, 3).value = 'Sequence' return worksheet @staticmethod - def _setup_excel_file(directory: str, filename: Optional[str]) -> Tuple[str, openpyxl.Workbook]: + def _setup_excel_file(directory: str, filename: Optional[str]) -> Tuple[str, 'openpyxl.Workbook']: import openpyxl # type: ignore plate_extension = f'xlsx' if filename is None: @@ -7223,6 +7225,7 @@ def _setup_excel_file(directory: str, filename: Optional[str]) -> Tuple[str, ope else: filename_plate = _create_directory_and_set_filename(directory, filename) workbook = openpyxl.Workbook() + workbook.remove(workbook.active) # removed automatically created default sheet return filename_plate, workbook def _write_plates_default(self, directory: str, filename: Optional[str], strands: List[Strand], @@ -7260,9 +7263,9 @@ def _write_plates_default(self, directory: str, filename: Optional[str], strands f"which is being ignored since we are using default plate/well addressing") well = plate_coord.well() - worksheet.write(excel_row, 0, well) - worksheet.write(excel_row, 1, strand.idt_export_name()) - worksheet.write(excel_row, 2, strand.idt_dna_sequence()) + worksheet.cell(excel_row + 1, 1).value = well + worksheet.cell(excel_row + 1, 2).value = strand.idt_export_name() + worksheet.cell(excel_row + 1, 3).value = strand.idt_dna_sequence() num_strands_remaining -= 1 # IDT charges extra for a plate with < 24 strands for 96-well plate diff --git a/tests/scadnano_tests.py b/tests/scadnano_tests.py index aff33b4..967941b 100644 --- a/tests/scadnano_tests.py +++ b/tests/scadnano_tests.py @@ -1228,7 +1228,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()}.xls' + filename = f'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) @@ -1238,11 +1238,11 @@ def test_write_idt_plate_excel_file(self) -> None: design.write_idt_plate_excel_file(filename=filename, plate_type=plate_type) - book = xlrd.open_workbook(filename) - self.assertEqual(4, book.nsheets) + book = openpyxl.load_workbook(filename=filename) + self.assertEqual(4, len(book.worksheets)) for plate in range(4): - sheet = book.sheet_by_index(plate) - self.assertEqual(3, sheet.ncols) + sheet = book.worksheets[plate] + self.assertEqual(3, sheet.max_column) if plate == 2: # penultimate plate expected_wells = plate_type.num_wells_per_plate() - plate_type.min_wells_per_plate() + 10 @@ -1251,7 +1251,7 @@ def test_write_idt_plate_excel_file(self) -> None: else: expected_wells = plate_type.num_wells_per_plate() - self.assertEqual(expected_wells + 1, sheet.nrows) + self.assertEqual(expected_wells + 1, sheet.max_row) os.remove(filename) diff --git a/tests/test_excel_export_96.xls b/tests/test_excel_export_96.xls new file mode 100644 index 0000000000000000000000000000000000000000..bbdb3dd2b504ecac592004d6044dd6ccf15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IvzEfJu{3^W(oK7K2;+ILZS3^7Xu5Yl+`;gDESV~7`f#hGiPu`e%b$q!L+nX)5+XoGg2k*cqX%l9JTh* zu^jXY8D}5%sJJDGN>)sJ%-)An?y`5XA9*+_wdCE;vs~`2oX@-a z^`{K_o3D|rttIqx78X6B_|IdE00aM@@Q9G|AcfViu<_Qs()Lq?0FG7C&W$e?>C<|M zAA?Z0EfQJ|IRo|5EBNuW$+DCfz6Er_<&j&hiY*-@SzA+f9$SLHbFMER2$D)X_+Q=TShLD>?Ix9eiXW2 z**Wu;jgx2y0&;dq%Ki+T7PU%7D~dY5oR$fZr`PaZR&7lD(?K%|2Oc6UGDE~3k=akS zyQ%n<5g4q~XP^0XXcgZ}8t0d+?AKWC+$nb15*R$BNBkUzEl4m`k%#svl!yv#X+@KL zT-qLqe@(*^rSE4!28n|}lidq{mgml2-x3TK)!zRMCz#qewB|zieHY2YizNM?3y-fU za5SP3AN$DY+fsEivW2>`&?Aa9?2We&cZKOa9r?1hpCcs2*mHet`ol3xU;7o>?^PV% z{d*wbL?tFWfdLS^0|P^NJrLKE?$6=4nt;9F9<+JO?s>%VAL!4=*J&~xYgx{ z5#dA(a2sm8R6`XdxWiDb6!2LoU0$W0=|Yt2<&=gC&sWdKy#|e2Y#WlylyWMJqvWPo zY3CfY3E}59)N(4ioU6fW`p8FBDk~5CiP(Y#v&`TnOHFZX8|k-0qq)Q07zhn!a+;Qi z=#`~+R8odK{Apl=iLbs!+ NFi!!)oM(Vu{T~>Y&?W!? literal 0 HcmV?d00001 From 3da47632493ea85b71ff6b33042ef778f2bd4d0a Mon Sep 17 00:00:00 2001 From: David Doty Date: Wed, 16 Aug 2023 15:07:14 -0700 Subject: [PATCH 09/10] added openpyxl to tests_require --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index 9699682..77dba7a 100644 --- a/setup.py +++ b/setup.py @@ -56,4 +56,7 @@ def extract_version(filename: str): 'openpyxl', 'tabulate', ], + tests_require=[ + 'openpyxl', + ], ) From c177ef03cbac313b4463abaaf9018a1bad08b169 Mon Sep 17 00:00:00 2001 From: David Doty Date: Wed, 16 Aug 2023 15:08:55 -0700 Subject: [PATCH 10/10] added openpyxl installation to docs-check GitHub action --- .github/workflows/docs-check.yml | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index bb6f08d..c865b08 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -1,21 +1,21 @@ -name: "Docs Check" -on: pull_request - -jobs: - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.4 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install Sphinx - run: | - python -m pip install --upgrade pip - pip install sphinx sphinx_rtd_theme - - name: Move to docs folder and build - run: | - cd doc - pwd - sphinx-build -T -E -W -b html . _build +name: "Docs Check" +on: pull_request + +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install Sphinx + run: | + python -m pip install --upgrade pip + pip install sphinx sphinx_rtd_theme openpyxl + - name: Move to docs folder and build + run: | + cd doc + pwd + sphinx-build -T -E -W -b html . _build