|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.proteinshader.structure.Structure
public class Structure
Structure is the top-level container for objects that store
information on a protein structure from the
Protein Data Bank.
The primary data structure can be described as follows:
Structure - holds at least one Model.
Model - holds at least one Chain.
Chain - holds at least one Residue.
Residue - holds at least one Atom.
Atom - holds any Bonds where it is the source Atom.
A Structure also holds a single Description object, which holds
Category objects that are used to group together Record objects,
where each Record object holds a list of Strings read from a
PDB file.
A Chain also holds a collection of SecondaryStructure objects, which
are used to represent alpha-helices and beta-strands.
An important design decision is that classes in package structure hold
not only the data from a Protein Data Bank entry, but also hold data
needed purely for display purposes (e.g. atom radius, colors,
textures, and visibility status). The reason for this decision is
that the user is allowed to select almost any object in order to
change how it is displayed, and it seems simpler to bundle all
information on something like an Atom in one place, rather than have
a second display-info data structure that would be almost equal in
size and complexity to a Structure that held only Protein Data Bank
information.
In almost all cases, numeric data from a Protein Data Bank entry is
stored in final instance variables, and, therefore, must be set by the
constructor and can have only getter methods. The changeable data
needed purely for display purposes will of course have setter and
getter methods.
Field Summary | |
---|---|
static int |
SERIAL_NO_CACHE_CAPACITY
Default starting capacity for Atom serial number cache. |
Constructor Summary | |
---|---|
Structure(String structureID)
Constructs a Structure with the requested structureID. |
Method Summary | |
---|---|
void |
accept(Visitor visitor)
Accepts a Visitor and does a callback. |
Atom |
addNewAtom(int atomSerialNo,
AtomEnum atomType,
String atomID,
String aminoAcidType,
String residueID,
String chainID,
String modelID,
double temperature,
int charge,
double occupancy,
String altLocation,
double x,
double y,
double z,
VisibilityEnum visibility)
Creates a new atom with the atomID given as an argument, adds the new Atom to the requested Model-Chain-AminoAcid, and then returns a reference to the new Atom. |
void |
addNewBetaStrand(String chainID,
String betaStrandID,
String betaStrandNumber,
String sheetID,
String startResidueID,
String endResidueID,
int sense,
int strandsInSheet)
The BetaStrand will be added to the equivalent Chain on each Model, but this addition will only work if the sequence of Residues that the BetaStrand refers to have already been added. |
void |
addNewHelix(String chainID,
String helixID,
String serialNo,
String startResidueID,
String endResidueID,
HelixEnum type)
The Helix will be added to the equivalent Chain on each Model, but this addition will only work if the sequence of Residues that the Helix refers to have already been added. |
Atom |
addNewHetAtom(int atomSerialNo,
AtomEnum atomType,
String atomID,
String hetName,
String residueID,
String chainID,
String modelID,
double temperature,
int charge,
double occupancy,
String altLocation,
double x,
double y,
double z,
VisibilityEnum visibility)
Creates a new atom with the atomID given as an argument, adds the new Atom to the requested Model-Chain-(Heterogen or Water), and then returns a reference to the new Atom. |
Model |
addNewModel(String modelID)
Creates a Model, adds it to the Structure, and returns a reference to the new Model. |
void |
calculateBounds()
Sets the min and max values for x, y, and z on each Model held by the Structure. |
void |
calculateFrenetFrames()
Before Regions objects (Helix, BetaStrand, and Loop) are added to the Structure, a rotation (the equivalent to a discrete Frenet Frame) should be calculated for each AminoAcid. |
void |
clearAllBonds()
Clears all Bonds (AminoAcids, Heterogens, and Waters) from the Structure. |
void |
clearAtomSerialNoCache()
Clears the cache that remembers Atom serial numbers and allows them to be used to retrieve an Atom. |
void |
clearBonds(ResidueMode residueMode)
Clears Bonds from the Structure. |
void |
generateLoopRegions()
Generates Loop objects from any AminoAcids that do not already belong to a Helix or BetaStrand object. |
void |
generateStandardBonds()
Generates standard Bonds (AminoAcids and Waters). |
List<String> |
getAminoAcidLabels()
Returns a list of all AminoAcid residueIDs. |
Atom |
getAtom(int atomSerialNo)
Returns the Atom with Atom serial number given as an argument (or null if not found). |
Atom |
getAtom(String atomID,
String residueID,
String chainID,
String modelID)
Returns the Atom with the IDs given as arguments. |
List<Atom> |
getAtomSerialNoCache()
Returns the Atom serial number cache as a list. |
BetaStrand |
getBetaStrand(String betaStrandID,
String modelID)
Returns the BetaStrand with the IDs given as arguments. |
Chain |
getChain(String chainID,
String modelID)
Returns the Chain with the IDs given as arguments. |
Description |
getDescription()
Returns a reference to the Description object owned by this Structure. |
Helix |
getHelix(String helixID,
String modelID)
Returns the Helix with the IDs given as arguments. |
Loop |
getLoop(String loopID,
String modelID)
Returns the Loop with the IDs given as arguments. |
Model |
getModel(String modelID)
Returns the Model with the modelID given as an argument. |
Residue |
getResidue(String residueID,
String chainID,
String modelID)
Returns the Residue with the IDs given as arguments. |
String |
getStructureID()
Returns the structureID, which is the sames as the PDB unique ID code. |
Iterator<Model> |
iteratorModels()
Returns an Iterator for the Models held by this Structure. |
int |
numberOfModels()
Returns the number of Models held by this Structure. |
String |
processID(String id,
String typeOfID)
Returns the ID after trimming any leading or trailing whitespace. |
void |
sortBetaStrands()
Iterates through all Models of the Structure and modifies the linked hash map of beta-strands for each Chain so that when an iterator for beta-strands is handed over (based on the linked list part) the beta-strands will be ordered according to the starting amino acid. |
String |
toString()
Returns the structureID, which is the sames as the PDB unique ID code. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SERIAL_NO_CACHE_CAPACITY
Constructor Detail |
---|
public Structure(String structureID) throws InvalidIDException
structureID
- the unique ID code assigned by the Protein
Data Bank.
InvalidIDException
- if structureID is null or does not
have at least one non-whitespace
character.Method Detail |
---|
public void accept(Visitor visitor) throws VisitorException
accept
in interface Visitable
visitor
- the Visitor to do a callback with.
VisitorException
- if an error occurs while an object is
being visited.public Atom addNewAtom(int atomSerialNo, AtomEnum atomType, String atomID, String aminoAcidType, String residueID, String chainID, String modelID, double temperature, int charge, double occupancy, String altLocation, double x, double y, double z, VisibilityEnum visibility) throws MissingAtomTypeException, MissingAATypeException, InvalidIDException
atomSerialNo
- the atom serial number.atomType
- the Atom type as an AtomEnum.atomID
- the ID of the Atom.aminoAcidType
- the AminoAcid type as a String.residueID
- the ID of the AminoAcid to add the Atom to.chainID
- the ID of the Chain to add the Atom to.modelID
- the ID of the Model to add the Atom to.temperature
- the x-ray crystallography temperature factor.charge
- optional measure of electric charge.occupancy
- less than 1 if atom has more than one location.altLocation
- alternate location if occupancy less than 1.0.x
- x-coordinate of the Drawable's center.y
- y-coordinate of the Drawable's center.z
- z-coordinate of the Drawable's center.visibility
- visibility status (OPAQUE, TRANSLUCENT, or
INVISIBLE).
MissingAtomTypeException
- if atomType is null.
MissingAATypeException
- if aminoAcidType is null or cannot
be converted to an AminoAcidEnum.
InvalidIDException
- if an ID is null or does not have at
least one non-whitespace character.public Atom addNewHetAtom(int atomSerialNo, AtomEnum atomType, String atomID, String hetName, String residueID, String chainID, String modelID, double temperature, int charge, double occupancy, String altLocation, double x, double y, double z, VisibilityEnum visibility) throws MissingAtomTypeException, MissingHetNameException, InvalidIDException
atomSerialNo
- the atom serial number.atomType
- the Atom type as an AtomEnum.atomID
- the ID of the Atom.hetName
- the heterogen name ("HOH" for Water).residueID
- the ID of the Residue to add the Atom to.chainID
- the ID of the Chain to add the Atom to.modelID
- the ID of the Model to add the Atom to.temperature
- the x-ray crystallography temperature factor.charge
- optional measure of electric charge.occupancy
- less than 1 if atom has more than one location.altLocation
- alternate location if occupancy less than 1.0.x
- x-coordinate of the Drawable's center.y
- y-coordinate of the Drawable's center.z
- z-coordinate of the Drawable's center.visibility
- visibility status (OPAQUE, TRANSLUCENT, or
INVISIBLE).
MissingAtomTypeException
- if atomType is null.
MissingHetNameException
- if the heterogen name is null or
does not have at least one
non-whitespace character.
InvalidIDException
- if an ID is null or does not have at
least one non-whitespace character.public Model addNewModel(String modelID) throws InvalidIDException
modelID
- the ID of the Model.
InvalidIDException
- if modelID is null or does not have at
least one non-whitespace character.public void calculateFrenetFrames() throws VisitorException
VisitorException
public void addNewHelix(String chainID, String helixID, String serialNo, String startResidueID, String endResidueID, HelixEnum type) throws InvalidRegionException, InvalidIDException
chainID
- the ID of the Chain to add the Helix to.helixID
- the Helix identifier from a PDB HELIX record.serialNo
- the serial number of the Helix.startResidueID
- ID of the first AminoAcid in the sequence.endResidueID
- ID of the last AminoAcid in the sequence.type
- the type of Helix as a HelixEnum.
InvalidRegionException
- if the sequence of AminoAcids
(with at least two Residues)
cannot be found on the Chain.
InvalidIDException
- if the helixID, serialNo,
startResidueID, or endResidueID is null
or does not have at least one
non-whitespace character.public void addNewBetaStrand(String chainID, String betaStrandID, String betaStrandNumber, String sheetID, String startResidueID, String endResidueID, int sense, int strandsInSheet) throws InvalidRegionException, InvalidIDException
chainID
- ID of the Chain to add the BetaStrand to.betaStrandID
- unique ID (strand number plus sheet ID).betaStrandNumber
- Strand number from a PDB SHEET record.sheetID
- sheet identifier from a PDB SHEET recordstartResidueID
- ID of the first AminoAcid in the sequence.endResidueID
- ID of the last AminoAcid in the sequence.sense
- strand sense (0, 1, or -1).strandsInSheet
- total number of BetaStrands in the sheet.
InvalidRegionException
- if the sequence of AminoAcids
(with at least two Residues)
cannot be found on the Chain.
InvalidIDException
- if the betaStrandID, sheetID,
startResidueID, or endResidueID is
null or does not have at least one
non-whitespace character.public void sortBetaStrands()
public void calculateBounds() throws VisitorException
VisitorException
- if a Model has no Atoms.public String getStructureID()
public Description getDescription()
public Atom getAtom(String atomID, String residueID, String chainID, String modelID)
atomID
- the ID of the Atom.residueID
- the ID of the Residue the Atom belongs to.chainID
- the ID of the Chain the Atom belongs to.modelID
- the ID of the Model the Atom belongs to.
public Atom getAtom(int atomSerialNo)
atomSerialNo
- the atom serial number.
public Residue getResidue(String residueID, String chainID, String modelID)
residueID
- the ID of the Residue.chainID
- the ID of the Chain the Atom belongs to.modelID
- the ID of the Model the Atom belongs to.
public Helix getHelix(String helixID, String modelID)
helixID
- the ID of the Helix.modelID
- the ID of the Model the Helix belongs to.
public BetaStrand getBetaStrand(String betaStrandID, String modelID)
betaStrandID
- the ID of the BetaStrand.modelID
- the ID of the Model the BetaStrand belongs to.
public Loop getLoop(String loopID, String modelID)
loopID
- the ID of the Loop.modelID
- the ID of the Model the Loop belongs to.
public Chain getChain(String chainID, String modelID)
chainID
- the ID of the Chain.modelID
- the ID of the Model the Chain belongs to.
public Model getModel(String modelID)
modelID
- the unique ID for the desired Model.
public Iterator<Model> iteratorModels()
public int numberOfModels()
public List<Atom> getAtomSerialNoCache()
public void clearAtomSerialNoCache()
public void generateLoopRegions() throws VisitorException
VisitorException
- if an error occurs while generating
Loops.public void generateStandardBonds() throws VisitorException
VisitorException
public void clearBonds(ResidueMode residueMode) throws VisitorException
residueMode
- the type of Residues to remove Bonds from.
VisitorException
public void clearAllBonds() throws VisitorException
VisitorException
public List<String> getAminoAcidLabels() throws VisitorException
VisitorException
public String processID(String id, String typeOfID) throws InvalidIDException
processID
in interface IDTest
id
- the ID to process.typeOfID
- the type of ID (for possible inclusion in error
message).
InvalidIDException
- if the trimmed ID does not have at
least one character.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |