statgen / locuszoom

A Javascript/d3 embeddable plugin for interactively visualizing statistical genetic data from customizable sources.
https://statgen.github.io/locuszoom/
MIT License
154 stars 29 forks source link

Panel Interaction #76

Closed Frencil closed 8 years ago

Frencil commented 8 years ago

Overview

This branch introduces several mouse interaction features. These include:

All interactions are configurable in panel layouts. Here's an overview of the new supported directives:

All of the above default to false in the default panel layout. The standard layout, used by many LocusZoom implementations, enables all interactive booleans and links the x axes on the two panels (association data and genes) that appear in that layout.

Panel linking and interaction broadcasting

The problem to solve is that in some cases two or more panels may be "linked" on a given axis; for example, if the x axis in an association panel changes due to interaction of any kind then the x axis in a genes panel should also update in real time, not just when new data is loaded. The layout directives x_linked, y1_linked, and y2_linked are a simple approach to this problem.

Essentially, if an interaction is being performed on a panel (e.g. actively dragging the background to pan) a check is performed continuously. The check first determines which axis is being changed by the interaction, and then looks to see if the panel in question has that axis linked (by way of the layout directive). If so, it then queries all other panels to see if they are also linked on that same axis, and if so, broadcasts the objects storing the interaction data over to that panel. In this way the linked panel has its own copy of the interaction information, as if the user were dragging all linked panels in the same way at the same time.

Where this simple approach may fall short is if a single LocusZoom plot would have the need to link panels in multiple groups for the same axis (e.g. have four panels, link panels 1 and 2 on their x axes, link panels 3 and 4 on their x axes). It seems at this point that this level of abstraction may not be necessary, as spinning off a second group of panels into a distinct LocusZoom plot may be an effective workaround.

Issues covered

This branch addresses Issues #16 and #17. With the addition of y-axis scaling and panning it also addresses the as-yet-undocumented issue of needing to adjust y axes to focus on a particular range.

This branch does not yet address the proposed option of introducing "breaks" in a y-scale (for example, on a -log10 pvalue scale, showing 0-10 with a break and then 6-70). My hope is that the ability to effectively "zoom in" on any continuous range on either y-axis will mitigate the immediate need for this feature, though it seems we'll still need that eventually too.

Frencil commented 8 years ago

Reverted to active development... feature complete but missing tests. Will commit tests shortly.

Frencil commented 8 years ago

Tests added, branch now truly development complete. Ready for testing/review/feedback.