Property
Properties for MolstarViewer include id, data, focus, layout, selection, hover, frame, style, measurement, updatefocusonframechange, and updateselectiononframechange. Once the viewer has been add to the web page, it is not supported to change the layout via callbacks.
id – The id for the html container of molstar, and should be unique in
app.layout.data – The molecule to be loaded into molstar viewer. It is a
dictor list of dicts, each containing a molecule to be loaded. With helper functionparse_molecule(), one can easily generate correct data for this property.datacan include additional components to be shown in the viewer. The component data should be generated by the helper functioncreate_component().focus – The component that the camera is currently focused on. It can also analyze the non-covalent interactions within 5 angstroms of the target. This can be controlled by the helper function
get_focus(), which takes a target selection and an optional booleananalyseparameter. Ifanalyseis set toTrue, the function will analyze the non-covalent interactions within 5 angstroms of the target. If not specified, the default value ofanalyseisFalse.layout – The initial appearance of molstar viewer. It has some default settings. If you wish to specify some of the options, indicate them with a
dict. The avaliable options are listed in General Options.selection – The partition being selected in the viewer. The data for selection can be generated by the helper function
get_selection(). IfNonewas passed to thetargetsparameter ofget_selection(), the selection on corresponding mode will be deselected.hover – Targets passed to this property will be highlighted. Data for this property should also be generated by helper function
get_selection(). IfNonewas passed to thetargetsparameter ofget_selection(), the highlights will be removed.frame – If a structure with multiple frames was loaded to the viewer, e.g. a molecular dynamics trajectory, this property can control the displayed frame.
measurement – Add measurement to selected targets in the molstar viewer.
style – The html style that will be add to the container for molstar viewer.
widthandheightcan be specified here.updatefocusonframechange – Controls whether focus should be updated when switching trajectory frames. Normally, the focus data will only be updated when the actual focus has been changed. But the user might want to obtain the new coordiantes of atoms when switching between frames. If set to
True, the focus data will be updated with new atom coordinates.updateselectiononframechange – Controls whether selection should be updated when switching trajectory frames. Normally, the selection data will only be updated when the actual selection has been changed. But the user might want to obtain the new coordiantes of atoms when switching between frames. If set to
True, the selection data will be updated with new atom coordinates.
See also
See how to control these properties with callbacks, refer to the Using Callbacks section.