Example 3: fastq_trimmer
In this example, you will translate the bash
app from the previous chapter into Workflow Definition Language (WDL).
You will learn how to:
Use Java Jar files to validate and compile WDL
Use WDL to define an applet's inputs, outputs, and runtime specs
Compile a WDL task into an applet
Getting Started
You will not use a wizard to start this applet, so manually create a directory for your work. Create a file called fastq_trimmer.wdl with the following contents:
The
task
defines the body of the applet.The
input
block defines the same inputs, aFile
called input_file and anInt
(integer) value called quality_score with a default value of 30.The
command
block will be executed at runtime. It uses the tilde/twiddle syntax (~{}
) to derefence variables. The output is written to a filename using thebasename
of the input.The
output
defines a singleFile
called output_file.The
runtime
specifies a Biocontainers/Docker that contains the FASTX toolkit binaries.
Checking and Compiling the WDL
To start, validate your WDL with WOMtool:
Before compiling the WDL into an applet, use dx pwd
to ensure you are in your desired project. If not, run dx select
to select a different project, then use the following command to compile the applet:
Use dx run
as in the previous chapter to run the applet with the -h|--help
option to that the usage looks identical to the bash
version:
You can run the applet using the command-line arguments as shown, or you can create a JSON file with the arguments as follows:
You can run the applet and watch the job with the following command:
The output will look quite different from the bash
app, but the basics are still the same. In this version, notice that you do not need to download the inputs or upload the outputs. Once the input files are in place, the command
block is run and the input files and variables are dereferenced properly. When the job has completed, run dx describe
to see the inputs and outputs:
Download the output file to ensure it looks like a correct result:
Documentation with Makefiles
You may find it useful to create a Makefile with all the steps documented in a runnable fashion:
Now you can run make compile
rather than type out the rather long Java command.
Review
The WDL version of the FastQTrimmmer applet is arguable simpler than the bash
version. It uses just one file, fastq_trimmer.wdl, and about 20 lines of text, whereas the bash
version requires at least dxapp.json, a bash
script, and the resources tarball.
In this chapter, you learned how to:
Use a Biocontainers Docker image for the necessary binary executables from FASTX toolkit
Define the same inputs, outputs, and commands as the
bash
applet from Chapter 3Use a Makefile to define project shortcuts to validate, compile, and run an applet
Resources
To create a support ticket if there are technical issues:
Go to the Help header (same section where Projects and Tools are) inside the platform
Select "Contact Support"
Fill in the Subject and Message to submit a support ticket.
Last updated
Was this helpful?