Density maps
The experimental density map for a cryoEM experiment itself corresponds to a 3-D numpy.ndarray
that contains the value of the density at different voxels. It is the location of the voxels themselves that encodes how these density values map onto the spatial information of the biomolecule. This information on the grid of the density map is stored in a separate class (gridclass
) in HARP.
gridclass
class harp.density.gridclass (origin, dxyz, nxyz, *args, **kwargs)
A gridclass
object stores the grid defining the voxel locations for a density map.
Attributes
Variable | Descrption |
---|---|
self.origin |
numpy.ndarray A 1-D double array of size 3 containing the Cartesian coordinates of the lower corner of the grid. |
self.dxyz |
numpy.ndarray A 1-D double array of size 3 containing the rectilinear spacing between each grid point along all Cartesian axes. |
self.nxyz |
numpy.ndarray A 1-D double array of size 3 containing the number of grid points in each Cartesian direction |
Functions
The functions associated with gridclass
are
Function | Descrption |
---|---|
self.xyzmin |
Returns the Cartesian coordinates of the lower corner of the grid (i.e., self.origin ). Input: None. Output A numpy.ndarray of double values, of size 3. |
self.xyzmax |
Returns the Cartesian coordinates of the upper corner of the grid (i.e., the one diagonally opposite self.origin ). Input: None. Output A numpy.ndarray of double values, of size 3. |
self.com |
Returns the Cartesian coordinates of the center-of-mass of the grid (not weighted by the density). Input: None. Output A numpy.ndarray of double values, of size 3. |
self.grid_ijk() |
Returns an array of the indices of the grid. Input: None. Output: A tuple of gx , gy , and gy , which are 1-D numpy.ndarray s of int values, of size self.nxyz[0] , self.nxyz[1] and self.nxyz[2] , which are the number of gridpoints in the x-, y- and z-direction respectively. |
self.grid_xyz |
Returns an array of the Cartesian coordinates corresponding to the indices of the grid. Input: None. Output: A tuple of gx , gy , and gy , which are 1-D numpy.ndarray s of double values, of size self.nxyz[0] , self.nxyz[1] and self.nxyz[2] , which are the number of gridpoints in the x-, y- and z-direction respectively. |
load
harp.density.load (fname)
This function loads cryoEM densities and the associated grid (file format suffixes supported are .map, .MAP, .mrc, .MRC, .map.gz, and .MAP.gz).
Arguments
Variable | Descrption |
---|---|
fname |
string The file-name for the cryoEM density map. |
Output
Variable | Descrption |
---|---|
grid |
gridclass The grid of voxel locations of the cryoEM density map. |
density |
numpy.ndarray A 3-D array of double values corresponding to the density values at specific voxels corresponding to grid . |
x2i
harp.density.x2i (grid, point)
This function transforms a point in Cartesian coordinates to the grid indices based on a particular grid.
Arguments
Variable | Descrption |
---|---|
grid |
gridclass The cryoEM grid which the Cartesian coordinates will be transformed with respect to. |
point |
numpy.ndarray An array of double values of size 3, containing the Cartesian coordinates of the point. |
Output
Variable | Descrption |
---|---|
point |
numpy.ndarray An array of int values of size 3, containing the grid indices of the point. |
i2x
harp.density.i2x (grid, point)
This function transforms a point in grid indices to Cartesian coordinates based on a particular grid.
Arguments
Variable | Descrption |
---|---|
grid |
gridclass The cryoEM grid which the grid indices will be transformed with respect to. |
point |
numpy.ndarray An array of int values of size 3, containing the grid indices of the point. |
Output
Variable | Descrption |
---|---|
point |
numpy.ndarray An array of double values of size 3, containing the Cartesian coordinates of the point. |
subgrid_center
harp.density.subgrid_center (grid, centerxyz, halfwidthxyz)
This function defines and returns a cubic subgrid within a specific gridclass
object centered at the specified point and with a specified half-width in every direction from that point.
Arguments
Variable | Descrption |
---|---|
grid |
gridclass The cryoEM grid in which the subgrid will be defined |
centerxyz |
numpy.ndarray An array of double values of size 3, containing the Cartesian coordinates of the center of the subgrid. |
halfwidthxyz |
numpy.ndarray An array of double values of size 3, containing the halfwidths of the subgrid from the center (in \(\unicode{x212B}\)). |
Output
Variable | Descrption |
---|---|
grid |
A gridclass object containing the defined subgrid. |
subgrid_extract
harp.density.subgrid_extract (grid, data, subgrid)
This function extracts the cryoEM density from a map for the voxels corresponding to a cubic subgrid within a specific grid.
Arguments
Variable | Descrption |
---|---|
grid |
gridclass The cryoEM grid associated with the cryoEM map. |
data |
numpy.ndarray The cryoEM density values defined at the voxel locations in grid . |
subgrid |
gridclass The subgrid defined on grid for which the densities will be extracted. |
Output
Variable | Descrption |
---|---|
data |
numpy.ndarray The cryoEM density values defined at the voxel locations in subgrid . |
trim_density_to_mol
harp.density.trim_density_to_mol (grid, data, mol, pad = 8.)
This function finds the box that emcompasses the atomic coordinates of a specific molecular model on the grid for a specified density map and returns a trimmed grid and associated density map corresponding to this box. The trimmed box may additionally be padded isotropically by a constant value using periodic boundary condtions. This truncation is particularly useful for maps where only a small region has been used to build a model (which commonly occurs for molecules with high rotational symmetry) as it greatly reduces the computational cost of HARP calculations in these cases.
Arguments
Variable | Descrption |
---|---|
grid |
gridclass The cryoEM grid associated with the cryoEM map. |
data |
numpy.ndarray The cryoEM density values defined at the voxel locations in grid . |
mol |
harp.molecule.atomcollection The molecular model that is built using part of the the cryoEM densities in data at voxel locations specified in grid . |
pad |
double A constant length (in \(\unicode{x212B}\)) that is added to the box encompassing mol that is padded using peridic boundary conditions. The default value is 8. |
Output
Variable | Descrption |
---|---|
grid |
gridclass The grid trimmed to the box around mol . |
data |
numpy.ndarray The cryoEM densities at the voxel locations specified by the trimmed grid . |