Class SequenceAnnotation
- java.lang.Object
-
- com.biomatters.geneious.publicapi.documents.sequence.SequenceAnnotation
-
- All Implemented Interfaces:
XMLSerializable
,XMLSerializable.OldVersionCompatible
public final class SequenceAnnotation extends java.lang.Object implements XMLSerializable, XMLSerializable.OldVersionCompatible
Provides information on a subset of the sequence. SequenceAnnotations are known as features in genbank format. Each annotation has a name (seegetName()
) and a type (seegetType()
) along with a set of name-value pairs (seegetQualifiers()
and the intervals of the sequence which the annotation covers (seegetIntervals()
Annotations are obtained viaSequenceDocument.getSequenceAnnotations
or from a track viaSequenceTrack.getSequenceAnnotations()
-
-
Nested Class Summary
-
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 java.lang.String
HIDDEN_TYPE_FOR_ACTIVELY_LINKED_PARENTS
An annotation type for annotations added to documents which are actively linked to their descendants (seeOperationRecordDocument.hasAnyActiveLinks()
).static java.lang.String
INVISIBLE_ANNOTATION_TYPE_PREFIX
Annotations whose type (getType()
) has this prefix are not visible in the sequence viewer.static java.lang.String
KEY_ANNOTATION_GROUP
Name
of a qualifier whose value identifies a group that this annotation belongs to on a single sequence.static java.lang.String
KEY_CREATED_BY
A special key used to identify the origin of this annotation.static java.lang.String
KEY_MODIFIED_BY
A special key to identify the last modifier of this annotation.static java.lang.String
TYPE_CDS
static java.lang.String
TYPE_CHAIN
static java.lang.String
TYPE_CLONING_FRAGMENT
The type of annotation adding to the results of a cloning operation to indicate which source sequence that fragment of the result was produced fromstatic java.lang.String
TYPE_COIL
static java.lang.String
TYPE_COILED_COIL
static java.lang.String
TYPE_CONCATENATED_SEQUENCE
Deprecated.useTYPE_CLONING_FRAGMENT
instead.static java.lang.String
TYPE_CONFLICT
static java.lang.String
TYPE_CRISPR
Candidate CRISPR sitestatic java.lang.String
TYPE_DISULFIDE_BOND
static java.lang.String
TYPE_DNA_PROBE
static java.lang.String
TYPE_DOMAIN
static java.lang.String
TYPE_EDITING_HISTORY_DELETION
static java.lang.String
TYPE_EDITING_HISTORY_INSERTION
A directionless annotation type to record deletions, insertions and replacements of bases in a sequence compared to the original imported sequence.static java.lang.String
TYPE_EDITING_HISTORY_REPLACEMENT
static java.lang.String
TYPE_EXCLUDED_REGION
Annotations of this type are length 0 annotations between 2 sites, and represent a region of the sequence that has been excluded for some reason, usually for example when viewing a query centric alignment with gaps hidden in the reference sequence.static java.lang.String
TYPE_EXON
static java.lang.String
TYPE_EXPRESSION_DIFFERENCE
A type used to represent differential expression levels (for example when dealing with RNA sequencing data)static java.lang.String
TYPE_EXPRESSION_LEVEL
A type used to represent expression levels (for example when dealing with RNA sequencing data)static java.lang.String
TYPE_EXTRACTED_REGION
This is an invisible annotation that contains a mapping from the original sequence indices to the current sequence indices.static java.lang.String
TYPE_GENE
static java.lang.String
TYPE_GIBSON_PRIMER_EXTENSION
A type to mark bases that have to be added as a primer extension (instead of primer binding site) during the newgibson assembly operation.static java.lang.String
TYPE_HELIX
static java.lang.String
TYPE_HIGH_COVERAGE
Annotation types created by High/Low coverage finder when it finds high coverage regions.static java.lang.String
TYPE_INSERTED_SEQUENCE
static java.lang.String
TYPE_INTRON
static java.lang.String
TYPE_JUNCTION
The annotation type created by reference mapping and SAM/BAM import when there are large deletions or intronsstatic java.lang.String
TYPE_LIGATION
static java.lang.String
TYPE_LONG_TERMINAL_REPEAT
static java.lang.String
TYPE_LOW_COVERAGE
Annotation types created by High/Low coverage finder when it finds low coverage regions Note that prior to Geneious 2022.2, the coverage finder would only use this field (value "Coverage - Low") under some situations and would use a value of "Low" in other situations.static java.lang.String
TYPE_LOW_QUALITY
Deprecated.replaced withTYPE_TRIMMED
.static java.lang.String
TYPE_MASKED
The annotation type used to mask alignment regions for the purpose of inferring phylogeny.static java.lang.String
TYPE_MATURE_PEPTIDE
static java.lang.String
TYPE_MISC_DIFFERENCE
static java.lang.String
TYPE_MISC_FEATURE
static java.lang.String
TYPE_MISC_RNA
static java.lang.String
TYPE_MOTIF
static java.lang.String
TYPE_MRNA
static java.lang.String
TYPE_NCRNA
static java.lang.String
TYPE_OPTIMIZED_CODON
A type used to represent a codon that has been replaced wih an optimized equivalentstatic java.lang.String
TYPE_ORF
static java.lang.String
TYPE_ORIGIN
static java.lang.String
TYPE_ORIGIN_OF_REPLICATION
static java.lang.String
TYPE_OVERHANG
A terminal region of a sequence annotated with an annotation of this type is an overhang on one of the strands.static java.lang.String
TYPE_PEPTIDE
static java.lang.String
TYPE_POLYA_SIGNAL
static java.lang.String
TYPE_POLYA_SITE
static java.lang.String
TYPE_POLYLINKER
static java.lang.String
TYPE_POLYMORPHISM
Used for any type of variant annotation, for example SNPs or longer variants.static java.lang.String
TYPE_POTENTIAL_RESTRICTION_SITE
Restriction site that can be introduced by a silent mutationstatic java.lang.String
TYPE_PRECURSOR_RNA
static java.lang.String
TYPE_PRIMER_BIND
Primer annotation type.
Primer annotations should not be created inside tracks as most primer handling code ignores tracks.static java.lang.String
TYPE_PRIMER_BIND_REVERSE
Deprecated.Should only be used to check for legacy primers.static java.lang.String
TYPE_PROMOTER
static java.lang.String
TYPE_PROTEIN_BIND
static java.lang.String
TYPE_REGULATORY
From Genbank definition: "Any region of sequence that functions in the regulation of transcription or translation"static java.lang.String
TYPE_REPEAT_REGION
static java.lang.String
TYPE_REPEAT_UNIT
static java.lang.String
TYPE_RESTRICTION_SITE
static java.lang.String
TYPE_RRNA
static java.lang.String
TYPE_SEARCH_HIT
The type of annotation added to a sequence search result to indicate the region that matched the query sequencestatic java.lang.String
TYPE_SIGNAL_PEPTIDE
static java.lang.String
TYPE_SITE
static java.lang.String
TYPE_SOURCE
static java.lang.String
TYPE_SPACER
static java.lang.String
TYPE_STATISTICS
A type used to represent statistical datastatic java.lang.String
TYPE_STRAND
static java.lang.String
TYPE_TERMINATOR
static java.lang.String
TYPE_TMRNA
static java.lang.String
TYPE_TRANSLATED_REGION
These annotations were created on translations prior to 10.0.0 but were never used.static java.lang.String
TYPE_TRANSMEMBRANE
static java.lang.String
TYPE_TRIMMED
Regions of a sequence covered by trim annotations are ignored for many operations, including assembly and consensus sequence calculation.static java.lang.String
TYPE_TRNA
static java.lang.String
TYPE_TURN
static java.lang.String
TYPE_UTR_3
static java.lang.String
TYPE_UTR_5
static java.lang.String
TYPE_VECTOR_MODERATE
static java.lang.String
TYPE_VECTOR_SEGMENT_OF_SUSPECT_ORIGIN
static java.lang.String
TYPE_VECTOR_STRONG
static java.lang.String
TYPE_VECTOR_WEAK
static java.lang.String
TYPE_WIG
Wiggle track (WIG) annotation-
Fields inherited from interface com.biomatters.geneious.publicapi.documents.XMLSerializable
ROOT_ELEMENT_NAME
-
-
Constructor Summary
Constructors Constructor Description SequenceAnnotation(SequenceAnnotation annotation)
creates a copy of the given annotationSequenceAnnotation(SequenceAnnotation annotation, int offset)
creates a copy of the given annotation offset by a certain amountSequenceAnnotation(java.lang.String name, java.lang.String type)
Constructs a new SequenceAnnotation with the specified name and type.SequenceAnnotation(java.lang.String name, java.lang.String type, SequenceAnnotationInterval... intervals)
Constructs a new SequenceAnnotation with the specified name and type.SequenceAnnotation(org.jdom.Element element)
XML deserialization constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addInterval(int from, int to)
Add one left to right interval to this annotation.void
addInterval(int minIndex, int maxIndex, SequenceAnnotationInterval.Direction direction)
Add one interval to this annotation.void
addInterval(SequenceAnnotationInterval interval)
add a new interval to this annotation.void
addIntervals(java.util.Collection<SequenceAnnotationInterval> intervalsToAdd)
adds a collection of intervals to this annotationvoid
addQualifier(SequenceAnnotationQualifier qualifier)
add a newqualifier
.void
addQualifier(java.lang.String name, java.lang.String value)
Add aqualifier
with the specified name-value mapping.void
addQualifiers(java.util.Collection<SequenceAnnotationQualifier> qualifiersToAdd)
Adds all the given qualifiers to this annotationstatic java.util.List<SequenceAnnotation>
applyHiddenAnnotationsForDeletingFromActivelyLinkedChild(URN urnOfDocument, java.util.List<SequenceAnnotation> potentialDeletionAnnotations, java.util.List<SequenceAnnotation> annotationsToApplyTo)
Applies any annotations created usingcreateHiddenAnnotationForDeletingThisFromActivelyLinkedChild(URN)
that are withinpotentialDeletionAnnotations
to the listannotationsToApplyTo by removing the matching annotation from that list and returning the edited list.boolean
containsOnPotentiallyCircularSequence(int startPosition, int length, int sequenceLengthIfCircular)
Checks whether any of this annotation's intervals include a residues between startPosition and startPosition+length on a potentially circular sequence.static java.util.List<SequenceAnnotation>
copyOf(java.util.List<SequenceAnnotation> sequenceAnnotationsToCopy)
Creates a deep copy of a list of SequenceAnnotations.SequenceAnnotation
copyWithoutIntervals()
Creates a copy of this annotation, without any intervals.SequenceAnnotation
createHiddenAnnotationForDeletingThisFromActivelyLinkedChild(URN urnOfDocument)
Creates an invisible annotation which can be added to an actively linked child document to indicate that this child document should delete the matching annotation when it is recreated after a parent document is edited.static SequenceAnnotation
createMaskedAnnotation(int minimumIndexInclusive, int maximumIndexInclusive)
Creates a newTYPE_MASKED
annotationstatic SequenceAnnotation
createTrimAnnotation(int minimumIndexInclusive, int maximumIndexInclusive)
Creates a newTYPE_TRIMMED
annotationboolean
equals(java.lang.Object obj)
void
fromXML(org.jdom.Element element)
Restore the object from the JDOM Element returned byXMLSerializable.toXML()
.static java.lang.String
getAlignmentHiddenQualifierName(SequenceDocument.Alphabet alphabet, boolean firstSequenceIsReferenceSequence, java.lang.String alignmentName, java.lang.String sequenceName)
Returns the name of an hidden (SequenceAnnotationQualifier.HIDDEN_PREFIX
) annotation qualifier that can be used for storing a single sequence that will appear in the alignments returned fromgetAlignmentsFromHiddenQualifiers()
.java.util.List<SequenceAlignmentDocument>
getAlignmentsFromHiddenQualifiers()
All alignments that can be created from hidden qualifiers returned fromgetAlignmentHiddenQualifierName(SequenceDocument.Alphabet, boolean, String, String)
.SequenceAnnotation
getAnnotationAdjustedForDeletion(int deletionStart, int deletionLength, boolean isDeletionAllGaps, int newSequenceLengthIfCircular)
Deprecated.SequenceAnnotation
getAnnotationAdjustedForDeletion(int deletionStart, java.lang.CharSequence deletedSequence, int newSequenceLengthIfCircular)
Handles a deletion from the sequence which this annotation is for, by either returning a new annotation adjusted to take the deletion into account, or this annotation if it doesn't change, or null if the annotation should be deleted (for example the user deletes nucleotides from a primer annotation).SequenceAnnotation
getAnnotationAdjustedForInsertion(int indexToInsertAt, int lengthOfInsertion, boolean isInsertionAllGaps, int newSequenceLengthIfCircular)
Handles an insertion into the sequence which this annotation is for, by either returning a new annotation adjusted to take the insertion into account, or this annotation if it doesn't change, or null if the annotation should be deleted (for example the user inserts nucleotides into a primer annotation)SequenceAnnotation
getAnnotationAdjustedForReplacement(int replacementPosition, int replacementLength, int sequenceLengthIfCircular)
Handles a non-gap replacement in the sequence which this annotation is for, by either returning this annotation if it doesn't change, or null if the annotation should be deleted (for example the user replaces nucleotides in a primer annotation)int
getCodonStart()
The value of theNCBI_CODON_START
qualifier indicates the offset at which the first complete codon of a coding feature can be found, relative to the first base of that feature.SequenceAnnotationInterval
getInterval()
If this annotation has exactly 1 interval gets that interval or throws anIllegalStateException
if it doesn't have exactly 1 interval.SequenceAnnotationInterval
getInterval(int intervalIndex)
Returns one of the intervals from this annotationjava.util.List<SequenceAnnotationInterval>
getIntervals()
Gets all theintervals
this annotation contains.java.lang.String
getName()
The name of the annotation which should be a short human readable text description.int
getNumberOfIntervals()
Returns the number of intervals this annotation hasjava.util.List<SequenceAnnotationQualifier>
getQualifiers()
A list of qualifiers for the sequence.java.lang.String
getQualifierValue(java.lang.String name)
Get the value of the first qualifier in the list of the given name or "" if one is not found.static java.lang.String
getTranslation(AnnotatedPluginDocument document, SequenceDocument sequence, SequenceAnnotation annotation)
Returns the translation (if applicable) for the given annotation.java.lang.String
getType()
Type of the annotation.UrnWithSequenceRegions
getUrnQualifierValue(java.lang.String name)
If the qualifier with the given name was created usingSequenceAnnotationQualifier(String, UrnWithSequenceRegions, boolean, String)
returns the UrnWithSequenceRegions provided.Geneious.MajorVersion
getVersionSupport(XMLSerializable.VersionSupportType versionType)
Gets either the latest version this class can serialize to viaXMLSerializable.OldVersionCompatible.toXML(Geneious.MajorVersion, ProgressListener)
or the most recent version in which the XML returned fromXMLSerializable.OldVersionCompatible.toXML(Geneious.MajorVersion, ProgressListener)
last changed.static Geneious.MajorVersion
getVersionSupportStatic(XMLSerializable.VersionSupportType versionType)
A static implementation ofgetVersionSupport(com.biomatters.geneious.publicapi.documents.XMLSerializable.VersionSupportType)
that can be used in place of that method since all SequenceAnnotation instances have the same version support.int
hashCode()
boolean
isAddedToActivelyLinkedChild(URN urnOfDocument)
Returns true if this annotation was flagged usingsetIsAddedToActivelyLinkedChild(URN)
static boolean
isEditingAnnotationType(java.lang.String type)
boolean
isInvisible()
static boolean
isInvisibleAnnotationType(java.lang.String type)
Returns true if annotations of this type are not visible to the user.boolean
isPrimer()
static boolean
isReadOnlyAnnotationType(java.lang.String type)
static SequenceAnnotation
readObject(GeneiousObjectInputStream in)
Reads data previously created usingwriteObject(GeneiousObjectOutputStream)
It is a good idea to use aGeneiousObjectInputStream
when deserializing lots of annotations.static SequenceAnnotation
readObject(java.io.DataInput in)
Reads data previously created usingwriteObject(java.io.DataOutput)
boolean
removeAnnotationWhenEdited()
void
removeInterval(SequenceAnnotationInterval interval)
Removes the given interval from this annotation.void
removeQualifier(SequenceAnnotationQualifier qualifierToRemove)
Removes the given qualifier from this annotation.void
removeQualifier(java.lang.String name)
Deletes all existing qualifiers with the given nameSequenceAnnotation
reverse(int sequenceLength, SequenceDocument.Alphabet alphabet)
Creates a new annotation that is either the reverse or the reverse complements this annotation.void
setIntervals(java.util.List<SequenceAnnotationInterval> intervals)
set the intervals on this annotationvoid
setIsAddedToActivelyLinkedChild(URN urnOfDocument)
Flags this annotations as being added to a sequence which is actively linked to its parent document.void
setName(java.lang.String name)
void
setQualifier(java.lang.String name, java.lang.String value)
Deletes all existing qualifiers with the given name, and adds a new qualifier with the given value.void
setQualifiers(java.util.List<SequenceAnnotationQualifier> qualifiers)
Set a new list of qualifiers on this SequenceAnnotation, removing any existing qualifiers added viaaddQualifier(String, String)
oraddQualifier(SequenceAnnotationQualifier)
oraddQualifiers(java.util.Collection)
orsetQualifiers(java.util.List)
void
setType(java.lang.String type)
Set the type of this annotation.java.lang.String
toString()
Returns a human readable string with information about this annotation; the exact format of the string is not guaranteed and should not be relied on, because it may change at any time.org.jdom.Element
toXML()
Convert object to a JDOM element.org.jdom.Element
toXML(Geneious.MajorVersion majorVersion, jebl.util.ProgressListener progressListener)
Serialization of annotation - to.void
writeObject(GeneiousObjectOutputStream out)
Writes this annotation to an output stream as defined bySerializable
.void
writeObject(Geneious.MajorVersion version, java.io.DataOutput out)
Writes this annotation to a DataOutput in a form that can potentially be read by old versions of Geneiousvoid
writeObject(java.io.DataOutput out)
Writes this annotation to a DataOutput
-
-
-
Field Detail
-
INVISIBLE_ANNOTATION_TYPE_PREFIX
public static final java.lang.String INVISIBLE_ANNOTATION_TYPE_PREFIX
Annotations whose type (getType()
) has this prefix are not visible in the sequence viewer.- Since:
- API 4.60 (Geneious 5.6.0)
- See Also:
isInvisibleAnnotationType(String)
,isInvisible()
, Constant Field Values
-
HIDDEN_TYPE_FOR_ACTIVELY_LINKED_PARENTS
public static final java.lang.String HIDDEN_TYPE_FOR_ACTIVELY_LINKED_PARENTS
An annotation type for annotations added to documents which are actively linked to their descendants (seeOperationRecordDocument.hasAnyActiveLinks()
). When a document containing an annotation of this type is regenerated because its parent has changed, then despite all other data on the document being discarded, if the region covered by this annotation can be unambiguously identified on the new version of the document, then this annotation will be copied to the new document covering that region. Annotations of this type will be hidden from the user interface. They are intended for programatic use only.- Since:
- API 4.60 (Geneious 5.6.0)
- See Also:
SequenceAnnotationQualifier.HIDDEN_QUALIFIER_FOR_ACTIVELY_LINKED_PARENTS
, Constant Field Values
-
TYPE_ORF
public static final java.lang.String TYPE_ORF
- See Also:
- Constant Field Values
-
TYPE_CDS
public static final java.lang.String TYPE_CDS
- See Also:
- Constant Field Values
-
TYPE_SPACER
public static final java.lang.String TYPE_SPACER
- See Also:
- Constant Field Values
-
TYPE_GENE
public static final java.lang.String TYPE_GENE
- See Also:
- Constant Field Values
-
TYPE_EXTRACTED_REGION
public static final java.lang.String TYPE_EXTRACTED_REGION
This is an invisible annotation that contains a mapping from the original sequence indices to the current sequence indices. SeeSequenceAnnotationQualifier.EXTRACTED_REGION_INTERVALS_NAME
for the name of the qualifier that contains the mapping.- See Also:
- Constant Field Values
-
TYPE_TRANSLATED_REGION
public static final java.lang.String TYPE_TRANSLATED_REGION
These annotations were created on translations prior to 10.0.0 but were never used. They are similar toTYPE_EXTRACTED_REGION
- See Also:
- Constant Field Values
-
TYPE_ORIGIN
public static final java.lang.String TYPE_ORIGIN
- See Also:
- Constant Field Values
-
TYPE_UTR_5
public static final java.lang.String TYPE_UTR_5
- See Also:
- Constant Field Values
-
TYPE_UTR_3
public static final java.lang.String TYPE_UTR_3
- See Also:
- Constant Field Values
-
TYPE_PRIMER_BIND
public static final java.lang.String TYPE_PRIMER_BIND
Primer annotation type.
Primer annotations should not be created inside tracks as most primer handling code ignores tracks.- See Also:
- Constant Field Values
-
TYPE_PRIMER_BIND_REVERSE
@Deprecated public static final java.lang.String TYPE_PRIMER_BIND_REVERSE
Deprecated.Should only be used to check for legacy primers. To create new primers, instead useTYPE_PRIMER_BIND
withSequenceAnnotationInterval.Direction.rightToLeft
Reverse directed primer annotation type.
Primer annotations should not be created inside tracks as most primer handling code ignores tracks.- See Also:
TYPE_PRIMER_BIND
, Constant Field Values
-
TYPE_PEPTIDE
public static final java.lang.String TYPE_PEPTIDE
- See Also:
- Constant Field Values
-
TYPE_MISC_FEATURE
public static final java.lang.String TYPE_MISC_FEATURE
- See Also:
- Constant Field Values
-
TYPE_SOURCE
public static final java.lang.String TYPE_SOURCE
- See Also:
- Constant Field Values
-
TYPE_EXON
public static final java.lang.String TYPE_EXON
- See Also:
- Constant Field Values
-
TYPE_INTRON
public static final java.lang.String TYPE_INTRON
- See Also:
- Constant Field Values
-
TYPE_DNA_PROBE
public static final java.lang.String TYPE_DNA_PROBE
- See Also:
- Constant Field Values
-
TYPE_RESTRICTION_SITE
public static final java.lang.String TYPE_RESTRICTION_SITE
- See Also:
- Constant Field Values
-
TYPE_POTENTIAL_RESTRICTION_SITE
public static final java.lang.String TYPE_POTENTIAL_RESTRICTION_SITE
Restriction site that can be introduced by a silent mutation- Since:
- API 4.1100 (Geneious 11.0.0)
- See Also:
- Constant Field Values
-
TYPE_WIG
public static final java.lang.String TYPE_WIG
Wiggle track (WIG) annotation- Since:
- API 4.201910 (Geneious Prime 2019.1.0)
- See Also:
- Constant Field Values
-
TYPE_MOTIF
public static final java.lang.String TYPE_MOTIF
- See Also:
- Constant Field Values
-
TYPE_REGULATORY
public static final java.lang.String TYPE_REGULATORY
From Genbank definition: "Any region of sequence that functions in the regulation of transcription or translation"- Since:
- API 4.810 (Geneious 8.1.0)
- See Also:
- Constant Field Values
-
TYPE_CRISPR
public static final java.lang.String TYPE_CRISPR
Candidate CRISPR site- Since:
- API 4.800 (Geneious 8.0.0)
- See Also:
- Constant Field Values
-
TYPE_SEARCH_HIT
public static final java.lang.String TYPE_SEARCH_HIT
The type of annotation added to a sequence search result to indicate the region that matched the query sequence- Since:
- API 4.703 (Geneious 7.0.3)
- See Also:
- Constant Field Values
-
TYPE_TRIMMED
public static final java.lang.String TYPE_TRIMMED
Regions of a sequence covered by trim annotations are ignored for many operations, including assembly and consensus sequence calculation.ImmutableSequence.getTrailingTrimLength()
andImmutableSequence.getLeadingTrimLength()
may also be used as an alternative method for indicating trimmed regions. Trim annotations should be created usingcreateTrimAnnotation(int, int)
- See Also:
- Constant Field Values
-
TYPE_HELIX
public static final java.lang.String TYPE_HELIX
- See Also:
- Constant Field Values
-
TYPE_STRAND
public static final java.lang.String TYPE_STRAND
- See Also:
- Constant Field Values
-
TYPE_TURN
public static final java.lang.String TYPE_TURN
- See Also:
- Constant Field Values
-
TYPE_COIL
public static final java.lang.String TYPE_COIL
- See Also:
- Constant Field Values
-
TYPE_VECTOR_SEGMENT_OF_SUSPECT_ORIGIN
public static final java.lang.String TYPE_VECTOR_SEGMENT_OF_SUSPECT_ORIGIN
- See Also:
- Constant Field Values
-
TYPE_VECTOR_WEAK
public static final java.lang.String TYPE_VECTOR_WEAK
- See Also:
- Constant Field Values
-
TYPE_VECTOR_MODERATE
public static final java.lang.String TYPE_VECTOR_MODERATE
- See Also:
- Constant Field Values
-
TYPE_VECTOR_STRONG
public static final java.lang.String TYPE_VECTOR_STRONG
- See Also:
- Constant Field Values
-
TYPE_POLYLINKER
public static final java.lang.String TYPE_POLYLINKER
- See Also:
- Constant Field Values
-
TYPE_DISULFIDE_BOND
public static final java.lang.String TYPE_DISULFIDE_BOND
- See Also:
- Constant Field Values
-
TYPE_ORIGIN_OF_REPLICATION
public static final java.lang.String TYPE_ORIGIN_OF_REPLICATION
- See Also:
- Constant Field Values
-
TYPE_TERMINATOR
public static final java.lang.String TYPE_TERMINATOR
- See Also:
- Constant Field Values
-
TYPE_SIGNAL_PEPTIDE
public static final java.lang.String TYPE_SIGNAL_PEPTIDE
- See Also:
- Constant Field Values
-
TYPE_MATURE_PEPTIDE
public static final java.lang.String TYPE_MATURE_PEPTIDE
- See Also:
- Constant Field Values
-
TYPE_PROMOTER
public static final java.lang.String TYPE_PROMOTER
- See Also:
- Constant Field Values
-
TYPE_SITE
public static final java.lang.String TYPE_SITE
- See Also:
- Constant Field Values
-
TYPE_LONG_TERMINAL_REPEAT
public static final java.lang.String TYPE_LONG_TERMINAL_REPEAT
- See Also:
- Constant Field Values
-
TYPE_REPEAT_REGION
public static final java.lang.String TYPE_REPEAT_REGION
- See Also:
- Constant Field Values
-
TYPE_REPEAT_UNIT
public static final java.lang.String TYPE_REPEAT_UNIT
- See Also:
- Constant Field Values
-
TYPE_MISC_DIFFERENCE
public static final java.lang.String TYPE_MISC_DIFFERENCE
- See Also:
- Constant Field Values
-
TYPE_CONFLICT
public static final java.lang.String TYPE_CONFLICT
- See Also:
- Constant Field Values
-
TYPE_POLYA_SIGNAL
public static final java.lang.String TYPE_POLYA_SIGNAL
- See Also:
- Constant Field Values
-
TYPE_POLYA_SITE
public static final java.lang.String TYPE_POLYA_SITE
- See Also:
- Constant Field Values
-
TYPE_PROTEIN_BIND
public static final java.lang.String TYPE_PROTEIN_BIND
- See Also:
- Constant Field Values
-
TYPE_DOMAIN
public static final java.lang.String TYPE_DOMAIN
- See Also:
- Constant Field Values
-
TYPE_TRANSMEMBRANE
public static final java.lang.String TYPE_TRANSMEMBRANE
- See Also:
- Constant Field Values
-
TYPE_COILED_COIL
public static final java.lang.String TYPE_COILED_COIL
- See Also:
- Constant Field Values
-
TYPE_POLYMORPHISM
public static final java.lang.String TYPE_POLYMORPHISM
Used for any type of variant annotation, for example SNPs or longer variants. All polymorphism annotations should be given a name which indicates the nucleotides in the variant. They may provide qualifiers forSequenceAnnotationQualifier.VARIANT_CHANGE
,SequenceAnnotationQualifier.VARIANT_NUCLEOTIDES
,SequenceAnnotationQualifier.VARIANT_REFERENCE_NUCLEOTIDES
,SequenceAnnotationQualifier.VARIANT_AMINO_ACIDS
- Since:
- API 4.615 (Geneious 6.1.5)
- See Also:
- Constant Field Values
-
TYPE_CHAIN
public static final java.lang.String TYPE_CHAIN
- See Also:
- Constant Field Values
-
TYPE_MRNA
public static final java.lang.String TYPE_MRNA
- See Also:
- Constant Field Values
-
TYPE_TMRNA
public static final java.lang.String TYPE_TMRNA
- See Also:
- Constant Field Values
-
TYPE_TRNA
public static final java.lang.String TYPE_TRNA
- See Also:
- Constant Field Values
-
TYPE_RRNA
public static final java.lang.String TYPE_RRNA
- See Also:
- Constant Field Values
-
TYPE_MISC_RNA
public static final java.lang.String TYPE_MISC_RNA
- See Also:
- Constant Field Values
-
TYPE_NCRNA
public static final java.lang.String TYPE_NCRNA
- See Also:
- Constant Field Values
-
TYPE_PRECURSOR_RNA
public static final java.lang.String TYPE_PRECURSOR_RNA
- See Also:
- Constant Field Values
-
TYPE_CONCATENATED_SEQUENCE
@Deprecated public static final java.lang.String TYPE_CONCATENATED_SEQUENCE
Deprecated.useTYPE_CLONING_FRAGMENT
instead.As of Geneious 2025.0, these types of annotations are no longer created by cloning operations. InsteadTYPE_CLONING_FRAGMENT
are created.- See Also:
- Constant Field Values
-
TYPE_CLONING_FRAGMENT
public static final java.lang.String TYPE_CLONING_FRAGMENT
The type of annotation adding to the results of a cloning operation to indicate which source sequence that fragment of the result was produced from- Since:
- API 4.202500 (Geneious 2025.0.0)
- See Also:
- Constant Field Values
-
TYPE_INSERTED_SEQUENCE
public static final java.lang.String TYPE_INSERTED_SEQUENCE
- See Also:
- Constant Field Values
-
TYPE_EXCLUDED_REGION
public static final java.lang.String TYPE_EXCLUDED_REGION
Annotations of this type are length 0 annotations between 2 sites, and represent a region of the sequence that has been excluded for some reason, usually for example when viewing a query centric alignment with gaps hidden in the reference sequence.- See Also:
- Constant Field Values
-
TYPE_OVERHANG
public static final java.lang.String TYPE_OVERHANG
A terminal region of a sequence annotated with an annotation of this type is an overhang on one of the strands. If the annotation is directed from left to right (SequenceAnnotationInterval.Direction.leftToRight
), the overhang is on the forward strand. If the annotation is directed right to left (SequenceAnnotationInterval.Direction.rightToLeft
), it is an overhang on the reverse strand.
Overhang annotations should not be created inside tracks as most overhang handling code ignores tracks.- See Also:
- Constant Field Values
-
TYPE_LIGATION
public static final java.lang.String TYPE_LIGATION
- See Also:
- Constant Field Values
-
TYPE_EDITING_HISTORY_INSERTION
public static final java.lang.String TYPE_EDITING_HISTORY_INSERTION
A directionless annotation type to record deletions, insertions and replacements of bases in a sequence compared to the original imported sequence. The bases that the annotation covers will always be bases the user has inserted into the sequence. And the qualifierSequenceAnnotationQualifier.EDITING_HISTORY_ORIGINAL_BASES
within the annotation records the bases that originally existed there. For example:1 2 3 4 5 6 7 8 9 G A T T A C A G G [ ] [C] [ T ]
Here we have 3 annotations. The first covers only the 3rd base and therefore represents and insertion of T at that point. The second annotation represents a deletion of a C between the 5th and 6th bases. The final annotation represents a replacement of a T with GG at the end of the sequence. This works well for the implementation but isn't that nice to look at so the text displayed to the user might be something like: "Inserted T", for the first annotaion, "Deleted C" for the second, and "Replaced T with GG" for the third.
-
TYPE_EDITING_HISTORY_REPLACEMENT
public static final java.lang.String TYPE_EDITING_HISTORY_REPLACEMENT
-
TYPE_EDITING_HISTORY_DELETION
public static final java.lang.String TYPE_EDITING_HISTORY_DELETION
-
TYPE_GIBSON_PRIMER_EXTENSION
public static final java.lang.String TYPE_GIBSON_PRIMER_EXTENSION
A type to mark bases that have to be added as a primer extension (instead of primer binding site) during the newgibson assembly operation.- Since:
- API 4.810 (Geneious 8.1.0)
- See Also:
- Constant Field Values
-
TYPE_LOW_QUALITY
@Deprecated public static final java.lang.String TYPE_LOW_QUALITY
Deprecated.replaced withTYPE_TRIMMED
.- See Also:
- Constant Field Values
-
TYPE_STATISTICS
public static final java.lang.String TYPE_STATISTICS
A type used to represent statistical data- Since:
- API 4.60 (Geneious 5.6.0)
- See Also:
- Constant Field Values
-
TYPE_EXPRESSION_LEVEL
public static final java.lang.String TYPE_EXPRESSION_LEVEL
A type used to represent expression levels (for example when dealing with RNA sequencing data)- Since:
- API 4.60 (Geneious 5.6.0)
- See Also:
- Constant Field Values
-
TYPE_EXPRESSION_DIFFERENCE
public static final java.lang.String TYPE_EXPRESSION_DIFFERENCE
A type used to represent differential expression levels (for example when dealing with RNA sequencing data)- Since:
- API 4.801 (Geneious 8.0.1)
- See Also:
- Constant Field Values
-
TYPE_OPTIMIZED_CODON
public static final java.lang.String TYPE_OPTIMIZED_CODON
A type used to represent a codon that has been replaced wih an optimized equivalent- Since:
- API 4.700 (Geneious 7.0.0)
- See Also:
- Constant Field Values
-
KEY_CREATED_BY
public static final java.lang.String KEY_CREATED_BY
A special key used to identify the origin of this annotation. eg. "ORF finder" if this annotation was generated by the ORF finder plugin the user's name if this annotation was created by the user Annotations from databases such as NCBI should not be given a created tag. To add a created by tag it should be added to the qualifiers of the annotation with this as the name- See Also:
- Constant Field Values
-
KEY_MODIFIED_BY
public static final java.lang.String KEY_MODIFIED_BY
A special key to identify the last modifier of this annotation. eg. the user's name if this annotation was modifed by the user. Annotations this tag if they have been modified after creation (do not give modified by tag to a new annotation). To add a modified by tag it should be added to the qualifiers of the annotation with this as the name- See Also:
- Constant Field Values
-
KEY_ANNOTATION_GROUP
public static final java.lang.String KEY_ANNOTATION_GROUP
Name
of a qualifier whose value identifies a group that this annotation belongs to on a single sequence. In the sequence viewer, if the user puts the mouse over one of these annotations then all others of the same group will be highlighted. (eg) Primer pairs are associated in this way. This value should be unique on a per sequence basis and groups cannot span several sequences. For example two correspondingTYPE_PRIMER_BIND
annotations may have KEY_ANNOTATION_GROUP qualifier with a value "group_1", with opposite direction, to work as a pair. Note: KEY_ANNOTATION_GROUP is different fromSequenceAnnotationGroup
which is used for grouping entire sets of types together.- See Also:
- Constant Field Values
-
TYPE_LOW_COVERAGE
public static final java.lang.String TYPE_LOW_COVERAGE
Annotation types created by High/Low coverage finder when it finds low coverage regions Note that prior to Geneious 2022.2, the coverage finder would only use this field (value "Coverage - Low") under some situations and would use a value of "Low" in other situations.- Since:
- API 4.902 (Geneious 9.0.2)
- See Also:
TYPE_HIGH_COVERAGE
, Constant Field Values
-
TYPE_HIGH_COVERAGE
public static final java.lang.String TYPE_HIGH_COVERAGE
Annotation types created by High/Low coverage finder when it finds high coverage regions. Note that prior to Geneious 2022.2, the coverage finder would only use this field (value "Coverage - High") under some situations and would use a value of "High" in other situations.- Since:
- API 4.902 (Geneious 9.0.2)
- See Also:
TYPE_LOW_COVERAGE
, Constant Field Values
-
TYPE_JUNCTION
public static final java.lang.String TYPE_JUNCTION
The annotation type created by reference mapping and SAM/BAM import when there are large deletions or introns- Since:
- API 4.911 (Geneious 9.1.1)
- See Also:
SequenceAnnotationQualifier.JUNCTION_SOURCE
,SequenceAnnotationQualifier.JUNCTION_DESTINATION
, Constant Field Values
-
TYPE_MASKED
public static final java.lang.String TYPE_MASKED
The annotation type used to mask alignment regions for the purpose of inferring phylogeny. During tree building, masked columns can be optionally removed.- Since:
- API 4.1000 (Geneious 10.0.0)
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SequenceAnnotation
public SequenceAnnotation(java.lang.String name, java.lang.String type)
Constructs a new SequenceAnnotation with the specified name and type. The type can be e.g. one of the TYPE_* constants in this class, but may be any arbitrary non-null value.
-
SequenceAnnotation
public SequenceAnnotation(java.lang.String name, java.lang.String type, SequenceAnnotationInterval... intervals)
Constructs a new SequenceAnnotation with the specified name and type. The type can be e.g. one of the TYPE_* constants in this class, but may be any arbitrary non-null value.- Parameters:
name
- Human readable name for the annotation; must not be null. SeegetName()
.type
- Identifier for the type of the annotation, e.g.TYPE_CDS
,TYPE_ORF
. May be any arbitrary String, but must not be null. SeegetType()
.intervals
- 0 or more intervals to add to this annotation.- Throws:
java.lang.NullPointerException
- if name or type is null
-
SequenceAnnotation
public SequenceAnnotation(org.jdom.Element element) throws XMLSerializationException
XML deserialization constructor.- Parameters:
element
- an element returned from a previous call totoXML()
- Throws:
XMLSerializationException
- if unable to deserialize the annotation
-
SequenceAnnotation
public SequenceAnnotation(SequenceAnnotation annotation)
creates a copy of the given annotation- Parameters:
annotation
- SequenceAnnotation of which to create a copy- Throws:
java.lang.NullPointerException
- if annotation is null
-
SequenceAnnotation
public SequenceAnnotation(SequenceAnnotation annotation, int offset)
creates a copy of the given annotation offset by a certain amount- Parameters:
annotation
- SequenceAnnotation of which to create a copyoffset
- amount to offset by- Throws:
java.lang.NullPointerException
- if annotation is null
-
-
Method Detail
-
getIntervals
public java.util.List<SequenceAnnotationInterval> getIntervals()
Gets all theintervals
this annotation contains. If the annotation is for the entire sequence, this method must return an interval specifying the entire sequence range. For a CDS annotation the order of the intervals indicates the order in which the translation proceeds.- Returns:
- all annotation intervals
- See Also:
getNumberOfIntervals()
,getInterval(int)
-
getNumberOfIntervals
public int getNumberOfIntervals()
Returns the number of intervals this annotation has- Returns:
- the number of intervals this annotation has
- Since:
- API 4.810 (Geneious 8.1.0)
- See Also:
getInterval(int)
,getIntervals()
-
getInterval
public SequenceAnnotationInterval getInterval(int intervalIndex)
Returns one of the intervals from this annotation- Parameters:
intervalIndex
- the 0-based index of the interval to get. Must be in the range [0,getNumberOfIntervals()
)- Returns:
- one of the intervals from this annotation
- Since:
- API 4.810 (Geneious 8.1.0)
- See Also:
getNumberOfIntervals()
,getIntervals()
-
getInterval
public SequenceAnnotationInterval getInterval()
If this annotation has exactly 1 interval gets that interval or throws anIllegalStateException
if it doesn't have exactly 1 interval. Annotations are generally made of several intervals. However, certain types of annotations (such asTYPE_PRIMER_BIND
) never have more than one interval, and in such cases this method can be called to avoid needing to call .getIntervals().get(0).- Returns:
- the sole interval of this annotation
- Throws:
java.lang.IllegalStateException
- if this annotation does not have exactly 1 interval- Since:
- API 4.600 (Geneious 6.0.0)
- See Also:
getIntervals()
-
getQualifiers
public java.util.List<SequenceAnnotationQualifier> getQualifiers()
A list of qualifiers for the sequence. If there are no qualifiers, this method must return an empty list (e.g.Collections.emptyList()
).- Returns:
- the qualifiers
-
getName
public java.lang.String getName()
The name of the annotation which should be a short human readable text description.- Returns:
- name of the annotation
-
getType
public java.lang.String getType()
Type of the annotation. types are non structured - for example "CDS" or "gene". These can be any of the strings defined at SequenceAnnotation.TYPE_* or any custom string.- Returns:
- the type
- See Also:
setType(String)
-
setType
public void setType(java.lang.String type)
Set the type of this annotation. Types are non structured - for example "CDS" or "gene". These can be any of the strings defined at SequenceAnnotation.TYPE_* or any custom string.- Parameters:
type
- the new type of this annotation- See Also:
getType()
-
isInvisibleAnnotationType
public static boolean isInvisibleAnnotationType(java.lang.String type)
Returns true if annotations of this type are not visible to the user. For exampleTYPE_EXTRACTED_REGION
,TYPE_TRANSLATED_REGION
,TYPE_ORIGIN
or types starting withINVISIBLE_ANNOTATION_TYPE_PREFIX
- Parameters:
type
- an annotation type- Returns:
- true if annotations of this type are not visible to the user.
- Since:
- API 4.605 (Geneious 6.0.5)
- See Also:
getType()
,INVISIBLE_ANNOTATION_TYPE_PREFIX
-
isInvisible
public boolean isInvisible()
- Returns:
- true if this annotation is not visible to the user. For example
TYPE_EXTRACTED_REGION
,TYPE_TRANSLATED_REGION
,TYPE_ORIGIN
or types starting withINVISIBLE_ANNOTATION_TYPE_PREFIX
- Since:
- API 4.1021 (Geneious 10.2.1)
-
equals
public final boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
createTrimAnnotation
public static SequenceAnnotation createTrimAnnotation(int minimumIndexInclusive, int maximumIndexInclusive)
Creates a newTYPE_TRIMMED
annotation- Parameters:
minimumIndexInclusive
- the minimum 1-based indexmaximumIndexInclusive
- the maximum 1-based index- Returns:
- a new trim annotation
- Since:
- API 4.40 (Geneious 5.4.0)
-
createMaskedAnnotation
public static SequenceAnnotation createMaskedAnnotation(int minimumIndexInclusive, int maximumIndexInclusive)
Creates a newTYPE_MASKED
annotation- Parameters:
minimumIndexInclusive
- the minimum 1-based indexmaximumIndexInclusive
- the maximum 1-based index- Returns:
- a new masked annotation
- Since:
- API 4.1000 (Geneious 10.0.0)
-
copyOf
public static java.util.List<SequenceAnnotation> copyOf(java.util.List<SequenceAnnotation> sequenceAnnotationsToCopy)
Creates a deep copy of a list of SequenceAnnotations. This is useful in cases where you obtain a list of annotations from another class and need to ensure the other class doesn't modify the list or any of the contained annotations after providing it to you.- Parameters:
sequenceAnnotationsToCopy
- the annotations to copy.- Returns:
- a deep copy of sequenceAnnotationsToCopy
-
addInterval
public void addInterval(int from, int to)
Add one left to right interval to this annotation.- Parameters:
from
- lower limit (inclusive), in range 1 to sequence length.to
- upper limit (inclusive), in range 1 to sequence length.
-
addInterval
public void addInterval(int minIndex, int maxIndex, SequenceAnnotationInterval.Direction direction)
Add one interval to this annotation.- Parameters:
minIndex
- The minimum index (inclusive) spanned by this interval, in range 1 to sequence length.maxIndex
- The maximum index (inclusive) spanned by this interval, in range 1 to sequence length.direction
- The direction of this annotation.- See Also:
SequenceAnnotationInterval.Direction
-
setIntervals
public void setIntervals(java.util.List<SequenceAnnotationInterval> intervals)
set the intervals on this annotation- Parameters:
intervals
- the intervals to set on the annotation- Since:
- API 4.60 (Geneious 5.6.0)
- See Also:
SequenceAnnotationInterval
-
addInterval
public void addInterval(SequenceAnnotationInterval interval)
add a new interval to this annotation. In Geneious 5.0 and later. annotations are not required to have any intervals. If they don't have intervals they will not be displayed in the sequence viewer, but will be visible in the annotations viewer.- Parameters:
interval
- an interval to copy the newly added interval from- See Also:
SequenceAnnotationInterval
-
addIntervals
public void addIntervals(java.util.Collection<SequenceAnnotationInterval> intervalsToAdd)
adds a collection of intervals to this annotation- Parameters:
intervalsToAdd
- the intervals to add- See Also:
SequenceAnnotationInterval
-
removeInterval
public void removeInterval(SequenceAnnotationInterval interval)
Removes the given interval from this annotation. Does nothing if the interval is not already present.- Parameters:
interval
- the interval to remove
-
copyWithoutIntervals
public SequenceAnnotation copyWithoutIntervals()
Creates a copy of this annotation, without any intervals. i.e. the returned annotation will have no intervals. The name, type and all qualifiers on this annotation will be the same on the returned annotation.- Returns:
- a copy of this annotation, without any intervals. i.e. the returned annotation will have no intervals.
-
addQualifier
public void addQualifier(java.lang.String name, java.lang.String value)
Add aqualifier
with the specified name-value mapping.- Parameters:
name
- name of the new SequenceAnnotationQualifier to addvalue
- value of the new SequenceAnnotationQualifier to add- Throws:
java.lang.NullPointerException
- if name or value is null
-
setQualifier
public void setQualifier(java.lang.String name, java.lang.String value)
Deletes all existing qualifiers with the given name, and adds a new qualifier with the given value.- Parameters:
name
- Name of the existing qualifier whose value to replace; must not be nullvalue
- Value to set on the qualifier; must not be null- Throws:
java.lang.NullPointerException
- if name or value is null
-
removeQualifier
public void removeQualifier(java.lang.String name)
Deletes all existing qualifiers with the given name- Parameters:
name
- Name of the qualifier whose values to delete; must not be null- Throws:
java.lang.NullPointerException
- if name is null- Since:
- API 4.700 (Geneious 7.0.0)
-
getQualifierValue
public java.lang.String getQualifierValue(java.lang.String name)
Get the value of the first qualifier in the list of the given name or "" if one is not found.- Parameters:
name
- the name of the qualifier to get the value for; must not be nll- Returns:
- the value of the qualifier with the specified name, or "" if no such qualifier was found
- Throws:
java.lang.NullPointerException
- if name is null
-
getUrnQualifierValue
public UrnWithSequenceRegions getUrnQualifierValue(java.lang.String name)
If the qualifier with the given name was created usingSequenceAnnotationQualifier(String, UrnWithSequenceRegions, boolean, String)
returns the UrnWithSequenceRegions provided.- Parameters:
name
- the qualifier name- Returns:
- or null if this qualifier is not a URN reference qualifier or is not present.
- Since:
- API 4.202500 (Geneious 2025.0.0)
-
addQualifier
public void addQualifier(SequenceAnnotationQualifier qualifier)
add a newqualifier
.- Parameters:
qualifier
- a qualifier to copy the newly added qualifier from
-
addQualifiers
public void addQualifiers(java.util.Collection<SequenceAnnotationQualifier> qualifiersToAdd)
Adds all the given qualifiers to this annotation- Parameters:
qualifiersToAdd
- the qualifiers to add to this annotation.
-
removeQualifier
public void removeQualifier(SequenceAnnotationQualifier qualifierToRemove)
Removes the given qualifier from this annotation. Does nothing if the qualifier is not already present.- Parameters:
qualifierToRemove
- the qualifier to remove.
-
setQualifiers
public void setQualifiers(java.util.List<SequenceAnnotationQualifier> qualifiers)
Set a new list of qualifiers on this SequenceAnnotation, removing any existing qualifiers added viaaddQualifier(String, String)
oraddQualifier(SequenceAnnotationQualifier)
oraddQualifiers(java.util.Collection)
orsetQualifiers(java.util.List)
- Parameters:
qualifiers
- the newSequenceAnnotationQualifier
s to set; must not be null, and must not contain null entries- Throws:
java.lang.NullPointerException
- if qualifiers or one of its elements is null
-
getVersionSupport
public Geneious.MajorVersion getVersionSupport(XMLSerializable.VersionSupportType versionType)
Description copied from interface:XMLSerializable.OldVersionCompatible
Gets either the latest version this class can serialize to viaXMLSerializable.OldVersionCompatible.toXML(Geneious.MajorVersion, ProgressListener)
or the most recent version in which the XML returned fromXMLSerializable.OldVersionCompatible.toXML(Geneious.MajorVersion, ProgressListener)
last changed. Example implementation:switch (versionType) { case FormatLastExtended: //added a new tag to xml in 10.0 that can be safely ignored by older versions return Geneious.MajorVersion.Version10_0; case FormatLastChanged: //renamed a tag in 9.1 meaning that older versions can no longer read the xml from 9.1 return Geneious.MajorVersion.Version9_1; case OldestVersionSerializableTo: //this document class can export xml that is compatible with 9.0 return Geneious.MajorVersion.Version9_0; default: throw new IllegalArgumentException("Unrecognized VersionSupportType"); }
- Specified by:
getVersionSupport
in interfaceXMLSerializable.OldVersionCompatible
- Parameters:
versionType
- specifies which version property to return- Returns:
- the major version of Geneious corresponding to the versionType for this classes toXML method.
-
getVersionSupportStatic
public static Geneious.MajorVersion getVersionSupportStatic(XMLSerializable.VersionSupportType versionType)
A static implementation ofgetVersionSupport(com.biomatters.geneious.publicapi.documents.XMLSerializable.VersionSupportType)
that can be used in place of that method since all SequenceAnnotation instances have the same version support.- Parameters:
versionType
- the type of version number to get- Returns:
- the version support as specified by
getVersionSupport(com.biomatters.geneious.publicapi.documents.XMLSerializable.VersionSupportType)
- Since:
- API 4.600 (Geneious 6.0.0)
-
toXML
public org.jdom.Element toXML()
Description copied from interface:XMLSerializable
Convert object to a JDOM element. The representation should be complete so thatXMLSerializable.fromXML(org.jdom.Element)
can completely restore the object's representation. It is recommended that the returned element useXMLSerializable.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 callXMLSerializer.classToXML(String, XMLSerializable)
which calls this method internally. PluginDocument implementations of this method may choose to throw anXMLSerializationException
, enclosed in aRuntimeException
.- Specified by:
toXML
in interfaceXMLSerializable
- Returns:
- object encoded as a JDOM element
-
toXML
public org.jdom.Element toXML(Geneious.MajorVersion majorVersion, jebl.util.ProgressListener progressListener)
Serialization of annotation - to.- Specified by:
toXML
in interfaceXMLSerializable.OldVersionCompatible
- Parameters:
majorVersion
- 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 fromgetVersionSupport
(VersionSupportType.OldestVersionSerializableTo
) and must never be greater than the current version (Geneious.getMajorVersion())progressListener
- for reporting progress and cancelling- Returns:
- annotation as a jdom element
-
fromXML
public void fromXML(org.jdom.Element element) throws XMLSerializationException
Description copied from interface:XMLSerializable
Restore the object from the JDOM Element returned byXMLSerializable.toXML()
. This method generally should not be called directly. Instead, you should usually callXMLSerializer.classFromXML(org.jdom.Element)
orXMLSerializer.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 singleElement
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 withElement.clone()
.- Specified by:
fromXML
in interfaceXMLSerializable
- Parameters:
element
- representation from a previous call toXMLSerializable.toXML()
- Throws:
XMLSerializationException
- if the Element can't be converted into this type of object
-
setName
public void setName(java.lang.String name)
- Parameters:
name
- The new name to set for this SequenceAnnotation; must not be null- Throws:
java.lang.NullPointerException
- if name is null- See Also:
getName()
-
toString
public java.lang.String toString()
Returns a human readable string with information about this annotation; the exact format of the string is not guaranteed and should not be relied on, because it may change at any time.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A human readable string with information about this annotation.
-
writeObject
public void writeObject(GeneiousObjectOutputStream out) throws java.io.IOException
Writes this annotation to an output stream as defined bySerializable
.- Parameters:
out
- the stream to write to.- Throws:
java.io.IOException
- if we are unable to write to the stream- See Also:
readObject(GeneiousObjectInputStream)
-
writeObject
public void writeObject(java.io.DataOutput out) throws java.io.IOException
Writes this annotation to a DataOutput- Parameters:
out
- the DataOutput to write to.- Throws:
java.io.IOException
- if we are unable to write to the DataOutput- Since:
- API 4.30 (Geneious 5.3.0)
- See Also:
readObject(GeneiousObjectInputStream)
-
writeObject
public void writeObject(Geneious.MajorVersion version, java.io.DataOutput out) throws java.io.IOException
Writes this annotation to a DataOutput in a form that can potentially be read by old versions of Geneious- Parameters:
version
- the version number of Geneious that must be able to deserialize this.out
- the DataOutput to write to.- Throws:
java.io.IOException
- if we are unable to write to the DataOutput- Since:
- API 4.600 (Geneious 6.0.0)
- See Also:
readObject(GeneiousObjectInputStream)
-
readObject
public static SequenceAnnotation readObject(GeneiousObjectInputStream in) throws java.io.IOException
Reads data previously created usingwriteObject(GeneiousObjectOutputStream)
It is a good idea to use aGeneiousObjectInputStream
when deserializing lots of annotations.- Parameters:
in
- the stream to read from- Returns:
- the deserialized annotation
- Throws:
java.io.IOException
- if we are unable to read from the stream
-
readObject
public static SequenceAnnotation readObject(java.io.DataInput in) throws java.io.IOException
Reads data previously created usingwriteObject(java.io.DataOutput)
- Parameters:
in
- the DataInput to read from- Returns:
- the deserialized annotation
- Throws:
java.io.IOException
- if we are unable to read from the DataInput- Since:
- API 4.30 (Geneious 5.3.0)
-
reverse
public SequenceAnnotation reverse(int sequenceLength, SequenceDocument.Alphabet alphabet)
Creates a new annotation that is either the reverse or the reverse complements this annotation.- Parameters:
sequenceLength
- the length of the sequence in which the annotation is being reversed.alphabet
- the alphabet of the sequence the annotation is from. This is used to determine whether or not to complement the bases in any editing annotation qualifiers (seeSequenceAnnotationQualifier.EDITING_HISTORY_ORIGINAL_BASES
)- Returns:
- this annotation in the reverse direction.
-
getCodonStart
public int getCodonStart()
The value of theNCBI_CODON_START
qualifier indicates the offset at which the first complete codon of a coding feature can be found, relative to the first base of that feature. Valid values are 1, 2 or 3.If this annotation has an NCBI_CODON_START qualifier, and the value of it is between 1 and 3, return that value. Otherwise, return -1
- Returns:
- the codon start of this annotation, or -1 if there is no NCBI_CODON_START qualifier or its value is not between 1 and 3
- Since:
- API 4.600 (Geneious 6.0.0)
- See Also:
SequenceAnnotationQualifier.NCBI_CODON_START
-
removeAnnotationWhenEdited
public boolean removeAnnotationWhenEdited()
-
isEditingAnnotationType
public static boolean isEditingAnnotationType(java.lang.String type)
- Parameters:
type
- a type of annotation returned fromgetType()
- Returns:
- true if this annotation type (
getType()
) isTYPE_EDITING_HISTORY_DELETION
orTYPE_EDITING_HISTORY_INSERTION
orTYPE_EDITING_HISTORY_REPLACEMENT
. - Since:
- API 4.700 (Geneious 7.0.0)
-
isReadOnlyAnnotationType
public static boolean isReadOnlyAnnotationType(java.lang.String type)
- Parameters:
type
- a type of annotation returned fromgetType()
- Returns:
- true if this annotation type is read only (i.e. the user shouldn't be allowed to edit it)
- Since:
- API 4.700 (Geneious 7.0.0)
-
getAnnotationAdjustedForInsertion
public SequenceAnnotation getAnnotationAdjustedForInsertion(int indexToInsertAt, int lengthOfInsertion, boolean isInsertionAllGaps, int newSequenceLengthIfCircular)
Handles an insertion into the sequence which this annotation is for, by either returning a new annotation adjusted to take the insertion into account, or this annotation if it doesn't change, or null if the annotation should be deleted (for example the user inserts nucleotides into a primer annotation)- Parameters:
indexToInsertAt
- the 1-based index to insert. On a circular sequence, this must still be in the range 1 to the sequence length.lengthOfInsertion
- the number of characters in the insertionisInsertionAllGaps
- true if the insertion consists entirely of gaps (which means for example we don't delete primer annotations)newSequenceLengthIfCircular
- if the sequence this annotation corresponds to is circular, then this should be >0 to indicate the length of a circular sequence (after the insertion)- Returns:
- either a new annotation (if the insertion was within or prior to this annotation), or this annotation (if it is unaffected by the insertion), or null (if this annotation should be deleted)
- Since:
- API 4.700 (Geneious 7.0.0)
-
getAnnotationAdjustedForReplacement
public SequenceAnnotation getAnnotationAdjustedForReplacement(int replacementPosition, int replacementLength, int sequenceLengthIfCircular)
Handles a non-gap replacement in the sequence which this annotation is for, by either returning this annotation if it doesn't change, or null if the annotation should be deleted (for example the user replaces nucleotides in a primer annotation)- Parameters:
replacementPosition
- the 1-based index of the first character being replacedreplacementLength
- the length of the region being replacedsequenceLengthIfCircular
- if the sequence this annotation corresponds to is circular, then this should be >0 to indicate the length of a circular sequence- Returns:
- either this annotation (if it is unaffected by the replacement), or null (if this annotation should be deleted)
- Since:
- API 4.700 (Geneious 7.0.0)
-
containsOnPotentiallyCircularSequence
public boolean containsOnPotentiallyCircularSequence(int startPosition, int length, int sequenceLengthIfCircular)
Checks whether any of this annotation's intervals include a residues between startPosition and startPosition+length on a potentially circular sequence.- Parameters:
startPosition
- An index in a sequence (In range 1 to sequence length.)length
- The number of indexes to check after the startPositionsequenceLengthIfCircular
- if the sequence this annotation corresponds to is circular, then this should be >0 to indicate the length of a circular sequence- Returns:
- true if this annotation contains any residue index between startPosition (inclusive) and startPosition+length (exclusive).
- Since:
- API 4.202120 (Geneious 2021.2.0)
-
getAnnotationAdjustedForDeletion
@Deprecated public SequenceAnnotation getAnnotationAdjustedForDeletion(int deletionStart, int deletionLength, boolean isDeletionAllGaps, int newSequenceLengthIfCircular)
Deprecated.Handles a deletion from the sequence which this annotation is for, by either returning a new annotation adjusted to take the deletion into account, or this annotation if it doesn't change, or null if the annotation should be deleted (for example the user deletes nucleotides from a primer annotation)- Parameters:
deletionStart
- the 1-based index the deletion begins at. On a circular sequence, this must still be in the range 1 to the sequence length.deletionLength
- the number of characters deleted.isDeletionAllGaps
- true if all the removed characters are gapsnewSequenceLengthIfCircular
- if the sequence this annotation corresponds to is circular, then this should be >0 to indicate the length of a circular sequence (after the deletion)- Returns:
- either a new annotation (if the deletion was within this annotation), or this annotation (if it is unaffected by the insertion), or null (if this annotation should be deleted)
- Since:
- API 4.700 (Geneious 7.0.0)
-
getAnnotationAdjustedForDeletion
public SequenceAnnotation getAnnotationAdjustedForDeletion(int deletionStart, java.lang.CharSequence deletedSequence, int newSequenceLengthIfCircular)
Handles a deletion from the sequence which this annotation is for, by either returning a new annotation adjusted to take the deletion into account, or this annotation if it doesn't change, or null if the annotation should be deleted (for example the user deletes nucleotides from a primer annotation).For
TYPE_CDS
andTYPE_ORF
annotations, if the start of the first interval is deleted,SequenceAnnotationQualifier.NCBI_CODON_START
is adjusted to keep the translation in frame.- Parameters:
deletionStart
- the 1-based index the deletion begins at. On a circular sequence, this must still be in the range 1 to the sequence length.deletedSequence
- the deleted sequence characters, including gapsnewSequenceLengthIfCircular
- if the sequence this annotation corresponds to is circular, then this should be >0 to indicate the length of a circular sequence (after the deletion)- Returns:
- either a new annotation (if the deletion was within this annotation), or this annotation (if it is unaffected by the insertion), or null (if this annotation should be deleted)
- Since:
- API 4.1021 (Geneious 10.2.1)
-
getTranslation
public static java.lang.String getTranslation(AnnotatedPluginDocument document, SequenceDocument sequence, SequenceAnnotation annotation)
Returns the translation (if applicable) for the given annotation. Usually this should only be called on CDS annotations. The genetic code defined by the annotations' trans_table qualifier is used if present. If that is not specified, the genetic code specified by the document is used. If that is not specified, the genetic code of the sequence is used. If that is not specified, the default genetic code (as specified from the cog section of the sequence viewer preferences) is used.- Parameters:
document
- the document the sequence came from. Used to obtain the genetic code. May be null.sequence
- the sequence the annotation to applies toannotation
- the annotation to translate- Returns:
- the translation for the given annotation or null if it cannot be translated
- Since:
- API 4.800 (Geneious 8.0.0)
-
isPrimer
public boolean isPrimer()
- Returns:
- true iff this annotation's
getType()
is eitherTYPE_PRIMER_BIND
orTYPE_PRIMER_BIND_REVERSE
- Since:
- API 4.1010 (Geneious 10.1.0)
-
getAlignmentHiddenQualifierName
public static java.lang.String getAlignmentHiddenQualifierName(SequenceDocument.Alphabet alphabet, boolean firstSequenceIsReferenceSequence, java.lang.String alignmentName, java.lang.String sequenceName)
Returns the name of an hidden (SequenceAnnotationQualifier.HIDDEN_PREFIX
) annotation qualifier that can be used for storing a single sequence that will appear in the alignments returned fromgetAlignmentsFromHiddenQualifiers()
. The Sequence Viewer will display the alignment(s) in its annotation tooltip. Alignments must contain a minimum of two sequences, so will only appear if two qualifiers with the same alignmentName but different sequenceNames are present.- Parameters:
alphabet
- whether this is a nucleotide or protein alignmentfirstSequenceIsReferenceSequence
- if the first sequence in the alignment should be a reference sequence (i.e.SequenceAlignmentDocument.getContigReferenceSequenceIndex()
so it will be highlighted where other sequences differ from the reference)alignmentName
- the name of the alignmentsequenceName
- the name of the sequence within the alignment- Returns:
- the name of the qualifier to store the sequence characters under
- Since:
- API 4.201900 (Geneious 2019.0.0)
- See Also:
getAlignmentsFromHiddenQualifiers()
-
getAlignmentsFromHiddenQualifiers
public java.util.List<SequenceAlignmentDocument> getAlignmentsFromHiddenQualifiers()
All alignments that can be created from hidden qualifiers returned fromgetAlignmentHiddenQualifierName(SequenceDocument.Alphabet, boolean, String, String)
. The Sequence Viewer will display the alignment(s) in its annotation tooltip. Alignments must contain a minimum of two sequences, so will only appear if two qualifiers with the same alignmentName but different sequenceNames are present.- Returns:
- all alignments created from hidden qualifiers.
- Since:
- API 4.201900 (Geneious 2019.0.0)
- See Also:
getAlignmentHiddenQualifierName(SequenceDocument.Alphabet, boolean, String, String)
-
setIsAddedToActivelyLinkedChild
public void setIsAddedToActivelyLinkedChild(URN urnOfDocument)
Flags this annotations as being added to a sequence which is actively linked to its parent document. This means that when the operation which produced this document is rerun, this annotation will be automatically transferred to the newly produced result. If residues are different on the new document, the location of the annotation will be automatically moved to the correct new location if it can be determined with reasonable confidence (i.e. the residue changes are not significant). If the new location cannot be reliable determined, the annotation will not be transferred to the new document.- Parameters:
urnOfDocument
- theAnnotatedPluginDocument.getURN()
of the document this annotation is added to. This is required so that if this annotation is ever transfered to a document derived from this sequence, the annotation will not received special handling on that child sequence.- Since:
- API 4.202020 (Geneious 2020.2.0)
- See Also:
isAddedToActivelyLinkedChild(URN)
-
isAddedToActivelyLinkedChild
public boolean isAddedToActivelyLinkedChild(URN urnOfDocument)
Returns true if this annotation was flagged usingsetIsAddedToActivelyLinkedChild(URN)
- Parameters:
urnOfDocument
- theAnnotatedPluginDocument.getURN()
of the document this annotation is currently on. If this does not match the URN under which the annotation was flagged, this method will return false.- Returns:
- true if this annotation was flagged using
setIsAddedToActivelyLinkedChild(URN)
- Since:
- API 4.202020 (Geneious 2020.2.0)
- See Also:
setIsAddedToActivelyLinkedChild(URN)
-
createHiddenAnnotationForDeletingThisFromActivelyLinkedChild
public SequenceAnnotation createHiddenAnnotationForDeletingThisFromActivelyLinkedChild(URN urnOfDocument)
Creates an invisible annotation which can be added to an actively linked child document to indicate that this child document should delete the matching annotation when it is recreated after a parent document is edited.- Parameters:
urnOfDocument
- the URN of the child document which this annotation should be deleted from.- Returns:
- an invisible annotation for deleting this annotation
- Since:
- API 4.202020 (Geneious 2020.2.0)
- See Also:
applyHiddenAnnotationsForDeletingFromActivelyLinkedChild(URN, List, List)
-
applyHiddenAnnotationsForDeletingFromActivelyLinkedChild
public static java.util.List<SequenceAnnotation> applyHiddenAnnotationsForDeletingFromActivelyLinkedChild(URN urnOfDocument, java.util.List<SequenceAnnotation> potentialDeletionAnnotations, java.util.List<SequenceAnnotation> annotationsToApplyTo)
Applies any annotations created usingcreateHiddenAnnotationForDeletingThisFromActivelyLinkedChild(URN)
that are withinpotentialDeletionAnnotations
to the listannotationsToApplyTo by removing the matching annotation from that list and returning the edited list.- Parameters:
urnOfDocument
- the URN of the document which contains the annotations which should be deleted. This should be the same URN passed tocreateHiddenAnnotationForDeletingThisFromActivelyLinkedChild(URN)
potentialDeletionAnnotations
- a list of annotations containing deletion annotations created usingcreateHiddenAnnotationForDeletingThisFromActivelyLinkedChild(URN)
. This list may also contain other annotations, which will be ignored.annotationsToApplyTo
- a list of annotations which may contain annotations to be deleted- Returns:
- annotationsToApplyTo, but without any annotations which should be deleted
- Since:
- API 4.202020 (Geneious 2020.2.0)
- See Also:
createHiddenAnnotationForDeletingThisFromActivelyLinkedChild(URN)
-
-