Skip to content
David Rio Deiros edited this page Mar 31, 2014 · 3 revisions

DNAism.js is a javascript library that uses horizon charts to visualize genomic datasets. The library is a modified version of Cubism which was originally developed to work with time series data.

API Reference

The main entry point to library is context which defines, among other things, the region of the genome we want to explore:

    var context = dnaism.context()
                   .start(5000)
                   .stop(10000)
                   .size(1024)
                   .chrm("Chr12")
                   .step(2);

Genomic region to investigate

chrm, start and stop define the genomic region we are investigating. size tells the engine how many horizontal pixels we have available for our visualization. step controls the resolution of the "metric" we are investigating.

Axis and rules

Once the context is defined we can use its methods to create the different components of our visualization. To create the axis in the visualization we use axis and we use rule to create the vertical rule that will allow us to see the specific metric values for a particular genomic coordinate.

Sources

Sources implement the logic on how to retrieve the actual data that goes in the visualization. Currently we have two: bedfile and bedserver. bedfile should be used when you want to pull a bed file directly into the browsers memory. This source is ideal for small bed files. bedserver is a source that communicates with a backend bedserver in order to retrieve the data points. This is ideal for bigger datasets. The backend server presumably will have more computational resources. In addition, bedserver uses bedfiles that are indexed so random access are much quicker. This source has one argument, the address of the server. Here are some examples of source creation:

var source_bedserver = context.bedserver("http://localhost:5000"),
    source_bedfile = context.bedfile();

Metrics

Each source created exposes a metric method which we can use to create as many metrics as necessary. The arguments change depending the source. bedfile requires the name of the file (bed file) we want to associate to the metric. For metrics in bedserver, we have to provide the project name and the sample name. Take a look to the bedserver repo to understand the rational behind that. Here are some examples:

var source_bedserver = context.bedserver("http://localhost:5000"),
    source_bedfile = context.bedfile(), 
    metrics = [];

metrics.push(source_bedserver.metric("1000_genomes", "NA18282_read_depth"));
metrics.push(source_bedfile.metric("human45756.bed"));

Horizons

The final component is horizon which creates all the necessary elements of the horizon visualization.

Clone this wiki locally