Root Mean Square Deviation

Usage

rmsd(a, b=NULL, a.inds=NULL, b.inds=NULL, fit=FALSE, ncore=1, nseg.scale=1)

Arguments

a
a numeric vector containing the reference coordinate set for comparison with the coordinates in b. Alternatively, if b=NULL then a can be a matrix or list object containing multiple coordinates for pairwise comparison.
b
a numeric vector, matrix or list object with an xyz component, containing one or more coordinate sets to be compared with a.
a.inds
a vector of indices that selects the elements of a upon which the calculation should be based.
b.inds
a vector of indices that selects the elements of b upon which the calculation should be based.
fit
logical, if TRUE coordinate superposition is performed prior to RMSD calculation.
ncore
number of CPU cores used to do the calculation. ncore>1 requires package ‘parallel’ installed.
nseg.scale
split input data into specified number of segments prior to running multiple core calculation. See fit.xyz.

Description

Calculate the RMSD between coordinate sets.

Details

RMSD is a standard measure of structural distance between coordinate sets.

Structure a[a.inds] and b[b.inds] should have the same length.

A least-squares fit is performed prior to RMSD calculation by setting fit=TRUE. See the function fit.xyz for more details of the fitting process.

Value

Returns a numeric vector of RMSD value(s).

References

Grant, B.J. et al. (2006) Bioinformatics 22, 2695--2696.

Examples

# Redundant testing excluded # -- Calculate RMSD between two or more structures aln <- read.fasta(system.file("examples/kif1a.fa",package="bio3d")) pdbs <- read.fasta.pdb(aln)
pdb/seq: 1 name: http://www.rcsb.org/pdb/files/1bg2.pdb pdb/seq: 2 name: http://www.rcsb.org/pdb/files/1i6i.pdb PDB has ALT records, taking A only, rm.alt=TRUE pdb/seq: 3 name: http://www.rcsb.org/pdb/files/1i5s.pdb PDB has ALT records, taking A only, rm.alt=TRUE pdb/seq: 4 name: http://www.rcsb.org/pdb/files/2ncd.pdb
# Gap positions inds <- gap.inspect(pdbs$xyz) # Superposition before pairwise RMSD rmsd(pdbs$xyz, fit=TRUE)
Warning message: No indices provided, using the 293 non NA positions
[,1] [,2] [,3] [,4] [1,] 0.000 2.654 2.412 2.775 [2,] 2.654 0.000 2.202 3.063 [3,] 2.412 2.202 0.000 2.904 [4,] 2.775 3.063 2.904 0.000
# RMSD between structure 1 and structures 2 and 3 rmsd(a=pdbs$xyz[1,], b=pdbs$xyz[2:3,], a.inds=inds$f.inds, b.inds=inds$f.inds, fit=TRUE)
http://www.rcsb.org/pdb/files/1i6i.pdb http://www.rcsb.org/pdb/files/1i5s.pdb 2.654 2.412
# RMSD between structure 1 and all structures in alignment rmsd(a=pdbs$xyz[1,], b=pdbs, a.inds=inds$f.inds, b.inds=inds$f.inds, fit=TRUE)
http://www.rcsb.org/pdb/files/1bg2.pdb http://www.rcsb.org/pdb/files/1i6i.pdb 0.000 2.654 http://www.rcsb.org/pdb/files/1i5s.pdb http://www.rcsb.org/pdb/files/2ncd.pdb 2.412 2.775
# RMSD without superposition rmsd(pdbs$xyz)
Warning message: No indices provided, using the 293 non NA positions
[,1] [,2] [,3] [,4] [1,] 0.000 48.901 48.533 63.343 [2,] 48.901 0.000 58.171 53.186 [3,] 48.533 58.171 0.000 88.198 [4,] 63.343 53.186 88.198 0.000

See also

fit.xyz, rot.lsq, read.pdb, read.fasta.pdb

Author

Barry Grant