org.proteinshader.structure.visitor
Class FrenetFrameGeneratorVisitor

java.lang.Object
  extended by org.proteinshader.structure.visitor.Visitor
      extended by org.proteinshader.structure.visitor.FrenetFrameGeneratorVisitor

public class FrenetFrameGeneratorVisitor
extends Visitor

Calculates a discrete Frenet frame for each AminoAcid visited.

In order to represent amino acids as segments of a tube or ribbon in a "cartoon" like drawing, it is necessary to have a local coordinate frame for each alpha-carbon (the alpha-carbon will be considered as the center of a Segment object). This class will traverse the AminoAcids of each Chain and calculate a discrete Frenet frame to assign to each AminoAcid. The Frenet frame will be calculated as three column vectors: the normal, the binormal, and the tangent. There three column vectors form the rotation matix [N B T], which will be converted to a Quaterion object that will be given to the setRotation() method of each AminoAcid.

ALGORITHM:

The discrete Frenet frame for alpha-carbon(i) will be calculated based on the triangle formed by the vertices alpha-carbon(i) and the previous and next alpha-carbons, alpha-carbon(i-1) and alpha-carbon(i+1), respectively. In the equations below, CA is the symbol for an alpha-carbon.

T = tangent vector = CA(i+1) - CA(i-1)
V = non-tangent vector = CA(i) - CA(i-1)
B = binormal vector = V x T, where 'x' means the crossproduct
N = normal vector = B x T, where 'x' means the crossproduct


The matrix [N B T] forms a right-handed coordinate system (and OpenGL uses a right-handed coordinate system).

At the beginning of the Chain, there is no CA(i-1), so...


Field Summary
static double MAX_CA_DISTANCE
          The maximum distance from one alpha-carbon to the next alpha-carbon in a chain of amino acids should not be greater than 4.5 angstroms.
 
Constructor Summary
FrenetFrameGeneratorVisitor()
          Constructs a FrenetFrameGeneratorVisitor.
 
Method Summary
 void calculateRotation(AminoAcid prev, AminoAcid cur, AminoAcid next)
          Calculates the equivalent of a discrete Frenet frame (a rotation matrix [N B T]) and uses it to set the rotation attribute of the current AminoAcid.
 Quaternion calculateRotation(Atom atom1, Atom atom2, Atom atom3)
          Calculates a rotation matrix [N B T] based on the xyz-centers of the three Atoms given as arguments, and then converts the rotation matrix into a Quaternion that is returned.
 void visit(AminoAcid aminoAcid)
          The AminoAcid being visited is considered as CA(i+1), while the last two AminoAcids are considered to be CA(i) and CA(i-1).
 void visit(Chain chain)
          All AminoAcids of the Chain will be visited.
 
Methods inherited from class org.proteinshader.structure.visitor.Visitor
clear, includeAAHetAndWater, setDebug, setMode, setMode, setMode, setMode, setMode, setMode, setVisitSegments, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CA_DISTANCE

public static final double MAX_CA_DISTANCE
The maximum distance from one alpha-carbon to the next alpha-carbon in a chain of amino acids should not be greater than 4.5 angstroms. The three bonds (CA-C, C-N, and N-CA) are each approximately 1.5 angstroms. Therefore, the distance from CA to CA must be shorter than 4.5 angstroms when bond angles are taken into account (these three bonds cannot form a straight line).

See Also:
Constant Field Values
Constructor Detail

FrenetFrameGeneratorVisitor

public FrenetFrameGeneratorVisitor()
Constructs a FrenetFrameGeneratorVisitor.

This Visitor is programmed to visit all Chains of a Structure and all AminoAcids of each Chain.

Method Detail

visit

public void visit(Chain chain)
           throws VisitorException
All AminoAcids of the Chain will be visited.

Overrides:
visit in class Visitor
Parameters:
chain - the Chain to generate Loops for.
Throws:
VisitorException - if an error occurs while visiting.

visit

public void visit(AminoAcid aminoAcid)
           throws VisitorException
The AminoAcid being visited is considered as CA(i+1), while the last two AminoAcids are considered to be CA(i) and CA(i-1).

Overrides:
visit in class Visitor
Parameters:
aminoAcid - the next AminoAcid in the Chain.
Throws:
VisitorException - if an error occurs while visiting.

calculateRotation

public void calculateRotation(AminoAcid prev,
                              AminoAcid cur,
                              AminoAcid next)
Calculates the equivalent of a discrete Frenet frame (a rotation matrix [N B T]) and uses it to set the rotation attribute of the current AminoAcid.

The alph-carbons of the previous, current, and next AminoAcids will be used if possible. If the previous or next alpha-carbon does not exist (or is too far away for a peptide bond), then the nitrogen or carbonyl-carbon of the current AminoAcid will be used instead, respectively.

The rotation is stored as a Quaternion rather than as a rotation matrix.

Parameters:
prev - alpha-carbon(i-1)
cur - alpha-carbon(i)
next - alpha-carbon(i+1)

calculateRotation

public Quaternion calculateRotation(Atom atom1,
                                    Atom atom2,
                                    Atom atom3)
Calculates a rotation matrix [N B T] based on the xyz-centers of the three Atoms given as arguments, and then converts the rotation matrix into a Quaternion that is returned.

The three Atoms can be thought of as forming a triangle. If the three Atoms are alpha-carbons from consecutive AminoAcids, they should be atom1 = alpha-carbon(i-1), atom2 = alpha-carbon(i), and atom1 = alpha-carbon(i+1).

If alpha-carbon(i-1) does not exist, then the nitrogen attached to alpha-carbon(i) can be used. If alpha-carbon(i+1) does not exist, then the carbonyl-carbon attached to alpha-carbon(i) can be used.

The column vectors {N, B, T} are the equivalent of a Frenet frame and are calculated as follows:

T = tangent vector = atom3 - atom1
V = non-tangent vector = atom2 - atom1
B = binormal vector = V x T, where 'x' means the crossproduct
N = normal vector = B x T, where 'x' means the crossproduct


The matrix [N B T] forms a right-handed coordinate system (OpenGL uses a right-handed coordinate system).

If any of the Atoms given as arguments are null, then a rotation cannot be calculated, so this method will return null.

Parameters:
atom1 - the first Atom in a triangle is CA(i-1) or N(i).
atom2 - the second Atom in a triangle is always CA(i).
atom3 - the third Atom in a triangle is CA(i+1) or C(i).
Returns:
A rotation equivalent to the matrix [N B T].


Copyright © 2007-2008