Class DefaultNucleotideGraph
- java.lang.Object
-
- com.biomatters.geneious.publicapi.documents.sequence.DefaultNucleotideGraph
-
- All Implemented Interfaces:
ExtendedNucleotideGraph
,NucleotideGraph
public final class DefaultNucleotideGraph extends java.lang.Object implements ExtendedNucleotideGraph
ANucleotideGraph
that stores its values in int[] arrays internally, and allows getting and setting those arrays.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.biomatters.geneious.publicapi.documents.sequence.NucleotideGraph
NucleotideGraph.ImmutableGraphProvider
-
-
Field Summary
Fields Modifier and Type Field Description static int
EDITED_NUCLEOTIDE_QUALITY
The quality score assigned to a nucleotide which is edited in a sequence with quality.
-
Constructor Summary
Constructors Constructor Description DefaultNucleotideGraph(int[][] chromatogramValues, int[] chromatogramPositionsForResidues, int[] sequenceQualities, int sequenceLength, int chromatogramLength)
Construct a new DefaultNucleotideGraph.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DefaultNucleotideGraph
copyOf(NucleotideGraph graph)
Creates a copy of the given graph.static ExtendedNucleotideGraph
createGraphWithAdjustedEndGaps(ExtendedNucleotideGraph originalGraph, int newLeadingGapsLength, int newTrailingGapsLength)
Creates a copy of the given graph with the length of its end gaps adjusted.static NucleotideGraph
createNucleotideGraph(int[][] chromatogramValues, int[] chromatogramPositionsForResidues, int[] sequenceQualities, int sequenceLength, int chromatogramLength)
Creates a new nucleotide graph.static NucleotideGraph
createNucleotideGraph(int[][] chromatogramValues, int[] chromatogramPositionsForResidues, int[] sequenceQualities, int sequenceLength, int chromatogramLength, int leadingGapsLength, int trailingGapsLength)
Creates a new nucleotide graph.static NucleotideGraph
createNucleotideGraph(int[] internalQualities, int leadingGapsLength, int trailingGapsLength)
Creates a new nucleotide graph with qualities but no traces.static NucleotideGraph
createNucleotideGraph(NucleotideGraph graphToCopy)
Creates a deep copy of the given graph.static ExtendedNucleotideGraph
createNucleotideGraphAdjustedForGapInsertion(NucleotideGraph graphToCopy, java.lang.CharSequence charSequence)
Creates a deep copy of the given graph with all graph values adjusted to compensate for gap insertion as indicated by the presense of gaps in charSequence.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 toNucleotideGraph.getChromatogramValue(int, int)
) where the nucleotide at the specified residue index has been called.static int[]
getChromatogramPositionsForResidues(NucleotideGraph graph)
Equivalent to callinggetChromatogramPositionsForResidues(graph,0,graph.getSequenceLength())
static int[]
getChromatogramPositionsForResidues(NucleotideGraph graph, int startIndex, int endIndex)
Get all the values returned fromNucleotideGraph.getChromatogramPositionForResidue(int)
for all residues indices in the range startIndex (inclusive) to endIndex (exclusive).int
getChromatogramValue(int nucleotideStateNumber, int graphPosition)
Returns the graph value for the specified nucleotide and at the specified position.static int[][]
getChromatogramValues(NucleotideGraph graph)
static int[]
getChromatogramValues(NucleotideGraph graph, int i)
DefaultNucleotideGraph
getGraphAdjustedForDeletion(int firstResidueIndex, int lastResidueIndexExclusive, SequenceCharSequence newCharSequence)
Returns a new graph equivalent to this one, but adjusted to take into account a deletion from the associated sequence.DefaultNucleotideGraph
getGraphAdjustedForInsertion(int residueIndex, java.lang.CharSequence insertedChars)
Returns a new graph equivalent to this one, but adjusted to take into account an insertion into the associated sequence.ExtendedNucleotideGraph
getGraphAdjustedForReplacement(int residueIndex, int numberOfResiduesReplaced)
Returns a new graph equivalent to this one, but with quality scores in the replaced nucleotides adjusted to beEDITED_NUCLEOTIDE_QUALITY
int
getLeadingGapsLength()
Get the number of leading residues in the sequence this graph corresponds to that are all gaps.int
getSequenceLength()
Thelength
of the nucleotide sequence that can be annotated with this graph.static int[]
getSequenceQualities(NucleotideGraph graph)
Equivalent to callinggetSequenceQualities(graph,0,graph.getSequenceLength())
static int[]
getSequenceQualities(NucleotideGraph graph, int startIndex, int endIndex)
Get all the values returned fromNucleotideGraph.getSequenceQuality(int)
for all residues indices in the range startIndex (inclusive) to endIndex (exclusive).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 callNucleotideGraph.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.static ExtendedNucleotideGraph
readObject(GeneiousObjectInputStream in)
Reads a graph previously written usingwriteObject(GeneiousObjectOutputStream , NucleotideGraph)
static ExtendedNucleotideGraph
readObject(java.io.DataInput in)
Reads a graph previously written usingwriteObject(java.io.DataOutput, NucleotideGraph)
static ExtendedNucleotideGraph
reverseComplement(NucleotideGraph graphToReverseComplement)
Creates a new graph that is the reverse complement of the given graph.DefaultNucleotideGraph
setChromatogramPositionsForResidues(int[] newSitePositions)
DefaultNucleotideGraph
setChromatogramValues(int[][] newGraphValues)
DefaultNucleotideGraph
setSequenceQualities(int[] newQualities)
static void
writeObject(GeneiousObjectOutputStream out, NucleotideGraph graph)
Writes the given graph in a binary format to an output stream (as specified bySerializable
) such that it can be recreated usingreadObject(GeneiousObjectInputStream)
.static void
writeObject(Geneious.MajorVersion version, java.io.DataOutput out, NucleotideGraph graph)
Writes the given graph in a binary format to an output stream (as specified bySerializable
) such that it can be recreated usingreadObject(java.io.DataInput)
.static void
writeObject(java.io.DataOutput out, NucleotideGraph graph)
Equivalent towriteObject
(Geneious.getMajorVersion(), out, graph)
-
-
-
Field Detail
-
EDITED_NUCLEOTIDE_QUALITY
public static final int EDITED_NUCLEOTIDE_QUALITY
The quality score assigned to a nucleotide which is edited in a sequence with quality. This has a value of 63, which is higher than any quality score assigned by a Sanger machine and can therefore be used by consensus calling to know not to further inspect the trace to make a call, but instead respect what the user has assigned for the base call.- Since:
- API 4.201910
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultNucleotideGraph
public DefaultNucleotideGraph(int[][] chromatogramValues, int[] chromatogramPositionsForResidues, int[] sequenceQualities, int sequenceLength, int chromatogramLength)
Construct a new DefaultNucleotideGraph. It is generally preferable to usecreateNucleotideGraph(int[][], int[], int[], int, int)
instead unless you require the returned graph to be aDefaultNucleotideGraph
rather than just aNucleotideGraph
.
-
-
Method Detail
-
getLeadingGapsLength
public int getLeadingGapsLength()
Description copied from interface:ExtendedNucleotideGraph
Get the number of leading residues in the sequence this graph corresponds to that are all gaps.NucleotideGraph.getSequenceQuality(int)
andNucleotideGraph.getChromatogramPositionForResidue(int)
will both returnInteger.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.- Specified by:
getLeadingGapsLength
in interfaceExtendedNucleotideGraph
- Returns:
- the number of leading residues in the sequence this graph corresponds to that are all gaps.
-
getTrailingGapsLength
public int getTrailingGapsLength()
Description copied from interface:ExtendedNucleotideGraph
Get the number of trailing residues in the sequence this graph corresponds to that are all gaps.NucleotideGraph.getSequenceQuality(int)
andNucleotideGraph.getChromatogramPositionForResidue(int)
will both returnInteger.MIN_VALUE
for residueIndices within this much ofNucleotideGraph.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.- Specified by:
getTrailingGapsLength
in interfaceExtendedNucleotideGraph
- Returns:
- the number of trailing residues in the sequence this graph corresponds to that are all gaps.
-
getChromatogramValues
public static int[][] getChromatogramValues(NucleotideGraph graph)
-
getChromatogramValues
public static int[] getChromatogramValues(NucleotideGraph graph, int i)
-
getChromatogramPositionsForResidues
public static int[] getChromatogramPositionsForResidues(NucleotideGraph graph)
Equivalent to callinggetChromatogramPositionsForResidues(graph,0,graph.getSequenceLength())
-
getChromatogramPositionsForResidues
public static int[] getChromatogramPositionsForResidues(NucleotideGraph graph, int startIndex, int endIndex)
Get all the values returned fromNucleotideGraph.getChromatogramPositionForResidue(int)
for all residues indices in the range startIndex (inclusive) to endIndex (exclusive).- Returns:
- all the values returned from
NucleotideGraph.getChromatogramPositionForResidue(int)
for all residues indices in the range startIndex (inclusive) to endIndex (exclusive) or null ifNucleotideGraph.hasChromatogramPositionsForResidues()
==false.
-
getSequenceQualities
public static int[] getSequenceQualities(NucleotideGraph graph)
Equivalent to callinggetSequenceQualities(graph,0,graph.getSequenceLength())
-
getSequenceQualities
public static int[] getSequenceQualities(NucleotideGraph graph, int startIndex, int endIndex)
Get all the values returned fromNucleotideGraph.getSequenceQuality(int)
for all residues indices in the range startIndex (inclusive) to endIndex (exclusive).- Returns:
- all the values returned from
NucleotideGraph.getSequenceQuality(int)
for all residues indices in the range startIndex (inclusive) to endIndex (exclusive) or null ifNucleotideGraph.hasSequenceQualities()
==false.
-
setSequenceQualities
public DefaultNucleotideGraph setSequenceQualities(int[] newQualities)
-
setChromatogramPositionsForResidues
public DefaultNucleotideGraph setChromatogramPositionsForResidues(int[] newSitePositions)
-
setChromatogramValues
public DefaultNucleotideGraph setChromatogramValues(int[][] newGraphValues)
-
createNucleotideGraph
public static NucleotideGraph createNucleotideGraph(int[][] chromatogramValues, int[] chromatogramPositionsForResidues, int[] sequenceQualities, int sequenceLength, int chromatogramLength, int leadingGapsLength, int trailingGapsLength)
Creates a new nucleotide graph. This method always returns anExtendedNucleotideGraph
but is declared to return a NucleotideGraph for backwards compatilbity reasons.- Parameters:
chromatogramValues
- the values to be returned fromgetChromatogramValue(int, int)
. May be null.chromatogramPositionsForResidues
- the values to be returned fromgetChromatogramPositionForResidue(int)
. May be null.sequenceQualities
- the values to be returned fromgetSequenceQualities(NucleotideGraph)
. May be null. The quality values must not include those in end gap regions (specified by leadingGapsLength and trailingGapsLength)sequenceLength
- the value to return fromgetSequenceLength()
chromatogramLength
- the value to return fromgetChromatogramLength()
leadingGapsLength
- the number of leading gaps in the sequence. chromatogramPositionsForResidues and sequenceQualities do not need to cover the leading gaps regionstrailingGapsLength
- the number of leading gaps in the sequence. chromatogramPositionsForResidues and sequenceQualities do not need to cover the leading gaps regions- Returns:
- the new graph.
-
createNucleotideGraph
public static NucleotideGraph createNucleotideGraph(int[] internalQualities, int leadingGapsLength, int trailingGapsLength)
Creates a new nucleotide graph with qualities but no traces.- Parameters:
internalQualities
- the values to be returned fromgetSequenceQualities(NucleotideGraph)
. The quality values must not include those in end gap regions (specified by leadingGapsLength and trailingGapsLength)leadingGapsLength
- leading gaps lengthtrailingGapsLength
- trailing gaps length- Returns:
- the new graph
- Since:
- API 4.50 (Geneious 5.5.0)
-
createNucleotideGraph
public static NucleotideGraph createNucleotideGraph(int[][] chromatogramValues, int[] chromatogramPositionsForResidues, int[] sequenceQualities, int sequenceLength, int chromatogramLength)
Creates a new nucleotide graph. This method always returns anExtendedNucleotideGraph
but is declared to return a NucleotideGraph for backwards compatilbity reasons.- Parameters:
chromatogramValues
- the values to be returned fromgetChromatogramValue(int, int)
. May be null.chromatogramPositionsForResidues
- the values to be returned fromgetChromatogramPositionForResidue(int)
. May be null.sequenceQualities
- the values to be returned fromgetSequenceQualities(NucleotideGraph)
. May be null. The quality values must not include those in end gap regions (specified by leadingGapsLength and trailingGapsLength)sequenceLength
- the value to return fromgetSequenceLength()
chromatogramLength
- the value to return fromgetChromatogramLength()
- Returns:
- the new graph.
-
createNucleotideGraphAdjustedForGapInsertion
public static ExtendedNucleotideGraph createNucleotideGraphAdjustedForGapInsertion(NucleotideGraph graphToCopy, java.lang.CharSequence charSequence)
Creates a deep copy of the given graph with all graph values adjusted to compensate for gap insertion as indicated by the presense of gaps in charSequence.- Parameters:
graphToCopy
- the graph to copycharSequence
- a CharSequence used for determining the positions of gaps to insert into the graph.- Returns:
- a deep copy of the graph adjusted for gap insertion
-
reverseComplement
public static ExtendedNucleotideGraph reverseComplement(NucleotideGraph graphToReverseComplement)
Creates a new graph that is the reverse complement of the given graph.- Parameters:
graphToReverseComplement
- the graph to reverse complement- Returns:
- a newly created graph which is the reverse complement of the given graph.
-
createNucleotideGraph
public static NucleotideGraph createNucleotideGraph(NucleotideGraph graphToCopy)
Creates a deep copy of the given graph. This method always returns anExtendedNucleotideGraph
but is declared to return a NucleotideGraph for backwards compatilbity reasons.- Parameters:
graphToCopy
- the graph to copy- Returns:
- a deep copy of the graph.
-
createGraphWithAdjustedEndGaps
public static ExtendedNucleotideGraph createGraphWithAdjustedEndGaps(ExtendedNucleotideGraph originalGraph, int newLeadingGapsLength, int newTrailingGapsLength)
Creates a copy of the given graph with the length of its end gaps adjusted. If the original graph was created using one of the createNucleotideGraph methods in this class, then this method will be efficient in that the actual graph data can be resued in the returned class since original graph is immutable.- Parameters:
originalGraph
- the graph to create a copy ofnewLeadingGapsLength
- the length of the leading gaps in the returned graphnewTrailingGapsLength
- the length of the trailing gaps in the returned graph- Returns:
- a new graph
-
copyOf
public static DefaultNucleotideGraph copyOf(NucleotideGraph graph)
Creates a copy of the given graph. It is generally preferable to usecreateNucleotideGraph(NucleotideGraph)
instead unless you require the returned graph to be aDefaultNucleotideGraph
rather than just aNucleotideGraph
.- Parameters:
graph
- the graph to copy- Returns:
- a copy of the graph
-
getChromatogramLength
public int getChromatogramLength()
Description copied from interface:NucleotideGraph
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.- Specified by:
getChromatogramLength
in interfaceNucleotideGraph
- Returns:
- the length of this graph, or 0 if this graph has no graph values for any nucleotide (i.e. 0 if
NucleotideGraph.hasChromatogramPositionsForResidues()
is false).
-
getChromatogramValue
public int getChromatogramValue(int nucleotideStateNumber, int graphPosition) throws java.lang.IndexOutOfBoundsException
Description copied from interface:NucleotideGraph
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 ifNucleotideGraph.hasChromatogramValues(int)
returns true for the specified nucleotide.- Specified by:
getChromatogramValue
in interfaceNucleotideGraph
- 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 >=NucleotideGraph.getChromatogramLength()
-
hasChromatogramValues
public boolean hasChromatogramValues(int nucleotideStateNumber)
Description copied from interface:NucleotideGraph
Specifies whether it is legal to callNucleotideGraph.getChromatogramValue(int, int)
for the specified nucleotide.- Specified by:
hasChromatogramValues
in interfaceNucleotideGraph
- Parameters:
nucleotideStateNumber
- A nucleotide state number encoded in the same way as forNucleotideGraph.getChromatogramValue(int, int)
, i.e. 0 = A, 1 = C, 2 = G, 3 = T- Returns:
- true if is legal to call
NucleotideGraph.getChromatogramValue(int, int)
for the specified nucleotide
-
getSequenceLength
public int getSequenceLength()
Description copied from interface:NucleotideGraph
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 ifNucleotideGraph.hasChromatogramPositionsForResidues()
orNucleotideGraph.hasSequenceQualities()
is true, the return value indicates the range of legal values to pass toNucleotideGraph.getChromatogramPositionForResidue(int)
andNucleotideGraph.getSequenceQuality(int)
.- Specified by:
getSequenceLength
in interfaceNucleotideGraph
- Returns:
- length of the nucleotide sequence belonging to this graph.
-
getChromatogramPositionForResidue
public int getChromatogramPositionForResidue(int residueIndex) throws java.lang.IndexOutOfBoundsException, java.lang.UnsupportedOperationException
Description copied from interface:NucleotideGraph
The graph position (can be used as an argument toNucleotideGraph.getChromatogramValue(int, int)
) where the nucleotide at the specified residue index has been called. This method may only be called ifNucleotideGraph.hasChromatogramPositionsForResidues()
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)
.- Specified by:
getChromatogramPositionForResidue
in interfaceNucleotideGraph
- Parameters:
residueIndex
- A value0 <= residueIndex <
specifying the index in the nucleotide sequence for which to calculate the corresponding position in the graph.NucleotideGraph.getSequenceLength()
- Returns:
- A value in the range 0 <= value <
NucleotideGraph.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 >NucleotideGraph.getSequenceLength()
.java.lang.UnsupportedOperationException
- if !hasChromatogramPositionsForResidues().
-
hasChromatogramPositionsForResidues
public boolean hasChromatogramPositionsForResidues()
Description copied from interface:NucleotideGraph
Tests whether this NucleotideGraph contains information about the position of the base calls, i.e. whether it is legal to callNucleotideGraph.getChromatogramPositionForResidue(int)
.- Specified by:
hasChromatogramPositionsForResidues
in interfaceNucleotideGraph
- Returns:
- true if this NucleotideGraph contains information about the position of the base calls.
-
getSequenceQuality
public int getSequenceQuality(int residueIndex) throws java.lang.IndexOutOfBoundsException, java.lang.UnsupportedOperationException
Description copied from interface:NucleotideGraph
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 ifNucleotideGraph.hasSequenceQualities()
returns true.- Specified by:
getSequenceQuality
in interfaceNucleotideGraph
- Parameters:
residueIndex
- A value0 <= residueIndex <
specifying the index in the nucleotide sequence for which to calculate the quality of the graph.NucleotideGraph.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.
- Throws:
java.lang.IndexOutOfBoundsException
- if residueIndex < 0 or residueIndex >NucleotideGraph.getSequenceLength()
.java.lang.UnsupportedOperationException
- if !hasSequenceQualities().
-
hasSequenceQualities
public boolean hasSequenceQualities()
Description copied from interface:NucleotideGraph
Tests whether this graph contains information about the confidence in the associated sequence's residues, i.e. whether it is legal to callNucleotideGraph.getSequenceQuality(int)
.- Specified by:
hasSequenceQualities
in interfaceNucleotideGraph
- Returns:
- true if it is legal to call
NucleotideGraph.getSequenceQuality(int)
on this graph.
-
writeObject
public static void writeObject(GeneiousObjectOutputStream out, NucleotideGraph graph) throws java.io.IOException
Writes the given graph in a binary format to an output stream (as specified bySerializable
) such that it can be recreated usingreadObject(GeneiousObjectInputStream)
. Note, if the given graph is not a standard NucleotideGraph implementation (one created bycreateNucleotideGraph(NucleotideGraph)
), then the object read back in will be converted to a standard NucleotideGraph implementation.- Parameters:
out
- the stream to write to.graph
- the graph to write to the stream- Throws:
java.io.IOException
- if it cannot be written to the stream.
-
writeObject
public static void writeObject(java.io.DataOutput out, NucleotideGraph graph) throws java.io.IOException
Equivalent towriteObject
(Geneious.getMajorVersion(), out, graph)- Parameters:
out
- the stream to write to. If out is not aGeneiousObjectOutputStream
and the graph is anImmutableSequence
its name may be uncompacted during deserializationgraph
- the graph to write to the stream- Throws:
java.io.IOException
- if it cannot be written to the stream.- Since:
- API 4.30 (Geneious 5.3.0)
-
writeObject
public static void writeObject(Geneious.MajorVersion version, java.io.DataOutput out, NucleotideGraph graph) throws java.io.IOException
Writes the given graph in a binary format to an output stream (as specified bySerializable
) such that it can be recreated usingreadObject(java.io.DataInput)
. Note, if the given graph is not a standard NucleotideGraph implementation (one created bycreateNucleotideGraph(NucleotideGraph)
), then the object read back in will be converted to a standard NucleotideGraph implementation.- Parameters:
version
- the Geneious version to ensure the data is compatible without
- the stream to write to. If out is not aGeneiousObjectOutputStream
and the graph is anImmutableSequence
its name may be uncompacted during deserializationgraph
- the graph to write to the stream- Throws:
java.io.IOException
- if it cannot be written to the stream.- Since:
- API 4.600 (Geneious 6.0.0)
-
readObject
public static ExtendedNucleotideGraph readObject(GeneiousObjectInputStream in) throws java.io.IOException
Reads a graph previously written usingwriteObject(GeneiousObjectOutputStream , NucleotideGraph)
- Parameters:
in
- the stream to read from- Returns:
- the graph read from the stream
- Throws:
java.io.IOException
- if it cannot be read from the stream.
-
readObject
public static ExtendedNucleotideGraph readObject(java.io.DataInput in) throws java.io.IOException
Reads a graph previously written usingwriteObject(java.io.DataOutput, NucleotideGraph)
- Parameters:
in
- the stream to read from- Returns:
- the graph read from the stream
- Throws:
java.io.IOException
- if it cannot be read from the stream.- Since:
- API 4.30 (Geneious 5.3.0)
-
getGraphAdjustedForReplacement
public ExtendedNucleotideGraph getGraphAdjustedForReplacement(int residueIndex, int numberOfResiduesReplaced)
Returns a new graph equivalent to this one, but with quality scores in the replaced nucleotides adjusted to beEDITED_NUCLEOTIDE_QUALITY
- Parameters:
residueIndex
- the first (zero based) position of a replaced nucleotidenumberOfResiduesReplaced
- the number of nucleotides replaced- Returns:
- a new graph, or this graph if no nucleotides were replaced.
- Since:
- API 4.201910
-
getGraphAdjustedForInsertion
public DefaultNucleotideGraph getGraphAdjustedForInsertion(int residueIndex, java.lang.CharSequence insertedChars)
Returns a new graph equivalent to this one, but adjusted to take into account an insertion into the associated sequence.- Parameters:
residueIndex
- the 0-based index to insert the new sequence atinsertedChars
- the newly inserted characters.- Returns:
- a new graph equivalent to this one, but adjusted to take into account an insertion into the associated sequence or this graph if no changes were needed.
- Since:
- API 4.700 (Geneious 7.0.0)
-
getGraphAdjustedForDeletion
public DefaultNucleotideGraph getGraphAdjustedForDeletion(int firstResidueIndex, int lastResidueIndexExclusive, SequenceCharSequence newCharSequence)
Returns a new graph equivalent to this one, but adjusted to take into account a deletion from the associated sequence.- Parameters:
firstResidueIndex
- the 0-based index to begin the deletion fromlastResidueIndexExclusive
- the 0-based index (exclusive) to finish the deletion atnewCharSequence
- required if the leading and trailing gaps of the result are to be correct. (in case we delete all bases between and end gap and an internal gap then the end gaps need to be incremented). May be null if the calling code doesn't care if the leading and end gaps might be not as high as they should be- Returns:
- a new graph equivalent to this one, but adjusted to take into account a deletion from the associated sequence or this graph if no changes were needed.
- Since:
- API 4.700 (Geneious 7.0.0)
-
-