public abstract class AbstractChromatogram extends Object implements Chromatogram
Chromatogram
. Provides
protected setters so that subclasses may set the value of the various
properties of a chromatogram.
Chromatograms should be created using ChromatogramFactory
or a
parser for a particular file format.DNA, OFFSETS
Constructor and Description |
---|
AbstractChromatogram()
Create a new AbstractChromatogram.
|
Modifier and Type | Method and Description |
---|---|
protected void |
clearTraces()
Sets the trace data structures to null.
|
protected Alignment |
createImmutableAlignment(Map labelsToSymLists)
A factory method for creating new immutable alignments, particularly
for use as base call alignments.
|
protected SymbolList |
createImmutableSymbolList(Alphabet alpha,
List syms)
A factory method for creating new symbol lists with a given alphabet.
|
Alignment |
getBaseCalls()
Return the total number of base calls.
|
int |
getMax()
Gets the max intensity from all the traces.
|
int |
getMax(AtomicSymbol nucleotide)
Gets the max intensity on the trace for the specified nucleotide.
|
int |
getSequenceLength()
Return the sequence length.
|
int |
getSignificantBits()
Return the number of significant bits.
|
int[] |
getTrace(AtomicSymbol nucleotide)
Returns an array containing the intensities of the sampled waveform
representing the chromatogram trace for base
nucleotide . |
int |
getTraceLength()
Returns the length of the trace of the Chromatogram.
|
protected static int[] |
reverse(int[] src)
Utility method for reversing an int[] array.
|
Chromatogram |
reverseComplement()
Returns a new
Chromatogram representing the reverse
complement of this one. |
protected SymbolList |
reverseComplementBaseCallList(Object label)
Return a symbol list containing the reverse complement of the base call
data for the given label.
|
protected Alignment |
reverseComplementBaseCalls()
Returns a new base call alignment that is the reverse complement of
one in this chromatogram.
|
protected abstract AbstractChromatogram |
reverseComplementInstance()
Returns a new instance of this AbstractChromatogram subclass for use in
reverseComplement() . |
protected void |
setBaseCallAlignment(Alignment align)
Provides the list of base calls.
|
protected void |
setBits(int bits)
Sets the number of significant bits in the trace samples.
|
protected void |
setTrace(AtomicSymbol nuc,
int[] trace,
int maxVal)
Provides the trace samples for a particular nucleotide.
|
public AbstractChromatogram()
public int[] getTrace(AtomicSymbol nucleotide) throws IllegalSymbolException
Chromatogram
nucleotide
.
This may be a reference the actual internal representation of the
samples, so callers must not modify it.
The resulting array for each nucleotide must be Chromatogram.getTraceLength()
int
s long.
getTrace
in interface Chromatogram
nucleotide
- the trace to examine. Must be the symbol for A, C, G, or T
as provided by DNATools
IllegalSymbolException
- if nucleotide
isn't in the DNA alphabetpublic int getTraceLength()
Chromatogram
getTraceLength
in interface Chromatogram
Chromatogram.getTrace(AtomicSymbol)
public int getMax()
Chromatogram
Chromatogram.getMax(AtomicSymbol)
on each
of the four non-ambiguous DNA nucleotides.getMax
in interface Chromatogram
public int getMax(AtomicSymbol nucleotide) throws IllegalSymbolException
Chromatogram
getMax
in interface Chromatogram
nucleotide
- the trace to examine. Must be a concrete
(non-ambiguous) nucleotide from the DNA alphabetIllegalSymbolException
- when the nucleotide isn't from the DNA
alphabetpublic Alignment getBaseCalls()
getBaseCalls
in interface Chromatogram
public int getSequenceLength()
getSequenceLength
in interface Chromatogram
public int getSignificantBits()
getSignificantBits
in interface Chromatogram
protected final void setBaseCallAlignment(Alignment align) throws IllegalAlphabetException, IllegalArgumentException, NoSuchElementException
align
- the base call alignmentNoSuchElementException
- when align doesn't contain alignments with
the required DNA and OFFSETS labelsIllegalArgumentException
- the lists in align aren't all the same length.IllegalAlphabetException
- if the required lists don't have the
correct alphabets. See the documentation of
Chromatogram.getBaseCalls()
for details.Chromatogram.getBaseCalls()
protected final void clearTraces()
protected final void setTrace(AtomicSymbol nuc, int[] trace, int maxVal) throws IllegalArgumentException, IllegalSymbolException
nuc
- A DNA nucleotidetrace
- the trace samples themselvesmaxVal
- the maximum value in the trace array. If this value
is Integer.MIN_VALUE
, this method will do a linear
search of trace to determine the max.IllegalArgumentException
- when trace.length is different
from any of the existing (non-null) tracesIllegalSymbolException
- when nuc is not a concrete DNA nucleotideprotected final void setBits(int bits) throws IllegalArgumentException
bits
- a non-negative integer indicating the number of
significant bits in each trace sampleIllegalArgumentException
- when bits
is negativeprotected abstract AbstractChromatogram reverseComplementInstance()
reverseComplement()
.public Chromatogram reverseComplement()
Chromatogram
Chromatogram
representing the reverse
complement of this one.
Implementors should copy the metadata about the chromatogram (i.e., base calls) as is appropriate to their formats.
reverseComplement
in interface Chromatogram
protected Alignment reverseComplementBaseCalls()
reverseComplementBaseCallList(java.lang.Object)
for each label in the current
base call alignment. When that method returns null, no list will
appear in reverse complement base call alignment with the null-provoking
label. For this reason, subclasses are encouraged to override
reverseComplementBaseCallList(java.lang.Object)
to handle any additional per-base
metadata that they store.
This implementation should be safely inheritable for all chromatogram implementations, unless one just doesn't want base calls on its reverse complement output. If this is the case, it should override this method to return null.
Alignment
that is the reverse complement of the
one in the current chromatogramprotected SymbolList reverseComplementBaseCallList(Object label)
Implementation note: subclasses which do not use an IntegerAlphabet
for
their offsets lists must override this method, at least for the case where
label ==
.
Chromatogram.OFFSETS
label
- the label Objectprotected SymbolList createImmutableSymbolList(Alphabet alpha, List syms) throws IllegalSymbolException, ClassCastException
alpha
- the Alphabet
for the new listsyms
- the symbols to put in the new listIllegalSymbolException
- when alpha and syms are incompatibleClassCastException
- when any object in syms isn't a Symbolprotected Alignment createImmutableAlignment(Map labelsToSymLists) throws IllegalArgumentException, ClassCastException
labelsToSymLists
- a Map
whose keys are desired labels
for the alignment and whose values are the SymbolLists.
All the SymbolLists must be the same length.IllegalArgumentException
- if the lists aren't all the same lengthClassCastException
- if any of the values in the map aren't
SymbolListsprotected static final int[] reverse(int[] src)
src
- the source arrayCopyright © 2014 BioJava. All rights reserved.