org.biojava.bio.chromatogram.graphic
Class FixedBaseWidthScaler

java.lang.Object
  extended by org.biojava.bio.chromatogram.graphic.FixedBaseWidthScaler
All Implemented Interfaces:
ChromatogramNonlinearScaler

public class FixedBaseWidthScaler
extends java.lang.Object
implements ChromatogramNonlinearScaler

A ChromatogramNonlinearScaler that scales all the base calls in a chromatogram to the same width in pixels, optionally biasing the peak of the call to the center.

Since:
1.3
Author:
Rhett Sutphin (UI CBCB), Matthew Pocock

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.biojava.bio.chromatogram.graphic.ChromatogramNonlinearScaler
ChromatogramNonlinearScaler.Identity
 
Constructor Summary
FixedBaseWidthScaler(float width)
          Creates a new scaler that will scale bases to the specified width without attempting to center their peaks.
FixedBaseWidthScaler(float width, boolean centerPeaks)
          Creates a new scaler that will scale bases to the specified width and may or may not bias the peaks to the center.
 
Method Summary
 float scale(Chromatogram c, int traceSampleIndex)
          Returns the remapped coordinate for the provided trace sample index of the given chromatogram.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedBaseWidthScaler

public FixedBaseWidthScaler(float width)
Creates a new scaler that will scale bases to the specified width without attempting to center their peaks.

Parameters:
width - the desired call width in pixels

FixedBaseWidthScaler

public FixedBaseWidthScaler(float width,
                            boolean centerPeaks)
Creates a new scaler that will scale bases to the specified width and may or may not bias the peaks to the center.

Parameters:
width - the desired call width in pixels
centerPeaks - if true, the scaler will try to put the peak of in the center of the scaled call. Otherwise, the whole call will be scaled using the same factor.
Method Detail

scale

public float scale(Chromatogram c,
                   int traceSampleIndex)
            throws java.lang.IndexOutOfBoundsException
Description copied from interface: ChromatogramNonlinearScaler
Returns the remapped coordinate for the provided trace sample index of the given chromatogram.

Specified by:
scale in interface ChromatogramNonlinearScaler
Parameters:
c - the Chromatogram
traceSampleIndex - the sample index
Returns:
the new coordinagte
Throws:
java.lang.IndexOutOfBoundsException