|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--AFLPcore.Data | +--AFLPcore.Gel
A gel contains most of the information needed by the program. It contains a set of lanes and a set of bins. Additionally, the gel contains methods to convert the lanes into an array which can be converted into an image. The image can be controlled by setting the size range, borders, and intensity. Note: the gel will NOT check to see if the size ranges specified are valid. The image can also be written out in a PPM image format. This format is not widely used, but it is easy to code. More formats may be added in the future. Finally, the gel can be written to an output stream as well as read in from an input stream. As mentioned before, this effectively writes all of the critical data for the program.
Bin
,
Lane
Constructor Summary | |
Gel()
Create a new Gel. |
Method Summary | |
void |
addBin(Bin bin)
Adds the specified bin to the gel. |
void |
addLane(Lane ln)
Adds a lane to this gel. |
Bin |
binAtSize(double size)
Gives the bin at the specified location. |
java.lang.Object |
clone()
Clones the gel Not Implemented. |
int |
getBackGroundColor()
Gives the color of the background for the gel. |
DataList |
getBins()
Gives a list of all the bins in the gel. |
int |
getGelTopBorder()
Gives the height of the border on the top and bottom of the gel image. |
double |
getGlobalMaxIntensity()
Gives the maximum intensity of the gel. |
double |
getIntensity()
Gives the height to which all values will be scaled to transform them into colors. |
int |
getLaneBorder()
Gives the spacing between two lanes in the gel image. |
DataList |
getLanes()
Gives a list of all of the lanes in the gel. |
int |
getLaneWidth()
Gives the width of a lane, in pixels. |
double |
getMaxIntensity(double minSize,
double maxSize)
Gives the maximum intensity in the gel between the two specified sizes. |
double |
getMaxSize()
Gives the largest size that will be included in the gel image when it is produced. |
double |
getMinSize()
Gives the smallest size that will be included in the gel image when it is produced. |
int |
getNumLanes()
Gives the number of lanes stored in this gel. |
int[] |
getPixels(double minSize,
double maxSize,
int length,
double maxHeight)
Gives an array of pixels that represents the gel as an image. |
int[] |
getPixels(int length)
Gives an array of pixels that represents the gel as an image. |
DataList |
getSelectedLanes()
Gives a list of all of the selected lanes in the gel. |
double |
getSizeInc()
Gives the size in bp represented by each pixel in the pixel array. |
Lane |
laneAt(int index)
Gives the lane at the specified index. |
void |
read(java.io.DataInputStream in)
Reads in the properties of this class from the specified input stream. |
void |
removeBin(Bin bin)
Removes the specified bin from the list of bins for this gel. |
void |
removeLane(Lane ln)
|
void |
setBackGroundColor(int color)
Set the background color to the specified value. |
void |
setGelTopBorder(int value)
Sets the border on the top and bottom of the gel image to the specified value. |
void |
setIntensity(double intensity)
Sets the intensity to the specified value. |
void |
setLaneBorder(int value)
Sets the spacing between lanes as well as the left and right border on the gel image. |
void |
setLaneWidth(int value)
Sets the width of a lane in the gel image. |
void |
setMaxSize(double maxSize)
Sets the largest size that will be included in the gel image when it is produced. |
void |
setMinSize(double minSize)
Sets the smallest size that will be included in the gel image when it is produced. |
void |
toggleSelectedLane(Lane ln)
Changes the selection state of the specified lane. |
void |
write(java.io.DataOutputStream out)
Writes all of the information this class needs to store in order to be recreated. |
protected void |
writeLane(int[] pix,
int length,
Lane lane,
int horzIndex,
int width,
double scaleFactor,
double maxSize)
Writes the specified lane data into the specified pixel array at the given location. |
void |
writePNG(java.io.DataOutputStream out)
Writes the gel image in a PNG format to the specified output stream. |
void |
writePPM(java.io.DataOutputStream out)
Writes the gel image in a PPM format to the specified output stream. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Gel()
Method Detail |
public void addLane(Lane ln)
ln
- the lane to addpublic void removeLane(Lane ln)
public Lane laneAt(int index)
public DataList getLanes()
public DataList getSelectedLanes()
public void toggleSelectedLane(Lane ln)
The list is updated when a lane is added by moving through every lane in the gel, seeing if it should be selected, and then adding it to a new list if it should. Finally, the new list becomes the list of selected lanes.
ln
- the lane to togglepublic void addBin(Bin bin)
bin
- the new bin, complete with size and width set.public void removeBin(Bin bin)
bin
- the bin to removepublic DataList getBins()
public Bin binAtSize(double size)
size
and checks to see if size is within that range. If it is not, the
first bin larger than size is checked in s similar manner.size
- the location to look for bins atnull
if no
such bin exists.public int[] getPixels(int length)
Image
using the
MemoryImageSource
. The array is one dimensional, with
the form value(x,y) = pix[y*width + x] The data in the lanes
of the gel are converted from heights to color values. The image
will represent the data from minSize to maxSize which where set
for this gel with setMinSize
and setMaxSize
.
The color scaling is contolled by the intensity with
setIntensity
.length
- the length in pixels of the image in the arraypublic int[] getPixels(double minSize, double maxSize, int length, double maxHeight)
Image
using the
MemoryImageSource
. The array is one dimensional, with
the form value(x,y) = pix[y*width + x] The data in the lanes
of the gel are converted from heights to color values. The image
will represent the data from minSize to maxSize.minSize
- the size of the smallest fragement to displaymaxSize
- the size of the largest tragement to displaylength
- the length, in pixels, of the gel image.maxHeight
- the value which will give the brightest color
Used to determine the color for the lane.writeLane(int[], int, AFLPcore.Lane, int, int, double, double)
,
MemoryImageSource
protected void writeLane(int[] pix, int length, Lane lane, int horzIndex, int width, double scaleFactor, double maxSize)
pix
- the array representing the imagelength
- the length in pixels of the lane on the imagelane
- the lane with the data of interesthorzIndex
- determines the horizontal position in the image
to write the lane to. It uses the laneWidth and
laneBorder as well.width
- the width of the image in the pixel arrayscaleFactor
- the value to multiply the height by to get the
color value, which maxes out at 255.maxSize
- the maximum size, in bp, for the lane. This size
will be the first value shown in the lane.public int getLaneWidth()
public void setLaneWidth(int value)
value
- the width in pixelsgetPixels(int)
public int getLaneBorder()
getPixels(int)
public void setLaneBorder(int value)
value
- the width of the spacing, in pixelsgetPixels(int)
public int getGelTopBorder()
getPixels(int)
public void setGelTopBorder(int value)
value
- the height of the border in pixelsgetPixels(int)
public double getMaxIntensity(double minSize, double maxSize)
minSize
- the lower bound for searching, in bpmaxSize
- the upper bound for searching, in bppublic double getGlobalMaxIntensity()
getMaxIntensity(double, double)
because this value is stored in the gel and updated only when
lanes are added. However, the slower method will scan for the
maximum in the current lanes and in a limited range.
- Returns:
- the maximum intensity
public int getNumLanes()
public double getSizeInc()
public double getMinSize()
getPixels(int)
public void setMinSize(double minSize)
minSize
- the size in bpgetPixels(int)
public double getMaxSize()
getPixels(int)
public void setMaxSize(double maxSize)
maxSize
- the size in bpgetPixels(int)
public double getIntensity()
getPixels(int)
public void setIntensity(double intensity)
intensity
- the new valuegetPixels(int)
public int getBackGroundColor()
public void setBackGroundColor(int color)
color
- the color as a 32-bit value, in the form 0xAARRGGBB, for
alpha, red, green, and blue components.public java.lang.Object clone()
clone
in class Data
public void writePPM(java.io.DataOutputStream out) throws java.io.IOException
getPixels
then that will be used to write the PPM. Otherwise, an image of
length 500 will be created.out
- the stream to write the PPM tojava.io.IOException
- occurs if problems writing to the stream are
incountered.public void writePNG(java.io.DataOutputStream out) throws java.io.IOException
getPixels
then that will be used to write the PNG. Otherwise, an image of
length 500 will be created.
To do the actual writing, the method uses a library produced by VisualTek. The library is specified in full here, as well as the java.awt.Image class. My thanks to them.
Java PNG by VisualTek Solutions Inc.
http://www.visualtek.com/PNG/
An image is created from the pixels and it is then passed to the libaray.
out
- the stream to write the PPM tojava.io.IOException
- occurs if problems writing to the stream are
incountered.public void write(java.io.DataOutputStream out) throws java.io.IOException
read
can recreate the essential properties of this
class.out
- the destination to write the data to.java.io.IOException
- occurs when a problem is encountered when
writing to the stream.public void read(java.io.DataInputStream in) throws java.io.IOException
write
. This
will retrieve this classes state from the input stream. All of the
current data in this class will be replaced by the data from the
stream.in
- the input stream with the data for the class.java.io.IOException
- occurs when a problem is encountered when
writing to the stream.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |