Class Assembler
- java.lang.Object
-
- com.biomatters.geneious.publicapi.plugin.Assembler
-
- All Implemented Interfaces:
BadgeSupplier
public abstract class Assembler extends java.lang.Object implements BadgeSupplier
Allows the implementation of a read mapper, reference assembler or de novo assembler. AGeneiousPlugincan return 1 or more assembly algorithm implementations viaGeneiousPlugin.getAssemblers(). The API documentation includes a sample implementation called ExampleAssembler While these could be implemented as aDocumentOperation, the Assembler API simplifies the process.- Since:
- API 4.14 (Geneious 5.1.0)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAssembler.CallbackUsed for assembly algorithms to provide results back to Geneious.static classAssembler.ContigOutputSupportUsed for indicating whether an assembly algorithm outputs contigs, consensus sequences, or both.static classAssembler.ReferenceSequenceSupportUsed for indicating whether an assembly algorithm supports no reference sequence, a single reference sequence, or multiple reference sequences.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDE_NOVO_UNIQUE_ID_SUFFIXIf an assembly implementation supports both reference sequence and de novo assembly, its de novo assemblergetUniqueId()should end with this.static java.lang.StringREFERENCE_UNIQUE_ID_SUFFIXIf an assembly implementation supports both reference sequence and de novo assembly, its referenced assemblergetUniqueId()should end with this.
-
Constructor Summary
Constructors Constructor Description Assembler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidassemble(Options options, AssemblerInput assemblyInput, jebl.util.ProgressListener progressListener, Assembler.Callback callback)Called to actually perform the assembly.booleancanRunOnGeneiousServer()Returns true if this operation supports being run on a GeneiousServer.booleancanRunOnLocalGeneious()Determine whether this assembly algorithm supports being run on the current computer.BadgegetBadge()This can be used to add any badge to the drop-down of Mapper in assembly operations dialog.abstract Assembler.ContigOutputSupportgetContigOutputSupport()Gets the type of data generated by this assembler.doublegetMenuPosition()abstract java.lang.StringgetName()Provides a short 1 or 2 word name for this algorithm.abstract OptionsgetOptions(OperationLocationOptions locationOptions, AssemblerInput.Properties inputProperties)Gets some options to display to the user before performing assembly.abstract Assembler.ReferenceSequenceSupportgetReferenceSequenceSupport()Gets whether or not this algorithm supports/requires assembling to a reference sequence and if so, whether it can assemble to multiple reference sequences.java.lang.StringgetShortName()abstract java.lang.StringgetUniqueId()Gets a unique id for this algorithm.booleanhandlesTrimAnnotations()Returns true if this assembler handles trim annotations (SequenceAnnotation.TYPE_TRIMMEDon input sequences and preserves them on generated contigs.booleanisProOnly()If true, this assembler will be always disabled when the user doesn't have an active license.abstract booleanprovidesUnusedReads()Returns true if this assembler can inform theAssembler.Callbackabout all reads that couldn't be assembled.booleanprovidesUsedReads()Returns true if this assembler can inform theAssembler.Callbackabout all reads that could be assembled.booleanprovidesUsedReadsIncludeMates()Returns true if this assembler can inform theAssembler.Callbackabout the mates of all reads that could be assembled.booleansupportsInputContigs()true if this assembly algorithm can accept contigs (SequenceAlignmentDocumentsas input along with sequences.booleansupportsReferenceSequencesWithDuplicateNames()booleansupportsSingleInputContig()true if this assembly can accept single contigs as input and do some sort of fine tuning to improve the contig.
-
-
-
Field Detail
-
DE_NOVO_UNIQUE_ID_SUFFIX
public static final java.lang.String DE_NOVO_UNIQUE_ID_SUFFIX
If an assembly implementation supports both reference sequence and de novo assembly, its de novo assemblergetUniqueId()should end with this.- See Also:
- Constant Field Values
-
REFERENCE_UNIQUE_ID_SUFFIX
public static final java.lang.String REFERENCE_UNIQUE_ID_SUFFIX
If an assembly implementation supports both reference sequence and de novo assembly, its referenced assemblergetUniqueId()should end with this.- See Also:
- Constant Field Values
-
-
Method Detail
-
getBadge
public Badge getBadge()
This can be used to add any badge to the drop-down of Mapper in assembly operations dialog. E.g. when introducing a new Assembly we can setBadge.NEWto draw attention to new implementation- Specified by:
getBadgein interfaceBadgeSupplier- Returns:
Badgeor null if there is no badge
-
getUniqueId
public abstract java.lang.String getUniqueId()
Gets a unique id for this algorithm. Since this must be unique, prefixing it with the fully qualified class name is recommended. Also seegetReferenceSequenceSupport(). The Geneious assemblers have unique IDs "Geneious.deNovo" and "Geneious.reference".- Returns:
- a unique id for this algorithm
- See Also:
getReferenceSequenceSupport(),DE_NOVO_UNIQUE_ID_SUFFIX,REFERENCE_UNIQUE_ID_SUFFIX
-
getName
public abstract java.lang.String getName()
Provides a short 1 or 2 word name for this algorithm.- Returns:
- a short 1 or 2 word name for this algorithm.
-
getMenuPosition
public double getMenuPosition()
- Returns:
- a value between 0 and 1 to represent the relative position of this assembler in the drop down list of available assemblers. Lower values appear first. The default implementation returns 0.5.
Similar to how
GeneiousActionOptions.getMainMenuPosition()works. - Since:
- API 4.202001 (Geneious 2020.0.1)
- See Also:
GeneiousActionOptions.getMainMenuPosition()
-
getShortName
public java.lang.String getShortName()
- Returns:
- a short single word name for this algorithm. The default implementation returns the first word of
getName() - Since:
- API 4.1100 (Geneious 11.0.0)
-
getOptions
public abstract Options getOptions(OperationLocationOptions locationOptions, AssemblerInput.Properties inputProperties) throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
Gets some options to display to the user before performing assembly.- Parameters:
locationOptions- Used to control where the assembler is run. Will be null if the assembler can only be run locally. SeeOperationLocationOptionsfor more details.inputProperties- some properties summarising the data to be assembled. If the user changes the reference sequence after the options are retrieved, the property values will change. The assembly implementation can request to be notified about this usingAssemblerInput.Properties.addChangeListener(org.virion.jam.util.SimpleListener)@return some options to display to the user before performing assembly.- Returns:
- options to display to the user for doing assembly.
- Throws:
com.biomatters.geneious.publicapi.plugin.DocumentOperationException- if this assembler doesn't support assembly on the given AssemblerInput.Properties
-
getReferenceSequenceSupport
public abstract Assembler.ReferenceSequenceSupport getReferenceSequenceSupport()
Gets whether or not this algorithm supports/requires assembling to a reference sequence and if so, whether it can assemble to multiple reference sequences. If an algorithm can support either reference assembly or de novo assembly, 2 different algorithm implementations must be created. In this case the 2 implementations should start with the samegetUniqueId()prefix, and end withDE_NOVO_UNIQUE_ID_SUFFIXandREFERENCE_UNIQUE_ID_SUFFIXso that Geneious can recognize they are the same and provide appropriate options to the user.- Returns:
- the type of reference sequences this assembler supports.
- See Also:
getUniqueId()
-
supportsReferenceSequencesWithDuplicateNames
public boolean supportsReferenceSequencesWithDuplicateNames()
- Returns:
- false if
AssemblerInput.getReferenceSequence(int, jebl.util.ProgressListener)throws aDocumentOperationExceptionif there are duplicate reference sequence names. The default implementation returns false - Since:
- API 4.710 (Geneious 7.1.0)
-
getContigOutputSupport
public abstract Assembler.ContigOutputSupport getContigOutputSupport()
Gets the type of data generated by this assembler. Some assemblers may generate just a consensus sequence (in which case they should returnAssembler.ContigOutputSupport.ConsensusOnly- Returns:
- the type of data generated by this assembler.
-
supportsInputContigs
public boolean supportsInputContigs()
true if this assembly algorithm can accept contigs (SequenceAlignmentDocumentsas input along with sequences. If so, thenReads provided as input to the assembler may be contigs instead of single or paired sequences. The default implementation returns false.- Returns:
- true if this assembly algorithm can accept contigs (
SequenceAlignmentDocumentsas input along with sequences. - See Also:
supportsSingleInputContig()
-
supportsSingleInputContig
public boolean supportsSingleInputContig()
true if this assembly can accept single contigs as input and do some sort of fine tuning to improve the contig.- Returns:
- true if this assembly can accept single contigs as input and do some sort of fine tuning to improve the contig.
- Since:
- API 4.30 (Geneious 5.3.0)
- See Also:
supportsInputContigs()
-
providesUnusedReads
public abstract boolean providesUnusedReads()
Returns true if this assembler can inform theAssembler.Callbackabout all reads that couldn't be assembled. This controls whether the "Save unused reads" option will be enabled in the user interface. An assembler can query whether or not the user actually selected the setting usingAssemblerInput.isSaveUnusedReads()- Returns:
- true if this assembler will inform the
Assembler.Callbackabout all reads that couldn't be assembled.
-
providesUsedReads
public boolean providesUsedReads()
Returns true if this assembler can inform theAssembler.Callbackabout all reads that could be assembled. This controls whether the "Save used reads" option (and associated "include mates" option ifprovidesUsedReadsIncludeMates()) will be enabled in the user interface. An assembler can query whether or not the user actually selected the setting usingAssemblerInput.isSaveUsedReads()- Returns:
- true if this assembler will inform the
Assembler.Callbackabout all reads that could be assembled. - Since:
- API 4.50 (Geneious 5.5.0)
-
providesUsedReadsIncludeMates
public boolean providesUsedReadsIncludeMates()
Returns true if this assembler can inform theAssembler.Callbackabout the mates of all reads that could be assembled. This controls whether the "include mates" option (associated with the "Save used reads" option) will be enabled in the user interface. An assembler can query whether or not the user actually selected the setting usingAssemblerInput.isSaveUsedReadsIncludeMates()- Returns:
- true if this assembler will inform the
Assembler.Callbackabout the mates of all reads that could be assembled. - Since:
- API 4.50 (Geneious 5.5.0)
-
handlesTrimAnnotations
public boolean handlesTrimAnnotations()
Returns true if this assembler handles trim annotations (SequenceAnnotation.TYPE_TRIMMEDon input sequences and preserves them on generated contigs. The default implementation returns false.- Returns:
- true if this assembler handles trim annotations (
SequenceAnnotation.TYPE_TRIMMEDon input sequences and preserves them on generated contigs. - Since:
- API 4.15 (Geneious 5.1.1)
-
assemble
public abstract void assemble(Options options, AssemblerInput assemblyInput, jebl.util.ProgressListener progressListener, Assembler.Callback callback) throws com.biomatters.geneious.publicapi.plugin.DocumentOperationException
Called to actually perform the assembly. All generated contigs (and unused reads if supported) should be given to the callback. Note: The operation will be run in a non AWT thread. If you need to perform user interface interaction in addition to the options provided in the optionsPanel (for example prompting for user input) then you need to place this inside a ThreadUtilities.invokeAndWait() function call. WARNING: Geneious may call this function multiple times simultaneously. Therefore, any implementation should not store its internal state within instance fields.- Parameters:
options- the options returned fromgetOptions(OperationLocationOptions, com.biomatters.geneious.publicapi.plugin.AssemblerInput.Properties)assemblyInput- the input data to assemble.progressListener- a progress listener to report progress to and to check for cancelling.callback- the callback to add the results to. @throws DocumentOperationException if the operation can't be performed or is cancelled.- Throws:
com.biomatters.geneious.publicapi.plugin.DocumentOperationException- if something goes wrong during assembly.
-
canRunOnLocalGeneious
public boolean canRunOnLocalGeneious()
Determine whether this assembly algorithm supports being run on the current computer. For example the algorithm may only work on particular operating systems or only on Geneious server.- Returns:
- true if this assembly algorithm supports being run on the current computer.
-
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- Returns:
- true if the operation can be run on a remote GeneiousServer
- See Also:
DocumentOperation.canRunOnGeneiousServer()
-
isProOnly
public boolean isProOnly()
If true, this assembler will be always disabled when the user doesn't have an active license. When disabled for this reason it will also have "(restricted)" appended to its name. The default implementation returns true.- Returns:
- whether this action requires an active license
-
-