org.proteinshader.structure
Class AminoAcid

java.lang.Object
  extended by org.proteinshader.structure.Residue
      extended by org.proteinshader.structure.AminoAcid
All Implemented Interfaces:
IDTest, Visitable

public class AminoAcid
extends Residue

This concrete subclass of the abstract class Residue stores information on an amino acid in a PDB structure entry.

An AminoAcid object has three caches (LinkedHashMaps) for atoms. A cache that all Atoms are placed in, a cache for backbone Atoms (N, CA, and C only), and a cache for side chain Atoms. Side chain Atoms are identified by process of elimination. If an Atom is not a backbone Atom, a main chain oxygen, or a main chain hydrogen, then it is included in the side chain cache. Hydrogen Atoms are tested by both the newer (V3) and older (V2 and earlier) nomenclatures.

Backbone atoms: N, CA, C

Main chain oxygen: O or OXT

Terminal amino hydrogen:
Names (V3): H1, H2, H3
Names (V2): 1H, 2H, 3H

Non-terminal amino hydrogen:
Names (V3): H, H2
Names (V2): H, HN2
Names (older): HN

Alpha-carbon hydrogen:
Name (V3 and V2): HA
Glycine (V3): HA2
Glycine (V2): 1HA

Note that HA3 (V3 nomenclature) and 2HA (older nomenclature) are considered to be the glycine side chain (rather than part of the main chain).

Terminal OXT hydrogen:
Name (V3 and older): HXT


Constructor Summary
AminoAcid(AminoAcidEnum type, String residueID, String chainID, String modelID, String structureID)
          Constructs an AminoAcid with the type and IDs given as arguments.
 
Method Summary
 void accept(Visitor visitor)
          Accepts a Visitor and does a callback.
 Atom addNewAtom(int serialNo, AtomEnum type, String atomID, double temperature, int charge, double occupancy, String altLocation, double x, double y, double z, VisibilityEnum visibility)
          Creates a new Atom with the type and Atom ID given as arguments, adds the Atom to the Residue's collection of Atoms, and returns a reference to the new Atom.
 Atom getC()
          Returns the carbon Atom of the carbonyl group if it exists.
 Atom getCA()
          Returns the alpha carbon Atom if it exists.
 Point3d getCenter()
          Returns a new Point3d object based on the xyz-coordinates of the alpha-carbon.
 Atom getHAor1HA()
          Returns the hydrogen Atom on the alpha carbon if it exists.
 Atom getHorHN()
          Returns the hydrogen Atom on the nitrogen of the amino group.
 Atom getN()
          Returns the nitrogen Atom of the amino group if it exists.
 Atom getO()
          Returns the oxygen Atom of the carbonyl group if it exists.
 Atom getOXT()
          Returns the Chain terminating oxygen if it exists.
 String getRegionID()
          Returns the regionID if the AminoAcid has been assigned to a Region.
 RegionEnum getRegionType()
          Returns the region type (LOOP, HELIX, or BETA_STRAND) if the AminoAcid has been assigned to a Region.
 Quaternion getRotation()
          Returns the rotation (the equivalent of a Frenet Frame) that will be needed for creating a Segment object based on this AminoAcid.
 Vec3d getTranslation()
          Returns a new Ved3d object based on the xyz-coordinates of the alpha-carbon.
 AminoAcidEnum getType()
          Returns the type of amino aicd: ALA, ARG, ASN, etc. The type cannot be null because it is checked by the constructor.
 Iterator<Atom> iteratorBackboneAtoms()
          Returns an Iterator for the backbone Atoms held by this Residue.
 Iterator<Atom> iteratorSideChainAtoms()
          Returns an Iterator for the side chain Atoms held by this Residue.
 int numberOfBackboneAtoms()
          Returns the number of Atoms in the backbone (three if no atoms are missing in the structure).
 int numberOfSideChainAtoms()
          Returns the number of Atoms in the side chain.
 void setRegionIDAndType(String regionID, RegionEnum regionType)
          Sets the regionID and the Region type.
 void setRotation(double x, double y, double z, double w)
          Sets the rotation (the equivalent of a Frenet Frame) that will be needed for creating a Segment object based on this AminoAcid.
 void setRotation(Quaternion rotation)
          Sets the rotation (the equivalent of a Frenet Frame) that will be needed for creating a Segment object based on this AminoAcid.
 
Methods inherited from class org.proteinshader.structure.Residue
getAtom, getChainID, getModelID, getResidueID, getStructureID, iteratorAtoms, numberOfAtoms, processID, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AminoAcid

public AminoAcid(AminoAcidEnum type,
                 String residueID,
                 String chainID,
                 String modelID,
                 String structureID)
          throws MissingAATypeException,
                 InvalidIDException
Constructs an AminoAcid with the type and IDs given as arguments. The residueID for an AminoAcid is typically in a form such as "ALA 5" or "ALA 5 B" where "5" is the residue sequence number and "B" is an insertion code.

Parameters:
type - the type of amino acid as an AminoAcidEnum.
residueID - the ID of the AminoAcid.
chainID - the ID of the Chain.
modelID - the ID of the Model.
structureID - the ID of the Structure.
Throws:
MissingAATypeException - if type is null.
InvalidIDException - if residueID is null or does not have at least one non-whitespace character.
Method Detail

accept

public void accept(Visitor visitor)
            throws VisitorException
Accepts a Visitor and does a callback.

Specified by:
accept in interface Visitable
Specified by:
accept in class Residue
Parameters:
visitor - the Visitor to do a callback with.
Throws:
VisitorException - if an error occurs while an object is being visited.

getType

public AminoAcidEnum getType()
Returns the type of amino aicd: ALA, ARG, ASN, etc. The type cannot be null because it is checked by the constructor.

Returns:
The type as an AminoAcidEnum.

addNewAtom

public Atom addNewAtom(int serialNo,
                       AtomEnum type,
                       String atomID,
                       double temperature,
                       int charge,
                       double occupancy,
                       String altLocation,
                       double x,
                       double y,
                       double z,
                       VisibilityEnum visibility)
                throws MissingAtomTypeException,
                       InvalidIDException
Creates a new Atom with the type and Atom ID given as arguments, adds the Atom to the Residue's collection of Atoms, and returns a reference to the new Atom.

This method overrides addNewAtom() of Residue so that an AminoAcid can cache references to backbone and side chain Atoms for iteration purposes. Backbone Atoms have an atomID of "N", "CA", and "C". All other Atoms are considered side chain (except the "OXT" terminal oxygen and the "HA" or "1HA" hydrogen on the alpha carbon).

The Atom type (an AtomEnum) will be used to set a default radius and CPK color. The new Atom will be stamped with the structureID, modelID, chainID, and residueID of the Residue.

Overrides:
addNewAtom in class Residue
Parameters:
serialNo - the Atom serial number.
type - the Atom type as an AtomEnum.
atomID - the ID of the Atom.
temperature - the x-ray crystallography temperature factor.
charge - optional measure of an atom's electric charge.
occupancy - less than 1 if atom has more than one location.
altLocation - alternate location if occupancy less than 1.
x - coordinate of the Drawable's center.
y - coordinate of the Drawable's center.
z - coordinate of the Drawable's center.
visibility - visibility status (OPAQUE, TRANSLUCENT, or INVISIBLE).
Returns:
The newly created Atom.
Throws:
MissingAtomTypeException - if type is null.
InvalidIDException - if atomID is null or does not have at least one non-whitespace character.

getN

public Atom getN()
Returns the nitrogen Atom of the amino group if it exists. Otherwise, returns null.

Returns:
The nitrogen Atom of the amino group.

getCA

public Atom getCA()
Returns the alpha carbon Atom if it exists. Otherwise, returns null.

Returns:
The alpha carbon Atom.

getC

public Atom getC()
Returns the carbon Atom of the carbonyl group if it exists. Otherwise, returns null.

Returns:
The carbon Atom of the carbonyl group.

getO

public Atom getO()
Returns the oxygen Atom of the carbonyl group if it exists. Otherwise, returns null.

Returns:
The oxygen Atom of the carbonyl group.

getHAor1HA

public Atom getHAor1HA()
Returns the hydrogen Atom on the alpha carbon if it exists. Otherwise, returns null. The PDB nomenclature of 'HA' will be looked for first, but if that is not found the alternate nomenclature of '1HA' will be looked for.

Returns:
The hydrogen Atom of the alpha carbon.

getHorHN

public Atom getHorHN()
Returns the hydrogen Atom on the nitrogen of the amino group. Otherwise, returns null. The PDB nomenclature of 'H' will be looked for first, but if that is not found the alternate nomenclature of 'HN' will be looked for.

Returns:
The hydrogen Atom of the amino group.

getOXT

public Atom getOXT()
Returns the Chain terminating oxygen if it exists. Otherwise, returns null.

Returns:
The "OXT" oxygen.

getRegionID

public String getRegionID()
Returns the regionID if the AminoAcid has been assigned to a Region. Otherwise, returns null.

Returns:
The regionID as a String.

getRegionType

public RegionEnum getRegionType()
Returns the region type (LOOP, HELIX, or BETA_STRAND) if the AminoAcid has been assigned to a Region. Otherwise, returns null.

Returns:
The region type as a RegionEnum.

setRegionIDAndType

public void setRegionIDAndType(String regionID,
                               RegionEnum regionType)
Sets the regionID and the Region type.

Parameters:
regionID - will be a loopID, helixID, or a betaStrandID.
regionType - will be LOOP, HELIX, or BETA_STRAND.

iteratorBackboneAtoms

public Iterator<Atom> iteratorBackboneAtoms()
Returns an Iterator for the backbone Atoms held by this Residue. An Atom in the backbone will have an atomID of "N", "CA", or "C". The order of iteration is the same as the order in which Atoms were added to the Residue. In the rare case where an Atom was replaced (by adding an Atom with the same atomID), the replacement would not change the iteration order in any way.

Returns:
An Iterator for the backbone Atoms held by this Residue.

iteratorSideChainAtoms

public Iterator<Atom> iteratorSideChainAtoms()
Returns an Iterator for the side chain Atoms held by this Residue. The order of iteration is the same as the order in which Atoms were added to the Residue. In the rare case where an Atom was replaced (by adding an Atom with the same atomID), the replacement would not change the iteration order in any way.

Returns:
An Iterator for the side chain Atoms held by this Residue.

numberOfBackboneAtoms

public int numberOfBackboneAtoms()
Returns the number of Atoms in the backbone (three if no atoms are missing in the structure).

Returns:
The total number of Atoms in the backbone.

numberOfSideChainAtoms

public int numberOfSideChainAtoms()
Returns the number of Atoms in the side chain.

Returns:
The total number of Atoms in the side chain.

getCenter

public Point3d getCenter()
Returns a new Point3d object based on the xyz-coordinates of the alpha-carbon. If there is no alpha-cabon, null is returned.

Returns:
The xyz-center as a Point3d.

getTranslation

public Vec3d getTranslation()
Returns a new Ved3d object based on the xyz-coordinates of the alpha-carbon. If there is no alpha-cabon, null is returned.

Returns:
The xyz-center as a Vec3d (with its tail at the origin).

getRotation

public Quaternion getRotation()
Returns the rotation (the equivalent of a Frenet Frame) that will be needed for creating a Segment object based on this AminoAcid.

Returns:
The rotation as a Quaternion.

setRotation

public void setRotation(Quaternion rotation)
Sets the rotation (the equivalent of a Frenet Frame) that will be needed for creating a Segment object based on this AminoAcid.

A reference to the Quaternion given as an object is kept.

Parameters:
rotation - the rotation as a Quaternion.

setRotation

public void setRotation(double x,
                        double y,
                        double z,
                        double w)
Sets the rotation (the equivalent of a Frenet Frame) that will be needed for creating a Segment object based on this AminoAcid.

The values given as arguments will be used to create a Quaternion.

Parameters:
x - the x-value of the Quaternion.
y - the y-value of the Quaternion.
z - the z-value of the Quaternion.
w - the w-value of the Quaternion.


Copyright © 2007-2008