edu.sdsc.mbt
Class StructureMap

java.lang.Object
  extended byedu.sdsc.mbt.StructureMap

public class StructureMap
extends java.lang.Object

This class implements a derived data map for a Structure object. It generates a number of hierarchical links, indexes, and generally provides access to the numerous relationships that exists between chains, fragments (secondary structure conformations), residues, atoms, and bonds for a Structure. The map enables one to "walk" a Structure's backbone, and finds "gaps" in the map (ie: segments of chains which are not spanned by Conformation objects). The set of map relationships that are managed by this class are suitable for applications and viewers to construct more spacially/biologically meaningful representations and displays.

This class provides a number of different "entry points" to traverse the underlying Structure data. The one an application should choose depeonds mostly on what the application wishes to accomplish. For example, while a basic sequence viewer might simply walk the raw list of residues (ie: by calling getResidueCount and getResidue in a loop) another sequence viewer may want to obtain residues by walking each chain (ie: by calling getChainCount, plus getChain and chain.getResidue in a nested loop) so that it knows where the residues of one chain ends and another begins. Again, its entirely up to the application.


Author:
John L. Moreland
See Also:
StructureComponent, StructureComponentRegistry

Field Summary
 boolean bondOrderImported
           
 boolean bondOrderUserAssigned
           
 boolean chargesUserAssigned
           
 boolean forceFieldTypesSet
           
static double hBondCutoff
           
 int MIN_ATOMS_FOR_FRAGMENTS
           
 
Constructor Summary
StructureMap(Structure structure)
          Constructs a StructureMap object for a given Structure.
 
Method Summary
 void addAtom(Atom added, Atom bonded, Bond b, boolean assignName)
           
 void addAtom(Atom added, Atom bonded, Bond b, int number)
           
 void addAtom(Atom added, Residue target, boolean assignName)
           
 void addAtom(Atom atom, Residue residue, int position, java.lang.String chainId)
          Adds a new atom with the specified position of the residue (if new)
 void addAtom(Atom atom, Residue residue, java.lang.String chainId)
          Simply add an atom to the records don't assign bonds (they may be added later), and assign number based on the current numbering in the structure residue is a new Residue object that will be added to the structure (subsequent atoms may be added to the same residue from the calling method)
 void addBond(Bond bond)
          Add a Bond to the StructureMap.
 void addBonds(java.util.Vector bondVector)
          Add a vector of Bond objects to the StructureMap.
 void addStructure(StructureMap map)
          This method incorporates a new structure (fragment) into this structure by importing all data structures and updating names
 void calculateBounds()
           
 boolean computePhiPsi()
          This method calculates phi-psi angles for the protein structure and saves the values in the hashmaps If the structure contains no amino acids, false is returned.
 void computePhiPsi(Residue r, java.util.HashMap transformed)
           
 void deriveBondOrders()
          This method walks over all bonds in the structure and calculates orders based on their geometry
 java.util.Vector detectBonds()
          This method detects missing bonds without removing any existing ones.
 void detectLigandBonds()
           
 void generateBonds()
          Generate a complete set of Bond objects from the Atom records.
 void generateFragments()
          Generate secondary structure fragments for the Structure.
 java.util.Vector getAngleConnections()
          Get all combination of three atoms connected through the central atom and forming an angle Each item is an array of three Atoms
 Atom getAtom(int atomIndex)
          Get the Atom at the specified index.
 double[] getAtomCoordinateAverage()
          Return the coordinate average for a Structure's atom coordinates.
 double[][] getAtomCoordinateBounds()
          Return the coordinate bounds for a Structure's atom coordinates.
 int getAtomCount()
          Return the total Atom count extracted from the Structure.
 int getAtomIndex(Atom atom)
          Get the index of the specified Atom.
 java.util.Vector getAtoms()
           
 java.util.Vector getAtoms(Atom atom)
           
 java.util.Hashtable getAtomToAtoms()
           
 java.util.Hashtable getAtomToBonds()
           
 Bond getBond(int bondIndex)
          Get the Bond at the specified index.
 int getBondCount()
          Get a count of bonds contained in this StructureMap.
 int getBondIndex(Bond bond)
          Get the index of the specified Bond.
 java.util.Vector getBonds()
           
 java.util.Vector getBonds(Atom atom)
          Return a Vector of all Bond objects connected to the given Atom object.
 java.util.Vector getBonds(Bond bond)
          Return a Vector of bonds that are neighbors of the argument
 java.util.Vector getBonds(java.util.Vector atomVector)
          Return a Vector of all Bond objects connected to the given Atom objects.
 java.util.Hashtable getBondToBonds()
           
 java.util.Hashtable getBondUniqueness()
           
 double[] getCenter()
           
 Chain getChain(Atom atom)
          Get the Chain object to which this Atom belongs.
 Chain getChain(int chainIndex)
          Return the Chain at the given chain index.
 Chain getChain(java.lang.String chainId)
          Get the Chain object given its ID.
 java.util.Hashtable getChainById()
           
 int getChainCount()
          Return the chain count extracted from the Structure.
 int getChainIndex(Chain chain)
          Get the index of the specified Chain.
 java.util.Vector getChains()
          Return the chains from the Structure.
 java.util.Vector getChildren(java.lang.Object object)
          Return the Structure or StructureComponent children objects.
 java.util.Vector getEndResidues()
           
 boolean getFillDisorderedGaps()
          Should we "fill in" the disordered residue gaps with random coil when we load fragments?
 Fragment getFragment(int fragmentIndex)
          Get the Fragment at the specified index.
 int getFragmentCount()
          Return the total Fragment count extracted from the Structure.
 int getFragmentIndex(Fragment fragment)
          Get the index of the specified Fragment.
 java.util.Vector getFragments()
           
 int getLigandCount()
          Return the ligand (het group) count.
 Residue getLigandResidue(int ligandIndex)
          Return the Residue for a given ligand index.
 java.util.Vector getLigands()
           
 double[] getMaxCoordinate()
           
 double[] getMinCoordinate()
           
 java.util.Vector getNonBondedConnections()
          Returns a Vector of arrays with pairs of atoms that don't form bonds
 java.util.Vector getParents(java.lang.Object object)
          Return the StructureComponent parent objects.
 java.util.HashMap getPhiMap()
           
 java.util.HashMap getPsiMap()
           
 double[] getPsiPhi(Residue r)
           
 Residue getResidue(Atom atom)
          Get the Residue object to which this Atom belongs.
 Residue getResidue(int residueIndex)
          Return the start Atom index for a given residue index.
 Residue getResidue(java.lang.String chainAndResidue)
          Get the Residue object by its chain and residue id.
 java.util.Hashtable getResidueByChainAndResidueId()
           
 int getResidueCount()
          Return the residue count extracted from the Structure.
 int getResidueIndex(Residue residue)
          Get the index of the specified Residue.
 java.util.Vector getResidues()
           
 Structure getStructure()
          Returns the Structure object used to construct this StructureMap.
 StructureStyles getStructureStyles()
          Return the StructureStyles object that describes the style (authored) attributes needed to produce consistant views of StructureMap elements.
 java.util.Vector getTorsionConnections()
           
 boolean inRing(Atom atom, int ringSize)
           
 boolean isBondOrderImported()
           
 boolean isBondOrderUserAssigned()
           
 boolean isChargesUserAssigned()
           
 void removeAllBonds()
          Remove all Bond objects from the StructureMap.
 void removeAtom(Atom atom)
          This method removes an atom from the structure
 void removeBond(Bond bond)
          Remove a Bond from the StructureMap.
 void removeBond(int bondIndex)
          Remove a Bond from the StructureMap.
 void setCenter(double[] c)
           
 void setFillDisorderedGaps(boolean state)
          Should we "fill in" the disordered residue gaps with random coil when we load fragments?
 void setResidueId(Residue residue, int n)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bondOrderImported

public boolean bondOrderImported

bondOrderUserAssigned

public boolean bondOrderUserAssigned

chargesUserAssigned

public boolean chargesUserAssigned

MIN_ATOMS_FOR_FRAGMENTS

public int MIN_ATOMS_FOR_FRAGMENTS

hBondCutoff

public static double hBondCutoff

forceFieldTypesSet

public boolean forceFieldTypesSet
Constructor Detail

StructureMap

public StructureMap(Structure structure)
Constructs a StructureMap object for a given Structure.

Method Detail

getMaxCoordinate

public double[] getMaxCoordinate()

getMinCoordinate

public double[] getMinCoordinate()

getCenter

public double[] getCenter()

setCenter

public void setCenter(double[] c)

setResidueId

public void setResidueId(Residue residue,
                         int n)

generateFragments

public void generateFragments()
Generate secondary structure fragments for the Structure. Use Conformation records loaded from the Structure if available. Otherwise, derive the secondary structure fragments.


getStructure

public Structure getStructure()
Returns the Structure object used to construct this StructureMap.


getAtomCoordinateBounds

public double[][] getAtomCoordinateBounds()
Return the coordinate bounds for a Structure's atom coordinates.

These bounding values are used in several parts of the toolkit including:


getAtomCoordinateAverage

public double[] getAtomCoordinateAverage()
Return the coordinate average for a Structure's atom coordinates.

double[0] = x
double[1] = y
double[2] = z


getAtoms

public java.util.Vector getAtoms(Atom atom)

getAtomCount

public int getAtomCount()
Return the total Atom count extracted from the Structure.


getAtom

public Atom getAtom(int atomIndex)
Get the Atom at the specified index.


getAtomIndex

public int getAtomIndex(Atom atom)
Get the index of the specified Atom.


getResidue

public Residue getResidue(Atom atom)
Get the Residue object to which this Atom belongs.


getChain

public Chain getChain(Atom atom)
Get the Chain object to which this Atom belongs.


getChain

public Chain getChain(java.lang.String chainId)
Get the Chain object given its ID.


getBondCount

public int getBondCount()
Get a count of bonds contained in this StructureMap.


getBond

public Bond getBond(int bondIndex)
Get the Bond at the specified index.


getBondIndex

public int getBondIndex(Bond bond)
Get the index of the specified Bond.


addBond

public void addBond(Bond bond)
Add a Bond to the StructureMap.


addAtom

public void addAtom(Atom added,
                    Residue target,
                    boolean assignName)

addAtom

public void addAtom(Atom added,
                    Atom bonded,
                    Bond b,
                    boolean assignName)

addAtom

public void addAtom(Atom atom,
                    Residue residue,
                    java.lang.String chainId)
Simply add an atom to the records don't assign bonds (they may be added later), and assign number based on the current numbering in the structure residue is a new Residue object that will be added to the structure (subsequent atoms may be added to the same residue from the calling method)

Parameters:
atom -
residue -

addAtom

public void addAtom(Atom atom,
                    Residue residue,
                    int position,
                    java.lang.String chainId)
Adds a new atom with the specified position of the residue (if new)

Parameters:
atom -
residue -
position - 1-based location of the residue in the chain

addAtom

public void addAtom(Atom added,
                    Atom bonded,
                    Bond b,
                    int number)

addBonds

public void addBonds(java.util.Vector bondVector)
Add a vector of Bond objects to the StructureMap.


removeBond

public void removeBond(Bond bond)
Remove a Bond from the StructureMap.


removeBond

public void removeBond(int bondIndex)
Remove a Bond from the StructureMap.


removeAllBonds

public void removeAllBonds()
Remove all Bond objects from the StructureMap.


getBonds

public java.util.Vector getBonds(Atom atom)
Return a Vector of all Bond objects connected to the given Atom object. NOTE: The Vector returned here is the internal copy (for speed purposes), so DO NOT MODIFY THE VECTOR!


getBonds

public java.util.Vector getBonds(Bond bond)
Return a Vector of bonds that are neighbors of the argument

Parameters:
bond -
Returns:

getBonds

public java.util.Vector getBonds(java.util.Vector atomVector)
Return a Vector of all Bond objects connected to the given Atom objects.


generateBonds

public void generateBonds()
Generate a complete set of Bond objects from the Atom records.


detectBonds

public java.util.Vector detectBonds()
This method detects missing bonds without removing any existing ones. The new bonds are added. This feature is useful for loading data that have mixed protein/ligand data, and ligands don't have conect records.


detectLigandBonds

public void detectLigandBonds()

getLigandCount

public int getLigandCount()
Return the ligand (het group) count.


getLigandResidue

public Residue getLigandResidue(int ligandIndex)
Return the Residue for a given ligand index.


getResidueCount

public int getResidueCount()
Return the residue count extracted from the Structure.


getResidue

public Residue getResidue(int residueIndex)
Return the start Atom index for a given residue index.


getResidue

public Residue getResidue(java.lang.String chainAndResidue)
Get the Residue object by its chain and residue id.


getResidueIndex

public int getResidueIndex(Residue residue)
                    throws java.lang.IllegalArgumentException
Get the index of the specified Residue.

Throws:
java.lang.IllegalArgumentException

getFragmentCount

public int getFragmentCount()
Return the total Fragment count extracted from the Structure.


getFragment

public Fragment getFragment(int fragmentIndex)
Get the Fragment at the specified index.


getFragmentIndex

public int getFragmentIndex(Fragment fragment)
Get the index of the specified Fragment.


getChainCount

public int getChainCount()
Return the chain count extracted from the Structure.


getChain

public Chain getChain(int chainIndex)
Return the Chain at the given chain index.


getChainIndex

public int getChainIndex(Chain chain)
Get the index of the specified Chain.


getStructureStyles

public StructureStyles getStructureStyles()
Return the StructureStyles object that describes the style (authored) attributes needed to produce consistant views of StructureMap elements.


getChildren

public java.util.Vector getChildren(java.lang.Object object)
Return the Structure or StructureComponent children objects. Structure->Chain->Fragment->Residue->Atom->null, or, Bond->null.


getChains

public java.util.Vector getChains()
Return the chains from the Structure.


getAtoms

public final java.util.Vector getAtoms()
Returns:
Returns the atoms.

getAtomToAtoms

public final java.util.Hashtable getAtomToAtoms()
Returns:
Returns the atomToAtoms.

getAtomToBonds

public final java.util.Hashtable getAtomToBonds()
Returns:
Returns the atomToBonds.

isBondOrderImported

public final boolean isBondOrderImported()
Returns:
Returns the bondOrderImported.

isBondOrderUserAssigned

public final boolean isBondOrderUserAssigned()
Returns:
Returns the bondOrderUserAssigned.

getBonds

public final java.util.Vector getBonds()
Returns:
Returns the bonds.

getBondToBonds

public final java.util.Hashtable getBondToBonds()
Returns:
Returns the bondToBonds.

getBondUniqueness

public final java.util.Hashtable getBondUniqueness()
Returns:
Returns the bondUniqueness.

getChainById

public final java.util.Hashtable getChainById()
Returns:
Returns the chainById.

isChargesUserAssigned

public final boolean isChargesUserAssigned()
Returns:
Returns the chargesUserAssigned.

getFragments

public final java.util.Vector getFragments()
Returns:
Returns the fragments.

getLigands

public final java.util.Vector getLigands()
Returns:
Returns the ligands.

getResidueByChainAndResidueId

public final java.util.Hashtable getResidueByChainAndResidueId()
Returns:
Returns the residueByChainAndResidueId.

getResidues

public final java.util.Vector getResidues()
Returns:
Returns the residues.

getParents

public java.util.Vector getParents(java.lang.Object object)
Return the StructureComponent parent objects. Atom->Residue->Fragment->Chain->Structure->null, or, Bond->{Atom,Atom}->null, or, null.


setFillDisorderedGaps

public void setFillDisorderedGaps(boolean state)
Should we "fill in" the disordered residue gaps with random coil when we load fragments?

See Also:


getFillDisorderedGaps

public boolean getFillDisorderedGaps()
Should we "fill in" the disordered residue gaps with random coil when we load fragments?

See Also:


deriveBondOrders

public void deriveBondOrders()
This method walks over all bonds in the structure and calculates orders based on their geometry


inRing

public boolean inRing(Atom atom,
                      int ringSize)

removeAtom

public void removeAtom(Atom atom)
This method removes an atom from the structure


addStructure

public void addStructure(StructureMap map)
This method incorporates a new structure (fragment) into this structure by importing all data structures and updating names

Parameters:
map -

calculateBounds

public void calculateBounds()

getAngleConnections

public java.util.Vector getAngleConnections()
Get all combination of three atoms connected through the central atom and forming an angle Each item is an array of three Atoms

Returns:

getTorsionConnections

public java.util.Vector getTorsionConnections()

getNonBondedConnections

public java.util.Vector getNonBondedConnections()
Returns a Vector of arrays with pairs of atoms that don't form bonds

Returns:

computePhiPsi

public boolean computePhiPsi()
This method calculates phi-psi angles for the protein structure and saves the values in the hashmaps If the structure contains no amino acids, false is returned. Otherwise, the result is true


computePhiPsi

public void computePhiPsi(Residue r,
                          java.util.HashMap transformed)

getPhiMap

public java.util.HashMap getPhiMap()

getPsiMap

public java.util.HashMap getPsiMap()

getEndResidues

public java.util.Vector getEndResidues()

getPsiPhi

public double[] getPsiPhi(Residue r)