You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to script a part of my origami design workflow in cadnano. I followed some of the guidance available from the docs to do this, but reading in and saving files is not working correctly. Would you be able to look into this? All details of my environment and some test files are provided below.
Reading a cadnano .json file into scripting interface, then saving it back results in a null or messed up output file without legacy enabled, and an error message with legacy enabled.
Environment
Windows 10.0.19044 Build 19044
cadnano 2.5.1.11 (installed via pip)
Python 3.6.13
Test design (json) files produced and tested in cadnano versions 2.3, 2.4, and 2.5
Steps to reproduce
Use scripting interface to read in file, save it back.
Remove "legacy=False" to run without error message.
importcadnanofromcadnano.documentimportDocumentimportosdefscripting_test(input_file):
app=cadnano.app() # cadnano structure initialization (need to define an app, document and part)doc=app.document=Document()
doc.readFile(input_file)
doc.writeToFile(os.path.join(os.path.dirname(input_file), 'adjusted_%s'%os.path.basename(input_file)),
legacy=False)
Input:
test_lattice.json
test_lattice_2.json
Rothemund-rect.json
(all available in attached zip file)
Output:
Without legacy=True:
adjusted_test_lattice.json
adjusted_test_lattice_2.json
adjusted_Rothemund-rect.json
(all available in attached zip file)
With legacy=True (error):
Found cadnano version 2 file
Traceback (most recent call last):
File "read_test.py", line 25, in <module>
break_maker()
File "C:\Users\s2443849\Anaconda3\envs\cadnano\lib\site-packages\click\core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "C:\Users\s2443849\Anaconda3\envs\cadnano\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "C:\Users\s2443849\Anaconda3\envs\cadnano\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\s2443849\Anaconda3\envs\cadnano\lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "read_test.py", line 22, in break_maker
legacy=False)
TypeError: writeToFile() got an unexpected keyword argument 'legacy'
Testing on another machine (Mac)
Environment:
Mac OS 13.1 (Intel-based)
Cadnano 2.5.2.1
Python 3.6.15
Output:
Without legacy enabled:
Found cadnano version 2 file
Deletion added on helix 4, position 41 3
Deletion added on helix 8, position 44 7
Deletion added on helix 7, position 28 10
Deletion added on helix 3, position 23 14
Deletion added on helix 0, position 31 17
Traceback (most recent call last):
File "/Users/matt/opt/anaconda3/envs/cadnano_scripting/lib/python3.6/code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "/Users/matt/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8214.51/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/Users/matt/Library/Application Support/JetBrains/Toolbox/apps/PyCharm-P/ch-0/223.8214.51/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/matt/Documents/PhD/research_output/mini_coding_projects/cadnano_scripting/cadnano_break_point_maker.py", line 68, in <module>
break_maker(sys.argv[1:]) # for use when debugging with pycharm
File "/Users/matt/opt/anaconda3/envs/cadnano_scripting/lib/python3.6/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/Users/matt/opt/anaconda3/envs/cadnano_scripting/lib/python3.6/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/Users/matt/opt/anaconda3/envs/cadnano_scripting/lib/python3.6/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/matt/opt/anaconda3/envs/cadnano_scripting/lib/python3.6/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/Users/matt/Documents/PhD/research_output/mini_coding_projects/cadnano_scripting/cadnano_break_point_maker.py", line 62, in break_maker
legacy=False)
File "/Users/matt/opt/anaconda3/envs/cadnano_scripting/lib/python3.6/site-packages/cadnano/document.py", line 188, in writeToFile
encodeToFile(filename, self, legacy)
File "/Users/matt/opt/anaconda3/envs/cadnano_scripting/lib/python3.6/site-packages/cadnano/fileio/encode.py", line 17, in encodeToFile
json_string = encode(document, legacy)
File "/Users/matt/opt/anaconda3/envs/cadnano_scripting/lib/python3.6/site-packages/cadnano/fileio/encode.py", line 37, in encode
obj = v3encode.encodeDocument(document)
File "/Users/matt/opt/anaconda3/envs/cadnano_scripting/lib/python3.6/site-packages/cadnano/fileio/v3encode.py", line 21, in encodeDocument
'slice_view_type': document.getSliceViewType(),
File "/Users/matt/opt/anaconda3/envs/cadnano_scripting/lib/python3.6/site-packages/cadnano/document.py", line 950, in getSliceViewType
return self.controller().getSliceViewType()
AttributeError: 'NoneType' object has no attribute 'getSliceViewType'
With legacy enabled:
test_lattice_legacy_true.json (also available in attached zip file)
Helices are moved around, sometimes breaking up the design, and some crossovers are also removed.
The text was updated successfully, but these errors were encountered:
Description of issue
I am attempting to script a part of my origami design workflow in cadnano. I followed some of the guidance available from the docs to do this, but reading in and saving files is not working correctly. Would you be able to look into this? All details of my environment and some test files are provided below.
Bug_Report.zip
Reading a cadnano .json file into scripting interface, then saving it back results in a null or messed up output file without legacy enabled, and an error message with legacy enabled.
Environment
Windows 10.0.19044 Build 19044
cadnano 2.5.1.11 (installed via pip)
Python 3.6.13
Test design (json) files produced and tested in cadnano versions 2.3, 2.4, and 2.5
Steps to reproduce
Use scripting interface to read in file, save it back.
Remove "legacy=False" to run without error message.
Input:
test_lattice.json
test_lattice_2.json
Rothemund-rect.json
(all available in attached zip file)
Output:
Without legacy=True:
adjusted_test_lattice.json
adjusted_test_lattice_2.json
adjusted_Rothemund-rect.json
(all available in attached zip file)
With legacy=True (error):
Testing on another machine (Mac)
Environment:
Mac OS 13.1 (Intel-based)
Cadnano 2.5.2.1
Python 3.6.15
Output:
Without legacy enabled:
With legacy enabled:
test_lattice_legacy_true.json (also available in attached zip file)
Helices are moved around, sometimes breaking up the design, and some crossovers are also removed.
The text was updated successfully, but these errors were encountered: