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

Is possible to load local burden test by locuszoom.js ? #290

Closed 1511878618 closed 1 year ago

1511878618 commented 1 year ago

lz-aggregation-tests.min.js is possible to plot burden test by raremetal.js, however it is too slow for big data.

Regenie is good for calculating UKB data for burden test, so is this possible for load local result and plot it, instead of using raremetal.js

@abought

abought commented 1 year ago

Short version: it is possible, and there is a much simpler place to start than with the code you reference!

Approach

Ultimately, LocusZoom makes scatter plots: "here is the x axis variable, and here is the y axis variable. Draw me this picture".

Rather than use the code of one specific interactive demo, I'd suggest stepping back and asking which elements of the plot you like. If you just want a different scatter plot with a different y axis value, you could give the plot your dataset (including your new y axis field), and tell the plot to use that variable name. (one tiny change to existing code) https://statgen.github.io/locuszoom/docs/guides/rendering_layouts.html#renamefields-resolving-tiny-differences-in-naming

For example, if you were using the tabix file as a source for your plots, you'd change the y-axis field, and modify the plot in the tabix file demo to use a custom parser function that handled your file format + returned the extra field. (we don't know how to parse custom files we've never seen; you'll need to help the code along there!)

Demo: https://statgen.github.io/locuszoom/examples/ext/tabix_tracks.html Example of what is returned by the parser used in the demo (field names and format): https://github.com/statgen/locuszoom/blob/develop/esm/ext/lz-parsers/gwas/parsers.js#L161-L172

Notes on old demo

As I recall, the original way that LZ presented aggregation tests was a more advanced interactive demo, highly specialized to the needs of one specific group. I wouldn't recommend starting there: it had some zany design constraints that made it hard to follow, and as you note, doing calculations client side imposes big performance limits! It was written for a world of many people sharing data from different places, and that never materialized.

Lastly: Apologies if the example page seems broken: as I write this, UM is seeing a major internet service outage. The servers that normally load part of that page may be unavailable for the next 24 hrs.

abought commented 1 year ago

Also, I apologize if the help is a bit generic. I moved on from the LZ team about a year ago, and I'm not sure if there's a more official plan for support. I can answer the occasional general question, but not write specific code for individual users. :)

1511878618 commented 1 year ago

Also, I apologize if the help is a bit generic. I moved on from the LZ team about a year ago, and I'm not sure if there's a more official plan for support. I can answer the occasional general question, but not write specific code for individual users. :)

Thank you very much for your response. It's great to know that I can organize my data and use your JavaScript interface to transmit it effectively. By the way, LZ.js is an excellent package that I find worthy of thoroughly exploring its source code to meet my requirements. As I've recently started learning about JS and Flask, I have a small curiosity. Do Adapters and plots retrieve the current page's region by analyzing the current URL and utilizing built-in parsers to automatically extract the current region for updates? Of course, I've also realized that I can manually provide the 'state' parameter, which is the approach I'm currently using to resolve this matter.

abought commented 1 year ago

Do Adapters and plots retrieve the current page's region by analyzing the current URL and utilizing built-in parsers to automatically extract the current region for updates?

Strictly speaking, the only thing that we use to determine plot region is layout.state (dynamically changed using plot.applyState).

That said, the plot can be made to respond to the URL. Not every website using locuszoom wanted this feature, because they had their own way of specifying URLs... This is an optional extension. See code examples for how to turn on this feature: https://statgen.github.io/locuszoom/docs/api/module-ext_lz-dynamic-urls.html

This is useful if you are exploring a large dataset and want to easily switch between two genes/ regions, and then share a specific view with collaborators. You don't need to hard-code one region of interest server side: people can jump to totally new regions and still be able to share their views.

See it in action in the demo: if you drag the plot to a new region, the URL changes. Click back button, and it goes to the prior view. https://statgen.github.io/locuszoom/

(*Note: At this exact moment in time, all UM servers are unreachable and the demo will seem broken. Normally it's a little more impressive)

1511878618 commented 1 year ago

Thats's great

Do Adapters and plots retrieve the current page's region by analyzing the current URL and utilizing built-in parsers to automatically extract the current region for updates?

Strictly speaking, the only thing that we use to determine plot region is layout.state (dynamically changed using plot.applyState).

That said, the plot can be made to respond to the URL. Not every website using locuszoom wanted this feature, because they had their own way of specifying URLs... This is an optional extension. See code examples for how to turn on this feature: https://statgen.github.io/locuszoom/docs/api/module-ext_lz-dynamic-urls.html

This is useful if you are exploring a large dataset and want to easily switch between two genes/ regions, and then share a specific view with collaborators. You don't need to hard-code one region of interest server side: people can jump to totally new regions and still be able to share their views.

See it in action in the demo: if you drag the plot to a new region, the URL changes. Click back button, and it goes to the prior view. https://statgen.github.io/locuszoom/

(*Note: At this exact moment in time, all UM servers are unreachable and the demo will seem broken. Normally it's a little more impressive)

That's great, thank u so much for the answer. I will close this issue as completed