public class DefaultPhylogenyDocument extends PhylogenyDocument implements ExportableDocument, EditableSameTaxaTreesDocument, XMLSerializable.OldVersionCompatible
SequenceAlignmentDocument.ReferencedSequenceExportableDocument.FormatPluginDocument.ReferencedDocumentsAlwaysLoaded, PluginDocument.ReferencedDocumentsNotLoaded, PluginDocument.SizeRequiredToLoadIntoMemoryProviderXMLSerializable.OldVersionCompatible, XMLSerializable.VersionSupportType| Modifier and Type | Field and Description |
|---|---|
static String |
KEY_DOCUMENT_SIZE |
static String |
KEY_NEXUS_TREE_DISTANCE_MATRIX |
static String |
KEY_SEQUENCE_RESIDUES |
KEY_ALIGNMENT_OPTIONS, KEY_ALIGNMENT_SCORE, KEY_MATCH_REGIONSFILE_DATA_ATTRIBUTE_NAME, MAXIMUM_HTML_LENGTH, MODIFIED_DATE_FIELDROOT_ELEMENT_NAME| Constructor and Description |
|---|
DefaultPhylogenyDocument()
XML deserialization constructor.
|
DefaultPhylogenyDocument(org.jdom.Element element)
XML deserialization constructor.
|
DefaultPhylogenyDocument(List<? extends Tree> trees,
List<Sequence> inAlignedSequences,
String name,
String summary,
AnnotatedPluginDocument alignmentDocument,
boolean standardTranslation) |
DefaultPhylogenyDocument(List<? extends Tree> trees,
List<Sequence> inAlignedSequences,
String name,
String summary,
AnnotatedPluginDocument alignmentDocument,
boolean standardTranslation,
boolean allTreesWritable) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSequence(SequenceDocument sequence)
Add a sequence to the end of the alignment.
|
boolean |
areAllTreesWritable()
True if the tree viewer should allow the user to modify all trees in this document (if false, only the first tree will be writable)
|
boolean |
canAddAndRemoveSequences()
Check if this alignment supports adding and removing sequences.
|
boolean |
canExport(ExportableDocument.Format format)
Check if a format is supported by document.
|
boolean |
export(ExportableDocument.Format format,
OutputStream to)
Export a document.
|
void |
fromXML(org.jdom.Element doc)
Restore the object from the JDOM Element returned by
XMLSerializable.toXML(). |
String |
getDescription()
A human readable single line of text describing this document,
to appear in the description field in the document table.
|
List<? extends Tree> |
getTrees()
Get tree set.
|
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. |
void |
removeSequence(int index)
Removes the specified sequence from the alignment.
|
void |
reorderSequences(int[] ordering)
Adjusts the ordering of sequences in the alignment according to the ordering array.
|
void |
setNexusSource(String fileText,
int nexusBlockNumber)
Set source of document in nexus format.
|
void |
setSequenceName(int index,
String newName,
boolean allowModifyingOriginals)
change the name of a sequence within the alignment.
|
void |
setTrees(List<? extends Tree> newTrees)
Set some trees.
|
String |
toHTML()
Provide a textual view of document.
|
org.jdom.Element |
toXML()
Convert object to a JDOM element.
|
org.jdom.Element |
toXML(Geneious.MajorVersion version,
ProgressListener progressListener)
Serializes this class to XML format, potentially to a format readable by an earlier version of Geneious.
|
void |
updateSequence(int index,
CharSequence sequence,
List<SequenceAnnotation> annotations,
NucleotideGraph graph,
boolean allowModifyingOriginals)
Set new residues and related data for one sequence.
|
addContigReferenceSequence, calculateScore, canSetAnnotations, canSetAnnotationsOnConsensus, canSetFieldValue, canSetSequenceNames, fromJeblAlignment, getAlignmentDataForSequencesNotInMemory, getAnnotationsOnConsensus, getCircularLength, getContigReferenceSequenceIndex, getCreationDate, getDescription, getDisplayableFields, getFieldValue, getImmutablePairedReadManager, getMateExpectedDistance, getMateIndex, getName, getNumberOfSequences, getReferencedDocument, getReferencedSequence, getScore, getSequence, getSequences, getSequencesInImmutableList, getSequenceType, getSizeRequiredToLoadIntoMemory, getSummary, getTrackManager, getURN, isContig, isEditable, isFreeEndGapAlignment, isQueryCentricAlignment, isReferencedDocumentReversed, setAlignmentDataForSequencesNotInMemory, setAlignmentOptions, setAnnotations, setAnnotationsOnConsensus, setCircularLength, setContig, setContigReferenceSequenceIndex, setCreationDate, setFieldValue, setFreeEndGapAlignment, setMatchRegions, setMates, setName, setQueryCentricAlignment, setReferencedDocument, setReferencedSequence, setReferencedSequenceListDocument, setScore, toXMLasJeblAlignment, asJeblAlignmentIfMemoryAllows, getRealignedName, getReferencedDocuments, getReferencedSequences, getRefinedName, getSequenceAsJeblSequence, setReferencedSequenceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCreationDate, getDisplayableFields, getFieldValue, getName, getURNpublic static final String KEY_NEXUS_TREE_DISTANCE_MATRIX
public static final String KEY_DOCUMENT_SIZE
public static final String KEY_SEQUENCE_RESIDUES
public DefaultPhylogenyDocument()
XMLSerializablepublic DefaultPhylogenyDocument(org.jdom.Element element)
throws XMLSerializationException
XMLSerializableelement - the previously serialized element returned from toXML().XMLSerializationException - if deserialization failspublic DefaultPhylogenyDocument(List<? extends Tree> trees, List<Sequence> inAlignedSequences, String name, String summary, AnnotatedPluginDocument alignmentDocument, boolean standardTranslation)
trees - One or more trees whose tips are sequences of the alignment; must not be null or emptyinAlignedSequences - List of aligned sequences. Can be null if alignmentDocument is given.name - document namesummary - document summaryalignmentDocument - Alignment document which is the origin of alignedSequences (optional, i.e. may be null)standardTranslation - when true, taxa on tree is in fact ("1", "2", ...) and so a conversion to the actual
taxa name (from the sequences) has to be applied when appropriate.IllegalArgumentException - if trees is null or emptypublic DefaultPhylogenyDocument(List<? extends Tree> trees, List<Sequence> inAlignedSequences, String name, String summary, AnnotatedPluginDocument alignmentDocument, boolean standardTranslation, boolean allTreesWritable)
trees - One or more trees whose tips are sequences of the alignment; must not be null or emptyinAlignedSequences - List of aligned sequences. Can be null if alignmentDocument is given.name - document namesummary - document summaryalignmentDocument - Alignment document which is the origin of alignedSequences (optional, i.e. may be null)standardTranslation - when true, taxa on tree is in fact ("1", "2", ...) and so a conversion to the actual
taxa name (from the sequences) has to be applied when appropriate.allTreesWritable - True if the tree viewer should allow the user to modify all trees in this document (if false, only the first tree will be writable)IllegalArgumentException - if trees is null or emptypublic void setNexusSource(String fileText, int nexusBlockNumber)
fileText - text in nexus formatnexusBlockNumber - block number (or -1 for the first one)org.jdom.IllegalDataException - if fileText is not legal XML character data,
as determined by Verifier.checkCharacterData(String).IllegalStateException - if standardTranslationForTaxa was used.public List<? extends Tree> getTrees()
SameTaxaTreesDocumentgetTrees in interface SameTaxaTreesDocumentpublic boolean areAllTreesWritable()
public boolean canExport(ExportableDocument.Format format)
ExportableDocumentcanExport in interface ExportableDocumentformat - export formatpublic boolean export(ExportableDocument.Format format, OutputStream to) throws IOException
ExportableDocumentexport in interface ExportableDocumentformat - format to exportto - output document to this stream.IOException - if the OutputStream can't be written to for any reasonpublic 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 XMLSerializabletoXML in class DefaultAlignmentDocumentpublic 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.OldVersionCompatiblegetVersionSupport in class DefaultAlignmentDocumentversionType - specifies which version property to returnpublic org.jdom.Element toXML(Geneious.MajorVersion version, ProgressListener progressListener)
XMLSerializable.OldVersionCompatibleXMLSerializable.toXML() for a more
detailed description of what it means to serialize to XML.
All classes that implement this method must also implement XMLSerializable.toXML() and should delegate back to
this method using Geneious.getMajorVersion() and ProgressListener.EMPTY as parameters.toXML in interface XMLSerializable.OldVersionCompatibletoXML in class DefaultAlignmentDocumentversion - 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 setTrees(List<? extends Tree> newTrees)
EditableSameTaxaTreesDocumentsetTrees in interface EditableSameTaxaTreesDocumentnewTrees - A list of new trees. A null entry means no change and the existing tree is taken.public void reorderSequences(int[] ordering)
SequenceAlignmentDocumentSequenceAlignmentDocument.isEditable()reorderSequences in class DefaultAlignmentDocumentordering - Each integer between 0 and ordering.length - 1 inclusive should occur exactly once in this array.public void setSequenceName(int index,
String newName,
boolean allowModifyingOriginals)
SequenceAlignmentDocumentSequenceAlignmentDocument.canSetSequenceNames() returns true.setSequenceName in class DefaultAlignmentDocumentindex - index of the sequence name to changenewName - the new name for the sequence.allowModifyingOriginals - if the alignment stores a reference to an editable original SequenceDocument
(which can be determined by using SequenceAlignmentDocument.getReferencedDocument(int)) then if this parameter is true
the original referenced sequence document will be renamed too.
Otherwise, any existing reference to the original SequenceDocument will be discarded
and a copy of the original sequence stored internally within the alignment instead.public void updateSequence(int index,
CharSequence sequence,
List<SequenceAnnotation> annotations,
NucleotideGraph graph,
boolean allowModifyingOriginals)
SequenceAlignmentDocumentSequenceAlignmentDocument.isEditable()
(otherwise, the method should throw UnsupportedOperationException).updateSequence in class DefaultAlignmentDocumentindex - the index of the sequence to be updated. between 0 and SequenceAlignmentDocument.getNumberOfSequences() - 1sequence - the new residuesannotations - a list of the annotationsgraph - Must be null if the original sequence at the specified index is not a NucleotideGraphSequenceDocument.
Otherwise (i.e. if the sequence was a NucleotideGraphSequenceDocument), specifies the new
graph to use for that sequence.allowModifyingOriginals - if the change being made to the sequence would affect the unaligned version of it
(for example, the sequence residues are changing rather than just the gaps)
and the alignment stores a reference an editable original SequenceDocument
(which can be determined by using SequenceAlignmentDocument.getReferencedDocument(int)) then if this parameter is true
the original referenced sequence document will be modified.
If this parameter is not true and the change would have otherwise modified the original SequenceDocument,
then any reference to the original document will be discarded
and a copy of the original sequence stored internally within the alignment instead.public void removeSequence(int index)
SequenceAlignmentDocumentSequenceAlignmentDocument.isEditable()removeSequence in class DefaultAlignmentDocumentindex - the index of the sequence to be removed. between 0 and SequenceAlignmentDocument.getNumberOfSequences() - 1public void addSequence(SequenceDocument sequence)
SequenceAlignmentDocumentsequence should be the
gapped (aligned) sequence.addSequence in class DefaultAlignmentDocumentsequence - sequence to addSequenceAlignmentDocument.reorderSequences(int[]),
SequenceAlignmentDocument.setReferencedDocument(int, com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument)public boolean canAddAndRemoveSequences()
SequenceAlignmentDocumentcanAddAndRemoveSequences in class DefaultAlignmentDocumentSequenceAlignmentDocument.addSequence(SequenceDocument),
SequenceAlignmentDocument.removeSequence(int)public void fromXML(org.jdom.Element doc)
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 XMLSerializablefromXML in class DefaultAlignmentDocumentdoc - representation from a previous call to XMLSerializable.toXML()XMLSerializationException - if the Element can't be converted into this type of objectpublic String getDescription()
PluginDocumentgetDescription in interface PluginDocumentgetDescription in class DefaultAlignmentDocumentpublic String toHTML()
PluginDocument<html>toHTML in interface PluginDocumenttoHTML in class SequenceAlignmentDocument