This tutorial will walk you through the following features of the DNAnexus app build infrastructure:
dxapp.json file, a central point for information about your app
/resources directory, where you can include files to be loaded onto the workers which will execute your app
The option to build your app remotely, needed when building from a system not compatible with Ubuntu 20.04 or 16.04
For more information about the worker environment where your app will run, and on how to specify runtime dependencies for your app, see the Execution Environment Reference.
DNAnexus applets and apps are usually compiled using the
dx build and
dx build --create-app utilities in the DNAnexus SDK, which take code on your local workstation and upload it into an object on the platform. The SDK expects each program to reside in a directory with a specific structure, which looks like this:
MyApp├── dxapp.json├── Readme.md├── Readme.developer.md├── resources│ └── ...├── src│ └── ...└── test└── ...
dxapp.json is a DNAnexus application metadata file. Its presence in a directory tells DNAnexus tools that it contains DNAnexus app source code (i.e., it's a project directory). See dxapp.json for a complete description of the app metadata format.
Readme.md file, if present, is inlined into the
description field of the app or applet.
Readme.developer.md file, if present, is inlined into the
See the section "Building apps from source" below, which describes the relationship between the
resources subdirectory of your project directory and the resulting app or applet.
You can use the following command to load your application into the DNAnexus Platform as an applet:
dx build MyApp
Assuming your applet's source code appears in a directory
MyApp underneath the current directory.
Before uploading your program to DNAnexus,
dx build performs the following build steps.
./configure (if a configure script exists)
make (if a Makefile is present)
You can put arbitrary steps in your Makefile to prepare any resources that might be needed by your app at runtime. For example, one module of your app might be written in C++ and therefore would need to be compiled to a library or executable.
Anything that is present in the
resources/ subdirectory of your app directory will be archived after the build step and then unarchived into the root of your execution environment's filesystem at runtime. You can either check files directly into your source repository in the
resources/ subdirectory, or have your build step generate files there, or a combination of the two.
By default, the
PATH in the environment is the following (it is inherited from Ubuntu's defaults):
As an example, if your Makefile produces a binary and puts it in
resources/usr/bin/bwa in your source tree, that file is available to your app as
/usr/bin/bwa at runtime (and you can therefore easily call it as a subprocess from your entry point method).
resources/ subdirectory is unpacked into the root of the virtual filesystem, your app starts in in
/home/dnanexus as its current working directory. You may therefore wish to put files or data in
resources/home/dnanexus in order to have them available in the current working directory when your applet starts.
A variety of sample applications are available for your reference: