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

allow per-helix-group geometry #306

Open
dave-doty opened this issue Sep 21, 2024 · 1 comment · Fixed by #307
Open

allow per-helix-group geometry #306

dave-doty opened this issue Sep 21, 2024 · 1 comment · Fixed by #307
Assignees
Labels
closed in dev enhancement New feature or request

Comments

@dave-doty
Copy link
Member

dave-doty commented Sep 21, 2024

See UC-Davis-molecular-computing/scadnano#993

In the Python package this just means adding a field HelixGroup.geometry and updating the methods HelixGroup.to_json_serializable and HelixGroup.from_scadnano_json_map to write/read it if necessary.

@dave-doty
Copy link
Member Author

dave-doty commented Sep 21, 2024

Release notes

HelixGroups custom geometry

See also UC-Davis-molecular-computing/scadnano#993 (comment).

There is a new optional field HelixGroup.geometry, which overrides the Geometry parameters of the Design.geometry field. For instance, the following code:

import scadnano as sc


def create_design() -> sc.Design:
    group0 = sc.HelixGroup(grid=sc.square)
    group1 = sc.HelixGroup(grid=sc.square, 
                           # NOTE: here's the custom geometry for helix 1
                           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')

produces this design with helix 0 having 10.5 base pairs per turn, and helix 1 having 18 base pairs per turn:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed in dev enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant