Measures¶
measuring characteristics¶
Functions to measure characteristics of any BiobOx object
- ccs(M, use_lib=True, impact_path='', impact_options='-Octree -nRuns 32 -cMode sem -convergence 0.01', pdbname='', tjm_scale=False, proberad=1.0)[source]¶
compute CCS calling either impact.
- Parameters
M – any biobox object
use_lib – if true, impact library will be used, if false a system call to impact executable will be performed instead
impact_path – by default, the environment variable IMPACTPATH is sought. This allows redirecting to a specific impact root folder.
impact_options – flags to be passes to impact executable
pdbname – if a file has been already written, impact can be asked to analyze it
tjm_scale – if True, CCS value calculated with PA method is scaled to better match trajectory method.
proberad – radius of probe. Do find out if your impact library already adds this value by default or not (old ones do)!
- Returns
CCS value in A^2. Error return: -1 = input filename not found, -2 = unknown code for CCS calculation
-3 CCS calculator failed, -4 = parsing of CCS calculation results failed
- rgyr(M)[source]¶
compute radius of gyration.
- Parameters
M – any biobox object
- Returns
radius of gyration
- sasa(M, targets=[], probe=1.4, n_sphere_point=960, threshold=0.05)[source]¶
compute the accessible surface area using the Shrake-Rupley algorithm (“rolling ball method”)
- Parameters
M – any biobox object
targets – indices to be used for surface estimation. By default, all indices are kept into account.
probe – radius of the “rolling ball”
n_sphere_point – number of mesh points per atom
threshold – fraction of points in sphere, above which structure points are considered as exposed
- Returns
accessible surface area in A^2
- Returns
mesh numpy array containing the found points forming the accessible surface mesh
- Returns
IDs of surface points
- saxs(M, crysol_path='', crysol_options='-lm 20 -ns 500', pdbname='')[source]¶
compute SAXS curve using crysol (from ATSAS suite)
- Parameters
M – any biobox object
crysol_path – path to crysol executable. If not provided, the environment variable ATSASPATH is sought instead. This allows redirecting to a specific ATSAS bin folder.
crysol_options – flags to be passes to impact executable
pdbname – if a file has been already written, crysol can be asked to analyze it
- Returns
SAXS curve (nx2 numpy array)
measuring distances¶
Helper functions and classes are available to assess points’ pairwise interactions between points. These are divided in two categories:
straight line (i.e. euclidean distances, van der Waals interactions).
paths (e.g. used to model cross-linking data)
Helper functions for the calculation of pairwise interactions
- distance_matrix(points1, points2)[source]¶
compute full distance matrix between two points clouds
- Parameters
points1 – nx3 numpy array containing points coordinates
points2 – mx3 numpy array containing points coordinates
- Returns
nxm distance matrix (numpy array)
- get_neighbors(dist, cutoff)[source]¶
detect interfacing points (couples at less than a certain cutoff distance)
- Parameters
dist – distance matrix
cutoff – maximal distance at which lennard-jones interaction is considered
- Returns
list of interacting couples
- lennard_jones(points1, points2, epsilon=1.0, sigma=2.7, cutoff=12.0, coeff1=9, coeff2=6)[source]¶
Compute m-n lennard-jones potential between two ensembles of points.
- Parameters
points1 – nx3 numpy array containing points coordinates
points2 – mx3 numpy array containing points coordinates
epsilon – epsilon parameter
sigma – sigma parameter
cutoff – maximal distance at which lennard-jones interaction is considered
coeff1 – coefficient of repulsive term (m coefficient)
coeff2 – coefficient of attractive term (n coefficient)
- Returns
m-n lennard-jones potential (kJ/mol)
- class Path(points)[source]¶
Methods for finding shortest paths between points in a point cloud (typically a
Structure
object).Two algorithms are implemented: A* and Theta*. In order to deal with lists of links within the same dataset, two methodologies are offered, global or local.
global builds a grid around the whole ensemble of points once, and every subsequent distance measure is performed on the same grid.
local a local grid is displaced to surround the points to be linked.
Global take longer to initialize, and is more memory intensive, but subsequent measures are quick. Local takes less memory, but individual measures take more time to be performed.
An accessibility graph must be initially created around the provided points cloud. This is a mesh where none of its nodes clashes with any of the provided point in the cloud. After instantiation,
setup_local_search
orsetup_global_search
must first be called (depending on whether one wants to generate a single grid encompassing all the protein, or a smaller, moving grid).- Parameters
points – points for representing obstacles.
- a_star(start, goal)[source]¶
A* algorithm, find path connecting two points in the graph.
- Parameters
start – starting point (flattened coordinate of a graph grid point).
goal – end point (flattened coordinate of a graph grid point).
- lazy_theta_star(start, goal)[source]¶
Lazy Theta* algorithm (better than Theta* in terms of amount of line-of-sight tests), find path connecting two points in the graph.
- Parameters
start – starting point (flattened coordinate of a graph grid point).
goal – end point (flattened coordinate of a graph grid point).
- search_path(start, end, method='theta', get_path=True, update_grid=True, test_los=True)[source]¶
Find the shortest accessible path between two points.
- Parameters
start – coordinates of starting point
end – coordinates of target point
method – can be theta or astar
get_path – return full path (not only waypoints)
update_grid – if True, grid will be recalculated (for local search only)
test_los – if true, a line of sight postprocessing will be performed to make paths straighter
- setup_global_search(step=1.0, maxdist=34, use_hull=True, boundaries=[], cloud=array([], dtype=float64), params=array([], dtype=float64))[source]¶
setup Path to perform path search using the a global grid wrapping all the obtacles region. This method (or
setup_local_search
) must be called before and path detection can be lauched withsearch_path
.- Parameters
step – grid step size.
maxdist – clash detection threshold
use_hull – if True, points not laying within the convex hull wrapping around obtacles will be excluded
boundaries – build a grid within the desired box boundaries (if defined, maxdist parameter is ignored)
cloud – build a grid using a points cloud as extrema for the construction of the box. If defined, maxdist and boundaries parameters are ignored.
- setup_local_search(step=1.0, maxdist=28, params=array([], dtype=float64))[source]¶
setup Path to perform path search using the local grid method. This method (or
setup_global_search
) must be called before and path detection can be launched withsearch_path
.- Parameters
step – grid step size
maxdist – clash detection threshold
- smooth(chain, move_angle_thresh=0.0)[source]¶
Utility method aimed at smoothing a chain produced by A* or Theta*, to make it less angular.
- Parameters
chain – numpy array containing the list of points composing the path
move_angle_thresh – if angle between three consecutive points is greater than this threshold, smoothing is performed
- Returns
smoothed chain (3xN numpy array)
- class Xlink(molecule)[source]¶
subclass of
Path
, measure cross-linking distance between atom pairs in a molecule.after instantiation, call first
set_clashing_atoms
to define molecule’s atoms of interest for clash detection.Subsequently, call either
setup_local_search
orsetup_local_search
to prepare the points grid used for path detection.Physical distances between a list of atom indices can be finally computed with
distance_matrix
or, between two atoms only, withsearch_path
.
If molecule contains multiple conformations, conformation i can be chosen by calling Xlink.molecule.set_current(i) before performing the procedure described in superclass.
- Parameters
molecule –
Molecule
instance
- distance_matrix(indices, method='theta', get_path=False, smooth=True, verbose=False, test_los=True, flexible_sidechain=False, sphere_pts_surf=4.0)[source]¶
compute distance matrix between provided indices.
- Parameters
indices – atoms indices (within the data structure, not the original pdb file). Get the indices via molecule.atomselect(…) command.
method – can be “theta” or “astar”.
get_path – if true, a list containing all the paths is also returned
smooth – if True, path will be refined to make turns less angular.
verbose – if True, the algorithm will dump text in console
sphere_pts_surf – surface occupied per sphere point, in A2. The smaller, the higher the points density
test_los – if true, a line of sight postprocessing will be performed to make paths straighter
flexible_sidechain – if True, the selected atoms will be rotated around their associated CA, in order to scan for alternative sidechain arrangements. A sphere of clash-free alternative conformations is generated, and the shortest distance accounting for all these different possibilities is returned. Note that this method is computationally expensive.
- Returns
distance matrix (numpy 2d array). matrix will contain -1 if atoms are too far, and -2 if one of the two atoms is buried. If get_path is True, a list of paths is also returned (format: [[id1, id2], [path]]).
- set_clashing_atoms(atoms=[], densify=True, atoms_vdw=False, points=[])[source]¶
define atoms to consider for clash detection.
- Parameters
atoms – atomnames to consider for clash detection. If undefined, protein backbone and C beta will be considered.
densify – if True, all atoms not solvent exposed will be considered for clash detection.
- setup_global_search(step=1.0, maxdist=28, use_hull=False, boundaries=[], cloud=array([], dtype=float64))[source]¶
setup Path to perform path search using the a global grid wrapping all the obtacles region. This method (or
setup_local_search
) must be called before and path detection can be lauched withsearch_path
.- Parameters
step – grid step size.
maxdist – clash detection threshold
use_hull – if True, points not laying within the convex hull wrapping around obtacles will be excluded
boundaries – build a grid within the desired box boundaries (if defined, maxdist parameter is ignored)
cloud – build a grid using a points cloud as extrema for the construction of the box. If defined, maxdist and boundaries parameters are ignored.