public class CompactQualityOnlyGraph extends Object implements ExtendedNucleotideGraph
NucleotideGraph.ImmutableGraphProvider| Constructor and Description |
|---|
CompactQualityOnlyGraph(byte[] qualities)
Constructs a new graph.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getChromatogramLength()
The number of points for which this graph has values, which is typically larger than the
length of the nucleotide sequence because a base isn't called at every position in the graph.
|
int |
getChromatogramPositionForResidue(int residueIndex)
The graph position (can be used as an argument to
NucleotideGraph.getChromatogramValue(int, int)) where the
nucleotide at the specified residue index has been called. |
int |
getChromatogramValue(int nucleotideStateNumber,
int graphPosition)
Returns the graph value for the specified nucleotide and at the specified position.
|
int |
getLeadingGapsLength()
Get the number of leading residues in the sequence this graph corresponds to that are all gaps.
|
int |
getSequenceLength()
The
length of the nucleotide sequence that can be annotated with this graph. |
int |
getSequenceQuality(int residueIndex)
Returns a measurement of confidence in the residue reported at the specified residueIndex in the sequence.
|
int |
getTrailingGapsLength()
Get the number of trailing residues in the sequence this graph corresponds to that are all gaps.
|
boolean |
hasChromatogramPositionsForResidues()
Tests whether this NucleotideGraph contains information about the position of the base calls,
i.e.
|
boolean |
hasChromatogramValues(int nucleotideStateNumber)
Specifies whether it is legal to call
NucleotideGraph.getChromatogramValue(int, int) for the specified nucleotide. |
boolean |
hasSequenceQualities()
Tests whether this graph contains information about the confidence in the associated sequence's
residues, i.e.
|
public CompactQualityOnlyGraph(byte[] qualities)
qualities - the qualities of the graph. The contents of this array must not change after calling this method. The quality values may be negative values (because Java bytes
range in value from -128 to +127). Negative byte values are interpreted as postive integers (by adding 256) when returned from getSequenceQuality(int).public boolean hasSequenceQualities()
NucleotideGraphNucleotideGraph.getSequenceQuality(int).hasSequenceQualities in interface NucleotideGraphNucleotideGraph.getSequenceQuality(int) on this graph.public int getSequenceQuality(int residueIndex)
throws IndexOutOfBoundsException,
UnsupportedOperationException
NucleotideGraphInteger.MIN_VALUE
if it is an end gap. If it is an internal gap, it should return the average quality of the non-gap positions
on either side of the gap.
This method may only be called if NucleotideGraph.hasSequenceQualities() returns true.getSequenceQuality in interface NucleotideGraphresidueIndex - A value 0 <= residueIndex < NucleotideGraph.getSequenceLength() specifying
the index in the nucleotide sequence for which to calculate the quality of the graph.IndexOutOfBoundsException - if residueIndex < 0 or residueIndex > NucleotideGraph.getSequenceLength().UnsupportedOperationException - if !hasSequenceQualities().public int getSequenceLength()
NucleotideGraphlength of the nucleotide sequence that can be annotated with this graph.
If a class implements both this interface and SequenceDocument, then the return value
of this method must be equal to getCharSequence().length()
Also if NucleotideGraph.hasChromatogramPositionsForResidues() or NucleotideGraph.hasSequenceQualities() is true, the return
value indicates the range of legal values to pass to NucleotideGraph.getChromatogramPositionForResidue(int)
and NucleotideGraph.getSequenceQuality(int).getSequenceLength in interface NucleotideGraphpublic int getChromatogramLength()
NucleotideGraphgetChromatogramLength in interface NucleotideGraphpublic int getChromatogramValue(int nucleotideStateNumber,
int graphPosition)
throws IndexOutOfBoundsException
NucleotideGraphNucleotideGraph.hasChromatogramValues(int) returns true for the
specified nucleotide.getChromatogramValue in interface NucleotideGraphnucleotideStateNumber - The nucleotide for which to retrieve the graph value, encoded as
0 = A, 1 = C, 2 = G, 3 = T (alphabetic order, same as in Nucleotides)graphPosition - The position in the sequence for which to query the graph value,
with 0 <= graphPosition < graph lengthIndexOutOfBoundsException - if graphPosition < 0 or graphPosition >= NucleotideGraph.getChromatogramLength()public boolean hasChromatogramValues(int nucleotideStateNumber)
NucleotideGraphNucleotideGraph.getChromatogramValue(int, int) for the specified nucleotide.hasChromatogramValues in interface NucleotideGraphnucleotideStateNumber - A nucleotide state number encoded in the same way as for NucleotideGraph.getChromatogramValue(int, int),
i.e. 0 = A, 1 = C, 2 = G, 3 = TNucleotideGraph.getChromatogramValue(int, int) for the specified nucleotidepublic int getChromatogramPositionForResidue(int residueIndex)
throws IndexOutOfBoundsException,
UnsupportedOperationException
NucleotideGraphNucleotideGraph.getChromatogramValue(int, int)) where the
nucleotide at the specified residue index has been called. This method may only be called if
NucleotideGraph.hasChromatogramPositionsForResidues() returns true.
The graph sites are guaranteed to have the same order as the sequence nucleotides. Therefore,
any implementation must ensure that if i < j, then
getChromatogramPositionForResidue(i) <= getChromatogramPositionForResidue(j).getChromatogramPositionForResidue in interface NucleotideGraphresidueIndex - A value 0 <= residueIndex < NucleotideGraph.getSequenceLength() specifying
the index in the nucleotide sequence for which to calculate the corresponding position in the graph.NucleotideGraph.getChromatogramLength(), specifiying the
graph position where the nucleotide that is at position residueIndex has been
called. For positions residueIndex where the
sequence
length consisting of values
between 0 and getChromatogramLength()-1 inclusive. For a residueIndex where the sequence holds
a '-', the returned site position must always be Integer.MIN_VALUE.IndexOutOfBoundsException - if residueIndex < 0 or residueIndex > NucleotideGraph.getSequenceLength().UnsupportedOperationException - if !hasChromatogramPositionsForResidues().public boolean hasChromatogramPositionsForResidues()
NucleotideGraphNucleotideGraph.getChromatogramPositionForResidue(int).hasChromatogramPositionsForResidues in interface NucleotideGraphpublic int getLeadingGapsLength()
ExtendedNucleotideGraphNucleotideGraph.getSequenceQuality(int) and NucleotideGraph.getChromatogramPositionForResidue(int) will both
return Integer.MIN_VALUE for residueIndices less than the number of leading gaps.
Note, an implementation may choose to return 0 from this method even if it has leading end gaps or any value less than or equal to the number of leading gaps it has.getLeadingGapsLength in interface ExtendedNucleotideGraphpublic int getTrailingGapsLength()
ExtendedNucleotideGraphNucleotideGraph.getSequenceQuality(int) and NucleotideGraph.getChromatogramPositionForResidue(int) will both
return Integer.MIN_VALUE for residueIndices within this much of NucleotideGraph.getSequenceLength().
Note, an implementation may choose to return 0 from this method even if it has trailing end gaps or any value less than or equal to the number of trailing gaps it has.getTrailingGapsLength in interface ExtendedNucleotideGraph