AFLPcore
Class Lane

java.lang.Object
  |
  +--AFLPcore.Data
        |
        +--AFLPcore.Lane

public class Lane
extends Data

This class represents a lane. A lane contains a trace, as well as a sample name, a gel name (for the original gel), a lane number, a lane index (which is unique to a lane), cutoffs, and peaks.

The trace consists of a bunch of points indicating the height at. The first point will contain the height at time=0, the next point will be at time=timeInc, and so on. These different time increments are called scan numbers throughout the program. (The ABI 377 scans a point in the gel every 1.6 seconds.) The lane must also have a SizeFunction, which is used to convert between scan numbers and sizes in bp. The lane can actually contain two traces. One is the raw data trace, which should not be modified, and the other is the normalized trace. Normalization is not provided in the lane file, but can be added as either a GelOperation or a LaneOperation. This allows easy implementation of different normilization algorithms.

The lane also contains a list of Cutoffs. These are used to help locate peaks and to score bins. Each cutoff is defined by a starting position. A cutoff will apply to the region between its start position and either the start of the next cutoff in the lane or until the end of the lane. The list of cutoffs is sorted by start location.

The lane also contains a list of defined peaks. This list can be obtained and then manipulated by calling getPeaks(). Again the lane itself does not find the peaks, but relies on other parts of the program to find them. This allows the peak locating algorithm to be changed easily.

See Also:
SizeFunction, Cutoff, Operation

Field Summary
static int BLUE
          Constant for lane color
static int GREEN
          Constant for lane color
static int NORMALIZED
          Constant to tell which type of trace the lane is using.
static int ORIGINAL
          Constant to tell which type of trace the lane is using.
static int RED
          Constant for lane color
static int YELLOW
          Constant for lane color
 
Constructor Summary
Lane(double[] trace)
          Create a new lane with the specified trace.
 
Method Summary
 void addCutoff(Cutoff ct)
          Adds the specified cutoff to the list of known cutoffs for this lane.
 java.lang.Object clone()
          Clones this lane Not implemented
 Cutoff cutoffUnder(double size)
          Gives the first cutoff in the lane that is less than or equal to the specified size.
 int getColor()
          Gives the color of the data in this lane.
 DataList getCutoffs()
          Returns the list of cutoffs associated with this lane.
 java.lang.String getGelName()
          Gives the name of the Gel that this lane was extracted from.
 double getHeightAt(double size)
          Gives the intensity of the light for the color at the specified size.
 int getLaneIndex()
          Gives an integer that is unique to this lane.
 int getLaneNumber()
          Gives the number of the lane on the gel that contianed this information.
 double getMaxGlobalHeight()
          Gives the maximum height in the lane
 double getMaxHeight(double minSize, double maxSize)
          Gives the maximum height in the specified range.
 TracePoint getMaxPoint(double minSize, double maxSize)
          Gives the maximum point, (size, height) ,in the specified range.
 double getMaxSize()
          Gives the largest size, in bp, represented by this lane.
 double getMinSize()
          Gives the smallest size, in bp, represented by this lane.
 java.lang.String getName()
          Gives the name of the sample run on this lane.
 int getNumPoints()
          This returns the number of points in the trace.
 DataList getPeaks()
          Gives the list of peaks in the lane.
 DataList getPeaksInRange(double min, double max)
          Produces a list of peaks that are in the given range.
 SizeFunction getSizeFunction()
          Gives the object that represents the conversion between size in bp and scan number (trace index).
 double getTotalSignal()
          Gives the strength of the signal for this lane.
 double[] getTrace()
          Gives the current trace for this lane, which is either the normalized trace or the raw trace.
 int hashCode()
          Gives an integer that is equivalent to the lane index, which is a unique number for this lane.
 void read(java.io.DataInputStream in)
          Reads in the properties of this class from the specified input stream.
 void setColor(int color)
          Set the color channel used with this lane to the specified value.
 void setGelName(java.lang.String newName)
          Set the name of the gel that the lane was on to the specified value.
 void setLaneNumber(int newLaneNum)
          Set the lane number of this lane to the specified value.
 void setName(java.lang.String newName)
          Set the name of the sample run on this lane to the specified string.
 void setNormTrace(double[] trace)
          Set the normalized trace to the specified trace.
 void setSizeFunction(SizeFunction sizeFunction)
          Set the size curve/function to be used by this lane.
 void useTrace(int trace_num)
          Sets the trace to be used when retrieving height, finding peaks, etc.
 void write(java.io.DataOutputStream out)
          Writes all of the information this class needs to store in order to be recreated.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

YELLOW

public static final int YELLOW
Constant for lane color

RED

public static final int RED
Constant for lane color

BLUE

public static final int BLUE
Constant for lane color

GREEN

public static final int GREEN
Constant for lane color

ORIGINAL

public static final int ORIGINAL
Constant to tell which type of trace the lane is using.

NORMALIZED

public static final int NORMALIZED
Constant to tell which type of trace the lane is using.
Constructor Detail

Lane

public Lane(double[] trace)
Create a new lane with the specified trace. The default name will be "unknown", the gelName will be "__", and the laneNum will be 0. These can and should be changed with the setParamName methods.
Parameters:
trace - each value represent the intensity of the light read at a given point, either scan or size. This should be a raw trace, not a normalized one.
Method Detail

getHeightAt

public double getHeightAt(double size)
Gives the intensity of the light for the color at the specified size. This also corresponds to the height of a trace. The trace can either be the normalized trace or the original trace, depending on what the current trace is set to.
Parameters:
size - the location of interest, specified in bp
Returns:
the value of the trace at the given point. -1 will be returned if the specified point is not in the Lane.
See Also:
useTrace(int)

getName

public final java.lang.String getName()
Gives the name of the sample run on this lane. This can be set using setName.
Returns:
the name, "unknown" by default

setName

public final void setName(java.lang.String newName)
Set the name of the sample run on this lane to the specified string.
Parameters:
newName - the value to set the name to.

getGelName

public final java.lang.String getGelName()
Gives the name of the Gel that this lane was extracted from. This can be set using setGelName.
Returns:
the gel name, "__" by default

setGelName

public final void setGelName(java.lang.String newName)
Set the name of the gel that the lane was on to the specified value.
Parameters:
newName - the value to set the name to.

getLaneNumber

public final int getLaneNumber()
Gives the number of the lane on the gel that contianed this information. return the lane number

setLaneNumber

public final void setLaneNumber(int newLaneNum)
Set the lane number of this lane to the specified value.
Parameters:
newName - the value to set the lane number to to.

getColor

public final int getColor()
Gives the color of the data in this lane. Possible values are RED, YELLOW, GREEN, and BLUE, which are defined in this class.
Returns:
the color of this lane.

setColor

public final void setColor(int color)
Set the color channel used with this lane to the specified value.
Parameters:
the - color, possible values are given in this class.

getSizeFunction

public SizeFunction getSizeFunction()
Gives the object that represents the conversion between size in bp and scan number (trace index).
Returns:
the size object

setSizeFunction

public void setSizeFunction(SizeFunction sizeFunction)
Set the size curve/function to be used by this lane.
Parameters:
sizeFunction - the new way to convert between scan number and size

getPeaksInRange

public DataList getPeaksInRange(double min,
                                double max)
Produces a list of peaks that are in the given range. That is, for the peak location, x, min <= x <= max must be true. For every such peak, the peak is added to the list, which is sorted.
Parameters:
min - the minimum size in bp
max - the maximum size in bp
Returns:
a list of peaks in the range. If there are no peaks, the list will be empty.

getPeaks

public DataList getPeaks()
Gives the list of peaks in the lane.
Returns:
the peak list.

getMaxHeight

public double getMaxHeight(double minSize,
                           double maxSize)
Gives the maximum height in the specified range.
Parameters:
minSize - the size in bp of the lower bound
maxSize - the size in bp of the upper bound
Returns:
the maximum intensity, -1 if maxSize < minSize or if the sizes are out of bounds.

getMaxGlobalHeight

public double getMaxGlobalHeight()
Gives the maximum height in the lane
Returns:
the maximum height

getMaxPoint

public TracePoint getMaxPoint(double minSize,
                              double maxSize)
Gives the maximum point, (size, height) ,in the specified range.
Parameters:
minSize - the size in bp of the lower bound
maxSize - the size in bp of the upper bound
Returns:
the maximum intensity point, -1 for the height if maxSize < minSize or if the sizes are out of bounds.

getNumPoints

public int getNumPoints()
This returns the number of points in the trace. Therefore, anything that attempts to display more information than this will simply be scaling the points, instead of accessing intermedite points. However, since the trace can be 4000+ points long, that's a little hard to display in one image.
Returns:
the number of data points in the trace.

useTrace

public void useTrace(int trace_num)
Sets the trace to be used when retrieving height, finding peaks, etc. The trace can either be the original trace that came from some input file, or the normalized trace.
Parameters:
trace_num - indicates which trace to use, possiblities are ORIGINAL or NORMALIZED
Throws:
java.lang.IllegalArgumentException - occurs when trace_num is not one of the excepted values.
NoDataError - occurs if this lane has not yet been normalized. If this is the case, then the normalized trace does not exist and therefore cannot be used.

setNormTrace

public void setNormTrace(double[] trace)
Set the normalized trace to the specified trace.
Parameters:
trace - the normalized version of the raw trace.

getTrace

public double[] getTrace()
Gives the current trace for this lane, which is either the normalized trace or the raw trace. The raw trace should NOT modified. Access is granted to it only to make creating a normalized trace easier.
Returns:
the lane trace
See Also:
useTrace(int)

getLaneIndex

public int getLaneIndex()
Gives an integer that is unique to this lane.
Returns:
an integer which identifies this lane.

hashCode

public int hashCode()
Gives an integer that is equivalent to the lane index, which is a unique number for this lane.
Overrides:
hashCode in class java.lang.Object
Returns:
a code suitable for a hashtable.

getMaxSize

public double getMaxSize()
Gives the largest size, in bp, represented by this lane. Any size greater than this will not be in the lane data. Warning: If there is a round off error in the sizing function, converting the maximum size back into a value may result in exceeding the data size. This is of course depended on the size function.
Returns:
the maximum size

getMinSize

public double getMinSize()
Gives the smallest size, in bp, represented by this lane. Any size less than this will not be in the lane data. Warning: If there is a round off error in the sizing function, converting the minimum size back into a value may result in an out of bounds problem. This is of course depended on the size function.
Returns:
the minimum size

clone

public java.lang.Object clone()
Clones this lane Not implemented
Overrides:
clone in class Data

getTotalSignal

public double getTotalSignal()
Gives the strength of the signal for this lane. The signal stength is found by summing every point in the trace. It is in effect, the area of the trace curve.
Returns:
a value equal to the strength of the signal in the lane.

getCutoffs

public DataList getCutoffs()
Returns the list of cutoffs associated with this lane.
Returns:
the list, empty if there are no cutoffs set

addCutoff

public void addCutoff(Cutoff ct)
Adds the specified cutoff to the list of known cutoffs for this lane. Any cutoff can contian multiple levels.
Parameters:
ct - the cutoff to be added.

cutoffUnder

public Cutoff cutoffUnder(double size)
Gives the first cutoff in the lane that is less than or equal to the specified size.
Parameters:
size - the size which the cutoff must be lower than
Returns:
the first such cutoff found, null if none exists.

write

public void write(java.io.DataOutputStream out)
           throws java.io.IOException
Writes all of the information this class needs to store in order to be recreated. This will be used for things like storing the class in a file. Therefore, the write should output enough information so that read can recreate the essential properties of this class.
Parameters:
out - the destination to write the data to.
Throws:
java.io.IOException - occurs when a problem is encountered when writing to the stream.

read

public void read(java.io.DataInputStream in)
          throws java.io.IOException
Reads in the properties of this class from the specified input stream. The stream data should have been created by 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.
Parameters:
in - the input stream with the data for the class.
Throws:
java.io.IOException - occurs when a problem is encountered when writing to the stream.