ca.cas.montecarlo
Class CircleGeometry

java.lang.Object
  extended by ca.cas.montecarlo.Geometry
      extended by ca.cas.montecarlo.CircleGeometry

public class CircleGeometry
extends Geometry

Each CircleGeometry object represents the relative positioning of chromosomes from a particular genome as arranged in a circle.


Field Summary
static int PTOQ
          A constant representing the orientation of a chromosome from its p telomere to its q telomere.
static int QTOP
          A constant representing the orientation of a chromosome from its q telomere to its p telomere.
 
Fields inherited from class ca.cas.montecarlo.Geometry
arranged, gen
 
Constructor Summary
CircleGeometry()
          Constructs a CircleGeometry object.
 
Method Summary
 void arrange(java.util.Random rGen)
          Calling this method causes this Geometry to arrange the Chromosomes from the Genome set by setGenome().
 boolean betweenChroms(long location)
          Determines whether the specified location in this Geometry exists between chromosomes
 int chromOrient(Chromosome chrom)
          Returns the orientation of a particular Chromosome in this Geometry
 double distance(Chromosome chrom1, long location1, Chromosome chrom2, long location2)
          Returns the distance between locations in the Genome.
 long leastNumBP(Chromosome chrom1, long location1, Chromosome chrom2, long location2)
          Finds the least number of base pairs between two locations in this Geometry
 Chromosome locToChrom(long location)
          Returns the Chromosome in which a location in this Geometry exists
 long locToLocalLoc(long location)
          Determines the location on a Chromosome of a location in this Geometry
static void main(java.lang.String[] args)
           
 long overallLocation(Chromosome chromIn, long chromLoc)
          Finds the location in this Geometry of a location on a chromosome.
 
Methods inherited from class ca.cas.montecarlo.Geometry
checkArranged, setGenome, totalBP
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PTOQ

public static final int PTOQ
A constant representing the orientation of a chromosome from its p telomere to its q telomere.

See Also:
Constant Field Values

QTOP

public static final int QTOP
A constant representing the orientation of a chromosome from its q telomere to its p telomere.

See Also:
Constant Field Values
Constructor Detail

CircleGeometry

public CircleGeometry()
Constructs a CircleGeometry object.

Method Detail

arrange

public void arrange(java.util.Random rGen)
             throws java.lang.Exception
Description copied from class: Geometry
Calling this method causes this Geometry to arrange the Chromosomes from the Genome set by setGenome(). If no valid Genome has been set, this method should throw an exception. If there are multiple ways of arranging the same Genome according to this Geometry, calling arrange() again after the initial arrangement causes this Geometry to re-arrange the Chromosomes in the Genome set by setGenome(). Otherwise, no change is made in this Geometry by calling arrange() multiple times. Every time a new Genome is set, the arrange method must be called to set an arrangement using the new Genome.

Specified by:
arrange in class Geometry
Parameters:
rGen - a Random object to use in creating the arrangement
Throws:
java.lang.Exception - if no valid Genome has been set

betweenChroms

public boolean betweenChroms(long location)
                      throws java.lang.Exception
Determines whether the specified location in this Geometry exists between chromosomes

Parameters:
location - a location on this Geometry
Returns:
true if location exists between two chromosomes in this Geometry
Throws:
java.lang.Exception - if arrange has not been called since the last time a new Genome was set

overallLocation

public long overallLocation(Chromosome chromIn,
                            long chromLoc)
                     throws java.lang.Exception
Finds the location in this Geometry of a location on a chromosome.

Parameters:
chromIn - the chromosome which contains the location that is being considered
chromLoc - the location on chromIn whose location in the Geometry is to be determined
Returns:
a location in this Geometry
Throws:
java.lang.Exception - if arrange has not been called since the last time a new Genome was set

locToChrom

public Chromosome locToChrom(long location)
                      throws java.lang.Exception
Returns the Chromosome in which a location in this Geometry exists

Parameters:
location - a location in this Geometry
Returns:
the Chromosome in which location exists or null if location exists between Chromosomes
Throws:
java.lang.Exception - if arrange has not been called since the last time a new Genome was set

locToLocalLoc

public long locToLocalLoc(long location)
                   throws java.lang.Exception
Determines the location on a Chromosome of a location in this Geometry

Parameters:
location - a location in this Geometry
Returns:
the location on a chromosome of location
Throws:
java.lang.Exception - if arrange has not been called since the last time a new Genome was set, if location is not a valid location in this geometry, or if location exists between chromosomes in this geometry

leastNumBP

public long leastNumBP(Chromosome chrom1,
                       long location1,
                       Chromosome chrom2,
                       long location2)
                throws java.lang.Exception
Finds the least number of base pairs between two locations in this Geometry

Parameters:
chrom1 - the Chromosome in which the first base pair is located
location1 - a location on chrom1
chrom2 - the Chromosome in which the second base pair is located
location2 - a location on chrom2
Returns:
the least number of base pairs between basePair1 and basePair2
Throws:
java.lang.Exception - if arrange has not been called since the last time a new Genome was set

distance

public double distance(Chromosome chrom1,
                       long location1,
                       Chromosome chrom2,
                       long location2)
                throws java.lang.Exception
Description copied from class: Geometry
Returns the distance between locations in the Genome. A location is defined as the space between base pairs. The meaning of distance depends on the particular subclass of Geometry being used. The distance of a location to itself should be 0. There are n+1 possible locations on a chromosome which is n base pairs long. This includes the locations on the outside of each telomere. The locations outside the p and q telomeres are defined to be 0 and n respectively. If this method is called and arrange() has not yet been called, an exception should be thrown.

Specified by:
distance in class Geometry
Parameters:
chrom1 - the Chromosome of the first location
location1 - the index of the first location
chrom2 - The Chromosome of the second location
location2 - the index of the second location
Returns:
the distance between location1 on chrom1 and location2 on chrom2 as a double
Throws:
java.lang.Exception - if arrange has not been called since the last time a new Genome was set

chromOrient

public int chromOrient(Chromosome chrom)
                throws java.lang.Exception
Returns the orientation of a particular Chromosome in this Geometry

Parameters:
chrom - the Chromosome whose orientation is to be determined
Returns:
CircleGeometry.PTOQ or CircleGeometry.QTOP according to the orientation of chrom
Throws:
java.lang.Exception - if arrange has not been called since the last time a new Genome was set

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception