locuszoom

A Javascript/d3 embeddable plugin for interactively visualizing statistical genetic data from customizable sources.

https://github.com/statgen/locuszoom

Science Score: 75.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    5 of 15 committers (33.3%) from academic institutions
  • Institutional organization owner
    Organization statgen has institutional domain (sph.umich.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.9%) to scientific vocabulary

Keywords

gwas gwas-summary-statistics gwas-tools locuszoom locuszoom-plot
Last synced: 6 months ago · JSON representation ·

Repository

A Javascript/d3 embeddable plugin for interactively visualizing statistical genetic data from customizable sources.

Basic Info
Statistics
  • Stars: 162
  • Watchers: 12
  • Forks: 30
  • Open Issues: 17
  • Releases: 61
Topics
gwas gwas-summary-statistics gwas-tools locuszoom locuszoom-plot
Created over 10 years ago · Last pushed 10 months ago
Metadata Files
Readme License Citation

README.md

LocusZoom

LocusZoom is a Javascript/d3 embeddable plugin for interactively visualizing statistical genetic data from customizable sources.

For more information, see our paper:

Boughton, A. P. et al. LocusZoom.js: interactive and embeddable visualization of genetic association study results. Bioinformatics (2021) doi:10.1093/bioinformatics/btab186.

This is a low level library aimed at developers who want to customize their own data sharing/visualization tools. If you are a genetics researcher who just wants to make a fast visualization of your research results, try our user-friendly plot-your-own data services built on LocusZoom.js: my.locuszoom.org and LocalZoom.

Build Status

See https://statgen.github.io/locuszoom/docs/ for full documentation and API reference.

To see functional examples of plots generated with LocusZoom.js see statgen.github.io/locuszoom and statgen.github.io/locuszoom/#examples.

LocusZoom.js Standard Association Plot

Making a LocusZoom Plot: Quickstart tutorial

1. Include Necessary JavaScript and CSS

The page you build that embeds the LocusZoom plugin must include the following resources, found in the dist directory (or preferably loaded via CDN):

  • d3.js
    D3.js v5.16.0 is used to draw graphics in LocusZoom plots. It may be loaded via a CDN. It must be present before LocusZoom is loaded.

  • locuszoom.app.min.js
    This is the primary application logic. It should only be included after the vendor dependencies have been included.

  • locuszoom.css
    This is the primary stylesheet. It is namespaced so as not to conflict with any other styles defined on the same page.

Instead of copying the files to your project, we recommend using CDN links are for these resources (see statgen.github.io/locuszoom/).

The above instructions describe using LocusZoom with pure JS and HTML. If you are using a module build system, LocusZoom supports usage via ES6 imports, eg:

javascript import LocusZoom from 'locuszoom'; import 'locuszoom/dist/locuszoom.css';

2. Define Data Sources

Data Sources is an object representing a collection of arbitrarily many sources from which data for the plot can be requested. When adding sources to the collection they must be namespaced so that retrieving specific fields can be done with respect to specific data sources.

Here's an example of defining a data sources object for a remote API:

javascript var data_sources = new LocusZoom.DataSources(); data_sources.add("assoc", ["AssociationLZ", { url: "http://server.com/api/", source: 1 }]);

The above example adds an "AssociationLZ" data source (a predefined data source designed to make requests for association data) with a defined URL. The namespace for this data source is "assoc".

Data sources can also be local files:

javascript data_sources = new LocusZoom.DataSources(); data_sources.add("assoc", ["AssociationLZ", { url: "file:///path/to/data.json" }]);

Refer to the Working with data guide for more information on using predefined data sources or extending/creating custom data sources.

3. Define a Layout

Layout is a serializable object that describes the configuration of the LocusZoom plot, including what data will be pulled from the data sources and displayed in what way, along with visual characteristics like color and geometry.

A layout definition may look something like this (simplified example; consult docs for details):

javascript var layout = { width: 500, height: 500, panels: [ { id: "association", data_layers: [ { id: "association", type: "scatter", x_axis: { field: "assoc:position" }, y_axis: { field: "assoc:pvalue" } } ] } ] };

The above example defines a basic plot that is 500 pixels on a side and has one panel with one scatter plot data layer that pulls in position and pvalue from the "trait" data source, mapping position to the x axis and pvalue to the y axis.

The LocusZoom.js library provides several pre-defined layouts for entire plots and subdivisions of plots such as panels, data layers, tool tips, etc. Refer to the Layouts and visualization options guide for more information.

4. Put it Together with LocusZoom.populate()

With includes included, data sources defined, and a layout defined, LocusZoom.populate() will accept a CSS selector string to populate the first matching element with a plot.

A basic example may then look like this:

html <html> <head> <script src="dist/locuszoom.app.min.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="dist/locuszoom.css"/> </head> <body> <div id="lz-plot"></div> <script type="text/javascript"> const data_sources = new LocusZoom.DataSources(); data_sources.add("assoc", ["AssociationLZ", { url: "https://server.com/api/single/", source: 1 }]); const layout = { width: 800, panels: [ { id : "association", height: 300, data_layers: [ { id: "association", type: "scatter", x_axis: { field: "assoc:position" }, y_axis: { field: "assoc:log_pvalue" } } ] } ] }; const plot = LocusZoom.populate("#lz-plot", data_sources, layout); </script> </body> </html>

Other Ways To Make a LocusZoom Plot

Use a Predefined Layout

The core LocusZoom library comes equipped with several predefined layouts, organized by type ("plot", "panel", "datalayer", and "toolbar"). You can see what layouts are predefined by reading the documentation or introspecting in the browser by entering LocusZoom.Layouts.list() (or to list one specific type, like "datalayer": LocusZoom.Layouts.list(type)).

Get any predefined layout by type and name using LocusZoom.Layouts.get(type, name).

If your data matches the field names and formats of the LocusZoom API, these layouts will provide a quick way to get started. If your data obeys different format rules, customization may be necessary. (for example, some LocusZoom features assume the presence of a field called log_pvalue)

See the guide to working with layouts for further details.

Build a Layout Using Some Predefined Pieces

LocusZoom.Layouts.get(type, name) can also be used to pull predefined layouts of smaller pieces, like data layers or toolbars, into a custom layout:

javascript const layout = { width: 1000, height: 500, panels: [ LocusZoom.Layouts.get("panel", "association"), { id: "custom_panel", ...options }, LocusZoom.Layouts.get("panel", "genes") ], ... };

Modify a Predefined Layout

The get() function also accepts a partial layout to be merged with the predefined layout as a third argument, providing the ability to use predefined layouts as starting points for custom layouts with only minor differences. Example:

javascript const overrides = { label_font_size: 20 }; LocusZoom.Layouts.get("data_layer", "genes", overrides);

Predefining State by Building a State Object

State is JSON-serializable object containing information that can affect the entire plot (including all data retrieval requests). State can be set before or after the plot is initialized. For example, the following special-named fields will cause the plot to be loaded to a specific region of interest on first render:

javascript const layout = LocusZoom.Layouts.get('plot', 'standard_association', { state: { chr: 6, start: 20379709, end: 20979709 } })

Alternate: setting the initial view via data-region

You can also describe the locususing a data-region attribute of the containing element before populating it, like so:

html <div id="lz-plot" data-region="10:114550452-115067678"></div>

When LocusZoom.populate() is executed on the element defined above it will automatically parse any data-region parameter to convert those values into the initial state.

Development Setup

Dependencies

LocusZoom is an entirely client-side library designed to plug into arbitrary data sets, be they local files, APIs, or something else entirely. It has the following external dependencies:

  • d3 for data visualization

Build System and Automated Testing

LocusZoom is bundled using Webpack. To install all necessary dependencies for a development environment, run:

bash $ npm install

We recommend using node.js v12 or greater to build the library and run tests.

Once complete run npm run build from the top of the application directory to run all tests and build the LocusZoom library bundle.

This build process will also write sourcemaps, to help with debugging code even in production environments.

Other supported build commands:

  • npm run test - Run unit tests (optional: npm run test:coverage to output a code coverage report)
  • npm run dev - Automatically rebuild the library whenever code changes (development mode)
  • npm run build - Run tests, and if they pass, build the library for release
  • npm run css - Rebuild the CSS using SASS (CSS rarely changes, so this doesn't get done automatically in dev mode)
  • npm run docs - Build just the library documentation
  • npm run format - Format the JavaScript code using ESLint

Automated Testing

LocusZoom uses Mocha for unit testing. Tests are located in the test subdirectory. Use npm run test.

Static analysis and code style

LocusZoom runs code quality checks via ESLint, the rules for which can be found in .eslintrc. This will run automatically as part of all new code commits, and during every build.

Help and Support

Full API documentation and prose guides are available at: https://statgen.github.io/locuszoom/docs/

A LocusZoom discussion forum is available here: https://groups.google.com/forum/#!forum/locuszoom. For the most effective help, please specify that your question is about "LocusZoom.js".

If you have questions or feedback please file an issue on the LocusZoom.js GitHub repository or post at the discussion forum referenced above.

Owner

  • Name: Center for Statistical Genetics
  • Login: statgen
  • Kind: organization
  • Location: Ann Arbor, MI

The Center for Statistical Genetics at the University of Michigan School of Public Health

Citation (citation.cff)

# YAML 1.2
---
abstract: "LocusZoom.js is a JavaScript library for creating interactive web-based visualizations of genetic association study results. It can display one or more traits in the context of relevant biological data (such as gene models and other genomic annotation), and allows interactive refinement of analysis models (by selecting linkage disequilibrium reference panels, identifying sets of likely causal variants, or comparisons to the GWAS catalog). It can be embedded in web pages to enable data sharing and exploration. Views can be customized and extended to display other data types such as phenome-wide association study (PheWAS) results, chromatin co-accessibility, or eQTL measurements. A new web upload service harmonizes datasets, adds annotations, and makes it easy to explore user-provided result sets."
authors:
  -
    family-names: Boughton
    given-names: Andrew
    orcid: "https://orcid.org/0000-0002-0318-4912"
  -
    family-names: Welch
    given-names: Ryan
  -
    family-names: Flickinger
    given-names: Matthew
  -
    family-names: VandeHaar
    given-names: Peter
  -
    family-names: Taliun
    given-names: Daniel
  -
    family-names: Abecasis
    given-names: "Gonçalo"
  -
    family-names: Boehnke
    given-names: Michael
cff-version: "1.1.0"
date-published: "2021-03-18"
doi: "10.1093/bioinformatics/btab186"
journal: "Bioinformatics"
message: "If you use this software, please cite the paper."
title: " LocusZoom.js: interactive and embeddable visualization of genetic association study results"
# Insert dummy version b/c the paper reports ongoing efforts
version: 1.0

GitHub Events

Total
  • Issues event: 6
  • Watch event: 7
  • Issue comment event: 5
  • Fork event: 1
Last Year
  • Issues event: 6
  • Watch event: 7
  • Issue comment event: 5
  • Fork event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 1,240
  • Total Committers: 15
  • Avg Commits per committer: 82.667
  • Development Distribution Score (DDS): 0.498
Top Committers
Name Email Commits
Andy Boughton a****t@g****m 622
Chris Clark c****k@u****u 317
Frencil f****s@g****m 170
Matthew Flickinger m****k@u****u 78
Peter VandeHaar p****r@g****m 12
Ryan Welch w****r@u****u 12
Peter VandeHaar p****r@u****m 6
Christopher Clark F****l@u****m 5
Julien Debon j****n@t****o 5
dependabot[bot] 4****]@u****m 5
Andy Boughton a****t@u****u 3
Andy Boughton p****t@g****m 2
Laurence Rowe l****e@l****k 1
Matthew Flickinger m****k@p****u 1
Julien Debon j****n@p****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 64
  • Total pull requests: 44
  • Average time to close issues: 5 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 20
  • Total pull request authors: 3
  • Average comments per issue: 1.92
  • Average comments per pull request: 0.61
  • Merged pull requests: 32
  • Bot issues: 0
  • Bot pull requests: 13
Past Year
  • Issues: 5
  • Pull requests: 0
  • Average time to close issues: 3 days
  • Average time to close pull requests: N/A
  • Issue authors: 5
  • Pull request authors: 0
  • Average comments per issue: 1.4
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • abought (35)
  • sir4ur0n (5)
  • vb-tony (4)
  • kennethbruskiewicz (3)
  • VasLem (2)
  • Z-Zen (1)
  • cgrace1978 (1)
  • CFB2018 (1)
  • welchr (1)
  • yu-zhang-oYo (1)
  • 1511878618 (1)
  • jielab (1)
  • elmedjadjirayane (1)
  • mariacos (1)
  • samuelmf1 (1)
Pull Request Authors
  • abought (26)
  • dependabot[bot] (13)
  • sir4ur0n (5)
Top Labels
Issue Labels
feature (medium) (15) priority low (13) bug (6) priority medium (5) refactor (3) feature (small) (3) feature (large) (3) priority high (3) question (2) documentation (1)
Pull Request Labels
dependencies (14) feature (medium) (6) feature (large) (5) active development (5) documentation (4) priority high (4) development on hold (3) refactor (3) priority medium (1) priority low (1)

Packages

  • Total packages: 1
  • Total downloads:
    • npm 833 last-month
  • Total dependent packages: 2
  • Total dependent repositories: 6
  • Total versions: 47
  • Total maintainers: 3
npmjs.org: locuszoom

Generate interactive visualizations of statistical genetic data

  • Versions: 47
  • Dependent Packages: 2
  • Dependent Repositories: 6
  • Downloads: 833 Last month
Rankings
Downloads: 2.9%
Stargazers count: 4.5%
Dependent repos count: 4.6%
Forks count: 4.7%
Average: 5.1%
Dependent packages count: 8.9%
Maintainers (3)
Last synced: 6 months ago

Dependencies

.github/workflows/node.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/setup-node v2 composite
package-lock.json npm
  • 671 dependencies
package.json npm
  • @babel/core ^7.20.5 development
  • @babel/preset-env ^7.20.2 development
  • @babel/register ^7.18.9 development
  • babel-loader ^9.1.0 development
  • babel-plugin-module-resolver ^4.1.0 development
  • chai ^4.3.7 development
  • clean-webpack-plugin ^4.0.0 development
  • eslint ^8.28.0 development
  • eslint-webpack-plugin ^3.2.0 development
  • jsdoc ^4.0.0 development
  • jsdom ^20.0.3 development
  • jsdom-global ^3.0.2 development
  • mocha ^10.1.0 development
  • nyc ^15.1.0 development
  • sass ^1.56.1 development
  • sass-loader ^13.2.0 development
  • sinon ^14.0.0 development
  • source-map-loader ^4.0.1 development
  • webpack ^5.75.0 development
  • webpack-cli ^5.0.0 development
  • webpack-merge ^5.8.0 development
  • @hapi/topo ^5.1.0
  • d3 ^5.16.0
  • gwas-credible-sets ^0.1.0
  • just-clone ^3.2.1
  • tabix-reader ^1.0.1