Changes between Version 23 and Version 24 of ChimeraAnimationState
- Timestamp:
- Feb 4, 2011, 2:07:40 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ChimeraAnimationState
v23 v24 65 65 1. incremental diff for sequential key-frames 66 66 2. saving immutable openModels.list() 67 a. saving to RAM 68 b. saving to disk (pickle, sqlite, etc.) 69 c. optimization issues (threading) 70 d. see http://docs.python.org/library/persistence.html 71 72 73 === Model Types === 74 75 Models types are Python classes. They all subclass from chimera.Model, but Python does not keep track of what classes subclass from a base class. The best you can do is to get a set of all the currently open model types. Keep in mind that a Chimera extension can introduce additional model types, so the set is always a subset. 67 a. If it's possible, options include: 68 i. by default, python objects are in RAM, use tuples for immutability 69 ii. saving to disk (pickle, sqlite, etc.) 70 iii. optimization issues (threading, using some kind set object) 71 iv. see http://docs.python.org/library/persistence.html 72 b. The c++ implementation of Chimera objects doesn't fully support pickle 73 74 75 == Model Types == 76 77 Model types are Python classes. They all subclass from chimera.Model, but Python does not keep track of what classes subclass from a base class. The best you can do is to get a set of all the currently open model types. Keep in mind that a Chimera extension can introduce additional model types, so the set is always a subset. 76 78 {{{ 77 79 #!python … … 82 84 }}} 83 85 84 === = Custom Models ====86 === Custom Models === 85 87 86 88 The Chimera module called !PythonModel is used to define custom model types entirely in Python, drawn using [http://pyopengl.sourceforge.net/ PyOpenGL]. … … 93 95 See also the [http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/bild.html Chimera BILD] commands. 94 96 95 === = 'Active' models ====97 === 'Active' models === 96 98 97 99 {{{ … … 129 131 }}} 130 132 131 === Molecules === 133 === openState attributes === 134 135 Get the !OpenState attributes of a model: {{{chimera.openModels.openState(id: int, subid: int)}}} 136 137 From the [http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/faq.html FAQ], item (10): The openState attribute of a Model controls whether that model is active for motion ('.active'), and contains the model's transformation matrix ('.xform') and center of rotation ('.cofr'). Since some models must move in synchrony (e.g. a molecule and its surface), !OpenState instances may be shared among multiple models. If you create a model that needs a shared openState with another model, then when adding your model to the list of open models with chimera.openModels.add(), you should use the 'sameAs' keyword to specify the other model. 138 139 ==== openState.xform ==== 140 141 {{{ 142 #!python 143 144 >>> dir(model_openState.xform) 145 ['__class__', '__copy__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'apply', 'coordFrame', 'getCoordFrame', 'getOpenGLMatrix', 'getRotation', 'getTranslation', 'identity', 'inverse', 'invert', 'isIdentity', 'lookAt', 'makeOrthogonal', 'multiply', 'premultiply', 'rotate', 'rotation', 'translate', 'translation', 'xRotate', 'xRotation', 'xform', 'yRotate', 'yRotation', 'zAlign', 'zRotate', 'zRotation'] 146 147 >>> help(model_openState.xform) 148 Help on Xform object: 149 150 ... 151 152 >>> models = chimera.openModels.list(all=True) 153 >>> for m in models: 154 chimera.openModels.openState(m.id, m.subid).xform 155 }}} 156 157 158 159 == Molecules == 132 160 133 161 Molecule models have some global attributes, like {{{display}}} and {{{color}}}, that can alter their appearance. Note that color properties will propagate into all elements of a molecule model (residues, atoms, bonds) that do not have any specific 'component' settings. Whenever a component (residue, atom, bond) has it's own color properties, they override the global molecule color properties. … … 156 184 157 185 158 159 186 === Atoms === 160 187 … … 188 215 print a.drawMode == chimera.Atom.Sphere 189 216 }}} 190 191 217 192 218 ==== Color and Material Attributes ==== … … 259 285 260 286 261 262 263 264 Get a PDB molecule to play with: 287 An example IDLE session. Start with a PDB molecule to play with: 265 288 {{{ 266 289 #!python … … 309 332 }}} 310 333 311 312 === General Spatial Properties === 334 === Bonds === 335 336 {{{ 337 #!python 338 for bond in model.bonds: 339 bond.display 340 if bond.color is not None: 341 bond.color.rgba() 342 }}} 343 344 === Residues === 345 346 347 348 349 == General Spatial Properties == 313 350 314 351 {{{ … … 348 385 Some tips in the [http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/faq.html programming FAQ] are useful (esp, items 4, 5, 7-10). 349 386 350 ==== Attributes: To Copy or Not to Copy, that is the question! ==== 387 388 === Attributes: To Copy or Not to Copy, that is the question! === 351 389 352 390 From the [http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/faq.html FAQ], item (7): Some attributes return a copy of an object. … … 362 400 Some Chimera objects returned as attributes are always copies, some are always references to the uncopied object. Objects that are always copied include {{{Xform, Vector, Point, Sphere, Element, MolResId, Coord,}}} .... Objects that are never copied include {{{Atom, Bond, PseudoBond, CoordSet, Molecule, Residue, RibbonStyle,}}} .... Object that can be copied have a {{{__copy__}}} method. In order to know if an object type is passed by value is to look at the Chimera C++ header files. Classes without a !WrapPy base class are always copied. This base class is part of the C++ to Python interface generation. 363 401 364 365 === openState attributes ===366 367 Get the !OpenState attributes of a model: {{{chimera.openModels.openState(id: int, subid: int)}}}368 369 From the [http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/faq.html FAQ], item (10): The openState attribute of a Model controls whether that model is active for motion ('.active'), and contains the model's transformation matrix ('.xform') and center of rotation ('.cofr'). Since some models must move in synchrony (e.g. a molecule and its surface), !OpenState instances may be shared among multiple models. If you create a model that needs a shared openState with another model, then when adding your model to the list of open models with chimera.openModels.add(), you should use the 'sameAs' keyword to specify the other model.370 371 ==== openState.xform ====372 373 {{{374 #!python375 376 >>> dir(model_openState.xform)377 ['__class__', '__copy__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'apply', 'coordFrame', 'getCoordFrame', 'getOpenGLMatrix', 'getRotation', 'getTranslation', 'identity', 'inverse', 'invert', 'isIdentity', 'lookAt', 'makeOrthogonal', 'multiply', 'premultiply', 'rotate', 'rotation', 'translate', 'translation', 'xRotate', 'xRotation', 'xform', 'yRotate', 'yRotation', 'zAlign', 'zRotate', 'zRotation']378 379 >>> help(model_openState.xform)380 Help on Xform object:381 382 ...383 384 >>> models = chimera.openModels.list(all=True)385 >>> for m in models:386 chimera.openModels.openState(m.id, m.subid).xform387 }}}
![[Chimera Issue Tracking System]](/trac/chimera/chrome/site/chimera_logo.png)