belka.mol
Class Molecule

java.lang.Object
  extended by belka.mol.Molecule
All Implemented Interfaces:
Serializable

public abstract class Molecule
extends Object
implements Serializable

Abstract class describing behavior of a molecule. Molecule can be as simple as single chemical compaund and as complex as protein bound to a DNA with surrounding water.

Author:
Alexej Abyzov
See Also:
Serialized Form

Field Summary
protected  double[][] rot_
           
protected  double scale_
           
protected  double[] trans_
           
 
Constructor Summary
Molecule()
           
 
Method Summary
abstract  boolean addAfter(Molecule newMol)
          Adds a molecule after the current one.
abstract  boolean addBefore(Molecule newMol)
          Adds a molecule before the current one.
abstract  boolean addChain(Chain chain)
          Adds a chain to the end of chain list for the current molecule.
 void addTransformation(int angle_x, int angle_y, int angle_z, double shift_x, double shift_y, double shift_z)
          Adds transformation (rotation and translation) to the current transformation.
abstract  Chain chainList()
          Returns list of chains.
abstract  int countAssemblies()
          Returns number of assemblies in the molecule.
abstract  int countAtoms()
          Returns number of atoms in the molecule.
abstract  int countChains()
          Returns number of chains in the molecule.
abstract  int countModels()
          Returns number of different NMR models in the molecule.
static Molecule create(String name)
          Static method to create a new molecule.
static Molecule create(String name, String pdbCode)
          Static method to create a new molecule.
abstract  void disassemble()
          Disassembles molecule into null pointers to help garbage collector to free memory.
abstract  Molecule extractAfter()
          Extracts the molecule following the current one from the list.
abstract  Molecule extractBefore()
          Extracts the molecule preceeding the current one from the list.
abstract  String getName()
          Returns molecule's name.
abstract  String getPDBCode()
          Returns molecule's PDB-code.
 double[][] getRotation()
          Returns current rotation matrix.
 double getScale()
          Returns current scale.
 double[] getTranslation()
          Returns current translation vector.
 boolean isFrozen()
          Returns status of freezing.
abstract  Molecule next()
          Returns next molecule in list.
abstract  Molecule prev()
          Returns previous molecule in list.
abstract  boolean rotate(double[][] rot, double[] trans)
          The function transforms a molecule.
abstract  void selectAllAtoms(boolean val)
          Select or deselect all atoms in a molecule.
 void setFrozen(boolean val)
          Freez or unfreez the object.
 void setScale(double scale)
          Sets scale to use.
 void setTransformation(double[][] rot, double[] trans)
          Sets transforamtion (rotation and translation) for the object.
 String toString()
          Returns string representation of the molecule.
 void transform()
          Performs transformation of the object using current values for transformation.
 void transformSize()
          Performs transformation of object size and coordinates using current scale.
 void transformXY()
          Performs transformation of X- and Y-coordinates of the object using current values for transformation.
 void transformYZ()
          Performs transformation of Y- and Z-coordinates of the object using current values for transformation.
 void transformZX()
          Performs transformation of Z- and X-coordinates of the object using current values for transformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rot_

protected double[][] rot_

trans_

protected double[] trans_

scale_

protected double scale_
Constructor Detail

Molecule

public Molecule()
Method Detail

create

public static Molecule create(String name,
                              String pdbCode)
Static method to create a new molecule.

Parameters:
name - molecule's name.
pdbCode - molecule's PDB-code.
Returns:
new created molecule.

create

public static Molecule create(String name)
Static method to create a new molecule.

Parameters:
name - molecule's name.
Returns:
new created molecule.

disassemble

public abstract void disassemble()
Disassembles molecule into null pointers to help garbage collector to free memory.


next

public abstract Molecule next()
Returns next molecule in list.

Returns:
next molecule in list.

prev

public abstract Molecule prev()
Returns previous molecule in list.

Returns:
previous molecule in list.

addAfter

public abstract boolean addAfter(Molecule newMol)
Adds a molecule after the current one. The function adds the molecule only if it is not linked to any other molecule and if the current molecule does not have linked next molecule.

Parameters:
newMol - molecule to add.
Returns:
'true' if the newMol has been added, 'false' otherwise.

addBefore

public abstract boolean addBefore(Molecule newMol)
Adds a molecule before the current one. The function adds the molecule only if it is not linked to any other molecule and if the current molecule does not have linked previous molecule.

Parameters:
newMol - molecule to add.
Returns:
'true' if the newMol has been added, 'false' otherwise.

extractAfter

public abstract Molecule extractAfter()
Extracts the molecule following the current one from the list. Extracted molecule is not linked to any other molecule.

Returns:
next molecule in the list.

extractBefore

public abstract Molecule extractBefore()
Extracts the molecule preceeding the current one from the list. Extracted molecule is not linked to any other molecule.

Returns:
previous molecule in the list.

chainList

public abstract Chain chainList()
Returns list of chains.

Returns:
list of chains.

addChain

public abstract boolean addChain(Chain chain)
Adds a chain to the end of chain list for the current molecule. The chain must be not linked to other chain. The function sets link of added chain to the current molecule.

Parameters:
chain - chain to add.
Returns:
'true' if the chain has been added, 'false' otherwise.

getName

public abstract String getName()
Returns molecule's name. Always not null.

Returns:
molecule's name.

getPDBCode

public abstract String getPDBCode()
Returns molecule's PDB-code. Always not null.

Returns:
molecule's PDB-code.

countChains

public abstract int countChains()
Returns number of chains in the molecule.

Returns:
number of chains in the molecule.

countAssemblies

public abstract int countAssemblies()
Returns number of assemblies in the molecule.

Returns:
number of assemblies in the molecule.

countAtoms

public abstract int countAtoms()
Returns number of atoms in the molecule.

Returns:
number of atoms in the molecule.

countModels

public abstract int countModels()
Returns number of different NMR models in the molecule.

Returns:
number of different NMR models in the molecule.

selectAllAtoms

public abstract void selectAllAtoms(boolean val)
Select or deselect all atoms in a molecule.

Parameters:
val - if true -- select all atoms, if false -- deselect.

rotate

public abstract boolean rotate(double[][] rot,
                               double[] trans)
The function transforms a molecule. The transformation is not related to screen rotation and affect atoms real (not screen) coordinates.

Parameters:
rot - rotation matrix.
trans - translation vector.
Returns:
true is succesfull, false otherwise.

toString

public String toString()
Returns string representation of the molecule.

Overrides:
toString in class Object
Returns:
string representation of the molecule.

getRotation

public double[][] getRotation()
Returns current rotation matrix.

Returns:
current rotation matrix

getTranslation

public double[] getTranslation()
Returns current translation vector.

Returns:
current translation vector

getScale

public double getScale()
Returns current scale.

Returns:
current scale.

isFrozen

public boolean isFrozen()
Returns status of freezing.

Returns:
status of freezing.

setFrozen

public void setFrozen(boolean val)
Freez or unfreez the object. If object is frozen no new transformation is added addTransformation(int, int, int, double, double, double) but scaling and setting transfromation work as usuall: transformSize() and setTransformation(double[][], double[]).


setTransformation

public void setTransformation(double[][] rot,
                              double[] trans)
Sets transforamtion (rotation and translation) for the object. Once values are set the function to perform transformation transform() is called.

Parameters:
rot - rotation matrix.
trans - translation vector.

addTransformation

public void addTransformation(int angle_x,
                              int angle_y,
                              int angle_z,
                              double shift_x,
                              double shift_y,
                              double shift_z)
Adds transformation (rotation and translation) to the current transformation. Rotation is specified by three rotation angles around axis. Translation is specified by three shifts along axis. After values for rotation and translation are updated the one of the functions for transformation is called: transformXY(), transformYZ(), transformZX(), transform().

Parameters:
angle_x - anlge of rotation around X-axis.
angle_y - anlge of rotation around Y-axis.
angle_z - anlge of rotation around Z-axis.
shift_x - shift long X-axis.
shift_y - shift long Y-axis.
shift_z - shift long Z-axis.

setScale

public void setScale(double scale)
Sets scale to use. After updating value function transformSize() is called.


transform

public void transform()
Performs transformation of the object using current values for transformation. The method has to be implemented by child class.


transformXY

public void transformXY()
Performs transformation of X- and Y-coordinates of the object using current values for transformation. The method has to be implemented by child class.


transformYZ

public void transformYZ()
Performs transformation of Y- and Z-coordinates of the object using current values for transformation. The method has to be implemented by child class.


transformZX

public void transformZX()
Performs transformation of Z- and X-coordinates of the object using current values for transformation. The method has to be implemented by child class.


transformSize

public void transformSize()
Performs transformation of object size and coordinates using current scale. The method has to be implemented by child class.