com(...)"com"(pdb, inds=NULL, use.mass=TRUE, ...)"com"(xyz, mass=NULL, ...)
pdb
as obtained from
function read.pdb
. atom.select
that selects the elements of pdb
upon which the calculation
should be based.atom2mass
. xyz
). xyz
. Calculate the center of mass of a PDB object.
This function calculates the center of mass of the provided PDB structure / Cartesian coordiantes. Atom names found in standard amino acids in the PDB are mapped to atom elements and their corresponding relative atomic masses.
In the case of an unknown atom name elety.custom
and
mass.custom
can be used to map an atom to the correct
atomic mass. See examples for more details.
Alternatively, the atom name will be mapped automatically to the
element corresponding to the first character of the atom name. Atom
names starting with character H
will be mapped to hydrogen
atoms.
Grant, B.J. et al. (2006) Bioinformatics 22, 2695--2696.
# PDB server connection required - testing excluded ## Stucture of PKA: pdb <- read.pdb("3dnd")Note: Accessing on-line PDB file PDB has ALT records, taking A only, rm.alt=TRUE## Center of mass: com(pdb)Warning message: unknown element: mapped O1P to O unknown element: mapped O2P to O unknown element: mapped O3P to O unknown element: mapped O1P to O unknown element: mapped O2P to O unknown element: mapped O3P to O unknown element: mapped C8 to C unknown element: mapped C11 to C unknown element: mapped C13 to C unknown element: mapped C12 to C unknown element: mapped C9 to C unknown element: mapped C5 to C unknown element: mapped C2 to C unknown element: mapped C1 to C unknown element: mapped S4 to S unknown element: mapped C3 to C unknown element: mapped N6 to N unknown element: mapped C7 to C unknown element: mapped N10 to Nx y z [1,] 9.760781 2.455901 -2.076182## Center of mass of a selection inds <- atom.select(pdb, chain="I") com(pdb, inds)x y z [1,] 22.72468 -0.6884178 8.571269## using XYZ Cartesian coordinates xyz <- pdb$xyz[, inds$xyz] com.xyz(xyz)x y z [1,] 22.68164 -0.7530328 8.586634## with mass weighting com.xyz(xyz, mass=atom2mass(pdb$atom[inds$atom, "elety"]) )x y z [1,] 22.72468 -0.6884178 8.571269## Unknown atom names pdb <- read.pdb("3dnd")Note: Accessing on-line PDB fileWarning message: /tmp/RtmpTDihxb/3dnd.pdb exists. Skipping downloadPDB has ALT records, taking A only, rm.alt=TRUEinds <- atom.select(pdb, resid="LL2") mycom <- com(pdb, inds, rescue=TRUE)Warning message: unknown element: mapped C8 to C unknown element: mapped C11 to C unknown element: mapped C13 to C unknown element: mapped C12 to C unknown element: mapped C9 to C unknown element: mapped C5 to C unknown element: mapped C2 to C unknown element: mapped C1 to C unknown element: mapped S4 to S unknown element: mapped C3 to C unknown element: mapped N6 to N unknown element: mapped C7 to C unknown element: mapped N10 to N#warnings() ## Map atom names manually pdb <- read.pdb("3RE0")Note: Accessing on-line PDB file PDB has ALT records, taking A only, rm.alt=TRUEinds <- atom.select(pdb, resno=201) myelety <- data.frame(name = c("CL2","PT1","N1","N2"), symb = c("Cl","Pt","N","N")) mymasses <- data.frame(symb = c("Cl","Pt"), mass = c(35.45, 195.08)) mycom <- com(pdb, inds, elety.custom=myelety, mass.custom=mymasses)