public class DefaultNucleotideGraphSequence extends DefaultNucleotideSequence implements ChromatogramDocument, EditableNucleotideGraphSequenceDocument, ExtendedNucleotideGraph, NucleotideGraph.ImmutableGraphProvider
DefaultSequenceDocument.CacheNucleotideGraph.ImmutableGraphProviderSequenceDocument.Alphabet, SequenceDocument.TransformerPluginDocument.ReferencedDocumentsAlwaysLoaded, PluginDocument.ReferencedDocumentsNotLoaded, PluginDocument.SizeRequiredToLoadIntoMemoryProviderXMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportTypeNICE_NAMEGENOME_SEQUENCE_THRESHOLDFILE_DATA_ATTRIBUTE_NAME, MAXIMUM_HTML_LENGTH, MODIFIED_DATE_FIELDROOT_ELEMENT_NAME| Constructor and Description |
|---|
DefaultNucleotideGraphSequence()
empty constructor for XML serialisation purposes
|
DefaultNucleotideGraphSequence(NucleotideGraphSequenceDocument sequence,
Date created)
Create a DefaultNucleotideGraphSequence from an existing document.
|
DefaultNucleotideGraphSequence(String name,
String description,
CharSequence charSequence,
Date created,
NucleotideGraph graph)
Create a DefaultNucleotideGraphSequence from any chromatogram.
|
DefaultNucleotideGraphSequence(String name,
String description,
CharSequence charSequence,
Date created,
NucleotideGraph graph,
URN urn)
Create a DefaultNucleotideGraphSequence from any chromatogram.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
checkChromatogramValidity(NucleotideGraphSequenceDocument graph)
Confirms the chromatogram data is valid.
|
void |
fromXML(org.jdom.Element root)
Restore the object from the JDOM Element returned by
XMLSerializable.toXML(). |
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 nucIndex,
int residuePosition)
Returns the graph value for the specified nucleotide and at the specified position.
|
ExtendedNucleotideGraph |
getImmutableGraph()
Returns the graph represented as an immutable graph.
|
int |
getLeadingGapsLength()
Get the number of leading residues in the sequence this graph corresponds to that are all gaps.
|
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.
|
Geneious.MajorVersion |
getVersionSupport(XMLSerializable.VersionSupportType versionType)
Gets either the latest version this class can serialize to via
XMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener)
or the most recent version in which the XML returned from XMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener) last changed. |
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.
|
void |
setSequenceAndAnnotations(CharSequence sequence,
List<SequenceAnnotation> annotations)
Sets the sequence and annotations of this document.
|
void |
setSequenceAndAnnotationsAndGraph(CharSequence sequence,
List<SequenceAnnotation> annotations,
NucleotideGraph graph)
Replaces
EditableSequenceDocument.setSequenceAndAnnotations(CharSequence,java.util.List)
which you must not call on a NucleotideGraphSequenceDocument. |
org.jdom.Element |
toXML()
Convert object to a JDOM element.
|
org.jdom.Element |
toXML(Geneious.MajorVersion version,
ProgressListener progressListener)
Serializes this class to XML format, potentially to a format readable by an earlier version of Geneious.
|
addSequenceAnnotation, annotationsFromXML, copySequenceTracksFrom, createCopy, createCopy, getAnnotationsRevisionNumber, getCharSequence, getCharSequenceRevisionNumber, getDescription, getDisplayableFields, getFieldValue, getName, getSequenceAnnotations, getSequenceGapInformation, getSequenceGapInformation, getSequenceLength, getSequenceString, getTrackManager, isBestSerializedToXmlRatherThanBinaryFormat, isCircular, isStandardImplementation, readObject, readObject, sequenceAnnotationsToXML, sequenceAnnotationsToXML, setAnnotations, setCache, setCircular, setDescription, setFieldValue, setName, toHTML, writeObject, writeObject, writeObjectaddDisplayableField, addReferencedDocumentUrn, clearReferencedDocumentUrns, createFromBaseElement, getBaseElement, getBaseElementString, getCreationDate, getFieldValueCodes, getReferencedDocumentUrns, getURN, hasProperties, setBaseElement, setCreated, setFieldValue, setFieldValues, setURNclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSequenceLengthsetCircularsetAnnotationsgetCharSequence, getSequenceAnnotations, getSequenceLength, getSequenceString, isCirculargetCreationDate, getDescription, getDisplayableFields, getFieldValue, getName, getURN, toHTMLpublic DefaultNucleotideGraphSequence()
public DefaultNucleotideGraphSequence(NucleotideGraphSequenceDocument sequence, Date created)
sequence - the original sequence documentcreated - the creation datepublic DefaultNucleotideGraphSequence(String name, String description, CharSequence charSequence, Date created, NucleotideGraph graph)
name - optional document default namedescription - sequence descriptions, if anycharSequence - the sequence residues. The length of charSequence and the characters retured from charSequence must not change after calling this method.created - sequence creation timegraph - a NucleotideGraphpublic DefaultNucleotideGraphSequence(String name, String description, CharSequence charSequence, Date created, NucleotideGraph graph, URN urn)
name - optional document default namedescription - sequence descriptions, if anycharSequence - the sequence residues. The length of charSequence and the characters retured from charSequence must not change after calling this method.created - sequence creation timegraph - a NucleotideGraphurn - an optonal URN for the document (may be null)public Geneious.MajorVersion getVersionSupport(XMLSerializable.VersionSupportType versionType)
XMLSerializable.OldVersionCompatibleXMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener)
or the most recent version in which the XML returned from XMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener) last changed.getVersionSupport in interface XMLSerializable.OldVersionCompatiblegetVersionSupport in class DefaultSequenceDocumentversionType - specifies which version property to returnpublic org.jdom.Element toXML()
XMLSerializableXMLSerializable.fromXML(org.jdom.Element) can completely
restore the objects representation.
It is recommended that the returned element use XMLSerializable.ROOT_ELEMENT_NAME as its name,
in which case it must not define an attribute called "type". In this case,
fromXML, will be called with an element whose name may differ from the element
return from this function. This recommendation allows a more compact representation
of the XML can be stored.
This method generally should not be called directly. Instead, you should usually call
XMLSerializer.classToXML(String, XMLSerializable)
which calls this method internally.
PluginDocument implementations of this method may choose to throw an XMLSerializationException,
enclosed in a RuntimeException.toXML in interface XMLSerializabletoXML in class DefaultSequenceDocumentpublic org.jdom.Element toXML(Geneious.MajorVersion version, ProgressListener progressListener)
XMLSerializable.OldVersionCompatibleXMLSerializable.toXML() for a more
detailed description of what it means to serialize to XML.
All classes that implement this method must also implement XMLSerializable.toXML() and should delegate back to
this method using Geneious.getMajorVersion() and ProgressListener.EMPTY as parameters.toXML in interface XMLSerializable.OldVersionCompatibletoXML in class DefaultSequenceDocumentversion - the major version of Geneious to serialize to XML for. For example "6.0" but not "6.0.0". This must be a version
returned greater or equal to a version returned from
getVersionSupport(VersionSupportType.OldestVersionSerializableTo)
and must never be greater than the current version (Geneious.getMajorVersion())progressListener - for reporting progress and cancellingpublic void fromXML(org.jdom.Element root)
throws XMLSerializationException
XMLSerializableXMLSerializable.toXML().
This method generally should not be called directly. Instead, you should usually call
XMLSerializer.classFromXML(org.jdom.Element)
or XMLSerializer.classFromXML(org.jdom.Element, Class)
which calls this method internally.
It is optional to implement this method. Instead of implementing an empty constructor and implementing
this method properly, the implementation may instead
throw an UnsupportedOperationException and implement a constructor
that takes a single Element as a parameter.
This allows for cleaner code such as support for final fields in the XMLSerializable class.
The element parameter should not be modified since it may be reused. If you need a modified version of it,
take a copy with Element.clone().fromXML in interface XMLSerializablefromXML in class DefaultSequenceDocumentroot - representation from a previous call to XMLSerializable.toXML()XMLSerializationException - if the Element can't be converted into this type of objectpublic int getChromatogramLength()
NucleotideGraphgetChromatogramLength in interface NucleotideGraphpublic 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 getChromatogramValue(int nucIndex,
int residuePosition)
NucleotideGraphNucleotideGraph.hasChromatogramValues(int) returns true for the
specified nucleotide.getChromatogramValue in interface NucleotideGraphnucIndex - 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)residuePosition - The position in the sequence for which to query the graph value,
with 0 <= graphPosition < graph lengthpublic boolean hasChromatogramPositionsForResidues()
NucleotideGraphNucleotideGraph.getChromatogramPositionForResidue(int).hasChromatogramPositionsForResidues in interface NucleotideGraphpublic int getChromatogramPositionForResidue(int residueIndex)
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.public boolean hasSequenceQualities()
NucleotideGraphNucleotideGraph.getSequenceQuality(int).hasSequenceQualities in interface NucleotideGraphNucleotideGraph.getSequenceQuality(int) on this graph.public int getSequenceQuality(int residueIndex)
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.public 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 ExtendedNucleotideGraphpublic static void checkChromatogramValidity(NucleotideGraphSequenceDocument graph) throws IllegalArgumentException
graph - a NucleotideGraphSequenceDocumentIllegalArgumentException - if the chromatogram data is invalid.public final void setSequenceAndAnnotations(CharSequence sequence, List<SequenceAnnotation> annotations)
EditableSequenceDocumentSequenceTracks
EditableNucleotideGraphSequenceDocument.setSequenceAndAnnotationsAndGraph(CharSequence, java.util.List, NucleotideGraph).
Hence, it is illegal to change the length of the sequence through this method if
this is instanceof NucleotideGraphSequenceDocument;
Therefore, implementations of this method should start with the following code:
if (this instanceof NucleotideGraphSequenceDocument && sequence.length() != getSequenceLength()) {
throw new IllegalArgumentException("Can't change sequence length without updating graph for " + getClass());
}
setSequenceAndAnnotations in interface EditableSequenceDocumentsetSequenceAndAnnotations in class DefaultSequenceDocumentsequence - new residues; NOTE: This CharSequence must not change its length or characters after it was passed to this method!annotations - new annotationspublic void setSequenceAndAnnotationsAndGraph(CharSequence sequence, List<SequenceAnnotation> annotations, NucleotideGraph graph)
EditableNucleotideGraphSequenceDocumentEditableSequenceDocument.setSequenceAndAnnotations(CharSequence,java.util.List)
which you must not call on a NucleotideGraphSequenceDocument. Does the same as that method
normally would, but also sets a new graph to use (which must be consistent with the sequence,
i.e. graph.getSequenceLength()
must be equal to sequence.length()
It is recommended that an implementation call
checkChromatogramValidity(NucleotideGraphSequenceDocument)
before returning from this method, to ensure that the graph and sequence are consistent.setSequenceAndAnnotationsAndGraph in interface EditableNucleotideGraphSequenceDocumentsequence - New sequence to set on this document; must be consistent with the annotations
and the graph (see above). Must not change length or characters after being passed to this method
(as in EditableSequenceDocument.setSequenceAndAnnotations(CharSequence, java.util.List)).annotations - New annotations to set on this document, with indices relative to the new sequence.graph - New graph to set on this document; must be consistent with the new sequence. The implementation must store a copy of this graph instead
of a reference to the specified graph (using for eaxmple DefaultNucleotideGraph.copyOf(NucleotideGraph))public ExtendedNucleotideGraph getImmutableGraph()
NucleotideGraph.ImmutableGraphProvidergetImmutableGraph in interface NucleotideGraph.ImmutableGraphProvider