Custom Elements with Scripts

It is possible to create custom algorithmic blocks using scripts in the Workflow Designer.

To create an element, either select Actions ‣ Create Element with Script in the main menu.

The Create Element with Script dialog will appear:

Here you should set the name of the element, its description, and the input/output ports of the element. It is possible to create a port with several input/output slots.

There are four types of data available for a slot:

  • Multiple alignments
  • Sequence
  • Set of annotations
  • Files

You can also add an attribute. The following types are supported for attributes:

  • String
  • Number
  • Boolean

The created element is stored in a directory that can be set in the Application Settings dialog.

The element also becomes available in the Custom Elements with Scripts group on the Palette.

It is required to write a script for the element. Supported languages for the script are languages based on ECMAScript (Javascript, QtScript).

To edit the script, select the element on the Scene and either select Actions ‣ Edit script of the element in the main menu or use the Edit script of the element item in the context menu.

The Script editor dialog will appear:

As you can see, there are predefined variables for the ports and the attributes in the script. The variables for the input slots begin with the “in_” prefix, and variables for the output slots begin with the “out_” prefix. It is possible to load a script from a file (use the Used script field to do it).

For each supported data type, UGENE provides a number of functions that can be used in the scripts.