Finds the atoms within a sphere with the indicated center and radius


ball(pdb, res, chain, r, backbone = FALSE)


pdb is either a PDB id, or the path to a pdb file.

chain a character indicating the chain to which the residue belongs

res position in the primary structure of the residue of interest, which will be use as center of the sphere.

r radious in ångströms of the sphere.

backbone logical, when TRUE it means that we include those atoms belonging to the main chain (CA, N, O and C) beside all the side chain atoms.


A dataframe with the atoms identification and their distances to the central atom.

See Also

pairwise.dist(), res.dist(), dist2closest()


The continuous formation and rupture of non-covalent bonds (intra- and intermolecular), gives rise to dynamic molecular interactions, which are cosubstantial to life. These non-covalent interactions can adopt many forms, but all of them are fundamentally electrostatic in nature, and strongly influenced by distances.

Type of interactionEnergy dependence on the distance
Ion-induced dipole1/r^4
Dipole-indiced dipole1/r^5

Therefore, computing spatial distances (in ångströms, Å), either between atoms or residues, is a useful task in many different contexts. A number of function from the package ptm will help us in these tasks:

There is a set of atoms of the protein molecule of particular interst because of they intramolecular interactions with other atoms that may be close enough. The types of relevant atoms that can be study with the function ball() are:

  • Sulfur delta (SD) from Met residues.
  • Sulfur gamma (SG) from Cys residues.
  • Oxigen gamma (OG) from Ser residues.
  • Oxigen gamma-1 (OG1) from Thr residues.
  • Carboxylate atoms (OE1 and OE2) from Glu residues.
  • Carboxylate atoms (OD1 and OD2 ) from Asp residues.
  • Nitrogen atoms (ND1 and NE2) of the imidazol from His residues.
  • Nitrogen atoms (NE, NH1 and NH2) of the guanidinum from Arg residues.
  • Nitrogen zeta (NZ) from Lys residues.
  • Benzene ring atoms (CG, CD1, CD2, CE1, CE2 and CZ) from Phe residues.
  • Benzene ring atoms (CG, CD1, CD2, CE1, CE2 and CZ) from Tyr residues.
  • Indol ring atoms (ring-1: CG, CD1, CD2, NE1, CE2; ring-2: CD2, CE3, CZ2, CH2, CZ3, CE2) from Trp residues.

The function ball() takes the (x, y, z) coordinates of the chosen atom (or centroid of the functional group) as the center of a sphere (ball) of radious \(r\), and finds all the atoms from the protein that are within this sphere. For instance, if we are interested in the interactions of the SD from Met181 of the protein human inositol polyphosphate multikinase (PDB ID: 6R7F), then we may procedure:

kable(ball(pdb = '6e7f', chain = 'A', res = 181, r = 4.5)) 

It should be noted that all atoms belonging to the central residue, in this case Met181, are excluded in the returned dataframe. Also, keep in mind that if we select a central residue that doesn’t belong to the set {Met, Cys, Ser, Thr, Glu, Asp, His, Arg, Lys, Phe, Tyr, Trp}, the function will return an error message.