Public | Automated Build

Last pushed: a year ago
Short Description
Example of dockerizing python scripts
Full Description

<a href = ""><img src ="" width ="300" align="center"></a>

If you are following the tutorial, switch to the <a href="">tutorial branch</a>.

What it is?

This is a very simple workflow, using two simple python script to illustrate, as an example,
how to bring several commandline application into a Docker container, and then how to express them
into CWL.

schematic of the workflow

The workflow is composed by two scripts:

  • which gets in input a dna.txt file composed by nucleotides and writes a rna.txt
    as output
  • which accepts a rna.txt as input and produce a peptide.txt

Build the image:

We create an image, called dna2protein, and build it using the Dockerfile.
Note: mmattioni is the username on the Seven Bridges Platform, dna2protein is the
development project we have created there. Change them to yours otherwise won't work.

docker build -t dna2protein .

We can launch a container, and see if we have everything we need.

docker run -it dna2protein bash

Launch our scripts from the container:

Transcribe example:

$ docker run dna2protein -h
usage: [-h] [-v] [--version] dna

Translates a DNA input test into a RNA

positional arguments:
  dna               DNA input file to transcribe

optional arguments:
  -h, --help     show this help message and exit
  -v, --verbose
  --version      show program's version number and exit

Translate example:

$ docker run dna2protein -h
usage: [-h] [--verbose] [--version] mRNA

Transcribe the provided mRNA into a peptide.

positional arguments:
  mRNA           mRNA to transcribe

optional arguments:
  -h, --help     show this help message and exit
  --verbose, -v  Run in verbose mode (default: False)
  --version      show program's version number and exit

Now our scripts are dockerized and we can use it directly from the image.

Push our image to the SevenBridges registry

First we need to tag the image. Make sure you have create a dev project called dna2protein, otherwise you will
not be able to push the image.

docker tag dna2protein

Now we login and push it to the registry. Note: you have to provide you API TOKEN, not the password you use to log
on the Seven Bridges Platform.

docker login --username <SBG_USERNAME> --email <SBG_EMAIL> --password <SBG_API_TOKEN>
docker push

CWL associated

The CWL associated for the whole workflow is in the root of the directory and it's called

you can run it locally with rabix (grab the latest release from

rabix --verbose dna2protein.cwl.json -- --dna dna.txt
Docker Pull Command
Source Repository