image_from_atoms

macromol_voxelize.image_from_atoms(atoms: DataFrame, img_params: ImageParams) Tuple[Image, DataFrame][source]

Create an voxelized representation of the given atoms.

Parameters:
  • atoms

    A dataframe representing the atoms to voxelize. The following columns are used to build the image. Any other columns will be silently ignored:

    • x, y, z (required): The center coordinates of each atom, in units of angstroms.

    • radius_A (required): The radius of each atom, in units of angstroms. The set_atom_radius_A() function can be used to create this column, if necessary.

    • channels (required/optional): The channels that each atoms belongs to, expressed as a list of integers. Each atom can belong to any number of channels. Each channel index must be between 0 and img_params.channels - 1, inclusive. If the image only has one channel (i.e. img_params.channels == 1), this column is optional.

    • occupancy (optional): How “present” each atom is. More specifically, this is a factor that will be used to scale the overlap between the atom and each voxel. If not specified, an occupancy of 1 is assumed.

  • img_params – An object specifying any information that applies to the image as a whole, rather than to individual atoms. This most importantly includes the dimensions of the image.

Returns:

  • image:

    A floating point array of dimension \((C, X, Y, Z)\), where \(C\) is the number of channels specified by img_params.channels and \(X\), \(Y\), and \(Z\) are the spatial dimensions specified by img_params.grid.length_voxels.

  • atoms:

    A dataframe containing just the atoms that are present in the returned image. This dataframe can be used to calculate answers to questions such as how many atoms are in the image, is the image mostly protein or nucleic acid, what amino acid is in the center of the image, etc.

Return type:

tuple