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
ANucleotideGraphthat 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 intEDITED_NUCLEOTIDE_QUALITYThe 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 DefaultNucleotideGraphcopyOf(NucleotideGraph graph)Creates a copy of the given graph.static ExtendedNucleotideGraphcreateGraphWithAdjustedEndGaps(ExtendedNucleotideGraph originalGraph, int newLeadingGapsLength, int newTrailingGapsLength)Creates a copy of the given graph with the length of its end gaps adjusted.static NucleotideGraphcreateNucleotideGraph(int[][] chromatogramValues, int[] chromatogramPositionsForResidues, int[] sequenceQualities, int sequenceLength, int chromatogramLength)Creates a new nucleotide graph.static NucleotideGraphcreateNucleotideGraph(int[][] chromatogramValues, int[] chromatogramPositionsForResidues, int[] sequenceQualities, int sequenceLength, int chromatogramLength, int leadingGapsLength, int trailingGapsLength)Creates a new nucleotide graph.static NucleotideGraphcreateNucleotideGraph(int[] internalQualities, int leadingGapsLength, int trailingGapsLength)Creates a new nucleotide graph with qualities but no traces.static NucleotideGraphcreateNucleotideGraph(NucleotideGraph graphToCopy)Creates a deep copy of the given graph.static ExtendedNucleotideGraphcreateNucleotideGraphAdjustedForGapInsertion(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.intgetChromatogramLength()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.intgetChromatogramPositionForResidue(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.int[]getChromatogramPositionsForResidues(int startIndex, int endIndex)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).intgetChromatogramValue(int nucleotideStateNumber, int graphPosition)Returns the graph value for the specified nucleotide and at the specified position.int[]getChromatogramValues(int nucleotideStateNumber)static int[][]getChromatogramValues(NucleotideGraph graph)static int[]getChromatogramValues(NucleotideGraph graph, int i)DefaultNucleotideGraphgetGraphAdjustedForDeletion(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.DefaultNucleotideGraphgetGraphAdjustedForInsertion(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.ExtendedNucleotideGraphgetGraphAdjustedForReplacement(int residueIndex, int numberOfResiduesReplaced)Returns a new graph equivalent to this one, but with quality scores in the replaced nucleotides adjusted to beEDITED_NUCLEOTIDE_QUALITYintgetLeadingGapsLength()Get the number of leading residues in the sequence this graph corresponds to that are all gaps.intgetSequenceLength()Thelengthof the nucleotide sequence that can be annotated with this graph.int[]getSequenceQualities(int startIndex, int endIndex)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).intgetSequenceQuality(int residueIndex)Returns a measurement of confidence in the residue reported at the specified residueIndex in the sequence.intgetTrailingGapsLength()Get the number of trailing residues in the sequence this graph corresponds to that are all gaps.booleanhasChromatogramPositionsForResidues()Tests whether this NucleotideGraph contains information about the position of the base calls, i.e.booleanhasChromatogramValues(int nucleotideStateNumber)Specifies whether it is legal to callNucleotideGraph.getChromatogramValue(int, int)for the specified nucleotide.booleanhasSequenceQualities()Tests whether this graph contains information about the confidence in the associated sequence's residues, i.e.static ExtendedNucleotideGraphreadObject(GeneiousObjectInputStream in)Reads a graph previously written usingwriteObject(GeneiousObjectOutputStream , NucleotideGraph)static ExtendedNucleotideGraphreadObject(java.io.DataInput in)Reads a graph previously written usingwriteObject(java.io.DataOutput, NucleotideGraph)static ExtendedNucleotideGraphreverseComplement(NucleotideGraph graphToReverseComplement)Creates a new graph that is the reverse complement of the given graph.DefaultNucleotideGraphsetChromatogramPositionsForResidues(int[] newSitePositions)DefaultNucleotideGraphsetChromatogramValues(int[][] newGraphValues)DefaultNucleotideGraphsetSequenceQualities(int[] newQualities)static voidwriteObject(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 voidwriteObject(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 voidwriteObject(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 aDefaultNucleotideGraphrather than just aNucleotideGraph.
-
-
Method Detail
-
getLeadingGapsLength
public int getLeadingGapsLength()
Description copied from interface:ExtendedNucleotideGraphGet 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_VALUEfor 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:
getLeadingGapsLengthin 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:ExtendedNucleotideGraphGet 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_VALUEfor 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:
getTrailingGapsLengthin 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.
-
getChromatogramPositionsForResidues
public int[] getChromatogramPositionsForResidues(int startIndex, int endIndex)- Specified by:
getChromatogramPositionsForResiduesin interfaceNucleotideGraph- Parameters:
startIndex- the 0-based start residue index (inclusive)endIndex- the 0-based end residue index (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.
-
getSequenceQualities
public int[] getSequenceQualities(int startIndex, int endIndex)- Specified by:
getSequenceQualitiesin interfaceNucleotideGraph- Parameters:
startIndex- the 0-based start residue index (inclusive)endIndex- the 0-based end residue index (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.
-
getChromatogramValues
public int[] getChromatogramValues(int nucleotideStateNumber)
- Specified by:
getChromatogramValuesin 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)- Returns:
- all the values returned from
NucleotideGraph.getChromatogramValue(int, int)for this nucleotideStateNumber for all indices in the range 0 toNucleotideGraph.getChromatogramLength()(exclusive) or null ifNucleotideGraph.hasChromatogramValues(int)==false for this nucleotideStateNumber.
-
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 anExtendedNucleotideGraphbut 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 anExtendedNucleotideGraphbut 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 anExtendedNucleotideGraphbut 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 aDefaultNucleotideGraphrather than just aNucleotideGraph.- Parameters:
graph- the graph to copy- Returns:
- a copy of the graph
-
getChromatogramLength
public int getChromatogramLength()
Description copied from interface:NucleotideGraphThe 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:
getChromatogramLengthin 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.IndexOutOfBoundsExceptionDescription copied from interface:NucleotideGraphReturns 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:
getChromatogramValuein 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:NucleotideGraphSpecifies whether it is legal to callNucleotideGraph.getChromatogramValue(int, int)for the specified nucleotide.- Specified by:
hasChromatogramValuesin 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:NucleotideGraphThelengthof 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:
getSequenceLengthin interfaceNucleotideGraph- Returns:
- length of the nucleotide sequence belonging to this graph.
-
getChromatogramPositionForResidue
public int getChromatogramPositionForResidue(int residueIndex) throws java.lang.IndexOutOfBoundsException, java.lang.UnsupportedOperationExceptionDescription copied from interface:NucleotideGraphThe 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:
getChromatogramPositionForResiduein 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 positionresidueIndexhas been called. For positionsresidueIndexwhere thesequencelengthconsisting of values between 0 and getChromatogramLength()-1 inclusive. For a residueIndex where the sequenceholdsa '-', 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:NucleotideGraphTests whether this NucleotideGraph contains information about the position of the base calls, i.e. whether it is legal to callNucleotideGraph.getChromatogramPositionForResidue(int).- Specified by:
hasChromatogramPositionsForResiduesin 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.UnsupportedOperationExceptionDescription copied from interface:NucleotideGraphReturns 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_VALUEif 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:
getSequenceQualityin 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. 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 >NucleotideGraph.getSequenceLength().java.lang.UnsupportedOperationException- if !hasSequenceQualities().
-
hasSequenceQualities
public boolean hasSequenceQualities()
Description copied from interface:NucleotideGraphTests 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:
hasSequenceQualitiesin 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.IOExceptionEquivalent towriteObject(Geneious.getMajorVersion(), out, graph)- Parameters:
out- the stream to write to. If out is not aGeneiousObjectOutputStreamand the graph is anImmutableSequenceits 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 aGeneiousObjectOutputStreamand the graph is anImmutableSequenceits 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)
-
-