Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #309: account for helix group rotation properly in oxdnaoxview export #310

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11", "3.12" ]
python-version: [ 3.9, "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v2
Expand Down
13 changes: 10 additions & 3 deletions scadnano/scadnano.py
Original file line number Diff line number Diff line change
Expand Up @@ -9020,7 +9020,10 @@ def _oxdna_get_helix_vectors(design: Design, helix: Helix) -> Tuple[_OxdnaVector
roll_axis = roll_axis.rotate(design.pitch_of_helix(helix), pitch_axis)

# then the roll rotation
yaw_axis = yaw_axis.rotate(-design.roll_of_helix(helix), roll_axis)
# uses group.roll instead of design.roll_of_helix(helix) because latter adds local roll to global roll
# but these are defined with different coordinate systems in mind
yaw_axis = yaw_axis.rotate(-group.roll, roll_axis)
pitch_axis = pitch_axis.rotate(-group.roll, roll_axis)

# by chosen convension, forward is the same as the roll axis
# and normal is the negated yaw axis
Expand All @@ -9036,9 +9039,13 @@ def _oxdna_get_helix_vectors(design: Design, helix: Helix) -> Tuple[_OxdnaVector
raise AssertionError('helix.grid_position should be assigned if grid is not Grid.none')
position = grid_position_to_position(helix.grid_position, grid, geometry)

position = position + group.position
# position of helix within its group, rotated by the groups yaw, pitch, roll
local_position = (pitch_axis * position.x) + (yaw_axis * position.y) + (roll_axis * position.z)

origin_ = _OxdnaVector(position.x, position.y, position.z) * NM_TO_OX_UNITS
# position of group's origin with respect to global coordinate system
group_position = _OxdnaVector(group.position.x, group.position.y, group.position.z)

origin_ = (local_position + group_position) * NM_TO_OX_UNITS
return origin_, forward, normal


Expand Down
Loading