Core functionality — bornprofiler.core

Base classes around which the whole BornProfiler package is built,

class bornprofiler.core.BPbase[source]

Provide basic infra structure methods for bornprofiler classes.

Defines the file name API.

  • simply number files, do not use z or other data in filename;
  • assume standard python 0-based indexing and naming
  • filenames are generated and typically only take num, the window number, as an argument

Note

This class cannot be used on its own and it relies on other attributes being set by the parent class.

get_taskid(num)[source]

Return 1-based Sun Gridengine taskid for an array job

readPQR()[source]

Read PQR file and determines protein centre of geometry

readPoints()[source]

Read positions for Born ions from data file.

Tries to be smart and autodetect standard x-y-z dat file or pdb.

writePQRs(windows=None)[source]

Generate input pqr files for all windows and store them in separate directories.

bornprofiler.core.IONS = {'Ag': {'atomname': 'Ag+', 'charge': 1.0, 'name': 'Ag', 'radius': 1.434, 'symbol': 'Ag+'}, 'Al': {'atomname': 'Al3+', 'charge': 3.0, 'name': 'Al', 'radius': 1.338, 'symbol': 'Al+3'}, 'Ba': {'atomname': 'Ba2+', 'charge': 2.0, 'name': 'Ba', 'radius': 2.119, 'symbol': 'Ba+2'}, 'Br': {'atomname': 'BR-', 'charge': -1.0, 'name': 'Br', 'radius': 2.087, 'symbol': 'Br-'}, 'Ca': {'atomname': 'Ca2+', 'charge': 2.0, 'name': 'Ca', 'radius': 1.862, 'symbol': 'Ca+2'}, 'Cd': {'atomname': 'Cd2+', 'charge': 2.0, 'name': 'Cd', 'radius': 1.509, 'symbol': 'Cd+2'}, 'Ce3': {'atomname': 'Ce3+', 'charge': 3.0, 'name': 'Ce3', 'radius': 1.761, 'symbol': 'Ce+3'}, 'Ce4': {'atomname': 'Ce4+', 'charge': 4.0, 'name': 'Ce4', 'radius': 1.761, 'symbol': 'Ce+4'}, 'Cl': {'atomname': 'CL-', 'charge': -1.0, 'name': 'Cl', 'radius': 1.937, 'symbol': 'Cl-'}, 'Cs': {'atomname': 'CS+', 'charge': 1.0, 'name': 'Cs', 'radius': 2.514, 'symbol': 'Cs+'}, 'Cu1': {'atomname': 'Cu+', 'charge': 1.0, 'name': 'Cu1', 'radius': 1.252, 'symbol': 'Cu+'}, 'Cu2': {'atomname': 'Cu2+', 'charge': 2.0, 'name': 'Cu2', 'radius': 1.242, 'symbol': 'Cu+2'}, 'F': {'atomname': 'F-', 'charge': -1.0, 'name': 'F', 'radius': 1.423, 'symbol': 'F-'}, 'Ga': {'atomname': 'Ga3+', 'charge': 3.0, 'name': 'Ga', 'radius': 1.338, 'symbol': 'Ga+3'}, 'H': {'atomname': 'H+', 'charge': 1.0, 'name': 'H', 'radius': 0.6209, 'symbol': 'H+'}, 'H3O': {'atomname': 'H3O+', 'charge': 1.0, 'name': 'H3O', 'radius': 1.4848, 'symbol': 'H3O+'}, 'Hg': {'atomname': 'Hg2+', 'charge': 2.0, 'name': 'Hg', 'radius': 1.541, 'symbol': 'Hg+2'}, 'I': {'atomname': 'I-', 'charge': -1.0, 'name': 'I', 'radius': 2.343, 'symbol': 'I-'}, 'In': {'atomname': 'In3+', 'charge': 3.0, 'name': 'In', 'radius': 1.605, 'symbol': 'In+3'}, 'K': {'atomname': 'K+', 'charge': 1.0, 'name': 'K', 'radius': 2.172, 'symbol': 'K+'}, 'La': {'atomname': 'La3+', 'charge': 3.0, 'name': 'La', 'radius': 1.808, 'symbol': 'La+3'}, 'Li': {'atomname': 'LI+', 'charge': 1.0, 'name': 'Li', 'radius': 1.316, 'symbol': 'Li+'}, 'Mg': {'atomname': 'MG2+', 'charge': 2.0, 'name': 'Mg', 'radius': 1.455, 'symbol': 'Mg+2'}, 'NH4': {'atomname': 'NH4+', 'charge': 4.0, 'name': 'NH4', 'radius': 2.13, 'symbol': 'NH+4'}, 'Na': {'atomname': 'NA+', 'charge': 1.0, 'name': 'Na', 'radius': 1.68, 'symbol': 'Na+'}, 'OH': {'atomname': 'OH-', 'charge': -1.0, 'name': 'OH', 'radius': 1.498, 'symbol': 'OH-'}, 'OH2': {'atomname': 'OH2-', 'charge': -1.0, 'name': 'OH2', 'radius': 1.5612, 'symbol': 'OH2-'}, 'Rb': {'atomname': 'RB+', 'charge': 1.0, 'name': 'Rb', 'radius': 2.311, 'symbol': 'Rb+'}, 'S': {'atomname': 'S2-', 'charge': -2.0, 'name': 'S', 'radius': 1.969, 'symbol': 'S-2'}, 'SH': {'atomname': 'SH-', 'charge': -1.0, 'name': 'SH', 'radius': 1.969, 'symbol': 'SH-'}, 'Sc': {'atomname': 'Sc3+', 'charge': 3.0, 'name': 'Sc', 'radius': 1.541, 'symbol': 'Sc+3'}, 'Sr': {'atomname': 'Sr2+', 'charge': 2.0, 'name': 'Sr', 'radius': 2.054, 'symbol': 'Sr+2'}, 'Y': {'atomname': 'Y3+', 'charge': 3.0, 'name': 'Y', 'radius': 1.733, 'symbol': 'Y+3'}, 'Zn': {'atomname': 'Zn2+', 'charge': 2.0, 'name': 'Zn', 'radius': 1.338, 'symbol': 'Zn+2'}}

Rashin&Honig ion data as a dict, read from templates/bornions.dat.

class bornprofiler.core.Ion(name, symbol, atomname, radius, charge)[source]

Represent parameters for an ion.

class bornprofiler.core.MPlaceion(*args, **kwargs)[source]

Generate all input files for a Born profile calculation WITH a membrane

Setup Born profile with membrane.

MPlaceion(paramfile[,basedir])

MPlaceion(pqr,points[,memclass,jobName,ionName,ionicStrength,temperature,script,arrayscript,basedir])

Arguments:
parameterfile

ini-style file containing all run parameters

pqr

PQR file DEPRECATED

points

data file with sample points DEPRECATED

Keywords:
memclass

a class or type APBSMem to customize draw_membrane DEPRECATED

jobName

name of the run, used as top directory name and as unique identifier [mbornprofile]

ionName

name of the Rashin&Honig ion to calculate; any ion in IONS works [Na]

ionicStrength

concentration of monovalent NaCl solution in mol/l [0.15]

temperature

temperature in K [300.0]

script

template for a submission script (contains ‘abps %(infile)s > %(outfile)s’ or similar; %(jobname)s is also replaced). Can be (a) a local file, (b) a file stored in he user template dir, (c) a bundled template file.

arrayscript

template for a queuing system array script; contains the the placeholders %(jobName)s and %(jobArray)s; jobs are stored in the bash array ‘job’ so there should be a line ‘declare -a job’. Window numbers correspond to the task ids (SGE) ar array ids (PBS) in the job array. See templates/q_array.sge as an example.

basedir

top directory of set up, defaults to [.]

generate(windows=None, run=False)[source]

Set up all input files for Born calculations with a membrane.

generate([windows[,run]])

The optional parameter windows allows one to select a subset of windows instead of all the points in the sample points file; it can be a single number or a list.

Setting run to True immediately generates setup files, in particular it runs apbs and draw_membrane2a in order to add the membrane to the system. Because this can take a long time for a large number of windows it is also possible to only generate a bash script for each window and defer the setup (run = False, the default).

generateMem(windows=None, run=False)[source]

Generate special diel/kappa/charge files and mem_placeion.in for each window.

The APBS calculation is set up for manual focusing in three stages:
  1. L is a coarse grid and centered on the protein
  2. M is a medium grid, centered on the ion, and using focusing (the boundary values come from the L calculation)
  3. S is the finest grid, also centered and focused on the ion

The ion positions (“windows”) are simply sequentially numbered, starting at 1, as they appear in the input file. Each window is set up in its own directiroy (called “wNNNN” where NNNN is the 4-digit, zero-padded number).

Warning

At the moment it is not checked that the “inner” focusing region M are always contained in the outer region L; it’s on the TODO list.

Keywords:
windows : None, number, or list

window number or list of window numbers to generate. If set to None (the default) then all windows are generated. Window numbers start at 0 and end at numPoints-1.

run : bool

True: immediately generate files (can take a while); False defer file generation and just write a script [False]

get_MemBornSetup(num)[source]

Return the setup class for window num (cached).

The method is responsible for passing all parameters to downstream classes that are used to generate individual windows. It instantiates an appropriately set up class for each window and caches each class. Classes are indexed by num (which is the unique window identifier).

process_bornprofile_kwargs()[source]

Hook to manipulate bornprofile_kwargs.

# set exclusion zone centre to the protein centroid (unless x0_R and/or
y0_R are set in the run input cfg file)

# shift exclusion zone centre by dx_R and dy_R # filter remove_bornprofile_keywords

remove_bornprofile_keywords = ('fglen', 'dx_R', 'dy_R')

These keywords are read from the runinput file but should not be passed on through the bornprofile_keywords mechanism. See meth:process_bornprofile_keywords.

schedule = {'dime': [(129, 129, 129), (129, 129, 129), (129, 129, 129)], 'glen': [(250, 250, 250), (100, 100, 100), (50, 50, 50)]}

Schedule is run from first to last: L -> M -> S choose dime compatible with nlev=4 (in input file)

writeJob(windows=None)[source]

Write the job script.

Can be done selectively for a subset of windows and then the global array script will also only contain this subset of windows.

class bornprofiler.core.Placeion(*args, **kwargs)[source]

preparing job for APBS energy profiling by placing ions

generate()[source]

Generate all input files.

readPQR()[source]

Read PQR file and determine bounding box and centre of geometry.

bornprofiler.core.ngridpoints(c, nlev=4)[source]

The allowed number of grid points.

For mg-manual calculations, the arguments are dependent on the choice of nlev for dime by the formula

n = c*2**(nlev + 1) + 1

where n is the dime argument, c is a non-zero integer, lev is the nlev value. The most common values for grid dimensions are 65, 97, 129, and 161 (they can be different in each direction); these are all compatible with a nlev value of 4. If you happen to pick a “bad” value for the dimensions (i.e., mismatch with nlev), the APBS code will adjust the specified dime downwards to more appropriate values. This means that “bad” values will typically result in lower resolution/accuracy calculations!