Skip to main content

Dash JBrowse

Dash is a popular open-source framework for building data-driven web apps. It is built on top of ReactJS, and provides a toolkit for converting React components into dash components that can be used in Dash apps written in Python, R, Julia, F# or Matlab.

Dash JBrowse's LinearGenomeView is a Dash component that wraps the JBrowse React Linear Genome View and makes it possible to embed an interactive genome browser into any Dash application. Now supporting the CircularGenomeView as well.

Dash JBrowse LGV configured with human data

Dash JBrowse CGV configured with human data

Quickstart

$ pip install dash_jbrowse

Basic linear genome view with an assembly

import dash
import dash_jbrowse
from dash import html

print(dash_jbrowse.__version__)
app = dash.Dash(__name__)

my_assembly = {
    "name": "GRCh38",
    "sequence": {
        "type": "ReferenceSequenceTrack",
        "trackId": "GRCh38-ReferenceSequenceTrack",
        "adapter": {
            "type": "BgzipFastaAdapter",
            "fastaLocation": {
                "uri": "https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz",
            },
            "faiLocation": {
                "uri": "https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz.fai",
            },
            "gziLocation": {
                "uri": "https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz.gzi",
            },
        },
    },
    "aliases": ["hg38"],
    "refNameAliases": {
        "adapter": {
            "type": "RefNameAliasAdapter",
            "location": {
                "uri": "https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/hg38_aliases.txt",
            },
        },
    },
}

app.layout = html.Div(
    [
        dash_jbrowse.LinearGenomeView(
            id="lgv-hg38",
            assembly=my_assembly
        ),
    ],
    id='test'
)

if __name__ == "__main__":
    app.run_server(debug=True)

An example of the CGV can be found in usage_cgv.py.

Installation

PyPI

$ pip install dash_jbrowse

Install with virtual venv

After cloning this repository, install virtualenv

$ pip install virtualenv
$ cd dash_jbrowse
$ python3 -m venv ./venv
$ source venv/bin/activate
$ pip install -r requirements.txt

Then you can run the example app found in usage.py

python usage.py

User Guide

The views can be customized in many ways, but the only properties that are required to launch it are the id required for dash call backs and the assembly.

  • id (string, required): the id used for dash callbacks. A basic example of this component using dash callbacks can be found under the examples directory)

  • assembly (object, required): the configuration object of the assembly being used for the browser. More information about the configuration of the assembly can be found here.

top level assembly config

{
  "name": "assemblyName",
  "aliases": [],
  "sequence": {},
  "refNameAliases": {}
}
  • tracks (list, optional) - list of track configuration objects.

top level track config

{
  "trackId": "test-id",
  "name": "track name",
  "assemblyNames": [],
  "category": []
}
  • defaultSession (object, optional) - information about the current app state such as what views are open

default session config

{
  "name": "this session",
  "view": {
    "id": "linearGenomeView",
    "type": "LinearGenomeView"
  }
}

Note: "type": "CircularGenomeView" for CGV

  • location (string or object, optional) - initial location for when the browser first loads, e.g '1:500-1000' or location object

location object

{
  "refName": 1,
  "start": 500,
  "end": 1000
}

Note:

  • Use 0-based coordinates in the location object.

  • The location field is only used for LGV and not CGV.

Checkout the storybook JBrowse React Linear Genome View docs or the JBrowse React Circular Genome View docs for more configuration examples.

Advanced Customization

Text Searching

Adding text searching to the JBrowse React Linear Genome View (not currently available for the CGV) requires a couple of extra steps. We first need to create an index via the JBrowse CLI tools. Once an index is created, we can add a text search adapter to the list of aggregate text search adapters in this component or to the configuration object of a track.

  • aggregateTextSearchAdapters (object, optional) - configuration of an index used for text searching

Aggregate text search adapter to use in the component.

{
  "type": "TrixTextSearchAdapter",
  "textSearchAdapterId": "adapter-id",
  "ixFilePath": {
    "uri": "url/path/to/my/ix/file",
    "locationType": "UriLocation"
  },
  "ixxFilePath": {
    "uri": "url/path/to/my/ixx/file",
    "locationType": "UriLocation"
  },
  "metaFilePath": {
    "uri": "url/path/to/my/meta.json/file",
    "locationType": "UriLocation"
  }
}

On a track configuration.

{
  "trackId": "yourtrack",
  "name": "Track name",
  "adapter": {
    "type": "Gff3TabixAdapter",
    "gffGzLocation": {
      "uri": "yourfile.gff.gz",
      "locationType": "UriLocation"
    },
    "index": {
      "location": {
        "uri": "yourfile.gff.gz.tbi",
        "locationType": "UriLocation"
      }
    }
  },
  "textSearching": {
    "textSearchAdapter": {
      "type": "TrixTextSearchAdapter",
      "textSearchAdapterId": "hg19-index",
      "ixFilePath": {
        "uri": "https://jbrowse.org/genomes/hg19/trix/hg19.ix",
        "locationType": "UriLocation"
      },
      "ixxFilePath": {
        "uri": "https://jbrowse.org/genomes/hg19/trix/hg19.ixx",
        "locationType": "UriLocation"
      },
      "metaFilePath": {
        "uri": "https://jbrowse.org/genomes/hg19/trix/meta.json",
        "locationType": "UriLocation"
      },
      "assemblyNames": ["hg19"]
    },
    "indexingAttributes": ["Name", "ID"],
    "indexingFeatureTypesToExclude": ["CDS", "exon"]
  }
}

Custom themes are also available.

  • configuration - (object, optional) - color scheme configuration
{
  "theme": {
    "palette": {
      "primary": {
        "main": "#311b92"
      },
      "secondary": {
        "main": "#0097a7"
      },
      "tertiary": {
        "main": "#f57c00"
      },
      "quaternary": {
        "main": "#d50000"
      },
      "bases": {
        "A": { "main": "#98FB98" },
        "C": { "main": "#87CEEB" },
        "G": { "main": "#DAA520" },
        "T": { "main": "#DC143C" }
      }
    }
  }
}

"Dash LGV component with a custom theme."

Academic Use

This package was written with funding from the NHGRI as part of the JBrowse project. If you use it in an academic project that you publish, please cite the most recent JBrowse paper, which will be linked from jbrowse.org.

Resources

Contact us

We really love talking to our users. Please reach out with any thoughts you have on what we are building!

Metadata

Release files for dash-jbrowse 1.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dash-jbrowse 1.4.2
File Size Uploaded
dash_jbrowse-1.4.2.tar.gz 872.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dash-jbrowse 1.4.2
File Interpreter ABI Platform
dash_jbrowse-1.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 1.7 MB

Release files / dash_jbrowse-1.4.2.tar.gz

Download URL dash_jbrowse-1.4.2.tar.gz
Size 872.9 kB
Tags Source
SHA-256 checksum
How to use checksums
07bd636ed7f46094d036e0777bf9f4583476c135f5de1a5506c3e5431e24fece
BLAKE2b-256 checksum
How to use checksums
6eaa74da987697ed3e19e5cc3e091e17e32bba369f24531cc4f20561fecd0760
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / dash_jbrowse-1.4.2-py3-none-any.whl

Download URL dash_jbrowse-1.4.2-py3-none-any.whl
Size 874.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84dbdc33b8c9f379c8f028742792d83d22e5b12f0f17f06bfba5f154116db551
BLAKE2b-256 checksum
How to use checksums
6bbd76d62e3a4526d21dd3bfde66a099725f2d516fe6ea425ea787582c5bb4ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release history Release notifications | RSS feed

This release

1.4.2 This release

2 release files

1.3.4

2 release files

1.3.1

1 release file

1.2.0

3 release files

1.1.3

3 release files

1.1.2

3 release files

1.1.1

3 release files

1.1.0

3 release files

1.0.4

3 release files

1.0.3

3 release files

1.0.2

3 release files

1.0.1

3 release files

1.0.0

3 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page