JavaScript Libraries for Integrating with DNAnexus

Today we are pleased to announce the release of our first publicly available JavaScript toolkit, which simplifies the integration process of your web application with DNAnexus.

Using our API library, it’s easy to make calls to the DNAnexus API from your JavaScript application. Many of the details of constructing the AJAX request are taken care of for you, with this new toolkit, including the configuration of the authentication headers, construction of the URL, serialization of the input, and backoff/retry logic for failed requests. All you need is an authentication token from DNAnexus and you’ll be on your way to making API calls.

Here is example code:

var api = new DX.Api("AUTH_TOKEN_GOES_HERE");
api.call("user-bob", "describe").done(function(resp) {
  alert("user-bob's full name is " + [resp.first, resp.last].join(" "));
});

For additional DX.Api documentation please visit: https://github.com/dnanexus/dx-JavaScript-toolkit/blob/master/docs/api.md

In addition to API call management, we are also releasing our upload libraries that utilize multiple connections and check the integrity of files. Traditional file uploads use a single connection, do not provide integrity checking, and are not resumable. To address these shortcomings, DNAnexus upload libraries upload file chunks independently and in parallel and merge them back together, all with only a few lines of code.  Our uploading library is very efficient, utilizing web workers for efficient parallel computation and involves slicing the files into chunks, computing checksums on the chunks, uploading the chunks in parallel, and then closing the file.

Here is example code:

var upload = new DX.Upload(authToken, fileList, options);
upload.start();

For additional DX.Upload documentation please visit: https://github.com/dnanexus/dx-JavaScript-toolkit/blob/master/docs/upload.md

The DX.Upload library makes it easy to create rich upload experiences, such as the DNAnexus Web Uploader (pictured below).

Add data to project

We’ve only scratched the surface in functionality of DNAnexus JavaScript libraries, and we’ll be releasing additional features in the coming months. Also on the horizon, complete UI components for common operations inside the DNAnexus platform. Check back with our devblog for new updates and if you have any questions or feature requests, please email evan@dnanexus.com.