com.objex.progeny.anywhere.data
Class Allele

java.lang.Object
  extended by com.objex.progeny.anywhere.data.Allele
All Implemented Interfaces:
java.io.Serializable

public class Allele
extends java.lang.Object
implements java.io.Serializable

Defines properties and methods for Alleles on a chromosome. An allele can be inherited from the mother or from the father. If a full set of Alleles on a marker is inherited from one parent
then it is a Haplotype.
Allele is a java bean so that it can be be used to store and/or transfer data through serialization.

See Also:
ChromosomeMarker, Chromosome, Serialized Form

Field Summary
static java.lang.String MATERNAL
          Represents Allele inherited from the Mother
static java.lang.String PATERNAL
          Represents Allele inherited from the Father
 
Constructor Summary
Allele()
          Creates a new Instance of an Allele class
 
Method Summary
 Allele cloneAllele()
          Creates and returns a new Allele with the same properties as this Allele.
 long getColor()
          Getter for property color.
 int getHatch()
           
 double getHeight()
          Getter for property height.
 double getIconX()
          Getter for property iconX.
 double getIconY()
          Getter for property iconY.
 java.lang.String getID()
          Getter for property ID.
 java.lang.String getInferredValue()
          Convenience method for return the appropriate string of allele is inferred
 int getMaxChars()
          Get the maximum number of Characters for the Allele value.
 java.lang.String getPaddedValue()
          Getter for property ID.
 java.lang.String getPaternity()
          Getter for property paternity.
 double getTextHeight()
          Getter for property textHeight.
 double getTextWidth()
          Getter for property textWidth.
 double getTextX()
          Getter for property textX.
 double getTextY()
          Getter for property textY.
 java.lang.String getType()
          Getter for property type.
 java.lang.String getValue()
           
 double getWidth()
          Getter for property width.
 double getX()
          Getter for property x.
 double getY()
          Getter for property y.
 boolean isBottomBar()
          Getter for property bottomBar.
 boolean isColorManuallyAssigned()
          Getter for property colorManuallyAssigned.
 boolean isIndet()
           
 boolean isInfer()
           
 boolean isRgb()
           
 boolean isTopBar()
          Getter for property topBar.
 void setBottomBar(boolean bottomBar)
          Setter for property bottomBar.
 void setColor(long color)
          Setter for property color.
 void setColor(long color, boolean ab_bgr)
          Setter for property color.
 void setColor(java.awt.Paint color)
          Set the new color for this Allel e
 void setColorManuallyAssigned(boolean rhs)
          Setter for property colorManuallyAssigned.
 void setHatch(int hatch)
          Set the value of the hatch property.
 void setHeight(double rhs)
          Setter for property height.
 void setIconX(double iconX)
          Setter for property iconX.
 void setIconY(double iconY)
          Setter for property iconY.
 void setID(java.lang.String ID)
          Setter for property ID.
 void setIndet(boolean indet)
           
 void setInfer(boolean infer)
          Set to true if value if inferred.
 void setPaternity(java.lang.String paternity)
          Setter for property paternity.
 void setRgb(boolean rgb)
          Set the RGB flag
 void setTextHeight(double textHeight)
          Setter for property textHeight.
 void setTextWidth(double textWidth)
          Setter for property textWidth.
 void setTextX(double textX)
          Setter for property textX.
 void setTextY(double textY)
          Setter for property textY.
 void setTopBar(boolean topBar)
          Setter for property topBar.
 void setType(java.lang.String type)
          Setter for property type.
 void setValue(java.lang.String value)
          Set the Allele value
 void setWidth(double aWidth)
          Setter for property width.
 void setX(double x)
          Setter for property x.
 void setY(double y)
          Setter for property y.
static long toLong(java.awt.Paint paint, boolean ab_bgr)
          Convert the paint to a long
 java.awt.Paint toPaint()
          Convert current color value to an AWT color or paint object
protected  long toRGB()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MATERNAL

public static final java.lang.String MATERNAL
Represents Allele inherited from the Mother

See Also:
Constant Field Values

PATERNAL

public static final java.lang.String PATERNAL
Represents Allele inherited from the Father

See Also:
Constant Field Values
Constructor Detail

Allele

public Allele()
Creates a new Instance of an Allele class

Method Detail

getID

public java.lang.String getID()
Getter for property ID.

Returns:
Value of property ID. Null will be returned if the ID property is not set.

setID

public void setID(java.lang.String ID)
Setter for property ID.

Parameters:
ID - New value of property ID.

getType

public java.lang.String getType()
Getter for property type. The Allele type designates the type of the Allele. Common Allele types are HLA-A, HLA-B, HLA-DR etc

Returns:
Value of property type.

setType

public void setType(java.lang.String type)
Setter for property type. The Allele type designates the type of the Allele. Common Allele types are HLA-A, HLA-B, HLA-DR etc

Parameters:
type - New value of property type.

getPaternity

public java.lang.String getPaternity()
Getter for property paternity. The partenity of the Allele inheritance. Possible types are Allele.MATERNAL and Allele.PATERNAL

Returns:
Value of property paternity.

setPaternity

public void setPaternity(java.lang.String paternity)
Setter for property paternity. The partenity of the Allele inheritance. Possible types are Allele.MATERNAL and Allele.PATERNAL

Parameters:
paternity - New value of property paternity.

getColor

public long getColor()
Getter for property color.

Returns:
A 32 bit long represeting color as follow 24-31 alpha, 16-23 red, 8-15 green, 0-7 blue

setColor

public void setColor(long color)
Setter for property color.

Parameters:
color - A 32 bit long represeting color as follow 24-31 alpha, 16-23 red, 8-15 green, 0-7 blue

setColor

public void setColor(long color,
                     boolean ab_bgr)
Setter for property color.

Parameters:
color - A 32 bit long represeting color. The red, blue and green bytes will be determined by the value of param ab_bgr as follows:
if ab_bgr is true the the color will be broken down as
Color Bits
Blue 16-23
Green 8-15
Red 0-7


If on the other hand ab_bgr is false then the red, green and blue bits will be arranged in the opposite direction as follows:
Color Bits
Red 16-23
Green 8-15
Blue 0-7
ab_bgr - TRUE if the color value is in the form of BGR where the red portion of the color is the least significant 8 bits and the blue if the most significant (3rd byte) 8 bits `

isColorManuallyAssigned

public boolean isColorManuallyAssigned()
Getter for property colorManuallyAssigned. When this property is set to TRUE, no changes will be made by the smartHaplotyping algorithms to the Color of this Allele and it will be preserverd in all cases except when a user overides it again. The user of this Allele class must ensure that no automatic haplotyping changes are made to the Allele color when this property is set and only allow those changes that come from the user changing the colors manually

Returns:
Value of property colorManuallyAssigned.

setColorManuallyAssigned

public void setColorManuallyAssigned(boolean rhs)
Setter for property colorManuallyAssigned. When this property is set to TRUE, no changes will be made by the smartHaplotyping algorithms to the Color of this Allele and it will be preserverd in all cases except when a user overides it again. The user of this Allele class must ensure that no automatic haplotyping changes are made to the Allele color when this property is set and only allow those changes that come from the user changing the colors manually

Parameters:
rhs - New value of property colorManuallyAssigned.

cloneAllele

public Allele cloneAllele()
Creates and returns a new Allele with the same properties as this Allele.


setValue

public void setValue(java.lang.String value)
Set the Allele value

Parameters:
value - The new Allele value

getValue

public java.lang.String getValue()
Returns:
The Allele value

getY

public double getY()
Getter for property y. The YC of the top left corner of the Allele Icon

Returns:
Value of property y.

setY

public void setY(double y)
Setter for property y. The YC of the top left corner of the Allele Icon

Parameters:
y - New value of property y.

getX

public double getX()
Getter for property x. The XC of the top left corner of the Allele Icon

Returns:
Value of property x.

setX

public void setX(double x)
Setter for property x. The XC of the top left corner of the Allele Icon

Parameters:
x - New value of property x.

getHeight

public double getHeight()
Getter for property height.

Returns:
Value of property height.

setHeight

public void setHeight(double rhs)
Setter for property height.

Parameters:
rhs - New value of property height.

getWidth

public double getWidth()
Getter for property width.

Returns:
Value of property width.

setWidth

public void setWidth(double aWidth)
Setter for property width.

Parameters:
aWidth - New value of property width.

isTopBar

public boolean isTopBar()
Getter for property topBar.

Returns:
Value of property topBar.

setTopBar

public void setTopBar(boolean topBar)
Setter for property topBar.

Parameters:
topBar - New value of property topBar.

isBottomBar

public boolean isBottomBar()
Getter for property bottomBar.

Returns:
Value of property bottomBar.

setBottomBar

public void setBottomBar(boolean bottomBar)
Setter for property bottomBar.

Parameters:
bottomBar - New value of property bottomBar.

getTextY

public double getTextY()
Getter for property textY.

Returns:
Value of property textY.

setTextY

public void setTextY(double textY)
Setter for property textY.

Parameters:
textY - New value of property textY.

getTextX

public double getTextX()
Getter for property textX.

Returns:
Value of property textX.

setTextX

public void setTextX(double textX)
Setter for property textX.

Parameters:
textX - New value of property textX.

getIconY

public double getIconY()
Getter for property iconY. The YC of the top left corner of the Allele Icon

Returns:
Value of property iconY.

setIconY

public void setIconY(double iconY)
Setter for property iconY. The YC of the top left corner of the Allele Icon

Parameters:
iconY - New value of property iconY.

getIconX

public double getIconX()
Getter for property iconX. The XC of the top left corner of the Allele Icon

Returns:
Value of property iconX.

setIconX

public void setIconX(double iconX)
Setter for property iconX. The XC of the top left corner of the Allele Icon

Parameters:
iconX - New value of property iconX.

getTextWidth

public double getTextWidth()
Getter for property textWidth.

Returns:
Value of property textWidth.

setTextWidth

public void setTextWidth(double textWidth)
Setter for property textWidth.

Parameters:
textWidth - New value of property textWidth.

getTextHeight

public double getTextHeight()
Getter for property textHeight.

Returns:
Value of property textHeight.

setTextHeight

public void setTextHeight(double textHeight)
Setter for property textHeight.

Parameters:
textHeight - New value of property textHeight.

getPaddedValue

public java.lang.String getPaddedValue()
Getter for property ID.

Returns:
A string of length 3 will be returned. If the allele value length is smaller than 3, the string will be left padded with spaces (" "). Null will be returned if the ID property is not set.

toPaint

public java.awt.Paint toPaint()
Convert current color value to an AWT color or paint object

Returns:
an AWT color object

toLong

public static long toLong(java.awt.Paint paint,
                          boolean ab_bgr)
Convert the paint to a long

Parameters:
ab_bgr - TRUE if blue is the least significant 8 bits in the color to be returned
paint - The color or paint. Must be non-null
Returns:
The color value in the form of a long in RGB format if ab_bgr is false or BGR if ab_bgr is true

toRGB

protected long toRGB()
Returns:
the color value in RGB format where Red makes up the least significant 8 bits

isRgb

public boolean isRgb()
Returns:
The current value of rgb property. TRUE will be returned if the color is in RGB format where RED is represented by the 8 least significant bits. FALSE otherwise

setRgb

public void setRgb(boolean rgb)
Set the RGB flag

Parameters:
rgb - The new value of rgb property. TRUE will be set if the color is to be in RGB format where RED is represented by the 8 least significant bits. FALSE otherwise

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setColor

public void setColor(java.awt.Paint color)
Set the new color for this Allel e

Parameters:
color - New value of property color.

getHatch

public int getHatch()
Returns:
The current value of the hatch property. If set, the allele will be rendered using a gradient of the hacth instead of using a color

setHatch

public void setHatch(int hatch)
Set the value of the hatch property. If set, the allele will be rendered using a gradient of the hacth instead of using a color

Parameters:
hatch - The new value of the hatch property

isInfer

public boolean isInfer()
Returns:
True if value if inferred. Otherwise return false

setInfer

public void setInfer(boolean infer)
Set to true if value if inferred. Otherwise set to false

Parameters:
infer - The new value for infer property

isIndet

public boolean isIndet()
Returns:
The current value of the indet property

setIndet

public void setIndet(boolean indet)
Parameters:
indet - The new value of the indet property the indet to set

getMaxChars

public int getMaxChars()
Get the maximum number of Characters for the Allele value. This class variabale can become important when the number of characters in the Allele Text/ID is heigher than the defualt of 3 chars and hennce needs to be factored in for proper rendering of the Allele Text and Icon


getInferredValue

public java.lang.String getInferredValue()
Convenience method for return the appropriate string of allele is inferred

Returns:
The value with the appropriate padding for inferred values