Package Biskit :: Module AmberEntropyMaster :: Class AmberEntropyMaster
[hide private]
[frames] | no frames]

Class AmberEntropyMaster

source code


Run many AmberEntropist calculations on many nodes. The Master has a standard set of 13 protocols to run on rec, lig, and com trajectories, as well as on every single member trajectory - in total 113. It accepts one variable parameter, e.g. s(tart). Each protocol is then run for all values of the variable parameter. A protocol is simply a set of options that are passed on to the AmberEntropist (which is run from within AmberEntropySlave). Comparing the different protocols allows to more or less separate random from real correlations, rigid body from intermolecular vibrations, etc.

Results are put into a tree-shaped dictionary of dictionaries. The first dimension/key is the member index -- None for the complete ensemble trajectory, 0 for the first member, etc. The second dimension/key is the name of the protocol, e.g. 'com_split' for the complex trajectory with seperately fitted receptor and ligand. The last dimension contains the different values obtained from the ptraj run, e.g. 'S_total' points to the total entropy in cal/mol/K, 'contributions' to the entropy contribution of each mode, 'T' to the assumed temperature, 'vibes' gives the number of vibrations with too low frequencies (according to ptraj). All these are lists of values - one for each value of the variable option.

Example:
        * r[None]['fcom']['S_vibes'][0] -> float
          first vibr. Entropy of free fake complex for complete ensemble
        * r[0]['com']['S_total'] -> [ float, float, .. ]
          the total entropies of the complex calculated for the first
          ensemble member and the different values of the variable option


Instance Methods [hide private]
  __init__(self, rec=None, lig=None, com=None, out=None, cr=None, var='s', vrange=[0], jack=0, zfilter=None, clean=0, all=1, exrec=[], exlig=[], excom=[], hosts=cpus_all, niceness=nice_dic, w=0, a=1, debug=0, restart=0, **kw)
[int] OR [float] __vrange(self, v)
Interprete the vrange option -> [ int ] or [ float ]
int OR float __float_int(self, v)
Convert v to int or, if necessary, float
trajectoty, [int], [int] loadTraj(self, fname, outliers=[], refname=None)
Load trajectory from file.
  processTrajs(self)
Extract reference model and member trajectories from rec, lig, and com trajectories.
  equalizeMemberCount(self, n_rec, n_lig, n_com)
Ensure we keep equal number of members trajectories from frec, flig, and com.
  prepareJackknife(self)
Prepare leave-one-trajectory-out jackknife test.
  nameRef(self, fname)
  nameRefCom(self, fname)
str dumpMissing(self, o, fname)
Pickle *o* to path *fname*, if it is not already there.
[int] getOutliers(self, traj, outlaws=[])
Identify member trajectories that haved moved much further than normal.
[str] dumpMembers(self, traj, fname)
Dump ensemble member trajectories
{param:value} getInitParameters(self, slave_tid)
hand over parameters to slave once.
  cleanup(self)
Tidy up
  cleanCache(self)
Remove left-over cache files
  saveProtocols(self)
Save protocol to file.
  done(self)
Write result to file.
  __cpupdate(self, d1, d2)
Merge 2 dictionaries *d1* and *d2* and return a copy
dict of dict protocols_standard(self, trec, tlig, tcom, ex_frec=None, ex_flig=None, ex_com=None, doshift=1, **options)
Create 13 parameter sets for AmberEntropist that cover the calculation of rec, lig, com and fcom entropies with and without splitting of the complex, with and without shifting and shuffling of frames.
dict of dict protocols_single_all(self, **options)
Set of protocols for all-member trajectories AND single-member traj.
  protocols_var_range(self, **options)
Complete set of protocols also considering different values of the variable option.
dict of dict of dict of dict dictionate(self, d)
Take dict with tuple keys (value, int_member, str_protocol) and build a tree-like dict of dicts in which the values of d can be accessed like:
dict of dict of dict of lists getResult(self, **arg)
Collapse the results for different values of the variable parameter into lists and put the results into a tree ala:

Inherited from PVM.TrackingJobMaster.TrackingJobMaster: calculateResult, finish, getRst, hostnameFromTID, is_valid_slave, job_done, mark_slow_slaves, notifyAll, reportProgress, saveRst, setCallback, setRst, start_job

Inherited from PVM.dispatcher.JobMaster: bindMessages, get_slave_chunk, initializationDone, spawn, spawnAll, start

Inherited from PVM.PVMThread.PVMMasterSlave: exit, initialize, messageLoopIsUp, startMessageLoop

Inherited from PVM.PVMThread.PVMThread: bind, getBindings, getMessageLoopDelay, getParent, getPingTimeout, getTID, getTasks, isStopped, log, messageLoopIsStopped, nicknameFromTID, ping, post, post_execute_method, post_message_received, post_message_sent, rm_log, run, send, sendToAll, send_primitive, setMessageLoopDelay, setPingTimeout, stop, stopMessageLoop, unbind

Inherited from PVM.PVMThread.PVMThread (private): _ping

Inherited from threading.Thread: __repr__, getName, isAlive, isDaemon, join, setDaemon, setName

Inherited from threading.Thread (private): _set_daemon

Inherited from threading._Verbose (private): _note

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, rec=None, lig=None, com=None, out=None, cr=None, var='s', vrange=[0], jack=0, zfilter=None, clean=0, all=1, exrec=[], exlig=[], excom=[], hosts=cpus_all, niceness=nice_dic, w=0, a=1, debug=0, restart=0, **kw)
(Constructor)

source code 
Parameters:
  • rec (str) - free rec trajectory [required]
  • lig (str) - free lig trajectory [required]
  • com (str) - complex trajectory [required]
  • out (str) - file name for pickled result [required]
  • cr ([int]) - chains of receptor in complex trajectory [n_chains rec]
  • var (str) - name of variable option [ s ]
  • vrange ([any]) - set of values used for variable option OR 'start:stop:step', string convertable to range() input
  • jack ([0|1]) - set up leave-one-trajectory-out jackknife test (default: 0) (replaces var with 'ex1' and vrange with range(1,n_members+1))
  • zfilter (float) - kick out outlyer trajectories using z-score threshold on RMSD trace (default: None->don't)
  • clean (0|1) - remove pickled ref models and member trajectories (default: 0)
  • all (0|1) - skip single member trajs (default: 1)
  • exrec ([int]) - exclude certain members of receptor ensemble [[]]
  • exlig ([int]) - exclude certain members of ligand ensemble [[]]
  • excom ([int]) - exclude certain members of complex ensemble [[]]
  • hosts ([str]) - nodes to be used (default: all known)
  • debug (1|0) - don't delete output files (default: 0)
  • kw (key=value pairs :
     ... parameters for AmberEntropist
     cast    - 1|0, equalize free and bound atom content [1]
     s,e     - int, start and stop frame                 [0, to end]
     atoms   - [ str ], names of atoms to consider       [all]
     step    - int, frame offset                         [no offset]
     thin    - float, use randomly distributed fraction of frames [all]
               (similar to step but perhaps better for entropy
               calculations)
     ex      - [int] OR ([int],[int]), exclude member trajectories   [[]]
     ex_n    - int, exclude last n members  OR...                  [None]
     ex3     - int, exclude |ex3|rd tripple of trajectories          [0]
               (index starts with 1! 0 to exclude nothing)
    
     ... parameters for AmberCrdEntropist
     f_template - str, alternative ptraj input template  [default]
    
     ... parameters for Executor:
     log      - Biskit.LogFile, program log (None->STOUT)        [None]
     verbose  - 0|1, print progress messages to log     [log != STDOUT]
    
     ... parameters for Master
     w        - 0|1, show X window for each slave [0]
     a        - 0|1, add hosts to PVM [1]
    
    ) - additional key=value parameters for AmberEntropist, AmberCrdEntropist, Executor and Master.
Overrides: PVM.TrackingJobMaster.TrackingJobMaster.__init__

__vrange(self, v)

source code 

Interprete the vrange option -> [ int ] or [ float ]
Parameters:
  • v (lst OR str) - vrange option
Returns: [int] OR [float]
range option

__float_int(self, v)

source code 

Convert v to int or, if necessary, float
Parameters:
  • v (any) - value
Returns: int OR float
converted value

loadTraj(self, fname, outliers=[], refname=None)

source code 

Load trajectory from file.
Parameters:
  • fname (str) - path to trajectory
  • outliers ([int] OR []) - Identify outlier trajectories (default: [], identify)
  • refname (str) - name of reference (efault: None)
Returns: trajectoty, [int], [int]
t, outliers, members

processTrajs(self)

source code 

Extract reference model and member trajectories from rec, lig, and com trajectories. Identify outlier member trajectories, if requested.

equalizeMemberCount(self, n_rec, n_lig, n_com)

source code 

Ensure we keep equal number of members trajectories from frec, flig, and com.
Parameters:
  • n_rec (int) - number of receptor trajectories
  • n_lig (int) - number of ligand trajectories
  • n_com (int) - number of complex trajectories

prepareJackknife(self)

source code 

Prepare leave-one-trajectory-out jackknife test.

nameRef(self, fname)

source code 

nameRefCom(self, fname)

source code 

dumpMissing(self, o, fname)

source code 

Pickle *o* to path *fname*, if it is not already there.
Parameters:
  • o (any) - object to dump
  • fname (str) - file name
Returns: str
file name

getOutliers(self, traj, outlaws=[])

source code 

Identify member trajectories that haved moved much further than normal.
Parameters:
  • traj (Trajectory) - Trajectory to analyze
  • outlaws ([int]) - members already marked for exclusion
Returns: [int]
member indices of outlyer trajectories (plus outlaws)

dumpMembers(self, traj, fname)

source code 

Dump ensemble member trajectories
Parameters:
  • traj (Trajectory) - Trajectory to dump
  • fname (str') - trajectory file name - used to derrive name for members
Returns: [str]
list of trajectory files

getInitParameters(self, slave_tid)

source code 

hand over parameters to slave once.
Parameters:
  • slave_tid (int) - slave task id
Returns: {param:value}
dictionary with init parameters
Overrides: PVM.dispatcher.JobMaster.getInitParameters

cleanup(self)

source code 

Tidy up
Overrides: PVM.TrackingJobMaster.TrackingJobMaster.cleanup

cleanCache(self)

source code 

Remove left-over cache files

saveProtocols(self)

source code 

Save protocol to file.

done(self)

source code 

Write result to file.
Overrides: PVM.TrackingJobMaster.TrackingJobMaster.done

__cpupdate(self, d1, d2)

source code 

Merge 2 dictionaries *d1* and *d2* and return a copy

protocols_standard(self, trec, tlig, tcom, ex_frec=None, ex_flig=None, ex_com=None, doshift=1, **options)

source code 

Create 13 parameter sets for AmberEntropist that cover the calculation of rec, lig, com and fcom entropies with and without splitting of the complex, with and without shifting and shuffling of frames.
Parameters:
  • options (key=value) - additional options (like cast, s, e, atoms, thin, step) that are the same in all parameter sets
Returns: dict of dict
each value of the returned dict contains a set of arguments for one AmberEntropist run

protocols_single_all(self, **options)

source code 

Set of protocols for all-member trajectories AND single-member traj. with the different shuffle, shift, split settings. Usually 11 x 13 protocols for AmberEntropist (10 members and 1 for all)
Parameters:
  • options (key=value) - additional options (like cast, s, e, atoms, thin, step) that are the same in all parameter sets
Returns: dict of dict
each value of the returned dict contains a set of arguments for one AmberEntropist run, each key is a tuple of the member index and the protocol name, i.e. (0, 'fcom_shuffle') The set of protocols for all-member trajectories has member index None.

protocols_var_range(self, **options)

source code 

Complete set of protocols also considering different values of the variable option.

dictionate(self, d)

source code 

Take dict with tuple keys (value, int_member, str_protocol) and build a tree-like dict of dicts in which the values of d can be accessed like:
 d[value][int_member][str_protocol]
Parameters:
  • d (dict) - the raw results accumulated from the slave nodes
Returns: dict of dict of dict of dict
tree-like dict ordered by variable value, member, protocol

getResult(self, **arg)

source code 

Collapse the results for different values of the variable parameter into lists and put the results into a tree ala:
 r[ member_index ][ protocol_name ][ result_field ] -> [ values ]
Returns: dict of dict of dict of lists
tree-like dict ordered by variable value, member, protocol
Overrides: PVM.TrackingJobMaster.TrackingJobMaster.getResult