Class AlignmentOperation
- java.lang.Object
-
- com.biomatters.geneious.publicapi.plugin.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
DocumentOperation
instead, but that is not recommended.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AlignmentOperation.InputProperties
Represents the properties of the input to an AlignmentOperation
-
Constructor Summary
Constructors Constructor Description AlignmentOperation()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract java.util.List<java.lang.CharSequence>
align(SequenceDocument.Alphabet alphabet, java.util.List<java.lang.CharSequence> sequences, Options options, jebl.util.ProgressListener progressListener)
Align the given sequencesboolean
canRunOnGeneiousServer()
Returns true if this operation supports being run on a GeneiousServer.boolean
canRunOnLocalGeneious()
java.lang.String
getAlignmentOptionsDescription(java.util.List<java.lang.CharSequence> alignedSequences, Options options)
Deprecated.this functionality is now supplied by operation historyjava.lang.String
getDescription()
Options
getGeneralOptions()
Gets some Options that work for this operation when invoked on any type and number of input sequencesjava.lang.String
getHelp()
Icons
getIcons()
abstract java.lang.String
getName()
Options
getOptions(SequenceDocument.Alphabet alphabet, boolean pairwise, boolean isSingleAlignment)
Get the options appropriate for aligning these sequencesOptions
getOptions(AlignmentOperation.InputProperties inputProperties)
A more powerful alternative togetOptions(com.biomatters.geneious.publicapi.documents.sequence.SequenceDocument.Alphabet, boolean, boolean)
that may provide the properties of the input to the operation.java.lang.Double
getScore(java.util.List<java.lang.CharSequence> alignedSequences, Options options)
Used as score parameter when constructing the result alignment, seeDefaultAlignmentDocument#DefaultAlignmentDocument(SequenceDocument[], List, String, Double, String)
abstract java.lang.String
getSupportedCharacters(SequenceDocument.Alphabet alphabet)
Get the characters that are supported by this alignment operation.abstract double
getTabPosition()
java.lang.String
getUniqueIdPrefix()
abstract boolean
isProOnly()
boolean
isRefine(Options options)
boolean
preserveSequenceOrder(Options options)
abstract boolean
supportsAlphabet(SequenceDocument.Alphabet alphabet)
-
-
-
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()
-
getDescription
public java.lang.String getDescription()
- Returns:
- description of what the operations created from this class. See
DocumentOperation.getActionOptions()
-
getIcons
public Icons getIcons()
- Returns:
- icons for these operations. See
DocumentOperation.getActionOptions()
-
getTabPosition
public abstract double getTabPosition()
- Returns:
- A position between 0 and 1 indicating where in the alignment menu this operation appears.
See
GeneiousActionOptions.setMainMenuLocation(com.biomatters.geneious.publicapi.plugin.GeneiousActionOptions.MainMenu, double)
}
-
getHelp
public java.lang.String getHelp()
- Returns:
- help for these operations. See
DocumentOperation.getHelp()
-
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 sequencespairwise
- true iff there are only two (unique) sequencesisSingleAlignment
- 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)
-
getOptions
public Options getOptions(AlignmentOperation.InputProperties inputProperties) throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
A more powerful alternative togetOptions(com.biomatters.geneious.publicapi.documents.sequence.SequenceDocument.Alphabet, boolean, boolean)
that may provide the properties of the input to the operation. These may include properties such as the location the operation is run and the alphabet of the input sequences. Operations that have Options that need to change state depending on whichGeneiousService
the operation is run on should implement this method and register a listener on the results ofAlignmentOperation.InputProperties.getLocationOptions()
by callingOperationLocationOptions.addLocationChangedListener(com.biomatters.geneious.publicapi.plugin.OperationLocationOptions.LocationChangedListener)
- Parameters:
inputProperties
- properties of the input to the AlignmentOperation. SeeAlignmentOperation.InputProperties
- Returns:
- the alignment options
- Throws:
com.biomatters.geneious.publicapi.plugin.DocumentOperationException
- if obtaining the options for this operation is unsuccessful for any reason- Since:
- API 4.15 (Geneious 5.1.1)
-
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 sequencessequences
- sequences to alignoptions
- options for aligning these sequencesprogressListener
- 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 historyUsed as alignmentOptions parameter when constructing the result alignment, seeDefaultAlignmentDocument#DefaultAlignmentDocument(SequenceDocument[], List, String, Double, String)
- Parameters:
alignedSequences
- aligned sequencesoptions
- 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, seeDefaultAlignmentDocument#DefaultAlignmentDocument(SequenceDocument[], List, String, Double, String)
- Parameters:
alignedSequences
- aligned sequencesoptions
- 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.- The state of the Options returned from its various getOptions() methods can be completely restored by
calling
Options.valuesFromXML(org.jdom.Element)
with the element obtained fromOptions.valuesToXML(String)
. - All results are returned through the
DocumentOperation.OperationCallback
or as an element in the return list. - The operation does not access any
GeneiousService
s directly.
- Returns:
- true if the operation can be run on a remote GeneiousServer
- Since:
- API 4.15 (Geneious 5.1.1)
- The state of the Options returned from its various getOptions() methods can be completely restored by
calling
-
-