statgen / locuszoom

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

Default LZ data adapters should subset rather than fetch when zooming in #223

Closed abought closed 3 years ago

abought commented 3 years ago

Currently, the "zoom" mechanism triggers a full data fetch, because the cache key is based only on exact chr/start/end match.

It is difficult to write a generic subsetter because each API has different assumptions (like fetching data in a different order not sorted by position, or not using specific field names).

The LZ-specific data sources can feasibly add a new feature for more granular subsetting of data, insofar as the payload format and ordering behavior should be known or easily guessed.

Eg, a cache hit would be satisfied by either an exact match, or a smaller region than what was already fetched; the payload data could then be subsetted using annotateData before further parsing.

We will need to think about backwards-compatible behavior, some sites use the association adapter with minor tweaks to talk to different APIs. We don't want those sites to break as we add nicer feature for our own APIs.

Adapters that would benefit: anything where each position was a single point:

Sources that would require further thought: anything where each datapoint represents an interval (half in, half out of the region)