in data/prepare_GO_data.py [0:0]
def get_atom_coords(residue, target_atoms=["N", "CA", "C", "O"]):
"""Extract the coordinates of the target_atoms from an AA residue.
Handles exception where residue doesn't contain certain atoms
by setting coordinates to np.nan
Args:
residue: a Bio.PDB.Residue object.
target_atoms: Target atoms which residues will be resturned.
Returns:
np arrays with target atoms 3D coordinates in the order of target atoms.
"""
atom_coords = []
for atom in target_atoms:
try:
coord = residue[atom].coord
except KeyError:
coord = [np.nan] * 3
atom_coords.append(coord)
return np.asarray(atom_coords)