Skip to content

Creating and saving workflows

In Bwb, you can create and organize workflows the way you want to by using the graphical interface. The Salmon RNA-seq demo workflow is one example of how a workflow can be constructed. Bwb workflows consist of widgets, widget settings, connections between widgets, and other elements that can be added to the workflow.

In this episode, you will learn how to create a workflow using the widgets included in Bwb. To create a new workflow, you can start off with one or more widgets and save a new workflow, or you can load an existing workflow and save it as a new workflow under a different name.

After completing this episode, you will:

  • Save a new workflow.
  • Find where the workflow's widgets are listed in the GUI.
  • Save a new workflow from an existing workflow.
  • Learn the structure of a workflow's folder and files.

Saving a workflow

Starting with an empty workspace, let's add a widget to the canvas. For example, let's add the File widget, from the Miscellaneous widget drawer, to the canvas. Having this one widget is good enough to save the canvas as a workflow.

Saving a workflow

To save what you have as a workflow, click on "File" on the top-left corner, and select "Save workflow as…"

Saving a workflow

In the middle of the display, you can see the settings you need to provide to save a workflow. The first setting is the workflow name. You can set this to a name specific to what would be done in the workflow. For this example, you can set the name to "example workflow". The name you set will be the directory name of the workflow that will be saved (more about workflow directories covered later).

Note

When naming your workflow, spaces and dashes (" " and "-") will be converted to an underscore ("_") in the workflow directory name. The workflow's files in its directory will have underscores in the name. The name for the workflow in Bwb will have dashes in the name automatically.

If the name is set to "example workflow", the workflow directory name is "example_workflow".

The next setting is the parent directory you want to store the workflow directory in. The default parent directory is /data/ . If you want to select another location, click on the blue folder icon and choose a folder to be the parent directory. While in the navigator, you can right-click and make a new folder. Let's make a new folder and call it "test_workflows", and choose it. The resulting parent directory would now be /data/test_workflows/, and expect the workflow to be stored as /data/test_workflows/example_workflow .

Note

When choosing a directory to save your workflow in, DO NOT SAVE THIS NEW WORKFLOW IN AN EXISTING WORKFLOW DIRECTORY. The workflow directory structure is set in a specific way that can make the both workflows (the existing workflow and the workflow you want to save) not work. So make sure the parent directory chosen is not a workflow directory.

Saving a workflow

Then, the color of the workflow in Bwb is set. The hexcode color is expected in this section. If this section is kept blank, the default color is light-blue. To select a color, click on the color wheel and choose a color you want. Let's pick the light-green color for now. When selected, the hex code for that color is automatically written in (#00ff00).

Saving a workflow

The second to last setting is the icon for this workflow. It expects an image file as the input, and this icon will appear on the workflow's widget drawer on the tool dock. You can select an image using the If left empty, the default icon will be the tool dock drawer icon from one of the widgets in the new workflow.

The final setting is the option of merging all widget types. If selected, widgets outside the workflow (added from the default widgets or from another workflow) are made as their own copies for the new workflow. These new widget copies are added to the new workflow's widget drawer in the tool dock. It is recommended to have this option enabled for encapsulation and reproducibility purposes.

At the end, the workflow settings before saving should look something like this:

Saving a workflow

Now, let's click "OK" to save this new workflow. The Bwb window will reload, and you can now see the new workflow is loaded. The name is displayed at the top of the window, the widget is now highlighted in green, and the workflow's widget drawer is added to the tool dock. This drawer is also colored green, and has the File widget that is currently on the canvas.

Saving a workflow

To see the workflow that is created as a directory, you can navigate to the newly created /data/test_workflows/example_workflow/ directory. You can see two things in this directory, one being the widgets/ folder and the other being the example_workflow.ows file. The .ows file contains the setup and settings for what is included in the workflow. This includes information about the widgets, connections between widgets, parameter settings, widget positions on the canvas, etc. in xml format.

Saving a workflow

The widgets/ folder will first open to another folder that is just the workflow name, then that folder contains the widgets, workflow icon, and an __init__.py file. The icon/ folder has the workflow's icon image file, and __init__.py script is how the workflow is loaded into Bwb. The widgets that are seen in the workflow's widget drawer are represented as their own directories. In this case, the File widget is shown as the File/ folder.

Saving a workflow

The File/ folder contains files for the settings and attributes for the widget, as well as the icon for that widget in its own dedicated folder.

Note

These widget directories are where you can find the Dockerfile setup in the Image Builder when editing the widgets. There will be a Dockerfiles/ folder created when you launch the Image Builder on a widget, and you can create a Dockerfile and other files needed for the Dockerfile in that folder.

Saving a workflow

Editing and overwriting a workflow

Going back to the workflow, there are some options on the bottom-left corner of Bwb that you can make changes to the workflow. The "i" icon allows you to change the properties of the workflow (title and description). The "#" icon formats the widgets on the canvas to be aligned in a grid format. The "T" allows you to add text to the workflow, and the arrow icon allows you to add arrows.

Editing and overwriting a workflow

Let's edit the workflow by adding an arrow and text to it. Try out the arrow and text options yourself by dragging the arrow to the direction you want to point, and add the text box and text to where you want to place it. An example is shown below.

Editing and overwriting a workflow

To save the changes to the workflow, Click on "File" on the top-left corner and click "Save workflow (Ctrl + S)". When the "Save workflow" window pops up, you can see the workflow name and parent directory already set when saving the workflow. Do not worry about the color and icon being blank, as Bwb will use what the workflow had previously for these options. Leave everything the same on this window and click "OK". When Bwb loads up again, the changes are now saved to the same workflow.

Saving a new workflow from an existing workflow.

Let's now make another edit to the workflow but then save it as a different workflow. Let's now add another widget to the workflow. For example, let's use the "bash_utils" widget from the "Scripting" drawer.

Editing and overwriting a workflow

Select "Save workflow as…" and rename the workflow to something different, like "example-workflow2". You can keep the parent directory, but let's change the color to something like light-blue. Keeping the rest the same, click "OK" and wait for Bwb to reload.

Editing and overwriting a workflow

When Bwb loads back up, you can see this new workflow is created with the bash widget included. You can see the workflow name is set differently, and the new workflow has its own tool dock widget drawer underneath the original workflow's drawer.

Editing and overwriting a workflow

This concludes how to create and save workflows. While this episode uses the default widgets to make a workflow, the next episode covers how you can make your own widgets when you want to create your own workflow.