Documentation 
Superpose 3D structures of two proteins
pdbsuperpose(PDB1, PDB2)
Dist = pdbsuperpose(PDB1, PDB2)
[Dist, RMSD]
= pdbsuperpose(PDB1, PDB2)
[Dist, RMSD, Transf]
= pdbsuperpose(PDB1, PDB2)
[Dist, RMSD, Transf, PBD2TX]
= pdbsuperpose(PDB1, PDB2)
... = pdbsuperpose(...,
'ModelNum', ModelNumValue, ...)
... = pdbsuperpose(...,
'Scale', ScaleValue, ...)
... = pdbsuperpose(...,
'Translate', TranslateValue, ...)
... = pdbsuperpose(...,
'Reflection', ReflectionValue, ...)
... = pdbsuperpose(...,
'SeqAlign', SeqAlignValue, ...)
... = pdbsuperpose(...,
'Segment', SegmentValue, ...)
... = pdbsuperpose(...,
'Apply', ApplyValue, ...)
... = pdbsuperpose(...,
'Display', DisplayValue, ...)
PDB1, PDB2  Protein structures represented by any of the following:

ModelNumValue  Twoelement numeric array whose elements correspond to models in PDB1 and PDB2 respectively when PDB1 or PDB2 contains multiple models. It specifies the models to consider in the superposition. By default, the first model in each structure is considered. 
ScaleValue  Specifies whether to include a scaling component in the linear transformation. Choices are true or false (default). 
TranslateValue  Specifies whether to include a translation component in the linear transformation. Choices are true (default) or false. 
ReflectionValue  Specifies whether to include a reflection component in the linear transformation. Choices are:

SeqAlignValue  Specifies whether to perform a local sequence alignment and then use only the portions of the structures corresponding to the segments that align to compute the linear transformation. Choices are true (default) or false. 
SegmentValue  Specifies the boundaries and the chain of two subsequences to consider for computing the linear transformation. SegmentValue is a cell array of strings with the following format: {'start1stop1:chain1', 'start2stop2:chain2'} You can omit the boundaries to indicate the entire chain, such as in {'chain1', 'start2stop2:chain2'}. You can specify only one pair of segments at any given time, and the specified segments are assumed to contain the same number of alpha carbon atoms. 
ApplyValue  Specifies the extent to which the linear transformation should be applied. Choices are:

DisplayValue  Specifies whether to display the original PDB1 structure and the resulting transformed PDB2TX structure in the Molecule Viewer window using the molviewer function. Each structure is represented as a separate model. Choices are true (default) or false. 
Dist  Value representing a dissimilarity measure given by the sum of the squared errors between PDB1 and PDB2. For more information, see procrustes in the Statistics Toolbox™ documentation.  
RMSD  Scalar representing the root mean square distance between the coordinates of the PDB1 structure and the transformed PDB2 structure, considering only the atoms used to compute the linear transformation.  
Transf  Linear transformation computed to superpose the chain of PDB2 to the chain of PDB1. Transf is a MATLAB structure with the following fields:
 
PDB2TX  PDBformatted MATLAB structure that represents the coordinates in the transformed PDB2 protein structure. 
pdbsuperpose(PDB1, PDB2) computes and applies a linear transformation to superpose the coordinates of the protein structure represented in PDB2 to the coordinates of the protein structure represented in PDB1. PDB1 and PDB2 are protein structures represented by any of the following:
String specifying a unique identifier for a protein structure record in the PDB database.
Variable containing a PDBformatted MATLAB structure, such as returned by getpdb or pdbread.
String specifying a file name or a path and file name. The referenced file is a PDBformatted file. If you specify only a file name, that file must be on the MATLAB search path or in the MATLAB Current Folder.
Alpha carbon atom coordinates of single chains for each structure are considered to compute the linear transformation (translation, reflection, orthogonal rotation, and scaling). By default, the first chain in each structure is considered to compute the transformation, and the transformation is applied to the entire molecule. By default, the original PDB1 structure and the resulting transformed PDB2 structure are displayed as separate models in the Molecule Viewer window using the molviewer function.
Dist = pdbsuperpose(PDB1, PDB2) returns a dissimilarity measure given by the sum of the squared errors between PDB1 and PDB2. For more information, see procrustes.
[Dist, RMSD] = pdbsuperpose(PDB1, PDB2) also returns RMSD, the root mean square distance between the coordinates of the PDB1 structure and the transformed PDB2 structure, considering only the atoms used to compute the linear transformation.
[Dist, RMSD, Transf] = pdbsuperpose(PDB1, PDB2) also returns Transf, the linear transformation computed to superpose the chain of PDB2 to the chain of PDB1. Transf is a MATLAB structure with the following fields:
T — Orthogonal rotation and reflection component.
b — Scale component.
c — Translation component.
[Dist, RMSD, Transf, PBD2TX] = pdbsuperpose(PDB1, PDB2) also returns PBD2TX, a PDBformatted MATLAB structure that represents the coordinates in the transformed PDB2 protein structure.
... = pdbsuperpose(..., 'PropertyName', PropertyValue, ...) calls pdbsuperpose with optional properties that use property name/property value pairs. You can specify one or more properties in any order. Each PropertyName must be enclosed in single quotation marks and is case insensitive. These property name/property value pairs are as follows:
... = pdbsuperpose(...,
'ModelNum', ModelNumValue, ...) specifies
the models to consider in the superposition when PDB1 or PDB2 contains
multiple models. ModelNumValue is a twoelement
numeric array whose elements correspond to the models in PDB1 and PDB2 respectively.
By default, the first model in each structure is considered.
... = pdbsuperpose(..., 'Scale', ScaleValue, ...) specifies whether to include a scaling component in the linear transformation. Choices are true or false (default).
... = pdbsuperpose(..., 'Translate', TranslateValue, ...) specifies whether to include a translation component in the linear transformation. Choices are true (default) or false.
... = pdbsuperpose(..., 'Reflection', ReflectionValue, ...) specifies whether to include a reflection component in the linear transformation. Choices are true (include reflection component), false (exclude reflection component), or 'best' (may or may not include the reflection component, depending on the best fit solution). Default is 'best'.
... = pdbsuperpose(..., 'SeqAlign', SeqAlignValue, ...) specifies whether to perform a local sequence alignment and then use only the portions of the structures corresponding to the segments that align to compute the linear transformation. Choices are true (default) or false.
Note: If you set the 'SeqAlign' property to true, you can also specify the following properties used by the swalign function:
For more information on these properties, see swalign. 
... = pdbsuperpose(..., 'Segment', SegmentValue, ...) specifies the boundaries and the chain of two subsequences to consider for computing the linear transformation. SegmentValue is a cell array of strings with the following format: {'start1stop1:chain1', 'start2stop2:chain2'}. You can omit the boundaries to indicate the entire chain, such as in {'chain1', 'start2stop2:chain2'}. You can specify only one pair of segments at any given time, and the specified segments are assumed to contain the same number of alpha carbon atoms.
... = pdbsuperpose(..., 'Apply', ApplyValue, ...) specifies the extent to which the linear transformation should be applied. Choices are 'all' (apply the linear transformation to the entire PDB2 structure), 'chain' (apply the linear transformation to the specified chain only), or 'segment' (apply the linear transformation to the specified segment only). Default is 'all'.
... = pdbsuperpose(..., 'Display', DisplayValue, ...) specifies whether to display the original PDB1 structure and the resulting transformed PDB2TX structure in the Molecule Viewer window using the molviewer function. Each structure is represented as a separate model. Choices are true (default) or false.
Superposing Two Hemoglobin Structures
Use the getpdb function to retrieve protein structure data from the Protein Data Bank (PDB) database for two hemoglobin structures.
str1 = getpdb('1dke'); str2 = getpdb('4hhb');
Superpose the first model of the two hemoglobin structures, applying the transformation to the entire molecule.
d = pdbsuperpose(str1, str2, 'model', [1 1], 'apply', 'all');
Superpose the two hemoglobin structures (each containing four chains), computing and applying the linear transformation chain by chain. Do not display the structures.
strtx = str2; chainList1 = {str1.Sequence.ChainID}; chainList2 = {str2.Sequence.ChainID}; for i = 1:4 [d(i), rmsd(i), tr(i), strtx] = pdbsuperpose(str1, strtx, ... 'segment', {chainList1{i}; chainList2{i}}, ... 'apply', 'chain', 'display', false); end
Superposing Two Chains of a Thioredoxin Structure
Superpose chain B on chain A of a thioredoxin structure (PDBID = 2trx), and then apply the transformation only to chain B.
[d, rmsd, tr] = pdbsuperpose('2trx', '2trx', 'segment', {'A', 'B'}, ... 'apply', 'chain') d = 0.0028 rmsd = 0.6604 tr = T: [3x3 double] b: 1 c: [109x3 double]
Superposing Two Calmodulin Structures
Superpose two calmodulin structures according to the linear transformation obtained using two 20 residuelong segments.
pdbsuperpose('1a29', '1cll', 'segment', {'1030:A', '1030:A'}) ans = 0.1945
getpdb  molviewer  pdbread  pdbtransform  procrustes  swalign