Class AlignmentOperation


  • public abstract class AlignmentOperation
    extends java.lang.Object
    A convenience class to enable plugins to contain alignment operations which do not need to concern themselves with:
    • The type of documents that have been selected (sequence documents, sequence list documents, or alignment documents)
    • Reordering and reversing of the sequences
    • Whether the alignment is local or global
    • Referenced documents
    • Bases/residues unsupported by the underlying algorithm
    If a plugin wants to handle these itself, it could implement itself as a DocumentOperation instead, but that is not recommended.
    • Constructor Detail

      • AlignmentOperation

        public AlignmentOperation()
    • Method Detail

      • getName

        public abstract java.lang.String getName()
        Returns:
        human-readable name for this operation
      • getUniqueIdPrefix

        public java.lang.String getUniqueIdPrefix()
        Returns:
        prefix for the unique ID of all operations created from this class. See DocumentOperation.getUniqueId()
      • supportsAlphabet

        public abstract boolean supportsAlphabet​(SequenceDocument.Alphabet alphabet)
        Parameters:
        alphabet -
        Returns:
        true iff alignments can be performed on sequences of this alphabet
      • getOptions

        public Options getOptions​(SequenceDocument.Alphabet alphabet,
                                  boolean pairwise,
                                  boolean isSingleAlignment)
                           throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
        Get the options appropriate for aligning these sequences
        Parameters:
        alphabet - alphabet of the sequences
        pairwise - true iff there are only two (unique) sequences
        isSingleAlignment - iff the only selected document is an alignment
        Returns:
        the alignment options
        Throws:
        com.biomatters.geneious.publicapi.plugin.DocumentOperationException - if obtaining the options for this operation is unsuccessful for any reason
      • getGeneralOptions

        public Options getGeneralOptions()
                                  throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
        Gets some Options that work for this operation when invoked on any type and number of input sequences
        Throws:
        com.biomatters.geneious.publicapi.plugin.DocumentOperationException - if this operation doesn't support general options.
        Since:
        API 4.700 (Geneious 7.0.0)
      • align

        public abstract java.util.List<java.lang.CharSequence> align​(SequenceDocument.Alphabet alphabet,
                                                                     java.util.List<java.lang.CharSequence> sequences,
                                                                     Options options,
                                                                     jebl.util.ProgressListener progressListener)
                                                              throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
        Align the given sequences
        Parameters:
        alphabet - alphabet of the sequences
        sequences - sequences to align
        options - options for aligning these sequences
        progressListener - used to report progress on the alignment
        Returns:
        the aligned sequence strings. The returned sequences must be the same as the input sequences except for the introduction of gaps and optionally reverse complementing in the case of nucleotide sequences. For local alignment, the sequences must be in the same order as the input sequences. For global alignment these do not have to be in the same order as the ones passed in.
        Throws:
        com.biomatters.geneious.publicapi.plugin.DocumentOperationException - if there is a problem or the user cancels the alignment
      • getAlignmentOptionsDescription

        @Deprecated
        public java.lang.String getAlignmentOptionsDescription​(java.util.List<java.lang.CharSequence> alignedSequences,
                                                               Options options)
                                                        throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
        Deprecated.
        this functionality is now supplied by operation history
        Used as alignmentOptions parameter when constructing the result alignment, see DefaultAlignmentDocument#DefaultAlignmentDocument(SequenceDocument[], List, String, Double, String)
        Parameters:
        alignedSequences - aligned sequences
        options - options used to align the sequences
        Returns:
        the alignment options as a string
        Throws:
        com.biomatters.geneious.publicapi.plugin.DocumentOperationException
      • getSupportedCharacters

        public abstract java.lang.String getSupportedCharacters​(SequenceDocument.Alphabet alphabet)
        Get the characters that are supported by this alignment operation. Other characters will be converted to 'N' in the case of nucleotide sequences and 'X' in the case of protein sequences before {com.biomatters.geneious.publicapi.plugin.AlignmentOperation@link align(SequenceDocument.Alphabet, List, Options, ProgressListener)}
        Parameters:
        alphabet - alphabet to get the characters for
        Returns:
        characters that are supported or null to indicate that all characters are supported. The default implementation returns
      • getScore

        public java.lang.Double getScore​(java.util.List<java.lang.CharSequence> alignedSequences,
                                         Options options)
        Used as score parameter when constructing the result alignment, see DefaultAlignmentDocument#DefaultAlignmentDocument(SequenceDocument[], List, String, Double, String)
        Parameters:
        alignedSequences - aligned sequences
        options - options used to align the sequences
        Returns:
        the score as a Double or null for no score (the default implementation returns null)
      • isRefine

        public boolean isRefine​(Options options)
        Parameters:
        options - options used to align the sequences
        Returns:
        true iff we are refining an existing alignment rather than aligning the sequences passed in
      • preserveSequenceOrder

        public boolean preserveSequenceOrder​(Options options)
        Parameters:
        options - options used to align the sequences
        Returns:
        true iff the generated alignment should preserve the original order of the sequences.
      • isProOnly

        public abstract boolean isProOnly()
        Returns:
        true iff the alignment method requires an active license
      • canRunOnLocalGeneious

        public boolean canRunOnLocalGeneious()
        Returns:
        true if this operation supports being run on the current computer.
        Since:
        API 4.15 (Geneious 5.1.1)
      • canRunOnGeneiousServer

        public boolean canRunOnGeneiousServer()
        Returns true if this operation supports being run on a GeneiousServer. If this returns true then the user is presented with the option of running the operation on their local computer or on a connected GeneiousServer.

        Operations should only return true if the following is true, otherwise undesired behavior may occur.

        Returns:
        true if the operation can be run on a remote GeneiousServer
        Since:
        API 4.15 (Geneious 5.1.1)