Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support local file Data Sources #38

Closed
Frencil opened this issue Mar 7, 2016 · 3 comments
Closed

Support local file Data Sources #38

Frencil opened this issue Mar 7, 2016 · 3 comments

Comments

@Frencil
Copy link
Contributor

Frencil commented Mar 7, 2016

The Problem

Presently LocusZoom does not support creating a data source that maps to a local file. This is a likely use case for the plugin on a longer time scale.

It's unclear exactly how to approach this problem without having some example files to work with. The HTML5 File API will likely play a part.

Opportunities

In scope for this feature we may want to consider generating a few small "example" data files that live in the repository. These would be very useful for building automated tests against local file data sources logic (see #36, related).

From there we could also strike the current data sources from the demo and define a proper DefaultDataSources object (in keeping with the pattern of DefaultLayout and DefaultState). In this way the "hello world" for the LocusZoom plugin could literally be a one-liner (that is, one line of JavaScript logic to call populate and the HTML to include the scripts and create an empty div).

@Frencil
Copy link
Contributor Author

Frencil commented Mar 7, 2016

Update: upon further discussion while we would still benefit from a DefaultDataSources object it would be more practical to have this be populated with reliable statgen API endpoints.

@Frencil
Copy link
Contributor Author

Frencil commented Jun 9, 2017

2017 Update

This is an older issue but it still holds that LocusZoom.js lacks an obvious approach to working with local files. However, it's not impossible:

apiBase = window.location.origin + window.location.pathname.substr(0, window.location.pathname.length - "demo.html".length) + "staticdata/";
data_sources = new LocusZoom.DataSources()
    .add("assoc", ["AssociationLZ", {url: apiBase + "assoc_10_114550452-115067678.json?", params: {analysis: 3, id_field: "variant"}}])
    .add("ld", ["LDLZ", { url: apiBase + "ld_10_114550452-115067678.json?" }])
    .add("gene", ["GeneLZ", { url: apiBase + "genes_10_114550452-115067678.json?" }])
    .add("recomb", ["RecombLZ", { url: apiBase + "recomb_10_114550452-115067678.json?" }])
    .add("constraint", ["GeneConstraintLZ", {  url: apiBase + "constraint_10_114550452-115067678.json?" }]);

As of v0.5.6 this approach is demonstrated in index.html using local files.

While this is demonstrated in the repo currently it's not clear that it's there. This issue is resolved when this is documented in the README in the repo as well as on the wiki.

@Frencil
Copy link
Contributor Author

Frencil commented Jun 9, 2017

Update: README and Wiki updated, repo example tuned up. Good enough for now!

@Frencil Frencil closed this as completed Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant