atomSelAction
index
atomSelAction.py

modify or analyze an AtomSel
 
Member classes perform actions on atom objects associated with an
atomSel.AtomSel object. These are invoked using the apply() method 
of an AtomSel object. A user-defined AtomSelAction can be defined by
creating a class which derives from the PyAtomSelAction class.
 
Constituent classes:
 
SetProperty(name,value)
    set named property of all atom.Atoms in a selection
 
    The arguments are the name is a property of an Atom (e.g. pos) and 
    new value to use.
 
  Example:
 
    sel = AtomSel("name HN")
    sel.apply( SetProperty("atomName","H") )
    from vec3 import Vec3
    sel.apply( SetProperty("pos",Vec3(0,0,0)) )
 
 
SetVelAction(velVal)
 
  will set velocities of all atoms in the atom selection to the 
value velVal, of type vec3.Vec3.
 
Translate(transVal)
 
  will translate coordinates of all atoms in the selection to the 
value transVal, of type vec3.Vec3.
 
Rotate(rotMat,centerVec)
 
  will apply the rotation operation q = rotMat * (q-centerVec)
to the positions of all atoms in the selection, where q is the atom
position. If centerVec is omitted, it is taken to be the origin.
rotMat is of type mat3.Mat3, and centerVec is of type vec3.Vec3. 
 
Fit(fitTo,fitBy,altCoords)
 
  will perform an rmsd fitting to the list of atomic coordinates
specified in fitTo. fitBy is an atomSel.AtomSel which specifies
which coordinates are used in the rmsd calculation (all known atoms by
default). If altCoords is specified, use these instead of those in the
selection to calculate the fit (but still perform the fit
transformation on the coordinates of the AtomSel). Once constructed a
Fit object contains the methods rotation() and translation() which
return R and T, the rotation matrix and translation vector which
transform the initial coordinates into the fit coordinates by the
expression:
  
   qFit = R q + T
 
The actual transformation is applied using an AtomSel's apply()
method. Alternately, fitTo can be an AtomSel (with the same number of
atoms as fitBy). Using an AtomSel allows one to fit different
coordinates within a Simulation, or within different Simulations.
 
 
RMSD(compare)
 
  compute the rmsd of the atoms of the AtomSel with the contents of
compare.  Compare can be a list of atomic coordinates (of length
sel.simulation().numAtoms()) or an atomSel.AtomSel with the correct
number of atoms.  Using an AtomSel allows one to compare different
coordinates within a Simulation, or within different Simulations.  No
property of the AtomSel is modified. Rather, after calling the
AtomSel's apply() method, one can access two methods of the RSMD
object:
    rmsd() 
      the overall rmsd 
    byResidue()
      returns a dictionary, which contains per-residue RMSD values
      indexed by residue number.
 
 
examples:
 
#translate all atoms 3 angstroms in the x direction
#
from atomSelAction import Translate
AtomSel("all").apply( Translate(Vec3(3,0,0)) )
 
#use the alpha carbons to compute a rigid-body fit to the
#corresponding coordinates stored in fitTo. 
#All known atoms are then moved according to the fit transformation.
#
AtomSel("known").apply( Fit(fitTo,"name CA") )
 
#compute the backbone rmsd with the coordinates stored in otherCoords
#the 
#
comparer=RMSD(otherCoords)
AtomSel("name C or name CA or name N").apply(comparer)
for resid in comparer.byResidue().keys():
        print resid, comparer.byResidue()[resid]
 

 
Classes
       
__builtin__.object
Base
BasePtr
Fit
FitPtr
PyAtomSelAction
PyAtomSelActionPtr
RMSD
RMSDPtr
Rotate
RotatePtr
SetProperty
SetPropertyPtr
SetVelAction
SetVelActionPtr
Translate
TranslatePtr
String
StringPtr

 
class Base(__builtin__.object)
     Methods defined here:
__del__(self, destroy=<built-in function delete_Base>)
__getattr__ lambda self, name
__init__(self, *args)
__repr__(self)
__setattr__ lambda self, name, value
finish_unused(*args)
init_unused(*args)
run(*args)

Data and other attributes defined here:
__dict__ = <dictproxy object at 0x174de88>
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class BasePtr(Base)
    
Method resolution order:
BasePtr
Base
__builtin__.object

Methods defined here:
__init__(self, this)

Methods inherited from Base:
__del__(self, destroy=<built-in function delete_Base>)
__getattr__ lambda self, name
__repr__(self)
__setattr__ lambda self, name, value
finish_unused(*args)
init_unused(*args)
run(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174dad0>
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class Fit(Base)
    
Method resolution order:
Fit
Base
__builtin__.object

Methods defined here:
__del__(self, destroy=<built-in function delete_Fit>)
__getattr__ lambda self, name
__init__ = Fit__init__(s, *args)
__repr__(self)
__setattr__ lambda self, name, value
init_unused(*args)
rotation(*args)
run(*args)
translation(*args)

Properties defined here:
fitToSel
get = Fit_fitToSel_get(...)
set = Fit_fitToSel_set(...)

Data and other attributes defined here:
__swig_getmethods__ = {'fitToSel': <built-in function Fit_fitToSel_get>}
__swig_setmethods__ = {'fitToSel': <built-in function Fit_fitToSel_set>}

Methods inherited from Base:
finish_unused(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174dd00>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class FitPtr(Fit)
    
Method resolution order:
FitPtr
Fit
Base
__builtin__.object

Methods defined here:
__init__(self, this)

Methods inherited from Fit:
__del__(self, destroy=<built-in function delete_Fit>)
__getattr__ lambda self, name
__repr__(self)
__setattr__ lambda self, name, value
init_unused(*args)
rotation(*args)
run(*args)
translation(*args)

Properties inherited from Fit:
fitToSel
get = Fit_fitToSel_get(...)
set = Fit_fitToSel_set(...)

Data and other attributes inherited from Fit:
__swig_getmethods__ = {'fitToSel': <built-in function Fit_fitToSel_get>}
__swig_setmethods__ = {'fitToSel': <built-in function Fit_fitToSel_set>}

Methods inherited from Base:
finish_unused(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174de50>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class PyAtomSelAction(Base)
    
Method resolution order:
PyAtomSelAction
Base
__builtin__.object

Methods defined here:
__del__(self, destroy=<built-in function delete_PyAtomSelAction>)
__getattr__ lambda self, name
__init__(self, *args)
__repr__(self)
__setattr__ lambda self, name, value
help(*args)

Data and other attributes defined here:
__swig_getmethods__ = {}
__swig_setmethods__ = {}

Methods inherited from Base:
finish_unused(*args)
init_unused(*args)
run(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174d788>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class PyAtomSelActionPtr(PyAtomSelAction)
    
Method resolution order:
PyAtomSelActionPtr
PyAtomSelAction
Base
__builtin__.object

Methods defined here:
__init__(self, this)

Methods inherited from PyAtomSelAction:
__del__(self, destroy=<built-in function delete_PyAtomSelAction>)
__getattr__ lambda self, name
__repr__(self)
__setattr__ lambda self, name, value
help(*args)

Data and other attributes inherited from PyAtomSelAction:
__swig_getmethods__ = {}
__swig_setmethods__ = {}

Methods inherited from Base:
finish_unused(*args)
init_unused(*args)
run(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174d868>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class RMSD(Base)
    
Method resolution order:
RMSD
Base
__builtin__.object

Methods defined here:
__del__(self, destroy=<built-in function delete_RMSD>)
__getattr__ lambda self, name
__init__ = RMSD__init__(s, arg)
__repr__(self)
__setattr__ lambda self, name, value
byResidue(*args)
finish_unused(*args)
init_unused(*args)
rmsd(*args)
run(*args)

Properties defined here:
compareSel
get = RMSD_compareSel_get(...)
set = RMSD_compareSel_set(...)

Data and other attributes defined here:
__swig_getmethods__ = {'compareSel': <built-in function RMSD_compareSel_get>}
__swig_setmethods__ = {'compareSel': <built-in function RMSD_compareSel_set>}

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174d7c0>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class RMSDPtr(RMSD)
    
Method resolution order:
RMSDPtr
RMSD
Base
__builtin__.object

Methods defined here:
__init__(self, this)

Methods inherited from RMSD:
__del__(self, destroy=<built-in function delete_RMSD>)
__getattr__ lambda self, name
__repr__(self)
__setattr__ lambda self, name, value
byResidue(*args)
finish_unused(*args)
init_unused(*args)
rmsd(*args)
run(*args)

Properties inherited from RMSD:
compareSel
get = RMSD_compareSel_get(...)
set = RMSD_compareSel_set(...)

Data and other attributes inherited from RMSD:
__swig_getmethods__ = {'compareSel': <built-in function RMSD_compareSel_get>}
__swig_setmethods__ = {'compareSel': <built-in function RMSD_compareSel_set>}

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174dc58>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class Rotate(Base)
    
Method resolution order:
Rotate
Base
__builtin__.object

Methods defined here:
__del__(self, destroy=<built-in function delete_Rotate>)
__getattr__ lambda self, name
__init__(self, *args)
__repr__(self)
__setattr__ lambda self, name, value
run(*args)

Data and other attributes defined here:
__swig_getmethods__ = {}
__swig_setmethods__ = {}

Methods inherited from Base:
finish_unused(*args)
init_unused(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174d670>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class RotatePtr(Rotate)
    
Method resolution order:
RotatePtr
Rotate
Base
__builtin__.object

Methods defined here:
__init__(self, this)

Methods inherited from Rotate:
__del__(self, destroy=<built-in function delete_Rotate>)
__getattr__ lambda self, name
__repr__(self)
__setattr__ lambda self, name, value
run(*args)

Data and other attributes inherited from Rotate:
__swig_getmethods__ = {}
__swig_setmethods__ = {}

Methods inherited from Base:
finish_unused(*args)
init_unused(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174dad0>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class SetProperty(Base)
    
Method resolution order:
SetProperty
Base
__builtin__.object

Methods defined here:
__del__(self, destroy=<built-in function delete_SetProperty>)
__getattr__ lambda self, name
__init__ = SetProperty__init__(s, name, val)
__repr__(self)
__setattr__ lambda self, name, value
run(*args)

Data and other attributes defined here:
__swig_getmethods__ = {}
__swig_setmethods__ = {}

Methods inherited from Base:
finish_unused(*args)
init_unused(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174dc58>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class SetPropertyPtr(SetProperty)
    
Method resolution order:
SetPropertyPtr
SetProperty
Base
__builtin__.object

Methods defined here:
__init__(self, this)

Methods inherited from SetProperty:
__del__(self, destroy=<built-in function delete_SetProperty>)
__getattr__ lambda self, name
__repr__(self)
__setattr__ lambda self, name, value
run(*args)

Data and other attributes inherited from SetProperty:
__swig_getmethods__ = {}
__swig_setmethods__ = {}

Methods inherited from Base:
finish_unused(*args)
init_unused(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174d8a0>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class SetVelAction(Base)
    
Method resolution order:
SetVelAction
Base
__builtin__.object

Methods defined here:
__del__(self, destroy=<built-in function delete_SetVelAction>)
__getattr__ lambda self, name
__init__(self, *args)
__repr__(self)
__setattr__ lambda self, name, value
run(*args)

Data and other attributes defined here:
__swig_getmethods__ = {}
__swig_setmethods__ = {}

Methods inherited from Base:
finish_unused(*args)
init_unused(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174da28>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class SetVelActionPtr(SetVelAction)
    
Method resolution order:
SetVelActionPtr
SetVelAction
Base
__builtin__.object

Methods defined here:
__init__(self, this)

Methods inherited from SetVelAction:
__del__(self, destroy=<built-in function delete_SetVelAction>)
__getattr__ lambda self, name
__repr__(self)
__setattr__ lambda self, name, value
run(*args)

Data and other attributes inherited from SetVelAction:
__swig_getmethods__ = {}
__swig_setmethods__ = {}

Methods inherited from Base:
finish_unused(*args)
init_unused(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174dc58>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class String(__builtin__.object)
     Methods defined here:
__del__(self, destroy=<built-in function delete_String>)
__getattr__ lambda self, name
__iadd__(*args)
__init__(self, *args)
__repr__(self)
__setattr__ lambda self, name, value
blockSize(*args)
charPtr(*args)
contains(*args)
copy(*args)
downcase(*args)
glob(*args)
gsub(*args)
length(*args)
matches(*args)
resize(*args)
split(*args)
strip(*args)
upcase(*args)

Data and other attributes defined here:
__dict__ = <dictproxy object at 0x174d830>
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'String' objects>
list of weak references to the object (if defined)

 
class StringPtr(String)
    
Method resolution order:
StringPtr
String
__builtin__.object

Methods defined here:
__init__(self, this)

Methods inherited from String:
__del__(self, destroy=<built-in function delete_String>)
__getattr__ lambda self, name
__iadd__(*args)
__repr__(self)
__setattr__ lambda self, name, value
blockSize(*args)
charPtr(*args)
contains(*args)
copy(*args)
downcase(*args)
glob(*args)
gsub(*args)
length(*args)
matches(*args)
resize(*args)
split(*args)
strip(*args)
upcase(*args)

Data and other attributes inherited from String:
__dict__ = <dictproxy object at 0x174d7f8>
dictionary for instance variables (if defined)
__swig_getmethods__ = {}
__swig_setmethods__ = {}
__weakref__ = <attribute '__weakref__' of 'String' objects>
list of weak references to the object (if defined)

 
class Translate(Base)
    
Method resolution order:
Translate
Base
__builtin__.object

Methods defined here:
__del__(self, destroy=<built-in function delete_Translate>)
__getattr__ lambda self, name
__init__(self, *args)
__repr__(self)
__setattr__ lambda self, name, value
run(*args)

Data and other attributes defined here:
__swig_getmethods__ = {}
__swig_setmethods__ = {}

Methods inherited from Base:
finish_unused(*args)
init_unused(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174d6a8>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
class TranslatePtr(Translate)
    
Method resolution order:
TranslatePtr
Translate
Base
__builtin__.object

Methods defined here:
__init__(self, this)

Methods inherited from Translate:
__del__(self, destroy=<built-in function delete_Translate>)
__getattr__ lambda self, name
__repr__(self)
__setattr__ lambda self, name, value
run(*args)

Data and other attributes inherited from Translate:
__swig_getmethods__ = {}
__swig_setmethods__ = {}

Methods inherited from Base:
finish_unused(*args)
init_unused(*args)

Data and other attributes inherited from Base:
__dict__ = <dictproxy object at 0x174da98>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Base' objects>
list of weak references to the object (if defined)

 
Functions
       
Fit__init__(s, *args)
RMSD__init__(s, arg)
SetProperty__init__(s, name, val)
help(...)