Class Assembler

java.lang.Object
com.biomatters.geneious.publicapi.plugin.Assembler
All Implemented Interfaces:
BadgeSupplier

public abstract class Assembler extends Object implements BadgeSupplier
Allows the implementation of a read mapper, reference assembler or de novo assembler. A GeneiousPlugin can return 1 or more assembly algorithm implementations via GeneiousPlugin.getAssemblers().

The API documentation includes a sample implementation called ExampleAssembler

While these could be implemented as a DocumentOperation, the Assembler API simplifies the process.

Since:
API 4.14 (Geneious 5.1.0)
  • Field Details

    • DE_NOVO_UNIQUE_ID_SUFFIX

      public static final String DE_NOVO_UNIQUE_ID_SUFFIX
      If an assembly implementation supports both reference sequence and de novo assembly, its de novo assembler getUniqueId() should end with this.
      See Also:
    • REFERENCE_UNIQUE_ID_SUFFIX

      public static final String REFERENCE_UNIQUE_ID_SUFFIX
      If an assembly implementation supports both reference sequence and de novo assembly, its referenced assembler getUniqueId() should end with this.
      See Also:
  • Constructor Details

    • Assembler

      public Assembler()
  • Method Details

    • 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 set Badge.NEW to draw attention to new implementation
      Specified by:
      getBadge in interface BadgeSupplier
      Returns:
      Badge or null if there is no badge
    • getUniqueId

      public abstract 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 see getReferenceSequenceSupport(). The Geneious assemblers have unique IDs "Geneious.deNovo" and "Geneious.reference".
      Returns:
      a unique id for this algorithm
      See Also:
    • getName

      public abstract 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:
    • getShortName

      public 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. See OperationLocationOptions for 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 using AssemblerInput.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 same getUniqueId() prefix, and end with DE_NOVO_UNIQUE_ID_SUFFIX and REFERENCE_UNIQUE_ID_SUFFIX so 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:
    • supportsReferenceSequencesWithDuplicateNames

      public boolean supportsReferenceSequencesWithDuplicateNames()
      Returns:
      false if AssemblerInput.getReferenceSequence(int, jebl.util.ProgressListener) throws a DocumentOperationException if 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 return Assembler.ContigOutputSupport.ConsensusOnly
      Returns:
      the type of data generated by this assembler.
    • supportsInputContigs

      public boolean supportsInputContigs()
      true if this assembly algorithm can accept contigs (SequenceAlignmentDocuments as input along with sequences. If so, then Reads 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 (SequenceAlignmentDocuments as input along with sequences.
      See Also:
    • 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:
    • providesUnusedReads

      public abstract boolean providesUnusedReads()
      Returns true if this assembler can inform the Assembler.Callback about 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 using AssemblerInput.isSaveUnusedReads()
      Returns:
      true if this assembler will inform the Assembler.Callback about all reads that couldn't be assembled.
    • providesUsedReads

      public boolean providesUsedReads()
      Returns true if this assembler can inform the Assembler.Callback about all reads that could be assembled. This controls whether the "Save used reads" option (and associated "include mates" option if providesUsedReadsIncludeMates()) will be enabled in the user interface. An assembler can query whether or not the user actually selected the setting using AssemblerInput.isSaveUsedReads()
      Returns:
      true if this assembler will inform the Assembler.Callback about 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 the Assembler.Callback about 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 using AssemblerInput.isSaveUsedReadsIncludeMates()
      Returns:
      true if this assembler will inform the Assembler.Callback about 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_TRIMMED on input sequences and preserves them on generated contigs. The default implementation returns false.
      Returns:
      true if this assembler handles trim annotations (SequenceAnnotation.TYPE_TRIMMED on 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, 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 from getOptions(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:
    • 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