# utilities¶

Utilities for the PDB2PQR software suite.

Code author: Todd Dolinsky

Code author: Yong Huang

Code author: Nathan Baker

pdb2pqr.utilities.add(coords1, coords2)[source]

Add one 3-dimensional point to another.

Parameters: coords1 ([float, float, float]) – coordinates of form [x,y,z] coords2 ([float, float, float]) – coordinates of form [x,y,z] list of coordinates equal to coords2 + coords1 numpy.ndarray
pdb2pqr.utilities.analyze_connectivity(map_, key)[source]

Analyze the connectivity of a given map using the key value.

Parameters: map (dict) – map to analyze key (str) – key value list of connected values to the key list
pdb2pqr.utilities.angle(coords1, coords2, coords3)[source]

Get the angle between three coordinates.

Parameters: coords1 ([float, float, float]) – first coordinate set coords2 ([float, float, float]) – second (vertex) coordinate set coords3 ([float, float, float]) – third coordinate set angle between the atoms (in degrees) float
pdb2pqr.utilities.cross(coords1, coords2)[source]

Find the cross-product of one 3-dimensional point with another.

Parameters: coords1 ([float, float, float]) – coordinates of form [x,y,z] coords2 ([float, float, float]) – coordinates of form [x,y,z] list of coordinates equal to coords2 cross coords1 numpy.ndarray
pdb2pqr.utilities.dihedral(coords1, coords2, coords3, coords4)[source]

Calculate the dihedral angle from four atoms’ coordinates.

Parameters: coords1 ([float, float, float]) – one of four coordinates of form [x,y,z] coords2 ([float, float, float]) – one of four coordinates of form [x,y,z] coords3 ([float, float, float]) – one of four coordinates of form [x,y,z] coords4 ([float, float, float]) – one of four coordinates of form [x,y,z] the angle (in degrees) float
pdb2pqr.utilities.distance(coords1, coords2)[source]

Calculate the distance between two coordinates.

Parameters: coords1 ([float, float, float]) – coordinates of form [x,y,z] coords2 ([float, float, float]) – coordinates of form [x,y,z] distance between the two coordinates float
pdb2pqr.utilities.dot(coords1, coords2)[source]

Find the dot-product of one 3-dimensional point with another.

Parameters: coords1 ([float, float, float]) – coordinates of form [x,y,z] coords2 ([float, float, float]) – coordinates of form [x,y,z] list of coordinates equal to the inner product of coords2 with coords1 numpy.ndarray
pdb2pqr.utilities.factorial(num)[source]

Returns the factorial of the given number.

Parameters: num (int) – number for which to compute factorial factorial of number int
pdb2pqr.utilities.normalize(coords)[source]

Normalize a set of coordinates to unit vector.

Parameters: coords ([float, float, float]) – coordinates of form [x,y,z] normalized coordinates numpy.ndarray
pdb2pqr.utilities.shortest_path(graph, start, end, path=[])[source]

Find the shortest path between two nodes.

Uses recursion to find the shortest path from one node to another in an unweighted graph. Adapted from http://www.python.org/doc/essays/graphs.html

Parameters: graph (dict) – a mapping of the graph to analyze, of the form {0: [1,2], 1:[3,4], …} . Each key has a list of edges. start (str) – the ID of the key to start the analysis from end (str) – the ID of the key to end the analysis path (list) – optional argument used during the recursive step to keep the current path up to that point list of the shortest path or None if start and end are not connected list
pdb2pqr.utilities.sort_dict_by_value(inputdict)[source]

Sort a dictionary by its values.

Parameters: inputdict (dict) – the dictionary to sort list of keys sorted by value list
pdb2pqr.utilities.subtract(coords1, coords2)[source]

Suntract one 3-dimensional point from another.

Parameters: coords1 ([float, float, float]) – coordinates of form [x,y,z] coords2 ([float, float, float]) – coordinates of form [x,y,z] list of coordinates equal to coords2 - coords1 numpy.ndarray