impact module¶
Analysis of impact of torsional rotations.
Warning
non-functional - started to upgrade 5/5/14, but realized that current pickling is not saving everything needed. Could be a substantial task to get this working again...
usage: impact.py [options] <residueInfo jar-file> [<pdb-file>]
usage: impact.py -h for help on command-line options
usage: help or help_all for commands at the (Cmd) prompt
As an imported module, provides functions for graphic analysis and annotation of torsion angle changes. In stand-alone mode, loads the residue information table that has been pickled after a prior refinement, allowing quick analysis without re-running the refinement.
The annotation option (command-line or plot command) allows plots to be customized through python / matlibplot annotation to show (for example) independently calculated dynamic domains, NMR relaxation or chemical shift data etc..
Coming soon: mapping impact into the B-factor fields of a PDB file, supporting display in PyMol.
Module author: Michael S. Chapman <chapmami@ohsu.edu>
Changed in version 10/23/2012.
Changed in version 04/02/2013: 0.4.0
Changed in version 04/30/2015: 0.5.0 restructured text documentation
-
class
impact.
Arguments
(imports=[], main=True, *args, **kwargs)¶ Bases:
argparser.ArgumentParser
Subclass, adding program-specific command-line options.
Parameters: - imports ((list of) ArgumentParser method(s)) – method(s) adding arguments to ArgumentParser instance. (Alternative to ArgumentParser parents w/ better maintained groups.)
- main (bool) – Parser for main program (i.e. not listed within an ArgumentParser parents argument). Adds default program information.
-
static
export
()¶ Adding options used in both stand-alone and imported modes.
-
finalize
()¶ Completion of the parser after program sub-class initialized.
-
class
impact.
Commands
(cntrl, cmd_file, option)¶ Bases:
impact.CommandsAdded
-
do_show
(rest)¶
-
help_show
()¶
-
-
class
impact.
CommandsAdded
¶ Bases:
object
Methods with which to extend superpose.Commands().
-
do_color
(rest)¶
-
do_histogram
(rest)¶
-
do_plot
(rest)¶
-
help_color
()¶
-
help_histogram
()¶
-
help_plot
()¶
-
-
class
impact.
ControlAdded
¶ Bases:
object
Methods with which to extend superpose.Control().
-
color
(output, coordinates=None, combined=False, angles=False, impact=False)¶ Write PDB file with B-factor set to φ/ψ change or impact.
Ready for coloring in PyMol
Parameters: - output (str) – new PDB filename
- coordinates (str) – filename for coordinates to use, else (if None) use self.atoms generated originally from optin.pdb_in.
- combined (bool) – effects of φi, ψi-1 averaged over relevant atoms.
- angles (bool) – torsion angle changes (impact cannot also be true).
- impact (bool) – impact on residual or RMSD (angles cannot also be true).
-
histogram
(prt=False, plot=False, log=False, normalize=False)¶
-
-
class
impact.
ResidueInfo
(atoms=None)¶
-
class
impact.
ResidueInfoAdded
¶ Bases:
object
Methods with which to extend optimize.ResidueInfo.
-
map2structure
(pdbIn=None, combined=True, angles=False, impact=True)¶ Map relative impact or torsion change to occupancy field for display.
Parameters: - pdbIn (str) – coordinate file on which to map, else command-line pdb_in.
- combined (bool) – combine φi, ψi-1 for mapping (quasi pseudo-torsion angle).
- angles (bool) – map torsion angle changes
- impact (bool) – map estimated impact
Returns: coordinates copied from pdbIn, occupancies reflecing relative torsion angle change or impact.
Return type:
-
-
class
impact.
Tasks
¶ Bases:
impact.ControlAdded
,superpose.Tasks
-
impact
(sequential=False, rmsd=False, combined=False, pickle='impact.jar', **arguments)¶ Plot impact of each torsion angle change on superimposition.
Parameters: arguments (dict) – additional arguments to be passed through to residueInfo.plot().
-
-
class
impact.
TopCommands
(tasks, initial_commands=None, py_locals={}, parser=None)¶ Bases:
atoms.Commands
,optimize.Commands
,cmd2nest.TopCmd
,cmd2nest.ProgCmd
Top-level commands for Program Prog.
Parameters: - tasks (
Control
) – class instance that defines methods to be called. - initial_commands (str or list of str) – file(s) of commands to run before interactive loop at the top level, and before any command-line commands.
- py_locals (dict) – objects added to the local namespace in the python interpreter invoked by ‘py’ commands.
- parser (ArgumentParser (argparse) or OptionParser (optparse)) – to which -t / –test option will be added for cmd2 regression testing. Should only be used once / program.
- tasks (
-
impact.
arrow_range
(ax, start=4.5, end=9.5, level=-0.2, text='0', text_props={}, **args)¶ Plot 2-headed horizontal arrows.
Parameters: - ax (
mapplotlib.axis
) – axis - usually should be axes1 - start (float) – left end of arrow
- end (float) – right end of arrow
- level (float) – y-value for arrows
- text (str) – label for the arrow
- text_props (dict) – properties passed to matplotlib.text
- args (dict) – properties passed to matplotlib.arrow
- ax (
-
impact.
parseLog
(inputName=None)¶ Open and read the log file.
Prepares for plotting by returning arrays containing normalized relative impact of torsion angle changes on the residual. Residue number is represented as a float with 1/6 subtracted for φ and 1/6 added for ψ.
Error
Now reading from picked jar file instead of text log file. Left here on the off chance that might want to resuscitate, but would have to update as the format of the log file will have changed. Furthermore, would have to pack impact into residueInfo object to be able to use its plot() method.
Parameters: inputName (str) – file name to read or None to get from command-line Returns: residueNumber, startingImpact, endingImpact, cResidue, combined Return type: ndarray(dtype=float, size=#phi+psi)*5
-
impact.
plotImpactHistogram
(impact, normalize=False, log=False)¶ Histogram of Impact.
Parameters: - impact (ndarray) – Impact of a torsion angle on the RMS.
- normalize (bool) – Normalized so that integral = 100%. Note that the normed option of pylab.hist only does this with bin-width = 1/bins, so this changes the horizontal axis. If False, the number, not frequency is plotted.
-
impact.
printImpactHistogram
(impact)¶ Histogram of Impact.
Parameters: impact (ndarray) – impact of each residue (or each φ, ψ).
-
impact.
startup
()¶ Program initialization, reading options etc..
Returns: parser Return type: Arguments.ArgumentParser
-
impact.
text_at
(ax, residues=[1, 2, 3], atom_type=None, level=-0.07, text='$\\Uparrow$', key='relaxation exchange', key_at=100, **args)¶ Write text at each residue.
Parameters: - ax (:py:classL`mapplotlib.axis`) – axis - usually should be axes1
- residues (list) –
- atom_type (str) – atom to be labeled (–> small anal retentive correction).
- level – y-axis height for text
- text (str) – TeX symbols between $ if unicode r’string’.
- key (str) – explanation written at the end of the line.
- key_at (float) – x-coordinate (residues) for key text (or None).
- args (dict) – matplotlib properties passed through as arguments to text.