App Build Process
Learn the basic app infrastructure you need to know to build your own DNAnexus app.
This tutorial will walk you through the following features of the DNAnexus app build infrastructure:
The
dxapp.json
file, a central point for information about your appThe
/resources
directory, where you can include files to be loaded onto the workers which will execute your appThe option to build your app remotely, needed when building from a system not compatible with Ubuntu 20.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.
App Directory Structure
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:
The dxapp.json
App Metadata File
dxapp.json
App Metadata FileThe file 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 Files
The Readme.md
file, if present, is inlined into the description
field of the app or applet.
The Readme.developer.md
file, if present, is inlined into the developerNotes
The Resources/ Subdirectory
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.
Building an Applet
You can use the following command to load your application into the DNAnexus Platform as an applet:
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.
The Resources/ Directory and Its Use
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).
While the 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.
Next Steps
See the Developer Tutorials page for language-specific tutorials in a variety of programming languages. These will walk you through writing more complex apps in the language of your choice.
If you would like to see more example code, you can use the
dx get
command to reconstruct and download the source directory of open-source apps (e.g.dx get app-cloud_workstation
). You can find open-source apps with the command below
Last updated