Biskit :: Pymoler :: Pymoler :: Class Pymoler
[hide private]
[frames] | no frames]

Class Pymoler

source code


Run Pymol

Create a pymol script file (.pml) and execule it using Pymol.

Example usage

>>> pm = Pymoler()
>>> pm.addPdb( model )
>>> pm.run()

References




Notes:

Instance Methods [hide private]
  __init__(self, full=0, mode='w', verbose=1, **kw)
  __del__(self)
  flush(self)
Flush output file (but keep it open).
  add(self, str)
Add String str and line break to file.
str addMovie(self, pdb, modName=None)
Add one or several existing pdb files or Structure objects to one model.
  addFrame(self, frame, modName)
Add file(s) or Structure(s) to an EXISTING model as movie.
str _getFreeModName(self, base, index)
Return next free model name in dictionary, made up from base + index
str addPdb(self, pdb, modName=None)
Add one or several existing pdbs.
  makeSel(self, selDic)
Make a selection.
  writeStructures(self)
Write all needed PDB files to disc.
  addDeleteScript(self)
Deletes the pymol script file from disc
  addDeletePdbs(self)
Deletes the pdb-files in the list from disc
  setAtomValues(self, model, values, key='temperature_factor', lastOnly=0)
Add numeric value to all atoms of all Structures or the last Structure in a model..
  setResValues(self, model, values, key='temperature_factor', lastOnly=0)
Add numeric value per residue to all atoms of all Structures or the last Structure in a model.
  colorAtoms(self, model, values, lastOnly=0)
Color atoms of this model by list of values.
  colorRes(self, model, values, lastOnly=0)
Color residues of this model by list of values.
[str] addColors(self, nColors, firstColor=[1.0,0.0,0.0], lastColor=[0.0,1.0,0.0])
Define a range of colors that can be called in PyMol by name.
  initPymol(self)
Do some stuff always first...
  prepare(self, cleanUp=1)
Overrides Executor method.
  show(self)
Backward compatability with old scripts.

Method Details [hide private]

__init__(self, full=0, mode='w', verbose=1, **kw)
(Constructor)

source code 
Parameters:
  • mode (str) - open file with this mode, w=override, a=append
  • full (0|1|2) - dispaly pymol structures in fill screen mode:
                  0 - normal mode
                  1 - full screen mode
                  2 - full screen and no menues
    

__del__(self)
(Destructor)

source code 

flush(self)

source code 

Flush output file (but keep it open).

add(self, str)

source code 

Add String str and line break to file.
Parameters:
  • str (str) - string to add to pml file

addMovie(self, pdb, modName=None)

source code 

Add one or several existing pdb files or Structure objects to one model. Several files will hence end up as single movie (i.e. as frames of a model in PyMol).
Parameters:
  • pdb (str or [str] OR PDBModel or [PDBModel]) - file name or a list of file names OR PDBModel or list of PDBModels
  • modName (str OR None) - model name, will show up in PyMol. If 'None' a model name will be created from the source file name and a serial number.
Returns: str
the modName of the added model

addFrame(self, frame, modName)

source code 

Add file(s) or Structure(s) to an EXISTING model as movie.
Parameters:
  • frame (str(s) or PDBModel(s)) - the structure to add to an existing model
  • modName (str) - model name, must be existing (i.e. an already added model)

_getFreeModName(self, base, index)

source code 

Return next free model name in dictionary, made up from base + index
Parameters:
  • base (str) - name base
  • index (int) - name suffix
Returns: str
name composed of base+suffix

addPdb(self, pdb, modName=None)

source code 

Add one or several existing pdbs. Make sure all go into different models (have different model names).
Parameters:
  • pdb (str or [str] OR PDBModel or [PDBModel]) - file name or a list of file names OR PDBModel or list of PDBModels
  • modName (str OR None) - force model name, will change for list of file names. If 'None' a model name will be created from the source file name.
Returns: str
model name of first file

makeSel(self, selDic)

source code 

Make a selection.
Parameters:
  • selDic (dict) - a selection dictionary, that can be of three types:
  • dictionary with one or more of the keys: 'model' 'segment', 'chain', 'residue', 'atom'
  • dictionary with key: 'element'
  • dictionaty with key: 'expression'

writeStructures(self)

source code 

Write all needed PDB files to disc.

addDeleteScript(self)

source code 

Deletes the pymol script file from disc

addDeletePdbs(self)

source code 

Deletes the pdb-files in the list from disc

setAtomValues(self, model, values, key='temperature_factor', lastOnly=0)

source code 

Add numeric value to all atoms of all Structures or the last Structure in a model.. The values will be written to either the B- (temperature_factor) or Q-factor 'occupancy' column in the temporary pdb-file. These values can then be used to display properties in PyMol via commands like 'color_b' and 'color_q'. See also setResValues.
Parameters:
  • model (str) - model name
  • values ([float]) - list of numbers, len( values ) == number of atoms
  • key (occupancy|temperature_factor) - key for Atom.properties dictionary (default: temperature_factor)
  • lastOnly (1|0) - 0 - add to all in model OR 1 - add only to last Structure (default: 0)

setResValues(self, model, values, key='temperature_factor', lastOnly=0)

source code 

Add numeric value per residue to all atoms of all Structures or the last Structure in a model. The values will be written to either the B- (temperature_factor) or Q-factor 'occupancy' column in the temporary pdb-file. These values can then be used to display properties in PyMol via commands like 'color_b' and 'color_q'. See also setAtomValues.
Parameters:
  • model (str) - model name
  • values ([float]) - list of numbers, len( values ) == number of residues
  • key (occupancy|temperature_factor) - key for Atom.properties dictionary (default: temperature_factor)
  • lastOnly (1|0) - 0 - add to all in model OR 1 - add only to last Structure (default: 0)

colorAtoms(self, model, values, lastOnly=0)

source code 

Color atoms of this model by list of values.
Parameters:
  • model (str) - model name
  • values ([float]) - len == number of atoms
  • lastOnly (1|0) - 0 - add to all in model OR 1 - add only to last Structure (default: 0)

colorRes(self, model, values, lastOnly=0)

source code 

Color residues of this model by list of values.
Parameters:
  • model (str) - model name
  • values (list of numbers) - len == number of residues
  • lastOnly () - 0 .. add to all in model 1 .. add only to last Structure

addColors(self, nColors, firstColor=[1.0,0.0,0.0], lastColor=[0.0,1.0,0.0])

source code 

Define a range of colors that can be called in PyMol by name.
Parameters:
  • nColors (int) - numbers of colors generated
  • firstColor ([float]) - first rgb color (default: [1.0, 0.0, 0.0])
  • lastColor ([float]) - last rgb color (default: [0.0, 1.0, 0.0])
Returns: [str]
a list of the color names

initPymol(self)

source code 

Do some stuff always first...

prepare(self, cleanUp=1)

source code 

Overrides Executor method.

show(self)

source code 

Backward compatability with old scripts.