You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-32Lines changed: 34 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,27 @@
2
2
3
3
LocusZoom is a Javascript/d3 embeddable plugin for interactively visualizing statistical genetic data from customizable sources.
4
4
5
+
6
+
For more information, see our paper:
7
+
8
+
*Boughton, A. P. et al. LocusZoom.js: interactive and embeddable visualization of genetic association study results. Bioinformatics (2021) [doi:10.1093/bioinformatics/btab186](https://doi.org/10.1093/bioinformatics/btab186).*
9
+
10
+
**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](https://my.locuszoom.org/) and [LocalZoom](https://statgen.github.io/localzoom/)**.
See [https://statgen.github.io/locuszoom/docs/](https://statgen.github.io/locuszoom/docs/) for full documentation and API reference.
8
16
9
17
To see functional examples of plots generated with LocusZoom.js see [statgen.github.io/locuszoom](http://statgen.github.io/locuszoom/) and [statgen.github.io/locuszoom/#examples](http://statgen.github.io/locuszoom/#examples).
10
18
11
-

19
+

12
20
13
-
## Making a LocusZoom Plot
21
+
## Making a LocusZoom Plot: Quickstart tutorial
14
22
15
23
### 1. Include Necessary JavaScript and CSS
16
24
17
-
The page you build that embeds the LocusZoom plugin must include the following resources, found in the `dist` directory:
25
+
The page you build that embeds the LocusZoom plugin must include the following resources, found in the `dist` directory (or preferably loaded via CDN):
18
26
19
27
*`d3.js`
20
28
[D3.js](https://d3js.org/) v5.16.0 is used to draw graphics in LocusZoom plots. It may be loaded [via a CDN](https://cdn.jsdelivr.net/npm/d3@^5.16.0). It must be present before LocusZoom is loaded.
@@ -42,7 +50,7 @@ Here's an example of defining a data sources object for a remote API:
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".
@@ -73,7 +81,6 @@ var layout = {
73
81
{
74
82
id:"association",
75
83
type:"scatter",
76
-
fields: ["assoc:position", "assoc:pvalue"],
77
84
x_axis: { field:"assoc:position" },
78
85
y_axis: { field:"assoc:pvalue" }
79
86
}
@@ -96,33 +103,32 @@ A basic example may then look like this:
@@ -132,11 +138,11 @@ A basic example may then look like this:
132
138
133
139
#### Use a Predefined Layout
134
140
135
-
The core LocusZoom library comes equipped with several predefined layouts, organized by type ("plot", "panel", "data_layer", and "toolbar"). You can see what layouts are predefined by reading the contents of `assets/js/app/Layouts.js` or in the browser by entering `LocusZoom.Layouts.list()` (or to list one specific type: `LocusZoom.Layouts.list(type)`).
141
+
The core LocusZoom library comes equipped with several predefined layouts, organized by type ("plot", "panel", "data_layer", and "toolbar"). You can see what layouts are predefined by reading the [documentation](https://statgen.github.io/locuszoom/docs/api/module-LocusZoom_Layouts.html) or introspecting in the browser by entering `LocusZoom.Layouts.list()` (or to list one specific type, like "data_layer": `LocusZoom.Layouts.list(type)`).
136
142
137
143
Get any predefined layout by type and name using `LocusZoom.Layouts.get(type, name)`.
138
144
139
-
If your data matches the field names and formats of the [UMich PortalDev API](https://portaldev.sph.umich.edu/docs/api/v1/#overview-of-api-endpoints), these layouts will provide a quick way to get started. If your data obeys different format rules, customization may be necessary.
145
+
If your data matches the field names and formats of the [UMich PortalDev API](https://portaldev.sph.umich.edu/docs/api/v1/#overview-of-api-endpoints), 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`)
140
146
141
147
See the [guide to working with layouts](https://statgen.github.io/locuszoom/docs/guides/rendering_layouts.html) for further details.
142
148
@@ -150,7 +156,7 @@ const layout = {
150
156
width:1000,
151
157
height:500,
152
158
panels: [
153
-
LocusZoom.Layouts.get("panel", "gwas"),
159
+
LocusZoom.Layouts.get("panel", "association"),
154
160
{
155
161
id:"custom_panel",
156
162
...options
@@ -166,24 +172,21 @@ const layout = {
166
172
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:
**State** is a serializable JSON object that describes orientation to specific data from data sources, and specific interactions with the layout. This can include a specific query against various data sources or pre-selecting specific elements. Essentially, the state object is what tracks these types of user input under the hood in LocusZoom, and it can be predefined at initialization as a top-level parameter in the layout. For example:
181
+
**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:
#### Alternate: setting the initial view via`data-region`
185
188
186
-
You can also describe the locus query aspect of the State (chromosome, start, and end position) using a `data-region` attribute of the containing element before populating it, like so:
189
+
You can also describe the locususing a `data-region` attribute of the containing element before populating it, like so:
@@ -192,7 +195,6 @@ You can also describe the locus query aspect of the State (chromosome, start, an
192
195
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.
193
196
194
197
## Development Setup
195
-
196
198
### Dependencies
197
199
198
200
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:
@@ -218,8 +220,8 @@ This build process will also write sourcemaps, to help with debugging code even
218
220
*`npm run test` - Run unit tests (optional: `npm run test:coverage` to output a code coverage report)
219
221
*`npm run dev` - Automatically rebuild the library whenever code changes (development mode)
220
222
*`npm run build` - Run tests, and if they pass, build the library for release
221
-
*`npm run css` - Rebuild the CSS using SASS
222
-
*`npm run docs` - Build the library documentation
223
+
*`npm run css` - Rebuild the CSS using SASS (CSS rarely changes, so this doesn't get done automatically in dev mode)
224
+
*`npm run docs` - Build just the library documentation
223
225
224
226
225
227
#### Automated Testing
@@ -231,9 +233,9 @@ LocusZoom runs code quality checks via [ESLint](http://eslint.org/), the rules f
231
233
232
234
## Help and Support
233
235
234
-
Full documentation can be found here: [docs/](https://statgen.github.io/locuszoom/docs/)
236
+
Full API documentation and prose guides are available at: [https://statgen.github.io/locuszoom/docs/](https://statgen.github.io/locuszoom/docs/)
235
237
236
-
A LocusZoom discussion forum is available here: [groups.google.com/forum/#!forum/locuszoom](https://groups.google.com/forum/#!forum/locuszoom).
238
+
A LocusZoom discussion forum is available here: [https://groups.google.com/forum/#!forum/locuszoom](https://groups.google.com/forum/#!forum/locuszoom).
237
239
For the most effective help, please specify that your question is about "LocusZoom.js".
238
240
239
241
If you have questions or feedback please file an issue on the [LocusZoom.js GitHub repository](https://github.com/statgen/locuszoom/issues) or post at the discussion forum referenced above.
0 commit comments