org.proteinshader.structure.factory
Class SegmentFactory

java.lang.Object
  extended by org.proteinshader.structure.factory.SegmentFactory
Direct Known Subclasses:
BetaStrandSegmentFactory

public class SegmentFactory
extends Object

Creates Segment objects for a Region (Loop, Helix, or BetaStrand).

A Segment object can be thought of as a segment of a tube-like structure used to create a cartoon-like representation of a protein. A Segment object is ultimately a collection of local frame objects that will be needed for sweeping a waist polygon along a spline in order to draw the tube-like structure. A figure illustrating this approach can be found on page 316 of "Computer Graphics Using OpenGL", F.S. Hill (2000), Upper Saddle River, NJ. Prentice Hall.

A Segment object corresponds to an individual AminoAcid. and will be marked with the same ID as that AminoAcid. A Segment object will also have the same xyz-center as the AminoAcid it represents.

To calculate the LocalFrame objects needed by a Segment, it will be necessary to have information on not only the AminoAcid the Segment represents, but also to have information on the previous and next AminoAcids in the Chain (if they exist). For this reason, the createSegments() method of this class will iterate() through the AminoAcids of a Region so that three AminoAcids at a time (previous, current, and next) can be plugged into a helper method that will create the Segment.

There may be some case where a Segment object cannot be created because some Atoms belonging to an AminoAcid are simply missing from the PDB structure file. If this type of error occurs, then a SegmentException object with the error information will be added to a list. After the createSegments() method has been called (and created all the Segments that it can), a public getErrors() method can be used to get any SegmentExceptions that occurred (if no errors occurred then the list will be empty).


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.
static double SEGMENT_LENGTH
          If an AminoAcid does not have an adjacent AminoAcid before or after it, then the Segment representing the AminoAcid will have it length determined by this constant, which currently is set at 2.6 angstroms in length.
 
Constructor Summary
SegmentFactory()
          No-arg constructor, which will be called automatically by concrete subclasses.
 
Method Summary
 LinkedHashMap<String,Segment> createSegments(Region region)
          Creates the Segment objects for a Region.
 List<SegmentException> getErrors()
          Returns a list with any SegmentExceptions that were created because an error prevented a Segment from being created.
 
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

SEGMENT_LENGTH

public static final double SEGMENT_LENGTH
If an AminoAcid does not have an adjacent AminoAcid before or after it, then the Segment representing the AminoAcid will have it length determined by this constant, which currently is set at 2.6 angstroms in length.

See Also:
Constant Field Values
Constructor Detail

SegmentFactory

public SegmentFactory()
No-arg constructor, which will be called automatically by concrete subclasses.

Method Detail

createSegments

public LinkedHashMap<String,Segment> createSegments(Region region)
Creates the Segment objects for a Region. The number of Segment objects created should be equal to the number of AminoAcids in the Region.

Parameters:
region - the Region object to create Segments for.
Returns:
A hash with the Segment objects.

getErrors

public List<SegmentException> getErrors()
Returns a list with any SegmentExceptions that were created because an error prevented a Segment from being created.

For example, if an AminoAcid was missing an Atom needed for calculations (which can happen in an X-ray crystollagraphy generated model), then the corresponding Segment could not be created and a SegmentException would be thrown. The SegmentException is saved to the error list and the createSegments() method will continue creating as many Segments as it can.

The factory does not retain a memory of the list after this method has been called.

Returns:
A list of exeception objects.


Copyright © 2007-2008