Interface SequenceDocument
-
- All Superinterfaces:
PluginDocument,XMLSerializable
- All Known Subinterfaces:
AminoAcidSequenceDocument,ChromatogramDocument,EditableNucleotideGraphSequenceDocument,EditableSequenceDocument,NucleotideGraphSequenceDocument,NucleotideSequenceDocument,SequenceDocumentWithEditableAnnotations
- All Known Implementing Classes:
CombinedAlignmentAndAminoAcidSequenceDocument,CombinedAlignmentAndNucleotideGraphSequenceDocument,CombinedAlignmentAndNucleotideSequenceDocument,CombinedAlignmentAndSequenceDocument,DefaultAminoAcidSequence,DefaultNucleotideGraphSequence,DefaultNucleotideSequence,DefaultSequenceDocument,ImmutableSequence,ImmutableSequenceImplementation,OligoSequenceDocument
public interface SequenceDocument extends PluginDocument
Interface representing one sequence. Any concrete implementation of this interface must implement eitherAminoAcidSequenceDocumentorNucleotideSequenceDocumentto 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 areDefaultSequenceDocumentandImmutableSequenceNot all SequenceDocuments are editable, although most implementations also implementEditableSequenceDocument- See Also:
SequenceUtilities,SequenceExtractionUtilities
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSequenceDocument.AlphabetSupported sequence types.static classSequenceDocument.TransformerProvides a method for returning a new sequence which represents a transformation made to another sequence.-
Nested classes/interfaces inherited from interface com.biomatters.geneious.publicapi.documents.PluginDocument
PluginDocument.ReferencedDocumentsAlwaysLoaded, PluginDocument.ReferencedDocumentsNotLoaded, PluginDocument.SizeRequiredToLoadIntoMemoryProvider
-
Nested classes/interfaces inherited from interface com.biomatters.geneious.publicapi.documents.XMLSerializable
XMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportType
-
-
Field Summary
Fields Modifier and Type Field Description static intGENOME_SEQUENCE_THRESHOLDThe sequence length threshold at which we decide a sequence is a genome.-
Fields inherited from interface com.biomatters.geneious.publicapi.documents.PluginDocument
FILE_DATA_ATTRIBUTE_NAME, MAXIMUM_HTML_LENGTH, MODIFIED_DATE_FIELD
-
Fields inherited from interface com.biomatters.geneious.publicapi.documents.XMLSerializable
ROOT_ELEMENT_NAME
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SequenceCharSequencegetCharSequence()Get the sequence as a CharSequence.java.util.List<SequenceAnnotation>getSequenceAnnotations()Gets sequence annotations which are directly on the sequence.intgetSequenceLength()Returns the length of the sequence.java.lang.StringgetSequenceString()Get the sequence as a string.booleanisCircular()Returns true if this sequence is circular.-
Methods inherited from interface com.biomatters.geneious.publicapi.documents.PluginDocument
getCreationDate, getDescription, getDisplayableFields, getFieldValue, getName, getURN, toHTML
-
Methods inherited from interface com.biomatters.geneious.publicapi.documents.XMLSerializable
fromXML, toXML
-
-
-
-
Field Detail
-
GENOME_SEQUENCE_THRESHOLD
static final int GENOME_SEQUENCE_THRESHOLD
The sequence length threshold at which we decide a sequence is a genome. eg. sequence longer than this are serialized differently and have a different set of defaults/preferences in the sequence view.
At API 4.50 this is 100,000.- Since:
- API 4.50 (Geneious 5.5.0)
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSequenceString
java.lang.String getSequenceString()
Get the sequence as a string. For nucleotide or amino acid sequences, each residue or ambiguity symbol is represented by one uppercase or lowercase character as per the IUPAC recommendations. For nucleotide sequences, any of the following are valid characters "ACGTURYMWSKBDHVN?-acgturymwskbdhvn" For amino acid sequences, any of the following are valid characters "ACDEFGHIKLMNPQRSTVWY*OUBJZX?-acdefghiklmnpqrstvwyoubjzx" Gap characters (-) are only allowed on sequences within aSequenceAlignmentDocument. Stand-alone sequences may not contain gaps. IfgetCharSequence()doesn't call this method, then one possible implementation for this method is the following:return getCharSequence().toString();WARNING: It is generally a bad idea to use this method on anything but very short sequences. On large sequences (e.g. whole chromosomes) this method may take some time and may use significant amounts of memory. e.g. A String representation of human chr1 requires 500 MB of memory. It is preferable to use
getCharSequence()instead.- Returns:
- the sequence as a string; must not return null.
- See Also:
getCharSequence()
-
getSequenceLength
int getSequenceLength()
Returns the length of the sequence. This returns exactly the same asgetCharSequence().length(), but may be more performant on some implementations.- Returns:
- The length of this document's sequence.
Note that if a class implements both this interface and
NucleotideGraph, the return value of this method must be consistent with the contracts from both interfaces.
-
getCharSequence
SequenceCharSequence getCharSequence()
Get the sequence as a CharSequence. Used as an alternative togetSequenceString()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()andCharSequence.charAt(int). If a SequenceDocument is editable and changes are made to it, it is required that the original CharSequence obtained fromgetCharSequence()not change. A client of the SequenceDocument is only able to obtain the changes by making a fresh call togetCharSequence(). IfgetSequenceString()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.
- Returns:
- the sequence as a SequenceCharSequence; must not return null.
- See Also:
getSequenceString()
-
getSequenceAnnotations
java.util.List<SequenceAnnotation> getSequenceAnnotations()
Gets sequence annotations which are directly on the sequence. This does not include annotations onsequence tracks.
To get all annotations, including those on sequence tracks, useSequenceUtilities.getSequenceAndTrackAnnotationsThis 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)
WARNING: this list may not include all SequenceAnnotations represented as annotations in the sequence viewer. One such case is with trim annotations, which should be found usingSequenceUtilities.getSequenceAnnotationsIncludingImmutableSequencesTrims(SequenceDocument).
This may also return annotations that are not visible in the sequence viewer, such asSequenceAnnotation.TYPE_EXTRACTED_REGION.- Returns:
- a list of SequenceAnnotations; must not return null, but may return an
empty list (e.g.
Collections.emptyList()). - See Also:
SequenceUtilities.getSequenceAndTrackAnnotations(SequenceDocument),SequenceDocumentWithEditableAnnotations.setAnnotations(java.util.List)
-
isCircular
boolean isCircular()
Returns true if this sequence is circular. A circular sequence is one where the end points touch forming one continuous sequence without ends. For information on how annotations are handled in circular sequences, see.SequenceAnnotationInterval.getFrom()- Returns:
- true if this sequence is circular.
-
-