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

fix crash error in assignment of DNA to design with deletion on one domain but not other #203

Open
dave-doty opened this issue Nov 11, 2021 · 0 comments
Assignees
Labels
bug Something isn't working high priority Something cruicial to get working soon.

Comments

@dave-doty
Copy link
Member

dave-doty commented Nov 11, 2021

Create a design where one domain has a deletion but the domain it is bound to does not:

image

Assign DNA to the strand with the deletion:

image

I'm showing this above in the web interface to help visualize, but you get the same error in the Python package:

design = sc.Design(grid=sc.square, helices=[sc.Helix(max_offset=100)], strands=[])
design.strand(0, 0).move(8)
design.strand(0, 8).move(-8)
design.strands[0].domains[0].deletions.append(4)
design.assign_dna(design.strands[0], 'AAAAAAA')

Expected behavior

Generally we don't encourage putting isolated deletions/insertions. But in this case, it makes sense to put a wildcard symbol. However, we should first add a (default True) boolean paramater to Design.assign_dna that raises an exception if some pair of Domains mismatch deletions or insertions in this way. Only if the user explicitly sets it to False would we assign the wildcard, since this could mask a subtle bug in the design.


This error was originally identified in the following design, but the minimal reproducible example is above.

Import this cadnano design and run

design.assign_dna(design.scaffold, sc.m13())

(Calling design.assign_m13_to_scaffold raises an exception because that design has two scaffolds, one is a small isolated strand on helix 37.)

It raises this exception:

  File "C:\Dropbox\git\scadnano-python-package\tests\scadnano_tests.py", line 595, in test_minitri_assign_m13
    design.assign_dna(design.scaffold, sc.m13())
  File "C:\Dropbox\git\scadnano-python-package\scadnano\scadnano.py", line 5499, in assign_dna
    other_strand.assign_dna_complement_from(strand)
  File "C:\Dropbox\git\scadnano-python-package\scadnano\scadnano.py", line 3107, in assign_dna_complement_from
    merged_domain_self_dna_sequence = _string_merge_wildcard(domain_self_dna_sequence,
  File "C:\Dropbox\git\scadnano-python-package\scadnano\scadnano.py", line 3426, in _string_merge_wildcard
    raise ValueError(f'\ns1={s1} and\ns2={s2}\nare not the same length.')
ValueError: 
s1=CTGGAAG and
s2=????????
are not the same length.
@dave-doty dave-doty changed the title fix crash error in assignment of DNA to cadnano imported design fix crash error in assignment of DNA to design with deletion on one domain but not other Nov 11, 2021
@dave-doty dave-doty added bug Something isn't working high priority Something cruicial to get working soon. labels Nov 11, 2021
@dave-doty dave-doty self-assigned this Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority Something cruicial to get working soon.
Projects
None yet
Development

No branches or pull requests

1 participant