-
Notifications
You must be signed in to change notification settings - Fork 7
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
Debugging cadnanov2 export of paranemic crossovers when both segments… #311
base: dev
Are you sure you want to change the base?
Debugging cadnanov2 export of paranemic crossovers when both segments… #311
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's something I don't understand. If I run this code:
import scadnano as sc
design = sc.Design(helices=[
sc.Helix(max_offset=50, idx=0),
sc.Helix(max_offset=50, idx=2),
], grid=sc.square)
design.draw_strand(2, 8).move(-8).cross(0, move=8).move(-8)
design.write_scadnano_file('paranemic_crossover_generated.sc')
it generates this design:
Then I add this line:
design.write_cadnano_v2_file(filename='paranemic_crossover_generated.json')
and it generates this error:
ValueError: Paranemic crossovers are only allowed between helices that have the same parity of
row number, here helix num 2 and helix num 0
have different parity of row number: respectively 1 and 0
What's going wrong? I gave the helices indices 0 and 2 so that they have the same parity. But somehow it's getting translated to cadnano helix num
of 0 and 1 instead of 0 and 2. I can fix it if I add an unused helix 1:
design = sc.Design(helices=[
sc.Helix(max_offset=50, idx=0),
sc.Helix(max_offset=50, idx=1),
sc.Helix(max_offset=50, idx=2),
], grid=sc.square)
before drawing the strand.
Is this intended behavior? I don't remember how cadnano works. Does it disallow helix indices from being non-consecutive? (i.e., you can have helices 0,1,2,...,n but no strict subset of that?)
If so, we should probably be more specific in specifying the constraints on scadnano designs in doc/index.rst to emphasize this constraint of consecutive helix indices.
But if that's not a constraint of cadnano, then this seems like a bug in the cadnano export code, where it is looking at the helix's order in the dict Design.helices
, instead of at its field Helix.idx
, to generate cadnano helix num
's.
I'm also confused about the distinction between scadnano helix index, and what you call num
and row number
in the error message. What's the difference between num
and row number
, and which is supposed to correspond to the field Helix.idx
? I think we should also change the error message to use scadnano terms instead of cadnano terms, since we are describing a constraint on the scadnano design for it to be exportable, and scadnano designs have no concept of num
or row number
.
One guess I have is that by "row number", you mean the order in which the helix appears in the dict Design.helices
? But it would be better to more precisely define these terms.
UPDATE: Sorry, I just now read your comments on issue #308 to see the explanation of the export rules. I also noticed that the current explanation says something about the helix's "y-coordinate" but I'm not sure what that means. [UPDATE: Oh, I think you mean its y-coordinate in the square grid?] So it seems the export is fine, given the constraints of cadnano. But I still think the documentation is confusing for the reasons I explained above. I guessed that "row number" means "order helix appears in the dict |
Hello Dave, yes, I mean y-coordinate in the square grid, i.e. what you can set in scadnano by doing "right click on helix -> set grid position -> v". This referred as "row" using cadnanov2 vocabulary (instead of "num" which is the helix's idx). |
… are in the 3' direction
Description
Related Issue
#308
Motivation and Context
How Has This Been Tested?
TestExportCadnanoV2.test_paranemic_crossover_other_direction
Screenshots (if appropriate):