public interface SequenceDocument extends PluginDocument
AminoAcidSequenceDocument or NucleotideSequenceDocument to
represent amino acid or nucleotide sequences because Geneious relies on
these interfaces for determining the type of a sequence.
The most widely used implementations of a SequenceDocument are
DefaultSequenceDocument
and ImmutableSequence
Not all SequenceDocuments are editable, although most implementations also implement EditableSequenceDocumentSequenceUtilities,
SequenceExtractionUtilities| Modifier and Type | Interface and Description |
|---|---|
static class |
SequenceDocument.Alphabet
Supported sequence types.
|
static class |
SequenceDocument.Transformer
Provides a method for returning a new sequence which represents a transformation made to another sequence.
|
PluginDocument.ReferencedDocumentsAlwaysLoaded, PluginDocument.ReferencedDocumentsNotLoaded, PluginDocument.SizeRequiredToLoadIntoMemoryProviderXMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportType| Modifier and Type | Field and Description |
|---|---|
static int |
GENOME_SEQUENCE_THRESHOLD
The sequence length threshold at which we decide a sequence is a genome.
|
FILE_DATA_ATTRIBUTE_NAME, MAXIMUM_HTML_LENGTH, MODIFIED_DATE_FIELDROOT_ELEMENT_NAME| Modifier and Type | Method and Description |
|---|---|
SequenceCharSequence |
getCharSequence()
Get the sequence as a CharSequence.
|
List<SequenceAnnotation> |
getSequenceAnnotations()
Gets sequence annotations which are directly on the sequence.
|
int |
getSequenceLength()
Returns the length of the sequence.
|
String |
getSequenceString()
Get the sequence as a string.
|
boolean |
isCircular()
Returns true if this sequence is circular.
|
getCreationDate, getDescription, getDisplayableFields, getFieldValue, getName, getURN, toHTMLfromXML, toXMLstatic final int GENOME_SEQUENCE_THRESHOLD
String getSequenceString()
getCharSequence() doesn't call this method, then one possible implementation
for this method is the following:
return getCharSequence().toString();
getCharSequence()int getSequenceLength()
getCharSequence().length(),
but may be more performant on some implementations.NucleotideGraph,
the return value of this method must be consistent with the contracts from both
interfaces.SequenceCharSequence getCharSequence()
getSequenceString()
in situations where a String is unnecessary and could potentially
use too much memory, or where we want to efficiently calculate the terminal gap lengths.
The returned CharSequence must always return consistent
values from any of the CharSequence methods
(e.g. CharSequence.length() and CharSequence.charAt(int).
If a SequenceDocument is editable and changes are made to it,
it is required that the original CharSequence obtained from
getCharSequence()
not change. A client of the SequenceDocument is only able to obtain
the changes by making a fresh call to getCharSequence().
If getSequenceString() doesn't call this method, then it is possible to
implement this method as follows:
return SequenceCharSequence.valueOf(getSequenceString());
However, it is recommended that a more memory efficient representation is used
where possible; in that case, getSequenceString() can be implemented
based on this method (see its javadoc).
Some implementations of this method may choose to throw a RuntimeException whose cause is an XMLSerializationException if there is insufficient memory to load the sequence. In most situations (e.g. from a DocumentOperation or DocumentFileImporter) catching this exception is unnecessary as core Geneious will have either pre-loaded the sequence or will catch and unwrap this exception itself gracefully.
getSequenceString()List<SequenceAnnotation> getSequenceAnnotations()
sequence tracks.
SequenceUtilities.getSequenceAndTrackAnnotations
This method may return an unmodifiable list and must not return the list which is used internally by the SequenceDocument to store the annotations
(ie modifying the returned list should not modify the annotations on the SequenceDocument directly)SequenceUtilities.getSequenceAnnotationsIncludingImmutableSequencesTrims(SequenceDocument).SequenceAnnotation.TYPE_EXTRACTED_REGION.Collections.emptyList()).SequenceUtilities.getSequenceAndTrackAnnotations(SequenceDocument),
SequenceDocumentWithEditableAnnotations.setAnnotations(java.util.List)boolean isCircular()
SequenceAnnotationInterval.getFrom()