See our Scripting tutorial to get started.
Cadnano source code is organized using a Model-View-Controller (MVC) design pattern.
The model consists of data structures and algorithms for managing and manipulating information related to Cadnano designs. It is a standalone system and can be used without any graphical user interface, though it is much more useful and intuitive with a GUI.
Views are a visual representations of the model state. Cadnano provides several views of the model, each serving a different purpose. Most user interaction is done in the Sliceview, is an orthographic 2D projection of DNA helices, and the Pathview, a schematic blueprint of the routes of individual oligos in a design. The Inspector window is a text-based widget that consists of the Outlinerview, a hierarchical listing of the components of a design, and the Propertyview which allows for editing properties of selected components. We have future plans for a 3D view and a console view.
Controllers are responsible for setting up and managing the communication between the model and views.
By a traditional MVC definition, Cadnano views have integrated controller functionality, i.e. they interpret user actions and send them to the model.
Signals and Slots¶
We use Qt’s Signals and Slots framework. The model is responsible for emitting relevant “signals” when modified, and the views can subscribe to those signals with local “slots” which are methods that receive model change information as argments and then decide what to do with it, for example updating a graphical element to reflect the change, or simply ignoring it.