org.biojava.bio.chromatogram
Class SimpleChromatogram

java.lang.Object
  extended by org.biojava.bio.chromatogram.AbstractChromatogram
      extended by org.biojava.bio.chromatogram.SimpleChromatogram
All Implemented Interfaces:
Chromatogram

public class SimpleChromatogram
extends AbstractChromatogram

A basic chromatogram implementation which provides public mutators for setting the various attributes of the chromatogram.

In general, new chromatogram implementations should be derived from AbstractChromatogram, not this class, as it is generally undesirable to allow the internal structures of a Chromatogram to be manipulated externally. This class could still be useful, however, for programatically generated "chromatograms".

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

Field Summary
 
Fields inherited from interface org.biojava.bio.chromatogram.Chromatogram
DNA, OFFSETS
 
Constructor Summary
SimpleChromatogram()
          Creates a new instance of SimpleChromatogram.
 
Method Summary
 void clearTraceValues()
          Sets all the traces to null.
protected  AbstractChromatogram reverseComplementInstance()
          Returns a new instance of this AbstractChromatogram subclass for use in AbstractChromatogram.reverseComplement().
 void setSignificantBits(int bits)
          Sets the number of significant bits in the data.
 void setSymbolLists(SymbolList dna, SymbolList offsets)
          Set the DNA and OFFSETS symbol lists for the basecall alignment.
 void setTraceValues(AtomicSymbol nuc, int[] trace, int maxVal)
          Sets the trace array for one of the DNA nucleotides.
 
Methods inherited from class org.biojava.bio.chromatogram.AbstractChromatogram
clearTraces, createImmutableAlignment, createImmutableSymbolList, getBaseCalls, getMax, getMax, getSequenceLength, getSignificantBits, getTrace, getTraceLength, reverse, reverseComplement, reverseComplementBaseCallList, reverseComplementBaseCalls, setBaseCallAlignment, setBits, setTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleChromatogram

public SimpleChromatogram()
Creates a new instance of SimpleChromatogram.

Method Detail

setSymbolLists

public void setSymbolLists(SymbolList dna,
                           SymbolList offsets)
                    throws IllegalAlphabetException,
                           java.lang.IllegalArgumentException
Set the DNA and OFFSETS symbol lists for the basecall alignment. Beware: this method does no consistency checks to be sure that all the offsets are valid indices into the trace arrays.

Parameters:
dna - a symbol list in the DNA alphabet that contains the base calls for this chromatogram
offsets - a symbol list in an integer or sub-integer alphabet that contains the locations in the chromatogram for the bases called in dna
Throws:
IllegalAlphabetException - when the alphabets aren't as specified
java.lang.IllegalArgumentException - when the lists aren't the same length

setTraceValues

public void setTraceValues(AtomicSymbol nuc,
                           int[] trace,
                           int maxVal)
                    throws java.lang.IllegalArgumentException,
                           IllegalSymbolException
Sets the trace array for one of the DNA nucleotides. The provided array will not be copied, so any modifications to it will be reflected in calls to AbstractChromatogram.getTrace(org.biojava.bio.symbol.AtomicSymbol).

If you need to set a new set of traces whose length is different from the old set, you must call clearTraceValues() first, or you will provoke an IllegalArgumentException.

Parameters:
nuc - the nucleotide for which to set the trace
trace - the sampled intensities along the trace
maxVal - the maximum value on the trace, or Integer.MIN_VALUE to force this method to calculate it
Throws:
java.lang.IllegalArgumentException - when trace.length is different from any of the existing (non-null) traces
IllegalSymbolException - when nuc is not a concrete DNA nucleotide

clearTraceValues

public void clearTraceValues()
Sets all the traces to null.


setSignificantBits

public void setSignificantBits(int bits)
Sets the number of significant bits in the data.

Parameters:
bits - how many bits of the trace samples are significant
See Also:
Chromatogram.getSignificantBits()

reverseComplementInstance

protected AbstractChromatogram reverseComplementInstance()
Description copied from class: AbstractChromatogram
Returns a new instance of this AbstractChromatogram subclass for use in AbstractChromatogram.reverseComplement().

Specified by:
reverseComplementInstance in class AbstractChromatogram
Returns:
a reverse-complemented AbstractChromatogram