«  Custom Elements with Scripts   ::   Contents   ::   Using Script to Set Parameter Value  »


Custom Elements with Command Line Tools

In UGENE you can create a custom workflow element that would launch any command line tool.

Creating Element

To create an element for a command line tool select either Actions ‣ Create element with command line tool in the main menu or the following icon on the toolbar:

_images/external_cmd_tool.png

The Create Element with Command Line Tool wizard appears. On the first page of the wizard input a name and a description of the element in the Property Editor. Letters, numbers and underscores are allowed in the name.

_images/create_elt_cmd_p1.png

On the second page add the required input and output data:

_images/create_elt_cmd_p2.png

For each input or output you should:

  • Input a name (letters, numbers and underscores are allowed in the name).
  • Select a type: multiple alignment, sequence, sequence with annotations or a set of annotations.
  • Select a format required.
  • Optionally input a description.

On the third page of the wizard you can add attributes for the command line tool. Later you would be able to set values for the attributes in the Property Editor, i.e. the attributes are actually the parameters of the new element.

_images/create_elt_cmd_p3.png

For each attribute added you should:

  • Input a name (letters, numbers and underscores are allowed in the name).
  • Select it’s type: boolean, number, string or URL.
  • Optionally input the description.

On the last page of the wizard you should input the execution string, i.e. the command that would be executed.

_images/create_elt_cmd_p4.png

The signature of the execution string depends on the command that is launched. But the general rule is that input/output data and attributes have prefic $. For example let there be some perl script “myScript.pl” that accepts an input file as the first attribute and accepts the second attribute denoted as “param1”. The command may look as follows:

perl [path_to_script]myScript.pl $infile $param1 > $outfile

Here infile and outfile are input and output data set on the step 2, param1 is an attribute set on the step 3.

On the same wizard page you can optionally input the description of the element. It would be shown on the element on the Scene. The description can be parameterized. This means that if you input e.g. an attribute name (with prefix $), the name on the element would be substituted with the value of the corresponding parameter.

For example input the following parameters:

_images/create_elt_cmd_p4_filled.png

The element created looks as follows:

_images/elt_cmd_on_scene.png

Editing Element

The element created appears in the Custom Elements with CMD Tools group on the Palette.

To edit an element select the Edit item in it’s context menu. The same wizard as during creation of the element would appear.

Adding Existent Element

The elements are stored in the files with the .etc extension.

The directory to store the elements can be set in the Application Settings dialog.

To add an element from a file to the Workflow Designer select either Actions ‣ Add element with command line tool in the main menu or the following icon on the toolbar:

_images/external_cmd_tool_add.png

In the appeared dialog select the required .etc file. The element is added to the group on the Pallete and appears on the Scene.

Removing Element

To remove an element right-click on it and select the Remove item in the element’s context menu. The corresponding .etc file is also removed in this case.