ca.cas.montecarlo
Class Misrejoiner

java.lang.Object
  extended by ca.cas.montecarlo.Misrejoiner
Direct Known Subclasses:
ExponentialMisrejoiner

public abstract class Misrejoiner
extends java.lang.Object

A class that extends Misrejoiner represents the process of rejoining the loose ends that are the result of the irradiation of a genome. Base pairs which were not adjacent prior to the irradiation of the genome may be joined during this process, hence the name Misrejoiner. An extending misrejoiner subclass may define its own constructor if it must be initialized with any parameters. Geometry and AbGraph objects must be set by the driver before the misrejoin method may be called.


Field Summary
protected  java.util.Set finalEdges
           
protected  AbVertex[] freeEnds
           
protected  Geometry geo
           
protected  double grandSum
           
protected  AbGraph graph
           
protected  double[][] probArray
           
protected  int size
           
 
Constructor Summary
Misrejoiner()
           
 
Method Summary
 void addEdgesToGraph()
          Adds all of the final edges found so far to the AbGraph set by setAbGraph() To ensure that Misrejoiner has finished the process of misrejoining, call getAllFinalEdges() before calling this method or call getAndAddFinalEdges()
 Chromosome arrayIndexToChromosome(int index)
          Finds the Chromosome that a particular free end is from
 long arrayIndexToLoc(int index)
          Finds the location of a particular free end on the Chromosome that it is from.
 java.util.Set getAllFinalEdges(java.util.Random r)
          Calculates a Set of final edges that represents the end result of the misrejoining process.
 java.util.Set getAndAddFinalEdges(java.util.Random r)
          Calculates a Set of final edges that represents the end result of the misrejoining process.
protected  void initialize()
           
protected abstract  void initializeProbArray()
           
 void misrejoin(java.util.Random r)
          Calculates final edges from the free ends currently contained by the AbGraph set by setAbGraph() and adds these final edges back into the AbGraph
 void setAbGraph(AbGraph graph)
          Set the AbGraph object that is to be used by this Misrejoiner
 void setGeometry(Geometry geo)
          Set the Geometry object that is to be used by this Misrejoiner
protected abstract  void updateProbArray(int i, int j)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

protected int size

grandSum

protected double grandSum

probArray

protected double[][] probArray

graph

protected AbGraph graph

freeEnds

protected AbVertex[] freeEnds

finalEdges

protected java.util.Set finalEdges

geo

protected Geometry geo
Constructor Detail

Misrejoiner

public Misrejoiner()
Method Detail

initialize

protected void initialize()
                   throws java.lang.Exception
Throws:
java.lang.Exception

initializeProbArray

protected abstract void initializeProbArray()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

setGeometry

public void setGeometry(Geometry geo)
Set the Geometry object that is to be used by this Misrejoiner

Parameters:
geo - a Geometry object

setAbGraph

public void setAbGraph(AbGraph graph)
Set the AbGraph object that is to be used by this Misrejoiner

Parameters:
graph - an AbGraph object

misrejoin

public void misrejoin(java.util.Random r)
               throws java.lang.Exception
Calculates final edges from the free ends currently contained by the AbGraph set by setAbGraph() and adds these final edges back into the AbGraph

Parameters:
r - a Random object to use in the calculation
Throws:
java.lang.Exception

getAllFinalEdges

public java.util.Set getAllFinalEdges(java.util.Random r)
                               throws java.lang.Exception
Calculates a Set of final edges that represents the end result of the misrejoining process. This method may be called any number of times and will always return the same Set from the same instance of Misrejoiner.

Returns:
a Set which contains AbEdge objects
Throws:
java.lang.Exception

getAndAddFinalEdges

public java.util.Set getAndAddFinalEdges(java.util.Random r)
                                  throws java.lang.Exception
Calculates a Set of final edges that represents the end result of the misrejoining process. This Set is returned and is also added to the AbGraph that this Misrejoiner was initialized with

Returns:
a Set of final edges
Throws:
java.lang.Exception

addEdgesToGraph

public void addEdgesToGraph()
                     throws java.lang.Exception
Adds all of the final edges found so far to the AbGraph set by setAbGraph() To ensure that Misrejoiner has finished the process of misrejoining, call getAllFinalEdges() before calling this method or call getAndAddFinalEdges()

Throws:
java.lang.Exception

updateProbArray

protected abstract void updateProbArray(int i,
                                        int j)

arrayIndexToChromosome

public Chromosome arrayIndexToChromosome(int index)
Finds the Chromosome that a particular free end is from

Parameters:
index - of the free end in the proability array
Returns:
The Chromosome that a particular free end is from

arrayIndexToLoc

public long arrayIndexToLoc(int index)
Finds the location of a particular free end on the Chromosome that it is from.

Parameters:
index - of the free end in the probability array
Returns:
the base pair number of a particular free end