5.1. ligandparam.io.coordinates

class ligandparam.io.coordinates.Coordinates(filename: Path | str, filetype: str = 'pdb')[source]

Bases: object

A class to handle the coordinates of a structure.

This class is a wrapper around the MDAnalysis Universe class, and provides a simple interface to manipulate the coordinates of a structure.

Parameters:
  • filename (Union[Path, str]) – The filename of the structure to read in

  • filetype (str, optional) – The filetype of the structure to read in

Methods

get_coordinates()

Grabs the coordinates

get_elements()

Grabs the elements

rotate([alpha, beta, gamma])

Rotate the coordinates around specific axes around the center of mass.

update_coordinates(coords[, original])

Updates the coordinates

get_coordinates()[source]

Grabs the coordinates

Parameters:

None

Returns:

coords – The coordinates of the atoms in the structure

Return type:

np.array

get_elements()[source]

Grabs the elements

Parameters:

None

Returns:

elements – The elements of the atoms in the structure

Return type:

list

rotate(alpha=0.0, beta=0.0, gamma=0.0)[source]

Rotate the coordinates around specific axes around the center of mass.

The rotation is done in the order alpha, beta, gamma, and the rotation is done around the center of mass.

Parameters:
  • alpha (float) – The angle to rotate the structure in the alpha direction (degrees)

  • beta (float) – The angle to rotate the structure in the beta direction (degrees)

  • use_original (bool, optional) – If True, the rotation will be applied to the new coordinates

update_coordinates(coords, original=False)[source]

Updates the coordinates

Parameters:

coords (np.array) – The new coordinates to update the structure with

Return type:

None

class ligandparam.io.coordinates.Mol2Writer(u, filename=None, selection='all')[source]

Bases: object

A class to write a mol2 file.

Parameters:
  • u (MDAnalysis Universe) – The universe to write to a mol2 file

  • filename (str) – The filename to write to

Methods

write()

Write the mol2 file.

write()[source]

Write the mol2 file.

This uses the _write method to write the mol2 file, and then removes any blank lines from the file.

Parameters:

None

ligandparam.io.coordinates.Remove_PDB_CONECT(filename: Path | str, backup: bool = False)[source]

Removes CONECT lines from a PDB file.

This script (1) copies the pdb file to a new file (with input added to the filename) and (2) removes the CONECT records from the original file.

Parameters:

filename (str) – The name of the file to check

Return type:

None

ligandparam.io.coordinates.SimpleXYZ(file_obj, coordinates)[source]

Write a simple XYZ file with the coordinates.

Parameters:
  • file_obj (file object) – The file object to write to

  • coordinates (np.array) – The coordinates to write to the file