public class SequencePropertiesStorage extends Object implements NucleotideGraph, XMLSerializable, XMLSerializable.OldVersionCompatible
getSequenceString() and getCharSequence() may return null.
For consistency the methods should remain named the same way as those in the SequenceDocuments,
however because of the above difference an object of this class should never be passed anywhere
as a SequenceDocument.NucleotideGraph.ImmutableGraphProviderXMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportTypeROOT_ELEMENT_NAME| Constructor and Description |
|---|
SequencePropertiesStorage()
Default constructor with no arguments.
|
SequencePropertiesStorage(org.jdom.Element element)
Constructs a SequencePropertiesStorage object from a JDOM XML Element.
|
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
byteArrayFromXML(org.jdom.Element element)
Converts some xml created from a preious call to
byteArrayToXML(String, byte[]) (String, int[])} back to a byte array. |
static org.jdom.Element |
byteArrayToXML(String elementName,
byte[] values)
Converts a byte array to xml, storing them in a compact way if possible.
|
void |
fromXML(org.jdom.Element root)
Restore the object from the JDOM Element returned by
XMLSerializable.toXML(). |
void |
fromXML(org.jdom.Element root,
NucleotideGraph overriddenGraph)
Deprecated.
|
SequenceCharSequence |
getCharSequence() |
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 residuePosition)
Returns the graph value for the specified nucleotide and at the specified position.
|
Date |
getCreationDate()
This method is not implemented.
|
String |
getDescription() |
List<DocumentField> |
getDisplayableFields()
This method is not implemented.
|
Object |
getFieldValue(String fieldCodeName)
This method is not implemented.
|
NucleotideGraph |
getGraph() |
String |
getName() |
String |
getProperty(String propertyKey)
Returns a value from the internal properties object.
|
List<SequenceAnnotation> |
getSequenceAnnotations() |
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.
|
String |
getSequenceString() |
URN |
getURN()
This method is not implemented.
|
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 |
hasGraph() |
boolean |
hasSequenceQualities()
Tests whether this graph contains information about the confidence in the associated sequence's
residues, i.e.
|
boolean |
hasSetCircular()
Returns true if
setCircular(boolean) has ever been called on this storage properties |
static int[] |
integerArrayFromXML(org.jdom.Element element)
Converts some xml created from a preious call to
integerArrayToXML(String, int[]) back to an integer array. |
static org.jdom.Element |
integerArrayToXML(Geneious.MajorVersion version,
String elementName,
int[] values)
Converts an integer array to xml, storing them in a compact way if possible.
|
static org.jdom.Element |
integerArrayToXML(String elementName,
int[] values)
Converts an integer array to xml, storing them in a compact way if possible.
|
boolean |
isCircular() |
void |
setAnnotations(List<SequenceAnnotation> annotations)
|
void |
setCircular(boolean circular) |
void |
setDescription(String description)
Set the human-readable graph description.
|
void |
setName(String name)
Set the name of the graph.
|
void |
setProperty(String propertyKey,
String value)
Sets a value on the internal properties object.
|
void |
setSequenceAndAnnotations(CharSequence sequence,
List<SequenceAnnotation> annotations)
|
void |
setSequenceAndAnnotationsAndGraph(CharSequence sequence,
List<SequenceAnnotation> annotations,
NucleotideGraph graph)
|
String |
toHTML()
This method is not implemented.
|
org.jdom.Element |
toXML()
Convert object to a JDOM element.
|
org.jdom.Element |
toXML(Geneious.MajorVersion majorVersion,
ProgressListener progressListener)
Serializes this class to XML format, potentially to a format readable by an earlier version of Geneious.
|
org.jdom.Element |
toXML(String elementName)
Convert object to a JDOM Element with the given name as the name of the
root element.
|
public SequencePropertiesStorage()
public SequencePropertiesStorage(org.jdom.Element element)
throws XMLSerializationException
element - a JDOM XML Element representing a SequencePropertiesStorage objectXMLSerializationException - if the SequencePropertiesStorage can't be reconstructed from the specified element for some reasonpublic void setSequenceAndAnnotations(CharSequence sequence, List<SequenceAnnotation> annotations)
EditableSequenceDocument.setSequenceAndAnnotations(CharSequence,java.util.List).
except that null sequences or a null list of annotations are allowed.public void setAnnotations(List<SequenceAnnotation> annotations)
public void setName(String name)
name - the name of the graphpublic void setDescription(String description)
description - the human-readable graph descriptionpublic String getName()
public String getProperty(String propertyKey)
propertyKey - key whose associated value is to be returnedMap.get(Object)public void setProperty(String propertyKey, String value)
propertyKey - key with which the specified value is to be associatedvalue - value to be associated with the specified keypublic String getDescription()
public final String getSequenceString()
public SequenceCharSequence getCharSequence()
public List<SequenceAnnotation> getSequenceAnnotations()
setAnnotations(java.util.List) or null if setAnnotations(java.util.List) has not been called.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.OldVersionCompatibleversionType - specifies which version property to returnpublic org.jdom.Element toXML(String elementName)
elementName - the name of the root elementXMLSerializable.toXML()public org.jdom.Element toXML(Geneious.MajorVersion majorVersion, 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.OldVersionCompatiblemajorVersion - 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 static org.jdom.Element integerArrayToXML(String elementName, int[] values)
elementName - the name of the element to return.values - the values to serialize to xml. Must not be null.integerArrayArrayFromXML(org.jdom.Element).public static org.jdom.Element integerArrayToXML(Geneious.MajorVersion version, String elementName, int[] values)
version - the version number of Geneious that must be able to deserialize this. All versions of Geneious from 6.0 onwards are and always will be supported.elementName - the name of the element to return.values - the values to serialize to xml. Must not be null.integerArrayArrayFromXML(org.jdom.Element).public static org.jdom.Element byteArrayToXML(String elementName, byte[] values)
elementName - the name of the element to return.values - the values to serialize to xml. Must not be null.byteArrayFromXML(org.jdom.Element)public static int[] integerArrayFromXML(org.jdom.Element element)
integerArrayToXML(String, int[]) back to an integer array.element - the element to convert to an array. May be null, in which case this method returns null.public static byte[] byteArrayFromXML(org.jdom.Element element)
byteArrayToXML(String, byte[]) (String, int[])} back to a byte array.element - the element to convert to an array. May be null, in which case this method returns null.@Deprecated public void fromXML(org.jdom.Element root, NucleotideGraph overriddenGraph) throws XMLSerializationException
serialized
by version 3.6 or later) should never need to call this method, and should instead just call
fromXML(org.jdom.Element).root - Element from which to XML deserialize (same as in fromXML(org.jdom.Element)overriddenGraph - The graph from which to take chromatogram
and sequence lengths
if they are not specified in the XML. May be null if these properties override no other graph
and root must contain specification of a legal graph by itself.XMLSerializationException - If the Element passed in (plus optionally overriddenGraph) is not a
valid serialization of a NucleotideGraphpublic 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 XMLSerializableroot - representation from a previous call to XMLSerializable.toXML()XMLSerializationException - if the Element can't be converted into this type of objectpublic 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 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 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 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 nucleotideStateNumber,
int residuePosition)
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)residuePosition - The position in the sequence for which to query the graph value,
with 0 <= graphPosition < graph lengthpublic NucleotideGraph getGraph()
public void setSequenceAndAnnotationsAndGraph(CharSequence sequence, List<SequenceAnnotation> annotations, NucleotideGraph graph)
public List<DocumentField> getDisplayableFields()
UnsupportedOperationException.UnsupportedOperationException.UnsupportedOperationException - alwayspublic Object getFieldValue(String fieldCodeName)
UnsupportedOperationException.fieldCodeName - ignoredUnsupportedOperationException.UnsupportedOperationException - alwayspublic URN getURN()
UnsupportedOperationException.UnsupportedOperationException.UnsupportedOperationException - alwayspublic Date getCreationDate()
UnsupportedOperationException.UnsupportedOperationException.UnsupportedOperationException - alwayspublic String toHTML()
UnsupportedOperationException.UnsupportedOperationException.UnsupportedOperationException - alwayspublic 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 XMLSerializablepublic void setCircular(boolean circular)
public boolean isCircular()
public boolean hasSetCircular()
setCircular(boolean) has ever been called on this storage propertiessetCircular(boolean) has ever been called on this storage properties.public boolean hasGraph()