Package org.biojava.bio.chromatogram
Class SimpleChromatogram
- java.lang.Object
-
- org.biojava.bio.chromatogram.AbstractChromatogram
-
- 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 aChromatogram
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
Constructors Constructor Description SimpleChromatogram()
Creates a new instance of SimpleChromatogram.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearTraceValues()
Sets all the traces to null.protected AbstractChromatogram
reverseComplementInstance()
Returns a new instance of this AbstractChromatogram subclass for use inAbstractChromatogram.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
-
-
-
-
Constructor Detail
-
SimpleChromatogram
public SimpleChromatogram()
Creates a new instance of SimpleChromatogram.
-
-
Method Detail
-
setSymbolLists
public void setSymbolLists(SymbolList dna, SymbolList offsets) throws IllegalAlphabetException, 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 chromatogramoffsets
- a symbol list in an integer or sub-integer alphabet that contains the locations in the chromatogram for the bases called indna
- Throws:
IllegalAlphabetException
- when the alphabets aren't as specifiedIllegalArgumentException
- when the lists aren't the same length
-
setTraceValues
public void setTraceValues(AtomicSymbol nuc, int[] trace, int maxVal) throws 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 toAbstractChromatogram.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 anIllegalArgumentException
.- Parameters:
nuc
- the nucleotide for which to set the tracetrace
- the sampled intensities along the tracemaxVal
- the maximum value on the trace, orInteger.MIN_VALUE
to force this method to calculate it- Throws:
IllegalArgumentException
- when trace.length is different from any of the existing (non-null) tracesIllegalSymbolException
- 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 inAbstractChromatogram.reverseComplement()
.- Specified by:
reverseComplementInstance
in classAbstractChromatogram
- Returns:
- a reverse-complemented AbstractChromatogram
-
-