Dalliance (Biodalliance)
repository·master·Indexed 42 days ago
https://github.com/dasmoth/dallianceA high-performance, embeddable genome visualization tool that runs in web browsers. Version 0.13.90-alpha.8 provides interactive genomic data views and an extensible rendering system via JavaScript modules, supporting custom renderers and multi-tier configurations.
What's inside Dalliance
- Biodalliance (Dalliance) is a fast, embeddable genome visualization tool designed for high interactivity directly within web browsers. It is compatible with current versions of Chrome, Firefox, and Safari, as well as mobile web browsers. It also supports Internet Explorer 11, though minor visual glitches may occur.
Extend the Biodalliance rendering system
masterThe Biodalliance rendering system is extensible via Javascript modules. To create a custom renderer, you must export at least two specific functions that the system calls during the rendering lifecycle:
renderTier(status, tier): Handles the initialization or state management for a tier.drawTier(tier): Handles the actual drawing logic for the tier.
For a reference implementation, you can examine
default-renderer.es6, which maintains the functionality of the original Biodalliance renderer.// A custom renderer module must export these functions export function renderTier(status, tier) { // implementation } export function drawTier(tier) { // implementation }Understand the renderer test mechanism
masterThe renderer test is used to verify that different rendering modules produce identical visual outputs. It works by comparing the effects of two different drawing functions on the same data structure:
drawFeatureTier(fromfeature-draw.js) anddrawTier(fromdefault-renderer.es6).Instead of comparing pixels directly, the test compares the resulting subtiers. Since subtiers contain the glyphs (the objects drawn to the BD canvas), ensuring the subtiers are identical guarantees that the glyphs and the eventual screen output are the same.
Build Dalliance from source
masterDalliance uses a Gulp-based build system. To build the project from the source repository, you must have Node.js installed. Follow these steps to install dependencies and build the project:
- Install Gulp globally:
npm install -g gulp - Install project dependencies:
npm install - Run the build:
gulp
After building, you can test the output by opening any of the HTML files located in the
example-browsersdirectory.(sudo?) npm install -g gulp npm install gulp- Install Gulp globally:
Run the renderer test
masterTo run the renderer test, open the HTML test file in a web browser. The test executes within a BD browser environment containing several tracks.
Note: The test output is logged to the web browser console.
// The test file is located at: /test/render-test.htmlConfigure a subtier within a multi-tier
masterSubtiers are tiers that are rendered inside a parent multi-tier. To configure a subtier, set the
rendererproperty to'sub'and provide asubconfiguration object.The
subobject requires:multi_id: The ID of the parent multi-tier it belongs to.
It also supports:
offset: The vertical pixel offset from the top of the multi-tier canvas.z: The z-index for the subtier.
{ name: 'Genes', desc: 'Gene structures from GENCODE M2', bwgURI: 'http://www.biodalliance.org/datasets/GRCm38/gencodeM2.bb', stylesheet_uri: 'http://localhost:8000/gencode.xml', collapseSuperGroups: true, trixURI: 'http://www.biodalliance.org/datasets/GRCm38/gencodeM2.ix', renderer: 'sub', sub: { multi_id: "multi_1", offset: 100, z: 2 } }Configure a multi-tier renderer
masterMulti-tier rendering allows multiple tiers to be drawn on the same canvas, overlapping one another. To use this, set the
rendererproperty to'multi'and include amulticonfiguration object.At minimum, the
multiobject must contain amulti_id. Other optional properties include:grid: Boolean to enable an evenly spaced horizontal grid.grid_offset: Starting position for the grid.grid_spacing: Spacing between grid lines.quant: An object defining a vertical ruler (e.g.,{ min: 0, max: 100 }).
{ name: 'Multi-tier', tier_type: 'qtl', uri: '', renderer: 'multi', multi: { multi_id: "multi_1", grid: true, grid_offset: 0, grid_spacing: 10, quant: { min: 0, max: 100 } } }