Class SequenceAlignmentDocument.ReferencedSequence

  • Enclosing class:
    SequenceAlignmentDocument

    public static final class SequenceAlignmentDocument.ReferencedSequence
    extends java.lang.Object
    Represents a reference to the original document that a sequence in this alignment was aligned from. Usually this is a reference to an AnnotatedPluginDocument containing a SequenceDocument. However, the referenced AnnotatedPluginDocument may instead contain a SequenceListDocument if the alignment was built from a sequence list document or a SequenceAlignmentDocument if the alignment was built using the consensus alignment builder.
    • Constructor Detail

      • ReferencedSequence

        public ReferencedSequence​(AnnotatedPluginDocument referencedDocument,
                                  int indexInSequenceListDocument)
        Parameters:
        referencedDocument - the document to reference. Must not be null.
        indexInSequenceListDocument - if the referenced document is a SequenceListDocument then this must be the index of the referenced sequence in that SequenceListDocument. Or -1 if the referenced document is not a SequenceListDocument.
    • Method Detail

      • getReferencedDocument

        public AnnotatedPluginDocument getReferencedDocument()
        Gets the document a sequence in the alignment was built from.

        Usually this AnnotatedPluginDocument contains a SequenceDocument. However, the AnnotatedPluginDocument may instead contain a SequenceListDocument if the alignment was built from a sequence list document or a SequenceAlignmentDocument if the alignment was built using the consensus alignment builder.

        Returns:
        The referenced document. Will never be null.
      • getIndexInSequenceListDocument

        public int getIndexInSequenceListDocument()
        If getReferencedDocument() is a SequenceListDocument then this method returns the index of the referenced sequence in that SequenceListDocument
        Returns:
        the index of the referenced sequence in that SequenceListDocument or -1 if the referenced document is not a SequenceListDocument.
      • forSequenceDocuments

        public static java.util.List<SequenceAlignmentDocument.ReferencedSequence> forSequenceDocuments​(AnnotatedPluginDocument... documents)
        Creates a list of ReferencedSequence, with 1 entry in the list for each given document (each of which must be a SequenceDocument) or null.
        Parameters:
        documents - the documents to create a list refering to.
        Returns:
        a list of ReferencedSequence where each entry in the list is null iff the corresponding entry in documents was null
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getSequenceDocument

        public SequenceDocument getSequenceDocument​(SequenceDocument.Alphabet alphabet)
                                             throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
        Get the sequence document referenced by this ReferencedSequence (if it references a SequenceDocument or SequenceListDocument)
        Parameters:
        alphabet - alphabet of the sequence. Never null
        Returns:
        the sequence document or null if this references something other than a sequenceDocument or sequenceListDocument
        Throws:
        com.biomatters.geneious.publicapi.plugin.DocumentOperationException - if the referenced sequence document could not be loaded
      • getSequenceDocument

        public static SequenceDocument getSequenceDocument​(SequenceAlignmentDocument.ReferencedSequence referencedSequence,
                                                           SequenceDocument.Alphabet alphabet)
                                                    throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
        Get the sequence document referenced by a ReferencedSequence (if it references a SequenceDocument or SequenceListDocument)
        Parameters:
        alphabet - alphabet of the sequence. Never null
        referencedSequence - the referenced sequence to get the sequence document from. Can be null
        Returns:
        the sequence document or null if the referencedSequence passed in was null or if it references something other than a sequenceDocument or sequenceListDocument
        Throws:
        com.biomatters.geneious.publicapi.plugin.DocumentOperationException - if the referenced document could not be loaded