org.biojava.bio.structure.align.ce
Class CeCalculatorEnhanced

java.lang.Object
  extended by org.biojava.bio.structure.align.ce.CeCalculatorEnhanced

public class CeCalculatorEnhanced
extends Object

This is based on the original Combinatorial Extension (CE) source code from 2003 or 2004 (CE version 2.3), as has been originally developed by I. Shindyalov and P.Bourne (1998). The original CE paper is available from here: http://peds.oxfordjournals.org/cgi/content/short/11/9/739. This class is a pretty much exact 1:1 port from C, where I cared about exact reproduce of the CE results and not about Java style.

Author:
Spencer Bliven, Andreas Prlic

Field Summary
protected  int[] bestTrace1
           
protected  int[] bestTrace2
           
protected  int[][] bestTraces1
           
protected  int[][] bestTraces2
           
protected  double bestTraceScore
           
protected  int[] bestTracesN
           
protected  double[] bestTracesScores
           
static boolean GLOBAL_ALIGN1
           
static boolean GLOBAL_ALIGN2
           
protected static boolean isPrint
           
protected  double[][] mat
           
protected  int nBestTrace
           
protected  int nBestTraces
           
protected static int nIter
           
protected  int nTrace
           
protected  int nTraces
           
protected  CeParameters params
           
protected  int[] trace1
           
protected  int[] trace2
           
protected static double zThr
           
 
Constructor Summary
CeCalculatorEnhanced(CeParameters params)
           
 
Method Summary
 void addMatrixListener(MatrixListener li)
           
 double calc_rmsd(Atom[] pro1, Atom[] pro2, int strLen, boolean storeTransform, boolean show)
          superimpose and get rmsd
 void convertAfpChain(AFPChain afpChain, Atom[] ca1, Atom[] ca2)
          copy data from this class into AFPChain container object.
protected  int doIter0(int newBestTrace, double traceTotalScore, double bestTracesMax)
           
 AFPChain extractFragments(AFPChain afpChain, Atom[] ca1, Atom[] ca2)
           
 int[] getAlign_se1()
           
 int[] getAlign_se2()
           
 double[][] getDist1()
           
 double[][] getDist2()
           
 int getLcmp()
           
 double[][] getMatMatrix()
          Caution: this matrix is overwriten with very different data at several points in the alignment algorithm.
 int getnAtom()
           
 Matrix getRotationMatrix()
          Gets the rotation matrix from the last call to calc_rmsd.
protected  double getScore2(int jse1, int jse2, double[][] traceScore, int traceIndex_, int[] traceIndex, int winSizeComb1, int winSizeComb2, double score0, double score1)
           
protected  double getScoreFromDistanceMatrices(int mse1, int mse2, int winSize)
           
 Atom getShift()
          Gets the shift from the last call to calc_rmsd.
 double[][] initSumOfDistances(int nse1, int nse2, int winSize, int winSizeComb1, Atom[] ca1, Atom[] ca2)
           
 void nextStep(AFPChain afpChain, Atom[] ca1, Atom[] ca2)
           
 void setAlign_se1(int[] alignSe1)
           
 void setAlign_se2(int[] alignSe2)
           
 void setDist1(double[][] dist1)
           
 void setDist2(double[][] dist2)
           
 void setLcmp(int lcmp)
           
 void setMatMatrix(double[][] matrix)
           
 void setnAtom(int nAtom)
           
 void traceFragmentMatrix(AFPChain afpChain, Atom[] ca1, Atom[] ca2)
           
static double[][] updateMatrixWithSequenceConservation(double[][] max, Atom[] ca1, Atom[] ca2, CeParameters params)
          Modifies an alignment matrix by favoring the alignment of similar and identical amino acids and penalizing the alignment of unrelated ones.
protected  double zStrAlign(int winSize, int nTrace, double score, int nGaps)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isPrint

protected static final boolean isPrint
See Also:
Constant Field Values

mat

protected double[][] mat

bestTrace1

protected int[] bestTrace1

bestTrace2

protected int[] bestTrace2

bestTraces1

protected int[][] bestTraces1

bestTraces2

protected int[][] bestTraces2

nBestTrace

protected int nBestTrace

nBestTraces

protected int nBestTraces

bestTracesN

protected int[] bestTracesN

bestTraceScore

protected double bestTraceScore

nTrace

protected int nTrace

bestTracesScores

protected double[] bestTracesScores

trace1

protected int[] trace1

trace2

protected int[] trace2

zThr

protected static final double zThr
See Also:
Constant Field Values

nTraces

protected int nTraces

params

protected CeParameters params

nIter

protected static final int nIter
See Also:
Constant Field Values

GLOBAL_ALIGN1

public static final boolean GLOBAL_ALIGN1
See Also:
Constant Field Values

GLOBAL_ALIGN2

public static final boolean GLOBAL_ALIGN2
See Also:
Constant Field Values
Constructor Detail

CeCalculatorEnhanced

public CeCalculatorEnhanced(CeParameters params)
Method Detail

extractFragments

public AFPChain extractFragments(AFPChain afpChain,
                                 Atom[] ca1,
                                 Atom[] ca2)
                          throws StructureException
Parameters:
afpChain - A new AFPChain, which will be filled in by this function
ca1 -
ca2 -
Returns:
afpChain
Throws:
StructureException

initSumOfDistances

public double[][] initSumOfDistances(int nse1,
                                     int nse2,
                                     int winSize,
                                     int winSizeComb1,
                                     Atom[] ca1,
                                     Atom[] ca2)

traceFragmentMatrix

public void traceFragmentMatrix(AFPChain afpChain,
                                Atom[] ca1,
                                Atom[] ca2)

getScore2

protected double getScore2(int jse1,
                           int jse2,
                           double[][] traceScore,
                           int traceIndex_,
                           int[] traceIndex,
                           int winSizeComb1,
                           int winSizeComb2,
                           double score0,
                           double score1)

doIter0

protected int doIter0(int newBestTrace,
                      double traceTotalScore,
                      double bestTracesMax)

getScoreFromDistanceMatrices

protected double getScoreFromDistanceMatrices(int mse1,
                                              int mse2,
                                              int winSize)

nextStep

public void nextStep(AFPChain afpChain,
                     Atom[] ca1,
                     Atom[] ca2)
              throws StructureException
Throws:
StructureException

updateMatrixWithSequenceConservation

public static double[][] updateMatrixWithSequenceConservation(double[][] max,
                                                              Atom[] ca1,
                                                              Atom[] ca2,
                                                              CeParameters params)
Modifies an alignment matrix by favoring the alignment of similar and identical amino acids and penalizing the alignment of unrelated ones.

Parameters:
max - alignment matrix
ca1 - Atoms for protein 1
ca2 - Atoms for Protein 2
params - alignment parameters
Returns:
modified alignment matrix

addMatrixListener

public void addMatrixListener(MatrixListener li)

calc_rmsd

public double calc_rmsd(Atom[] pro1,
                        Atom[] pro2,
                        int strLen,
                        boolean storeTransform,
                        boolean show)
                 throws StructureException
superimpose and get rmsd

Parameters:
pro1 -
pro2 -
strLen -
storeTransform -
show -
Returns:
RMSD
Throws:
StructureException

zStrAlign

protected double zStrAlign(int winSize,
                           int nTrace,
                           double score,
                           int nGaps)

convertAfpChain

public void convertAfpChain(AFPChain afpChain,
                            Atom[] ca1,
                            Atom[] ca2)
copy data from this class into AFPChain container object.

Parameters:
afpChain -
ca1 -
ca2 -

getnAtom

public int getnAtom()

setnAtom

public void setnAtom(int nAtom)

getLcmp

public int getLcmp()

setLcmp

public void setLcmp(int lcmp)

getAlign_se1

public int[] getAlign_se1()

setAlign_se1

public void setAlign_se1(int[] alignSe1)

getAlign_se2

public int[] getAlign_se2()

setAlign_se2

public void setAlign_se2(int[] alignSe2)

getMatMatrix

public double[][] getMatMatrix()
Caution: this matrix is overwriten with very different data at several points in the alignment algorithm. After initSumOfDistances is run, this will hold the distance matrix between AFPs.

Returns:
mat

setMatMatrix

public void setMatMatrix(double[][] matrix)

getRotationMatrix

public Matrix getRotationMatrix()
Gets the rotation matrix from the last call to calc_rmsd.

Returns:
The rotatiokn matrix

getShift

public Atom getShift()
Gets the shift from the last call to calc_rmsd.

Returns:
The shift

getDist1

public double[][] getDist1()

setDist1

public void setDist1(double[][] dist1)

getDist2

public double[][] getDist2()

setDist2

public void setDist2(double[][] dist2)