Changes between Version 23 and Version 24 of ChimeraAnimationState


Ignore:
Timestamp:
Feb 4, 2011, 2:07:40 PM (15 years ago)
Author:
Darren Weber
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ChimeraAnimationState

    v23 v24  
    6565 1. incremental diff for sequential key-frames
    6666 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
     77Model 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.
    7678{{{
    7779#!python
     
    8284}}}
    8385
    84 ==== Custom Models ====
     86=== Custom Models ===
    8587
    8688The Chimera module called !PythonModel is used to define custom model types entirely in Python, drawn using [http://pyopengl.sourceforge.net/ PyOpenGL].
     
    9395See also the [http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/bild.html Chimera BILD] commands.
    9496
    95 ==== 'Active' models ====
     97=== 'Active' models ===
    9698
    9799{{{
     
    129131}}}
    130132
    131 === Molecules ===
     133=== openState attributes ===
     134
     135Get the !OpenState attributes of a model: {{{chimera.openModels.openState(id: int, subid: int)}}}
     136
     137From 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)
     148Help 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 ==
    132160
    133161Molecule 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.
     
    156184
    157185
    158 
    159186=== Atoms ===
    160187
     
    188215        print a.drawMode == chimera.Atom.Sphere
    189216}}}
    190 
    191217
    192218==== Color and Material Attributes ====
     
    259285
    260286
    261 
    262 
    263 
    264 Get a PDB molecule to play with:
     287An example IDLE session.  Start with a PDB molecule to play with:
    265288{{{
    266289#!python
     
    309332}}}
    310333
    311 
    312 === General Spatial Properties ===
     334=== Bonds ===
     335
     336{{{
     337#!python
     338for 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 ==
    313350
    314351{{{
     
    348385Some tips in the [http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/faq.html programming FAQ] are useful (esp, items 4, 5, 7-10).
    349386
    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! ===
    351389
    352390From the [http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/faq.html FAQ], item (7): Some attributes return a copy of an object.
     
    362400Some 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.
    363401
    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 #!python
    375 
    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).xform
    387 }}}