tools package¶
Submodules¶
tools.ambertools module¶
Routines that wrap AmberTools programs
This module defines two public functions: run_antechamber run_parmchk
Can be executed from the command line as a stand-alone program
-
tools.ambertools.
run_antechamber
(lig, charge, resnam=None)¶ Wrapper for antechamber with default parameters and AM1-BCC charges
Parameters: lig : PDBFile or string
the ligand to run Antechamber on
charge : int
the net charge of the ligand
resnam : string, optional
the residue name of the ligand
Returns: string
the filename of the created prepi file
-
tools.ambertools.
run_parmchk
(lig)¶ Wrapper for parmcheck with default parameters
Parameters: lig : PDBFile or string
the ligand to run Parmcheck on
Returns: string
the filename of the created frcmod file
tools.build_template module¶
Routines to build a ProtoMS template file
The module defines a two public function build_template make_zmat
Can be executed from the command line as a stand-alone program
-
class
tools.build_template.
PrepiAtom
¶ Class to encapsulate an atom in an Amber prepi file and its connectivity
Attributes
atype (string) the atom type bondidx (int) the index of the atom this atom is bonded to in the prepi z-matrix bonds (list) names of all atoms this atom is bonded to charge (float) the charge index (int) the serial number in the prepi file is_on_loop (dictionary) a flag for each atom in bonds indicating if the bond is part of a loop loop_closure (dictionary) a flag for each atom in bonds indicating if the bond was part of a loop statement in the prepi file name (string) the atom name traversed (dictionary) a flag for each atom in bonds indicating if the bond has been traversed zmat (list) atom names of the atoms defined to this atom in the z-matrix Methods
add_bond
(atomname[, loop_closure])Add a bond to this atom backward_bond
(exclude, defined)Find an atom, bonded to this atom that has improper_dihedral
(exclude, defined)Look for the definition of an improper dihedral: next_bond
(defined[, update])Find an atom, bonded to this atom that read
(record, atomlist)Read a line from an Amber prepi-file sort_bonds
(metric)Sort the bonds based on some metric -
add_bond
(atomname, loop_closure=False)¶ Add a bond to this atom
-
backward_bond
(exclude, defined)¶ Find an atom, bonded to this atom that has already been defined but is not in the list of excluded atoms
-
improper_dihedral
(exclude, defined)¶ Look for the definition of an improper dihedral: see if at least two bonds to this atom has been defined, excluding the bond in the exclude list
-
next_bond
(defined, update=True)¶ Find an atom, bonded to this atom that has not been defined and where the bond has not been traversed
-
read
(record, atomlist)¶ Read a line from an Amber prepi-file
-
sort_bonds
(metric)¶ Sort the bonds based on some metric
-
-
tools.build_template.
build_template
(temfile, prepifile, translate=0.25, rotate=5, zmatfile=None, frcmodfile=None, resname='UNK')¶ Build a ProtoMS template file
Parameters: temfile : string
the filename to save the template file to
prepifile : string
the filename of the Amber prepi file (prep-file with z-matrix)
translate : float, optional
the translational displacement
rotate : float, optional
the rotational displacement
zmatfile : string, optional
the filename of a zmat, if None it is created
frcmodfile : string, optional
the filename of an Amber frcmod file with additional parameters
resname : string, optional
the name of solute
Returns: TemplateFile
the created template file
-
tools.build_template.
make_zmat
(prepifile)¶ Make a ProtoMS z-matrix for a solute
Parameters: prepifile : string
the filename of the Amber prepi file (prep-file with z-matrix)
Returns: atoms : dictionary
created PrepiAtom objects
all_zmat : list
a list of atoms with their z-matrix atoms
tools.calc_bar module¶
Program to do BAR
This module defines a single public function: bar
Can be executed from the command line as a stand-alone program
-
tools.calc_bar.
bar
(path, res_tem, skip, maxread, RT, verbose, nboots=10)¶ Do Bennet Acceptance Ratio for a set of ProtoMS output files
Parameters: path : string
directory where all lambda folders are
res_tem : string
prefix of result files
skip : int
number of snapshots to skip
maxread : int
maximum number of snapshots to read
RT : float
the thermal temperature
verbose : dictionary of booleans
tune the output to standard output
nboots : int, optional
the number of bootstrap samples
Returns: numpy array
the lambda values
numpy array
the free energy for each lambda
numpy array
the standard error of the free energy for each lambda
tools.calc_clusters module¶
Routines to cluster molecules from simulations.
Can be executed from the command line as a stand-alone program
-
tools.calc_clusters.
cluster_coords
(confs, clustmethod='average', cutoff=2.0)¶ Clusters the supplied conformations in a hierarchical fasion
Parameters: conformations : Numpy array
Array of the coordinates of the different conformations
method : String
the hierarchical clustering method
cutoff : Float
the RMSD cutoff that specifies whether conformations are in the same cluster.
Returns: NumpyArray
the coordinates of the cluster representatives
NumpyArray
the coordinates of the cluster centroids
-
tools.calc_clusters.
get_coords
(pdbfiles, molname, atomname)¶ Finds the coordinates of a specified molecule name or a named atom from supplied PDB files.
Parameters: pdbfiles : PDBSet
the PDB files
residue : string
the residue to extract
atom : string
the name of the atom to extract (optional)
Returns: NumpyArray of coordinates
the x,y,z coordinates of the specified molecule or atom
Integer
the number of molecules or atoms matching the names.
tools.calc_density module¶
Routine to calculate a density from a set of PDB files
This module defines a these public functions: calc_density writeDX
Can be executed from the command line as a stand-alone program
-
tools.calc_density.
calc_density
(pdbfiles, molname, atomname, padding=2.0, extent=1.0, spacing=0.5, norm=None, smoothing='sphere')¶ Calculate the density from a set of PDB files
Parameters: pdbfiles : PDBSet
the PDB files
residue : string
the residue to extract
atom : string
the name of the atom to make a density from
padding : float, optional
extra space to add to the minimum extent
extent : float, optional
the extent of the smoothing
spacing : float, optional
the spacing of the grid
norm : int, optional
number to normalize the density by
smoothing : string, optional
kind of smoothing, can be either sphere or gauss
Returns: NumpyArray of integers
the number of atom extracted from each PDB structure
NumpyArray
the 3D density
dictionary
grid properties, keys = spacing, min, and max
-
tools.calc_density.
writeDX
(grid, origin, spacing, filename)¶ Write the grid to file in DX-format
Parameters: grid : Numpy array
the 3D grid
origin : NumpyArray
the bottom-left coordinate of the grid
spacing : float
the grid spacing
filename : string
the name of the DX file
tools.calc_dg module¶
Program to calculate free energies using TI, BAR and MBAR
tools.calc_gcsingle module¶
Program to analyze GCMC simulations
tools.calc_replicapath module¶
Program to analyze and plot replica paths
This module defines the following public functions: replica_path
Can be executed from the command line as a stand-alone program
-
tools.calc_replicapath.
replica_path
(filenames, replicakind='lambda')¶ Extract replica path from a set of results files
Parameters: filenames : list of strings
the files to read
replicakind : string
the type of replica, at the moment only lambda is allowed
Returns: numpy array
the labeled replica path
list
list of the labels for all input files
tools.calc_rmsd module¶
Routine to calculate the RMSD of the center of a ligand
This module defines a these public functions: calc_rmsd
Can be executed from the command line as a stand-alone program
-
tools.calc_rmsd.
calc_rmsd
(ref, structures, resname, atomname=None)¶ Calculate RMSD of ligand centre or a specific atom
Parameters: ref : PDBFile object
the reference structure
structures : PDBSet object
the trajectory to analyze
resname : string
the residue name of the ligand to analyze
atomname : string, optional
the atom name to analyze, if not set will analyze geometric centre
Returns: float :
the RMSD in Angstroms
tools.calc_series module¶
Program to analyze and plot data series
This module defines the following public functions: find_equilibration stats_inefficiency maximize_samples running moving parse_series parse_files plot_series write_series
Can be executed from the command line as a stand-alone program
-
tools.calc_series.
find_equilibration
(x, y, atleast=10, threshold=0.05, nperm=0)¶ Find the equilibration time of a data series
Parameters: x : Numpy array
the x data
y : Numpy array
the y data
atleast : int, optional
this is the smallest number of snapshots considered to be production
threshold : float, optional
the confidence level
nperm : int, optional
if greater than zero, a permutation test is peformed with nperm synthetic permuations
Returns: int
the length of the equilibration period
-
tools.calc_series.
maximize_samples
(y, atleast=10)¶ Find the minimum of the statistical inefficiency by varying the equlibration period, i.e. maximizing the number of uncorrelated samples
Parameters: y : Numpy array
the data
atleast : int, optional
this is the smallest number of snapshots considered to be production
Returns: int
the snapshot at which g is maximum
float
maximum of g
int
the number of uncorrelated samples
-
tools.calc_series.
moving
(data, window)¶ Returns a moving/rolling average of the data
Parameters: data : NumpyArray
the input data, should be 1D
window : int
the window size
Returns: NumpyArray
the averaged data
-
tools.calc_series.
parse_files
(filenames, series, all_results, ys, labels, **kwargs)¶ Parse multiple results file
If a data serie in series can be calculated over multiple input files, the data serie is replaced by some calculation over all input files
Parameters: filenames : list of strings
the files to parse
series : list of strings
the series selected
all_results : list of SnapshotResults
all the results loaded from all input files, needs to be initialized before calling this routine
ys : list of NumpyArrays
all the series
labels : list of strings
labels for all the data series
**kwargs : dictionary
additional parameters, passed directly to the different parsers
Returns: bool
whether the series has been modified, i.e. if any parser was found
-
tools.calc_series.
parse_series
(series, results)¶ Extract data series and label from a results file based on a label
Parameters: series : list of string
the series to extract
results : SnapshotResults object
all the results
Returns: list of NumpyArrays
the data series
list of string
the labels for the series
-
tools.calc_series.
plot_series
(ys, yprop, labels, offset, plotkind, outprefix)¶ Plot a series
Parameters: ys : list of Numpy arrays
the data series
yprop : list of dictionary
statistical properties of the data
labels : list of strings
the labels for the data series
offset : int
the offset of x from 1
plotkind : string
the type of plot to create, can be either sep, sub, single, single_first0 or single_last0
outprefix : string
the prefix of the created png-files
-
tools.calc_series.
running
(data)¶ Returns a running average of the data
Value at position i of the returned data is the average of the input data from point zero to point i
Parameters: data : NumpyArray
the input data, should be 1D
Returns: NumpyArray
the averaged data
-
tools.calc_series.
stat_inefficiency
(y)¶ Calculates the statistical inefficiency, g.
g = 1 + 2*tau, where tau is the autocorrelation time
Parameters: y : Numpy array
the data
Returns: float
g, the inefficiency or None if variance is too small
float
neff, the number of samples or None if variance is too small
-
tools.calc_series.
write_series
(ys, yprop, labels, offset, filekind, outprefix)¶ Write a series to disc
Parameters: ys : list of Numpy arrays
the data series
yprop : list of dictionary
statistical properties of the data
labels : list of strings
the labels for the data series
offset : int
the offset of x from 1
filekind : string
the type of file to write, can be either sep or single
outprefix : string
the prefix of the created files
tools.calc_ti module¶
Program to do thermodynamic integration
This module defines a single public function: ti
Can be executed from the command line as a stand-alone program
-
tools.calc_ti.
fit_pmf
(lambdas, pmf, orderfit=4, upperfit=5, plotfile='fit.png')¶ Fit the PMF to a polynomial function Parameters ———- lambdas : list
list of lambda values- pmf : list
- list of pmf values for each lambda
- orderfit : int, optional
- the order of the polynomial to fit your pmf to
- upperfit : int, optional
- the maximum order of the polynomial to fit to
- plotfile : string, optional
- the name of the file where to plot of the fit
Returns: numpy array
the coefictients of the fit
-
tools.calc_ti.
ti
(path, res_tem, skip, maxread, verbose, numkind, useanalytical)¶ Do thermodynamic integration
Parameters: path : string
directory where all lambda folders are
res_tem : string
result files
skip : int
number of snapshots to skip
maxread : int
maximum number of snapshots to read
verbose : dictionary of booleans
tune the printing to standard output
numkind : string
the kind of numerical gradient, should be either both, forw, or back
useanalytical : boolean
if to use analytical gradients
Returns: numpy array
all lambda values
numpy array
gradient for each lambda value
numpy array
standard deviation of the gradient for each lambda value
numpy array
pmf at each lambda value
numpy array
standard deviation of the pmf at each lambda value
tools.clear_gcmcbox module¶
Routine to remove solvent molecules from a GCMC/JAWS-1 simulation box
This module defines a single public function: clear_gcmcbox
Can be executed from the command line as a stand-alone program
-
tools.clear_gcmcbox.
clear_gcmcbox
(gcmcbox, waters)¶ Removes solvent molecules from the GCMC/JAWS-1 box as they will not be able to move during the simulation
Parameters: gcmcbox : string or PDBFile object
the gcmcbox
waters : string or PDBFile object
the water molecule to check
Returns: int
the number of removed water molecules
PDBFile
the cleared solvation box
tools.convertatomnames module¶
Routines to convert atom names in a PDB-file
This module defines two public functions: read_convfile pdb2pms
Can be executed from the command line as a stand-alone program
-
tools.convertatomnames.
pdb2pms
(pdb_in, forcefield, conversion_file)¶ Convert atom names to ProtoMS standard
The protein object is not modified by this routine, but the Residue and Atom objects are.
Parameters: pdb_in : PDBFile
the pdb file to modify inline
forcefield : string
the style of the input PDB-file
conversion_file :
a file with conversion rules
Returns: a PDBFile instance with ProtoMS names
-
tools.convertatomnames.
read_convfile
(file=None, inmode=None, outmode=None)¶ Reads a conversion file into a dictionary
Parameters: file : string
the filename of the conversion file
inmode : string
the style of the input PDB-file
outmode : string
the style of the output PDB-file
Returns: a dictionary of the conversion
Raises: ValueError
if any of the parameters are none
tools.convertwater module¶
Routines to convert water molecules to water models from a PDB file.
This module defines a single public function convertwater
Can be executed from the command line as a stand-alone program
-
tools.convertwater.
alignhydrogens
(watcoords, template, tol=0.05)¶ Rotates a template water molecule such that it has the same orientation as a reference water molecule. Useful for converting between different water models in cases when one wishes to retain the same orientations of hydrogens. It assumes that both the template and the reference water have maching oxygen locations.
Parameters: watcoords : numpy array
the coordinates of the water molecule that will be aligned to. The first row must be the x,y,z coordinates of the oxygen atom. Hydrogens must be present in the proceeding two rows
template : numpy array
the template water molecule whose hydrogens will be aligned to match that of watcoords. Does not have to be same water model (e.g. tip4p versus spc) as watcoords.
tol : float
the tolerance level for the BFGS solver. At a tolerance level of 0.1, orientating 1000 water molecules takes about 10s. With a lower tolerance, alignment is more accurate, but can take up to 17s per 1000 waters.
Returns: numpy array
the rotated set of water coordinates.
-
tools.convertwater.
convertwater
(pdb_in, watermodel, ignorH=False, watresname=None)¶ Converts water in a pdb object to ideal water geometries of an input model
The protein object is not modified by this routine, but the Residue and Atom objects are.
Parameters: pdb_in : PDBFile
the PDB object containing the water molecules that will be converted
watermodel : string
the name of the water model that will be used in the transformtation, e.g. tip4p, t3p.
ignorH : bool
whether to ignore hydrogens in the input water.
Returns: PDBFile
a pdb file whose solvent elements have the geometry of the desired solvent model
-
tools.convertwater.
rotatesolute
(solutecoords, alpha, beta, gamma)¶ Rotates a molecule about the centre of geometry (the mean of x,y,z of each atom in the molecule).
Parameters: solutecoords : numpy array
the coordinates of the molecule.
alpha : float or integer
the angle (in radians) by which rotation is performed about the x-axis.
beta : float or integer
the angle (in radians) by which rotation is performed about the y-axis.
gamma : float or integer
the angle (in radians) by which rotation is performed about the z-axis.
Returns: numpy array
the rotated set of molecule coordinates.
-
tools.convertwater.
rotatewat
(watcoords, alpha, beta, gamma)¶ Rotates a water molecule about the oxygen atom, which is assumed to be the first element in the coordinate array.
Parameters: watcoords : numpy array
the coordinates of the water molecule. The first row must be the x,y,z coordinates of the oxygen atom. Hydrogens must be present in the proceeding two rows
alpha : float or integer
the angle (in radians) by which rotation is performed about the x-axis.
beta : float or integer
the angle (in radians) by which rotation is performed about the y-axis.
gamma : float or integer
the angle (in radians) by which rotation is performed about the z-axis.
Returns: numpy array
the rotated set of water coordinates.
-
tools.convertwater.
rotmat_x
(alpha)¶ 3D rotation matrix for rotations about x-axis.
Parameters: alpha : float or integer
the angle (in radians) by which rotation is performed about the x-axis.
Returns: numpy array
the rotation matrix for the desired angle.
-
tools.convertwater.
rotmat_y
(beta)¶ 3D rotation matrix for rotations about x-axis.
Parameters: beta : float or integer
the angle (in radians) by which rotation is performed about the y-axis.
Returns: numpy array
the rotation matrix for the desired angle.
-
tools.convertwater.
rotmat_z
(gamma)¶ 3D rotation matrix for rotations about x-axis.
Parameters: gamma : float or integer
the angle (in radians) by which rotation is performed about the z-axis.
Returns: numpy array
the rotation matrix for the desired angle.
tools.distribute_waters module¶
Program to generate a set of n molecules contained within given box dimenstions or to redistribute molecules given in a pdb object or file within the given box dimensions
This program takes the box dimensions as a list of strings convertible to floats, in the following order :
origin in x | origin in y | origin in z | length in x | length in y | length in z
And either the number of molecules as a string convertible to integer, or the pdb, which can be provided as a string with the name of the file, or an object.
It produces a pdb file with the randomly distributed molecules with their oxigen atoms within the box limits.
Initially thought to generate JAWS or GCMC molecules
Can be executed from the command line as a stand-alone program
-
tools.distribute_waters.
create_res
(atnames=['O00'], resname='sol', positions=[array([ 0., 0., 0.])], resind=1)¶ Create a residue object
Parameters: atnames : list of strings
a list containing the names of all the atoms in the residue
resname : string
the name of the residue
positions : list of numpy arrays
a list with the positions of all the atoms in the residue
Returns: Residue object
the residue built with the given atoms
-
tools.distribute_waters.
distribute_particles
(box, particles, watermodel='t4p', resname='WAT', partnumb=None)¶ Randomly distribute molecules in a box
Parameters: box : a list or dictionary
the origin and lenght of the box where the molecules will be placed
particles : string or PDB object
the number of waters to include in the box or the pdb object or filename with the molecules to include in the box
watermodel : string, optional
(only used when particles is a number) either “t4p” or “t3p” the water model for the generated waters
partnumb : string,optional
(only used when particles is a file) the number of particles. If not specified it is set to be as many as there are in the file
Returns: pdb object
the pdb object with the molecules distributed randomly in the box
tools.divide_pdb module¶
Program to split a multi pdb file into individual files
This program divides a multi pdb file in individual files. The individual pdbs must be separated by a line starting with END.
Initially thought to divide the multi-snapshot pdb file produced as ProtoMS output into individual snapshot pdb files. Required for an easy visualization of GCMC and JAWS stage 1 results.
Can be executed from the command line as a stand-alone program
-
tools.divide_pdb.
divide_print
(common, prefix)¶ Divide a pdb file in individual pdbfiles. Division is controled by lines starting with END
Parameters: common : string
the name of the initial pdb file
prefix : string
the prefix for output pdb files
tools.generate_input module¶
Classes and routines to make ProtoMS command files
This module defines a single public function generate_input
and the following public classes: ProtoMSSimulation ProteinLigandSimulation Equilibration Sampling DualTopology
Can be executed from the command line as a stand-alone program
-
class
tools.generate_input.
DualTopology
(protein='protein.pdb', solutes=['solute1.pdb', 'solute2.pdb'], solvent='water.pdb', templates=['solute1.tem', 'solute2.tem'], nequil=5000000.0, nprod=40000000.0, dumpfreq=100000.0, lambdaval=None, outfolder='out', restrained=[])¶ Bases:
tools.generate_input.ProteinLigandSimulation
This a command file for a dual-topology protein-ligand simulation Generates input for proteins, solutes and solvent write dual-toplogy parameters, lambda-replica exchange, dump results, pdb and restart files equilibrate and production run
Methods
clear
()Clear the simulation description readCommandFile
(filename)Read in a simulation from a command file run
(exe[, cmdfile])Run this simulation setChunk
(chunk)This adds the simulation chunk to ‘chunk’. setDump
(dump, freq)This adds the simulation dump to ‘dump’ with frequnecy freq setForceField
(filename)Set the filename for parfile setParameter
(parameter, value)Set the parameter to value setProtein
(n, filename)Set the filename for proteinN. setSolute
(n, filename)Set the filename for soluteN. setSolvent
(n, filename)Set the filename for solventN. setStream
(stream, filename)Set the direction of the output stream to a filename writeCommandFile
(filename)Write the contents of this simulation object to disc
-
class
tools.generate_input.
Equilibration
(protein='protein.pdb', solutes=['solute.pdb'], solvent='water.pdb', templates=['solute.tem'], outfolder='', nsteps=100000.0, pdbfile='equilibrated.pdb')¶ Bases:
tools.generate_input.ProteinLigandSimulation
This a command file for equilibration of a protein-ligand system Generates input for proteins, solutes and solvent and write an equilibration and a pdb chunk
Methods
clear
()Clear the simulation description readCommandFile
(filename)Read in a simulation from a command file run
(exe[, cmdfile])Run this simulation setChunk
(chunk)This adds the simulation chunk to ‘chunk’. setDump
(dump, freq)This adds the simulation dump to ‘dump’ with frequnecy freq setForceField
(filename)Set the filename for parfile setParameter
(parameter, value)Set the parameter to value setProtein
(n, filename)Set the filename for proteinN. setSolute
(n, filename)Set the filename for soluteN. setSolvent
(n, filename)Set the filename for solventN. setStream
(stream, filename)Set the direction of the output stream to a filename writeCommandFile
(filename)Write the contents of this simulation object to disc
-
class
tools.generate_input.
GCMC
(protein='protein.pdb', solutes=[], solvent='water.pdb', templates=[], gcmcwater='gcmc_water.pdb', gcmcbox=None, nequil=5000000.0, nprod=40000000.0, dumpfreq=100000.0, adamval=None, outfolder='out_gcmc')¶ Bases:
tools.generate_input.ProteinLigandSimulation
This a command file for a GCMC simulation Generates input for proteins, solutes and solvent write GCMC parameters dump results, pdb and restart files equilibrate and production run
Methods
clear
()Clear the simulation description readCommandFile
(filename)Read in a simulation from a command file run
(exe[, cmdfile])Run this simulation setChunk
(chunk)This adds the simulation chunk to ‘chunk’. setDump
(dump, freq)This adds the simulation dump to ‘dump’ with frequnecy freq setForceField
(filename)Set the filename for parfile setParameter
(parameter, value)Set the parameter to value setProtein
(n, filename)Set the filename for proteinN. setSolute
(n, filename)Set the filename for soluteN. setSolvent
(n, filename)Set the filename for solventN. setStream
(stream, filename)Set the direction of the output stream to a filename writeCommandFile
(filename)Write the contents of this simulation object to disc
-
class
tools.generate_input.
Jaws1
(protein='protein.pdb', solutes=[], solvent='water.pdb', templates=[], outfolder='', jawswater='jaws_water.pdb', jawsbox=None, nequil=5000000.0, nprod=40000000.0, dumpfreq=100000.0)¶ Bases:
tools.generate_input.ProteinLigandSimulation
This a command file for a JAWS-1 simulation Generates input for proteins, solutes and solvent write JAWS-1 parameters dump results, pdb and restart files equilibrate and production run
Methods
clear
()Clear the simulation description readCommandFile
(filename)Read in a simulation from a command file run
(exe[, cmdfile])Run this simulation setChunk
(chunk)This adds the simulation chunk to ‘chunk’. setDump
(dump, freq)This adds the simulation dump to ‘dump’ with frequnecy freq setForceField
(filename)Set the filename for parfile setParameter
(parameter, value)Set the parameter to value setProtein
(n, filename)Set the filename for proteinN. setSolute
(n, filename)Set the filename for soluteN. setSolvent
(n, filename)Set the filename for solventN. setStream
(stream, filename)Set the direction of the output stream to a filename writeCommandFile
(filename)Write the contents of this simulation object to disc
-
class
tools.generate_input.
Jaws2
(protein='protein.pdb', solutes=[], solvent='water.pdb', templates=[], outfolder='', jawswater='jaws_water.pdb', jbias=6.5, nequil=5000000.0, nprod=40000000.0, dumpfreq=100000.0)¶ Bases:
tools.generate_input.ProteinLigandSimulation
This a command file for a JAWS-2 simulation Generates input for proteins, solutes and solvent write JAWS-2 parameters dump results, pdb and restart files equilibrate and production run
Methods
clear
()Clear the simulation description readCommandFile
(filename)Read in a simulation from a command file run
(exe[, cmdfile])Run this simulation setChunk
(chunk)This adds the simulation chunk to ‘chunk’. setDump
(dump, freq)This adds the simulation dump to ‘dump’ with frequnecy freq setForceField
(filename)Set the filename for parfile setParameter
(parameter, value)Set the parameter to value setProtein
(n, filename)Set the filename for proteinN. setSolute
(n, filename)Set the filename for soluteN. setSolvent
(n, filename)Set the filename for solventN. setStream
(stream, filename)Set the direction of the output stream to a filename writeCommandFile
(filename)Write the contents of this simulation object to disc
-
class
tools.generate_input.
ProteinLigandSimulation
(protein='protein.pdb', solutes=['solute.pdb'], solvent='water.pdb', templates=['solute.tem'], outfolder=None)¶ Bases:
tools.generate_input.ProtoMSSimulation
This a generic command file for a protein-ligand simulation Generates input for proteins, solutes and solvent but does not write any chunks
Methods
clear
()Clear the simulation description readCommandFile
(filename)Read in a simulation from a command file run
(exe[, cmdfile])Run this simulation setChunk
(chunk)This adds the simulation chunk to ‘chunk’. setDump
(dump, freq)This adds the simulation dump to ‘dump’ with frequnecy freq setForceField
(filename)Set the filename for parfile setParameter
(parameter, value)Set the parameter to value setProtein
(n, filename)Set the filename for proteinN. setSolute
(n, filename)Set the filename for soluteN. setSolvent
(n, filename)Set the filename for solventN. setStream
(stream, filename)Set the direction of the output stream to a filename writeCommandFile
(filename)Write the contents of this simulation object to disc
-
class
tools.generate_input.
ProtoMSSimulation
(filename=None)¶ This is a ProtoMS command file object.This object holds all of the information about the simulation and can either run the simulation with this information, or can write this information to a command file.
Attributes
lines : list of strings all the lines of the ProtoMS command file Methods
clear
()Clear the simulation description readCommandFile
(filename)Read in a simulation from a command file run
(exe[, cmdfile])Run this simulation setChunk
(chunk)This adds the simulation chunk to ‘chunk’. setDump
(dump, freq)This adds the simulation dump to ‘dump’ with frequnecy freq setForceField
(filename)Set the filename for parfile setParameter
(parameter, value)Set the parameter to value setProtein
(n, filename)Set the filename for proteinN. setSolute
(n, filename)Set the filename for soluteN. setSolvent
(n, filename)Set the filename for solventN. setStream
(stream, filename)Set the direction of the output stream to a filename writeCommandFile
(filename)Write the contents of this simulation object to disc -
clear
()¶ Clear the simulation description
-
readCommandFile
(filename)¶ Read in a simulation from a command file
Parameters: filename : string
the filename of the command file to read from disc
-
run
(exe, cmdfile=None)¶ Run this simulation
Parameters: exe : string
the filename of the executable
cmdfile : string, optional
the filename of the command file
-
setChunk
(chunk)¶ This adds the simulation chunk to ‘chunk’.
Parameters: chunk : string
the chunk to be executed, including parameters
-
setDump
(dump, freq)¶ This adds the simulation dump to ‘dump’ with frequnecy freq
Parameters: dump : string
the dump to be executed, including parameters
freq : int
the dump frequency
-
setForceField
(filename)¶ Set the filename for parfile
Parameters: filename : string
the filename of the force field file
-
setParameter
(parameter, value)¶ Set the parameter to value
Parameters: parameter : string
the name of the parameter
value : string
the value of the parameter
-
setProtein
(n, filename)¶ Set the filename for proteinN. It then returns n+1
Parameters: n : int
the protein serial number
filename : string
the filename of the protein pdb file
Returns: int
n + 1
-
setSolute
(n, filename)¶ Set the filename for soluteN. It then returns n+1
Parameters: n : int
the solute serial number
filename : string
the filename of the solute pdb file
Returns: int
n + 1
-
setSolvent
(n, filename)¶ Set the filename for solventN. It then returns n+1
Parameters: n : int
the solvent serial number
filename : string
the filename of the solvent pdb file
Returns: int
n + 1
-
setStream
(stream, filename)¶ Set the direction of the output stream to a filename
Parameters: stream : string
the name of the stream
filename : string
the filename to direct the stream to
-
writeCommandFile
(filename)¶ Write the contents of this simulation object to disc
Parameters: filename : string
the filename to write the commands to
-
-
class
tools.generate_input.
Sampling
(protein='protein.pdb', solutes=['solute.pdb'], solvent='water.pdb', templates=['solute.tem'], outfolder='', nequil=5000000.0, nprod=40000000.0, dumpfreq=100000.0, outprefix='')¶ Bases:
tools.generate_input.ProteinLigandSimulation
This a command file for MC sampling of a protein-ligand system Generates input for proteins, solutes and solvent and write chunks for equilibration and simulation, as well as dumps
Methods
clear
()Clear the simulation description readCommandFile
(filename)Read in a simulation from a command file run
(exe[, cmdfile])Run this simulation setChunk
(chunk)This adds the simulation chunk to ‘chunk’. setDump
(dump, freq)This adds the simulation dump to ‘dump’ with frequnecy freq setForceField
(filename)Set the filename for parfile setParameter
(parameter, value)Set the parameter to value setProtein
(n, filename)Set the filename for proteinN. setSolute
(n, filename)Set the filename for soluteN. setSolvent
(n, filename)Set the filename for solventN. setStream
(stream, filename)Set the direction of the output stream to a filename writeCommandFile
(filename)Write the contents of this simulation object to disc
-
class
tools.generate_input.
SingleTopology
(protein='protein.pdb', solutes=['solute1.pdb'], solvent='water.pdb', templates=['solute.tem'], nequil=5000000.0, nprod=40000000.0, dumpfreq=100000.0, lambdaval=None, outfolder='out', restrained=[])¶ Bases:
tools.generate_input.ProteinLigandSimulation
This a command file for a single-topology protein-ligand simulation Generates input for proteins, solutes and solvent write lambda-replica exchange, dump results, pdb and restart files equilibrate and production run
Methods
clear
()Clear the simulation description readCommandFile
(filename)Read in a simulation from a command file run
(exe[, cmdfile])Run this simulation setChunk
(chunk)This adds the simulation chunk to ‘chunk’. setDump
(dump, freq)This adds the simulation dump to ‘dump’ with frequnecy freq setForceField
(filename)Set the filename for parfile setParameter
(parameter, value)Set the parameter to value setProtein
(n, filename)Set the filename for proteinN. setSolute
(n, filename)Set the filename for soluteN. setSolvent
(n, filename)Set the filename for solventN. setStream
(stream, filename)Set the direction of the output stream to a filename writeCommandFile
(filename)Write the contents of this simulation object to disc
-
tools.generate_input.
generate_input
(protein, ligands, templates, protein_water, ligand_water, settings)¶ Generates ProtoMS command files
If protein is a valid filename a protein(-ligand) simulation is setup, and if ligands contains at least one valid filename a ligand simulation is setup.
Parameters: protein : string
the filename of a protein pdb file
ligands : list of strings
filenames of solute pdb files
templates : list of strings
filenames of template files to be included
protein_water : string
the filename of a solvent pdb file for the protein
ligand_water : string
the filename of a solvent pdb file for the ligands
settings : Namespace object (from argparse)
additional settings
Returns: free_cmd : ProtoMSSimulation
the command file for the ligand simulation
bnd_cmd : ProtoMSSimulation
the command file for the protein simulation
gas_cmd : ProtoMSSimulation
the command file for the gas simulation
tools.make_dummy module¶
Routine to make a dummy PDB structure for a solute
This module defines a single public function: make_dummy
Can be executed from the command line as a stand-alone program
-
tools.make_dummy.
make_dummy
(pdbfile)¶ Make a dummy PDB structure to match a molecule
It will place the dummy at the centre of the molecule
Parameters: pdbfile : string or PDBFile
the pdb structure of the molecule
Returns: PDBFile instance
the dummy structure
tools.make_gcmcbox module¶
Routine to make a GCMC/JAWS-1 simulation box from a ligand
This module defines a single public function: make_gcmcbox
Can be executed from the command line as a stand-alone program
-
tools.make_gcmcbox.
make_gcmcbox
(pdb, filename, padding=2.0)¶ Make a GCMC/JAWS-1 simulation box around a PDB-structure
Parameters: pdb : PDBFile object
the PDB structure
filename : string
the name of the output file
padding : float, optional
the amount of extra space around the ligand to add
tools.make_single module¶
Routines to make ProtoMS single topology template
This module defines these public function make_single write_map summarize
Can be executed from the command line as a stand-alone program
-
tools.make_single.
make_single
(tem1, tem2, pdb1, pdb2, mapfile=None)¶ Make single topology templates
Parameters: tem1 : TemplateFile or string
first template file or its filename
tem2 : TemplateFile or string
second template file or its filename
pdb1 : PDBFile or string
structure template for tem1 or its filename
pdb2 : PDBFile or string
structure template for tem2 or its filename
mapfile : string, optional
filename of map of correspondance
Returns: TemplateFile
a template file for the electrostatic leg
TemplateFile
a template file for the van der Waals leg
TemplateFile
a template file for a combined transformation
dictionary of strings
the full map of correspondance
Raises: SetupError
tem2 is larger than tem1
-
tools.make_single.
summarize
(eletem, vdwtem, loggfunc)¶ Print single topology parameter summary
Parameters: eletem : TemplateFile
template for electrostatic perturbation
vdwtem : TemplateFile
template for van der Waals perturbation
loggfunc : logger function
the logger function to use to print the summary
-
tools.make_single.
write_map
(cmap, filename)¶ Write a correspondance map to disc
Parameters: cmap : a dictionary of strings
the map of correspondance
filename : string
the name of the file
tools.merge_templates module¶
Routine to merge a series of ProtoMS template files
This module defines a single public function: merge_templates
Can be executed from the command line as a stand-alone program
-
tools.merge_templates.
merge_templates
(templates)¶ Merge a series of ProtoMS template files
Parameters: templates : list of string
the names of the template file
Returns: TemplateFile
the merged template file
tools.pms2pymbar module¶
Program to prepare ProtoMS output for pymbar
This module defines two public functions: extract_energies mbar
Can be executed from the command line as a stand-alone program
-
tools.pms2pymbar.
bar
(energies, RT)¶ Calculates the BAR free energy using the PyMBAR package
Parameters: lambdas : numpy array
the lambda values
energies : list of numpy array
the energy values at each lambda and each snapshot
RT : float
the gas constant multiplied by the absolute temperature
Returns: float
the free energy
float
the uncertainty in the free energy
-
tools.pms2pymbar.
extract_energies
(path, res_tem, skip, maxread)¶ Extract total energies from a number of folders
Parameters: path : string
the directory to find lambda folders
res_tem : string
the prefix of the results files
skip : int
number of snapshots to ignore
maxread : int
maximum number of snapshots to read
Returns: list of float
the lambda values
list of numpy array
all total energies
list of strings
the path of the lambda folders
-
tools.pms2pymbar.
mbar
(lambdas, energies, RT)¶ Calculates the MBAR free energy using the PyMBAR package
Parameters: lambdas : numpy array
the lambda values
energies : list of numpy array
the energy values at each lambda and each snapshot
RT : float
the gas constant multiplied by the absolute temperature
Returns: numpy array
the free energy matrix
numpy array
the uncertainty in the free energy matrix
tools.scoop module¶
Routines to build a protein scoop
This module defines a single public function scoop
Can be executed from the command line as a stand-alone program
-
tools.scoop.
scoop
(protein, ligand, innercut=16, outercut=20, flexin='full', flexout='sidechain', terminal='neutralize', excluded=[], added=[])¶ Generates a scoop from protein structure
The protein object is not modified by this routine.
Parameters: protein : PDBFile
pdb instance for the protein to be scooped
ligand : PDBFile or string
Either pdb instance for ligand to be scooped around, or string giving the name of a file containing 3 floats to act as coords for scoop centre, or a string with three floating point numbers
innercut : float, optional
Maximum distance from ligand defining inner region of the scoop
outercut : float, optional
Maximum distance from ligand defining outer region of the scoop
flexin : string, optional
Gives the degree of flexibility for residues of the inner region Can be ‘rigid’, ‘sidechain’ or ‘flexible’
flexout : string, optional
As flexin but for residues of the outer scoop
terminal : string, optional
Determines what to do with terminal residues Can be ‘keep’, ‘doublekeep’,’neutralize’
excluded : list of int
List of indices for residues to be excluded from scoop
added : list of int
List of indices for residues to be included in outer scoop
Returns: PDBFile
an object representing the scooped protein
tools.simulationobjects module¶
Useful classes for setup and analysis of ProtoMS simulations. Contain classes to
- Read, modify and write structures in PDB format
- Store parameter collections
- Read and store ProtoMS results files
- Read, modify and write ProtoMS template files
-
class
tools.simulationobjects.
Atom
(index=0, name='?', resname='???', resindex=0, coords=[])¶ Bases:
object
Class for holding a PDB atom record
Attributes
index (integer) the number of the atom in the pdb file resindex (integer) the number of the residue in the pdb file name (string) the name of the atom resname (string) the name of the residue coords (NumpyArray) Cartesian coordinates type (string) either atom or hetatm element (string) the element of the atom Methods
getElement
()Set the element of this atom -
getElement
()¶ Set the element of this atom
-
-
class
tools.simulationobjects.
AtomSet
(record=None)¶ Class to hold a set of atoms and their associated parameter
Attributes
atoms (list of strings) the atoms in this set param (int or ForceFieldParameter) the parameter associated with the atoms Methods
parse
(record)Parse a line from a ProtoMS file -
parse
(record)¶ Parse a line from a ProtoMS file
Parameters: record : string
the line to parse from
-
-
class
tools.simulationobjects.
EnergyResults
(line=None)¶ Class to hold energy results
Attributes
curr (float) the energy at the current lambda back (float) the energy at the previous lambda forward (float) the energy at the next lambda type (string) a label Methods
parse_line
(line)Parse energies from the result file -
parse_line
(line)¶ Parse energies from the result file
Parameters: line : string
the line to parse
-
-
class
tools.simulationobjects.
ForceFieldParameter
(record=None)¶ Class to hold a general parameter set
Attributes
key (string) a label index (integer) a serial number params (list) either a list of strings or a list of ForceFieldParameter, containing the actual parameters Methods
parse
(record)Parse a line from a ProtoMS file -
parse
(record)¶ Parse a line from a ProtoMS file
Parameters: record : string
the line to parse from
-
-
class
tools.simulationobjects.
MolTemplate
¶ Class to hold a ProtoMS template
Attributes
name (string) the name of the template type (string) the kind of template, e.g. solute translate (float) the translation displacement rot (float) the rotational displacement atoms (list of TemplateAtom objects) the atoms in this template connectivity (list of TemplateConnectivity objects) the connectivity in this template variables (list of string) the variable geometries atomclass (TemplateAtom class) the class to create objects of atoms Methods
parse_from
(fileobj)Parse a full template from a file write_to
(fileobj)Write the template to disc write_zmat
(filename)Write the z-matrix of this template to disc -
parse_from
(fileobj)¶ Parse a full template from a file
Terminates when found another mode or end of file
Parameters: fileobj : file object
the file to parse from
-
write_to
(fileobj)¶ Write the template to disc
Parameters: fileobj : file object
the file to write to
-
write_zmat
(filename)¶ Write the z-matrix of this template to disc
Parameters: filename : string
the name of the file to write to
-
-
class
tools.simulationobjects.
MyArgumentParser
(prog=None, usage=None, description=None, epilog=None, version=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, add_fullhelp=True)¶ Bases:
argparse.ArgumentParser
Extention to ArgumentParser to allow separation of of help in to help for most common options and full help that list all arguments
Methods
format_help
([fullhelp])print_fullhelp
([file])print_help
([file])-
format_help
(fullhelp=False)¶
-
print_fullhelp
(file=None)¶
-
print_help
(file=None)¶
-
-
class
tools.simulationobjects.
PDBFile
(filename=None)¶ Class for holding the atoms and residues of a PDB file
Attributes
center (NumPy array) the center of coordinates of all atoms header (string) additional lines to print before ATOM records name (string) the name of the file residues (dictionary of Residue objects) all non-solvent residues solvents (dictionary of Residue objects) all solvent residues Methods
copy
()Make a copy of the residues and solvents dictionaries, getBox
([atomlist, reslist])Calculate the smallest box to encompass the atoms getCenter
()Calculate the center of geometry read
(filename)Read a pdb-file from disc read_from
(f[, resname])Read a pdb structure from a fileobject write
(filename[, renumber, header, solvents])Write the PDB file to disc -
copy
()¶ Make a copy of the residues and solvents dictionaries, not the Residue and Atom objects themselves
Returns: PDBFile
the newly created instance
-
getBox
(atomlist='all', reslist='all')¶ Calculate the smallest box to encompass the atoms
Parameters: atomlist = list, optional
the atoms to be taken into acount to get the box
reslist = list, optional
the residues to be taken into acount to get the box
Returns: dictionary of Numpy arrays
the center, length and origin of the box
-
getCenter
()¶ Calculate the center of geometry
Returns: NumPy array
the center
-
read
(filename)¶ Read a pdb-file from disc
It will overwrite existing residues and renumber all residues from 1
Parameters: filename : string
the name of the pdb file
-
read_from
(f, resname=None)¶ Read a pdb structure from a fileobject
Terminates reading when found a record starting with END
Parameters: f : file object
the object to read from
resname : string, optional
the name of the residue to read, only read this
-
write
(filename, renumber=False, header=None, solvents=True)¶ Write the PDB file to disc
Parameters: filename : string
the name of the file
renumber : boolean, optional
indicate if residues should be renumbered
header : string, optional
additional lines to print before the atom records
solvents : boolean, optional
if to write the solvents
-
-
class
tools.simulationobjects.
PDBSet
¶ Hold a collection of PDBFile objects
Attributes
pdbs (list of PDBFile objects) the pdb files Methods
from_residues
(pdbfile)Split a PDB file into a set by residue read
(filename[, resname, skip, readmax])Read a set of pdb structures from a file write
(filenames[, solvents])Write the set to disc -
from_residues
(pdbfile)¶ Split a PDB file into a set by residue
Parameters: pdbfile : PDBFile object
the pdb-file to split
-
read
(filename, resname=None, skip=0, readmax=None)¶ Read a set of pdb structures from a file
Parameters: filename : string
the name of the file to read
resname : string, optional
the name of the residue to read, only read this
skip : int, optional
number of snapshot at the beginning to skip
readmax : int, optional
maximum number of snapshots to read
-
write
(filenames, solvents=True)¶ Write the set to disc
If one filename is given all PDB-files are written to one file
Parameters: filenames : list of strings
the name of the file(s) to write to
solvents : boolean
if to write the solvents
-
-
class
tools.simulationobjects.
Parameter
(index, ats, k, b0)¶ Class to hold a parameter from a ProtoMS template file
Not valid for dihedral parameters but contains sufficient information to check that a parameter exists
Attributes
index (integer) the serial number of the parameter ats (list of string) the name of the atoms associated with the parameter k (float) the force constant b0 (float) the equilibrium value
-
class
tools.simulationobjects.
ParameterSet
(param_file, ptype)¶ Class to hold a collection of parameters
Attributes
file_name (string) the name of the file where the parameters originated params (list of Parameter objects) the parameters in this collection Methods
get_params
(ats)Find parameters for specific atoms -
get_params
(ats)¶ Find parameters for specific atoms
Parameters: ats : list of string
the query atoms
Returns: Parameter object
the found parameter
-
-
class
tools.simulationobjects.
Residue
(name='???', index=0)¶ Bases:
object
Class for holding a set of PDB atoms
Attributes
atoms (list of Atom objects) the atom of this residue index (integer) the number of the residue in the pdb file name (string) the name of the residue center (NumPy array) the center of coordinates of all atoms Methods
addAtom
(atom)Adds an atom to this residue getCenter
()Sets the center of coordinates for this residue isAminoacid
()Checks is the residue name is an aminoacid name -
addAtom
(atom)¶ Adds an atom to this residue
Parameters: atom : Atom object
the atom to add
-
getCenter
()¶ Sets the center of coordinates for this residue
-
isAminoacid
()¶ Checks is the residue name is an aminoacid name
-
-
class
tools.simulationobjects.
RestartFile
(filename=None)¶ Class to hold the information on a restart file
Attributes
filename (string) the name of the restart file nsolutes (int) the number of solute molecules ngcsolutes (int) the number of gcsolute molecules solutesdic (dict) the correlation of solute ids with residue names gcsolutesdic (dict) the correlation of gcsolutes ids with residue names Methods
read
(filename)Read the restart file from disc -
read
(filename)¶ Read the restart file from disc
Parameters: filename : string
the name of the file to read
-
-
class
tools.simulationobjects.
ResultsFile
¶ Class to store a collection of results
Attributes
filename (string) the name of the file snapshots (list of SnapshotResult) all the results series (SnapshotResult) all the results in a single object Methods
make_series
()Make a snapshot with all the results read
(filename[, skip, readmax])Read results from disc -
make_series
()¶ Make a snapshot with all the results
This routine creates a special SnapshotResults object, which has the same attributes as the objects in the snapshots list, but rather than storing single floats and integers, this object stores NumpyArrays of all the results
Returns: SnapshotResults
the created object, also stored in self.series
-
read
(filename, skip=0, readmax=None)¶ Read results from disc
The filename parameter can be either a single filename, in case it is assumed that it is a ProtoMS3.0 results file, i.e. it contains several snapshots if it is a list of strings, two behaviors are supported:
- if the length of the list is 2, and the first filename
is a dictionary, a glob is used to list all filenames in that directory that starts with the second filename in the list
- if the length is not two or you give two filenames,
each of them are processed individually and treated as individual snapshots
Parameters: filename : string or list of strings
the name of the file to read
skip : int, optional
number of snapshot at the beginning to skip
readmax : int, optional
maximum number of snapshots to read
-
-
exception
tools.simulationobjects.
SetupError
¶ Bases:
exceptions.Exception
A general exception class to be raised by setup code
-
class
tools.simulationobjects.
SnapshotResults
¶ Class to store a single snapshot of results
Not all attributes might not be set as they might not exists in the result file
internal_energies and interaction_energies are dictionary where the key is is the molecules involved in the energy, e.g. protein1, or protein1-solute1. The value is a list of EnergyResults objects, for the various energy components.
Attributes
lam (float) the current lambda value lamb (float) the previous lambda value lamf (float) the next lambda value datastep (int) the number of steps the averages are calculate over lambdareplica (int) the index of the lambda replica temperaturereplica (int) the index of the temperature replica global replica (int) the index of the global replica temperature (float) the temperature of the simulation efftemperature (float) the effective temperature in case of REST ngcsolutes (int) the number of GC solutes nthetasolutes (int) the number of theta solutes bvalue (float) the Adams value solventson (int) the number of GC solutes that are turned on pressure (float) the pressure volume (float) the volume seed (int) the random seed backfe (float) the free energy to the previous lambda forwfe (float) the free energy to the next lambda total (EnergyResults object) the total energy internal_energies (dictionary of lists of EnergyResults object) the internal energies interaction_energies (dictionary of lists of EnergyResults objects) the interaction energies capenergy (EnergyResults object) the energy of the cap extraenergy (EnergyResults object) all extra energies feenergies (dictionary of float) the total energy at various lambda values gradient (float) the numerical gradient of lambda agradient (float) the analytical gradient of lambda thetavals (list of float) the theta values of all GC solutes thetasolvals (list of float) the theta values of all theta solutes Methods
parse
(fileobj)Parse a file for results -
parse
(fileobj)¶ Parse a file for results
Parameters: fileobj : file object
the file to read from
Returns: string :
the line last read
-
-
class
tools.simulationobjects.
TemplateAtom
(record)¶ Class to hold a template atom
Attributes
name (string) the name of the atom residue (string) the residue of the atom param0 (int or ForceFieldParameter) the parameter associated with this atom at v0 param1 (int or ForceFieldParameter) the parameter associated with this atom at v1 bondedto (string or TemplateAtom) the atom this atom is bonded to angleto (string or TemplateAtom) the atom this atom forms an angle with dihedto (string or TemplateAtom) the atom this atom forms a dihedral with Methods
parse
(record)Parse a line from a ProtoMS file zmat
()Produces a simple z-matrix representation of this atom -
parse
(record)¶ Parse a line from a ProtoMS file
Parameters: record : string
the line to parse from
-
zmat
()¶ Produces a simple z-matrix representation of this atom
Returns: returns
the z-matrix representation
-
-
class
tools.simulationobjects.
TemplateConnectivity
(record=None)¶ Class to hold a solute bond, angle or dihedral
Attributes
type (string) the kind of connectivity, i.e. bond, angle or dihedral atoms (list of strings or TemplateAtom objects) the atoms involved in this connectivity flex (float) the flexibility param0 (int or ForceFieldParameter) the parameter associated with this connectivity at v0 param1 (int or ForceFieldParameter) the parameter associated with this connectivity at v1 dummy (bool) flag to indicate if this should be treated as a dummy Methods
parse
(record)Parse a line from a ProtoMS file -
parse
(record)¶ Parse a line from a ProtoMS file
Parameters: record : string
the line to parse from
-
-
class
tools.simulationobjects.
TemplateFile
(filename=None)¶ Class to hold a ProtoMS template file
Attributes
bondparams (list of ForceFieldParameter objects) all bond parameters bondatoms (list of AtomSet objects) all atoms associated with bond parameters angleparams (list of ForceFieldParameter objects) all angle parameters angleatoms (list of AtomSet objects) all atoms associated with angle parameters dihedralterms (list of ForceFieldParameter objects) all dihedral term parameters dihedralparams (list of ForceFieldParameter objects) all dihedral parameters dihedralatoms (list of AtomSet objects) all atoms associated with dihedral parameters cljparams (list of ForceFieldParameter objects) all clj parameters templates (list of MolTemplate objects) all templates in this file Methods
append
(other)Adds another template file to this one assign_paramobj
()Replaces integers and strings with objects read
(filename)Read a template file from disc write
(filename)Write a template file to disc -
append
(other)¶ Adds another template file to this one
Will renumber the parameters of the other file
Parameters: other : TemplateFile
the file to add
-
assign_paramobj
()¶ Replaces integers and strings with objects
It replaces all indices to force field parameters with references to ForceFieldParameter objects
It replaces all atom in templates with references to TemplateAtom objects
-
read
(filename)¶ Read a template file from disc
Parameters: filename : string
the name of the file to read
-
write
(filename)¶ Write a template file to disc
Parameters: filename : string
the name of the file to write to
-
-
class
tools.simulationobjects.
TemplateSoluteAtom
(record=None)¶ Bases:
tools.simulationobjects.TemplateAtom
Class to hold a solute atom
This is a sub-class that implements functions that are specific for solute templates
Has the same attributes as TemplateAtom
Methods
parse
(record)Parse a line from a ProtoMS file zmat
()Produces a simple z-matrix representation of this atom -
parse
(record)¶ Parse a line from a ProtoMS file
Parameters: record : string
the line to parse from
-
zmat
()¶ Produces a simple z-matrix representation of this atom
Returns: returns
the z-matrix representation, viz. ATOM BONDEDTO ANGLETO DIHEDRALTO
-
-
tools.simulationobjects.
angle
(v1, v2)¶ Calculates the angle between two vectors
Parameters: v1 : Numpy array
the first vecor
v2 : Numpy array
the second vecor
Returns: float
the angle in radians
-
tools.simulationobjects.
angle_atms
(a1, a2, a3)¶ Calculates the angle between three atoms
Parameters: a1 : Numpy array
the first atom
a2 : Numpy array
the second atom
a3 : Numpy array
the third atom
Returns: float
the angle in radians
-
tools.simulationobjects.
color
(idx)¶ Returns a color of index
For instances when the index is larger than the number of defined colors, this routine takes care of this by periodicity, i.e. color at idx=0 is the same color as idx=n
Parameters: idx : int
the index of the color
Returns: list of floats
the color
-
tools.simulationobjects.
find_box
(pdbobj)¶ Parse box information from a pdb file
Looks for CENTER, DIMENSIONS and box keywords in the header of the pdb file
Parameters: pdbobj : PDBFile object
the structure to parse
Returns: dictionary of Numpy arrays
the center, length and origin of the box
-
tools.simulationobjects.
is_solvent
(name)¶ Check whether a given residue name is a solvent residue name
Parameters: name : string
the residue name
-
tools.simulationobjects.
merge_pdbs
(pdbobjs)¶ Merge pdb files
Create a new PDBFile instance and add all residues and solvents from all pdb files given, renumbering residues
Parameters: pdbobjs : list of PDBFile objects
Returns: PDBFile object
the newly created and merged pdb structure
-
tools.simulationobjects.
setup_logger
(filename=None)¶ Setup ProtoMS logging system
Uses the standard logging module with two handlers, one that prints everything above DEBUG to standard output and one that prints everything, even DEBUG to a file
If filename is None no file handler is created
This should be called by protoms.py and all other stand-alone programs that uses the tools
Parameters: filename : string, optional
the filename of the string
Returns: a reference to the created logger
-
tools.simulationobjects.
standard_filename
(filename, folder)¶ Generates the filename of file in the standard ProtoMS file hierarchy
If $PROTOMSHOME is set, it uses it as the base-path, otherwise, it uses the location of this module as to create the base-path
Parameters: filename : string
the name of the file
folder : string
a folder in the standard ProtoMS file hierarchy
Returns: the full path to the file
-
tools.simulationobjects.
write_box
(filename, box)¶ Write a box in PDB file format
Parameters: filename : string
the name of the file to write
box : dictionary of Numpy array
the box specification
tools.solvate module¶
Routines to solvate a structure
This module defines a single public function: solvate
Can be executed from the command line as a stand-alone program
-
tools.solvate.
solvate
(box, ligand=None, protein=None, geometry='box', padding=10.0, radius=30.0, center='cent', namescheme='ProtoMS', offset=0.89)¶ Function to solvate ligand and/or protein structures using a pre-equilibrated box of waters.
Parameters: box : String
String giving the name of a pdb file containing a box of pre- equilibrated water molecules for solvation
ligand : PDBFile or string, optional
Either pdb instance for ligand to be solvated, or string giving the name of a pdb file of the ligand. NOTE - either ligand or protein or both must be supplied
protein : PDBFile or string, optional
Either pdb instance for protein to be solvated, or string giving the name of a pdb file of the protein. NOTE - either ligand or protein or both must be supplied
geometry : string, optional
Shape of solvent box, options “box”, “droplet”, “flood”. Default box. Droplet defines a sphere of radius ‘radius’ around center ‘center’. Box defines a box that extends at least distance ‘padding’ from solute Flood defines the equivalent, but waters overlapping with the solute are not removed
padding : float, optional
Minimum distance between the solute and the box edge. Default 10.0A
radius : float, optional
The radius of the added droplet sphere. Default 30.0A
center : string, optional
Defines the center of the added droplet sphere. Options “cent”, one, two or three numbers. Default “cent”. Cent defines the center based on all solute atom coordinates One number defines coordinates for the center as identical x,y,z Two numbers defines coordinates for the center over an atom range Three numbers defines coordinates for the center as separate x,y,z
namescheme : string, optional
Naming scheme for printout, options “ProtoMS”, “Amber”. Default ProtoMS
Returns: PDBFile
the created box of waters, including crystallographic water
Raises: SetupError
neither protein nor ligand was given, or x-ray waters is not same format as pre-equilibrated box
tools.split_jawswater module¶
Routine to split JAWS-1 water into PDBs for JAWS-2
This module defines a single public function: split_water
Can be executed from the command line as a stand-alone program
-
tools.split_jawswater.
set_jaws2_box
(water_files, length=3)¶ Sets the header of the pdbs containing one single solvent molecule to define a box around the first atom
- water_files : PDBSet
- a pdb set containing the pdb files with one molecule of solvent
- length : int, optional
- the dimensions of the box around the molecule
-
tools.split_jawswater.
split_waters
(waters)¶ Split waters in a PDB file to many PDB-files for JAWS-2
Parameters: waters : string or PDBFile object
the PDB structure
Returns: PDBSet
single waters
PDBSet
excluding single waters