Interface NucleotideGraph
-
- All Known Subinterfaces:
ChromatogramDocument
,EditableNucleotideGraphSequenceDocument
,ExtendedNucleotideGraph
,NucleotideGraph.ImmutableGraphProvider
,NucleotideGraphSequenceDocument
- All Known Implementing Classes:
CombinedAlignmentAndNucleotideGraphSequenceDocument
,CompactQualityOnlyGraph
,DefaultNucleotideGraph
,DefaultNucleotideGraphSequence
,SequencePropertiesStorage
public interface NucleotideGraph
Optional phred-like
quality information
on the residues of a sequence, and an optional chromatogram graph.For some sequences such as 454 flowgrams, only phred-like quality information for each sequence residues exists. Other sequences, e.g. ABI traces, will have both the quality information and a chromatogram graph.
A chromatogram graph may exist for any subset of the four bases (A, C, G, T) (see
hasChromatogramValues(int)
). If a chromatogram exists, then its values are specified throughgetChromatogramValue(int, int)
. The positions in the chromatogram where the bases were called, i.e. which corresponds to positions in the sequence, are specified throughgetChromatogramPositionForResidue(int)
.Typically the site positions of the subsequent residues should be spaced regularly through the graph, but slight variations occur due to inaccuracies in the sequencing process. However, it is required that the positions for increasing residue indices also increase. It is not specified what Geneious will do if it encounters a NucleotideGraph that violates this requirement.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
NucleotideGraph.ImmutableGraphProvider
An interface a NucleotideGraph may implement to indicate it can provide an immutable instance of itself.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method 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 togetChromatogramValue(int, int)
) where the nucleotide at the specified residue index has been called.default int[]
getChromatogramPositionsForResidues(int startIndex, int endIndex)
int
getChromatogramValue(int nucleotideStateNumber, int graphPosition)
Returns the graph value for the specified nucleotide and at the specified position.default int[]
getChromatogramValues(int nucleotideStateNumber)
int
getSequenceLength()
Thelength
of the nucleotide sequence that can be annotated with this graph.default int[]
getSequenceQualities(int startIndex, int endIndex)
int
getSequenceQuality(int residueIndex)
Returns a measurement of confidence in the residue reported at the specified residueIndex in the sequence.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 callgetChromatogramValue(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.
-
-
-
Method Detail
-
getChromatogramValue
int getChromatogramValue(int nucleotideStateNumber, int graphPosition) throws java.lang.IndexOutOfBoundsException
Returns the graph value for the specified nucleotide and at the specified position. If the graph is a chromatogram, this is a measure of the support for the specified nucleotide at this position. May only be called ifhasChromatogramValues(int)
returns true for the specified nucleotide.- Parameters:
nucleotideStateNumber
- The nucleotide for which to retrieve the graph value, encoded as 0 = A, 1 = C, 2 = G, 3 = T (alphabetic order, same as inNucleotides
)graphPosition
- The position in the sequence for which to query the graph value, with 0 <= graphPosition <graph length
- Returns:
- the graph value for the specified nucleotide and at the specified position.
- Throws:
java.lang.IndexOutOfBoundsException
- if graphPosition < 0 or graphPosition >=getChromatogramLength()
java.lang.UnsupportedOperationException
- if!hasGaphValues(nucleotideStateNumber)
.
-
hasChromatogramValues
boolean hasChromatogramValues(int nucleotideStateNumber)
Specifies whether it is legal to callgetChromatogramValue(int, int)
for the specified nucleotide.- Parameters:
nucleotideStateNumber
- A nucleotide state number encoded in the same way as forgetChromatogramValue(int, int)
, i.e. 0 = A, 1 = C, 2 = G, 3 = T- Returns:
- true if is legal to call
getChromatogramValue(int, int)
for the specified nucleotide - Throws:
java.lang.IllegalArgumentException
- if nucleotideStateNumber < 0 or nucleotideStateNumber > 3. It is not guaranteed that this exception will ever be thrown, even if the arguments are illegal.
-
getChromatogramPositionForResidue
int getChromatogramPositionForResidue(int residueIndex) throws java.lang.IndexOutOfBoundsException, java.lang.UnsupportedOperationException
The graph position (can be used as an argument togetChromatogramValue(int, int)
) where the nucleotide at the specified residue index has been called. This method may only be called ifhasChromatogramPositionsForResidues()
returns true. The graph sites are guaranteed to have the same order as the sequence nucleotides. Therefore, any implementation must ensure that ifi < j
, thengetChromatogramPositionForResidue(i) <= getChromatogramPositionForResidue(j)
.- Parameters:
residueIndex
- A value0 <= residueIndex <
specifying the index in the nucleotide sequence for which to calculate the corresponding position in the graph.getSequenceLength()
- Returns:
- A value in the range 0 <= value <
getChromatogramLength()
, specifiying the graph position where the nucleotide that is at positionresidueIndex
has been called. For positionsresidueIndex
where thesequence
length
consisting of values between 0 and getChromatogramLength()-1 inclusive. For a residueIndex where the sequenceholds
a '-', the returned site position must always beInteger.MIN_VALUE
. - Throws:
java.lang.IndexOutOfBoundsException
- if residueIndex < 0 or residueIndex >getSequenceLength()
.java.lang.UnsupportedOperationException
- if !hasChromatogramPositionsForResidues().
-
hasChromatogramPositionsForResidues
boolean hasChromatogramPositionsForResidues()
Tests whether this NucleotideGraph contains information about the position of the base calls, i.e. whether it is legal to callgetChromatogramPositionForResidue(int)
.- Returns:
- true if this NucleotideGraph contains information about the position of the base calls.
-
getSequenceQuality
int getSequenceQuality(int residueIndex) throws java.lang.IndexOutOfBoundsException, java.lang.UnsupportedOperationException
Returns a measurement of confidence in the residue reported at the specified residueIndex in the sequence. The measure is on a logaritmic scale: P(call correct) = 1 - 10^(-v/10) where v is the quality returned from this method. If the sequence contains a gap at the specified position, this method should returnInteger.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 ifhasSequenceQualities()
returns true.- Parameters:
residueIndex
- A value0 <= residueIndex <
specifying the index in the nucleotide sequence for which to calculate the quality of the graph.getSequenceLength()
- Returns:
- The quality score v for the residue at the specified index in the nucleotide sequence, which indicates the reliability of the nucleotide on a logarithmic scale as described above. For all positions other than end-gaps, this must be non-negative (since below 0 would imply a negative probability)
- Throws:
java.lang.IndexOutOfBoundsException
- if residueIndex < 0 or residueIndex >getSequenceLength()
.java.lang.UnsupportedOperationException
- if !hasSequenceQualities().
-
hasSequenceQualities
boolean hasSequenceQualities()
Tests whether this graph contains information about the confidence in the associated sequence's residues, i.e. whether it is legal to callgetSequenceQuality(int)
.- Returns:
- true if it is legal to call
getSequenceQuality(int)
on this graph.
-
getSequenceLength
int getSequenceLength()
Thelength
of the nucleotide sequence that can be annotated with this graph. If a class implements both this interface andSequenceDocument
, then the return value of this method must be equal togetCharSequence()
.length()
Also ifhasChromatogramPositionsForResidues()
orhasSequenceQualities()
is true, the return value indicates the range of legal values to pass togetChromatogramPositionForResidue(int)
andgetSequenceQuality(int)
.- Returns:
- length of the nucleotide sequence belonging to this graph.
-
getChromatogramLength
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.- Returns:
- the length of this graph, or 0 if this graph has no graph values for any nucleotide (i.e. 0 if
hasChromatogramPositionsForResidues()
is false).
-
getChromatogramValues
default int[] getChromatogramValues(int nucleotideStateNumber)
- Parameters:
nucleotideStateNumber
- The nucleotide for which to retrieve the graph value, encoded as 0 = A, 1 = C, 2 = G, 3 = T (alphabetic order, same as inNucleotides
)- Returns:
- all the values returned from
getChromatogramValue(int, int)
for this nucleotideStateNumber for all indices in the range 0 togetChromatogramLength()
(exclusive) or null ifhasChromatogramValues(int)
==false for this nucleotideStateNumber. - Since:
- API 4.202510 (Geneious 2025.1.0)
-
getSequenceQualities
default int[] getSequenceQualities(int startIndex, int endIndex)
- Parameters:
startIndex
- the 0-based start residue index (inclusive)endIndex
- the 0-based end residue index (exclusive)- Returns:
- all the values returned from
getSequenceQuality(int)
for all residues indices in the range startIndex (inclusive) to endIndex (exclusive) or null ifhasSequenceQualities()
==false. - Since:
- API 4.202510 (Geneious 2025.1.0)
-
getChromatogramPositionsForResidues
default int[] getChromatogramPositionsForResidues(int startIndex, int endIndex)
- Parameters:
startIndex
- the 0-based start residue index (inclusive)endIndex
- the 0-based end residue index (exclusive)- Returns:
- all the values returned from
getChromatogramPositionForResidue(int)
for all residues indices in the range startIndex (inclusive) to endIndex (exclusive) or null ifhasChromatogramPositionsForResidues()
==false. - Since:
- API 4.202510 (Geneious 2025.1.0)
-
-