public abstract class ImmutableSequenceImplementation extends ImmutableSequence
ImmutableSequence.
To create implementations of ImmutableSequence you should
use ImmutableSequence.createImmutableSequence(SequenceDocument, boolean)
or ImmutableSequence.Builder
Furthermore, nothing outside of the Geneious public API may extend this class.
The only reason this class is declared public is because we define new class-loaders at runtime that need access to it.ImmutableSequence.BuilderSequenceDocument.Alphabet, SequenceDocument.TransformerPluginDocument.ReferencedDocumentsAlwaysLoaded, PluginDocument.ReferencedDocumentsNotLoaded, PluginDocument.SizeRequiredToLoadIntoMemoryProviderXMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportTypeEMPTYGENOME_SEQUENCE_THRESHOLDFILE_DATA_ATTRIBUTE_NAME, MAXIMUM_HTML_LENGTH, MODIFIED_DATE_FIELDROOT_ELEMENT_NAME| Modifier | Constructor and Description |
|---|---|
protected |
ImmutableSequenceImplementation() |
| Modifier and Type | Method and Description |
|---|---|
ImmutableSequence |
asDna()
Creates a new sequence that is identical to this sequence except with U replaced with T
|
ImmutableSequence |
asRna()
Creates a new sequence that is identical to this sequence except with T replaced with U
|
ImmutableSequence |
createCopyWithNameSuffix(String nameSuffix)
Creates a new sequence identical to this once except with a different name.
|
ImmutableSequence |
createCopyWithNewName(String newName)
Creates a new sequence identical to this once except with a different name.
|
ImmutableSequence |
delete(int deletionBegin,
int deletionEnd)
Returns a copy of this SequenceCharSequence where the characters at positions deletionBegin inclusive
to deletionEnd exclusive have been removed.
|
protected abstract int |
getBitsPerCharIncludingQuality() |
protected abstract com.biomatters.geneious.publicapi.documents.sequence.SequenceCharacterSets.CharacterSet |
getCharacterSet() |
SequenceCharSequence |
getCharSequence()
Get the sequence as a CharSequence.
|
protected abstract int |
getCharSequenceDataBitOffset() |
abstract sun.reflect.ConstructorAccessor |
getConstructorAccessorStatic() |
Date |
getCreationDate()
Get the date this document was created.
|
String |
getDescription()
A human readable single line of text describing this document,
to appear in the description field in the document table.
|
List<DocumentField> |
getDisplayableFields()
A list of columns for display in the main document panel.
|
Object |
getFieldValue(String fieldCodeName)
Get the value of a particular field.
|
protected abstract int |
getInt(int index) |
ImmutableSequence |
getInternalCharSequence()
Returns the CharSequence wrapped by this SequenceCharSequence, representing the
sequence without the terminal gaps.
|
protected abstract int |
getLengthOfSequenceIncludingEndGaps() |
protected abstract int |
getLengthOfSequenceIncludingEndGapsStatic() |
protected abstract int |
getMappingQualityBits() |
protected abstract int |
getMappingQualityDataBitOffset() |
String |
getName()
A short name (preferably one or two words) for the document.
|
protected abstract int |
getNameDataBitOffset() |
protected abstract Object |
getNamePatternObject() |
protected abstract int |
getNumberOfBitsUsedToStoreLength() |
protected abstract int |
getNumberOfMappedLocationsBits() |
protected abstract int |
getNumberOfMappedLocationsDataBitOffset() |
List<SequenceAnnotation> |
getSequenceAnnotations()
Gets sequence annotations which are directly on the sequence.
|
String |
getSequenceString()
Get the sequence as a string.
|
protected abstract char[] |
getStates() |
protected abstract int |
getTrimDataBitOffset() |
int |
getUngappedLength()
returns the length of this sequence, excluding any gaps (both internal and end gaps)
|
URN |
getURN()
A Universal Resource Name.
|
protected abstract boolean |
hasEndGaps() |
protected abstract boolean |
hasSequenceQualities() |
protected abstract boolean |
hasTrims() |
ImmutableSequence |
insert(int index,
CharSequence charSequence)
Creates a copy of this SequenceCharSequence with the specified CharSequence inserted
at the specified index.
|
ImmutableSequence |
insertGaps(int leadingGapsLength,
int trailingGapsLength,
int[] internalGapPositions,
int[] internalGapSizes)
Creates a new sequence identical to this one except with some gaps inserted.
|
boolean |
isCircular()
Returns true if this sequence is circular.
|
static boolean |
isImmutableSequenceHeader(byte header) |
boolean |
isReversed()
Determine if this sequence is reversed (i.e.
|
static ImmutableSequence |
readObject(DataInput in,
byte header) |
ImmutableSequence |
removeGaps()
Creates a new sequence identical to this once except all gaps (both end and internal) have been removed.
|
ImmutableSequence |
reverse()
Create a new sequence that is the reverse of this sequence.
|
ImmutableSequence |
reverseComplement()
Create a new sequence that is the reverse complement of this sequence.
|
protected abstract void |
setCharactersAndBitsPerCharStatic(com.biomatters.geneious.publicapi.documents.sequence.SequenceCharacterSets.CharacterSet _characters,
int _bitsPerCharIncludingQuality) |
protected abstract void |
setCompactNamePatternStatic(Object pattern) |
abstract void |
setConstructorAccessorStatic(sun.reflect.ConstructorAccessor constructorAccessor) |
protected abstract void |
setHasEndGapsStatic(boolean _hasEndGaps,
int _lengthOfSequenceIncludingEndGaps) |
protected abstract void |
setHasTrimsStatic(boolean _hasTrims) |
protected abstract void |
setInt(int index,
int data) |
protected abstract void |
setMappingQualityBitsStatic(int _mappingQualityBits) |
protected abstract void |
setNumberOfBitsUsedToStoreLengthStatic(int _numberOfBitsUsedToStoreLength) |
protected abstract void |
setNumberOfIntegersOfStorage(int numberOfIntegersOfStorage) |
protected abstract void |
setNumberOfMappedLocationsBitsStatic(int _numberOfMappedLocationsBits) |
ImmutableSequence |
subSequence(int start,
int end)
Constructs a subsequence of this sequence.
|
String |
toHTML()
Provide a textual view of document.
|
ImmutableSequence |
withMappingQuality(int mappingQuality)
Creates a new sequence identical to this one, except with a different value for
ImmutableSequence.getMappingQuality() |
ImmutableSequence |
withNumberOfMappedLocations(int numberOfMappedLocations)
Creates a new sequence identical to this one, except with a different value for
ImmutableSequence.getNumberOfMappedLocations() |
ImmutableSequence |
withTrimLengths(int leadingTrimLength,
int trailingTrimLength)
Creates a new sequence identical to this one, except with different leading and trailing trim lengths.
|
compactAminoAcidSequences, compactNucleotideSequences, createImmutableSequence, createImmutableSequence, getCharAndQualityAtIgnoringEndGaps, getData, getLeadingTrimLength, getMappingQuality, getNumberOfIntegersOfStorage, getNumberOfMappedLocations, getTrailingTrimLength, getVersionSupport, immutableSequenceFromXML, readObject, subString, toXML, toXML, writeObject, writeObjectcharAt, charAtIgnoringEndGaps, compareTo, contains, containsInvalidResidues, count, countGaps, equals, equalsIgnoreCase, fromXml, fromXML, getInternalSequenceLength, getLeadingGapsLength, getTrailingGapsLength, getTrailingGapsStartIndex, hashCode, indexOf, indexOf, isAllGaps, isEndGap, isGap, readObject, toString, toXML, toXML, valueOf, withOnlyGaps, withTerminalGaps, writeObjectclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetSequenceLengthfromXML, toXMLlengthprotected abstract void setInt(int index,
int data)
protected abstract void setCharactersAndBitsPerCharStatic(com.biomatters.geneious.publicapi.documents.sequence.SequenceCharacterSets.CharacterSet _characters,
int _bitsPerCharIncludingQuality)
protected abstract void setNumberOfBitsUsedToStoreLengthStatic(int _numberOfBitsUsedToStoreLength)
protected abstract void setHasEndGapsStatic(boolean _hasEndGaps,
int _lengthOfSequenceIncludingEndGaps)
protected abstract void setHasTrimsStatic(boolean _hasTrims)
protected abstract void setNumberOfMappedLocationsBitsStatic(int _numberOfMappedLocationsBits)
protected abstract void setMappingQualityBitsStatic(int _mappingQualityBits)
protected abstract void setCompactNamePatternStatic(Object pattern)
protected abstract int getNumberOfBitsUsedToStoreLength()
protected abstract boolean hasEndGaps()
protected abstract boolean hasTrims()
protected abstract int getNumberOfMappedLocationsBits()
protected abstract int getMappingQualityBits()
protected abstract int getLengthOfSequenceIncludingEndGaps()
protected abstract int getLengthOfSequenceIncludingEndGapsStatic()
protected abstract int getCharSequenceDataBitOffset()
protected abstract int getBitsPerCharIncludingQuality()
protected abstract char[] getStates()
protected abstract com.biomatters.geneious.publicapi.documents.sequence.SequenceCharacterSets.CharacterSet getCharacterSet()
protected abstract Object getNamePatternObject()
protected abstract boolean hasSequenceQualities()
protected abstract void setNumberOfIntegersOfStorage(int numberOfIntegersOfStorage)
protected abstract int getTrimDataBitOffset()
protected abstract int getNameDataBitOffset()
protected abstract int getNumberOfMappedLocationsDataBitOffset()
protected abstract int getMappingQualityDataBitOffset()
protected abstract int getInt(int index)
public ImmutableSequence reverseComplement()
ImmutableSequenceSequenceExtractionUtilities.REVERSED_NAME_SUFFIX either appended or removedreverseComplement in class ImmutableSequenceNucleotideSequenceDocumentImmutableSequence.reverse()public ImmutableSequence asDna()
ImmutableSequenceasDna in class ImmutableSequenceNucleotideSequenceDocumentpublic ImmutableSequence asRna()
ImmutableSequenceasRna in class ImmutableSequenceNucleotideSequenceDocumentpublic ImmutableSequence reverse()
ImmutableSequencereverse in class ImmutableSequenceAminoAcidSequenceDocumentImmutableSequence.reverseComplement()public ImmutableSequence getInternalCharSequence()
SequenceCharSequencegetInternalCharSequence in class SequenceCharSequencepublic String getName()
PluginDocumentAnnotatedPluginDocument then this method
will be overridden and delegate back to AnnotatedPluginDocument.getName(). One way to look at it is
that when you call PluginDocument.getName() you will get the current name of the document. If you are implementing PluginDocument.getName() then you are
returning the default name for the document.public boolean isReversed()
ImmutableSequenceSequenceExtractionUtilities.REVERSED_NAME_SUFFIX)isReversed in class ImmutableSequencepublic ImmutableSequence removeGaps()
ImmutableSequenceremoveGaps in class ImmutableSequenceNucleotideSequenceDocument the returned sequence will also be a NucleotideSequenceDocument. If this sequence is an AminoAcidSequenceDocument the returned sequence will also be a AminoAcidSequenceDocumentpublic ImmutableSequence insertGaps(int leadingGapsLength, int trailingGapsLength, int[] internalGapPositions, int[] internalGapSizes)
ImmutableSequenceinsertGaps in class ImmutableSequenceleadingGapsLength - the number of additional leading gaps to add to this sequencetrailingGapsLength - the number of additional trailing gaps to add to this sequenceinternalGapPositions - the positions of internal gaps to insert into this sequence. All values must be in the range 1 through to the internal sequence length-1 inclusive and indicate that a gap should be inserted before the current character at that index. This array may be null which is equivalent to an empty array.internalGapSizes - the sizes of corresponding internal gaps to insert into this sequence. This array must be equal in length to internalGapPositions. Each size must be positive. This array may be null which is equivalent to an empty array.NucleotideSequenceDocument the returned sequence will also be a NucleotideSequenceDocument. If this sequence is an AminoAcidSequenceDocument the returned sequence will also be a AminoAcidSequenceDocumentpublic ImmutableSequence insert(int index, CharSequence charSequence)
SequenceCharSequenceinsertions
and deletions, and its length will be longer than this sequence's by
charSequence.length().
In order to obey the contract of SequenceCharSequence that it is immutable,
the length of charSequence and the characters retured from charSequence must not change after calling this method.insert in class ImmutableSequenceindex - The position where to insert csq. All existing characters at or to the right of this position will be moved to the right by charSequence.length().charSequence - A CharSequence to insert at the specified index. The length of charSequence and the characters retured from charSequence must not change after calling this method.public ImmutableSequence withTrimLengths(int leadingTrimLength, int trailingTrimLength)
ImmutableSequencewithTrimLengths in class ImmutableSequenceleadingTrimLength - the leading trim length as defined by ImmutableSequence.getLeadingTrimLength()trailingTrimLength - the trailing trim length as defined by ImmutableSequence.getTrailingTrimLength()public ImmutableSequence withNumberOfMappedLocations(int numberOfMappedLocations)
ImmutableSequenceImmutableSequence.getNumberOfMappedLocations()withNumberOfMappedLocations in class ImmutableSequencenumberOfMappedLocations - the new number of mapped locationsImmutableSequence.getNumberOfMappedLocations()public ImmutableSequence withMappingQuality(int mappingQuality)
ImmutableSequenceImmutableSequence.getMappingQuality()withMappingQuality in class ImmutableSequencemappingQuality - the new mapping quality. -1 for no quality, or between 0 and 254 inclusive for a valid mapping qualityImmutableSequence.getMappingQuality()public ImmutableSequence delete(int deletionBegin, int deletionEnd)
SequenceCharSequenceinsertions
and deletions, and its length will be shorter than this sequence's by
deletionEnd - deletionBegin.delete in class ImmutableSequencedeletionBegin - Deletion start index, inclusivedeletionEnd - Deletion end index, exclusivepublic ImmutableSequence subSequence(int start, int end)
SequenceCharSequenceSequenceCharSequence.insert(int, CharSequence) or SequenceCharSequence.delete(int, int)) and supports logarithmic
time modifications, then it is guaranteed that the returned subsequence supports logarithmic
time modifications as well.subSequence in interface CharSequencesubSequence in class SequenceCharSequencestart - the start index, inclusiveend - the end index, exclusivepublic ImmutableSequence createCopyWithNewName(String newName)
ImmutableSequencecreateCopyWithNewName in class ImmutableSequencenewName - the name of the new sequence to createNucleotideSequenceDocument the returned sequence will also be a NucleotideSequenceDocument. If this sequence is an AminoAcidSequenceDocument the returned sequence will also be a AminoAcidSequenceDocumentpublic ImmutableSequence createCopyWithNameSuffix(String nameSuffix)
ImmutableSequencecreateCopyWithNameSuffix in class ImmutableSequencenameSuffix - a suffix to append to the name. If the current name ends with " (reversed)" then the suffix will be appended immediately prior to the reversed suffix.NucleotideSequenceDocument the returned sequence will also be a NucleotideSequenceDocument. If this sequence is an AminoAcidSequenceDocument the returned sequence will also be a AminoAcidSequenceDocumentpublic String getSequenceString()
SequenceDocumentSequenceDocument.getCharSequence() doesn't call this method, then one possible implementation
for this method is the following:
return getCharSequence().toString();
SequenceDocument.getCharSequence()public SequenceCharSequence getCharSequence()
SequenceDocumentSequenceDocument.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
SequenceDocument.getCharSequence()
not change. A client of the SequenceDocument is only able to obtain
the changes by making a fresh call to SequenceDocument.getCharSequence().
If SequenceDocument.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, SequenceDocument.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.
SequenceDocument.getSequenceString()public List<SequenceAnnotation> getSequenceAnnotations()
SequenceDocumentsequence 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)public boolean isCircular()
SequenceDocumentSequenceAnnotationInterval.getFrom()public List<DocumentField> getDisplayableFields()
PluginDocumentPluginDocument.getFieldValue(String).
Each column is specified by a Field. The fields should be obtained from a call to the appropriate
Field.createXXXXField, where XXXX is the appropriate type.
While it is not required, it is recommended that a PluginDocument
handle returning a complete list of its displayable fields before
the document has been properly constructed via a call to XMLSerializable.fromXML(org.jdom.Element)
The returned list need not and should not be modifiable.public Object getFieldValue(String fieldCodeName)
PluginDocumentfieldCodeName - field code. This should be the
code of one of the fields
returned from PluginDocument.getDisplayableFields().DocumentField.getValueType() (or a subclass) of the corresponding DocumentField returned from PluginDocument.getDisplayableFields().public URN getURN()
PluginDocumentpublic Date getCreationDate()
PluginDocumentAnnotatedPluginDocument.getCreationDate()
instead as that will return either the date returned from
PluginDocument.getCreationDate() or if that returned null,
AnnotatedPluginDocument.getCreationDate() will return the date the
document was first instantiated.PluginDocument.MODIFIED_DATE_FIELDpublic String getDescription()
PluginDocumentpublic String toHTML()
PluginDocument<html>public abstract void setConstructorAccessorStatic(sun.reflect.ConstructorAccessor constructorAccessor)
public abstract sun.reflect.ConstructorAccessor getConstructorAccessorStatic()
public static boolean isImmutableSequenceHeader(byte header)
public static ImmutableSequence readObject(DataInput in, byte header) throws XMLSerializationException
XMLSerializationExceptionpublic int getUngappedLength()
SequenceCharSequencegetUngappedLength in class SequenceCharSequence