public final class SequenceAnnotation extends Object implements XMLSerializable, XMLSerializable.OldVersionCompatible
getName()) and a type (see getType()) along with a set of name-value pairs (see getQualifiers()
and the intervals of the sequence which the annotation covers (see getIntervals()
Annotations are obtained via SequenceDocument.getSequenceAnnotations
or from a track via SequenceTrack.getSequenceAnnotations()XMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportType| Modifier and Type | Field and Description |
|---|---|
static String |
HIDDEN_TYPE_FOR_ACTIVELY_LINKED_PARENTS
An annotation type for annotations added to documents which are actively linked to their descendants (see
OperationRecordDocument.hasAnyActiveLinks()). |
static String |
INVISIBLE_ANNOTATION_TYPE_PREFIX
Annotations whose type (
getType()) has this prefix are not visible in the sequence viewer. |
static String |
KEY_ANNOTATION_GROUP
Name
of a qualifier whose value identifies a group that this annotation belongs to
on a single sequence. |
static String |
KEY_CREATED_BY
A special key used to identify the origin of this annotation.
|
static String |
KEY_MODIFIED_BY
A special key to identify the last modifier of this annotation.
|
static String |
TYPE_CDS |
static String |
TYPE_CHAIN |
static String |
TYPE_COIL |
static String |
TYPE_COILED_COIL |
static String |
TYPE_CONCATENATED_SEQUENCE |
static String |
TYPE_CONFLICT |
static String |
TYPE_CRISPR
Candidate CRISPR site
|
static String |
TYPE_DISULFIDE_BOND |
static String |
TYPE_DNA_PROBE |
static String |
TYPE_DOMAIN |
static String |
TYPE_EDITING_HISTORY_DELETION |
static 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 String |
TYPE_EDITING_HISTORY_REPLACEMENT |
static 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 String |
TYPE_EXON |
static String |
TYPE_EXPRESSION_DIFFERENCE
A type used to represent differential expression levels (for example when dealing with RNA sequencing data)
|
static String |
TYPE_EXPRESSION_LEVEL
A type used to represent expression levels (for example when dealing with RNA sequencing data)
|
static String |
TYPE_EXTRACTED_REGION
This is an invisible annotation that contains a mapping from the original sequence indices to the current sequence indices.
|
static String |
TYPE_GENE |
static 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 gibson assembly operation.
|
static String |
TYPE_HELIX |
static String |
TYPE_INSERTED_SEQUENCE |
static String |
TYPE_INTRON |
static String |
TYPE_LIGATION |
static String |
TYPE_LONG_TERMINAL_REPEAT |
static String |
TYPE_LOW_QUALITY
Deprecated.
replaced with
TYPE_TRIMMED. |
static String |
TYPE_MATURE_PEPTIDE |
static String |
TYPE_MISC_DIFFERENCE |
static String |
TYPE_MISC_FEATURE |
static String |
TYPE_MISC_RNA |
static String |
TYPE_MOTIF |
static String |
TYPE_MRNA |
static String |
TYPE_NCRNA |
static String |
TYPE_OPTIMIZED_CODON
A type used to represent a codon that has been replaced wih an optimized equivalent
|
static String |
TYPE_ORF |
static String |
TYPE_ORIGIN |
static String |
TYPE_ORIGIN_OF_REPLICATION |
static 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 String |
TYPE_PEPTIDE |
static String |
TYPE_POLYA_SIGNAL |
static String |
TYPE_POLYA_SITE |
static String |
TYPE_POLYLINKER |
static String |
TYPE_POLYMORPHISM
Used for any type of variant annotation, for example SNPs or longer variants.
|
static String |
TYPE_PRECURSOR_RNA |
static String |
TYPE_PRIMER_BIND |
static String |
TYPE_PRIMER_BIND_REVERSE |
static String |
TYPE_PROMOTER |
static String |
TYPE_PROTEIN_BIND |
static String |
TYPE_REGULATORY
From Genbank definition: "Any region of sequence that functions in the regulation of transcription or translation"
|
static String |
TYPE_REPEAT_REGION |
static String |
TYPE_REPEAT_UNIT |
static String |
TYPE_RESTRICTION_SITE |
static String |
TYPE_RRNA |
static String |
TYPE_SEARCH_HIT
The type of annotation added to a sequence search result to indicate the region that matched the query sequence
|
static String |
TYPE_SIGNAL_PEPTIDE |
static String |
TYPE_SITE |
static String |
TYPE_SOURCE |
static String |
TYPE_STATISTICS
A type used to represent statistical data
|
static String |
TYPE_STRAND |
static String |
TYPE_TERMINATOR |
static String |
TYPE_TMRNA |
static String |
TYPE_TRANSLATED_REGION |
static String |
TYPE_TRANSMEMBRANE |
static String |
TYPE_TRIMMED
Regions of a sequence covered by trim annotations are ignored for many operations, including assembly and consensus sequence calculation.
|
static String |
TYPE_TRNA |
static String |
TYPE_TURN |
static String |
TYPE_UTR_3 |
static String |
TYPE_UTR_5 |
static String |
TYPE_VECTOR_MODERATE |
static String |
TYPE_VECTOR_SEGMENT_OF_SUSPECT_ORIGIN |
static String |
TYPE_VECTOR_STRONG |
static String |
TYPE_VECTOR_WEAK |
ROOT_ELEMENT_NAME| Constructor and Description |
|---|
SequenceAnnotation(org.jdom.Element element)
XML deserialization constructor.
|
SequenceAnnotation(SequenceAnnotation annotation)
creates a copy of the given annotation
|
SequenceAnnotation(SequenceAnnotation annotation,
int offset)
creates a copy of the given annotation offset by a certain amount
|
SequenceAnnotation(String name,
String type)
Constructs a new SequenceAnnotation with the specified name and type.
|
SequenceAnnotation(String name,
String type,
SequenceAnnotationInterval... intervals)
Constructs a new SequenceAnnotation with the specified name and type.
|
| Modifier and Type | Method and 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(Collection<SequenceAnnotationInterval> intervalsToAdd)
adds a collection of intervals to this annotation
|
void |
addQualifier(SequenceAnnotationQualifier qualifier)
add a new
qualifier. |
void |
addQualifier(String name,
String value)
Add a
qualifier with the specified name-value mapping. |
void |
addQualifiers(Collection<SequenceAnnotationQualifier> qualifiersToAdd)
Adds all the given qualifiers to this annotation
|
static List<SequenceAnnotation> |
copyOf(List<SequenceAnnotation> sequenceAnnotationsToCopy)
Creates a deep copy of a list of SequenceAnnotations.
|
SequenceAnnotation |
copyWithoutIntervals()
Creates a copy of this annotation, without any intervals.
|
static SequenceAnnotation |
createTrimAnnotation(int minimumIndexInclusive,
int maximumIndexInclusive)
Creates a new
TYPE_TRIMMED annotation |
boolean |
equals(Object obj) |
void |
fromXML(org.jdom.Element element)
Restore the object from the JDOM Element returned by
XMLSerializable.toXML(). |
SequenceAnnotation |
getAnnotationAdjustedForDeletion(int deletionStart,
int deletionLength,
boolean isDeletionAllGaps,
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 the
NCBI_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 an
IllegalStateException if it doesn't have exactly 1 interval. |
SequenceAnnotationInterval |
getInterval(int intervalIndex)
Returns one of the intervals from this annotation
|
List<SequenceAnnotationInterval> |
getIntervals()
Gets all the
intervals this annotation contains. |
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 has
|
List<SequenceAnnotationQualifier> |
getQualifiers()
A list of qualifiers for the sequence.
|
String |
getQualifierValue(String name)
Get the value of the first qualifier in the list of the given name or "" if one is not found.
|
static String |
getTranslation(AnnotatedPluginDocument document,
SequenceDocument sequence,
SequenceAnnotation annotation)
Returns the translation (if applicable) for the given annotation.
|
String |
getType()
Type of the annotation.
|
Geneious.MajorVersion |
getVersionSupport(XMLSerializable.VersionSupportType versionType)
Gets either the latest version this class can serialize to via
XMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener)
or the most recent version in which the XML returned from XMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener) last changed. |
static Geneious.MajorVersion |
getVersionSupportStatic(XMLSerializable.VersionSupportType versionType)
A static implementation of
getVersionSupport(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() |
static boolean |
isEditingAnnotationType(String type) |
static boolean |
isInvisibleAnnotationType(String type)
Returns true if annotations of this type are not visible to the user.
|
static boolean |
isReadOnlyAnnotationType(String type) |
static SequenceAnnotation |
readObject(DataInput in)
Reads data previously created using
writeObject(java.io.DataOutput) |
static SequenceAnnotation |
readObject(GeneiousObjectInputStream in)
Reads data previously created using
writeObject(GeneiousObjectOutputStream)
It is a good idea to use a GeneiousObjectInputStream when deserializing
lots of annotations. |
void |
removeInterval(SequenceAnnotationInterval interval)
Removes the given interval from this annotation.
|
void |
removeQualifier(SequenceAnnotationQualifier qualifierToRemove)
Removes the given qualifier from this annotation.
|
void |
removeQualifier(String name)
Deletes all existing qualifiers with the given name
|
SequenceAnnotation |
reverse(int sequenceLength,
SequenceDocument.Alphabet alphabet)
Creates a new annotation that is either the reverse or the reverse complements this annotation.
|
void |
setIntervals(List<SequenceAnnotationInterval> intervals)
set the intervals on this annotation
|
void |
setName(String name) |
void |
setQualifier(String name,
String value)
Deletes all existing qualifiers with the given name, and adds a new qualifier with the given value.
|
void |
setQualifiers(List<SequenceAnnotationQualifier> qualifiers)
Set a new list of qualifiers on this SequenceAnnotation, removing any
existing qualifiers added via
addQualifier(String, String) or addQualifier(SequenceAnnotationQualifier) or addQualifiers(java.util.Collection) or setQualifiers(java.util.List) |
void |
setType(String type)
Set the type of this annotation.
|
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,
ProgressListener progressListener)
Serialization of annotation - to.
|
void |
writeObject(DataOutput out)
Writes this annotation to a DataOutput
|
void |
writeObject(Geneious.MajorVersion version,
DataOutput out)
Writes this annotation to a DataOutput in a form that can potentially be read by old versions of Geneious
|
void |
writeObject(GeneiousObjectOutputStream out)
Writes this annotation to an output stream as defined by
Serializable. |
public static final String INVISIBLE_ANNOTATION_TYPE_PREFIX
getType()) has this prefix are not visible in the sequence viewer.isInvisibleAnnotationType(String),
Constant Field Valuespublic static final String HIDDEN_TYPE_FOR_ACTIVELY_LINKED_PARENTS
OperationRecordDocument.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.SequenceAnnotationQualifier.HIDDEN_QUALIFIER_FOR_ACTIVELY_LINKED_PARENTS,
Constant Field Valuespublic static final String TYPE_ORF
public static final String TYPE_CDS
public static final String TYPE_GENE
public static final String TYPE_EXTRACTED_REGION
SequenceAnnotationQualifier.EXTRACTED_REGION_INTERVALS_NAME for the name of the qualifier that contains the mapping.public static final String TYPE_TRANSLATED_REGION
public static final String TYPE_ORIGIN
public static final String TYPE_UTR_5
public static final String TYPE_UTR_3
public static final String TYPE_PRIMER_BIND
public static final String TYPE_PRIMER_BIND_REVERSE
public static final String TYPE_PEPTIDE
public static final String TYPE_MISC_FEATURE
public static final String TYPE_SOURCE
public static final String TYPE_EXON
public static final String TYPE_INTRON
public static final String TYPE_DNA_PROBE
public static final String TYPE_RESTRICTION_SITE
public static final String TYPE_MOTIF
public static final String TYPE_REGULATORY
public static final String TYPE_CRISPR
public static final String TYPE_SEARCH_HIT
public static final String TYPE_TRIMMED
ImmutableSequence.getTrailingTrimLength() and ImmutableSequence.getLeadingTrimLength() may also be used as an alternative method
for indicating trimmed regions. Trim annotations should be created using createTrimAnnotation(int, int)public static final String TYPE_HELIX
public static final String TYPE_STRAND
public static final String TYPE_TURN
public static final String TYPE_COIL
public static final String TYPE_VECTOR_SEGMENT_OF_SUSPECT_ORIGIN
public static final String TYPE_VECTOR_WEAK
public static final String TYPE_VECTOR_MODERATE
public static final String TYPE_VECTOR_STRONG
public static final String TYPE_POLYLINKER
public static final String TYPE_DISULFIDE_BOND
public static final String TYPE_ORIGIN_OF_REPLICATION
public static final String TYPE_TERMINATOR
public static final String TYPE_SIGNAL_PEPTIDE
public static final String TYPE_MATURE_PEPTIDE
public static final String TYPE_PROMOTER
public static final String TYPE_SITE
public static final String TYPE_LONG_TERMINAL_REPEAT
public static final String TYPE_REPEAT_REGION
public static final String TYPE_REPEAT_UNIT
public static final String TYPE_MISC_DIFFERENCE
public static final String TYPE_CONFLICT
public static final String TYPE_POLYA_SIGNAL
public static final String TYPE_POLYA_SITE
public static final String TYPE_PROTEIN_BIND
public static final String TYPE_DOMAIN
public static final String TYPE_TRANSMEMBRANE
public static final String TYPE_COILED_COIL
public static final String TYPE_POLYMORPHISM
SequenceAnnotationQualifier.VARIANT_CHANGE, SequenceAnnotationQualifier.VARIANT_NUCLEOTIDES,
SequenceAnnotationQualifier.VARIANT_REFERENCE_NUCLEOTIDES, SequenceAnnotationQualifier.VARIANT_AMINO_ACIDSpublic static final String TYPE_CHAIN
public static final String TYPE_MRNA
public static final String TYPE_TMRNA
public static final String TYPE_TRNA
public static final String TYPE_RRNA
public static final String TYPE_MISC_RNA
public static final String TYPE_NCRNA
public static final String TYPE_PRECURSOR_RNA
public static final String TYPE_CONCATENATED_SEQUENCE
public static final String TYPE_INSERTED_SEQUENCE
public static final String TYPE_EXCLUDED_REGION
public static final String TYPE_OVERHANG
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.public static final String TYPE_LIGATION
public static final String TYPE_EDITING_HISTORY_INSERTION
SequenceAnnotationQualifier.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.public static final String TYPE_EDITING_HISTORY_REPLACEMENT
public static final String TYPE_EDITING_HISTORY_DELETION
public static final String TYPE_GIBSON_PRIMER_EXTENSION
@Deprecated public static final String TYPE_LOW_QUALITY
TYPE_TRIMMED.public static final String TYPE_STATISTICS
public static final String TYPE_EXPRESSION_LEVEL
public static final String TYPE_EXPRESSION_DIFFERENCE
public static final String TYPE_OPTIMIZED_CODON
public static final String KEY_CREATED_BY
public static final String KEY_MODIFIED_BY
public static final 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.public SequenceAnnotation(String name, String type)
name - Human readable name for the annotation; must not be null. See getName().type - Identifier for the type of the annotation, e.g. TYPE_CDS, TYPE_ORF. May be
any arbitrary String, but must not be null. See getType().NullPointerException - if name or type is nullpublic SequenceAnnotation(String name, String type, SequenceAnnotationInterval... intervals)
name - Human readable name for the annotation; must not be null. See getName().type - Identifier for the type of the annotation, e.g. TYPE_CDS, TYPE_ORF. May be
any arbitrary String, but must not be null. See getType().intervals - 0 or more intervals to add to this annotation.NullPointerException - if name or type is nullpublic SequenceAnnotation(org.jdom.Element element)
throws XMLSerializationException
element - an element returned from a previous call to toXML()XMLSerializationException - if unable to deserialize the annotationpublic SequenceAnnotation(SequenceAnnotation annotation)
annotation - SequenceAnnotation of which to create a copyNullPointerException - if annotation is nullpublic SequenceAnnotation(SequenceAnnotation annotation, int offset)
annotation - SequenceAnnotation of which to create a copyoffset - amount to offset byNullPointerException - if annotation is nullpublic List<SequenceAnnotationInterval> getIntervals()
intervals 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.getNumberOfIntervals(),
getInterval(int)public int getNumberOfIntervals()
getInterval(int),
getIntervals()public SequenceAnnotationInterval getInterval(int intervalIndex)
intervalIndex - the 0-based index of the interval to get. Must be in the range [0,getNumberOfIntervals())getNumberOfIntervals(),
getIntervals()public SequenceAnnotationInterval getInterval()
IllegalStateException if it doesn't have exactly 1 interval.
Annotations are generally made of several intervals.
However, certain types of annotations (such as TYPE_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).IllegalStateException - if this annotation does not have exactly 1 intervalgetIntervals()public List<SequenceAnnotationQualifier> getQualifiers()
Collections.emptyList()).public String getName()
public String getType()
setType(String)public void setType(String type)
type - the new type of this annotationgetType()public static boolean isInvisibleAnnotationType(String type)
TYPE_EXTRACTED_REGION, TYPE_TRANSLATED_REGION, TYPE_ORIGIN or types starting with INVISIBLE_ANNOTATION_TYPE_PREFIXtype - an annotation typegetType(),
INVISIBLE_ANNOTATION_TYPE_PREFIXpublic static SequenceAnnotation createTrimAnnotation(int minimumIndexInclusive, int maximumIndexInclusive)
TYPE_TRIMMED annotationminimumIndexInclusive - the minimum 1-based indexmaximumIndexInclusive - the maximum 1-based indexpublic static List<SequenceAnnotation> copyOf(List<SequenceAnnotation> sequenceAnnotationsToCopy)
sequenceAnnotationsToCopy - the annotations to copy.public void addInterval(int from,
int to)
from - lower limit (inclusive), in range 1 to sequence length.to - upper limit (inclusive), in range 1 to sequence length.public void addInterval(int minIndex,
int maxIndex,
SequenceAnnotationInterval.Direction direction)
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.SequenceAnnotationInterval.Directionpublic void setIntervals(List<SequenceAnnotationInterval> intervals)
intervals - the intervals to set on the annotationSequenceAnnotationIntervalpublic void addInterval(SequenceAnnotationInterval interval)
interval - an interval to copy the newly added interval fromSequenceAnnotationIntervalpublic void addIntervals(Collection<SequenceAnnotationInterval> intervalsToAdd)
intervalsToAdd - the intervals to addSequenceAnnotationIntervalpublic void removeInterval(SequenceAnnotationInterval interval)
interval - the interval to removepublic SequenceAnnotation copyWithoutIntervals()
public void addQualifier(String name, String value)
qualifier with the specified name-value mapping.name - name of the new SequenceAnnotationQualifier to addvalue - value of the new SequenceAnnotationQualifier to addNullPointerException - if name or value is nullpublic void setQualifier(String name, String value)
name - Name of the existing qualifier whose value to replace; must not be nullvalue - Value to set on the qualifier; must not be nullNullPointerException - if name or value is nullpublic void removeQualifier(String name)
name - Name of the qualifier whose values to delete; must not be nullNullPointerException - if name is nullpublic String getQualifierValue(String name)
name - the name of the qualifier to get the value for; must not be nllNullPointerException - if name is nullpublic void addQualifier(SequenceAnnotationQualifier qualifier)
qualifier.qualifier - a qualifier to copy the newly added qualifier frompublic void addQualifiers(Collection<SequenceAnnotationQualifier> qualifiersToAdd)
qualifiersToAdd - the qualifiers to add to this annotation.public void removeQualifier(SequenceAnnotationQualifier qualifierToRemove)
qualifierToRemove - the qualifier to remove.public void setQualifiers(List<SequenceAnnotationQualifier> qualifiers)
addQualifier(String, String) or addQualifier(SequenceAnnotationQualifier) or addQualifiers(java.util.Collection) or setQualifiers(java.util.List)qualifiers - the new SequenceAnnotationQualifiers to set; must not be null, and must not contain null entriesNullPointerException - if qualifiers or one of its elements is nullpublic Geneious.MajorVersion getVersionSupport(XMLSerializable.VersionSupportType versionType)
XMLSerializable.OldVersionCompatibleXMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener)
or the most recent version in which the XML returned from XMLSerializable.OldVersionCompatible.toXML(com.biomatters.geneious.publicapi.plugin.Geneious.MajorVersion, jebl.util.ProgressListener) last changed.getVersionSupport in interface XMLSerializable.OldVersionCompatibleversionType - specifies which version property to returnpublic static Geneious.MajorVersion getVersionSupportStatic(XMLSerializable.VersionSupportType versionType)
getVersionSupport(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.versionType - the type of version number to getgetVersionSupport(com.biomatters.geneious.publicapi.documents.XMLSerializable.VersionSupportType)public org.jdom.Element toXML()
XMLSerializableXMLSerializable.fromXML(org.jdom.Element) can completely
restore the objects representation.
It is recommended that the returned element use XMLSerializable.ROOT_ELEMENT_NAME as its name,
in which case it must not define an attribute called "type". In this case,
fromXML, will be called with an element whose name may differ from the element
return from this function. This recommendation allows a more compact representation
of the XML can be stored.
This method generally should not be called directly. Instead, you should usually call
XMLSerializer.classToXML(String, XMLSerializable)
which calls this method internally.
PluginDocument implementations of this method may choose to throw an XMLSerializationException,
enclosed in a RuntimeException.toXML in interface XMLSerializablepublic org.jdom.Element toXML(Geneious.MajorVersion majorVersion, ProgressListener progressListener)
toXML in interface XMLSerializable.OldVersionCompatiblemajorVersion - the major version of Geneious to serialize to XML for. For example "6.0" but not "6.0.0". This must be a version
returned greater or equal to a version returned from
getVersionSupport(VersionSupportType.OldestVersionSerializableTo)
and must never be greater than the current version (Geneious.getMajorVersion())progressListener - for reporting progress and cancellingpublic void fromXML(org.jdom.Element element)
throws XMLSerializationException
XMLSerializableXMLSerializable.toXML().
This method generally should not be called directly. Instead, you should usually call
XMLSerializer.classFromXML(org.jdom.Element)
or XMLSerializer.classFromXML(org.jdom.Element, Class)
which calls this method internally.
It is optional to implement this method. Instead of implementing an empty constructor and implementing
this method properly, the implementation may instead
throw an UnsupportedOperationException and implement a constructor
that takes a single Element as a parameter.
This allows for cleaner code such as support for final fields in the XMLSerializable class.
The element parameter should not be modified since it may be reused. If you need a modified version of it,
take a copy with Element.clone().fromXML in interface XMLSerializableelement - representation from a previous call to XMLSerializable.toXML()XMLSerializationException - if the Element can't be converted into this type of objectpublic void setName(String name)
name - The new name to set for this SequenceAnnotation; must not be nullNullPointerException - if name is nullgetName()public String toString()
public void writeObject(GeneiousObjectOutputStream out) throws IOException
Serializable.out - the stream to write to.IOException - if we are unable to write to the streamreadObject(GeneiousObjectInputStream)public void writeObject(DataOutput out) throws IOException
out - the DataOutput to write to.IOException - if we are unable to write to the DataOutputreadObject(GeneiousObjectInputStream)public void writeObject(Geneious.MajorVersion version, DataOutput out) throws IOException
version - the version number of Geneious that must be able to deserialize this.out - the DataOutput to write to.IOException - if we are unable to write to the DataOutputreadObject(GeneiousObjectInputStream)public static SequenceAnnotation readObject(GeneiousObjectInputStream in) throws IOException
writeObject(GeneiousObjectOutputStream)
It is a good idea to use a GeneiousObjectInputStream when deserializing
lots of annotations.in - the stream to read fromIOException - if we are unable to read from the streampublic static SequenceAnnotation readObject(DataInput in) throws IOException
writeObject(java.io.DataOutput)in - the DataInput to read fromIOException - if we are unable to read from the DataInputpublic SequenceAnnotation reverse(int sequenceLength, SequenceDocument.Alphabet alphabet)
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 (see SequenceAnnotationQualifier.EDITING_HISTORY_ORIGINAL_BASES)public int getCodonStart()
NCBI_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 -1SequenceAnnotationQualifier.NCBI_CODON_STARTpublic static boolean isEditingAnnotationType(String type)
type - a type of annotation returned from getType()getType()) is TYPE_EDITING_HISTORY_DELETION or
TYPE_EDITING_HISTORY_INSERTION or TYPE_EDITING_HISTORY_REPLACEMENT.public static boolean isReadOnlyAnnotationType(String type)
type - a type of annotation returned from getType()public SequenceAnnotation getAnnotationAdjustedForInsertion(int indexToInsertAt, int lengthOfInsertion, boolean isInsertionAllGaps, int newSequenceLengthIfCircular)
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)public SequenceAnnotation getAnnotationAdjustedForReplacement(int replacementPosition, int replacementLength, int sequenceLengthIfCircular)
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 sequencepublic SequenceAnnotation getAnnotationAdjustedForDeletion(int deletionStart, int deletionLength, boolean isDeletionAllGaps, int newSequenceLengthIfCircular)
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)public static String getTranslation(AnnotatedPluginDocument document, SequenceDocument sequence, SequenceAnnotation annotation)
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