From 9730004353bce7b85927afecd678c427590955d7 Mon Sep 17 00:00:00 2001 From: Andy Boughton Date: Thu, 21 Dec 2017 13:24:44 -0500 Subject: [PATCH 1/6] Fix broken link on index page (dependency files have moved and will be tracked per-version, ahead of future additions) --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 3d154151..d8655b2c 100644 --- a/index.html +++ b/index.html @@ -95,7 +95,7 @@
CSS
Dependencies
- https://statgen.github.io/locuszoom/locuszoom.vendor.min.js + https://statgen.github.io/locuszoom/versions/0.7.0/locuszoom.vendor.min.js
Contains d3 v3.5.6 and Q (any version)
From 152610410645f92203e5adf3d66dc00596740c8d Mon Sep 17 00:00:00 2001 From: Andy Boughton Date: Thu, 21 Dec 2017 13:35:38 -0500 Subject: [PATCH 2/6] Package `main` should reference new dist folder --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 17bdcc61..4e6f9348 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "Peter VandeHaar", "Andy Boughton " ], - "main": "locuszoom.app.js", + "main": "dist/locuszoom.app.js", "engines": { "node": ">=6.12.0" }, From 4204d18e137dba25c1f9c3e37a75354cfec2c4fd Mon Sep 17 00:00:00 2001 From: Andy Boughton Date: Thu, 18 Jan 2018 13:25:14 -0500 Subject: [PATCH 3/6] Fix demo page to reflect newest database update h/t @welchr --- examples/interval_annotations.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/interval_annotations.html b/examples/interval_annotations.html index 6620da1a..8dda513a 100644 --- a/examples/interval_annotations.html +++ b/examples/interval_annotations.html @@ -68,7 +68,7 @@

Top Hits

.add("gene", ["GeneLZ", { url: apiBase + "annotation/genes/", params: {source: 2} }]) .add("recomb", ["RecombLZ", { url: apiBase + "annotation/recomb/results/", params: {source: 15} }]) .add("constraint", ["GeneConstraintLZ", { url: "http://exac.broadinstitute.org/api/constraint" }]) - .add("intervals", ["IntervalLZ", { url: apiBase + "annotation/intervals/results/", params: {source: 16} }]); + .add("intervals", ["IntervalLZ", { url: apiBase + "annotation/intervals/results/", params: {source: 19} }]); // Get the standard assocation plot layout from LocusZoom's built-in layouts var mods = { @@ -107,8 +107,8 @@

Top Hits

var start = 0; var end = 0; if (!pos.match(/[-+]/)) { - start = +pos - 300000 - end = +pos + 300000 + start = +pos - 300000; + end = +pos + 300000; } plot.applyState({ chr: chr, start: start, end: end, ldrefvar: "" }); return false; From 495cbc24f617ad934a9de530f89e81fad03c0765 Mon Sep 17 00:00:00 2001 From: Andy Boughton Date: Thu, 18 Jan 2018 13:26:22 -0500 Subject: [PATCH 4/6] Update dependency versions --- package-lock.json | 269 +++++++++++++++++++++++++++++++--------------- package.json | 10 +- 2 files changed, 187 insertions(+), 92 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0dce7330..9814f5fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "resolved": "https://registry.npmjs.org/@gulp-sourcemaps/identity-map/-/identity-map-1.0.1.tgz", "integrity": "sha1-z6I7xYQPkQTOMqZedNt+epdLvuE=", "requires": { - "acorn": "5.2.1", + "acorn": "5.3.0", "css": "2.2.1", "normalize-path": "2.1.1", "source-map": "0.5.6", @@ -38,9 +38,9 @@ "dev": true }, "acorn": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", - "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==" + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.3.0.tgz", + "integrity": "sha512-Yej+zOJ1Dm/IMZzzj78OntP/r3zHEaKcyNoU2lAaxPtrseM6rF0xwqoz5Q5ysAiED9hTjI2hgtvLXitlCN1/Ug==" }, "acorn-globals": { "version": "3.1.0", @@ -77,9 +77,9 @@ } }, "ajv": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.1.tgz", - "integrity": "sha1-s4u4h22ehr7plJVqBOch6IskjrI=", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "dev": true, "requires": { "co": "4.6.0", @@ -110,12 +110,39 @@ "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" }, + "ansi-cyan": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz", + "integrity": "sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, "ansi-escapes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", "dev": true }, + "ansi-gray": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz", + "integrity": "sha1-KWLPVOyXksSFEKPetSRDaGHvclE=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-red": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", + "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -128,6 +155,12 @@ "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", "dev": true }, + "ansi-wrap": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", + "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", + "dev": true + }, "anymatch": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", @@ -184,6 +217,12 @@ "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "dev": true }, + "arr-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-2.1.0.tgz", + "integrity": "sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=", + "dev": true + }, "array-differ": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", @@ -306,9 +345,9 @@ } }, "babylon": { - "version": "7.0.0-beta.21", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.21.tgz", - "integrity": "sha512-fjhepTXb+WS5Iyu+DATZA5maLpuqaGckPnCgmnIWG80Xkm4SxA1mdTsBHMvaMSbdSKj/4Pocd4pUkI4qgL2wwQ==", + "version": "7.0.0-beta.19", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.19.tgz", + "integrity": "sha512-Vg0C9s/REX6/WIXN37UKpv5ZhRi6A4pjHlpkE34+8/a6c2W1Q692n3hmc+SZG5lKRnaExLUbxtJ1SVT+KaCQ/A==", "dev": true }, "balanced-match": { @@ -580,7 +619,8 @@ "clone": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz", - "integrity": "sha1-Jgt6meux7f4kdTgXX3gyQ8sZ0Uk=" + "integrity": "sha1-Jgt6meux7f4kdTgXX3gyQ8sZ0Uk=", + "dev": true }, "clone-buffer": { "version": "1.0.0", @@ -591,7 +631,8 @@ "clone-stats": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", - "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=" + "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", + "dev": true }, "cloneable-readable": { "version": "1.0.0", @@ -631,6 +672,12 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "dev": true + }, "combined-stream": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", @@ -776,7 +823,7 @@ "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", "requires": { - "es5-ext": "0.10.37" + "es5-ext": "0.10.38" } }, "d3": { @@ -823,9 +870,9 @@ } }, "debug-fabulous": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/debug-fabulous/-/debug-fabulous-0.2.1.tgz", - "integrity": "sha512-u0TV6HcfLsZ03xLBhdhSViQMldaiQ2o+8/nSILaXkuNSWvxkx66vYJUAam0Eu7gAilJRX/69J4kKdqajQPaPyw==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/debug-fabulous/-/debug-fabulous-1.0.0.tgz", + "integrity": "sha512-dsd50qQ1atDeurcxL7XOjPp4nZCGZzWIONDujDXzl1atSyC3hMbZD+v6440etw+Vt0Pr8ce4TQzHfX3KZM05Mw==", "requires": { "debug": "3.1.0", "memoizee": "0.4.11", @@ -917,9 +964,9 @@ "dev": true }, "doctrine": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.2.tgz", - "integrity": "sha512-y0tm5Pq6ywp3qSTZ1vPgVdAnbDEoeoc5wlOHXoY1c4Wug/a7JvqHIl7BTvwodaHmejWkK/9dSb3sCYfyo/om8A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { "esutils": "2.0.2" @@ -1000,9 +1047,9 @@ } }, "es5-ext": { - "version": "0.10.37", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.37.tgz", - "integrity": "sha1-DudB0Ui4AGm6J9AgOTdWryV978M=", + "version": "0.10.38", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.38.tgz", + "integrity": "sha512-jCMyePo7AXbUESwbl8Qi01VSH2piY9s/a3rSU/5w/MlTIx8HPL1xn2InGN8ejt/xulcJgnTO7vqNtOAxzYd2Kg==", "requires": { "es6-iterator": "2.0.3", "es6-symbol": "3.1.1" @@ -1014,7 +1061,7 @@ "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", "requires": { "d": "1.0.0", - "es5-ext": "0.10.37", + "es5-ext": "0.10.38", "es6-symbol": "3.1.1" } }, @@ -1030,7 +1077,7 @@ "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", "requires": { "d": "1.0.0", - "es5-ext": "0.10.37" + "es5-ext": "0.10.38" } }, "es6-weak-map": { @@ -1039,7 +1086,7 @@ "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", "requires": { "d": "1.0.0", - "es5-ext": "0.10.37", + "es5-ext": "0.10.38", "es6-iterator": "2.0.3", "es6-symbol": "3.1.1" } @@ -1088,31 +1135,31 @@ } }, "eslint": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.12.1.tgz", - "integrity": "sha512-28hOYej+NZ/R5H1yMvyKa1+bPlu+fnsIAQffK6hxXgvmXnImos2bA5XfCn5dYv2k2mrKj+/U/Z4L5ICWxC7TQw==", + "version": "4.15.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.15.0.tgz", + "integrity": "sha512-zEO/Z1ZUxIQ+MhDVKkVTUYpIPDTEJLXGMrkID+5v1NeQHtCz6FZikWuFRgxE1Q/RV2V4zVl1u3xmpPADHhMZ6A==", "dev": true, "requires": { - "ajv": "5.5.1", + "ajv": "5.5.2", "babel-code-frame": "6.26.0", "chalk": "2.3.0", "concat-stream": "1.6.0", "cross-spawn": "5.1.0", "debug": "3.1.0", - "doctrine": "2.0.2", + "doctrine": "2.1.0", "eslint-scope": "3.7.1", + "eslint-visitor-keys": "1.0.0", "espree": "3.5.2", "esquery": "1.0.0", - "estraverse": "4.2.0", "esutils": "2.0.2", "file-entry-cache": "2.0.0", "functional-red-black-tree": "1.0.1", "glob": "7.1.2", - "globals": "11.0.1", + "globals": "11.1.0", "ignore": "3.3.7", "imurmurhash": "0.1.4", "inquirer": "3.3.0", - "is-resolvable": "1.0.0", + "is-resolvable": "1.0.1", "js-yaml": "3.9.1", "json-stable-stringify-without-jsonify": "1.0.1", "levn": "0.3.0", @@ -1197,13 +1244,19 @@ "estraverse": "4.2.0" } }, + "eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", + "dev": true + }, "espree": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.2.tgz", "integrity": "sha512-sadKeYwaR/aJ3stC2CdvgXu1T16TdYN+qwCpcWbMnGJ8s0zNWemzrvb2GbD4OhmJ/fwpJjudThAlLobGbWZbCQ==", "dev": true, "requires": { - "acorn": "5.2.1", + "acorn": "5.3.0", "acorn-jsx": "3.0.1" } }, @@ -1250,7 +1303,7 @@ "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", "requires": { "d": "1.0.0", - "es5-ext": "0.10.37" + "es5-ext": "0.10.38" } }, "execa": { @@ -1301,6 +1354,23 @@ "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", "dev": true }, + "extend-shallow": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-1.1.4.tgz", + "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", + "dev": true, + "requires": { + "kind-of": "1.1.0" + }, + "dependencies": { + "kind-of": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", + "dev": true + } + } + }, "external-editor": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.1.0.tgz", @@ -2666,9 +2736,9 @@ } }, "globals": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.0.1.tgz", - "integrity": "sha1-Eqh7sBDlFUOWrMU14eQ/x1Ow5eg=", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.1.0.tgz", + "integrity": "sha512-uEuWt9mqTlPDwSqi+sHjD4nWU/1N+q0fiWI9T1mZpD2UENqX20CFD5T/ziLZvztPaBKl7ZylUi1q6Qfm7E2CiQ==", "dev": true }, "globby": { @@ -2850,13 +2920,27 @@ } }, "gulp-eslint": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/gulp-eslint/-/gulp-eslint-4.0.0.tgz", - "integrity": "sha512-+qsePo04v1O3JshpNvww9+bOgZEJ6Cc2/w3mEktfKz0NL0zsh1SWzjyIL2FIM2zzy6IYQYv+j8REZORF8dKX4g==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/gulp-eslint/-/gulp-eslint-4.0.1.tgz", + "integrity": "sha512-MPafTtjHqV03g+ElSqvVXPjWQJafmBtSitF3dbTSD5ObcPjz353TGcR0LfCM0tqpBAQCywDL2siYKetnrxkjvg==", "dev": true, "requires": { - "eslint": "4.12.1", - "gulp-util": "3.0.8" + "eslint": "4.15.0", + "fancy-log": "1.3.2", + "plugin-error": "0.1.2" + }, + "dependencies": { + "fancy-log": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.2.tgz", + "integrity": "sha1-9BEl49hPLn2JpD0G2VjI94vha+E=", + "dev": true, + "requires": { + "ansi-gray": "0.1.1", + "color-support": "1.1.3", + "time-stamp": "1.1.0" + } + } } }, "gulp-mocha": { @@ -2937,39 +3021,21 @@ } }, "gulp-sourcemaps": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-2.6.1.tgz", - "integrity": "sha512-1qHCI3hdmsMdq/SUotxwUh/L8YzlI6J9zQ5ifNOtx4Y6KV5y5sGuORv1KZzWhuKtz/mXNh5xLESUtwC4EndCjA==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-2.6.3.tgz", + "integrity": "sha1-EbAz91n5CeCl8Vt730esKcxU76Q=", "requires": { "@gulp-sourcemaps/identity-map": "1.0.1", "@gulp-sourcemaps/map-sources": "1.0.0", - "acorn": "4.0.13", + "acorn": "5.3.0", "convert-source-map": "1.5.1", "css": "2.2.1", - "debug-fabulous": "0.2.1", + "debug-fabulous": "1.0.0", "detect-newline": "2.1.0", "graceful-fs": "4.1.11", "source-map": "0.5.6", "strip-bom-string": "1.0.0", - "through2": "2.0.3", - "vinyl": "1.2.0" - }, - "dependencies": { - "acorn": { - "version": "4.0.13", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=" - }, - "vinyl": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz", - "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", - "requires": { - "clone": "1.0.2", - "clone-stats": "0.0.1", - "replace-ext": "0.0.1" - } - } + "through2": "2.0.3" } }, "gulp-uglify": { @@ -3536,13 +3602,10 @@ } }, "is-resolvable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", - "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", - "dev": true, - "requires": { - "tryit": "1.0.3" - } + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.1.tgz", + "integrity": "sha512-y5CXYbzvB3jTnWAZH1Nl7ykUWb6T3BcTs56HUruwBf8MhF56n1HWqhDWnVFo8GHrUPDgvUUNVhrc2U8W7iqz5g==", + "dev": true }, "is-stream": { "version": "1.1.0", @@ -3642,18 +3705,18 @@ "optional": true }, "jsdoc": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.5.4.tgz", - "integrity": "sha512-VmTw0J+2L16IxAe0JSDSAcH0F+DbZxaj8wN1AjHtKMQU/hO0ciIl5ZE93XqrrFIbknobuqHKJCXZj6+Hk57MjA==", + "version": "3.5.5", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.5.5.tgz", + "integrity": "sha512-6PxB65TAU4WO0Wzyr/4/YhlGovXl0EVYfpKbpSroSj0qBxT4/xod/l40Opkm38dRHRdQgdeY836M0uVnJQG7kg==", "dev": true, "requires": { - "babylon": "7.0.0-beta.21", + "babylon": "7.0.0-beta.19", "bluebird": "3.5.0", "catharsis": "0.8.9", "escape-string-regexp": "1.0.5", "js2xmlparser": "3.0.0", "klaw": "2.0.0", - "marked": "0.3.6", + "marked": "0.3.12", "mkdirp": "0.5.1", "requizzle": "0.2.1", "strip-json-comments": "2.0.1", @@ -4082,7 +4145,7 @@ "resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz", "integrity": "sha1-Jzi9nw089PhEkMVzbEhpmsYyzaM=", "requires": { - "es5-ext": "0.10.37" + "es5-ext": "0.10.38" } }, "make-error": { @@ -4113,9 +4176,9 @@ "dev": true }, "marked": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.6.tgz", - "integrity": "sha1-ssbGGPzOzk74bE/Gy4p8v1rtqNc=", + "version": "0.3.12", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.12.tgz", + "integrity": "sha512-k4NaW+vS7ytQn6MgJn3fYpQt20/mOgYM5Ft9BYMfQJDz2QT6yEeS9XJ8k2Nw8JTeWK/znPPW2n3UJGzyYEiMoA==", "dev": true }, "mem": { @@ -4133,7 +4196,7 @@ "integrity": "sha1-vemBdmPJ5A/bKk6hw2cpYIeujI8=", "requires": { "d": "1.0.0", - "es5-ext": "0.10.37", + "es5-ext": "0.10.38", "es6-weak-map": "2.0.2", "event-emitter": "0.3.5", "is-promise": "2.1.0", @@ -4793,6 +4856,37 @@ "pinkie": "2.0.4" } }, + "plugin-error": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-0.1.2.tgz", + "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", + "dev": true, + "requires": { + "ansi-cyan": "0.1.1", + "ansi-red": "0.1.1", + "arr-diff": "1.1.0", + "arr-union": "2.1.0", + "extend-shallow": "1.1.4" + }, + "dependencies": { + "arr-diff": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-1.1.0.tgz", + "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", + "dev": true, + "requires": { + "arr-flatten": "1.1.0", + "array-slice": "0.2.3" + } + }, + "array-slice": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz", + "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", + "dev": true + } + } + }, "pluralize": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", @@ -4997,7 +5091,8 @@ "replace-ext": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", - "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=" + "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "dev": true }, "request": { "version": "2.81.0", @@ -5599,7 +5694,7 @@ "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", "dev": true, "requires": { - "ajv": "5.5.1", + "ajv": "5.5.2", "ajv-keywords": "2.1.1", "chalk": "2.3.0", "lodash": "4.17.4", @@ -5696,7 +5791,7 @@ "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.2.tgz", "integrity": "sha1-YcxHp2wavTGV8UUn+XjViulMUgQ=", "requires": { - "es5-ext": "0.10.37", + "es5-ext": "0.10.38", "next-tick": "1.0.0" } }, diff --git a/package.json b/package.json index 4e6f9348..b94e0763 100644 --- a/package.json +++ b/package.json @@ -30,27 +30,27 @@ "gulp": "gulp", "build": "gulp css js", "test": "gulp test", - "lint": "gulp lint.", + "lint": "gulp lint", "watch": "gulp watch" }, "dependencies": { "d3": "3.5.6", - "gulp-sourcemaps": "^2.6.1", + "gulp-sourcemaps": "^2.6.3", "q": "1.4.1" }, "devDependencies": { - "eslint": "^4.12.1", + "eslint": "^4.15.0", "glob": "^7.1.2", "gulp": "~3.9.1", "gulp-concat": "~2.6.0", - "gulp-eslint": "^4.0.0", + "gulp-eslint": "^4.0.1", "gulp-mocha": "~4.0.0", "gulp-sass": "~3.1.0", "gulp-uglify": "~2.0.1", "gulp-util": "~3.0.8", "gulp-watch": "~4.3.11", "gulp-wrap": "~0.13.0", - "jsdoc": "^3.5.4", + "jsdoc": "^3.5.5", "jsdom": "9.12.0", "mocha": "~4.0.1", "mocha-jsdom": "~1.1.0", From 83f37728de6ea6b102a9a9f8e3875f3a1ec3037d Mon Sep 17 00:00:00 2001 From: Andy Boughton Date: Wed, 31 Jan 2018 12:43:04 -0500 Subject: [PATCH 5/6] Option to suppress "confirm to remove panel" modals Sample usage: add "suppress_confirm: true" to the `remove_panel` dashboard button layout options Feature request per @benralexander , #121 Also expands documentation for layout configuration parameters --- assets/js/app/Dashboard.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/assets/js/app/Dashboard.js b/assets/js/app/Dashboard.js index e01e0521..3bb46a26 100644 --- a/assets/js/app/Dashboard.js +++ b/assets/js/app/Dashboard.js @@ -185,6 +185,10 @@ LocusZoom.Dashboard.prototype.destroy = function(force){ * @class * @param {Object} layout A JSON-serializable object of layout configuration parameters * @param {('left'|'right')} [layout.position='left'] Whether to float the component left or right. + * @param {('start'|'middle'|'end')} [layout.group_position] Buttons can optionally be gathered into a visually + * distinctive group whose elements are closer together. If a button is identified as the start or end of a group, + * it will be drawn with rounded corners and an extra margin of spacing from any button not part of the group. + * For example, the region_nav_plot dashboard is a defined as a group. * @param {('gray'|'red'|'orange'|'yellow'|'green'|'blue'|'purple'} [layout.color='gray'] Color scheme for the * component. Applies to buttons and menus. * @param {LocusZoom.Dashboard} parent The dashboard that contains this component @@ -915,22 +919,23 @@ LocusZoom.Dashboard.Components.add("download", function(layout){ * NOTE: Will only work on panel dashboards. * @class LocusZoom.Dashboard.Components.remove_panel * @augments LocusZoom.Dashboard.Component + * @param {Boolean} [layout.suppress_confirm=false] If true, removes the panel without prompting user for confirmation */ -LocusZoom.Dashboard.Components.add("remove_panel", function(layout){ +LocusZoom.Dashboard.Components.add("remove_panel", function(layout) { LocusZoom.Dashboard.Component.apply(this, arguments); - this.update = function(){ + this.update = function() { if (this.button){ return this; } this.button = new LocusZoom.Dashboard.Component.Button(this) .setColor(layout.color).setHtml("×").setTitle("Remove panel") .setOnclick(function(){ - if (confirm("Are you sure you want to remove this panel? This cannot be undone!")){ - var panel = this.parent_panel; - panel.dashboard.hide(true); - d3.select(panel.parent.svg.node().parentNode).on("mouseover." + panel.getBaseId() + ".dashboard", null); - d3.select(panel.parent.svg.node().parentNode).on("mouseout." + panel.getBaseId() + ".dashboard", null); - return panel.parent.removePanel(panel.id); + if (!layout.suppress_confirm && !confirm("Are you sure you want to remove this panel? This cannot be undone!")){ + return false; } - return false; + var panel = this.parent_panel; + panel.dashboard.hide(true); + d3.select(panel.parent.svg.node().parentNode).on("mouseover." + panel.getBaseId() + ".dashboard", null); + d3.select(panel.parent.svg.node().parentNode).on("mouseout." + panel.getBaseId() + ".dashboard", null); + return panel.parent.removePanel(panel.id); }.bind(this)); this.button.show(); return this; From fd97e78f20b12a13d9c587f97c18e014bfb31350 Mon Sep 17 00:00:00 2001 From: Andy Boughton Date: Thu, 15 Feb 2018 13:53:41 -0500 Subject: [PATCH 6/6] Bump version for 0.7.1 --- assets/js/app/LocusZoom.js | 2 +- dist/locuszoom.app.js | 25 +++++++++++++++---------- dist/locuszoom.app.min.js | 6 +++--- index.html | 10 +++++----- package-lock.json | 2 +- package.json | 2 +- 6 files changed, 26 insertions(+), 21 deletions(-) diff --git a/assets/js/app/LocusZoom.js b/assets/js/app/LocusZoom.js index 9baa5dac..d5f687d8 100644 --- a/assets/js/app/LocusZoom.js +++ b/assets/js/app/LocusZoom.js @@ -2,7 +2,7 @@ * @namespace */ var LocusZoom = { - version: "0.7.0" + version: "0.7.1" }; /** diff --git a/dist/locuszoom.app.js b/dist/locuszoom.app.js index 4275fee0..2452f431 100644 --- a/dist/locuszoom.app.js +++ b/dist/locuszoom.app.js @@ -45,7 +45,7 @@ * @namespace */ var LocusZoom = { - version: "0.7.0" + version: "0.7.1" }; /** @@ -6113,6 +6113,10 @@ LocusZoom.Dashboard.prototype.destroy = function(force){ * @class * @param {Object} layout A JSON-serializable object of layout configuration parameters * @param {('left'|'right')} [layout.position='left'] Whether to float the component left or right. + * @param {('start'|'middle'|'end')} [layout.group_position] Buttons can optionally be gathered into a visually + * distinctive group whose elements are closer together. If a button is identified as the start or end of a group, + * it will be drawn with rounded corners and an extra margin of spacing from any button not part of the group. + * For example, the region_nav_plot dashboard is a defined as a group. * @param {('gray'|'red'|'orange'|'yellow'|'green'|'blue'|'purple'} [layout.color='gray'] Color scheme for the * component. Applies to buttons and menus. * @param {LocusZoom.Dashboard} parent The dashboard that contains this component @@ -6843,22 +6847,23 @@ LocusZoom.Dashboard.Components.add("download", function(layout){ * NOTE: Will only work on panel dashboards. * @class LocusZoom.Dashboard.Components.remove_panel * @augments LocusZoom.Dashboard.Component + * @param {Boolean} [layout.suppress_confirm=false] If true, removes the panel without prompting user for confirmation */ -LocusZoom.Dashboard.Components.add("remove_panel", function(layout){ +LocusZoom.Dashboard.Components.add("remove_panel", function(layout) { LocusZoom.Dashboard.Component.apply(this, arguments); - this.update = function(){ + this.update = function() { if (this.button){ return this; } this.button = new LocusZoom.Dashboard.Component.Button(this) .setColor(layout.color).setHtml("×").setTitle("Remove panel") .setOnclick(function(){ - if (confirm("Are you sure you want to remove this panel? This cannot be undone!")){ - var panel = this.parent_panel; - panel.dashboard.hide(true); - d3.select(panel.parent.svg.node().parentNode).on("mouseover." + panel.getBaseId() + ".dashboard", null); - d3.select(panel.parent.svg.node().parentNode).on("mouseout." + panel.getBaseId() + ".dashboard", null); - return panel.parent.removePanel(panel.id); + if (!layout.suppress_confirm && !confirm("Are you sure you want to remove this panel? This cannot be undone!")){ + return false; } - return false; + var panel = this.parent_panel; + panel.dashboard.hide(true); + d3.select(panel.parent.svg.node().parentNode).on("mouseover." + panel.getBaseId() + ".dashboard", null); + d3.select(panel.parent.svg.node().parentNode).on("mouseout." + panel.getBaseId() + ".dashboard", null); + return panel.parent.removePanel(panel.id); }.bind(this)); this.button.show(); return this; diff --git a/dist/locuszoom.app.min.js b/dist/locuszoom.app.min.js index 564182f3..5051f43c 100644 --- a/dist/locuszoom.app.min.js +++ b/dist/locuszoom.app.min.js @@ -1,6 +1,6 @@ -!function(t,e){"function"==typeof define&&define.amd?define(["postal"],function(a,i){return t.LocusZoom=e(a,i)}):"object"==typeof module&&module.exports?module.exports=t.LocusZoom=e(require("d3"),require("Q")):t.LocusZoom=e(t.d3,t.Q)}(this,function(t,e){var a=function(t,e){if(e==t)return!0;var a=t.split("."),i=e.split("."),n=!1;return a.forEach(function(t,e){!n&&+i[e]>+a[e]&&(n=!0)}),n};try{var i="3.5.6";if("object"!=typeof t)throw"d3 dependency not met. Library missing.";if(!a(i,t.version))throw"d3 dependency not met. Outdated version detected.\nRequired d3 version: "+i+" or higher (found: "+t.version+").";if("function"!=typeof e)throw"Q dependency not met. Library missing.";var n={version:"0.7.0"};n.populate=function(e,a,i){if("undefined"==typeof e)throw"LocusZoom.populate selector not defined";t.select(e).html("");var s;return t.select(e).call(function(){if("undefined"==typeof this.node().id){for(var e=0;!t.select("#lz-"+e).empty();)e++;this.attr("id","#lz-"+e)}if(s=new n.Plot(this.node().id,a,i),s.container=this.node(),"undefined"!=typeof this.node().dataset&&"undefined"!=typeof this.node().dataset.region){var o=n.parsePositionQuery(this.node().dataset.region);Object.keys(o).forEach(function(t){s.state[t]=o[t]})}s.svg=t.select("div#"+s.id).append("svg").attr("version","1.1").attr("xmlns","http://www.w3.org/2000/svg").attr("id",s.id+"_svg").attr("class","lz-locuszoom").style(s.layout.style),s.setDimensions(),s.positionPanels(),s.initialize(),"object"==typeof a&&Object.keys(a).length&&s.refresh()}),s},n.populateAll=function(e,a,i){var s=[];return t.selectAll(e).each(function(t,e){s[e]=n.populate(this,a,i)}),s},n.positionIntToString=function(t,e,a){var i={0:"",3:"K",6:"M",9:"G"};if(a=a||!1,isNaN(e)||null===e){var n=Math.log(t)/Math.LN10;e=Math.min(Math.max(n-n%3,0),9)}var s=e-Math.floor((Math.log(t)/Math.LN10).toFixed(e+3)),o=Math.min(Math.max(e,0),2),r=Math.min(Math.max(s,o),12),l=""+(t/Math.pow(10,e)).toFixed(r);return a&&"undefined"!=typeof i[e]&&(l+=" "+i[e]+"b"),l},n.positionStringToInt=function(t){var e=t.toUpperCase();e=e.replace(/,/g,"");var a=/([KMG])[B]*$/,i=a.exec(e),n=1;return i&&(n="M"===i[1]?1e6:"G"===i[1]?1e9:1e3,e=e.replace(a,"")),e=Number(e)*n},n.parsePositionQuery=function(t){var e=/^(\w+):([\d,.]+[kmgbKMGB]*)([-+])([\d,.]+[kmgbKMGB]*)$/,a=/^(\w+):([\d,.]+[kmgbKMGB]*)$/,i=e.exec(t);if(i){if("+"===i[3]){var s=n.positionStringToInt(i[2]),o=n.positionStringToInt(i[4]);return{chr:i[1],start:s-o,end:s+o}}return{chr:i[1],start:n.positionStringToInt(i[2]),end:n.positionStringToInt(i[4])}}return i=a.exec(t),i?{chr:i[1],position:n.positionStringToInt(i[2])}:null},n.prettyTicks=function(t,e,a){("undefined"==typeof a||isNaN(parseInt(a)))&&(a=5),a=parseInt(a);var i=a/3,n=.75,s=1.5,o=.5+1.5*s,r=Math.abs(t[0]-t[1]),l=r/a;Math.log(r)/Math.LN10<-2&&(l=Math.max(Math.abs(r))*n/i);var h=Math.pow(10,Math.floor(Math.log(l)/Math.LN10)),d=0;h<1&&0!==h&&(d=Math.abs(Math.round(Math.log(h)/Math.LN10)));var u=h;2*h-l0&&(c=parseFloat(c.toFixed(d)));return p.push(c),"undefined"!=typeof e&&["low","high","both","neither"].indexOf(e)!==-1||(e="neither"),"low"!==e&&"both"!==e||p[0]t[1]&&p.pop(),p},n.createCORSPromise=function(t,a,i,n,s){var o=e.defer(),r=new XMLHttpRequest;if("withCredentials"in r?r.open(t,a,!0):"undefined"!=typeof XDomainRequest?(r=new XDomainRequest,r.open(t,a)):r=null,r){if(r.onreadystatechange=function(){4===r.readyState&&(200===r.status||0===r.status?o.resolve(r.response):o.reject("HTTP "+r.status+" for "+a))},s&&setTimeout(o.reject,s),i="undefined"!=typeof i?i:"","undefined"!=typeof n)for(var l in n)r.setRequestHeader(l,n[l]);r.send(i)}return o.promise},n.validateState=function(t,e){t=t||{},e=e||{};var a=!1;if("undefined"!=typeof t.chr&&"undefined"!=typeof t.start&&"undefined"!=typeof t.end){var i,n=null;if(t.start=Math.max(parseInt(t.start),1),t.end=Math.max(parseInt(t.end),1),isNaN(t.start)&&isNaN(t.end))t.start=1,t.end=1,n=.5,i=0;else if(isNaN(t.start)||isNaN(t.end))n=t.start||t.end,i=0,t.start=isNaN(t.start)?t.end:t.start,t.end=isNaN(t.end)?t.start:t.end;else{if(n=Math.round((t.start+t.end)/2),i=t.end-t.start,i<0){var s=t.start;t.end=t.start,t.start=s,i=t.end-t.start}n<0&&(t.start=1,t.end=1,i=0)}a=!0}return!isNaN(e.min_region_scale)&&a&&ie.max_region_scale&&(t.start=Math.max(n-Math.floor(e.max_region_scale/2),1),t.end=t.start+e.max_region_scale),t},n.parseFields=function(t,e){if("object"!=typeof t)throw"LocusZoom.parseFields invalid arguments: data is not an object";if("string"!=typeof e)throw"LocusZoom.parseFields invalid arguments: html is not a string";for(var a=[],i=/\{\{(?:(#if )?([A-Za-z0-9_:|]+)|(\/if))\}\}/;e.length>0;){var s=i.exec(e);s?0!==s.index?(a.push({text:e.slice(0,s.index)}),e=e.slice(s.index)):"#if "===s[1]?(a.push({condition:s[2]}),e=e.slice(s[0].length)):s[2]?(a.push({variable:s[2]}),e=e.slice(s[0].length)):"/if"===s[3]?(a.push({close:"if"}),e=e.slice(s[0].length)):(console.error("Error tokenizing tooltip when remaining template is "+JSON.stringify(e)+" and previous tokens are "+JSON.stringify(a)+" and current regex match is "+JSON.stringify([s[1],s[2],s[3]])),e=e.slice(s[0].length)):(a.push({text:e}),e="")}for(var o=function(){var t=a.shift();if("undefined"!=typeof t.text||t.variable)return t;if(t.condition){for(t.then=[];a.length>0;){if("if"===a[0].close){a.shift();break}t.then.push(o())}return t}return console.error("Error making tooltip AST due to unknown token "+JSON.stringify(t)),{text:""}},r=[];a.length>0;)r.push(o());var l=function(e){return l.cache.hasOwnProperty(e)||(l.cache[e]=new n.Data.Field(e).resolve(t)),l.cache[e]};l.cache={};var h=function(t){if("undefined"!=typeof t.text)return t.text;if(t.variable){try{var e=l(t.variable);if(["string","number","boolean"].indexOf(typeof e)!==-1)return e;if(null===e)return""}catch(e){console.error("Error while processing variable "+JSON.stringify(t.variable))}return"{{"+t.variable+"}}"}if(t.condition){try{var a=l(t.condition);if(a||0===a)return t.then.map(h).join("")}catch(e){console.error("Error while processing condition "+JSON.stringify(t.variable))}return""}console.error("Error rendering tooltip due to unknown AST node "+JSON.stringify(t))};return r.map(h).join("")},n.getToolTipData=function(e){if("object"!=typeof e||"undefined"==typeof e.parentNode)throw"Invalid node object";var a=t.select(e);return a.classed("lz-data_layer-tooltip")&&"undefined"!=typeof a.data()[0]?a.data()[0]:n.getToolTipData(e.parentNode)},n.getToolTipDataLayer=function(t){var e=n.getToolTipData(t);return e.getDataLayer?e.getDataLayer():null},n.getToolTipPanel=function(t){var e=n.getToolTipDataLayer(t);return e?e.parent:null},n.getToolTipPlot=function(t){var e=n.getToolTipPanel(t);return e?e.parent:null},n.generateCurtain=function(){var e={showing:!1,selector:null,content_selector:null,hide_delay:null,show:function(e,a){return this.curtain.showing||(this.curtain.selector=t.select(this.parent_plot.svg.node().parentNode).insert("div").attr("class","lz-curtain").attr("id",this.id+".curtain"),this.curtain.content_selector=this.curtain.selector.append("div").attr("class","lz-curtain-content"),this.curtain.selector.append("div").attr("class","lz-curtain-dismiss").html("Dismiss").on("click",function(){this.curtain.hide()}.bind(this)),this.curtain.showing=!0),this.curtain.update(e,a)}.bind(this),update:function(t,e){if(!this.curtain.showing)return this.curtain;clearTimeout(this.curtain.hide_delay),"object"==typeof e&&this.curtain.selector.style(e);var a=this.getPageOrigin();return this.curtain.selector.style({top:a.y+"px",left:a.x+"px",width:this.layout.width+"px",height:this.layout.height+"px"}),this.curtain.content_selector.style({"max-width":this.layout.width-40+"px","max-height":this.layout.height-40+"px"}),"string"==typeof t&&this.curtain.content_selector.html(t),this.curtain}.bind(this),hide:function(t){return this.curtain.showing?"number"==typeof t?(clearTimeout(this.curtain.hide_delay),this.curtain.hide_delay=setTimeout(this.curtain.hide,t),this.curtain):(this.curtain.selector.remove(),this.curtain.selector=null,this.curtain.content_selector=null,this.curtain.showing=!1,this.curtain):this.curtain}.bind(this)};return e},n.generateLoader=function(){var e={showing:!1,selector:null,content_selector:null,progress_selector:null,cancel_selector:null,show:function(e){return this.loader.showing||(this.loader.selector=t.select(this.parent_plot.svg.node().parentNode).insert("div").attr("class","lz-loader").attr("id",this.id+".loader"),this.loader.content_selector=this.loader.selector.append("div").attr("class","lz-loader-content"),this.loader.progress_selector=this.loader.selector.append("div").attr("class","lz-loader-progress-container").append("div").attr("class","lz-loader-progress"),this.loader.showing=!0,"undefined"==typeof e&&(e="Loading...")),this.loader.update(e)}.bind(this),update:function(t,e){if(!this.loader.showing)return this.loader;clearTimeout(this.loader.hide_delay),"string"==typeof t&&this.loader.content_selector.html(t);var a=6,i=this.getPageOrigin(),n=this.loader.selector.node().getBoundingClientRect();return this.loader.selector.style({top:i.y+this.layout.height-n.height-a+"px",left:i.x+a+"px"}),"number"==typeof e&&this.loader.progress_selector.style({width:Math.min(Math.max(e,1),100)+"%"}),this.loader}.bind(this),animate:function(){return this.loader.progress_selector.classed("lz-loader-progress-animated",!0),this.loader}.bind(this),setPercentCompleted:function(t){return this.loader.progress_selector.classed("lz-loader-progress-animated",!1),this.loader.update(null,t)}.bind(this),hide:function(t){return this.loader.showing?"number"==typeof t?(clearTimeout(this.loader.hide_delay),this.loader.hide_delay=setTimeout(this.loader.hide,t),this.loader):(this.loader.selector.remove(),this.loader.selector=null,this.loader.content_selector=null,this.loader.progress_selector=null,this.loader.cancel_selector=null,this.loader.showing=!1,this.loader):this.loader}.bind(this)};return e},n.subclass=function(t,e,a){if("function"!=typeof t)throw"Parent must be a callable constructor";e=e||{};var i=a||function(){t.apply(this,arguments)};return i.prototype=Object.create(t.prototype),Object.keys(e).forEach(function(t){i.prototype[t]=e[t]}),i.prototype.constructor=i,i},n.Layouts=function(){var t={},e={plot:{},panel:{},data_layer:{},dashboard:{},tooltip:{}};return t.get=function(t,a,i){if("string"!=typeof t||"string"!=typeof a)throw"invalid arguments passed to LocusZoom.Layouts.get, requires string (layout type) and string (layout name)";if(e[t][a]){var s=n.Layouts.merge(i||{},e[t][a]);if(s.unnamespaced)return delete s.unnamespaced,JSON.parse(JSON.stringify(s));var o="";"string"==typeof s.namespace?o=s.namespace:"object"==typeof s.namespace&&Object.keys(s.namespace).length&&(o="undefined"!=typeof s.namespace.default?s.namespace.default:s.namespace[Object.keys(s.namespace)[0]].toString()),o+=o.length?":":"";var r=function(t,e){if(e?"string"==typeof e&&(e={default:e}):e={default:""},"string"==typeof t){for(var a,i,s,l,h=/\{\{namespace(\[[A-Za-z_0-9]+\]|)\}\}/g,d=[];null!==(a=h.exec(t));)i=a[0],s=a[1].length?a[1].replace(/(\[|\])/g,""):null,l=o,null!=e&&"object"==typeof e&&"undefined"!=typeof e[s]&&(l=e[s]+(e[s].length?":":"")),d.push({base:i,namespace:l});for(var u in d)t=t.replace(d[u].base,d[u].namespace)}else if("object"==typeof t&&null!=t){if("undefined"!=typeof t.namespace){var p="string"==typeof t.namespace?{default:t.namespace}:t.namespace;e=n.Layouts.merge(e,p)}var c,y;for(var f in t)"namespace"!==f&&(c=r(t[f],e),y=r(f,e),f!==y&&delete t[f],t[y]=c)}return t};return s=r(s,s.namespace),JSON.parse(JSON.stringify(s))}throw"layout type ["+t+"] name ["+a+"] not found"},t.set=function(t,a,i){if("string"!=typeof t||"string"!=typeof a||"object"!=typeof i)throw"unable to set new layout; bad arguments passed to set()";return e[t]||(e[t]={}),i?e[t][a]=JSON.parse(JSON.stringify(i)):(delete e[t][a],null)},t.add=function(e,a,i){return t.set(e,a,i)},t.list=function(t){if(e[t])return Object.keys(e[t]);var a={};return Object.keys(e).forEach(function(t){a[t]=Object.keys(e[t])}),a},t.merge=function(t,e){if("object"!=typeof t||"object"!=typeof e)throw"LocusZoom.Layouts.merge only accepts two layout objects; "+typeof t+", "+typeof e+" given";for(var a in e)if(e.hasOwnProperty(a)){var i=null===t[a]?"undefined":typeof t[a],s=typeof e[a];if("object"===i&&Array.isArray(t[a])&&(i="array"),"object"===s&&Array.isArray(e[a])&&(s="array"),"function"===i||"function"===s)throw"LocusZoom.Layouts.merge encountered an unsupported property type";"undefined"!==i?"object"!==i||"object"!==s||(t[a]=n.Layouts.merge(t[a],e[a])):t[a]=JSON.parse(JSON.stringify(e[a]))}return t},t}(),n.Layouts.add("tooltip","standard_association",{namespace:{assoc:"assoc"},closable:!0,show:{or:["highlighted","selected"]},hide:{and:["unhighlighted","unselected"]},html:'{{{{namespace[assoc]}}variant}}
P Value: {{{{namespace[assoc]}}log_pvalue|logtoscinotation}}
Ref. Allele: {{{{namespace[assoc]}}ref_allele}}
Make LD Reference
'});var s=n.Layouts.get("tooltip","standard_association",{unnamespaced:!0});s.html+='Condition on Variant
',n.Layouts.add("tooltip","covariates_model_association",s),n.Layouts.add("tooltip","standard_genes",{closable:!0,show:{or:["highlighted","selected"]},hide:{and:["unhighlighted","unselected"]},html:'

{{gene_name}}

Gene ID: {{gene_id}}
Transcript ID: {{transcript_id}}
ConstraintExpected variantsObserved variantsConst. Metric
Synonymous{{exp_syn}}{{n_syn}}z = {{syn_z}}
Missense{{exp_mis}}{{n_mis}}z = {{mis_z}}
LoF{{exp_lof}}{{n_lof}}pLI = {{pLI}}
More data on ExAC'}),n.Layouts.add("tooltip","standard_intervals",{namespace:{intervals:"intervals"},closable:!1,show:{or:["highlighted","selected"]},hide:{and:["unhighlighted","unselected"]},html:"{{{{namespace[intervals]}}state_name}}
{{{{namespace[intervals]}}start}}-{{{{namespace[intervals]}}end}}"}),n.Layouts.add("data_layer","significance",{id:"significance",type:"orthogonal_line",orientation:"horizontal",offset:4.522}),n.Layouts.add("data_layer","recomb_rate",{namespace:{recomb:"recomb"},id:"recombrate",type:"line",fields:["{{namespace[recomb]}}position","{{namespace[recomb]}}recomb_rate"],z_index:1,style:{stroke:"#0000FF","stroke-width":"1.5px"},x_axis:{field:"{{namespace[recomb]}}position"},y_axis:{axis:2,field:"{{namespace[recomb]}}recomb_rate",floor:0,ceiling:100}}),n.Layouts.add("data_layer","association_pvalues",{namespace:{assoc:"assoc",ld:"ld"},id:"associationpvalues",type:"scatter",point_shape:{scale_function:"if",field:"{{namespace[ld]}}isrefvar",parameters:{field_value:1,then:"diamond",else:"circle"}},point_size:{scale_function:"if",field:"{{namespace[ld]}}isrefvar",parameters:{field_value:1,then:80,else:40}},color:[{scale_function:"if",field:"{{namespace[ld]}}isrefvar",parameters:{field_value:1,then:"#9632b8"}},{scale_function:"numerical_bin",field:"{{namespace[ld]}}state",parameters:{breaks:[0,.2,.4,.6,.8],values:["#357ebd","#46b8da","#5cb85c","#eea236","#d43f3a"]}},"#B8B8B8"],legend:[{shape:"diamond",color:"#9632b8",size:40,label:"LD Ref Var",class:"lz-data_layer-scatter"},{shape:"circle",color:"#d43f3a",size:40,label:"1.0 > r² ≥ 0.8",class:"lz-data_layer-scatter"},{shape:"circle",color:"#eea236",size:40,label:"0.8 > r² ≥ 0.6",class:"lz-data_layer-scatter"},{shape:"circle",color:"#5cb85c",size:40,label:"0.6 > r² ≥ 0.4",class:"lz-data_layer-scatter"},{shape:"circle",color:"#46b8da",size:40,label:"0.4 > r² ≥ 0.2",class:"lz-data_layer-scatter"},{shape:"circle",color:"#357ebd",size:40,label:"0.2 > r² ≥ 0.0",class:"lz-data_layer-scatter"},{shape:"circle",color:"#B8B8B8",size:40,label:"no r² data",class:"lz-data_layer-scatter"}],fields:["{{namespace[assoc]}}variant","{{namespace[assoc]}}position","{{namespace[assoc]}}log_pvalue","{{namespace[assoc]}}log_pvalue|logtoscinotation","{{namespace[assoc]}}ref_allele","{{namespace[ld]}}state","{{namespace[ld]}}isrefvar"],id_field:"{{namespace[assoc]}}variant",z_index:2,x_axis:{field:"{{namespace[assoc]}}position"},y_axis:{axis:1,field:"{{namespace[assoc]}}log_pvalue",floor:0,upper_buffer:.1,min_extent:[0,10]},behaviors:{onmouseover:[{action:"set",status:"highlighted"}],onmouseout:[{action:"unset",status:"highlighted"}],onclick:[{action:"toggle",status:"selected",exclusive:!0}],onshiftclick:[{action:"toggle",status:"selected"}]},tooltip:n.Layouts.get("tooltip","standard_association",{unnamespaced:!0})}),n.Layouts.add("data_layer","phewas_pvalues",{namespace:{phewas:"phewas"},id:"phewaspvalues",type:"category_scatter",point_shape:"circle",point_size:70,tooltip_positioning:"vertical",id_field:"{{namespace[phewas]}}id",fields:["{{namespace[phewas]}}id","{{namespace[phewas]}}log_pvalue","{{namespace[phewas]}}trait_group","{{namespace[phewas]}}trait_label"],x_axis:{field:"{{namespace[phewas]}}x",category_field:"{{namespace[phewas]}}trait_group"},y_axis:{axis:1,field:"{{namespace[phewas]}}log_pvalue",floor:0,upper_buffer:.15},color:{field:"{{namespace[phewas]}}trait_group",scale_function:"categorical_bin",parameters:{categories:[],values:[],null_value:"#B8B8B8"}},fill_opacity:.7,tooltip:{closable:!0,show:{or:["highlighted","selected"]},hide:{and:["unhighlighted","unselected"]},html:["Trait: {{{{namespace[phewas]}}trait_label|htmlescape}}
","Trait Category: {{{{namespace[phewas]}}trait_group|htmlescape}}
","P-value: {{{{namespace[phewas]}}log_pvalue|logtoscinotation|htmlescape}}
"].join("")},behaviors:{onmouseover:[{action:"set",status:"highlighted"}],onmouseout:[{action:"unset",status:"highlighted"}],onclick:[{action:"toggle",status:"selected",exclusive:!0}],onshiftclick:[{action:"toggle",status:"selected"}]},label:{text:"{{{{namespace[phewas]}}trait_label}}",spacing:6,lines:{style:{"stroke-width":"2px",stroke:"#333333","stroke-dasharray":"2px 2px"}},filters:[{field:"{{namespace[phewas]}}log_pvalue",operator:">=",value:20}],style:{"font-size":"14px","font-weight":"bold",fill:"#333333"}}}),n.Layouts.add("data_layer","genes",{namespace:{gene:"gene",constraint:"constraint"},id:"genes",type:"genes",fields:["{{namespace[gene]}}gene","{{namespace[constraint]}}constraint"],id_field:"gene_id",behaviors:{onmouseover:[{action:"set",status:"highlighted"}],onmouseout:[{action:"unset",status:"highlighted"}],onclick:[{action:"toggle",status:"selected",exclusive:!0}],onshiftclick:[{action:"toggle",status:"selected"}]},tooltip:n.Layouts.get("tooltip","standard_genes",{unnamespaced:!0})}),n.Layouts.add("data_layer","genome_legend",{namespace:{genome:"genome"},id:"genome_legend",type:"genome_legend",fields:["{{namespace[genome]}}chr","{{namespace[genome]}}base_pairs"],x_axis:{floor:0,ceiling:2881033286}}),n.Layouts.add("data_layer","intervals",{namespace:{intervals:"intervals"},id:"intervals",type:"intervals",fields:["{{namespace[intervals]}}start","{{namespace[intervals]}}end","{{namespace[intervals]}}state_id","{{namespace[intervals]}}state_name"],id_field:"{{namespace[intervals]}}start",start_field:"{{namespace[intervals]}}start",end_field:"{{namespace[intervals]}}end",track_split_field:"{{namespace[intervals]}}state_id",split_tracks:!0,always_hide_legend:!1,color:{field:"{{namespace[intervals]}}state_id",scale_function:"categorical_bin",parameters:{categories:[1,2,3,4,5,6,7,8,9,10,11,12,13],values:["rgb(212,63,58)","rgb(250,120,105)","rgb(252,168,139)","rgb(240,189,66)","rgb(250,224,105)","rgb(240,238,84)","rgb(244,252,23)","rgb(23,232,252)","rgb(32,191,17)","rgb(23,166,77)","rgb(32,191,17)","rgb(162,133,166)","rgb(212,212,212)"],null_value:"#B8B8B8"}},legend:[{shape:"rect",color:"rgb(212,63,58)",width:9,label:"Active Promoter","{{namespace[intervals]}}state_id":1},{shape:"rect",color:"rgb(250,120,105)",width:9,label:"Weak Promoter","{{namespace[intervals]}}state_id":2},{shape:"rect",color:"rgb(252,168,139)",width:9,label:"Poised Promoter","{{namespace[intervals]}}state_id":3},{shape:"rect",color:"rgb(240,189,66)",width:9,label:"Strong enhancer","{{namespace[intervals]}}state_id":4},{shape:"rect",color:"rgb(250,224,105)",width:9,label:"Strong enhancer","{{namespace[intervals]}}state_id":5},{shape:"rect",color:"rgb(240,238,84)",width:9,label:"Weak enhancer","{{namespace[intervals]}}state_id":6},{shape:"rect",color:"rgb(244,252,23)",width:9,label:"Weak enhancer","{{namespace[intervals]}}state_id":7},{shape:"rect",color:"rgb(23,232,252)",width:9,label:"Insulator","{{namespace[intervals]}}state_id":8},{shape:"rect",color:"rgb(32,191,17)",width:9,label:"Transcriptional transition","{{namespace[intervals]}}state_id":9},{shape:"rect",color:"rgb(23,166,77)",width:9,label:"Transcriptional elongation","{{namespace[intervals]}}state_id":10},{shape:"rect",color:"rgb(136,240,129)",width:9,label:"Weak transcribed","{{namespace[intervals]}}state_id":11},{shape:"rect",color:"rgb(162,133,166)",width:9,label:"Polycomb-repressed","{{namespace[intervals]}}state_id":12},{shape:"rect",color:"rgb(212,212,212)",width:9,label:"Heterochromatin / low signal","{{namespace[intervals]}}state_id":13}],behaviors:{onmouseover:[{action:"set",status:"highlighted"}],onmouseout:[{action:"unset",status:"highlighted"}],onclick:[{action:"toggle",status:"selected",exclusive:!0}],onshiftclick:[{action:"toggle",status:"selected"}]},tooltip:n.Layouts.get("tooltip","standard_intervals",{unnamespaced:!0})}),n.Layouts.add("dashboard","standard_panel",{components:[{type:"remove_panel",position:"right",color:"red",group_position:"end"},{type:"move_panel_up",position:"right",group_position:"middle"},{type:"move_panel_down",position:"right",group_position:"start",style:{"margin-left":"0.75em"}}]}),n.Layouts.add("dashboard","standard_plot",{components:[{type:"title",title:"LocusZoom",subtitle:'v'+n.version+"",position:"left"},{type:"dimensions",position:"right"},{type:"region_scale",position:"right"},{type:"download",position:"right"}]});var o=n.Layouts.get("dashboard","standard_plot");o.components.push({type:"covariates_model",button_html:"Model",button_title:"Show and edit covariates currently in model",position:"left"}),n.Layouts.add("dashboard","covariates_model_plot",o);var r=n.Layouts.get("dashboard","standard_plot");r.components.push({type:"shift_region",step:5e5,button_html:">>",position:"right",group_position:"end"}),r.components.push({type:"shift_region",step:5e4,button_html:">",position:"right",group_position:"middle"}),r.components.push({type:"zoom_region",step:.2,position:"right",group_position:"middle"}),r.components.push({type:"zoom_region",step:-.2,position:"right",group_position:"middle"}),r.components.push({type:"shift_region",step:-5e4,button_html:"<",position:"right",group_position:"middle"}),r.components.push({type:"shift_region",step:-5e5,button_html:"<<",position:"right",group_position:"start"}),n.Layouts.add("dashboard","region_nav_plot",r),n.Layouts.add("panel","association",{id:"association",width:800,height:225,min_width:400,min_height:200,proportional_width:1,margin:{top:35,right:50,bottom:40,left:50},inner_border:"rgb(210, 210, 210)",dashboard:function(){var t=n.Layouts.get("dashboard","standard_panel",{unnamespaced:!0});return t.components.push({type:"toggle_legend",position:"right"}),t}(),axes:{x:{label:"Chromosome {{chr}} (Mb)",label_offset:32,tick_format:"region",extent:"state"},y1:{label:"-log10 p-value",label_offset:28},y2:{label:"Recombination Rate (cM/Mb)",label_offset:40}},legend:{orientation:"vertical",origin:{x:55,y:40},hidden:!0},interaction:{drag_background_to_pan:!0,drag_x_ticks_to_scale:!0,drag_y1_ticks_to_scale:!0,drag_y2_ticks_to_scale:!0,scroll_to_zoom:!0,x_linked:!0},data_layers:[n.Layouts.get("data_layer","significance",{unnamespaced:!0}),n.Layouts.get("data_layer","recomb_rate",{unnamespaced:!0}),n.Layouts.get("data_layer","association_pvalues",{unnamespaced:!0})]}),n.Layouts.add("panel","genes",{id:"genes",width:800,height:225,min_width:400,min_height:112.5,proportional_width:1,margin:{top:20,right:50,bottom:20,left:50},axes:{},interaction:{drag_background_to_pan:!0,scroll_to_zoom:!0,x_linked:!0},dashboard:function(){var t=n.Layouts.get("dashboard","standard_panel",{unnamespaced:!0});return t.components.push({type:"resize_to_data",position:"right"}),t}(),data_layers:[n.Layouts.get("data_layer","genes",{unnamespaced:!0})]}),n.Layouts.add("panel","phewas",{id:"phewas",width:800,height:300,min_width:800,min_height:300,proportional_width:1,margin:{top:20,right:50,bottom:120,left:50},inner_border:"rgb(210, 210, 210)",axes:{x:{ticks:{style:{"font-weight":"bold","font-size":"11px","text-anchor":"start"},transform:"rotate(50)",position:"left"}},y1:{label:"-log10 p-value",label_offset:28}},data_layers:[n.Layouts.get("data_layer","significance",{unnamespaced:!0}),n.Layouts.get("data_layer","phewas_pvalues",{unnamespaced:!0})]}),n.Layouts.add("panel","genome_legend",{id:"genome_legend",width:800,height:50,origin:{x:0,y:300},min_width:800,min_height:50,proportional_width:1,margin:{top:0,right:50,bottom:35,left:50},axes:{x:{label:"Genomic Position (number denotes chromosome)",label_offset:35,ticks:[{x:124625310,text:"1",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:370850307,text:"2",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:591461209,text:"3",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:786049562,text:"4",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:972084330,text:"5",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:1148099493,text:"6",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:1313226358,text:"7",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:1465977701,text:"8",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:1609766427,text:"9",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:1748140516,text:"10",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:1883411148,text:"11",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2017840353,text:"12",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2142351240,text:"13",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2253610949,text:"14",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2358551415,text:"15",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2454994487,text:"16",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2540769469,text:"17",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2620405698,text:"18",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2689008813,text:"19",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2750086065,text:"20",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2805663772,text:"21",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2855381003,text:"22",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"}]}},data_layers:[n.Layouts.get("data_layer","genome_legend",{unnamespaced:!0})]}),n.Layouts.add("panel","intervals",{id:"intervals",width:1e3,height:50,min_width:500,min_height:50,margin:{top:25,right:150,bottom:5,left:50},dashboard:function(){var t=n.Layouts.get("dashboard","standard_panel",{unnamespaced:!0});return t.components.push({type:"toggle_split_tracks",data_layer_id:"intervals",position:"right"}),t}(),axes:{},interaction:{drag_background_to_pan:!0,scroll_to_zoom:!0,x_linked:!0},legend:{hidden:!0,orientation:"horizontal",origin:{x:50,y:0},pad_from_bottom:5},data_layers:[n.Layouts.get("data_layer","intervals",{unnamespaced:!0})]}),n.Layouts.add("plot","standard_association",{state:{},width:800,height:450,responsive_resize:!0,min_region_scale:2e4,max_region_scale:1e6,dashboard:n.Layouts.get("dashboard","standard_plot",{unnamespaced:!0}),panels:[n.Layouts.get("panel","association",{unnamespaced:!0,proportional_height:.5}),n.Layouts.get("panel","genes",{unnamespaced:!0,proportional_height:.5})]}),n.StandardLayout=n.Layouts.get("plot","standard_association"),n.Layouts.add("plot","standard_phewas",{width:800,height:600,min_width:800,min_height:600,responsive_resize:!0,dashboard:n.Layouts.get("dashboard","standard_plot",{unnamespaced:!0}),panels:[n.Layouts.get("panel","phewas",{unnamespaced:!0,proportional_height:.45}),n.Layouts.get("panel","genome_legend",{unnamespaced:!0,proportional_height:.1}),n.Layouts.get("panel","genes",{unnamespaced:!0,proportional_height:.45,margin:{bottom:40},axes:{x:{label:"Chromosome {{chr}} (Mb)",label_offset:32,tick_format:"region",extent:"state"}}})],mouse_guide:!1}),n.Layouts.add("plot","interval_association",{state:{},width:800,height:550,responsive_resize:!0,min_region_scale:2e4,max_region_scale:1e6,dashboard:n.Layouts.get("dashboard","standard_plot",{unnamespaced:!0}),panels:[n.Layouts.get("panel","association",{unnamespaced:!0,width:800,proportional_height:225/570}),n.Layouts.get("panel","intervals",{unnamespaced:!0,proportional_height:120/570}),n.Layouts.get("panel","genes",{unnamespaced:!0,width:800,proportional_height:225/570})]}),n.DataLayer=function(t,e){return this.initialized=!1,this.layout_idx=null,this.id=null,this.parent=e||null,this.svg={},this.parent_plot=null,"undefined"!=typeof e&&e instanceof n.Panel&&(this.parent_plot=e.parent),this.layout=n.Layouts.merge(t||{},n.DataLayer.DefaultLayout),this.layout.id&&(this.id=this.layout.id),this.layout.x_axis!=={}&&"number"!=typeof this.layout.x_axis.axis&&(this.layout.x_axis.axis=1),this.layout.y_axis!=={}&&"number"!=typeof this.layout.y_axis.axis&&(this.layout.y_axis.axis=1),this.state={},this.state_id=null,this.setDefaultState(),this.data=[], +!function(t,e){"function"==typeof define&&define.amd?define(["postal"],function(a,i){return t.LocusZoom=e(a,i)}):"object"==typeof module&&module.exports?module.exports=t.LocusZoom=e(require("d3"),require("Q")):t.LocusZoom=e(t.d3,t.Q)}(this,function(t,e){var a=function(t,e){if(e==t)return!0;var a=t.split("."),i=e.split("."),n=!1;return a.forEach(function(t,e){!n&&+i[e]>+a[e]&&(n=!0)}),n};try{var i="3.5.6";if("object"!=typeof t)throw"d3 dependency not met. Library missing.";if(!a(i,t.version))throw"d3 dependency not met. Outdated version detected.\nRequired d3 version: "+i+" or higher (found: "+t.version+").";if("function"!=typeof e)throw"Q dependency not met. Library missing.";var n={version:"0.7.1"};n.populate=function(e,a,i){if("undefined"==typeof e)throw"LocusZoom.populate selector not defined";t.select(e).html("");var s;return t.select(e).call(function(){if("undefined"==typeof this.node().id){for(var e=0;!t.select("#lz-"+e).empty();)e++;this.attr("id","#lz-"+e)}if(s=new n.Plot(this.node().id,a,i),s.container=this.node(),"undefined"!=typeof this.node().dataset&&"undefined"!=typeof this.node().dataset.region){var o=n.parsePositionQuery(this.node().dataset.region);Object.keys(o).forEach(function(t){s.state[t]=o[t]})}s.svg=t.select("div#"+s.id).append("svg").attr("version","1.1").attr("xmlns","http://www.w3.org/2000/svg").attr("id",s.id+"_svg").attr("class","lz-locuszoom").style(s.layout.style),s.setDimensions(),s.positionPanels(),s.initialize(),"object"==typeof a&&Object.keys(a).length&&s.refresh()}),s},n.populateAll=function(e,a,i){var s=[];return t.selectAll(e).each(function(t,e){s[e]=n.populate(this,a,i)}),s},n.positionIntToString=function(t,e,a){var i={0:"",3:"K",6:"M",9:"G"};if(a=a||!1,isNaN(e)||null===e){var n=Math.log(t)/Math.LN10;e=Math.min(Math.max(n-n%3,0),9)}var s=e-Math.floor((Math.log(t)/Math.LN10).toFixed(e+3)),o=Math.min(Math.max(e,0),2),r=Math.min(Math.max(s,o),12),l=""+(t/Math.pow(10,e)).toFixed(r);return a&&"undefined"!=typeof i[e]&&(l+=" "+i[e]+"b"),l},n.positionStringToInt=function(t){var e=t.toUpperCase();e=e.replace(/,/g,"");var a=/([KMG])[B]*$/,i=a.exec(e),n=1;return i&&(n="M"===i[1]?1e6:"G"===i[1]?1e9:1e3,e=e.replace(a,"")),e=Number(e)*n},n.parsePositionQuery=function(t){var e=/^(\w+):([\d,.]+[kmgbKMGB]*)([-+])([\d,.]+[kmgbKMGB]*)$/,a=/^(\w+):([\d,.]+[kmgbKMGB]*)$/,i=e.exec(t);if(i){if("+"===i[3]){var s=n.positionStringToInt(i[2]),o=n.positionStringToInt(i[4]);return{chr:i[1],start:s-o,end:s+o}}return{chr:i[1],start:n.positionStringToInt(i[2]),end:n.positionStringToInt(i[4])}}return i=a.exec(t),i?{chr:i[1],position:n.positionStringToInt(i[2])}:null},n.prettyTicks=function(t,e,a){("undefined"==typeof a||isNaN(parseInt(a)))&&(a=5),a=parseInt(a);var i=a/3,n=.75,s=1.5,o=.5+1.5*s,r=Math.abs(t[0]-t[1]),l=r/a;Math.log(r)/Math.LN10<-2&&(l=Math.max(Math.abs(r))*n/i);var h=Math.pow(10,Math.floor(Math.log(l)/Math.LN10)),d=0;h<1&&0!==h&&(d=Math.abs(Math.round(Math.log(h)/Math.LN10)));var u=h;2*h-l0&&(c=parseFloat(c.toFixed(d)));return p.push(c),"undefined"!=typeof e&&["low","high","both","neither"].indexOf(e)!==-1||(e="neither"),"low"!==e&&"both"!==e||p[0]t[1]&&p.pop(),p},n.createCORSPromise=function(t,a,i,n,s){var o=e.defer(),r=new XMLHttpRequest;if("withCredentials"in r?r.open(t,a,!0):"undefined"!=typeof XDomainRequest?(r=new XDomainRequest,r.open(t,a)):r=null,r){if(r.onreadystatechange=function(){4===r.readyState&&(200===r.status||0===r.status?o.resolve(r.response):o.reject("HTTP "+r.status+" for "+a))},s&&setTimeout(o.reject,s),i="undefined"!=typeof i?i:"","undefined"!=typeof n)for(var l in n)r.setRequestHeader(l,n[l]);r.send(i)}return o.promise},n.validateState=function(t,e){t=t||{},e=e||{};var a=!1;if("undefined"!=typeof t.chr&&"undefined"!=typeof t.start&&"undefined"!=typeof t.end){var i,n=null;if(t.start=Math.max(parseInt(t.start),1),t.end=Math.max(parseInt(t.end),1),isNaN(t.start)&&isNaN(t.end))t.start=1,t.end=1,n=.5,i=0;else if(isNaN(t.start)||isNaN(t.end))n=t.start||t.end,i=0,t.start=isNaN(t.start)?t.end:t.start,t.end=isNaN(t.end)?t.start:t.end;else{if(n=Math.round((t.start+t.end)/2),i=t.end-t.start,i<0){var s=t.start;t.end=t.start,t.start=s,i=t.end-t.start}n<0&&(t.start=1,t.end=1,i=0)}a=!0}return!isNaN(e.min_region_scale)&&a&&ie.max_region_scale&&(t.start=Math.max(n-Math.floor(e.max_region_scale/2),1),t.end=t.start+e.max_region_scale),t},n.parseFields=function(t,e){if("object"!=typeof t)throw"LocusZoom.parseFields invalid arguments: data is not an object";if("string"!=typeof e)throw"LocusZoom.parseFields invalid arguments: html is not a string";for(var a=[],i=/\{\{(?:(#if )?([A-Za-z0-9_:|]+)|(\/if))\}\}/;e.length>0;){var s=i.exec(e);s?0!==s.index?(a.push({text:e.slice(0,s.index)}),e=e.slice(s.index)):"#if "===s[1]?(a.push({condition:s[2]}),e=e.slice(s[0].length)):s[2]?(a.push({variable:s[2]}),e=e.slice(s[0].length)):"/if"===s[3]?(a.push({close:"if"}),e=e.slice(s[0].length)):(console.error("Error tokenizing tooltip when remaining template is "+JSON.stringify(e)+" and previous tokens are "+JSON.stringify(a)+" and current regex match is "+JSON.stringify([s[1],s[2],s[3]])),e=e.slice(s[0].length)):(a.push({text:e}),e="")}for(var o=function(){var t=a.shift();if("undefined"!=typeof t.text||t.variable)return t;if(t.condition){for(t.then=[];a.length>0;){if("if"===a[0].close){a.shift();break}t.then.push(o())}return t}return console.error("Error making tooltip AST due to unknown token "+JSON.stringify(t)),{text:""}},r=[];a.length>0;)r.push(o());var l=function(e){return l.cache.hasOwnProperty(e)||(l.cache[e]=new n.Data.Field(e).resolve(t)),l.cache[e]};l.cache={};var h=function(t){if("undefined"!=typeof t.text)return t.text;if(t.variable){try{var e=l(t.variable);if(["string","number","boolean"].indexOf(typeof e)!==-1)return e;if(null===e)return""}catch(e){console.error("Error while processing variable "+JSON.stringify(t.variable))}return"{{"+t.variable+"}}"}if(t.condition){try{var a=l(t.condition);if(a||0===a)return t.then.map(h).join("")}catch(e){console.error("Error while processing condition "+JSON.stringify(t.variable))}return""}console.error("Error rendering tooltip due to unknown AST node "+JSON.stringify(t))};return r.map(h).join("")},n.getToolTipData=function(e){if("object"!=typeof e||"undefined"==typeof e.parentNode)throw"Invalid node object";var a=t.select(e);return a.classed("lz-data_layer-tooltip")&&"undefined"!=typeof a.data()[0]?a.data()[0]:n.getToolTipData(e.parentNode)},n.getToolTipDataLayer=function(t){var e=n.getToolTipData(t);return e.getDataLayer?e.getDataLayer():null},n.getToolTipPanel=function(t){var e=n.getToolTipDataLayer(t);return e?e.parent:null},n.getToolTipPlot=function(t){var e=n.getToolTipPanel(t);return e?e.parent:null},n.generateCurtain=function(){var e={showing:!1,selector:null,content_selector:null,hide_delay:null,show:function(e,a){return this.curtain.showing||(this.curtain.selector=t.select(this.parent_plot.svg.node().parentNode).insert("div").attr("class","lz-curtain").attr("id",this.id+".curtain"),this.curtain.content_selector=this.curtain.selector.append("div").attr("class","lz-curtain-content"),this.curtain.selector.append("div").attr("class","lz-curtain-dismiss").html("Dismiss").on("click",function(){this.curtain.hide()}.bind(this)),this.curtain.showing=!0),this.curtain.update(e,a)}.bind(this),update:function(t,e){if(!this.curtain.showing)return this.curtain;clearTimeout(this.curtain.hide_delay),"object"==typeof e&&this.curtain.selector.style(e);var a=this.getPageOrigin();return this.curtain.selector.style({top:a.y+"px",left:a.x+"px",width:this.layout.width+"px",height:this.layout.height+"px"}),this.curtain.content_selector.style({"max-width":this.layout.width-40+"px","max-height":this.layout.height-40+"px"}),"string"==typeof t&&this.curtain.content_selector.html(t),this.curtain}.bind(this),hide:function(t){return this.curtain.showing?"number"==typeof t?(clearTimeout(this.curtain.hide_delay),this.curtain.hide_delay=setTimeout(this.curtain.hide,t),this.curtain):(this.curtain.selector.remove(),this.curtain.selector=null,this.curtain.content_selector=null,this.curtain.showing=!1,this.curtain):this.curtain}.bind(this)};return e},n.generateLoader=function(){var e={showing:!1,selector:null,content_selector:null,progress_selector:null,cancel_selector:null,show:function(e){return this.loader.showing||(this.loader.selector=t.select(this.parent_plot.svg.node().parentNode).insert("div").attr("class","lz-loader").attr("id",this.id+".loader"),this.loader.content_selector=this.loader.selector.append("div").attr("class","lz-loader-content"),this.loader.progress_selector=this.loader.selector.append("div").attr("class","lz-loader-progress-container").append("div").attr("class","lz-loader-progress"),this.loader.showing=!0,"undefined"==typeof e&&(e="Loading...")),this.loader.update(e)}.bind(this),update:function(t,e){if(!this.loader.showing)return this.loader;clearTimeout(this.loader.hide_delay),"string"==typeof t&&this.loader.content_selector.html(t);var a=6,i=this.getPageOrigin(),n=this.loader.selector.node().getBoundingClientRect();return this.loader.selector.style({top:i.y+this.layout.height-n.height-a+"px",left:i.x+a+"px"}),"number"==typeof e&&this.loader.progress_selector.style({width:Math.min(Math.max(e,1),100)+"%"}),this.loader}.bind(this),animate:function(){return this.loader.progress_selector.classed("lz-loader-progress-animated",!0),this.loader}.bind(this),setPercentCompleted:function(t){return this.loader.progress_selector.classed("lz-loader-progress-animated",!1),this.loader.update(null,t)}.bind(this),hide:function(t){return this.loader.showing?"number"==typeof t?(clearTimeout(this.loader.hide_delay),this.loader.hide_delay=setTimeout(this.loader.hide,t),this.loader):(this.loader.selector.remove(),this.loader.selector=null,this.loader.content_selector=null,this.loader.progress_selector=null,this.loader.cancel_selector=null,this.loader.showing=!1,this.loader):this.loader}.bind(this)};return e},n.subclass=function(t,e,a){if("function"!=typeof t)throw"Parent must be a callable constructor";e=e||{};var i=a||function(){t.apply(this,arguments)};return i.prototype=Object.create(t.prototype),Object.keys(e).forEach(function(t){i.prototype[t]=e[t]}),i.prototype.constructor=i,i},n.Layouts=function(){var t={},e={plot:{},panel:{},data_layer:{},dashboard:{},tooltip:{}};return t.get=function(t,a,i){if("string"!=typeof t||"string"!=typeof a)throw"invalid arguments passed to LocusZoom.Layouts.get, requires string (layout type) and string (layout name)";if(e[t][a]){var s=n.Layouts.merge(i||{},e[t][a]);if(s.unnamespaced)return delete s.unnamespaced,JSON.parse(JSON.stringify(s));var o="";"string"==typeof s.namespace?o=s.namespace:"object"==typeof s.namespace&&Object.keys(s.namespace).length&&(o="undefined"!=typeof s.namespace.default?s.namespace.default:s.namespace[Object.keys(s.namespace)[0]].toString()),o+=o.length?":":"";var r=function(t,e){if(e?"string"==typeof e&&(e={default:e}):e={default:""},"string"==typeof t){for(var a,i,s,l,h=/\{\{namespace(\[[A-Za-z_0-9]+\]|)\}\}/g,d=[];null!==(a=h.exec(t));)i=a[0],s=a[1].length?a[1].replace(/(\[|\])/g,""):null,l=o,null!=e&&"object"==typeof e&&"undefined"!=typeof e[s]&&(l=e[s]+(e[s].length?":":"")),d.push({base:i,namespace:l});for(var u in d)t=t.replace(d[u].base,d[u].namespace)}else if("object"==typeof t&&null!=t){if("undefined"!=typeof t.namespace){var p="string"==typeof t.namespace?{default:t.namespace}:t.namespace;e=n.Layouts.merge(e,p)}var c,y;for(var f in t)"namespace"!==f&&(c=r(t[f],e),y=r(f,e),f!==y&&delete t[f],t[y]=c)}return t};return s=r(s,s.namespace),JSON.parse(JSON.stringify(s))}throw"layout type ["+t+"] name ["+a+"] not found"},t.set=function(t,a,i){if("string"!=typeof t||"string"!=typeof a||"object"!=typeof i)throw"unable to set new layout; bad arguments passed to set()";return e[t]||(e[t]={}),i?e[t][a]=JSON.parse(JSON.stringify(i)):(delete e[t][a],null)},t.add=function(e,a,i){return t.set(e,a,i)},t.list=function(t){if(e[t])return Object.keys(e[t]);var a={};return Object.keys(e).forEach(function(t){a[t]=Object.keys(e[t])}),a},t.merge=function(t,e){if("object"!=typeof t||"object"!=typeof e)throw"LocusZoom.Layouts.merge only accepts two layout objects; "+typeof t+", "+typeof e+" given";for(var a in e)if(e.hasOwnProperty(a)){var i=null===t[a]?"undefined":typeof t[a],s=typeof e[a];if("object"===i&&Array.isArray(t[a])&&(i="array"),"object"===s&&Array.isArray(e[a])&&(s="array"),"function"===i||"function"===s)throw"LocusZoom.Layouts.merge encountered an unsupported property type";"undefined"!==i?"object"!==i||"object"!==s||(t[a]=n.Layouts.merge(t[a],e[a])):t[a]=JSON.parse(JSON.stringify(e[a]))}return t},t}(),n.Layouts.add("tooltip","standard_association",{namespace:{assoc:"assoc"},closable:!0,show:{or:["highlighted","selected"]},hide:{and:["unhighlighted","unselected"]},html:'{{{{namespace[assoc]}}variant}}
P Value: {{{{namespace[assoc]}}log_pvalue|logtoscinotation}}
Ref. Allele: {{{{namespace[assoc]}}ref_allele}}
Make LD Reference
'});var s=n.Layouts.get("tooltip","standard_association",{unnamespaced:!0});s.html+='Condition on Variant
',n.Layouts.add("tooltip","covariates_model_association",s),n.Layouts.add("tooltip","standard_genes",{closable:!0,show:{or:["highlighted","selected"]},hide:{and:["unhighlighted","unselected"]},html:'

{{gene_name}}

Gene ID: {{gene_id}}
Transcript ID: {{transcript_id}}
ConstraintExpected variantsObserved variantsConst. Metric
Synonymous{{exp_syn}}{{n_syn}}z = {{syn_z}}
Missense{{exp_mis}}{{n_mis}}z = {{mis_z}}
LoF{{exp_lof}}{{n_lof}}pLI = {{pLI}}
More data on ExAC'}),n.Layouts.add("tooltip","standard_intervals",{namespace:{intervals:"intervals"},closable:!1,show:{or:["highlighted","selected"]},hide:{and:["unhighlighted","unselected"]},html:"{{{{namespace[intervals]}}state_name}}
{{{{namespace[intervals]}}start}}-{{{{namespace[intervals]}}end}}"}),n.Layouts.add("data_layer","significance",{id:"significance",type:"orthogonal_line",orientation:"horizontal",offset:4.522}),n.Layouts.add("data_layer","recomb_rate",{namespace:{recomb:"recomb"},id:"recombrate",type:"line",fields:["{{namespace[recomb]}}position","{{namespace[recomb]}}recomb_rate"],z_index:1,style:{stroke:"#0000FF","stroke-width":"1.5px"},x_axis:{field:"{{namespace[recomb]}}position"},y_axis:{axis:2,field:"{{namespace[recomb]}}recomb_rate",floor:0,ceiling:100}}),n.Layouts.add("data_layer","association_pvalues",{namespace:{assoc:"assoc",ld:"ld"},id:"associationpvalues",type:"scatter",point_shape:{scale_function:"if",field:"{{namespace[ld]}}isrefvar",parameters:{field_value:1,then:"diamond",else:"circle"}},point_size:{scale_function:"if",field:"{{namespace[ld]}}isrefvar",parameters:{field_value:1,then:80,else:40}},color:[{scale_function:"if",field:"{{namespace[ld]}}isrefvar",parameters:{field_value:1,then:"#9632b8"}},{scale_function:"numerical_bin",field:"{{namespace[ld]}}state",parameters:{breaks:[0,.2,.4,.6,.8],values:["#357ebd","#46b8da","#5cb85c","#eea236","#d43f3a"]}},"#B8B8B8"],legend:[{shape:"diamond",color:"#9632b8",size:40,label:"LD Ref Var",class:"lz-data_layer-scatter"},{shape:"circle",color:"#d43f3a",size:40,label:"1.0 > r² ≥ 0.8",class:"lz-data_layer-scatter"},{shape:"circle",color:"#eea236",size:40,label:"0.8 > r² ≥ 0.6",class:"lz-data_layer-scatter"},{shape:"circle",color:"#5cb85c",size:40,label:"0.6 > r² ≥ 0.4",class:"lz-data_layer-scatter"},{shape:"circle",color:"#46b8da",size:40,label:"0.4 > r² ≥ 0.2",class:"lz-data_layer-scatter"},{shape:"circle",color:"#357ebd",size:40,label:"0.2 > r² ≥ 0.0",class:"lz-data_layer-scatter"},{shape:"circle",color:"#B8B8B8",size:40,label:"no r² data",class:"lz-data_layer-scatter"}],fields:["{{namespace[assoc]}}variant","{{namespace[assoc]}}position","{{namespace[assoc]}}log_pvalue","{{namespace[assoc]}}log_pvalue|logtoscinotation","{{namespace[assoc]}}ref_allele","{{namespace[ld]}}state","{{namespace[ld]}}isrefvar"],id_field:"{{namespace[assoc]}}variant",z_index:2,x_axis:{field:"{{namespace[assoc]}}position"},y_axis:{axis:1,field:"{{namespace[assoc]}}log_pvalue",floor:0,upper_buffer:.1,min_extent:[0,10]},behaviors:{onmouseover:[{action:"set",status:"highlighted"}],onmouseout:[{action:"unset",status:"highlighted"}],onclick:[{action:"toggle",status:"selected",exclusive:!0}],onshiftclick:[{action:"toggle",status:"selected"}]},tooltip:n.Layouts.get("tooltip","standard_association",{unnamespaced:!0})}),n.Layouts.add("data_layer","phewas_pvalues",{namespace:{phewas:"phewas"},id:"phewaspvalues",type:"category_scatter",point_shape:"circle",point_size:70,tooltip_positioning:"vertical",id_field:"{{namespace[phewas]}}id",fields:["{{namespace[phewas]}}id","{{namespace[phewas]}}log_pvalue","{{namespace[phewas]}}trait_group","{{namespace[phewas]}}trait_label"],x_axis:{field:"{{namespace[phewas]}}x",category_field:"{{namespace[phewas]}}trait_group"},y_axis:{axis:1,field:"{{namespace[phewas]}}log_pvalue",floor:0,upper_buffer:.15},color:{field:"{{namespace[phewas]}}trait_group",scale_function:"categorical_bin",parameters:{categories:[],values:[],null_value:"#B8B8B8"}},fill_opacity:.7,tooltip:{closable:!0,show:{or:["highlighted","selected"]},hide:{and:["unhighlighted","unselected"]},html:["Trait: {{{{namespace[phewas]}}trait_label|htmlescape}}
","Trait Category: {{{{namespace[phewas]}}trait_group|htmlescape}}
","P-value: {{{{namespace[phewas]}}log_pvalue|logtoscinotation|htmlescape}}
"].join("")},behaviors:{onmouseover:[{action:"set",status:"highlighted"}],onmouseout:[{action:"unset",status:"highlighted"}],onclick:[{action:"toggle",status:"selected",exclusive:!0}],onshiftclick:[{action:"toggle",status:"selected"}]},label:{text:"{{{{namespace[phewas]}}trait_label}}",spacing:6,lines:{style:{"stroke-width":"2px",stroke:"#333333","stroke-dasharray":"2px 2px"}},filters:[{field:"{{namespace[phewas]}}log_pvalue",operator:">=",value:20}],style:{"font-size":"14px","font-weight":"bold",fill:"#333333"}}}),n.Layouts.add("data_layer","genes",{namespace:{gene:"gene",constraint:"constraint"},id:"genes",type:"genes",fields:["{{namespace[gene]}}gene","{{namespace[constraint]}}constraint"],id_field:"gene_id",behaviors:{onmouseover:[{action:"set",status:"highlighted"}],onmouseout:[{action:"unset",status:"highlighted"}],onclick:[{action:"toggle",status:"selected",exclusive:!0}],onshiftclick:[{action:"toggle",status:"selected"}]},tooltip:n.Layouts.get("tooltip","standard_genes",{unnamespaced:!0})}),n.Layouts.add("data_layer","genome_legend",{namespace:{genome:"genome"},id:"genome_legend",type:"genome_legend",fields:["{{namespace[genome]}}chr","{{namespace[genome]}}base_pairs"],x_axis:{floor:0,ceiling:2881033286}}),n.Layouts.add("data_layer","intervals",{namespace:{intervals:"intervals"},id:"intervals",type:"intervals",fields:["{{namespace[intervals]}}start","{{namespace[intervals]}}end","{{namespace[intervals]}}state_id","{{namespace[intervals]}}state_name"],id_field:"{{namespace[intervals]}}start",start_field:"{{namespace[intervals]}}start",end_field:"{{namespace[intervals]}}end",track_split_field:"{{namespace[intervals]}}state_id",split_tracks:!0,always_hide_legend:!1,color:{field:"{{namespace[intervals]}}state_id",scale_function:"categorical_bin",parameters:{categories:[1,2,3,4,5,6,7,8,9,10,11,12,13],values:["rgb(212,63,58)","rgb(250,120,105)","rgb(252,168,139)","rgb(240,189,66)","rgb(250,224,105)","rgb(240,238,84)","rgb(244,252,23)","rgb(23,232,252)","rgb(32,191,17)","rgb(23,166,77)","rgb(32,191,17)","rgb(162,133,166)","rgb(212,212,212)"],null_value:"#B8B8B8"}},legend:[{shape:"rect",color:"rgb(212,63,58)",width:9,label:"Active Promoter","{{namespace[intervals]}}state_id":1},{shape:"rect",color:"rgb(250,120,105)",width:9,label:"Weak Promoter","{{namespace[intervals]}}state_id":2},{shape:"rect",color:"rgb(252,168,139)",width:9,label:"Poised Promoter","{{namespace[intervals]}}state_id":3},{shape:"rect",color:"rgb(240,189,66)",width:9,label:"Strong enhancer","{{namespace[intervals]}}state_id":4},{shape:"rect",color:"rgb(250,224,105)",width:9,label:"Strong enhancer","{{namespace[intervals]}}state_id":5},{shape:"rect",color:"rgb(240,238,84)",width:9,label:"Weak enhancer","{{namespace[intervals]}}state_id":6},{shape:"rect",color:"rgb(244,252,23)",width:9,label:"Weak enhancer","{{namespace[intervals]}}state_id":7},{shape:"rect",color:"rgb(23,232,252)",width:9,label:"Insulator","{{namespace[intervals]}}state_id":8},{shape:"rect",color:"rgb(32,191,17)",width:9,label:"Transcriptional transition","{{namespace[intervals]}}state_id":9},{shape:"rect",color:"rgb(23,166,77)",width:9,label:"Transcriptional elongation","{{namespace[intervals]}}state_id":10},{shape:"rect",color:"rgb(136,240,129)",width:9,label:"Weak transcribed","{{namespace[intervals]}}state_id":11},{shape:"rect",color:"rgb(162,133,166)",width:9,label:"Polycomb-repressed","{{namespace[intervals]}}state_id":12},{shape:"rect",color:"rgb(212,212,212)",width:9,label:"Heterochromatin / low signal","{{namespace[intervals]}}state_id":13}],behaviors:{onmouseover:[{action:"set",status:"highlighted"}],onmouseout:[{action:"unset",status:"highlighted"}],onclick:[{action:"toggle",status:"selected",exclusive:!0}],onshiftclick:[{action:"toggle",status:"selected"}]},tooltip:n.Layouts.get("tooltip","standard_intervals",{unnamespaced:!0})}),n.Layouts.add("dashboard","standard_panel",{components:[{type:"remove_panel",position:"right",color:"red",group_position:"end"},{type:"move_panel_up",position:"right",group_position:"middle"},{type:"move_panel_down",position:"right",group_position:"start",style:{"margin-left":"0.75em"}}]}),n.Layouts.add("dashboard","standard_plot",{components:[{type:"title",title:"LocusZoom",subtitle:'v'+n.version+"",position:"left"},{type:"dimensions",position:"right"},{type:"region_scale",position:"right"},{type:"download",position:"right"}]});var o=n.Layouts.get("dashboard","standard_plot");o.components.push({type:"covariates_model",button_html:"Model",button_title:"Show and edit covariates currently in model",position:"left"}),n.Layouts.add("dashboard","covariates_model_plot",o);var r=n.Layouts.get("dashboard","standard_plot");r.components.push({type:"shift_region",step:5e5,button_html:">>",position:"right",group_position:"end"}),r.components.push({type:"shift_region",step:5e4,button_html:">",position:"right",group_position:"middle"}),r.components.push({type:"zoom_region",step:.2,position:"right",group_position:"middle"}),r.components.push({type:"zoom_region",step:-.2,position:"right",group_position:"middle"}),r.components.push({type:"shift_region",step:-5e4,button_html:"<",position:"right",group_position:"middle"}),r.components.push({type:"shift_region",step:-5e5,button_html:"<<",position:"right",group_position:"start"}),n.Layouts.add("dashboard","region_nav_plot",r),n.Layouts.add("panel","association",{id:"association",width:800,height:225,min_width:400,min_height:200,proportional_width:1,margin:{top:35,right:50,bottom:40,left:50},inner_border:"rgb(210, 210, 210)",dashboard:function(){var t=n.Layouts.get("dashboard","standard_panel",{unnamespaced:!0});return t.components.push({type:"toggle_legend",position:"right"}),t}(),axes:{x:{label:"Chromosome {{chr}} (Mb)",label_offset:32,tick_format:"region",extent:"state"},y1:{label:"-log10 p-value",label_offset:28},y2:{label:"Recombination Rate (cM/Mb)",label_offset:40}},legend:{orientation:"vertical",origin:{x:55,y:40},hidden:!0},interaction:{drag_background_to_pan:!0,drag_x_ticks_to_scale:!0,drag_y1_ticks_to_scale:!0,drag_y2_ticks_to_scale:!0,scroll_to_zoom:!0,x_linked:!0},data_layers:[n.Layouts.get("data_layer","significance",{unnamespaced:!0}),n.Layouts.get("data_layer","recomb_rate",{unnamespaced:!0}),n.Layouts.get("data_layer","association_pvalues",{unnamespaced:!0})]}),n.Layouts.add("panel","genes",{id:"genes",width:800,height:225,min_width:400,min_height:112.5,proportional_width:1,margin:{top:20,right:50,bottom:20,left:50},axes:{},interaction:{drag_background_to_pan:!0,scroll_to_zoom:!0,x_linked:!0},dashboard:function(){var t=n.Layouts.get("dashboard","standard_panel",{unnamespaced:!0});return t.components.push({type:"resize_to_data",position:"right"}),t}(),data_layers:[n.Layouts.get("data_layer","genes",{unnamespaced:!0})]}),n.Layouts.add("panel","phewas",{id:"phewas",width:800,height:300,min_width:800,min_height:300,proportional_width:1,margin:{top:20,right:50,bottom:120,left:50},inner_border:"rgb(210, 210, 210)",axes:{x:{ticks:{style:{"font-weight":"bold","font-size":"11px","text-anchor":"start"},transform:"rotate(50)",position:"left"}},y1:{label:"-log10 p-value",label_offset:28}},data_layers:[n.Layouts.get("data_layer","significance",{unnamespaced:!0}),n.Layouts.get("data_layer","phewas_pvalues",{unnamespaced:!0})]}),n.Layouts.add("panel","genome_legend",{id:"genome_legend",width:800,height:50,origin:{x:0,y:300},min_width:800,min_height:50,proportional_width:1,margin:{top:0,right:50,bottom:35,left:50},axes:{x:{label:"Genomic Position (number denotes chromosome)",label_offset:35,ticks:[{x:124625310,text:"1",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:370850307,text:"2",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:591461209,text:"3",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:786049562,text:"4",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:972084330,text:"5",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:1148099493,text:"6",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:1313226358,text:"7",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:1465977701,text:"8",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:1609766427,text:"9",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:1748140516,text:"10",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:1883411148,text:"11",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2017840353,text:"12",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2142351240,text:"13",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2253610949,text:"14",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2358551415,text:"15",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2454994487,text:"16",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2540769469,text:"17",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2620405698,text:"18",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2689008813,text:"19",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2750086065,text:"20",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2805663772,text:"21",style:{fill:"rgb(120, 120, 186)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"},{x:2855381003,text:"22",style:{fill:"rgb(0, 0, 66)","text-anchor":"center","font-size":"13px","font-weight":"bold"},transform:"translate(0, 2)"}]}},data_layers:[n.Layouts.get("data_layer","genome_legend",{unnamespaced:!0})]}),n.Layouts.add("panel","intervals",{id:"intervals",width:1e3,height:50,min_width:500,min_height:50,margin:{top:25,right:150,bottom:5,left:50},dashboard:function(){var t=n.Layouts.get("dashboard","standard_panel",{unnamespaced:!0});return t.components.push({type:"toggle_split_tracks",data_layer_id:"intervals",position:"right"}),t}(),axes:{},interaction:{drag_background_to_pan:!0,scroll_to_zoom:!0,x_linked:!0},legend:{hidden:!0,orientation:"horizontal",origin:{x:50,y:0},pad_from_bottom:5},data_layers:[n.Layouts.get("data_layer","intervals",{unnamespaced:!0})]}),n.Layouts.add("plot","standard_association",{state:{},width:800,height:450,responsive_resize:!0,min_region_scale:2e4,max_region_scale:1e6,dashboard:n.Layouts.get("dashboard","standard_plot",{unnamespaced:!0}),panels:[n.Layouts.get("panel","association",{unnamespaced:!0,proportional_height:.5}),n.Layouts.get("panel","genes",{unnamespaced:!0,proportional_height:.5})]}),n.StandardLayout=n.Layouts.get("plot","standard_association"),n.Layouts.add("plot","standard_phewas",{width:800,height:600,min_width:800,min_height:600,responsive_resize:!0,dashboard:n.Layouts.get("dashboard","standard_plot",{unnamespaced:!0}),panels:[n.Layouts.get("panel","phewas",{unnamespaced:!0,proportional_height:.45}),n.Layouts.get("panel","genome_legend",{unnamespaced:!0,proportional_height:.1}),n.Layouts.get("panel","genes",{unnamespaced:!0,proportional_height:.45,margin:{bottom:40},axes:{x:{label:"Chromosome {{chr}} (Mb)",label_offset:32,tick_format:"region",extent:"state"}}})],mouse_guide:!1}),n.Layouts.add("plot","interval_association",{state:{},width:800,height:550,responsive_resize:!0,min_region_scale:2e4,max_region_scale:1e6,dashboard:n.Layouts.get("dashboard","standard_plot",{unnamespaced:!0}),panels:[n.Layouts.get("panel","association",{unnamespaced:!0,width:800,proportional_height:225/570}),n.Layouts.get("panel","intervals",{unnamespaced:!0,proportional_height:120/570}),n.Layouts.get("panel","genes",{unnamespaced:!0,width:800,proportional_height:225/570})]}),n.DataLayer=function(t,e){return this.initialized=!1,this.layout_idx=null,this.id=null,this.parent=e||null,this.svg={},this.parent_plot=null,"undefined"!=typeof e&&e instanceof n.Panel&&(this.parent_plot=e.parent),this.layout=n.Layouts.merge(t||{},n.DataLayer.DefaultLayout),this.layout.id&&(this.id=this.layout.id),this.layout.x_axis!=={}&&"number"!=typeof this.layout.x_axis.axis&&(this.layout.x_axis.axis=1),this.layout.y_axis!=={}&&"number"!=typeof this.layout.y_axis.axis&&(this.layout.y_axis.axis=1),this.state={},this.state_id=null,this.setDefaultState(),this.data=[], this.layout.tooltip&&(this.tooltips={}),this.global_statuses={highlighted:!1,selected:!1,faded:!1,hidden:!1},this},n.DataLayer.prototype.addField=function(t,e,a){if(!t||!e)throw"Must specify field name and namespace to use when adding field";var i=e+":"+t;if(a)if(i+="|","string"==typeof a)i+=a;else{if(!Array.isArray(a))throw"Must provide transformations as either a string or array of strings";i+=a.join("|")}var n=this.layout.fields;return n.indexOf(i)===-1&&n.push(i),i},n.DataLayer.prototype.setDefaultState=function(){this.parent&&(this.state=this.parent.state,this.state_id=this.parent.id+"."+this.id,this.state[this.state_id]=this.state[this.state_id]||{},n.DataLayer.Statuses.adjectives.forEach(function(t){this.state[this.state_id][t]=this.state[this.state_id][t]||[]}.bind(this)))},n.DataLayer.DefaultLayout={type:"",fields:[],x_axis:{},y_axis:{}},n.DataLayer.Statuses={verbs:["highlight","select","fade","hide"],adjectives:["highlighted","selected","faded","hidden"],menu_antiverbs:["unhighlight","deselect","unfade","show"]},n.DataLayer.prototype.getBaseId=function(){return this.parent_plot.id+"."+this.parent.id+"."+this.id},n.DataLayer.prototype.getAbsoluteDataHeight=function(){var t=this.svg.group.node().getBoundingClientRect();return t.height},n.DataLayer.prototype.canTransition=function(){return!!this.layout.transition&&!(this.parent_plot.panel_boundaries.dragging||this.parent_plot.interaction.panel_id)},n.DataLayer.prototype.getElementId=function(t){var e="element";if("string"==typeof t)e=t;else if("object"==typeof t){var a=this.layout.id_field||"id";if("undefined"==typeof t[a])throw"Unable to generate element ID";e=t[a].toString().replace(/\W/g,"")}return(this.getBaseId()+"-"+e).replace(/(:|\.|\[|\]|,)/g,"_")},n.DataLayer.prototype.getElementStatusNodeId=function(t){return null},n.DataLayer.prototype.getElementById=function(e){var a=t.select("#"+e.replace(/(:|\.|\[|\]|,)/g,"\\$1"));return!a.empty()&&a.data()&&a.data().length?a.data()[0]:null},n.DataLayer.prototype.applyDataMethods=function(){return this.data.forEach(function(t,e){this.data[e].toHTML=function(){var t=this.layout.id_field||"id",a="";return this.data[e][t]&&(a=this.data[e][t].toString()),a}.bind(this),this.data[e].getDataLayer=function(){return this}.bind(this),this.data[e].deselect=function(){var t=this.getDataLayer();t.unselectElement(this)}}.bind(this)),this.applyCustomDataMethods(),this},n.DataLayer.prototype.applyCustomDataMethods=function(){return this},n.DataLayer.prototype.initialize=function(){return this.svg.container=this.parent.svg.group.append("g").attr("class","lz-data_layer-container").attr("id",this.getBaseId()+".data_layer_container"),this.svg.clipRect=this.svg.container.append("clipPath").attr("id",this.getBaseId()+".clip").append("rect"),this.svg.group=this.svg.container.append("g").attr("id",this.getBaseId()+".data_layer").attr("clip-path","url(#"+this.getBaseId()+".clip)"),this},n.DataLayer.prototype.moveUp=function(){return this.parent.data_layer_ids_by_z_index[this.layout.z_index+1]&&(this.parent.data_layer_ids_by_z_index[this.layout.z_index]=this.parent.data_layer_ids_by_z_index[this.layout.z_index+1],this.parent.data_layer_ids_by_z_index[this.layout.z_index+1]=this.id,this.parent.resortDataLayers()),this},n.DataLayer.prototype.moveDown=function(){return this.parent.data_layer_ids_by_z_index[this.layout.z_index-1]&&(this.parent.data_layer_ids_by_z_index[this.layout.z_index]=this.parent.data_layer_ids_by_z_index[this.layout.z_index-1],this.parent.data_layer_ids_by_z_index[this.layout.z_index-1]=this.id,this.parent.resortDataLayers()),this},n.DataLayer.prototype.resolveScalableParameter=function(t,e){var a=null;if(Array.isArray(t))for(var i=0;null===a&&i":function(t,e){return t>e},">=":function(t,e){return t>=e},"%":function(t,e){return t%e}};return!!Array.isArray(e)&&(2===e.length?t[e[0]]===e[1]:!(3!==e.length||!a[e[1]])&&a[e[1]](t[e[0]],e[2]))},i=[];return this.data.forEach(function(n,s){var o=!0;t.forEach(function(t){a(n,t)||(o=!1)}),o&&i.push("indexes"===e?s:n)}),i},n.DataLayer.prototype.filterIndexes=function(t){return this.filter(t,"indexes")},n.DataLayer.prototype.filterElements=function(t){return this.filter(t,"elements")},n.DataLayer.Statuses.verbs.forEach(function(t,e){var a=n.DataLayer.Statuses.adjectives[e],i="un"+t;n.DataLayer.prototype[t+"Element"]=function(t,e){return e="undefined"!=typeof e&&!!e,this.setElementStatus(a,t,!0,e),this},n.DataLayer.prototype[i+"Element"]=function(t,e){return e="undefined"!=typeof e&&!!e,this.setElementStatus(a,t,!1,e),this},n.DataLayer.prototype[t+"ElementsByFilters"]=function(t,e){return e="undefined"!=typeof e&&!!e,this.setElementStatusByFilters(a,!0,t,e)},n.DataLayer.prototype[i+"ElementsByFilters"]=function(t,e){return e="undefined"!=typeof e&&!!e,this.setElementStatusByFilters(a,!1,t,e)},n.DataLayer.prototype[t+"AllElements"]=function(){return this.setAllElementStatus(a,!0),this},n.DataLayer.prototype[i+"AllElements"]=function(){return this.setAllElementStatus(a,!1),this}}),n.DataLayer.prototype.setElementStatus=function(e,a,i,s){if("undefined"==typeof e||n.DataLayer.Statuses.adjectives.indexOf(e)===-1)throw"Invalid status passed to DataLayer.setElementStatus()";if("undefined"==typeof a)throw"Invalid element passed to DataLayer.setElementStatus()";"undefined"==typeof i&&(i=!0);try{var o=this.getElementId(a)}catch(t){return this}s&&this.setAllElementStatus(e,!i),t.select("#"+o).classed("lz-data_layer-"+this.layout.type+"-"+e,i);var r=this.getElementStatusNodeId(a);null!==r&&t.select("#"+r).classed("lz-data_layer-"+this.layout.type+"-statusnode-"+e,i);var l=this.state[this.state_id][e].indexOf(o);return i&&l===-1&&this.state[this.state_id][e].push(o),i||l===-1||this.state[this.state_id][e].splice(l,1),this.showOrHideTooltip(a),this.parent.emit("layout_changed"),this.parent_plot.emit("layout_changed"),this},n.DataLayer.prototype.setElementStatusByFilters=function(t,e,a,i){if("undefined"==typeof t||n.DataLayer.Statuses.adjectives.indexOf(t)===-1)throw"Invalid status passed to DataLayer.setElementStatusByFilters()";return"undefined"==typeof this.state[this.state_id][t]?this:(e="undefined"==typeof e||!!e,i="undefined"!=typeof i&&!!i,Array.isArray(a)||(a=[]),i&&this.setAllElementStatus(t,!e),this.filterElements(a).forEach(function(a){this.setElementStatus(t,a,e)}.bind(this)),this)},n.DataLayer.prototype.setAllElementStatus=function(t,e){if("undefined"==typeof t||n.DataLayer.Statuses.adjectives.indexOf(t)===-1)throw"Invalid status passed to DataLayer.setAllElementStatus()";if("undefined"==typeof this.state[this.state_id][t])return this;if("undefined"==typeof e&&(e=!0),e)this.data.forEach(function(e){this.setElementStatus(t,e,!0)}.bind(this));else{var a=this.state[this.state_id][t].slice();a.forEach(function(e){var a=this.getElementById(e);"object"==typeof a&&null!==a&&this.setElementStatus(t,a,!1)}.bind(this)),this.state[this.state_id][t]=[]}return this.global_statuses[t]=e,this},n.DataLayer.prototype.applyBehaviors=function(t){"object"==typeof this.layout.behaviors&&Object.keys(this.layout.behaviors).forEach(function(e){var a=/(click|mouseover|mouseout)/.exec(e);a&&t.on(a[0]+"."+e,this.executeBehaviors(e,this.layout.behaviors[e]))}.bind(this))},n.DataLayer.prototype.executeBehaviors=function(e,a){var i={ctrl:e.indexOf("ctrl")!==-1,shift:e.indexOf("shift")!==-1};return function(e){i.ctrl===!!t.event.ctrlKey&&i.shift===!!t.event.shiftKey&&a.forEach(function(t){if("object"==typeof t&&null!==t)switch(t.action){case"set":this.setElementStatus(t.status,e,!0,t.exclusive);break;case"unset":this.setElementStatus(t.status,e,!1,t.exclusive);break;case"toggle":var a=this.state[this.state_id][t.status].indexOf(this.getElementId(e))!==-1,i=t.exclusive&&!a;this.setElementStatus(t.status,e,!a,i);break;case"link":if("string"==typeof t.href){var s=n.parseFields(e,t.href);"string"==typeof t.target?window.open(s,t.target):window.location.href=s}}}.bind(this))}.bind(this)},n.DataLayer.prototype.getPageOrigin=function(){var t=this.parent.getPageOrigin();return{x:t.x+this.parent.layout.margin.left,y:t.y+this.parent.layout.margin.top}},n.DataLayer.prototype.exportData=function(t){var e="json";t=t||e,t="string"==typeof t?t.toLowerCase():e,["json","csv","tsv"].indexOf(t)===-1&&(t=e);var a;switch(t){case"json":try{a=JSON.stringify(this.data)}catch(t){a=null,console.error("Unable to export JSON data from data layer: "+this.getBaseId()+";",t)}break;case"tsv":case"csv":try{var i=JSON.parse(JSON.stringify(this.data));if("object"!=typeof i)a=i.toString();else if(Array.isArray(i)){var n="tsv"===t?"\t":",",s=this.layout.fields.map(function(t){return JSON.stringify(t)}).join(n)+"\n";a=s+i.map(function(t){return this.layout.fields.map(function(e){return"undefined"==typeof t[e]?JSON.stringify(null):"object"==typeof t[e]&&null!==t[e]?Array.isArray(t[e])?'"[Array('+t[e].length+')]"':'"[Object]"':JSON.stringify(t[e])}).join(n)}.bind(this)).join("\n")}else a="Object"}catch(t){a=null,console.error("Unable to export CSV data from data layer: "+this.getBaseId()+";",t)}}return a},n.DataLayer.prototype.draw=function(){return this.svg.container.attr("transform","translate("+this.parent.layout.cliparea.origin.x+","+this.parent.layout.cliparea.origin.y+")"),this.svg.clipRect.attr("width",this.parent.layout.cliparea.width).attr("height",this.parent.layout.cliparea.height),this.positionAllTooltips(),this},n.DataLayer.prototype.reMap=function(){this.destroyAllTooltips();var t=this.parent_plot.lzd.getData(this.state,this.layout.fields);return t.then(function(t){this.data=t.body,this.applyDataMethods(),this.initialized=!0}.bind(this)),t},n.DataLayers=function(){var t={},e={};return t.get=function(t,a,i){if(t){if(e[t]){if("object"!=typeof a)throw"invalid layout argument for data layer ["+t+"]";return new e[t](a,i)}throw"data layer ["+t+"] not found"}return null},t.set=function(t,a){if(a){if("function"!=typeof a)throw"unable to set data layer ["+t+"], argument provided is not a function";e[t]=a,e[t].prototype=new n.DataLayer}else delete e[t]},t.add=function(a,i){if(e[a])throw"data layer already exists with name: "+a;t.set(a,i)},t.extend=function(t,a,i){i=i||{};var s=e[t];if(!s)throw"Attempted to subclass an unknown or unregistered datalayer type";if("object"!=typeof i)throw"Must specify an object of properties and methods";var o=n.subclass(s,i);return e[a]=o,o},t.list=function(){return Object.keys(e)},t}(),n.DataLayers.add("annotation_track",function(t){if(this.DefaultLayout={color:"#000000",filters:[]},t=n.Layouts.merge(t,this.DefaultLayout),!Array.isArray(t.filters))throw"Annotation track must specify array of filters for selecting points to annotate";return n.DataLayer.apply(this,arguments),this.render=function(){var t=this,e=this.filter(this.layout.filters,"elements"),a=this.svg.group.selectAll("rect.lz-data_layer-"+t.layout.type).data(e,function(e){return e[t.layout.id_field]});a.enter().append("rect").attr("class","lz-data_layer-"+this.layout.type).attr("id",function(e){return t.getElementId(e)}),a.attr("x",function(e){return t.parent.x_scale(e[t.layout.x_axis.field])}).attr("width",1).attr("height",t.parent.layout.height).attr("fill",function(e){return t.resolveScalableParameter(t.layout.color,e)}),a.exit().remove(),this.applyBehaviors(a)},this.positionTooltip=function(t){if("string"!=typeof t)throw"Unable to position tooltip: id is not a string";if(!this.tooltips[t])throw"Unable to position tooltip: id does not point to a valid tooltip";var e,a,i,n,s,o=this.tooltips[t],r=7,l=1,h=l/2,d=this.getPageOrigin(),u=o.selector.node().getBoundingClientRect(),p=this.parent.layout.height-(this.parent.layout.margin.top+this.parent.layout.margin.bottom),c=this.parent.layout.width-(this.parent.layout.margin.left+this.parent.layout.margin.right),y=this.parent.x_scale(o.data[this.layout.x_axis.field]),f=p/2,g=Math.max(u.width/2-y,0),_=Math.max(u.width/2+y-c,0);a=d.x+y-u.width/2-_+g,s=u.width/2-r+_-g-h,u.height+l+r>p-f?(e=d.y+f-(u.height+l+r),i="down",n=u.height-l):(e=d.y+f+l+r,i="up",n=0-l-r),o.selector.style("left",a+"px").style("top",e+"px"),o.arrow||(o.arrow=o.selector.append("div").style("position","absolute")),o.arrow.attr("class","lz-data_layer-tooltip-arrow_"+i).style("left",s+"px").style("top",n+"px")},this}),n.DataLayers.add("forest",function(e){return this.DefaultLayout={point_size:40,point_shape:"square",color:"#888888",fill_opacity:1,y_axis:{axis:2},id_field:"id",confidence_intervals:{start_field:"ci_start",end_field:"ci_end"},show_no_significance_line:!0},e=n.Layouts.merge(e,this.DefaultLayout),n.DataLayer.apply(this,arguments),this.positionTooltip=function(t){if("string"!=typeof t)throw"Unable to position tooltip: id is not a string";if(!this.tooltips[t])throw"Unable to position tooltip: id does not point to a valid tooltip";var e,a,i,n=this.tooltips[t],s=this.resolveScalableParameter(this.layout.point_size,n.data),o=7,r=1,l=6,h=this.getPageOrigin(),d=this.parent.x_scale(n.data[this.layout.x_axis.field]),u="y"+this.layout.y_axis.axis+"_scale",p=this.parent[u](n.data[this.layout.y_axis.field]),c=n.selector.node().getBoundingClientRect(),y=Math.sqrt(s/Math.PI);d<=this.parent.layout.width/2?(e=h.x+d+y+o+r,a="left",i=-1*(o+r)):(e=h.x+d-c.width-y-o-r,a="right",i=c.width-r);var f,g,_=this.parent.layout.height-(this.parent.layout.margin.top+this.parent.layout.margin.bottom);p-c.height/2<=0?(f=h.y+p-1.5*o-l,g=l):p+c.height/2>=_?(f=h.y+p+o+l-c.height,g=c.height-2*o-l):(f=h.y+p-c.height/2,g=c.height/2-o),n.selector.style("left",e+"px").style("top",f+"px"),n.arrow||(n.arrow=n.selector.append("div").style("position","absolute")),n.arrow.attr("class","lz-data_layer-tooltip-arrow_"+a).style("left",i+"px").style("top",g+"px")},this.render=function(){var e="x_scale",a="y"+this.layout.y_axis.axis+"_scale";if(this.layout.confidence_intervals&&this.layout.fields.indexOf(this.layout.confidence_intervals.start_field)!==-1&&this.layout.fields.indexOf(this.layout.confidence_intervals.end_field)!==-1){var i=this.svg.group.selectAll("rect.lz-data_layer-forest.lz-data_layer-forest-ci").data(this.data,function(t){return t[this.layout.id_field]}.bind(this));i.enter().append("rect").attr("class","lz-data_layer-forest lz-data_layer-forest-ci").attr("id",function(t){return this.getElementId(t)+"_ci"}.bind(this)).attr("transform","translate(0,"+(isNaN(this.parent.layout.height)?0:this.parent.layout.height)+")");var n=function(t){var i=this.parent[e](t[this.layout.confidence_intervals.start_field]),n=this.parent[a](t[this.layout.y_axis.field]);return isNaN(i)&&(i=-1e3),isNaN(n)&&(n=-1e3),"translate("+i+","+n+")"}.bind(this),s=function(t){return this.parent[e](t[this.layout.confidence_intervals.end_field])-this.parent[e](t[this.layout.confidence_intervals.start_field])}.bind(this),o=1;this.canTransition()?i.transition().duration(this.layout.transition.duration||0).ease(this.layout.transition.ease||"cubic-in-out").attr("transform",n).attr("width",s).attr("height",o):i.attr("transform",n).attr("width",s).attr("height",o),i.exit().remove()}var r=this.svg.group.selectAll("path.lz-data_layer-forest.lz-data_layer-forest-point").data(this.data,function(t){return t[this.layout.id_field]}.bind(this)),l=isNaN(this.parent.layout.height)?0:this.parent.layout.height;r.enter().append("path").attr("class","lz-data_layer-forest lz-data_layer-forest-point").attr("id",function(t){return this.getElementId(t)+"_point"}.bind(this)).attr("transform","translate(0,"+l+")");var h=function(t){var i=this.parent[e](t[this.layout.x_axis.field]),n=this.parent[a](t[this.layout.y_axis.field]);return isNaN(i)&&(i=-1e3),isNaN(n)&&(n=-1e3),"translate("+i+","+n+")"}.bind(this),d=function(t){return this.resolveScalableParameter(this.layout.color,t)}.bind(this),u=function(t){return this.resolveScalableParameter(this.layout.fill_opacity,t)}.bind(this),p=t.svg.symbol().size(function(t){return this.resolveScalableParameter(this.layout.point_size,t)}.bind(this)).type(function(t){return this.resolveScalableParameter(this.layout.point_shape,t)}.bind(this));this.canTransition()?r.transition().duration(this.layout.transition.duration||0).ease(this.layout.transition.ease||"cubic-in-out").attr("transform",h).attr("fill",d).attr("fill-opacity",u).attr("d",p):r.attr("transform",h).attr("fill",d).attr("fill-opacity",u).attr("d",p),r.exit().remove(),r.on("click.event_emitter",function(t){this.parent.emit("element_clicked",t),this.parent_plot.emit("element_clicked",t)}.bind(this)),this.applyBehaviors(r)},this}),n.DataLayers.add("genes",function(e){return this.DefaultLayout={label_font_size:12,label_exon_spacing:4,exon_height:16,bounding_box_padding:6,track_vertical_spacing:10},e=n.Layouts.merge(e,this.DefaultLayout),n.DataLayer.apply(this,arguments),this.getElementStatusNodeId=function(t){return this.getElementId(t)+"-statusnode"},this.getTrackHeight=function(){return 2*this.layout.bounding_box_padding+this.layout.label_font_size+this.layout.label_exon_spacing+this.layout.exon_height+this.layout.track_vertical_spacing},this.transcript_idx=0,this.tracks=1,this.gene_track_index={1:[]},this.assignTracks=function(){return this.getLabelWidth=function(t,e){try{var a=this.svg.group.append("text").attr("x",0).attr("y",0).attr("class","lz-data_layer-genes lz-label").style("font-size",e).text(t+"→"),i=a.node().getBBox().width;return a.remove(),i}catch(t){return 0}},this.tracks=1,this.gene_track_index={1:[]},this.data.map(function(t,e){if(this.data[e].gene_id&&this.data[e].gene_id.indexOf(".")){var a=this.data[e].gene_id.split(".");this.data[e].gene_id=a[0],this.data[e].gene_version=a[1]}if(this.data[e].transcript_id=this.data[e].transcripts[this.transcript_idx].transcript_id,this.data[e].display_range={start:this.parent.x_scale(Math.max(t.start,this.state.start)),end:this.parent.x_scale(Math.min(t.end,this.state.end))},this.data[e].display_range.label_width=this.getLabelWidth(this.data[e].gene_name,this.layout.label_font_size),this.data[e].display_range.width=this.data[e].display_range.end-this.data[e].display_range.start,this.data[e].display_range.text_anchor="middle",this.data[e].display_range.widththis.state.end)this.data[e].display_range.start=this.data[e].display_range.end-this.data[e].display_range.label_width-this.layout.label_font_size,this.data[e].display_range.text_anchor="end";else{var i=(this.data[e].display_range.label_width-this.data[e].display_range.width)/2+this.layout.label_font_size;this.data[e].display_range.start-ithis.parent.x_scale(this.state.end)?(this.data[e].display_range.end=this.parent.x_scale(this.state.end),this.data[e].display_range.start=this.data[e].display_range.end-this.data[e].display_range.label_width,this.data[e].display_range.text_anchor="end"):(this.data[e].display_range.start-=i,this.data[e].display_range.end+=i)}this.data[e].display_range.width=this.data[e].display_range.end-this.data[e].display_range.start}this.data[e].display_range.start-=this.layout.bounding_box_padding,this.data[e].display_range.end+=this.layout.bounding_box_padding,this.data[e].display_range.width+=2*this.layout.bounding_box_padding,this.data[e].display_domain={start:this.parent.x_scale.invert(this.data[e].display_range.start),end:this.parent.x_scale.invert(this.data[e].display_range.end)},this.data[e].display_domain.width=this.data[e].display_domain.end-this.data[e].display_domain.start,this.data[e].track=null;for(var n=1;null===this.data[e].track;){var s=!1;this.gene_track_index[n].map(function(t){if(!s){var e=Math.min(t.display_range.start,this.display_range.start),a=Math.max(t.display_range.end,this.display_range.end);a-ethis.tracks&&(this.tracks=n,this.gene_track_index[n]=[])):(this.data[e].track=n,this.gene_track_index[n].push(this.data[e]))}this.data[e].parent=this,this.data[e].transcripts.map(function(t,a){this.data[e].transcripts[a].parent=this.data[e],this.data[e].transcripts[a].exons.map(function(t,i){this.data[e].transcripts[a].exons[i].parent=this.data[e].transcripts[a]}.bind(this))}.bind(this))}.bind(this)),this},this.render=function(){this.assignTracks();var e,a,i,n,s=this.svg.group.selectAll("g.lz-data_layer-genes").data(this.data,function(t){return t.gene_name});s.enter().append("g").attr("class","lz-data_layer-genes"),s.attr("id",function(t){return this.getElementId(t)}.bind(this)).each(function(s){var o=s.parent,r=t.select(this).selectAll("rect.lz-data_layer-genes.lz-data_layer-genes-statusnode").data([s],function(t){return o.getElementStatusNodeId(t)});r.enter().append("rect").attr("class","lz-data_layer-genes lz-data_layer-genes-statusnode"),r.attr("id",function(t){return o.getElementStatusNodeId(t)}).attr("rx",function(){return o.layout.bounding_box_padding}).attr("ry",function(){return o.layout.bounding_box_padding}),e=function(t){return t.display_range.width},a=function(){return o.getTrackHeight()-o.layout.track_vertical_spacing},i=function(t){return t.display_range.start},n=function(t){return(t.track-1)*o.getTrackHeight()},o.canTransition()?r.transition().duration(o.layout.transition.duration||0).ease(o.layout.transition.ease||"cubic-in-out").attr("width",e).attr("height",a).attr("x",i).attr("y",n):r.attr("width",e).attr("height",a).attr("x",i).attr("y",n),r.exit().remove();var l=t.select(this).selectAll("rect.lz-data_layer-genes.lz-boundary").data([s],function(t){return t.gene_name+"_boundary"});l.enter().append("rect").attr("class","lz-data_layer-genes lz-boundary"),e=function(t){return o.parent.x_scale(t.end)-o.parent.x_scale(t.start)},a=function(){return 1},i=function(t){return o.parent.x_scale(t.start)},n=function(t){return(t.track-1)*o.getTrackHeight()+o.layout.bounding_box_padding+o.layout.label_font_size+o.layout.label_exon_spacing+Math.max(o.layout.exon_height,3)/2},o.canTransition()?l.transition().duration(o.layout.transition.duration||0).ease(o.layout.transition.ease||"cubic-in-out").attr("width",e).attr("height",a).attr("x",i).attr("y",n):l.attr("width",e).attr("height",a).attr("x",i).attr("y",n),l.exit().remove();var h=t.select(this).selectAll("text.lz-data_layer-genes.lz-label").data([s],function(t){return t.gene_name+"_label"});h.enter().append("text").attr("class","lz-data_layer-genes lz-label"),h.attr("text-anchor",function(t){return t.display_range.text_anchor}).text(function(t){return"+"===t.strand?t.gene_name+"→":"←"+t.gene_name}).style("font-size",s.parent.layout.label_font_size),i=function(t){return"middle"===t.display_range.text_anchor?t.display_range.start+t.display_range.width/2:"start"===t.display_range.text_anchor?t.display_range.start+o.layout.bounding_box_padding:"end"===t.display_range.text_anchor?t.display_range.end-o.layout.bounding_box_padding:void 0},n=function(t){return(t.track-1)*o.getTrackHeight()+o.layout.bounding_box_padding+o.layout.label_font_size},o.canTransition()?h.transition().duration(o.layout.transition.duration||0).ease(o.layout.transition.ease||"cubic-in-out").attr("x",i).attr("y",n):h.attr("x",i).attr("y",n),h.exit().remove();var d=t.select(this).selectAll("rect.lz-data_layer-genes.lz-exon").data(s.transcripts[s.parent.transcript_idx].exons,function(t){return t.exon_id});d.enter().append("rect").attr("class","lz-data_layer-genes lz-exon"),e=function(t){return o.parent.x_scale(t.end)-o.parent.x_scale(t.start)},a=function(){return o.layout.exon_height},i=function(t){return o.parent.x_scale(t.start)},n=function(){return(s.track-1)*o.getTrackHeight()+o.layout.bounding_box_padding+o.layout.label_font_size+o.layout.label_exon_spacing},o.canTransition()?d.transition().duration(o.layout.transition.duration||0).ease(o.layout.transition.ease||"cubic-in-out").attr("width",e).attr("height",a).attr("x",i).attr("y",n):d.attr("width",e).attr("height",a).attr("x",i).attr("y",n),d.exit().remove();var u=t.select(this).selectAll("rect.lz-data_layer-genes.lz-clickarea").data([s],function(t){return t.gene_name+"_clickarea"});u.enter().append("rect").attr("class","lz-data_layer-genes lz-clickarea"),u.attr("id",function(t){return o.getElementId(t)+"_clickarea"}).attr("rx",function(){return o.layout.bounding_box_padding}).attr("ry",function(){return o.layout.bounding_box_padding}),e=function(t){return t.display_range.width},a=function(){return o.getTrackHeight()-o.layout.track_vertical_spacing},i=function(t){return t.display_range.start},n=function(t){return(t.track-1)*o.getTrackHeight()},o.canTransition()?u.transition().duration(o.layout.transition.duration||0).ease(o.layout.transition.ease||"cubic-in-out").attr("width",e).attr("height",a).attr("x",i).attr("y",n):u.attr("width",e).attr("height",a).attr("x",i).attr("y",n),u.exit().remove(),u.on("click.event_emitter",function(t){t.parent.parent.emit("element_clicked",t),t.parent.parent_plot.emit("element_clicked",t)}),o.applyBehaviors(u)}),s.exit().remove()},this.positionTooltip=function(e){if("string"!=typeof e)throw"Unable to position tooltip: id is not a string";if(!this.tooltips[e])throw"Unable to position tooltip: id does not point to a valid tooltip";var a,i,n,s=this.tooltips[e],o=7,r=1,l=this.getPageOrigin(),h=s.selector.node().getBoundingClientRect(),d=this.getElementStatusNodeId(s.data),u=t.select("#"+d).node().getBBox(),p=this.parent.layout.height-(this.parent.layout.margin.top+this.parent.layout.margin.bottom),c=this.parent.layout.width-(this.parent.layout.margin.left+this.parent.layout.margin.right),y=(s.data.display_range.start+s.data.display_range.end)/2-this.layout.bounding_box_padding/2,f=Math.max(h.width/2-y,0),g=Math.max(h.width/2+y-c,0),_=l.x+y-h.width/2-g+f,m=h.width/2-o/2+g-f;h.height+r+o>p-(u.y+u.height)?(a=l.y+u.y-(h.height+r+o),i="down",n=h.height-r):(a=l.y+u.y+u.height+r+o,i="up",n=0-r-o),s.selector.style("left",_+"px").style("top",a+"px"),s.arrow||(s.arrow=s.selector.append("div").style("position","absolute")),s.arrow.attr("class","lz-data_layer-tooltip-arrow_"+i).style("left",m+"px").style("top",n+"px")},this}),n.DataLayers.add("genome_legend",function(t){return this.DefaultLayout={chromosome_fill_colors:{light:"rgb(155, 155, 188)",dark:"rgb(95, 95, 128)"},chromosome_label_colors:{light:"rgb(120, 120, 186)",dark:"rgb(0, 0, 66)"}},t=n.Layouts.merge(t,this.DefaultLayout),n.DataLayer.apply(this,arguments),this.render=function(){var t=0;this.data.forEach(function(e,a){this.data[a].genome_start=t,this.data[a].genome_end=t+e["genome:base_pairs"],t+=e["genome:base_pairs"]}.bind(this));var e=this.svg.group.selectAll("rect.lz-data_layer-genome_legend").data(this.data,function(t){return t["genome:chr"]});e.enter().append("rect").attr("class","lz-data_layer-genome_legend");var a=this,i=this.parent;e.attr("fill",function(t){ return t["genome:chr"]%2?a.layout.chromosome_fill_colors.light:a.layout.chromosome_fill_colors.dark}).attr("x",function(t){return i.x_scale(t.genome_start)}).attr("y",0).attr("width",function(t){return i.x_scale(t["genome:base_pairs"])}).attr("height",i.layout.cliparea.height),e.exit().remove();var n=/([^:]+):(\d+)(?:_.*)?/.exec(this.state.variant);if(!n)throw"Genome legend cannot understand the specified variant position";var s=n[1],o=n[2];t=+this.data[s-1].genome_start+ +o;var r=this.svg.group.selectAll("rect.lz-data_layer-genome_legend-marker").data([{start:t,end:t+1}]);r.enter().append("rect").attr("class","lz-data_layer-genome_legend-marker"),r.transition().duration(500).style({fill:"rgba(255, 250, 50, 0.8)",stroke:"rgba(255, 250, 50, 0.8)","stroke-width":"3px"}).attr("x",function(t){return i.x_scale(t.start)}).attr("y",0).attr("width",function(t){return i.x_scale(t.end-t.start)}).attr("height",i.layout.cliparea.height),r.exit().remove()},this}),n.DataLayers.add("intervals",function(e){return this.DefaultLayout={start_field:"start",end_field:"end",track_split_field:"state_id",track_split_order:"DESC",track_split_legend_to_y_axis:2,split_tracks:!0,track_height:15,track_vertical_spacing:3,bounding_box_padding:2,always_hide_legend:!1,color:"#B8B8B8",fill_opacity:1},e=n.Layouts.merge(e,this.DefaultLayout),n.DataLayer.apply(this,arguments),this.getElementStatusNodeId=function(t){return this.layout.split_tracks?(this.getBaseId()+"-statusnode-"+t[this.layout.track_split_field]).replace(/[:.[\],]/g,"_"):this.getElementId(t)+"-statusnode"}.bind(this),this.getTrackHeight=function(){return this.layout.track_height+this.layout.track_vertical_spacing+2*this.layout.bounding_box_padding},this.tracks=1,this.previous_tracks=1,this.interval_track_index={1:[]},this.assignTracks=function(){if(this.previous_tracks=this.tracks,this.tracks=0,this.interval_track_index={1:[]},this.track_split_field_index={},this.layout.track_split_field&&this.layout.split_tracks){this.data.map(function(t){this.track_split_field_index[t[this.layout.track_split_field]]=null}.bind(this));var t=Object.keys(this.track_split_field_index);"DESC"===this.layout.track_split_order&&t.reverse(),t.forEach(function(t){this.track_split_field_index[t]=this.tracks+1,this.interval_track_index[this.tracks+1]=[],this.tracks++}.bind(this))}return this.data.map(function(t,e){if(this.data[e].parent=this,this.data[e].display_range={start:this.parent.x_scale(Math.max(t[this.layout.start_field],this.state.start)),end:this.parent.x_scale(Math.min(t[this.layout.end_field],this.state.end))},this.data[e].display_range.width=this.data[e].display_range.end-this.data[e].display_range.start,this.data[e].display_domain={start:this.parent.x_scale.invert(this.data[e].display_range.start),end:this.parent.x_scale.invert(this.data[e].display_range.end)},this.data[e].display_domain.width=this.data[e].display_domain.end-this.data[e].display_domain.start,this.layout.track_split_field&&this.layout.split_tracks){var a=this.data[e][this.layout.track_split_field];this.data[e].track=this.track_split_field_index[a],this.interval_track_index[this.data[e].track].push(e)}else{this.tracks=1,this.data[e].track=null;for(var i=1;null===this.data[e].track;){var n=!1;this.interval_track_index[i].map(function(t){if(!n){var e=Math.min(t.display_range.start,this.display_range.start),a=Math.max(t.display_range.end,this.display_range.end);a-ethis.tracks&&(this.tracks=i,this.interval_track_index[i]=[])):(this.data[e].track=i,this.interval_track_index[i].push(this.data[e]))}}}.bind(this)),this},this.render=function(){this.assignTracks(),this.svg.group.selectAll(".lz-data_layer-intervals-statusnode.lz-data_layer-intervals-shared").remove(),Object.keys(this.track_split_field_index).forEach(function(t){var e={};e[this.layout.track_split_field]=t;var a={display:this.layout.split_tracks?null:"none"};this.svg.group.insert("rect",":first-child").attr("id",this.getElementStatusNodeId(e)).attr("class","lz-data_layer-intervals lz-data_layer-intervals-statusnode lz-data_layer-intervals-shared").attr("rx",this.layout.bounding_box_padding).attr("ry",this.layout.bounding_box_padding).attr("width",this.parent.layout.cliparea.width).attr("height",this.getTrackHeight()-this.layout.track_vertical_spacing).attr("x",0).attr("y",(this.track_split_field_index[t]-1)*this.getTrackHeight()).style(a)}.bind(this));var e,a,i,n,s,o,r=this.svg.group.selectAll("g.lz-data_layer-intervals").data(this.data,function(t){return t[this.layout.id_field]}.bind(this));return r.enter().append("g").attr("class","lz-data_layer-intervals"),r.attr("id",function(t){return this.getElementId(t)}.bind(this)).each(function(r){var l=r.parent,h={display:l.layout.split_tracks?"none":null},d=t.select(this).selectAll("rect.lz-data_layer-intervals.lz-data_layer-intervals-statusnode.lz-data_layer-intervals-statusnode-discrete").data([r],function(t){return l.getElementId(t)+"-statusnode"});d.enter().insert("rect",":first-child").attr("class","lz-data_layer-intervals lz-data_layer-intervals-statusnode lz-data_layer-intervals-statusnode-discrete"),d.attr("id",function(t){return l.getElementId(t)+"-statusnode"}).attr("rx",function(){return l.layout.bounding_box_padding}).attr("ry",function(){return l.layout.bounding_box_padding}).style(h),e=function(t){return t.display_range.width+2*l.layout.bounding_box_padding},a=function(){return l.getTrackHeight()-l.layout.track_vertical_spacing},i=function(t){return t.display_range.start-l.layout.bounding_box_padding},n=function(t){return(t.track-1)*l.getTrackHeight()},l.canTransition()?d.transition().duration(l.layout.transition.duration||0).ease(l.layout.transition.ease||"cubic-in-out").attr("width",e).attr("height",a).attr("x",i).attr("y",n):d.attr("width",e).attr("height",a).attr("x",i).attr("y",n),d.exit().remove();var u=t.select(this).selectAll("rect.lz-data_layer-intervals.lz-interval_rect").data([r],function(t){return t[l.layout.id_field]+"_interval_rect"});u.enter().append("rect").attr("class","lz-data_layer-intervals lz-interval_rect"),a=l.layout.track_height,e=function(t){return t.display_range.width},i=function(t){return t.display_range.start},n=function(t){return(t.track-1)*l.getTrackHeight()+l.layout.bounding_box_padding},s=function(t){return l.resolveScalableParameter(l.layout.color,t)},o=function(t){return l.resolveScalableParameter(l.layout.fill_opacity,t)},l.canTransition()?u.transition().duration(l.layout.transition.duration||0).ease(l.layout.transition.ease||"cubic-in-out").attr("width",e).attr("height",a).attr("x",i).attr("y",n).attr("fill",s).attr("fill-opacity",o):u.attr("width",e).attr("height",a).attr("x",i).attr("y",n).attr("fill",s).attr("fill-opacity",o),u.exit().remove();var p=t.select(this).selectAll("rect.lz-data_layer-intervals.lz-clickarea").data([r],function(t){return t.interval_name+"_clickarea"});p.enter().append("rect").attr("class","lz-data_layer-intervals lz-clickarea"),p.attr("id",function(t){return l.getElementId(t)+"_clickarea"}).attr("rx",function(){return l.layout.bounding_box_padding}).attr("ry",function(){return l.layout.bounding_box_padding}),e=function(t){return t.display_range.width},a=function(){return l.getTrackHeight()-l.layout.track_vertical_spacing},i=function(t){return t.display_range.start},n=function(t){return(t.track-1)*l.getTrackHeight()},l.canTransition()?p.transition().duration(l.layout.transition.duration||0).ease(l.layout.transition.ease||"cubic-in-out").attr("width",e).attr("height",a).attr("x",i).attr("y",n):p.attr("width",e).attr("height",a).attr("x",i).attr("y",n),p.exit().remove(),p.on("click",function(t){t.parent.parent.emit("element_clicked",t),t.parent.parent_plot.emit("element_clicked",t)}.bind(this)),l.applyBehaviors(p)}),r.exit().remove(),this.previous_tracks!==this.tracks&&this.updateSplitTrackAxis(),this},this.positionTooltip=function(e){if("string"!=typeof e)throw"Unable to position tooltip: id is not a string";if(!this.tooltips[e])throw"Unable to position tooltip: id does not point to a valid tooltip";var a,i,n,s=this.tooltips[e],o=7,r=1,l=this.getPageOrigin(),h=s.selector.node().getBoundingClientRect(),d=t.select("#"+this.getElementStatusNodeId(s.data)).node().getBBox(),u=this.parent.layout.height-(this.parent.layout.margin.top+this.parent.layout.margin.bottom),p=this.parent.layout.width-(this.parent.layout.margin.left+this.parent.layout.margin.right),c=(s.data.display_range.start+s.data.display_range.end)/2-this.layout.bounding_box_padding/2,y=Math.max(h.width/2-c,0),f=Math.max(h.width/2+c-p,0),g=l.x+c-h.width/2-f+y,_=h.width/2-o/2+f-y;h.height+r+o>u-(d.y+d.height)?(a=l.y+d.y-(h.height+r+o),i="down",n=h.height-r):(a=l.y+d.y+d.height+r+o,i="up",n=0-r-o),s.selector.style("left",g+"px").style("top",a+"px"),s.arrow||(s.arrow=s.selector.append("div").style("position","absolute")),s.arrow.attr("class","lz-data_layer-tooltip-arrow_"+i).style("left",_+"px").style("top",n+"px")},this.updateSplitTrackAxis=function(){var t=!!this.layout.track_split_legend_to_y_axis&&"y"+this.layout.track_split_legend_to_y_axis;if(this.layout.split_tracks){var e=+this.tracks||0,a=+this.layout.track_height||0,i=2*(+this.layout.bounding_box_padding||0)+(+this.layout.track_vertical_spacing||0),n=e*a+(e-1)*i;this.parent.scaleHeightToData(n),t&&this.parent.legend&&(this.parent.legend.hide(),this.parent.layout.axes[t]={render:!0,ticks:[],range:{start:n-this.layout.track_height/2,end:this.layout.track_height/2}},this.layout.legend.forEach(function(a){var i=a[this.layout.track_split_field],n=this.track_split_field_index[i];n&&("DESC"===this.layout.track_split_order&&(n=Math.abs(n-e-1)),this.parent.layout.axes[t].ticks.push({y:n,text:a.label}))}.bind(this)),this.layout.y_axis={axis:this.layout.track_split_legend_to_y_axis,floor:1,ceiling:e},this.parent.render()),this.parent_plot.positionPanels()}else t&&this.parent.legend&&(this.layout.always_hide_legend||this.parent.legend.show(),this.parent.layout.axes[t]={render:!1},this.parent.render());return this},this.toggleSplitTracks=function(){return this.layout.split_tracks=!this.layout.split_tracks,this.parent.legend&&!this.layout.always_hide_legend&&(this.parent.layout.margin.bottom=5+(this.layout.split_tracks?0:this.parent.legend.layout.height+5)),this.render(),this.updateSplitTrackAxis(),this},this}),n.DataLayers.add("line",function(e){return this.DefaultLayout={style:{fill:"none","stroke-width":"2px"},interpolate:"linear",x_axis:{field:"x"},y_axis:{field:"y",axis:1},hitarea_width:5},e=n.Layouts.merge(e,this.DefaultLayout),this.mouse_event=null,this.line=null,this.tooltip_timeout=null,n.DataLayer.apply(this,arguments),this.getMouseDisplayAndData=function(){var e={display:{x:t.mouse(this.mouse_event)[0],y:null},data:{},slope:null},a=this.layout.x_axis.field,i=this.layout.y_axis.field,n="x_scale",s="y"+this.layout.y_axis.axis+"_scale";e.data[a]=this.parent[n].invert(e.display.x);var o=t.bisector(function(t){return+t[a]}).left,r=o(this.data,e.data[a])-1,l=this.data[r],h=this.data[r+1],d=t.interpolateNumber(+l[i],+h[i]),u=+h[a]-+l[a];return e.data[i]=d(e.data[a]%u/u),e.display.y=this.parent[s](e.data[i]),this.layout.tooltip.x_precision&&(e.data[a]=e.data[a].toPrecision(this.layout.tooltip.x_precision)),this.layout.tooltip.y_precision&&(e.data[i]=e.data[i].toPrecision(this.layout.tooltip.y_precision)),e.slope=(this.parent[s](h[i])-this.parent[s](l[i]))/(this.parent[n](h[a])-this.parent[n](l[a])),e},this.positionTooltip=function(t){if("string"!=typeof t)throw"Unable to position tooltip: id is not a string";if(!this.tooltips[t])throw"Unable to position tooltip: id does not point to a valid tooltip";var e,a,i,n,s,o=this.tooltips[t],r=o.selector.node().getBoundingClientRect(),l=7,h=6,d=parseFloat(this.layout.style["stroke-width"])||1,u=this.getPageOrigin(),p=this.parent.layout.height-(this.parent.layout.margin.top+this.parent.layout.margin.bottom),c=this.parent.layout.width-(this.parent.layout.margin.left+this.parent.layout.margin.right),y=this.getMouseDisplayAndData();if(Math.abs(y.slope)>1)y.display.x<=this.parent.layout.width/2?(a=u.x+y.display.x+d+l+d,s="left",n=-1*(l+d)):(a=u.x+y.display.x-r.width-d-l-d,s="right",n=r.width-d),y.display.y-r.height/2<=0?(e=u.y+y.display.y-1.5*l-h,i=h):y.display.y+r.height/2>=p?(e=u.y+y.display.y+l+h-r.height,i=r.height-2*l-h):(e=u.y+y.display.y-r.height/2,i=r.height/2-l);else{var f=Math.max(r.width/2-y.display.x,0),g=Math.max(r.width/2+y.display.x-c,0);a=u.x+y.display.x-r.width/2-g+f;var _=l/2,m=r.width-2.5*l;n=r.width/2-l+g-f,n=Math.min(Math.max(n,_),m),r.height+d+l>y.display.y?(e=u.y+y.display.y+d+l,s="up",i=0-d-l):(e=u.y+y.display.y-(r.height+d+l),s="down",i=r.height-d)}o.selector.style({left:a+"px",top:e+"px"}),o.arrow||(o.arrow=o.selector.append("div").style("position","absolute")),o.arrow.attr("class","lz-data_layer-tooltip-arrow_"+s).style({left:n+"px",top:i+"px"})},this.render=function(){var e=this,a=this.parent,i=this.layout.x_axis.field,n=this.layout.y_axis.field,s="x_scale",o="y"+this.layout.y_axis.axis+"_scale",r=this.svg.group.selectAll("path.lz-data_layer-line").data([this.data]);if(this.path=r.enter().append("path").attr("class","lz-data_layer-line"),this.line=t.svg.line().x(function(t){return parseFloat(a[s](t[i]))}).y(function(t){return parseFloat(a[o](t[n]))}).interpolate(this.layout.interpolate),this.canTransition()?r.transition().duration(this.layout.transition.duration||0).ease(this.layout.transition.ease||"cubic-in-out").attr("d",this.line).style(this.layout.style):r.attr("d",this.line).style(this.layout.style),this.layout.tooltip){var l=parseFloat(this.layout.hitarea_width).toString()+"px",h=this.svg.group.selectAll("path.lz-data_layer-line-hitarea").data([this.data]);h.enter().append("path").attr("class","lz-data_layer-line-hitarea").style("stroke-width",l);var d=t.svg.line().x(function(t){return parseFloat(a[s](t[i]))}).y(function(t){return parseFloat(a[o](t[n]))}).interpolate(this.layout.interpolate);h.attr("d",d).on("mouseover",function(){clearTimeout(e.tooltip_timeout),e.mouse_event=this;var t=e.getMouseDisplayAndData();e.createTooltip(t.data)}).on("mousemove",function(){clearTimeout(e.tooltip_timeout),e.mouse_event=this;var t=e.getMouseDisplayAndData();e.updateTooltip(t.data),e.positionTooltip(e.getElementId())}).on("mouseout",function(){e.tooltip_timeout=setTimeout(function(){e.mouse_event=null,e.destroyTooltip(e.getElementId())},300)}),h.exit().remove()}r.exit().remove()},this.setElementStatus=function(t,e,a){return this.setAllElementStatus(t,a)},this.setElementStatusByFilters=function(t,e){return this.setAllElementStatus(t,e)},this.setAllElementStatus=function(t,e){if("undefined"==typeof t||n.DataLayer.Statuses.adjectives.indexOf(t)===-1)throw"Invalid status passed to DataLayer.setAllElementStatus()";if("undefined"==typeof this.state[this.state_id][t])return this;"undefined"==typeof e&&(e=!0),this.global_statuses[t]=e;var a="lz-data_layer-line";return Object.keys(this.global_statuses).forEach(function(t){this.global_statuses[t]&&(a+=" lz-data_layer-line-"+t)}.bind(this)),this.path.attr("class",a),this.parent.emit("layout_changed"),this.parent_plot.emit("layout_changed"),this},this}),n.DataLayers.add("orthogonal_line",function(e){return this.DefaultLayout={style:{stroke:"#D3D3D3","stroke-width":"3px","stroke-dasharray":"10px 10px"},orientation:"horizontal",x_axis:{axis:1,decoupled:!0},y_axis:{axis:1,decoupled:!0},offset:0},e=n.Layouts.merge(e,this.DefaultLayout),["horizontal","vertical"].indexOf(e.orientation)===-1&&(e.orientation="horizontal"),this.data=[],this.line=null,n.DataLayer.apply(this,arguments),this.render=function(){var e=this.parent,a="x_scale",i="y"+this.layout.y_axis.axis+"_scale",n="x_extent",s="y"+this.layout.y_axis.axis+"_extent",o="x_range",r="y"+this.layout.y_axis.axis+"_range";"horizontal"===this.layout.orientation?this.data=[{x:e[n][0],y:this.layout.offset},{x:e[n][1],y:this.layout.offset}]:this.data=[{x:this.layout.offset,y:e[s][0]},{x:this.layout.offset,y:e[s][1]}];var l=this.svg.group.selectAll("path.lz-data_layer-line").data([this.data]);this.path=l.enter().append("path").attr("class","lz-data_layer-line"),this.line=t.svg.line().x(function(t,i){var n=parseFloat(e[a](t.x));return isNaN(n)?e[o][i]:n}).y(function(t,a){var n=parseFloat(e[i](t.y));return isNaN(n)?e[r][a]:n}).interpolate("linear"),this.canTransition()?l.transition().duration(this.layout.transition.duration||0).ease(this.layout.transition.ease||"cubic-in-out").attr("d",this.line).style(this.layout.style):l.attr("d",this.line).style(this.layout.style),l.exit().remove()},this}),n.DataLayers.add("scatter",function(e){return this.DefaultLayout={point_size:40,point_shape:"circle",tooltip_positioning:"horizontal",color:"#888888",fill_opacity:1,y_axis:{axis:1},id_field:"id"},e=n.Layouts.merge(e,this.DefaultLayout),e.label&&isNaN(e.label.spacing)&&(e.label.spacing=4),n.DataLayer.apply(this,arguments),this.positionTooltip=function(t){if("string"!=typeof t)throw"Unable to position tooltip: id is not a string";if(!this.tooltips[t])throw"Unable to position tooltip: id does not point to a valid tooltip";var e,a,i,n,s,o=this.tooltips[t],r=this.resolveScalableParameter(this.layout.point_size,o.data),l=Math.sqrt(r/Math.PI),h=7,d=1,u=6,p=this.getPageOrigin(),c=this.parent.x_scale(o.data[this.layout.x_axis.field]),y="y"+this.layout.y_axis.axis+"_scale",f=this.parent[y](o.data[this.layout.y_axis.field]),g=o.selector.node().getBoundingClientRect(),_=this.parent.layout.height-(this.parent.layout.margin.top+this.parent.layout.margin.bottom),m=this.parent.layout.width-(this.parent.layout.margin.left+this.parent.layout.margin.right);if("vertical"===this.layout.tooltip_positioning){var b=Math.max(g.width/2-c,0),x=Math.max(g.width/2+c-m,0);a=p.x+c-g.width/2-x+b,s=g.width/2-h/2+x-b-l,g.height+d+h>_-(f+l)?(e=p.y+f-(l+g.height+d+h),i="down",n=g.height-d):(e=p.y+f+l+d+h,i="up",n=0-d-h)}else c<=this.parent.layout.width/2?(a=p.x+c+l+h+d,i="left",s=-1*(h+d)):(a=p.x+c-g.width-l-h-d,i="right",s=g.width-d),_=this.parent.layout.height-(this.parent.layout.margin.top+this.parent.layout.margin.bottom),f-g.height/2<=0?(e=p.y+f-1.5*h-u,n=u):f+g.height/2>=_?(e=p.y+f+h+u-g.height,n=g.height-2*h-u):(e=p.y+f-g.height/2,n=g.height/2-h);o.selector.style("left",a+"px").style("top",e+"px"),o.arrow||(o.arrow=o.selector.append("div").style("position","absolute")),o.arrow.attr("class","lz-data_layer-tooltip-arrow_"+i).style("left",s+"px").style("top",n+"px")},this.flip_labels=function(){var e=this,a=e.resolveScalableParameter(e.layout.point_size,{}),i=e.layout.label.spacing,n=Boolean(e.layout.label.lines),s=2*i,o=e.parent.layout.width-e.parent.layout.margin.left-e.parent.layout.margin.right-2*i,r=function(t,e){var s=+t.attr("x"),o=2*i+2*Math.sqrt(a);if(n)var r=+e.attr("x2"),l=i+2*Math.sqrt(a);"start"===t.style("text-anchor")?(t.style("text-anchor","end"),t.attr("x",s-o),n&&e.attr("x2",r-l)):(t.style("text-anchor","start"),t.attr("x",s+o),n&&e.attr("x2",r+l))};e.label_texts.each(function(a,s){var l=this,h=t.select(l),d=+h.attr("x"),u=h.node().getBoundingClientRect();if(d+u.width+i>o){var p=n?t.select(e.label_lines[0][s]):null;r(h,p)}}),e.label_texts.each(function(a,o){var l=this,h=t.select(l);if("end"!==h.style("text-anchor")){var d=+h.attr("x"),u=h.node().getBoundingClientRect(),p=n?t.select(e.label_lines[0][o]):null;e.label_texts.each(function(){var e=this,a=t.select(e),n=a.node().getBoundingClientRect(),o=u.leftn.left&&u.topn.top;o&&(r(h,p),d=+h.attr("x"),d-u.width-iu.left&&d.topu.top;if(p){n=!0;var c,y=h.attr("y"),f=d.topx?(c=_-+r,_=+r,m-=c):m+u.height/2>x&&(c=m-+y,m=+y,_-=c),o.attr("y",_),h.attr("y",m)}}}})}),n){if(e.layout.label.lines){var s=e.label_texts[0];e.label_lines.attr("y2",function(e,a){var i=t.select(s[a]);return i.attr("y")})}this.seperate_iterations<150&&setTimeout(function(){this.separate_labels()}.bind(this),1)}},this.render=function(){var e=this,a="x_scale",i="y"+this.layout.y_axis.axis+"_scale";if(this.layout.label){var s=this.data.filter(function(t){if(e.layout.label.filters){var a=!0;return e.layout.label.filters.forEach(function(e){var i=new n.Data.Field(e.field).resolve(t);if(isNaN(i))a=!1;else switch(e.operator){case"<":i":i>e.value||(a=!1);break;case">=":i>=e.value||(a=!1);break;case"=":i!==e.value&&(a=!1);break;default:a=!1}}),a}return!0}),o=this;this.label_groups=this.svg.group.selectAll("g.lz-data_layer-"+this.layout.type+"-label").data(s,function(t){return t[o.layout.id_field]+"_label"}),this.label_groups.enter().append("g").attr("class","lz-data_layer-"+this.layout.type+"-label"),this.label_texts&&this.label_texts.remove(),this.label_texts=this.label_groups.append("text").attr("class","lz-data_layer-"+this.layout.type+"-label"),this.label_texts.text(function(t){return n.parseFields(t,e.layout.label.text||"")}).style(e.layout.label.style||{}).attr({x:function(t){var i=e.parent[a](t[e.layout.x_axis.field])+Math.sqrt(e.resolveScalableParameter(e.layout.point_size,t))+e.layout.label.spacing;return isNaN(i)&&(i=-1e3),i},y:function(t){var a=e.parent[i](t[e.layout.y_axis.field]);return isNaN(a)&&(a=-1e3),a},"text-anchor":function(){return"start"}}),e.layout.label.lines&&(this.label_lines&&this.label_lines.remove(),this.label_lines=this.label_groups.append("line").attr("class","lz-data_layer-"+this.layout.type+"-label"),this.label_lines.style(e.layout.label.lines.style||{}).attr({x1:function(t){var i=e.parent[a](t[e.layout.x_axis.field]);return isNaN(i)&&(i=-1e3),i},y1:function(t){var a=e.parent[i](t[e.layout.y_axis.field]);return isNaN(a)&&(a=-1e3),a},x2:function(t){var i=e.parent[a](t[e.layout.x_axis.field])+Math.sqrt(e.resolveScalableParameter(e.layout.point_size,t))+e.layout.label.spacing/2;return isNaN(i)&&(i=-1e3),i},y2:function(t){var a=e.parent[i](t[e.layout.y_axis.field]);return isNaN(a)&&(a=-1e3),a}})),this.label_groups.exit().remove()}var r=this.svg.group.selectAll("path.lz-data_layer-"+this.layout.type).data(this.data,function(t){return t[this.layout.id_field]}.bind(this)),l=isNaN(this.parent.layout.height)?0:this.parent.layout.height;r.enter().append("path").attr("class","lz-data_layer-"+this.layout.type).attr("id",function(t){return this.getElementId(t)}.bind(this)).attr("transform","translate(0,"+l+")");var h=function(t){var e=this.parent[a](t[this.layout.x_axis.field]),n=this.parent[i](t[this.layout.y_axis.field]);return isNaN(e)&&(e=-1e3),isNaN(n)&&(n=-1e3),"translate("+e+","+n+")"}.bind(this),d=function(t){return this.resolveScalableParameter(this.layout.color,t)}.bind(this),u=function(t){return this.resolveScalableParameter(this.layout.fill_opacity,t)}.bind(this),p=t.svg.symbol().size(function(t){return this.resolveScalableParameter(this.layout.point_size,t)}.bind(this)).type(function(t){return this.resolveScalableParameter(this.layout.point_shape,t)}.bind(this));this.canTransition()?r.transition().duration(this.layout.transition.duration||0).ease(this.layout.transition.ease||"cubic-in-out").attr("transform",h).attr("fill",d).attr("fill-opacity",u).attr("d",p):r.attr("transform",h).attr("fill",d).attr("fill-opacity",u).attr("d",p),r.exit().remove(),r.on("click.event_emitter",function(t){this.parent.emit("element_clicked",t),this.parent_plot.emit("element_clicked",t)}.bind(this)),this.applyBehaviors(r),this.layout.label&&(this.flip_labels(),this.seperate_iterations=0,this.separate_labels(),this.applyBehaviors(this.label_texts))},this.makeLDReference=function(t){var e=null;if("undefined"==typeof t)throw"makeLDReference requires one argument of any type";e="object"==typeof t?this.layout.id_field&&"undefined"!=typeof t[this.layout.id_field]?t[this.layout.id_field].toString():"undefined"!=typeof t.id?t.id.toString():t.toString():t.toString(),this.parent_plot.applyState({ldrefvar:e})},this}),n.DataLayers.extend("scatter","category_scatter",{_prepareData:function(){var t=this.layout.x_axis.field||"x",e=this.layout.x_axis.category_field;if(!e)throw"Layout for "+this.layout.id+" must specify category_field";var a=this.data.sort(function(t,a){var i=t[e],n=a[e],s=i.toString?i.toString().toLowerCase():i,o=n.toString?n.toString().toLowerCase():n;return s===o?0:s1?function(t){for(var e=t,n=0;n1?Math.ceil(Math.log(t)/Math.LN10):Math.floor(Math.log(t)/Math.LN10),Math.abs(e)<=3?t.toFixed(3):t.toExponential(2).replace("+","").replace("e"," × 10^")}),n.TransformationFunctions.add("urlencode",function(t){return encodeURIComponent(t)}),n.TransformationFunctions.add("htmlescape",function(t){return t?(t+="",t.replace(/['"<>&`]/g,function(t){switch(t){case"'":return"'";case'"':return""";case"<":return"<";case">":return">";case"&":return"&";case"`":return"`"}})):""}),n.ScaleFunctions=function(){var t={},e={};return t.get=function(t,a,i){if(t){if(e[t])return"undefined"==typeof a&&"undefined"==typeof i?e[t]:e[t](a,i);throw"scale function ["+t+"] not found"}return null},t.set=function(t,a){a?e[t]=a:delete e[t]},t.add=function(a,i){if(e[a])throw"scale function already exists with name: "+a;t.set(a,i)},t.list=function(){return Object.keys(e)},t}(),n.ScaleFunctions.add("if",function(t,e){return"undefined"==typeof e||t.field_value!==e?"undefined"!=typeof t.else?t.else:null:t.then}),n.ScaleFunctions.add("numerical_bin",function(t,e){var a=t.breaks||[],i=t.values||[];if("undefined"==typeof e||null===e||isNaN(+e))return t.null_value?t.null_value:null;var n=a.reduce(function(t,a){return+e=t&&+e=e.breaks[e.breaks.length-1])return n[i.length-1];var o=null;if(i.forEach(function(t,e){e&&i[e-1]<=+a&&i[e]>=+a&&(o=e)}),null===o)return s;var r=(+a-i[o-1])/(i[o]-i[o-1]);return isFinite(r)?t.interpolate(n[o-1],n[o])(r):s}),n.Dashboard=function(t){if(!(t instanceof n.Plot||t instanceof n.Panel))throw"Unable to create dashboard, parent must be a locuszoom plot or panel";return this.parent=t,this.id=this.parent.getBaseId()+".dashboard",this.type=this.parent instanceof n.Plot?"plot":"panel",this.parent_plot="plot"===this.type?this.parent:this.parent.parent,this.selector=null,this.components=[],this.hide_timeout=null,this.persist=!1,this.initialize()},n.Dashboard.prototype.initialize=function(){return Array.isArray(this.parent.layout.dashboard.components)&&this.parent.layout.dashboard.components.forEach(function(t){try{var e=n.Dashboard.Components.get(t.type,t,this);this.components.push(e)}catch(t){console.warn(t)}}.bind(this)),"panel"===this.type&&(t.select(this.parent.parent.svg.node().parentNode).on("mouseover."+this.id,function(){clearTimeout(this.hide_timeout),this.selector&&"hidden"!==this.selector.style("visibility")||this.show()}.bind(this)),t.select(this.parent.parent.svg.node().parentNode).on("mouseout."+this.id,function(){clearTimeout(this.hide_timeout),this.hide_timeout=setTimeout(function(){this.hide()}.bind(this),300)}.bind(this))),this},n.Dashboard.prototype.shouldPersist=function(){if(this.persist)return!0;var t=!1;return this.components.forEach(function(e){t=t||e.shouldPersist()}),t=t||this.parent_plot.panel_boundaries.dragging||this.parent_plot.interaction.dragging,!!t},n.Dashboard.prototype.show=function(){if(!this.selector){switch(this.type){case"plot":this.selector=t.select(this.parent.svg.node().parentNode).insert("div",":first-child");break;case"panel":this.selector=t.select(this.parent.parent.svg.node().parentNode).insert("div",".lz-data_layer-tooltip, .lz-dashboard-menu, .lz-curtain").classed("lz-panel-dashboard",!0); -}this.selector.classed("lz-dashboard",!0).classed("lz-"+this.type+"-dashboard",!0).attr("id",this.id)}return this.components.forEach(function(t){t.show()}),this.selector.style({visibility:"visible"}),this.update()},n.Dashboard.prototype.update=function(){return this.selector?(this.components.forEach(function(t){t.update()}),this.position()):this},n.Dashboard.prototype.position=function(){if(!this.selector)return this;if("panel"===this.type){var t=this.parent.getPageOrigin(),e=(t.y+3.5).toString()+"px",a=t.x.toString()+"px",i=(this.parent.layout.width-4).toString()+"px";this.selector.style({position:"absolute",top:e,left:a,width:i})}return this.components.forEach(function(t){t.position()}),this},n.Dashboard.prototype.hide=function(){return!this.selector||this.shouldPersist()?this:(this.components.forEach(function(t){t.hide()}),this.selector.style({visibility:"hidden"}),this)},n.Dashboard.prototype.destroy=function(t){return"undefined"==typeof t&&(t=!1),this.selector?this.shouldPersist()&&!t?this:(this.components.forEach(function(t){t.destroy(!0)}),this.components=[],this.selector.remove(),this.selector=null,this):this},n.Dashboard.Component=function(t,e){return this.layout=t||{},this.layout.color||(this.layout.color="gray"),this.parent=e||null,this.parent_panel=null,this.parent_plot=null,this.parent_svg=null,this.parent instanceof n.Dashboard&&("panel"===this.parent.type?(this.parent_panel=this.parent.parent,this.parent_plot=this.parent.parent.parent,this.parent_svg=this.parent_panel):(this.parent_plot=this.parent.parent,this.parent_svg=this.parent_plot)),this.selector=null,this.button=null,this.persist=!1,this.layout.position||(this.layout.position="left"),this},n.Dashboard.Component.prototype.show=function(){if(this.parent&&this.parent.selector){if(!this.selector){var t=["start","middle","end"].indexOf(this.layout.group_position)!==-1?" lz-dashboard-group-"+this.layout.group_position:"";this.selector=this.parent.selector.append("div").attr("class","lz-dashboard-"+this.layout.position+t),this.layout.style&&this.selector.style(this.layout.style),"function"==typeof this.initialize&&this.initialize()}return this.button&&"highlighted"===this.button.status&&this.button.menu.show(),this.selector.style({visibility:"visible"}),this.update(),this.position()}},n.Dashboard.Component.prototype.update=function(){},n.Dashboard.Component.prototype.position=function(){return this.button&&this.button.menu.position(),this},n.Dashboard.Component.prototype.shouldPersist=function(){return!!this.persist||!(!this.button||!this.button.persist)},n.Dashboard.Component.prototype.hide=function(){return!this.selector||this.shouldPersist()?this:(this.button&&this.button.menu.hide(),this.selector.style({visibility:"hidden"}),this)},n.Dashboard.Component.prototype.destroy=function(t){return"undefined"==typeof t&&(t=!1),this.selector?this.shouldPersist()&&!t?this:(this.button&&this.button.menu&&this.button.menu.destroy(),this.selector.remove(),this.selector=null,this.button=null,this):this},n.Dashboard.Components=function(){var t={},e={};return t.get=function(t,a,i){if(t){if(e[t]){if("object"!=typeof a)throw"invalid layout argument for dashboard component ["+t+"]";return new e[t](a,i)}throw"dashboard component ["+t+"] not found"}return null},t.set=function(t,a){if(a){if("function"!=typeof a)throw"unable to set dashboard component ["+t+"], argument provided is not a function";e[t]=a,e[t].prototype=new n.Dashboard.Component}else delete e[t]},t.add=function(a,i){if(e[a])throw"dashboard component already exists with name: "+a;t.set(a,i)},t.list=function(){return Object.keys(e)},t}(),n.Dashboard.Component.Button=function(e){if(!(e instanceof n.Dashboard.Component))throw"Unable to create dashboard component button, invalid parent";this.parent=e,this.parent_panel=this.parent.parent_panel,this.parent_plot=this.parent.parent_plot,this.parent_svg=this.parent.parent_svg,this.parent_dashboard=this.parent.parent,this.selector=null,this.tag="a",this.setTag=function(t){return"undefined"!=typeof t&&(this.tag=t.toString()),this},this.html="",this.setHtml=function(t){return"undefined"!=typeof t&&(this.html=t.toString()),this},this.setText=this.setHTML,this.title="",this.setTitle=function(t){return"undefined"!=typeof t&&(this.title=t.toString()),this},this.color="gray",this.setColor=function(t){return"undefined"!=typeof t&&(["gray","red","orange","yellow","green","blue","purple"].indexOf(t)!==-1?this.color=t:this.color="gray"),this},this.style={},this.setStyle=function(t){return"undefined"!=typeof t&&(this.style=t),this},this.getClass=function(){var t=["start","middle","end"].indexOf(this.parent.layout.group_position)!==-1?" lz-dashboard-button-group-"+this.parent.layout.group_position:"";return"lz-dashboard-button lz-dashboard-button-"+this.color+(this.status?"-"+this.status:"")+t},this.persist=!1,this.permanent=!1,this.setPermanent=function(t){return t="undefined"==typeof t||Boolean(t),this.permanent=t,this.permanent&&(this.persist=!0),this},this.shouldPersist=function(){return this.permanent||this.persist},this.status="",this.setStatus=function(t){return"undefined"!=typeof t&&["","highlighted","disabled"].indexOf(t)!==-1&&(this.status=t),this.update()},this.highlight=function(t){return t="undefined"==typeof t||Boolean(t),t?this.setStatus("highlighted"):"highlighted"===this.status?this.setStatus(""):this},this.disable=function(t){return t="undefined"==typeof t||Boolean(t),t?this.setStatus("disabled"):"disabled"===this.status?this.setStatus(""):this},this.onmouseover=function(){},this.setOnMouseover=function(t){return"function"==typeof t?this.onmouseover=t:this.onmouseover=function(){},this},this.onmouseout=function(){},this.setOnMouseout=function(t){return"function"==typeof t?this.onmouseout=t:this.onmouseout=function(){},this},this.onclick=function(){},this.setOnclick=function(t){return"function"==typeof t?this.onclick=t:this.onclick=function(){},this},this.show=function(){if(this.parent)return this.selector||(this.selector=this.parent.selector.append(this.tag).attr("class",this.getClass())),this.update()},this.preUpdate=function(){return this},this.update=function(){return this.selector?(this.preUpdate(),this.selector.attr("class",this.getClass()).attr("title",this.title).style(this.style).on("mouseover","disabled"===this.status?null:this.onmouseover).on("mouseout","disabled"===this.status?null:this.onmouseout).on("click","disabled"===this.status?null:this.onclick).html(this.html),this.menu.update(),this.postUpdate(),this):this},this.postUpdate=function(){return this},this.hide=function(){return this.selector&&!this.shouldPersist()&&(this.selector.remove(),this.selector=null),this},this.menu={outer_selector:null,inner_selector:null,scroll_position:0,hidden:!0,show:function(){return this.menu.outer_selector||(this.menu.outer_selector=t.select(this.parent_plot.svg.node().parentNode).append("div").attr("class","lz-dashboard-menu lz-dashboard-menu-"+this.color).attr("id",this.parent_svg.getBaseId()+".dashboard.menu"),this.menu.inner_selector=this.menu.outer_selector.append("div").attr("class","lz-dashboard-menu-content"),this.menu.inner_selector.on("scroll",function(){this.menu.scroll_position=this.menu.inner_selector.node().scrollTop}.bind(this))),this.menu.outer_selector.style({visibility:"visible"}),this.menu.hidden=!1,this.menu.update()}.bind(this),update:function(){return this.menu.outer_selector?(this.menu.populate(),this.menu.inner_selector&&(this.menu.inner_selector.node().scrollTop=this.menu.scroll_position),this.menu.position()):this.menu}.bind(this),position:function(){if(!this.menu.outer_selector)return this.menu;this.menu.outer_selector.style({height:null});var t=3,e=20,a=14,i=this.parent_svg.getPageOrigin(),n=document.documentElement.scrollTop||document.body.scrollTop,s=this.parent_plot.getContainerOffset(),o=this.parent_dashboard.selector.node().getBoundingClientRect(),r=this.selector.node().getBoundingClientRect(),l=this.menu.outer_selector.node().getBoundingClientRect(),h=this.menu.inner_selector.node().scrollHeight,d=0,u=0;"panel"===this.parent_dashboard.type?(d=i.y+o.height+2*t,u=Math.max(i.x+this.parent_svg.layout.width-l.width-t,i.x+t)):(d=r.bottom+n+t-s.top,u=Math.max(r.left+r.width-l.width-s.left,i.x+t));var p=Math.max(this.parent_svg.layout.width-2*t-e,e),c=p,y=p-4*t,f=Math.max(this.parent_svg.layout.height-10*t-a,a),g=Math.min(h,f),_=f;return this.menu.outer_selector.style({top:d.toString()+"px",left:u.toString()+"px","max-width":c.toString()+"px","max-height":_.toString()+"px",height:g.toString()+"px"}),this.menu.inner_selector.style({"max-width":y.toString()+"px"}),this.menu.inner_selector.node().scrollTop=this.menu.scroll_position,this.menu}.bind(this),hide:function(){return this.menu.outer_selector?(this.menu.outer_selector.style({visibility:"hidden"}),this.menu.hidden=!0,this.menu):this.menu}.bind(this),destroy:function(){return this.menu.outer_selector?(this.menu.inner_selector.remove(),this.menu.outer_selector.remove(),this.menu.inner_selector=null,this.menu.outer_selector=null,this.menu):this.menu}.bind(this),populate:function(){}.bind(this),setPopulate:function(t){return"function"==typeof t?(this.menu.populate=t,this.setOnclick(function(){this.menu.hidden?(this.menu.show(),this.highlight().update(),this.persist=!0):(this.menu.hide(),this.highlight(!1).update(),this.permanent||(this.persist=!1))}.bind(this))):this.setOnclick(),this}.bind(this)}},n.Dashboard.Components.add("title",function(t){n.Dashboard.Component.apply(this,arguments),this.show=function(){return this.div_selector=this.parent.selector.append("div").attr("class","lz-dashboard-title lz-dashboard-"+this.layout.position),this.title_selector=this.div_selector.append("h3"),this.update()},this.update=function(){var e=t.title.toString();return this.layout.subtitle&&(e+=" "+this.layout.subtitle+""),this.title_selector.html(e),this}}),n.Dashboard.Components.add("dimensions",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){var e=this.parent_plot.layout.width.toString().indexOf(".")===-1?this.parent_plot.layout.width:this.parent_plot.layout.width.toFixed(2),a=this.parent_plot.layout.height.toString().indexOf(".")===-1?this.parent_plot.layout.height:this.parent_plot.layout.height.toFixed(2);return this.selector.html(e+"px × "+a+"px"),t.class&&this.selector.attr("class",t.class),t.style&&this.selector.style(t.style),this}}),n.Dashboard.Components.add("region_scale",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){return isNaN(this.parent_plot.state.start)||isNaN(this.parent_plot.state.end)||null===this.parent_plot.state.start||null===this.parent_plot.state.end?this.selector.style("display","none"):(this.selector.style("display",null),this.selector.html(n.positionIntToString(this.parent_plot.state.end-this.parent_plot.state.start,null,!0))),t.class&&this.selector.attr("class",t.class),t.style&&this.selector.style(t.style),this}}),n.Dashboard.Components.add("download",function(a){n.Dashboard.Component.apply(this,arguments),this.update=function(){return this.button?this:(this.button=new n.Dashboard.Component.Button(this).setColor(a.color).setHtml("Download Image").setTitle("Download image of the current plot as locuszoom.svg").setOnMouseover(function(){this.button.selector.classed("lz-dashboard-button-gray-disabled",!0).html("Preparing Image"),this.generateBase64SVG().then(function(t){this.button.selector.attr("href","data:image/svg+xml;base64,\n"+t).classed("lz-dashboard-button-gray-disabled",!1).classed("lz-dashboard-button-gray-highlighted",!0).html("Download Image")}.bind(this))}.bind(this)).setOnMouseout(function(){this.button.selector.classed("lz-dashboard-button-gray-highlighted",!1)}.bind(this)),this.button.show(),this.button.selector.attr("href-lang","image/svg+xml").attr("download","locuszoom.svg"),this)},this.css_string="";for(var i in Object.keys(document.styleSheets))if(null!==document.styleSheets[i].href&&document.styleSheets[i].href.indexOf("locuszoom.css")!==-1){n.createCORSPromise("GET",document.styleSheets[i].href).then(function(t){this.css_string=t.replace(/[\r\n]/g," ").replace(/\s+/g," "),this.css_string.indexOf("/* ! LocusZoom HTML Styles */")&&(this.css_string=this.css_string.substring(0,this.css_string.indexOf("/* ! LocusZoom HTML Styles */")))}.bind(this));break}this.generateBase64SVG=function(){return e.fcall(function(){var e=this.parent.selector.append("div").style("display","none").html(this.parent_plot.svg.node().outerHTML);e.selectAll("g.lz-curtain").remove(),e.selectAll("g.lz-mouse_guide").remove(),e.selectAll("g.tick text").each(function(){var e=10*+t.select(this).attr("dy").substring(-2).slice(0,-2);t.select(this).attr("dy",e)});var a=t.select(e.select("svg").node().parentNode).html(),i='",n=a.indexOf(">")+1;return a=a.slice(0,n)+i+a.slice(n),e.remove(),btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode("0x"+e)}))}.bind(this))}}),n.Dashboard.Components.add("remove_panel",function(e){n.Dashboard.Component.apply(this,arguments),this.update=function(){return this.button?this:(this.button=new n.Dashboard.Component.Button(this).setColor(e.color).setHtml("×").setTitle("Remove panel").setOnclick(function(){if(confirm("Are you sure you want to remove this panel? This cannot be undone!")){var e=this.parent_panel;return e.dashboard.hide(!0),t.select(e.parent.svg.node().parentNode).on("mouseover."+e.getBaseId()+".dashboard",null),t.select(e.parent.svg.node().parentNode).on("mouseout."+e.getBaseId()+".dashboard",null),e.parent.removePanel(e.id)}return!1}.bind(this)),this.button.show(),this)}}),n.Dashboard.Components.add("move_panel_up",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){if(this.button){var e=0===this.parent_panel.layout.y_index;return this.button.disable(e),this}return this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml("▴").setTitle("Move panel up").setOnclick(function(){this.parent_panel.moveUp(),this.update()}.bind(this)),this.button.show(),this.update()}}),n.Dashboard.Components.add("move_panel_down",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){if(this.button){var e=this.parent_panel.layout.y_index===this.parent_plot.panel_ids_by_y_index.length-1;return this.button.disable(e),this}return this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml("▾").setTitle("Move panel down").setOnclick(function(){this.parent_panel.moveDown(),this.update()}.bind(this)),this.button.show(),this.update()}}),n.Dashboard.Components.add("shift_region",function(t){return n.Dashboard.Component.apply(this,arguments),isNaN(this.parent_plot.state.start)||isNaN(this.parent_plot.state.end)?(this.update=function(){},void console.warn("Unable to add shift_region dashboard component: plot state does not have region bounds")):((isNaN(t.step)||0===t.step)&&(t.step=5e4),"string"!=typeof t.button_html&&(t.button_html=t.step>0?">":"<"),"string"!=typeof t.button_title&&(t.button_title="Shift region by "+(t.step>0?"+":"-")+n.positionIntToString(Math.abs(t.step),null,!0)),void(this.update=function(){return this.button?this:(this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml(t.button_html).setTitle(t.button_title).setOnclick(function(){this.parent_plot.applyState({start:Math.max(this.parent_plot.state.start+t.step,1),end:this.parent_plot.state.end+t.step})}.bind(this)),this.button.show(),this)}))}),n.Dashboard.Components.add("zoom_region",function(t){return n.Dashboard.Component.apply(this,arguments),isNaN(this.parent_plot.state.start)||isNaN(this.parent_plot.state.end)?(this.update=function(){},void console.warn("Unable to add zoom_region dashboard component: plot state does not have region bounds")):((isNaN(t.step)||0===t.step)&&(t.step=.2),"string"!=typeof t.button_html&&(t.button_html=t.step>0?"z–":"z+"),"string"!=typeof t.button_title&&(t.button_title="Zoom region "+(t.step>0?"out":"in")+" by "+(100*Math.abs(t.step)).toFixed(1)+"%"),void(this.update=function(){if(this.button){var e=!0,a=this.parent_plot.state.end-this.parent_plot.state.start;return t.step>0&&!isNaN(this.parent_plot.layout.max_region_scale)&&a>=this.parent_plot.layout.max_region_scale&&(e=!1),t.step<0&&!isNaN(this.parent_plot.layout.min_region_scale)&&a<=this.parent_plot.layout.min_region_scale&&(e=!1),this.button.disable(!e),this}return this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml(t.button_html).setTitle(t.button_title).setOnclick(function(){var e=this.parent_plot.state.end-this.parent_plot.state.start,a=1+t.step,i=e*a;isNaN(this.parent_plot.layout.max_region_scale)||(i=Math.min(i,this.parent_plot.layout.max_region_scale)),isNaN(this.parent_plot.layout.min_region_scale)||(i=Math.max(i,this.parent_plot.layout.min_region_scale));var n=Math.floor((i-e)/2);this.parent_plot.applyState({start:Math.max(this.parent_plot.state.start-n,1),end:this.parent_plot.state.end+n})}.bind(this)),this.button.show(),this}))}),n.Dashboard.Components.add("menu",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){return this.button?this:(this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml(t.button_html).setTitle(t.button_title),this.button.menu.setPopulate(function(){this.button.menu.inner_selector.html(t.menu_html)}.bind(this)),this.button.show(),this)}}),n.Dashboard.Components.add("covariates_model",function(t){n.Dashboard.Component.apply(this,arguments),this.initialize=function(){this.parent_plot.state.model=this.parent_plot.state.model||{},this.parent_plot.state.model.covariates=this.parent_plot.state.model.covariates||[],this.parent_plot.CovariatesModel={button:this,add:function(t){var e=JSON.parse(JSON.stringify(t));"object"==typeof t&&"string"!=typeof e.html&&(e.html="function"==typeof t.toHTML?t.toHTML():t.toString());for(var a=0;a1?"covariates":"covariate";t+=" ("+this.parent_plot.state.model.covariates.length+" "+e+")"}this.button.setHtml(t).disable(!1)}.bind(this),this.button.show(),this)}}),n.Dashboard.Components.add("toggle_split_tracks",function(t){if(n.Dashboard.Component.apply(this,arguments),t.data_layer_id||(t.data_layer_id="intervals"),!this.parent_panel.data_layers[t.data_layer_id])throw"Dashboard toggle split tracks component missing valid data layer ID";this.update=function(){var e=this.parent_panel.data_layers[t.data_layer_id],a=e.layout.split_tracks?"Merge Tracks":"Split Tracks";return this.button?(this.button.setHtml(a),this.button.show(),this.parent.position(),this):(this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml(a).setTitle("Toggle whether tracks are split apart or merged together").setOnclick(function(){e.toggleSplitTracks(),this.scale_timeout&&clearTimeout(this.scale_timeout);var t=e.layout.transition?+e.layout.transition.duration||0:0;this.scale_timeout=setTimeout(function(){this.parent_panel.scaleHeightToData(),this.parent_plot.positionPanels()}.bind(this),t),this.update()}.bind(this)),this.update())}}),n.Dashboard.Components.add("resize_to_data",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){return this.button?this:(this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml("Resize to Data").setTitle("Automatically resize this panel to fit the data its currently showing").setOnclick(function(){this.parent_panel.scaleHeightToData(),this.update()}.bind(this)),this.button.show(),this)}}),n.Dashboard.Components.add("toggle_legend",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){var e=this.parent_panel.legend.layout.hidden?"Show Legend":"Hide Legend";return this.button?(this.button.setHtml(e).show(),this.parent.position(),this):(this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setTitle("Show or hide the legend for this panel").setOnclick(function(){this.parent_panel.legend.layout.hidden=!this.parent_panel.legend.layout.hidden,this.parent_panel.legend.render(),this.update()}.bind(this)),this.update())}}),n.Dashboard.Components.add("data_layers",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){return"string"!=typeof t.button_html&&(t.button_html="Data Layers"),"string"!=typeof t.button_title&&(t.button_title="Manipulate Data Layers (sort, dim, show/hide, etc.)"),this.button?this:(this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml(t.button_html).setTitle(t.button_title).setOnclick(function(){this.button.menu.populate()}.bind(this)),this.button.menu.setPopulate(function(){this.button.menu.inner_selector.html("");var e=this.button.menu.inner_selector.append("table");return this.parent_panel.data_layer_ids_by_z_index.slice().reverse().forEach(function(a,i){var s=this.parent_panel.data_layers[a],o="string"!=typeof s.layout.name?s.id:s.layout.name,r=e.append("tr");r.append("td").html(o),t.statuses.forEach(function(t){var e,a,i,o=n.DataLayer.Statuses.adjectives.indexOf(t),l=n.DataLayer.Statuses.verbs[o];s.global_statuses[t]?(e=n.DataLayer.Statuses.menu_antiverbs[o],a="un"+l+"AllElements",i="-highlighted"):(e=n.DataLayer.Statuses.verbs[o],a=l+"AllElements",i=""),r.append("td").append("a").attr("class","lz-dashboard-button lz-dashboard-button-"+this.layout.color+i).style({"margin-left":"0em"}).on("click",function(){s[a](),this.button.menu.populate()}.bind(this)).html(e)}.bind(this));var l=0===i,h=i===this.parent_panel.data_layer_ids_by_z_index.length-1,d=r.append("td");d.append("a").attr("class","lz-dashboard-button lz-dashboard-button-group-start lz-dashboard-button-"+this.layout.color+(h?"-disabled":"")).style({"margin-left":"0em"}).on("click",function(){s.moveDown(),this.button.menu.populate()}.bind(this)).html("▾").attr("title","Move layer down (further back)"),d.append("a").attr("class","lz-dashboard-button lz-dashboard-button-group-middle lz-dashboard-button-"+this.layout.color+(l?"-disabled":"")).style({"margin-left":"0em"}).on("click",function(){s.moveUp(),this.button.menu.populate()}.bind(this)).html("▴").attr("title","Move layer up (further front)"),d.append("a").attr("class","lz-dashboard-button lz-dashboard-button-group-end lz-dashboard-button-red").style({"margin-left":"0em"}).on("click",function(){return confirm("Are you sure you want to remove the "+o+" layer? This cannot be undone!")&&s.parent.removeDataLayer(a),this.button.menu.populate()}.bind(this)).html("×").attr("title","Remove layer")}.bind(this)),this}.bind(this)),this.button.show(),this)}}),n.Dashboard.Components.add("display_options",function(t){"string"!=typeof t.button_html&&(t.button_html="Display options"),"string"!=typeof t.button_title&&(t.button_title="Control how plot items are displayed"),n.Dashboard.Component.apply(this,arguments);var e=t.fields_whitelist||["color","fill_opacity","label","legend","point_shape","point_size","tooltip","tooltip_positioning"],a=this.parent_panel.data_layers[t.layer_name],i=a.layout,s={};e.forEach(function(t){var e=i[t];e&&(s[t]=JSON.parse(JSON.stringify(e)))}),this._selected_item="default";var o=this;this.button=new n.Dashboard.Component.Button(o).setColor(t.color).setHtml(t.button_html).setTitle(t.button_title).setOnclick(function(){o.button.menu.populate()}),this.button.menu.setPopulate(function(){var t=Math.floor(1e4*Math.random()).toString();o.button.menu.inner_selector.html("");var e=o.button.menu.inner_selector.append("table"),i=o.layout,n=function(i,n,s){var r=e.append("tr");r.append("td").append("input").attr({type:"radio",name:"color-picker-"+t,value:s}).property("checked",s===o._selected_item).on("click",function(){Object.keys(n).forEach(function(t){a.layout[t]=n[t]}),o._selected_item=s,o.parent_panel.render();var t=o.parent_panel.legend;t&&n.legend&&t.render()}),r.append("td").text(i)},r=i.default_config_display_name||"Default style";return n(r,s,"default"),i.options.forEach(function(t,e){n(t.display_name,t.display,e)}),o}),this.update=function(){return this.button.show(),this}}),n.Legend=function(t){if(!(t instanceof n.Panel))throw"Unable to create legend, parent must be a locuszoom panel";return this.parent=t,this.id=this.parent.getBaseId()+".legend",this.parent.layout.legend=n.Layouts.merge(this.parent.layout.legend||{},n.Legend.DefaultLayout),this.layout=this.parent.layout.legend,this.selector=null,this.background_rect=null,this.elements=[],this.elements_group=null,this.hidden=!1,this.render()},n.Legend.DefaultLayout={orientation:"vertical",origin:{x:0,y:0},width:10,height:10,padding:5,label_size:12,hidden:!1},n.Legend.prototype.render=function(){this.selector||(this.selector=this.parent.svg.group.append("g").attr("id",this.parent.getBaseId()+".legend").attr("class","lz-legend")),this.background_rect||(this.background_rect=this.selector.append("rect").attr("width",100).attr("height",100).attr("class","lz-legend-background")),this.elements_group||(this.elements_group=this.selector.append("g")),this.elements.forEach(function(t){t.remove()}),this.elements=[];var e=+this.layout.padding||1,a=e,i=e,n=0;this.parent.data_layer_ids_by_z_index.slice().reverse().forEach(function(s){Array.isArray(this.parent.data_layers[s].layout.legend)&&this.parent.data_layers[s].layout.legend.forEach(function(s){var o=this.elements_group.append("g").attr("transform","translate("+a+","+i+")"),r=+s.label_size||+this.layout.label_size||12,l=0,h=r/2+e/2;if(n=Math.max(n,r+e),"line"===s.shape){var d=+s.length||16,u=r/4+e/2;o.append("path").attr("class",s.class||"").attr("d","M0,"+u+"L"+d+","+u).style(s.style||{}),l=d+e}else if("rect"===s.shape){var p=+s.width||16,c=+s.height||p;o.append("rect").attr("class",s.class||"").attr("width",p).attr("height",c).attr("fill",s.color||{}).style(s.style||{}),l=p+e,n=Math.max(n,c+e)}else if(t.svg.symbolTypes.indexOf(s.shape)!==-1){var y=+s.size||40,f=Math.ceil(Math.sqrt(y/Math.PI));o.append("path").attr("class",s.class||"").attr("d",t.svg.symbol().size(y).type(s.shape)).attr("transform","translate("+f+","+(f+e/2)+")").attr("fill",s.color||{}).style(s.style||{}),l=2*f+e,h=Math.max(2*f+e/2,h),n=Math.max(n,2*f+e)}o.append("text").attr("text-anchor","left").attr("class","lz-label").attr("x",l).attr("y",h).style({"font-size":r}).text(s.label);var g=o.node().getBoundingClientRect();if("vertical"===this.layout.orientation)i+=g.height+e,n=0;else{var _=this.layout.origin.x+a+g.width;a>e&&_>this.parent.layout.width&&(i+=n,a=e,o.attr("transform","translate("+a+","+i+")")),a+=g.width+3*e}this.elements.push(o)}.bind(this))}.bind(this));var s=this.elements_group.node().getBoundingClientRect();return this.layout.width=s.width+2*this.layout.padding,this.layout.height=s.height+2*this.layout.padding,this.background_rect.attr("width",this.layout.width).attr("height",this.layout.height),this.selector.style({visibility:this.layout.hidden?"hidden":"visible"}),this.position()},n.Legend.prototype.position=function(){if(!this.selector)return this;var t=this.selector.node().getBoundingClientRect();isNaN(+this.layout.pad_from_bottom)||(this.layout.origin.y=this.parent.layout.height-t.height-+this.layout.pad_from_bottom),isNaN(+this.layout.pad_from_right)||(this.layout.origin.x=this.parent.layout.width-t.width-+this.layout.pad_from_right),this.selector.attr("transform","translate("+this.layout.origin.x+","+this.layout.origin.y+")")},n.Legend.prototype.hide=function(){this.layout.hidden=!0,this.render()},n.Legend.prototype.show=function(){this.layout.hidden=!1,this.render()},n.Data=n.Data||{},n.DataSources=function(){this.sources={}},n.DataSources.prototype.addSource=function(t,e){return console.warn("Warning: .addSource() is deprecated. Use .add() instead"),this.add(t,e)},n.DataSources.prototype.add=function(t,e){return this.set(t,e)},n.DataSources.prototype.set=function(t,e){if(Array.isArray(e)){var a=n.KnownDataSources.create.apply(null,e);this.sources[t]=a}else null!==e?this.sources[t]=e:delete this.sources[t];return this},n.DataSources.prototype.getSource=function(t){return console.warn("Warning: .getSource() is deprecated. Use .get() instead"),this.get(t)},n.DataSources.prototype.get=function(t){return this.sources[t]},n.DataSources.prototype.removeSource=function(t){return console.warn("Warning: .removeSource() is deprecated. Use .remove() instead"),this.remove(t)},n.DataSources.prototype.remove=function(t){return this.set(t,null)},n.DataSources.prototype.fromJSON=function(t){"string"==typeof t&&(t=JSON.parse(t));var e=this;return Object.keys(t).forEach(function(a){e.set(a,t[a])}),e},n.DataSources.prototype.keys=function(){return Object.keys(this.sources)},n.DataSources.prototype.toJSON=function(){return this.sources},n.Data.Field=function(t){var e=/^(?:([^:]+):)?([^:|]*)(\|.+)*$/.exec(t);this.full_name=t,this.namespace=e[1]||null,this.name=e[2]||null,this.transformations=[],"string"==typeof e[3]&&e[3].length>1&&(this.transformations=e[3].substring(1).split("|"),this.transformations.forEach(function(t,e){this.transformations[e]=n.TransformationFunctions.get(t)}.bind(this))),this.applyTransformations=function(t){return this.transformations.forEach(function(e){t=e(t)}),t},this.resolve=function(t){if("undefined"==typeof t[this.full_name]){var e=null;"undefined"!=typeof t[this.namespace+":"+this.name]?e=t[this.namespace+":"+this.name]:"undefined"!=typeof t[this.name]&&(e=t[this.name]),t[this.full_name]=this.applyTransformations(e)}return t[this.full_name]}},n.Data.Requester=function(t){function a(t){var e={},a=/^(?:([^:]+):)?([^:|]*)(\|.+)*$/;return t.forEach(function(t){var i=a.exec(t),s=i[1]||"base",o=i[2],r=n.TransformationFunctions.get(i[3]);"undefined"==typeof e[s]&&(e[s]={outnames:[],fields:[],trans:[]}),e[s].outnames.push(t),e[s].fields.push(o),e[s].trans.push(r)}),e}this.getData=function(i,n){for(var s=a(n),o=Object.keys(s).map(function(e){ -if(!t.get(e))throw"Datasource for namespace "+e+" not found";return t.get(e).getData(i,s[e].fields,s[e].outnames,s[e].trans)}),r=e.when({header:{},body:{}}),l=0;l1&&(2!==e.length||e.indexOf("isrefvar")===-1))throw"LD does not know how to get all fields: "+e.join(", ")},n.Data.LDSource.prototype.findMergeFields=function(t){var e=function(t){return function(){for(var e=arguments,a=0;a0){var i=Object.keys(t.body[0]),n=e(i);a.id=a.id||n(/\bvariant\b/)||n(/\bid\b/),a.position=a.position||n(/\bposition\b/i,/\bpos\b/i),a.pvalue=a.pvalue||n(/\bpvalue\b/i,/\blog_pvalue\b/i),a._names_=i}return a},n.Data.LDSource.prototype.findRequestedFields=function(t,e){for(var a={},i=0;ii&&(i=t[s][e]*a,n=s);return n},n=t.ldrefsource||e.header.ldrefsource||1,s=this.findRequestedFields(a),o=s.ldin;if("state"===o&&(o=t.ldrefvar||e.header.ldrefvar||"best"),"best"===o){if(!e.body)throw"No association data found to find best pvalue";var r=this.findMergeFields(e);if(!r.pvalue||!r.id){var l="";throw r.id||(l+=(l.length?", ":"")+"id"),r.pvalue||(l+=(l.length?", ":"")+"pvalue"),"Unable to find necessary column(s) for merge: "+l+" (available: "+r._names_+")"}o=e.body[i(e.body,r.pvalue)][r.id]}return e.header||(e.header={}),e.header.ldrefvar=o,this.url+"results/?filter=reference eq "+n+" and chromosome2 eq '"+t.chr+"' and position2 ge "+t.start+" and position2 le "+t.end+" and variant1 eq '"+o+"'&fields=chr,pos,rsquare"},n.Data.LDSource.prototype.parseResponse=function(t,e,a,i){var n=JSON.parse(t),s=this.findMergeFields(e),o=this.findRequestedFields(a,i);if(!s.position)throw"Unable to find position field for merge: "+s._names_;var r=function(t,e,a,i){for(var n=0,o=0;n0&&parseFloat(this.panels[i].layout.proportional_height)>0&&(s=Math.max(s,this.panels[i].layout.min_height/this.panels[i].layout.proportional_height));if(this.layout.min_width=Math.max(n,1),this.layout.min_height=Math.max(s,1),t.select(this.svg.node().parentNode).style({"min-width":this.layout.min_width+"px","min-height":this.layout.min_height+"px"}),!isNaN(e)&&e>=0&&!isNaN(a)&&a>=0){this.layout.width=Math.max(Math.round(+e),this.layout.min_width),this.layout.height=Math.max(Math.round(+a),this.layout.min_height),this.layout.aspect_ratio=this.layout.width/this.layout.height,this.layout.responsive_resize&&(this.svg&&(this.layout.width=Math.max(this.svg.node().parentNode.getBoundingClientRect().width,this.layout.min_width)),this.layout.height=this.layout.width/this.layout.aspect_ratio,this.layout.height0)e.layout.y_index<0&&(e.layout.y_index=Math.max(this.panel_ids_by_y_index.length+e.layout.y_index,0)),this.panel_ids_by_y_index.splice(e.layout.y_index,0,e.id),this.applyPanelYIndexesToPanelLayouts();else{var a=this.panel_ids_by_y_index.push(e.id);this.panels[e.id].layout.y_index=a-1}var i=null;return this.layout.panels.forEach(function(t,a){t.id===e.id&&(i=a)}),null===i&&(i=this.layout.panels.push(this.panels[e.id].layout)-1),this.panels[e.id].layout_idx=i,this.initialized&&(this.positionPanels(),this.panels[e.id].initialize(),this.panels[e.id].reMap(),this.setDimensions(this.layout.width,this.layout.height)),this.panels[e.id]},n.Plot.prototype.clearPanelData=function(t,e){e=e||"wipe";var a;a=t?[t]:Object.keys(this.panels);var i=this;return a.forEach(function(t){i.panels[t].data_layer_ids_by_z_index.forEach(function(a){var n=i.panels[t].data_layers[a];n.destroyAllTooltips(),delete i.layout.state[t+"."+a],"reset"===e&&n.setDefaultState()})}),this},n.Plot.prototype.removePanel=function(t){if(!this.panels[t])throw"Unable to remove panel, ID not found: "+t;return this.panel_boundaries.hide(),this.clearPanelData(t),this.panels[t].loader.hide(),this.panels[t].dashboard.destroy(!0),this.panels[t].curtain.hide(),this.panels[t].svg.container&&this.panels[t].svg.container.remove(),this.layout.panels.splice(this.panels[t].layout_idx,1),delete this.panels[t],delete this.layout.state[t],this.layout.panels.forEach(function(t,e){this.panels[t.id].layout_idx=e}.bind(this)),this.panel_ids_by_y_index.splice(this.panel_ids_by_y_index.indexOf(t),1),this.applyPanelYIndexesToPanelLayouts(),this.initialized&&(this.layout.min_height=this._base_layout.min_height,this.layout.min_width=this._base_layout.min_width,this.positionPanels(),this.setDimensions(this.layout.width,this.layout.height)),this},n.Plot.prototype.positionPanels=function(){var t,e={left:0,right:0};for(t in this.panels)null===this.panels[t].layout.proportional_height&&(this.panels[t].layout.proportional_height=this.panels[t].layout.height/this.layout.height),null===this.panels[t].layout.proportional_width&&(this.panels[t].layout.proportional_width=1),this.panels[t].layout.interaction.x_linked&&(e.left=Math.max(e.left,this.panels[t].layout.margin.left),e.right=Math.max(e.right,this.panels[t].layout.margin.right));var a=this.sumProportional("height");if(!a)return this;var i=1/a;for(t in this.panels)this.panels[t].layout.proportional_height*=i;var n=0;this.panel_ids_by_y_index.forEach(function(t){if(this.panels[t].setOrigin(0,n),this.panels[t].layout.proportional_origin.x=0,n+=this.panels[t].layout.height,this.panels[t].layout.interaction.x_linked){var a=Math.max(e.left-this.panels[t].layout.margin.left,0)+Math.max(e.right-this.panels[t].layout.margin.right,0);this.panels[t].layout.width+=a,this.panels[t].layout.margin.left=e.left,this.panels[t].layout.margin.right=e.right,this.panels[t].layout.cliparea.origin.x=e.left}}.bind(this));var s=n;return this.panel_ids_by_y_index.forEach(function(t){this.panels[t].layout.proportional_origin.y=this.panels[t].layout.origin.y/s}.bind(this)),this.setDimensions(),this.panel_ids_by_y_index.forEach(function(t){this.panels[t].setDimensions(this.layout.width*this.panels[t].layout.proportional_width,this.layout.height*this.panels[t].layout.proportional_height)}.bind(this)),this},n.Plot.prototype.initialize=function(){if(this.layout.responsive_resize&&t.select(this.container).classed("lz-container-responsive",!0),this.layout.mouse_guide){var e=this.svg.append("g").attr("class","lz-mouse_guide").attr("id",this.id+".mouse_guide"),a=e.append("rect").attr("class","lz-mouse_guide-vertical").attr("x",-1),i=e.append("rect").attr("class","lz-mouse_guide-horizontal").attr("y",-1);this.mouse_guide={svg:e,vertical:a,horizontal:i}}this.curtain=n.generateCurtain.call(this),this.loader=n.generateLoader.call(this),this.panel_boundaries={parent:this,hide_timeout:null,showing:!1,dragging:!1,selectors:[],corner_selector:null,show:function(){if(!this.showing&&!this.parent.curtain.showing){this.showing=!0,this.parent.panel_ids_by_y_index.forEach(function(e,a){var i=t.select(this.parent.svg.node().parentNode).insert("div",".lz-data_layer-tooltip").attr("class","lz-panel-boundary").attr("title","Resize panel");i.append("span");var n=t.behavior.drag();n.on("dragstart",function(){this.dragging=!0}.bind(this)),n.on("dragend",function(){this.dragging=!1}.bind(this)),n.on("drag",function(){var e=this.parent.panels[this.parent.panel_ids_by_y_index[a]],i=e.layout.height;e.setDimensions(e.layout.width,e.layout.height+t.event.dy);var n=e.layout.height-i,s=this.parent.layout.height+n;this.parent.panel_ids_by_y_index.forEach(function(t,e){var i=this.parent.panels[this.parent.panel_ids_by_y_index[e]];i.layout.proportional_height=i.layout.height/s,e>a&&(i.setOrigin(i.layout.origin.x,i.layout.origin.y+n),i.dashboard.position())}.bind(this)),this.parent.positionPanels(),this.position()}.bind(this)),i.call(n),this.parent.panel_boundaries.selectors.push(i)}.bind(this));var e=t.select(this.parent.svg.node().parentNode).insert("div",".lz-data_layer-tooltip").attr("class","lz-panel-corner-boundary").attr("title","Resize plot");e.append("span").attr("class","lz-panel-corner-boundary-outer"),e.append("span").attr("class","lz-panel-corner-boundary-inner");var a=t.behavior.drag();a.on("dragstart",function(){this.dragging=!0}.bind(this)),a.on("dragend",function(){this.dragging=!1}.bind(this)),a.on("drag",function(){this.setDimensions(this.layout.width+t.event.dx,this.layout.height+t.event.dy)}.bind(this.parent)),e.call(a),this.parent.panel_boundaries.corner_selector=e}return this.position()},position:function(){if(!this.showing)return this;var t=this.parent.getPageOrigin();this.selectors.forEach(function(e,a){var i=this.parent.panels[this.parent.panel_ids_by_y_index[a]].getPageOrigin(),n=t.x,s=i.y+this.parent.panels[this.parent.panel_ids_by_y_index[a]].layout.height-12,o=this.parent.layout.width-1;e.style({top:s+"px",left:n+"px",width:o+"px"}),e.select("span").style({width:o+"px"})}.bind(this));var e=10,a=16;return this.corner_selector.style({top:t.y+this.parent.layout.height-e-a+"px",left:t.x+this.parent.layout.width-e-a+"px"}),this},hide:function(){return this.showing?(this.showing=!1,this.selectors.forEach(function(t){t.remove()}),this.selectors=[],this.corner_selector.remove(),this.corner_selector=null,this):this}},this.layout.panel_boundaries&&(t.select(this.svg.node().parentNode).on("mouseover."+this.id+".panel_boundaries",function(){clearTimeout(this.panel_boundaries.hide_timeout),this.panel_boundaries.show()}.bind(this)),t.select(this.svg.node().parentNode).on("mouseout."+this.id+".panel_boundaries",function(){this.panel_boundaries.hide_timeout=setTimeout(function(){this.panel_boundaries.hide()}.bind(this),300)}.bind(this))),this.dashboard=new n.Dashboard(this).show();for(var s in this.panels)this.panels[s].initialize();var o="."+this.id;if(this.layout.mouse_guide){var r=function(){this.mouse_guide.vertical.attr("x",-1),this.mouse_guide.horizontal.attr("y",-1)}.bind(this),l=function(){var e=t.mouse(this.svg.node());this.mouse_guide.vertical.attr("x",e[0]),this.mouse_guide.horizontal.attr("y",e[1])}.bind(this);this.svg.on("mouseout"+o+"-mouse_guide",r).on("touchleave"+o+"-mouse_guide",r).on("mousemove"+o+"-mouse_guide",l)}var h=function(){this.stopDrag()}.bind(this),d=function(){if(this.interaction.dragging){var e=t.mouse(this.svg.node());t.event&&t.event.preventDefault(),this.interaction.dragging.dragged_x=e[0]-this.interaction.dragging.start_x,this.interaction.dragging.dragged_y=e[1]-this.interaction.dragging.start_y,this.panels[this.interaction.panel_id].render(),this.interaction.linked_panel_ids.forEach(function(t){this.panels[t].render()}.bind(this))}}.bind(this);this.svg.on("mouseup"+o,h).on("touchend"+o,h).on("mousemove"+o,d).on("touchmove"+o,d),t.select("body").empty()||t.select("body").on("mouseup"+o,h).on("touchend"+o,h),this.initialized=!0;var u=this.svg.node().getBoundingClientRect(),p=u.width?u.width:this.layout.width,c=u.height?u.height:this.layout.height;return this.setDimensions(p,c),this},n.Plot.prototype.refresh=function(){return this.applyState()},n.Plot.prototype.applyState=function(t){if(t=t||{},"object"!=typeof t)throw"LocusZoom.applyState only accepts an object; "+typeof t+" given";var a=JSON.parse(JSON.stringify(this.state));for(var i in t)a[i]=t[i];a=n.validateState(a,this.layout);for(i in a)this.state[i]=a[i];this.emit("data_requested"),this.remap_promises=[],this.loading_data=!0;for(var s in this.panels)this.remap_promises.push(this.panels[s].reMap());return e.all(this.remap_promises).catch(function(t){console.error(t),this.curtain.drop(t),this.loading_data=!1}.bind(this)).then(function(){this.dashboard.update(),this.panel_ids_by_y_index.forEach(function(t){var e=this.panels[t];e.dashboard.update(),e.data_layer_ids_by_z_index.forEach(function(e){var a=this.data_layers[e],i=t+"."+e;for(var n in this.state[i])this.state[i].hasOwnProperty(n)&&Array.isArray(this.state[i][n])&&this.state[i][n].forEach(function(t){try{this.setElementStatus(n,this.getElementById(t),!0)}catch(t){console.error("Unable to apply state: "+i+", "+n)}}.bind(a))}.bind(e))}.bind(this)),this.emit("layout_changed"),this.emit("data_rendered"),this.loading_data=!1}.bind(this))},n.Plot.prototype.startDrag=function(e,a){e=e||null,a=a||null;var i=null;switch(a){case"background":case"x_tick":i="x";break;case"y1_tick":i="y1";break;case"y2_tick":i="y2"}if(!(e instanceof n.Panel&&i&&this.canInteract()))return this.stopDrag();var s=t.mouse(this.svg.node());return this.interaction={panel_id:e.id,linked_panel_ids:e.getLinkedPanelIds(i),dragging:{method:a,start_x:s[0],start_y:s[1],dragged_x:0,dragged_y:0,axis:i}},this.svg.style("cursor","all-scroll"),this},n.Plot.prototype.stopDrag=function(){if(!this.interaction.dragging)return this;if("object"!=typeof this.panels[this.interaction.panel_id])return this.interaction={},this;var t=this.panels[this.interaction.panel_id],e=function(e,a,i){t.data_layer_ids_by_z_index.forEach(function(n){t.data_layers[n].layout[e+"_axis"].axis===a&&(t.data_layers[n].layout[e+"_axis"].floor=i[0],t.data_layers[n].layout[e+"_axis"].ceiling=i[1],delete t.data_layers[n].layout[e+"_axis"].lower_buffer,delete t.data_layers[n].layout[e+"_axis"].upper_buffer,delete t.data_layers[n].layout[e+"_axis"].min_extent,delete t.data_layers[n].layout[e+"_axis"].ticks)})};switch(this.interaction.dragging.method){case"background":case"x_tick":0!==this.interaction.dragging.dragged_x&&(e("x",1,t.x_extent),this.applyState({start:t.x_extent[0],end:t.x_extent[1]}));break;case"y1_tick":case"y2_tick":if(0!==this.interaction.dragging.dragged_y){var a=parseInt(this.interaction.dragging.method[1]);e("y",a,t["y"+a+"_extent"])}}return this.interaction={},this.svg.style("cursor",null),this},n.Panel=function(t,e){if("object"!=typeof t)throw"Unable to create panel, invalid layout";if(this.parent=e||null,this.parent_plot=e,"string"==typeof t.id&&t.id.length){if(this.parent&&"undefined"!=typeof this.parent.panels[t.id])throw"Cannot create panel with id ["+t.id+"]; panel with that id already exists"}else if(this.parent){var a=null,i=function(){a="p"+Math.floor(Math.random()*Math.pow(10,8)),null!=a&&"undefined"==typeof this.parent.panels[a]||(a=i())}.bind(this);t.id=a}else t.id="p"+Math.floor(Math.random()*Math.pow(10,8));return this.id=t.id,this.initialized=!1,this.layout_idx=null,this.svg={},this.layout=n.Layouts.merge(t||{},n.Panel.DefaultLayout),this.parent?(this.state=this.parent.state,this.state_id=this.id,this.state[this.state_id]=this.state[this.state_id]||{}):(this.state=null,this.state_id=null),this.data_layers={},this.data_layer_ids_by_z_index=[],this.applyDataLayerZIndexesToDataLayerLayouts=function(){this.data_layer_ids_by_z_index.forEach(function(t,e){this.data_layers[t].layout.z_index=e}.bind(this))}.bind(this),this.data_promises=[],this.x_scale=null,this.y1_scale=null,this.y2_scale=null,this.x_extent=null,this.y1_extent=null,this.y2_extent=null,this.x_ticks=[],this.y1_ticks=[],this.y2_ticks=[],this.zoom_timeout=null,this.getBaseId=function(){return this.parent.id+"."+this.id},this.event_hooks={layout_changed:[],data_requested:[],data_rendered:[],element_clicked:[]},this.on=function(t,e){if(!Array.isArray(this.event_hooks[t]))throw"Unable to register event hook, invalid event: "+t.toString();if("function"!=typeof e)throw"Unable to register event hook, invalid hook function passed";return this.event_hooks[t].push(e),this},this.emit=function(t,e){if(!Array.isArray(this.event_hooks[t]))throw"LocusZoom attempted to throw an invalid event: "+t.toString();return e=e||this,this.event_hooks[t].forEach(function(t){t.call(e)}),this},this.getPageOrigin=function(){var t=this.parent.getPageOrigin();return{x:t.x+this.layout.origin.x,y:t.y+this.layout.origin.y}},this.initializeLayout(),this},n.Panel.DefaultLayout={title:{text:"",style:{},x:10,y:22},y_index:null,width:0,height:0,origin:{x:0,y:null},min_width:1,min_height:1,proportional_width:null,proportional_height:null,proportional_origin:{x:0,y:null},margin:{top:0,right:0,bottom:0,left:0},background_click:"clear_selections",dashboard:{components:[]},cliparea:{height:0,width:0,origin:{x:0,y:0}},axes:{x:{},y1:{},y2:{}},legend:null,interaction:{drag_background_to_pan:!1,drag_x_ticks_to_scale:!1,drag_y1_ticks_to_scale:!1,drag_y2_ticks_to_scale:!1,scroll_to_zoom:!1,x_linked:!1,y1_linked:!1,y2_linked:!1},data_layers:[]},n.Panel.prototype.initializeLayout=function(){if(0===this.layout.width&&null===this.layout.proportional_width&&(this.layout.proportional_width=1),0===this.layout.height&&null===this.layout.proportional_height){var t=Object.keys(this.parent.panels).length;t>0?this.layout.proportional_height=1/t:this.layout.proportional_height=1}return this.setDimensions(),this.setOrigin(),this.setMargin(),this.x_range=[0,this.layout.cliparea.width],this.y1_range=[this.layout.cliparea.height,0],this.y2_range=[this.layout.cliparea.height,0],["x","y1","y2"].forEach(function(t){Object.keys(this.layout.axes[t]).length&&this.layout.axes[t].render!==!1?(this.layout.axes[t].render=!0,this.layout.axes[t].label=this.layout.axes[t].label||null,this.layout.axes[t].label_function=this.layout.axes[t].label_function||null):this.layout.axes[t].render=!1}.bind(this)),this.layout.data_layers.forEach(function(t){this.addDataLayer(t)}.bind(this)),this},n.Panel.prototype.setDimensions=function(t,e){return"undefined"!=typeof t&&"undefined"!=typeof e?!isNaN(t)&&t>=0&&!isNaN(e)&&e>=0&&(this.layout.width=Math.max(Math.round(+t),this.layout.min_width),this.layout.height=Math.max(Math.round(+e),this.layout.min_height)):(null!==this.layout.proportional_width&&(this.layout.width=Math.max(this.layout.proportional_width*this.parent.layout.width,this.layout.min_width)),null!==this.layout.proportional_height&&(this.layout.height=Math.max(this.layout.proportional_height*this.parent.layout.height,this.layout.min_height))),this.layout.cliparea.width=Math.max(this.layout.width-(this.layout.margin.left+this.layout.margin.right),0),this.layout.cliparea.height=Math.max(this.layout.height-(this.layout.margin.top+this.layout.margin.bottom),0),this.svg.clipRect&&this.svg.clipRect.attr("width",this.layout.width).attr("height",this.layout.height),this.initialized&&(this.render(),this.curtain.update(),this.loader.update(),this.dashboard.update(),this.legend&&this.legend.position()),this},n.Panel.prototype.setOrigin=function(t,e){return!isNaN(t)&&t>=0&&(this.layout.origin.x=Math.max(Math.round(+t),0)),!isNaN(e)&&e>=0&&(this.layout.origin.y=Math.max(Math.round(+e),0)),this.initialized&&this.render(),this},n.Panel.prototype.setMargin=function(t,e,a,i){var n;return!isNaN(t)&&t>=0&&(this.layout.margin.top=Math.max(Math.round(+t),0)),!isNaN(e)&&e>=0&&(this.layout.margin.right=Math.max(Math.round(+e),0)),!isNaN(a)&&a>=0&&(this.layout.margin.bottom=Math.max(Math.round(+a),0)),!isNaN(i)&&i>=0&&(this.layout.margin.left=Math.max(Math.round(+i),0)),this.layout.margin.top+this.layout.margin.bottom>this.layout.height&&(n=Math.floor((this.layout.margin.top+this.layout.margin.bottom-this.layout.height)/2),this.layout.margin.top-=n,this.layout.margin.bottom-=n),this.layout.margin.left+this.layout.margin.right>this.layout.width&&(n=Math.floor((this.layout.margin.left+this.layout.margin.right-this.layout.width)/2),this.layout.margin.left-=n,this.layout.margin.right-=n),["top","right","bottom","left"].forEach(function(t){this.layout.margin[t]=Math.max(this.layout.margin[t],0)}.bind(this)),this.layout.cliparea.width=Math.max(this.layout.width-(this.layout.margin.left+this.layout.margin.right),0), +}this.selector.classed("lz-dashboard",!0).classed("lz-"+this.type+"-dashboard",!0).attr("id",this.id)}return this.components.forEach(function(t){t.show()}),this.selector.style({visibility:"visible"}),this.update()},n.Dashboard.prototype.update=function(){return this.selector?(this.components.forEach(function(t){t.update()}),this.position()):this},n.Dashboard.prototype.position=function(){if(!this.selector)return this;if("panel"===this.type){var t=this.parent.getPageOrigin(),e=(t.y+3.5).toString()+"px",a=t.x.toString()+"px",i=(this.parent.layout.width-4).toString()+"px";this.selector.style({position:"absolute",top:e,left:a,width:i})}return this.components.forEach(function(t){t.position()}),this},n.Dashboard.prototype.hide=function(){return!this.selector||this.shouldPersist()?this:(this.components.forEach(function(t){t.hide()}),this.selector.style({visibility:"hidden"}),this)},n.Dashboard.prototype.destroy=function(t){return"undefined"==typeof t&&(t=!1),this.selector?this.shouldPersist()&&!t?this:(this.components.forEach(function(t){t.destroy(!0)}),this.components=[],this.selector.remove(),this.selector=null,this):this},n.Dashboard.Component=function(t,e){return this.layout=t||{},this.layout.color||(this.layout.color="gray"),this.parent=e||null,this.parent_panel=null,this.parent_plot=null,this.parent_svg=null,this.parent instanceof n.Dashboard&&("panel"===this.parent.type?(this.parent_panel=this.parent.parent,this.parent_plot=this.parent.parent.parent,this.parent_svg=this.parent_panel):(this.parent_plot=this.parent.parent,this.parent_svg=this.parent_plot)),this.selector=null,this.button=null,this.persist=!1,this.layout.position||(this.layout.position="left"),this},n.Dashboard.Component.prototype.show=function(){if(this.parent&&this.parent.selector){if(!this.selector){var t=["start","middle","end"].indexOf(this.layout.group_position)!==-1?" lz-dashboard-group-"+this.layout.group_position:"";this.selector=this.parent.selector.append("div").attr("class","lz-dashboard-"+this.layout.position+t),this.layout.style&&this.selector.style(this.layout.style),"function"==typeof this.initialize&&this.initialize()}return this.button&&"highlighted"===this.button.status&&this.button.menu.show(),this.selector.style({visibility:"visible"}),this.update(),this.position()}},n.Dashboard.Component.prototype.update=function(){},n.Dashboard.Component.prototype.position=function(){return this.button&&this.button.menu.position(),this},n.Dashboard.Component.prototype.shouldPersist=function(){return!!this.persist||!(!this.button||!this.button.persist)},n.Dashboard.Component.prototype.hide=function(){return!this.selector||this.shouldPersist()?this:(this.button&&this.button.menu.hide(),this.selector.style({visibility:"hidden"}),this)},n.Dashboard.Component.prototype.destroy=function(t){return"undefined"==typeof t&&(t=!1),this.selector?this.shouldPersist()&&!t?this:(this.button&&this.button.menu&&this.button.menu.destroy(),this.selector.remove(),this.selector=null,this.button=null,this):this},n.Dashboard.Components=function(){var t={},e={};return t.get=function(t,a,i){if(t){if(e[t]){if("object"!=typeof a)throw"invalid layout argument for dashboard component ["+t+"]";return new e[t](a,i)}throw"dashboard component ["+t+"] not found"}return null},t.set=function(t,a){if(a){if("function"!=typeof a)throw"unable to set dashboard component ["+t+"], argument provided is not a function";e[t]=a,e[t].prototype=new n.Dashboard.Component}else delete e[t]},t.add=function(a,i){if(e[a])throw"dashboard component already exists with name: "+a;t.set(a,i)},t.list=function(){return Object.keys(e)},t}(),n.Dashboard.Component.Button=function(e){if(!(e instanceof n.Dashboard.Component))throw"Unable to create dashboard component button, invalid parent";this.parent=e,this.parent_panel=this.parent.parent_panel,this.parent_plot=this.parent.parent_plot,this.parent_svg=this.parent.parent_svg,this.parent_dashboard=this.parent.parent,this.selector=null,this.tag="a",this.setTag=function(t){return"undefined"!=typeof t&&(this.tag=t.toString()),this},this.html="",this.setHtml=function(t){return"undefined"!=typeof t&&(this.html=t.toString()),this},this.setText=this.setHTML,this.title="",this.setTitle=function(t){return"undefined"!=typeof t&&(this.title=t.toString()),this},this.color="gray",this.setColor=function(t){return"undefined"!=typeof t&&(["gray","red","orange","yellow","green","blue","purple"].indexOf(t)!==-1?this.color=t:this.color="gray"),this},this.style={},this.setStyle=function(t){return"undefined"!=typeof t&&(this.style=t),this},this.getClass=function(){var t=["start","middle","end"].indexOf(this.parent.layout.group_position)!==-1?" lz-dashboard-button-group-"+this.parent.layout.group_position:"";return"lz-dashboard-button lz-dashboard-button-"+this.color+(this.status?"-"+this.status:"")+t},this.persist=!1,this.permanent=!1,this.setPermanent=function(t){return t="undefined"==typeof t||Boolean(t),this.permanent=t,this.permanent&&(this.persist=!0),this},this.shouldPersist=function(){return this.permanent||this.persist},this.status="",this.setStatus=function(t){return"undefined"!=typeof t&&["","highlighted","disabled"].indexOf(t)!==-1&&(this.status=t),this.update()},this.highlight=function(t){return t="undefined"==typeof t||Boolean(t),t?this.setStatus("highlighted"):"highlighted"===this.status?this.setStatus(""):this},this.disable=function(t){return t="undefined"==typeof t||Boolean(t),t?this.setStatus("disabled"):"disabled"===this.status?this.setStatus(""):this},this.onmouseover=function(){},this.setOnMouseover=function(t){return"function"==typeof t?this.onmouseover=t:this.onmouseover=function(){},this},this.onmouseout=function(){},this.setOnMouseout=function(t){return"function"==typeof t?this.onmouseout=t:this.onmouseout=function(){},this},this.onclick=function(){},this.setOnclick=function(t){return"function"==typeof t?this.onclick=t:this.onclick=function(){},this},this.show=function(){if(this.parent)return this.selector||(this.selector=this.parent.selector.append(this.tag).attr("class",this.getClass())),this.update()},this.preUpdate=function(){return this},this.update=function(){return this.selector?(this.preUpdate(),this.selector.attr("class",this.getClass()).attr("title",this.title).style(this.style).on("mouseover","disabled"===this.status?null:this.onmouseover).on("mouseout","disabled"===this.status?null:this.onmouseout).on("click","disabled"===this.status?null:this.onclick).html(this.html),this.menu.update(),this.postUpdate(),this):this},this.postUpdate=function(){return this},this.hide=function(){return this.selector&&!this.shouldPersist()&&(this.selector.remove(),this.selector=null),this},this.menu={outer_selector:null,inner_selector:null,scroll_position:0,hidden:!0,show:function(){return this.menu.outer_selector||(this.menu.outer_selector=t.select(this.parent_plot.svg.node().parentNode).append("div").attr("class","lz-dashboard-menu lz-dashboard-menu-"+this.color).attr("id",this.parent_svg.getBaseId()+".dashboard.menu"),this.menu.inner_selector=this.menu.outer_selector.append("div").attr("class","lz-dashboard-menu-content"),this.menu.inner_selector.on("scroll",function(){this.menu.scroll_position=this.menu.inner_selector.node().scrollTop}.bind(this))),this.menu.outer_selector.style({visibility:"visible"}),this.menu.hidden=!1,this.menu.update()}.bind(this),update:function(){return this.menu.outer_selector?(this.menu.populate(),this.menu.inner_selector&&(this.menu.inner_selector.node().scrollTop=this.menu.scroll_position),this.menu.position()):this.menu}.bind(this),position:function(){if(!this.menu.outer_selector)return this.menu;this.menu.outer_selector.style({height:null});var t=3,e=20,a=14,i=this.parent_svg.getPageOrigin(),n=document.documentElement.scrollTop||document.body.scrollTop,s=this.parent_plot.getContainerOffset(),o=this.parent_dashboard.selector.node().getBoundingClientRect(),r=this.selector.node().getBoundingClientRect(),l=this.menu.outer_selector.node().getBoundingClientRect(),h=this.menu.inner_selector.node().scrollHeight,d=0,u=0;"panel"===this.parent_dashboard.type?(d=i.y+o.height+2*t,u=Math.max(i.x+this.parent_svg.layout.width-l.width-t,i.x+t)):(d=r.bottom+n+t-s.top,u=Math.max(r.left+r.width-l.width-s.left,i.x+t));var p=Math.max(this.parent_svg.layout.width-2*t-e,e),c=p,y=p-4*t,f=Math.max(this.parent_svg.layout.height-10*t-a,a),g=Math.min(h,f),_=f;return this.menu.outer_selector.style({top:d.toString()+"px",left:u.toString()+"px","max-width":c.toString()+"px","max-height":_.toString()+"px",height:g.toString()+"px"}),this.menu.inner_selector.style({"max-width":y.toString()+"px"}),this.menu.inner_selector.node().scrollTop=this.menu.scroll_position,this.menu}.bind(this),hide:function(){return this.menu.outer_selector?(this.menu.outer_selector.style({visibility:"hidden"}),this.menu.hidden=!0,this.menu):this.menu}.bind(this),destroy:function(){return this.menu.outer_selector?(this.menu.inner_selector.remove(),this.menu.outer_selector.remove(),this.menu.inner_selector=null,this.menu.outer_selector=null,this.menu):this.menu}.bind(this),populate:function(){}.bind(this),setPopulate:function(t){return"function"==typeof t?(this.menu.populate=t,this.setOnclick(function(){this.menu.hidden?(this.menu.show(),this.highlight().update(),this.persist=!0):(this.menu.hide(),this.highlight(!1).update(),this.permanent||(this.persist=!1))}.bind(this))):this.setOnclick(),this}.bind(this)}},n.Dashboard.Components.add("title",function(t){n.Dashboard.Component.apply(this,arguments),this.show=function(){return this.div_selector=this.parent.selector.append("div").attr("class","lz-dashboard-title lz-dashboard-"+this.layout.position),this.title_selector=this.div_selector.append("h3"),this.update()},this.update=function(){var e=t.title.toString();return this.layout.subtitle&&(e+=" "+this.layout.subtitle+""),this.title_selector.html(e),this}}),n.Dashboard.Components.add("dimensions",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){var e=this.parent_plot.layout.width.toString().indexOf(".")===-1?this.parent_plot.layout.width:this.parent_plot.layout.width.toFixed(2),a=this.parent_plot.layout.height.toString().indexOf(".")===-1?this.parent_plot.layout.height:this.parent_plot.layout.height.toFixed(2);return this.selector.html(e+"px × "+a+"px"),t.class&&this.selector.attr("class",t.class),t.style&&this.selector.style(t.style),this}}),n.Dashboard.Components.add("region_scale",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){return isNaN(this.parent_plot.state.start)||isNaN(this.parent_plot.state.end)||null===this.parent_plot.state.start||null===this.parent_plot.state.end?this.selector.style("display","none"):(this.selector.style("display",null),this.selector.html(n.positionIntToString(this.parent_plot.state.end-this.parent_plot.state.start,null,!0))),t.class&&this.selector.attr("class",t.class),t.style&&this.selector.style(t.style),this}}),n.Dashboard.Components.add("download",function(a){n.Dashboard.Component.apply(this,arguments),this.update=function(){return this.button?this:(this.button=new n.Dashboard.Component.Button(this).setColor(a.color).setHtml("Download Image").setTitle("Download image of the current plot as locuszoom.svg").setOnMouseover(function(){this.button.selector.classed("lz-dashboard-button-gray-disabled",!0).html("Preparing Image"),this.generateBase64SVG().then(function(t){this.button.selector.attr("href","data:image/svg+xml;base64,\n"+t).classed("lz-dashboard-button-gray-disabled",!1).classed("lz-dashboard-button-gray-highlighted",!0).html("Download Image")}.bind(this))}.bind(this)).setOnMouseout(function(){this.button.selector.classed("lz-dashboard-button-gray-highlighted",!1)}.bind(this)),this.button.show(),this.button.selector.attr("href-lang","image/svg+xml").attr("download","locuszoom.svg"),this)},this.css_string="";for(var i in Object.keys(document.styleSheets))if(null!==document.styleSheets[i].href&&document.styleSheets[i].href.indexOf("locuszoom.css")!==-1){n.createCORSPromise("GET",document.styleSheets[i].href).then(function(t){this.css_string=t.replace(/[\r\n]/g," ").replace(/\s+/g," "),this.css_string.indexOf("/* ! LocusZoom HTML Styles */")&&(this.css_string=this.css_string.substring(0,this.css_string.indexOf("/* ! LocusZoom HTML Styles */")))}.bind(this));break}this.generateBase64SVG=function(){return e.fcall(function(){var e=this.parent.selector.append("div").style("display","none").html(this.parent_plot.svg.node().outerHTML);e.selectAll("g.lz-curtain").remove(),e.selectAll("g.lz-mouse_guide").remove(),e.selectAll("g.tick text").each(function(){var e=10*+t.select(this).attr("dy").substring(-2).slice(0,-2);t.select(this).attr("dy",e)});var a=t.select(e.select("svg").node().parentNode).html(),i='",n=a.indexOf(">")+1;return a=a.slice(0,n)+i+a.slice(n),e.remove(),btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode("0x"+e)}))}.bind(this))}}),n.Dashboard.Components.add("remove_panel",function(e){n.Dashboard.Component.apply(this,arguments),this.update=function(){return this.button?this:(this.button=new n.Dashboard.Component.Button(this).setColor(e.color).setHtml("×").setTitle("Remove panel").setOnclick(function(){if(!e.suppress_confirm&&!confirm("Are you sure you want to remove this panel? This cannot be undone!"))return!1;var a=this.parent_panel;return a.dashboard.hide(!0),t.select(a.parent.svg.node().parentNode).on("mouseover."+a.getBaseId()+".dashboard",null),t.select(a.parent.svg.node().parentNode).on("mouseout."+a.getBaseId()+".dashboard",null),a.parent.removePanel(a.id)}.bind(this)),this.button.show(),this)}}),n.Dashboard.Components.add("move_panel_up",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){if(this.button){var e=0===this.parent_panel.layout.y_index;return this.button.disable(e),this}return this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml("▴").setTitle("Move panel up").setOnclick(function(){this.parent_panel.moveUp(),this.update()}.bind(this)),this.button.show(),this.update()}}),n.Dashboard.Components.add("move_panel_down",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){if(this.button){var e=this.parent_panel.layout.y_index===this.parent_plot.panel_ids_by_y_index.length-1;return this.button.disable(e),this}return this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml("▾").setTitle("Move panel down").setOnclick(function(){this.parent_panel.moveDown(),this.update()}.bind(this)),this.button.show(),this.update()}}),n.Dashboard.Components.add("shift_region",function(t){return n.Dashboard.Component.apply(this,arguments),isNaN(this.parent_plot.state.start)||isNaN(this.parent_plot.state.end)?(this.update=function(){},void console.warn("Unable to add shift_region dashboard component: plot state does not have region bounds")):((isNaN(t.step)||0===t.step)&&(t.step=5e4),"string"!=typeof t.button_html&&(t.button_html=t.step>0?">":"<"),"string"!=typeof t.button_title&&(t.button_title="Shift region by "+(t.step>0?"+":"-")+n.positionIntToString(Math.abs(t.step),null,!0)),void(this.update=function(){return this.button?this:(this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml(t.button_html).setTitle(t.button_title).setOnclick(function(){this.parent_plot.applyState({start:Math.max(this.parent_plot.state.start+t.step,1),end:this.parent_plot.state.end+t.step})}.bind(this)),this.button.show(),this)}))}),n.Dashboard.Components.add("zoom_region",function(t){return n.Dashboard.Component.apply(this,arguments),isNaN(this.parent_plot.state.start)||isNaN(this.parent_plot.state.end)?(this.update=function(){},void console.warn("Unable to add zoom_region dashboard component: plot state does not have region bounds")):((isNaN(t.step)||0===t.step)&&(t.step=.2),"string"!=typeof t.button_html&&(t.button_html=t.step>0?"z–":"z+"),"string"!=typeof t.button_title&&(t.button_title="Zoom region "+(t.step>0?"out":"in")+" by "+(100*Math.abs(t.step)).toFixed(1)+"%"),void(this.update=function(){if(this.button){var e=!0,a=this.parent_plot.state.end-this.parent_plot.state.start;return t.step>0&&!isNaN(this.parent_plot.layout.max_region_scale)&&a>=this.parent_plot.layout.max_region_scale&&(e=!1),t.step<0&&!isNaN(this.parent_plot.layout.min_region_scale)&&a<=this.parent_plot.layout.min_region_scale&&(e=!1),this.button.disable(!e),this}return this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml(t.button_html).setTitle(t.button_title).setOnclick(function(){var e=this.parent_plot.state.end-this.parent_plot.state.start,a=1+t.step,i=e*a;isNaN(this.parent_plot.layout.max_region_scale)||(i=Math.min(i,this.parent_plot.layout.max_region_scale)),isNaN(this.parent_plot.layout.min_region_scale)||(i=Math.max(i,this.parent_plot.layout.min_region_scale));var n=Math.floor((i-e)/2);this.parent_plot.applyState({start:Math.max(this.parent_plot.state.start-n,1),end:this.parent_plot.state.end+n})}.bind(this)),this.button.show(),this}))}),n.Dashboard.Components.add("menu",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){return this.button?this:(this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml(t.button_html).setTitle(t.button_title),this.button.menu.setPopulate(function(){this.button.menu.inner_selector.html(t.menu_html)}.bind(this)),this.button.show(),this)}}),n.Dashboard.Components.add("covariates_model",function(t){n.Dashboard.Component.apply(this,arguments),this.initialize=function(){this.parent_plot.state.model=this.parent_plot.state.model||{},this.parent_plot.state.model.covariates=this.parent_plot.state.model.covariates||[],this.parent_plot.CovariatesModel={button:this,add:function(t){var e=JSON.parse(JSON.stringify(t));"object"==typeof t&&"string"!=typeof e.html&&(e.html="function"==typeof t.toHTML?t.toHTML():t.toString());for(var a=0;a1?"covariates":"covariate";t+=" ("+this.parent_plot.state.model.covariates.length+" "+e+")"}this.button.setHtml(t).disable(!1)}.bind(this),this.button.show(),this)}}),n.Dashboard.Components.add("toggle_split_tracks",function(t){if(n.Dashboard.Component.apply(this,arguments),t.data_layer_id||(t.data_layer_id="intervals"),!this.parent_panel.data_layers[t.data_layer_id])throw"Dashboard toggle split tracks component missing valid data layer ID";this.update=function(){var e=this.parent_panel.data_layers[t.data_layer_id],a=e.layout.split_tracks?"Merge Tracks":"Split Tracks";return this.button?(this.button.setHtml(a),this.button.show(),this.parent.position(),this):(this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml(a).setTitle("Toggle whether tracks are split apart or merged together").setOnclick(function(){e.toggleSplitTracks(),this.scale_timeout&&clearTimeout(this.scale_timeout);var t=e.layout.transition?+e.layout.transition.duration||0:0;this.scale_timeout=setTimeout(function(){this.parent_panel.scaleHeightToData(),this.parent_plot.positionPanels()}.bind(this),t),this.update()}.bind(this)),this.update())}}),n.Dashboard.Components.add("resize_to_data",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){return this.button?this:(this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml("Resize to Data").setTitle("Automatically resize this panel to fit the data its currently showing").setOnclick(function(){this.parent_panel.scaleHeightToData(),this.update()}.bind(this)),this.button.show(),this)}}),n.Dashboard.Components.add("toggle_legend",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){var e=this.parent_panel.legend.layout.hidden?"Show Legend":"Hide Legend";return this.button?(this.button.setHtml(e).show(),this.parent.position(),this):(this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setTitle("Show or hide the legend for this panel").setOnclick(function(){this.parent_panel.legend.layout.hidden=!this.parent_panel.legend.layout.hidden,this.parent_panel.legend.render(),this.update()}.bind(this)),this.update())}}),n.Dashboard.Components.add("data_layers",function(t){n.Dashboard.Component.apply(this,arguments),this.update=function(){return"string"!=typeof t.button_html&&(t.button_html="Data Layers"),"string"!=typeof t.button_title&&(t.button_title="Manipulate Data Layers (sort, dim, show/hide, etc.)"),this.button?this:(this.button=new n.Dashboard.Component.Button(this).setColor(t.color).setHtml(t.button_html).setTitle(t.button_title).setOnclick(function(){this.button.menu.populate()}.bind(this)),this.button.menu.setPopulate(function(){this.button.menu.inner_selector.html("");var e=this.button.menu.inner_selector.append("table");return this.parent_panel.data_layer_ids_by_z_index.slice().reverse().forEach(function(a,i){var s=this.parent_panel.data_layers[a],o="string"!=typeof s.layout.name?s.id:s.layout.name,r=e.append("tr");r.append("td").html(o),t.statuses.forEach(function(t){var e,a,i,o=n.DataLayer.Statuses.adjectives.indexOf(t),l=n.DataLayer.Statuses.verbs[o];s.global_statuses[t]?(e=n.DataLayer.Statuses.menu_antiverbs[o],a="un"+l+"AllElements",i="-highlighted"):(e=n.DataLayer.Statuses.verbs[o],a=l+"AllElements",i=""),r.append("td").append("a").attr("class","lz-dashboard-button lz-dashboard-button-"+this.layout.color+i).style({"margin-left":"0em"}).on("click",function(){s[a](),this.button.menu.populate()}.bind(this)).html(e)}.bind(this));var l=0===i,h=i===this.parent_panel.data_layer_ids_by_z_index.length-1,d=r.append("td");d.append("a").attr("class","lz-dashboard-button lz-dashboard-button-group-start lz-dashboard-button-"+this.layout.color+(h?"-disabled":"")).style({"margin-left":"0em"}).on("click",function(){s.moveDown(),this.button.menu.populate()}.bind(this)).html("▾").attr("title","Move layer down (further back)"),d.append("a").attr("class","lz-dashboard-button lz-dashboard-button-group-middle lz-dashboard-button-"+this.layout.color+(l?"-disabled":"")).style({"margin-left":"0em"}).on("click",function(){s.moveUp(),this.button.menu.populate()}.bind(this)).html("▴").attr("title","Move layer up (further front)"),d.append("a").attr("class","lz-dashboard-button lz-dashboard-button-group-end lz-dashboard-button-red").style({"margin-left":"0em"}).on("click",function(){return confirm("Are you sure you want to remove the "+o+" layer? This cannot be undone!")&&s.parent.removeDataLayer(a),this.button.menu.populate()}.bind(this)).html("×").attr("title","Remove layer")}.bind(this)),this}.bind(this)),this.button.show(),this)}}),n.Dashboard.Components.add("display_options",function(t){"string"!=typeof t.button_html&&(t.button_html="Display options"),"string"!=typeof t.button_title&&(t.button_title="Control how plot items are displayed"),n.Dashboard.Component.apply(this,arguments);var e=t.fields_whitelist||["color","fill_opacity","label","legend","point_shape","point_size","tooltip","tooltip_positioning"],a=this.parent_panel.data_layers[t.layer_name],i=a.layout,s={};e.forEach(function(t){var e=i[t];e&&(s[t]=JSON.parse(JSON.stringify(e)))}),this._selected_item="default";var o=this;this.button=new n.Dashboard.Component.Button(o).setColor(t.color).setHtml(t.button_html).setTitle(t.button_title).setOnclick(function(){o.button.menu.populate()}),this.button.menu.setPopulate(function(){var t=Math.floor(1e4*Math.random()).toString();o.button.menu.inner_selector.html("");var e=o.button.menu.inner_selector.append("table"),i=o.layout,n=function(i,n,s){var r=e.append("tr");r.append("td").append("input").attr({type:"radio",name:"color-picker-"+t,value:s}).property("checked",s===o._selected_item).on("click",function(){Object.keys(n).forEach(function(t){a.layout[t]=n[t]}),o._selected_item=s,o.parent_panel.render();var t=o.parent_panel.legend;t&&n.legend&&t.render()}),r.append("td").text(i)},r=i.default_config_display_name||"Default style";return n(r,s,"default"),i.options.forEach(function(t,e){n(t.display_name,t.display,e)}),o}),this.update=function(){return this.button.show(),this}}),n.Legend=function(t){if(!(t instanceof n.Panel))throw"Unable to create legend, parent must be a locuszoom panel";return this.parent=t,this.id=this.parent.getBaseId()+".legend",this.parent.layout.legend=n.Layouts.merge(this.parent.layout.legend||{},n.Legend.DefaultLayout),this.layout=this.parent.layout.legend,this.selector=null,this.background_rect=null,this.elements=[],this.elements_group=null,this.hidden=!1,this.render()},n.Legend.DefaultLayout={orientation:"vertical",origin:{x:0,y:0},width:10,height:10,padding:5,label_size:12,hidden:!1},n.Legend.prototype.render=function(){this.selector||(this.selector=this.parent.svg.group.append("g").attr("id",this.parent.getBaseId()+".legend").attr("class","lz-legend")),this.background_rect||(this.background_rect=this.selector.append("rect").attr("width",100).attr("height",100).attr("class","lz-legend-background")),this.elements_group||(this.elements_group=this.selector.append("g")),this.elements.forEach(function(t){t.remove()}),this.elements=[];var e=+this.layout.padding||1,a=e,i=e,n=0;this.parent.data_layer_ids_by_z_index.slice().reverse().forEach(function(s){Array.isArray(this.parent.data_layers[s].layout.legend)&&this.parent.data_layers[s].layout.legend.forEach(function(s){var o=this.elements_group.append("g").attr("transform","translate("+a+","+i+")"),r=+s.label_size||+this.layout.label_size||12,l=0,h=r/2+e/2;if(n=Math.max(n,r+e),"line"===s.shape){var d=+s.length||16,u=r/4+e/2;o.append("path").attr("class",s.class||"").attr("d","M0,"+u+"L"+d+","+u).style(s.style||{}),l=d+e}else if("rect"===s.shape){var p=+s.width||16,c=+s.height||p;o.append("rect").attr("class",s.class||"").attr("width",p).attr("height",c).attr("fill",s.color||{}).style(s.style||{}),l=p+e,n=Math.max(n,c+e)}else if(t.svg.symbolTypes.indexOf(s.shape)!==-1){var y=+s.size||40,f=Math.ceil(Math.sqrt(y/Math.PI));o.append("path").attr("class",s.class||"").attr("d",t.svg.symbol().size(y).type(s.shape)).attr("transform","translate("+f+","+(f+e/2)+")").attr("fill",s.color||{}).style(s.style||{}),l=2*f+e,h=Math.max(2*f+e/2,h),n=Math.max(n,2*f+e)}o.append("text").attr("text-anchor","left").attr("class","lz-label").attr("x",l).attr("y",h).style({"font-size":r}).text(s.label);var g=o.node().getBoundingClientRect();if("vertical"===this.layout.orientation)i+=g.height+e,n=0;else{var _=this.layout.origin.x+a+g.width;a>e&&_>this.parent.layout.width&&(i+=n,a=e,o.attr("transform","translate("+a+","+i+")")),a+=g.width+3*e}this.elements.push(o)}.bind(this))}.bind(this));var s=this.elements_group.node().getBoundingClientRect();return this.layout.width=s.width+2*this.layout.padding,this.layout.height=s.height+2*this.layout.padding,this.background_rect.attr("width",this.layout.width).attr("height",this.layout.height),this.selector.style({visibility:this.layout.hidden?"hidden":"visible"}),this.position()},n.Legend.prototype.position=function(){if(!this.selector)return this;var t=this.selector.node().getBoundingClientRect();isNaN(+this.layout.pad_from_bottom)||(this.layout.origin.y=this.parent.layout.height-t.height-+this.layout.pad_from_bottom),isNaN(+this.layout.pad_from_right)||(this.layout.origin.x=this.parent.layout.width-t.width-+this.layout.pad_from_right),this.selector.attr("transform","translate("+this.layout.origin.x+","+this.layout.origin.y+")")},n.Legend.prototype.hide=function(){this.layout.hidden=!0,this.render()},n.Legend.prototype.show=function(){this.layout.hidden=!1,this.render()},n.Data=n.Data||{},n.DataSources=function(){this.sources={}},n.DataSources.prototype.addSource=function(t,e){return console.warn("Warning: .addSource() is deprecated. Use .add() instead"),this.add(t,e)},n.DataSources.prototype.add=function(t,e){return this.set(t,e)},n.DataSources.prototype.set=function(t,e){if(Array.isArray(e)){var a=n.KnownDataSources.create.apply(null,e);this.sources[t]=a}else null!==e?this.sources[t]=e:delete this.sources[t];return this},n.DataSources.prototype.getSource=function(t){return console.warn("Warning: .getSource() is deprecated. Use .get() instead"),this.get(t)},n.DataSources.prototype.get=function(t){return this.sources[t]},n.DataSources.prototype.removeSource=function(t){return console.warn("Warning: .removeSource() is deprecated. Use .remove() instead"),this.remove(t)},n.DataSources.prototype.remove=function(t){return this.set(t,null)},n.DataSources.prototype.fromJSON=function(t){"string"==typeof t&&(t=JSON.parse(t));var e=this;return Object.keys(t).forEach(function(a){e.set(a,t[a])}),e},n.DataSources.prototype.keys=function(){return Object.keys(this.sources)},n.DataSources.prototype.toJSON=function(){return this.sources},n.Data.Field=function(t){var e=/^(?:([^:]+):)?([^:|]*)(\|.+)*$/.exec(t);this.full_name=t,this.namespace=e[1]||null,this.name=e[2]||null,this.transformations=[],"string"==typeof e[3]&&e[3].length>1&&(this.transformations=e[3].substring(1).split("|"),this.transformations.forEach(function(t,e){this.transformations[e]=n.TransformationFunctions.get(t)}.bind(this))),this.applyTransformations=function(t){return this.transformations.forEach(function(e){t=e(t)}),t},this.resolve=function(t){if("undefined"==typeof t[this.full_name]){var e=null;"undefined"!=typeof t[this.namespace+":"+this.name]?e=t[this.namespace+":"+this.name]:"undefined"!=typeof t[this.name]&&(e=t[this.name]),t[this.full_name]=this.applyTransformations(e)}return t[this.full_name]}},n.Data.Requester=function(t){function a(t){var e={},a=/^(?:([^:]+):)?([^:|]*)(\|.+)*$/;return t.forEach(function(t){var i=a.exec(t),s=i[1]||"base",o=i[2],r=n.TransformationFunctions.get(i[3]);"undefined"==typeof e[s]&&(e[s]={outnames:[],fields:[],trans:[]}),e[s].outnames.push(t),e[s].fields.push(o),e[s].trans.push(r)}),e}this.getData=function(i,n){ +for(var s=a(n),o=Object.keys(s).map(function(e){if(!t.get(e))throw"Datasource for namespace "+e+" not found";return t.get(e).getData(i,s[e].fields,s[e].outnames,s[e].trans)}),r=e.when({header:{},body:{}}),l=0;l1&&(2!==e.length||e.indexOf("isrefvar")===-1))throw"LD does not know how to get all fields: "+e.join(", ")},n.Data.LDSource.prototype.findMergeFields=function(t){var e=function(t){return function(){for(var e=arguments,a=0;a0){var i=Object.keys(t.body[0]),n=e(i);a.id=a.id||n(/\bvariant\b/)||n(/\bid\b/),a.position=a.position||n(/\bposition\b/i,/\bpos\b/i),a.pvalue=a.pvalue||n(/\bpvalue\b/i,/\blog_pvalue\b/i),a._names_=i}return a},n.Data.LDSource.prototype.findRequestedFields=function(t,e){for(var a={},i=0;ii&&(i=t[s][e]*a,n=s);return n},n=t.ldrefsource||e.header.ldrefsource||1,s=this.findRequestedFields(a),o=s.ldin;if("state"===o&&(o=t.ldrefvar||e.header.ldrefvar||"best"),"best"===o){if(!e.body)throw"No association data found to find best pvalue";var r=this.findMergeFields(e);if(!r.pvalue||!r.id){var l="";throw r.id||(l+=(l.length?", ":"")+"id"),r.pvalue||(l+=(l.length?", ":"")+"pvalue"),"Unable to find necessary column(s) for merge: "+l+" (available: "+r._names_+")"}o=e.body[i(e.body,r.pvalue)][r.id]}return e.header||(e.header={}),e.header.ldrefvar=o,this.url+"results/?filter=reference eq "+n+" and chromosome2 eq '"+t.chr+"' and position2 ge "+t.start+" and position2 le "+t.end+" and variant1 eq '"+o+"'&fields=chr,pos,rsquare"},n.Data.LDSource.prototype.parseResponse=function(t,e,a,i){var n=JSON.parse(t),s=this.findMergeFields(e),o=this.findRequestedFields(a,i);if(!s.position)throw"Unable to find position field for merge: "+s._names_;var r=function(t,e,a,i){for(var n=0,o=0;n0&&parseFloat(this.panels[i].layout.proportional_height)>0&&(s=Math.max(s,this.panels[i].layout.min_height/this.panels[i].layout.proportional_height));if(this.layout.min_width=Math.max(n,1),this.layout.min_height=Math.max(s,1),t.select(this.svg.node().parentNode).style({"min-width":this.layout.min_width+"px","min-height":this.layout.min_height+"px"}),!isNaN(e)&&e>=0&&!isNaN(a)&&a>=0){this.layout.width=Math.max(Math.round(+e),this.layout.min_width),this.layout.height=Math.max(Math.round(+a),this.layout.min_height),this.layout.aspect_ratio=this.layout.width/this.layout.height,this.layout.responsive_resize&&(this.svg&&(this.layout.width=Math.max(this.svg.node().parentNode.getBoundingClientRect().width,this.layout.min_width)),this.layout.height=this.layout.width/this.layout.aspect_ratio,this.layout.height0)e.layout.y_index<0&&(e.layout.y_index=Math.max(this.panel_ids_by_y_index.length+e.layout.y_index,0)),this.panel_ids_by_y_index.splice(e.layout.y_index,0,e.id),this.applyPanelYIndexesToPanelLayouts();else{var a=this.panel_ids_by_y_index.push(e.id);this.panels[e.id].layout.y_index=a-1}var i=null;return this.layout.panels.forEach(function(t,a){t.id===e.id&&(i=a)}),null===i&&(i=this.layout.panels.push(this.panels[e.id].layout)-1),this.panels[e.id].layout_idx=i,this.initialized&&(this.positionPanels(),this.panels[e.id].initialize(),this.panels[e.id].reMap(),this.setDimensions(this.layout.width,this.layout.height)),this.panels[e.id]},n.Plot.prototype.clearPanelData=function(t,e){e=e||"wipe";var a;a=t?[t]:Object.keys(this.panels);var i=this;return a.forEach(function(t){i.panels[t].data_layer_ids_by_z_index.forEach(function(a){var n=i.panels[t].data_layers[a];n.destroyAllTooltips(),delete i.layout.state[t+"."+a],"reset"===e&&n.setDefaultState()})}),this},n.Plot.prototype.removePanel=function(t){if(!this.panels[t])throw"Unable to remove panel, ID not found: "+t;return this.panel_boundaries.hide(),this.clearPanelData(t),this.panels[t].loader.hide(),this.panels[t].dashboard.destroy(!0),this.panels[t].curtain.hide(),this.panels[t].svg.container&&this.panels[t].svg.container.remove(),this.layout.panels.splice(this.panels[t].layout_idx,1),delete this.panels[t],delete this.layout.state[t],this.layout.panels.forEach(function(t,e){this.panels[t.id].layout_idx=e}.bind(this)),this.panel_ids_by_y_index.splice(this.panel_ids_by_y_index.indexOf(t),1),this.applyPanelYIndexesToPanelLayouts(),this.initialized&&(this.layout.min_height=this._base_layout.min_height,this.layout.min_width=this._base_layout.min_width,this.positionPanels(),this.setDimensions(this.layout.width,this.layout.height)),this},n.Plot.prototype.positionPanels=function(){var t,e={left:0,right:0};for(t in this.panels)null===this.panels[t].layout.proportional_height&&(this.panels[t].layout.proportional_height=this.panels[t].layout.height/this.layout.height),null===this.panels[t].layout.proportional_width&&(this.panels[t].layout.proportional_width=1),this.panels[t].layout.interaction.x_linked&&(e.left=Math.max(e.left,this.panels[t].layout.margin.left),e.right=Math.max(e.right,this.panels[t].layout.margin.right));var a=this.sumProportional("height");if(!a)return this;var i=1/a;for(t in this.panels)this.panels[t].layout.proportional_height*=i;var n=0;this.panel_ids_by_y_index.forEach(function(t){if(this.panels[t].setOrigin(0,n),this.panels[t].layout.proportional_origin.x=0,n+=this.panels[t].layout.height,this.panels[t].layout.interaction.x_linked){var a=Math.max(e.left-this.panels[t].layout.margin.left,0)+Math.max(e.right-this.panels[t].layout.margin.right,0);this.panels[t].layout.width+=a,this.panels[t].layout.margin.left=e.left,this.panels[t].layout.margin.right=e.right,this.panels[t].layout.cliparea.origin.x=e.left}}.bind(this));var s=n;return this.panel_ids_by_y_index.forEach(function(t){this.panels[t].layout.proportional_origin.y=this.panels[t].layout.origin.y/s}.bind(this)),this.setDimensions(),this.panel_ids_by_y_index.forEach(function(t){this.panels[t].setDimensions(this.layout.width*this.panels[t].layout.proportional_width,this.layout.height*this.panels[t].layout.proportional_height)}.bind(this)),this},n.Plot.prototype.initialize=function(){if(this.layout.responsive_resize&&t.select(this.container).classed("lz-container-responsive",!0),this.layout.mouse_guide){var e=this.svg.append("g").attr("class","lz-mouse_guide").attr("id",this.id+".mouse_guide"),a=e.append("rect").attr("class","lz-mouse_guide-vertical").attr("x",-1),i=e.append("rect").attr("class","lz-mouse_guide-horizontal").attr("y",-1);this.mouse_guide={svg:e,vertical:a,horizontal:i}}this.curtain=n.generateCurtain.call(this),this.loader=n.generateLoader.call(this),this.panel_boundaries={parent:this,hide_timeout:null,showing:!1,dragging:!1,selectors:[],corner_selector:null,show:function(){if(!this.showing&&!this.parent.curtain.showing){this.showing=!0,this.parent.panel_ids_by_y_index.forEach(function(e,a){var i=t.select(this.parent.svg.node().parentNode).insert("div",".lz-data_layer-tooltip").attr("class","lz-panel-boundary").attr("title","Resize panel");i.append("span");var n=t.behavior.drag();n.on("dragstart",function(){this.dragging=!0}.bind(this)),n.on("dragend",function(){this.dragging=!1}.bind(this)),n.on("drag",function(){var e=this.parent.panels[this.parent.panel_ids_by_y_index[a]],i=e.layout.height;e.setDimensions(e.layout.width,e.layout.height+t.event.dy);var n=e.layout.height-i,s=this.parent.layout.height+n;this.parent.panel_ids_by_y_index.forEach(function(t,e){var i=this.parent.panels[this.parent.panel_ids_by_y_index[e]];i.layout.proportional_height=i.layout.height/s,e>a&&(i.setOrigin(i.layout.origin.x,i.layout.origin.y+n),i.dashboard.position())}.bind(this)),this.parent.positionPanels(),this.position()}.bind(this)),i.call(n),this.parent.panel_boundaries.selectors.push(i)}.bind(this));var e=t.select(this.parent.svg.node().parentNode).insert("div",".lz-data_layer-tooltip").attr("class","lz-panel-corner-boundary").attr("title","Resize plot");e.append("span").attr("class","lz-panel-corner-boundary-outer"),e.append("span").attr("class","lz-panel-corner-boundary-inner");var a=t.behavior.drag();a.on("dragstart",function(){this.dragging=!0}.bind(this)),a.on("dragend",function(){this.dragging=!1}.bind(this)),a.on("drag",function(){this.setDimensions(this.layout.width+t.event.dx,this.layout.height+t.event.dy)}.bind(this.parent)),e.call(a),this.parent.panel_boundaries.corner_selector=e}return this.position()},position:function(){if(!this.showing)return this;var t=this.parent.getPageOrigin();this.selectors.forEach(function(e,a){var i=this.parent.panels[this.parent.panel_ids_by_y_index[a]].getPageOrigin(),n=t.x,s=i.y+this.parent.panels[this.parent.panel_ids_by_y_index[a]].layout.height-12,o=this.parent.layout.width-1;e.style({top:s+"px",left:n+"px",width:o+"px"}),e.select("span").style({width:o+"px"})}.bind(this));var e=10,a=16;return this.corner_selector.style({top:t.y+this.parent.layout.height-e-a+"px",left:t.x+this.parent.layout.width-e-a+"px"}),this},hide:function(){return this.showing?(this.showing=!1,this.selectors.forEach(function(t){t.remove()}),this.selectors=[],this.corner_selector.remove(),this.corner_selector=null,this):this}},this.layout.panel_boundaries&&(t.select(this.svg.node().parentNode).on("mouseover."+this.id+".panel_boundaries",function(){clearTimeout(this.panel_boundaries.hide_timeout),this.panel_boundaries.show()}.bind(this)),t.select(this.svg.node().parentNode).on("mouseout."+this.id+".panel_boundaries",function(){this.panel_boundaries.hide_timeout=setTimeout(function(){this.panel_boundaries.hide()}.bind(this),300)}.bind(this))),this.dashboard=new n.Dashboard(this).show();for(var s in this.panels)this.panels[s].initialize();var o="."+this.id;if(this.layout.mouse_guide){var r=function(){this.mouse_guide.vertical.attr("x",-1),this.mouse_guide.horizontal.attr("y",-1)}.bind(this),l=function(){var e=t.mouse(this.svg.node());this.mouse_guide.vertical.attr("x",e[0]),this.mouse_guide.horizontal.attr("y",e[1])}.bind(this);this.svg.on("mouseout"+o+"-mouse_guide",r).on("touchleave"+o+"-mouse_guide",r).on("mousemove"+o+"-mouse_guide",l)}var h=function(){this.stopDrag()}.bind(this),d=function(){if(this.interaction.dragging){var e=t.mouse(this.svg.node());t.event&&t.event.preventDefault(),this.interaction.dragging.dragged_x=e[0]-this.interaction.dragging.start_x,this.interaction.dragging.dragged_y=e[1]-this.interaction.dragging.start_y,this.panels[this.interaction.panel_id].render(),this.interaction.linked_panel_ids.forEach(function(t){this.panels[t].render()}.bind(this))}}.bind(this);this.svg.on("mouseup"+o,h).on("touchend"+o,h).on("mousemove"+o,d).on("touchmove"+o,d),t.select("body").empty()||t.select("body").on("mouseup"+o,h).on("touchend"+o,h),this.initialized=!0;var u=this.svg.node().getBoundingClientRect(),p=u.width?u.width:this.layout.width,c=u.height?u.height:this.layout.height;return this.setDimensions(p,c),this},n.Plot.prototype.refresh=function(){return this.applyState()},n.Plot.prototype.applyState=function(t){if(t=t||{},"object"!=typeof t)throw"LocusZoom.applyState only accepts an object; "+typeof t+" given";var a=JSON.parse(JSON.stringify(this.state));for(var i in t)a[i]=t[i];a=n.validateState(a,this.layout);for(i in a)this.state[i]=a[i];this.emit("data_requested"),this.remap_promises=[],this.loading_data=!0;for(var s in this.panels)this.remap_promises.push(this.panels[s].reMap());return e.all(this.remap_promises).catch(function(t){console.error(t),this.curtain.drop(t),this.loading_data=!1}.bind(this)).then(function(){this.dashboard.update(),this.panel_ids_by_y_index.forEach(function(t){var e=this.panels[t];e.dashboard.update(),e.data_layer_ids_by_z_index.forEach(function(e){var a=this.data_layers[e],i=t+"."+e;for(var n in this.state[i])this.state[i].hasOwnProperty(n)&&Array.isArray(this.state[i][n])&&this.state[i][n].forEach(function(t){try{this.setElementStatus(n,this.getElementById(t),!0)}catch(t){console.error("Unable to apply state: "+i+", "+n)}}.bind(a))}.bind(e))}.bind(this)),this.emit("layout_changed"),this.emit("data_rendered"),this.loading_data=!1}.bind(this))},n.Plot.prototype.startDrag=function(e,a){e=e||null,a=a||null;var i=null;switch(a){case"background":case"x_tick":i="x";break;case"y1_tick":i="y1";break;case"y2_tick":i="y2"}if(!(e instanceof n.Panel&&i&&this.canInteract()))return this.stopDrag();var s=t.mouse(this.svg.node());return this.interaction={panel_id:e.id,linked_panel_ids:e.getLinkedPanelIds(i),dragging:{method:a,start_x:s[0],start_y:s[1],dragged_x:0,dragged_y:0,axis:i}},this.svg.style("cursor","all-scroll"),this},n.Plot.prototype.stopDrag=function(){if(!this.interaction.dragging)return this;if("object"!=typeof this.panels[this.interaction.panel_id])return this.interaction={},this;var t=this.panels[this.interaction.panel_id],e=function(e,a,i){t.data_layer_ids_by_z_index.forEach(function(n){t.data_layers[n].layout[e+"_axis"].axis===a&&(t.data_layers[n].layout[e+"_axis"].floor=i[0],t.data_layers[n].layout[e+"_axis"].ceiling=i[1],delete t.data_layers[n].layout[e+"_axis"].lower_buffer,delete t.data_layers[n].layout[e+"_axis"].upper_buffer,delete t.data_layers[n].layout[e+"_axis"].min_extent,delete t.data_layers[n].layout[e+"_axis"].ticks)})};switch(this.interaction.dragging.method){case"background":case"x_tick":0!==this.interaction.dragging.dragged_x&&(e("x",1,t.x_extent),this.applyState({start:t.x_extent[0],end:t.x_extent[1]}));break;case"y1_tick":case"y2_tick":if(0!==this.interaction.dragging.dragged_y){var a=parseInt(this.interaction.dragging.method[1]);e("y",a,t["y"+a+"_extent"])}}return this.interaction={},this.svg.style("cursor",null),this},n.Panel=function(t,e){if("object"!=typeof t)throw"Unable to create panel, invalid layout";if(this.parent=e||null,this.parent_plot=e,"string"==typeof t.id&&t.id.length){if(this.parent&&"undefined"!=typeof this.parent.panels[t.id])throw"Cannot create panel with id ["+t.id+"]; panel with that id already exists"}else if(this.parent){var a=null,i=function(){a="p"+Math.floor(Math.random()*Math.pow(10,8)),null!=a&&"undefined"==typeof this.parent.panels[a]||(a=i())}.bind(this);t.id=a}else t.id="p"+Math.floor(Math.random()*Math.pow(10,8));return this.id=t.id,this.initialized=!1,this.layout_idx=null,this.svg={},this.layout=n.Layouts.merge(t||{},n.Panel.DefaultLayout),this.parent?(this.state=this.parent.state,this.state_id=this.id,this.state[this.state_id]=this.state[this.state_id]||{}):(this.state=null,this.state_id=null),this.data_layers={},this.data_layer_ids_by_z_index=[],this.applyDataLayerZIndexesToDataLayerLayouts=function(){this.data_layer_ids_by_z_index.forEach(function(t,e){this.data_layers[t].layout.z_index=e}.bind(this))}.bind(this),this.data_promises=[],this.x_scale=null,this.y1_scale=null,this.y2_scale=null,this.x_extent=null,this.y1_extent=null,this.y2_extent=null,this.x_ticks=[],this.y1_ticks=[],this.y2_ticks=[],this.zoom_timeout=null,this.getBaseId=function(){return this.parent.id+"."+this.id},this.event_hooks={layout_changed:[],data_requested:[],data_rendered:[],element_clicked:[]},this.on=function(t,e){if(!Array.isArray(this.event_hooks[t]))throw"Unable to register event hook, invalid event: "+t.toString();if("function"!=typeof e)throw"Unable to register event hook, invalid hook function passed";return this.event_hooks[t].push(e),this},this.emit=function(t,e){if(!Array.isArray(this.event_hooks[t]))throw"LocusZoom attempted to throw an invalid event: "+t.toString();return e=e||this,this.event_hooks[t].forEach(function(t){t.call(e)}),this},this.getPageOrigin=function(){var t=this.parent.getPageOrigin();return{x:t.x+this.layout.origin.x,y:t.y+this.layout.origin.y}},this.initializeLayout(),this},n.Panel.DefaultLayout={title:{text:"",style:{},x:10,y:22},y_index:null,width:0,height:0,origin:{x:0,y:null},min_width:1,min_height:1,proportional_width:null,proportional_height:null,proportional_origin:{x:0,y:null},margin:{top:0,right:0,bottom:0,left:0},background_click:"clear_selections",dashboard:{components:[]},cliparea:{height:0,width:0,origin:{x:0,y:0}},axes:{x:{},y1:{},y2:{}},legend:null,interaction:{drag_background_to_pan:!1,drag_x_ticks_to_scale:!1,drag_y1_ticks_to_scale:!1,drag_y2_ticks_to_scale:!1,scroll_to_zoom:!1,x_linked:!1,y1_linked:!1,y2_linked:!1},data_layers:[]},n.Panel.prototype.initializeLayout=function(){if(0===this.layout.width&&null===this.layout.proportional_width&&(this.layout.proportional_width=1),0===this.layout.height&&null===this.layout.proportional_height){var t=Object.keys(this.parent.panels).length;t>0?this.layout.proportional_height=1/t:this.layout.proportional_height=1}return this.setDimensions(),this.setOrigin(),this.setMargin(),this.x_range=[0,this.layout.cliparea.width],this.y1_range=[this.layout.cliparea.height,0],this.y2_range=[this.layout.cliparea.height,0],["x","y1","y2"].forEach(function(t){Object.keys(this.layout.axes[t]).length&&this.layout.axes[t].render!==!1?(this.layout.axes[t].render=!0,this.layout.axes[t].label=this.layout.axes[t].label||null,this.layout.axes[t].label_function=this.layout.axes[t].label_function||null):this.layout.axes[t].render=!1}.bind(this)),this.layout.data_layers.forEach(function(t){this.addDataLayer(t)}.bind(this)),this},n.Panel.prototype.setDimensions=function(t,e){return"undefined"!=typeof t&&"undefined"!=typeof e?!isNaN(t)&&t>=0&&!isNaN(e)&&e>=0&&(this.layout.width=Math.max(Math.round(+t),this.layout.min_width),this.layout.height=Math.max(Math.round(+e),this.layout.min_height)):(null!==this.layout.proportional_width&&(this.layout.width=Math.max(this.layout.proportional_width*this.parent.layout.width,this.layout.min_width)),null!==this.layout.proportional_height&&(this.layout.height=Math.max(this.layout.proportional_height*this.parent.layout.height,this.layout.min_height))),this.layout.cliparea.width=Math.max(this.layout.width-(this.layout.margin.left+this.layout.margin.right),0),this.layout.cliparea.height=Math.max(this.layout.height-(this.layout.margin.top+this.layout.margin.bottom),0),this.svg.clipRect&&this.svg.clipRect.attr("width",this.layout.width).attr("height",this.layout.height),this.initialized&&(this.render(),this.curtain.update(),this.loader.update(),this.dashboard.update(),this.legend&&this.legend.position()),this},n.Panel.prototype.setOrigin=function(t,e){return!isNaN(t)&&t>=0&&(this.layout.origin.x=Math.max(Math.round(+t),0)),!isNaN(e)&&e>=0&&(this.layout.origin.y=Math.max(Math.round(+e),0)),this.initialized&&this.render(),this},n.Panel.prototype.setMargin=function(t,e,a,i){var n;return!isNaN(t)&&t>=0&&(this.layout.margin.top=Math.max(Math.round(+t),0)),!isNaN(e)&&e>=0&&(this.layout.margin.right=Math.max(Math.round(+e),0)),!isNaN(a)&&a>=0&&(this.layout.margin.bottom=Math.max(Math.round(+a),0)),!isNaN(i)&&i>=0&&(this.layout.margin.left=Math.max(Math.round(+i),0)),this.layout.margin.top+this.layout.margin.bottom>this.layout.height&&(n=Math.floor((this.layout.margin.top+this.layout.margin.bottom-this.layout.height)/2),this.layout.margin.top-=n,this.layout.margin.bottom-=n),this.layout.margin.left+this.layout.margin.right>this.layout.width&&(n=Math.floor((this.layout.margin.left+this.layout.margin.right-this.layout.width)/2),this.layout.margin.left-=n,this.layout.margin.right-=n),["top","right","bottom","left"].forEach(function(t){this.layout.margin[t]=Math.max(this.layout.margin[t],0)}.bind(this)),this.layout.cliparea.width=Math.max(this.layout.width-(this.layout.margin.left+this.layout.margin.right),0), this.layout.cliparea.height=Math.max(this.layout.height-(this.layout.margin.top+this.layout.margin.bottom),0),this.layout.cliparea.origin.x=this.layout.margin.left,this.layout.cliparea.origin.y=this.layout.margin.top,this.initialized&&this.render(),this},n.Panel.prototype.setTitle=function(t){if("string"==typeof this.layout.title){var e=this.layout.title;this.layout.title={text:e,x:0,y:0,style:{}}}return"string"==typeof t?this.layout.title.text=t:"object"==typeof t&&null!==t&&(this.layout.title=n.Layouts.merge(t,this.layout.title)),this.layout.title.text.length?this.title.attr("display",null).attr("x",parseFloat(this.layout.title.x)).attr("y",parseFloat(this.layout.title.y)).style(this.layout.title.style).text(this.layout.title.text):this.title.attr("display","none"),this},n.Panel.prototype.initialize=function(){this.svg.container=this.parent.svg.append("g").attr("id",this.getBaseId()+".panel_container").attr("transform","translate("+(this.layout.origin.x||0)+","+(this.layout.origin.y||0)+")");var t=this.svg.container.append("clipPath").attr("id",this.getBaseId()+".clip");if(this.svg.clipRect=t.append("rect").attr("width",this.layout.width).attr("height",this.layout.height),this.svg.group=this.svg.container.append("g").attr("id",this.getBaseId()+".panel").attr("clip-path","url(#"+this.getBaseId()+".clip)"),this.curtain=n.generateCurtain.call(this),this.loader=n.generateLoader.call(this),this.dashboard=new n.Dashboard(this),this.inner_border=this.svg.group.append("rect").attr("class","lz-panel-background").on("click",function(){"clear_selections"===this.layout.background_click&&this.clearSelections()}.bind(this)),this.title=this.svg.group.append("text").attr("class","lz-panel-title"),"undefined"!=typeof this.layout.title&&this.setTitle(),this.svg.x_axis=this.svg.group.append("g").attr("id",this.getBaseId()+".x_axis").attr("class","lz-x lz-axis"),this.layout.axes.x.render&&(this.svg.x_axis_label=this.svg.x_axis.append("text").attr("class","lz-x lz-axis lz-label").attr("text-anchor","middle")),this.svg.y1_axis=this.svg.group.append("g").attr("id",this.getBaseId()+".y1_axis").attr("class","lz-y lz-y1 lz-axis"),this.layout.axes.y1.render&&(this.svg.y1_axis_label=this.svg.y1_axis.append("text").attr("class","lz-y1 lz-axis lz-label").attr("text-anchor","middle")),this.svg.y2_axis=this.svg.group.append("g").attr("id",this.getBaseId()+".y2_axis").attr("class","lz-y lz-y2 lz-axis"),this.layout.axes.y2.render&&(this.svg.y2_axis_label=this.svg.y2_axis.append("text").attr("class","lz-y2 lz-axis lz-label").attr("text-anchor","middle")),this.data_layer_ids_by_z_index.forEach(function(t){this.data_layers[t].initialize()}.bind(this)),this.legend=null,this.layout.legend&&(this.legend=new n.Legend(this)),this.layout.interaction.drag_background_to_pan){var e="."+this.parent.id+"."+this.id+".interaction.drag",a=function(){this.parent.startDrag(this,"background")}.bind(this);this.svg.container.select(".lz-panel-background").on("mousedown"+e+".background",a).on("touchstart"+e+".background",a)}return this},n.Panel.prototype.resortDataLayers=function(){var e=[];this.data_layer_ids_by_z_index.forEach(function(t){e.push(this.data_layers[t].layout.z_index)}.bind(this)),this.svg.group.selectAll("g.lz-data_layer-container").data(e).sort(t.ascending),this.applyDataLayerZIndexesToDataLayerLayouts()},n.Panel.prototype.getLinkedPanelIds=function(t){t=t||null;var e=[];return["x","y1","y2"].indexOf(t)===-1?e:this.layout.interaction[t+"_linked"]?(this.parent.panel_ids_by_y_index.forEach(function(a){a!==this.id&&this.parent.panels[a].layout.interaction[t+"_linked"]&&e.push(a)}.bind(this)),e):e},n.Panel.prototype.moveUp=function(){return this.parent.panel_ids_by_y_index[this.layout.y_index-1]&&(this.parent.panel_ids_by_y_index[this.layout.y_index]=this.parent.panel_ids_by_y_index[this.layout.y_index-1],this.parent.panel_ids_by_y_index[this.layout.y_index-1]=this.id,this.parent.applyPanelYIndexesToPanelLayouts(),this.parent.positionPanels()),this},n.Panel.prototype.moveDown=function(){return this.parent.panel_ids_by_y_index[this.layout.y_index+1]&&(this.parent.panel_ids_by_y_index[this.layout.y_index]=this.parent.panel_ids_by_y_index[this.layout.y_index+1],this.parent.panel_ids_by_y_index[this.layout.y_index+1]=this.id,this.parent.applyPanelYIndexesToPanelLayouts(),this.parent.positionPanels()),this},n.Panel.prototype.addDataLayer=function(t){if("object"!=typeof t||"string"!=typeof t.id||!t.id.length)throw"Invalid data layer layout passed to LocusZoom.Panel.prototype.addDataLayer()";if("undefined"!=typeof this.data_layers[t.id])throw"Cannot create data_layer with id ["+t.id+"]; data layer with that id already exists in the panel";if("string"!=typeof t.type)throw"Invalid data layer type in layout passed to LocusZoom.Panel.prototype.addDataLayer()";"object"!=typeof t.y_axis||"undefined"!=typeof t.y_axis.axis&&[1,2].indexOf(t.y_axis.axis)!==-1||(t.y_axis.axis=1);var e=n.DataLayers.get(t.type,t,this);if(this.data_layers[e.id]=e,null!==e.layout.z_index&&!isNaN(e.layout.z_index)&&this.data_layer_ids_by_z_index.length>0)e.layout.z_index<0&&(e.layout.z_index=Math.max(this.data_layer_ids_by_z_index.length+e.layout.z_index,0)),this.data_layer_ids_by_z_index.splice(e.layout.z_index,0,e.id),this.data_layer_ids_by_z_index.forEach(function(t,e){this.data_layers[t].layout.z_index=e}.bind(this));else{var a=this.data_layer_ids_by_z_index.push(e.id);this.data_layers[e.id].layout.z_index=a-1}var i=null;return this.layout.data_layers.forEach(function(t,a){t.id===e.id&&(i=a)}),null===i&&(i=this.layout.data_layers.push(this.data_layers[e.id].layout)-1),this.data_layers[e.id].layout_idx=i,this.data_layers[e.id]},n.Panel.prototype.removeDataLayer=function(t){if(!this.data_layers[t])throw"Unable to remove data layer, ID not found: "+t;return this.data_layers[t].destroyAllTooltips(),this.data_layers[t].svg.container&&this.data_layers[t].svg.container.remove(),this.layout.data_layers.splice(this.data_layers[t].layout_idx,1),delete this.state[this.data_layers[t].state_id],delete this.data_layers[t],this.data_layer_ids_by_z_index.splice(this.data_layer_ids_by_z_index.indexOf(t),1),this.applyDataLayerZIndexesToDataLayerLayouts(),this.layout.data_layers.forEach(function(t,e){this.data_layers[t.id].layout_idx=e}.bind(this)),this},n.Panel.prototype.clearSelections=function(){return this.data_layer_ids_by_z_index.forEach(function(t){this.data_layers[t].setAllElementStatus("selected",!1)}.bind(this)),this},n.Panel.prototype.reMap=function(){this.emit("data_requested"),this.data_promises=[],this.curtain.hide();for(var t in this.data_layers)try{this.data_promises.push(this.data_layers[t].reMap())}catch(t){console.warn(t),this.curtain.show(t)}return e.all(this.data_promises).then(function(){this.initialized=!0,this.render(),this.emit("layout_changed"),this.parent.emit("layout_changed"),this.emit("data_rendered")}.bind(this)).catch(function(t){console.warn(t),this.curtain.show(t)}.bind(this))};n.Panel.prototype.generateExtents=function(){["x","y1","y2"].forEach(function(t){this[t+"_extent"]=null}.bind(this));for(var e in this.data_layers){var a=this.data_layers[e];if(a.layout.x_axis&&!a.layout.x_axis.decoupled&&(this.x_extent=t.extent((this.x_extent||[]).concat(a.getAxisExtent("x")))),a.layout.y_axis&&!a.layout.y_axis.decoupled){var i="y"+a.layout.y_axis.axis;this[i+"_extent"]=t.extent((this[i+"_extent"]||[]).concat(a.getAxisExtent("y")))}}return this.layout.axes.x&&"state"===this.layout.axes.x.extent&&(this.x_extent=[this.state.start,this.state.end]),this};n.Panel.prototype.generateTicks=function(t){if(this.layout.axes[t].ticks){var e=this.layout.axes[t],a=e.ticks;if(Array.isArray(a))return a;if("object"==typeof a){var i=this,s={position:a.position},o=this.data_layer_ids_by_z_index.reduce(function(e,a){var n=i.data_layers[a];return e.concat(n.getTicks(t,s))},[]);return o.map(function(t){var e={};return e=n.Layouts.merge(e,a),n.Layouts.merge(e,t)})}}return this[t+"_extent"]?n.prettyTicks(this[t+"_extent"],"both"):[]},n.Panel.prototype.render=function(){this.svg.container.attr("transform","translate("+this.layout.origin.x+","+this.layout.origin.y+")"),this.svg.clipRect.attr("width",this.layout.width).attr("height",this.layout.height),this.inner_border.attr("x",this.layout.margin.left).attr("y",this.layout.margin.top).attr("width",this.layout.width-(this.layout.margin.left+this.layout.margin.right)).attr("height",this.layout.height-(this.layout.margin.top+this.layout.margin.bottom)),this.layout.inner_border&&this.inner_border.style({"stroke-width":1,stroke:this.layout.inner_border}),this.setTitle(),this.generateExtents();var e=function(t,e){var a=Math.pow(-10,e),i=Math.pow(-10,-e),n=Math.pow(10,-e),s=Math.pow(10,e);return t===1/0&&(t=s),t===-(1/0)&&(t=a),0===t&&(t=n),t>0&&(t=Math.max(Math.min(t,s),n)),t<0&&(t=Math.max(Math.min(t,i),a)),t},a={};if(this.x_extent){var i={start:0,end:this.layout.cliparea.width};this.layout.axes.x.range&&(i.start=this.layout.axes.x.range.start||i.start,i.end=this.layout.axes.x.range.end||i.end),a.x=[i.start,i.end],a.x_shifted=[i.start,i.end]}if(this.y1_extent){var n={start:this.layout.cliparea.height,end:0};this.layout.axes.y1.range&&(n.start=this.layout.axes.y1.range.start||n.start,n.end=this.layout.axes.y1.range.end||n.end),a.y1=[n.start,n.end],a.y1_shifted=[n.start,n.end]}if(this.y2_extent){var s={start:this.layout.cliparea.height,end:0};this.layout.axes.y2.range&&(s.start=this.layout.axes.y2.range.start||s.start,s.end=this.layout.axes.y2.range.end||s.end),a.y2=[s.start,s.end],a.y2_shifted=[s.start,s.end]}if(this.parent.interaction.panel_id&&(this.parent.interaction.panel_id===this.id||this.parent.interaction.linked_panel_ids.indexOf(this.id)!==-1)){var o,r=null;if(this.parent.interaction.zooming&&"function"==typeof this.x_scale){var l=Math.abs(this.x_extent[1]-this.x_extent[0]),h=Math.round(this.x_scale.invert(a.x_shifted[1]))-Math.round(this.x_scale.invert(a.x_shifted[0])),d=this.parent.interaction.zooming.scale,u=Math.floor(h*(1/d));d<1&&!isNaN(this.parent.layout.max_region_scale)?d=1/(Math.min(u,this.parent.layout.max_region_scale)/h):d>1&&!isNaN(this.parent.layout.min_region_scale)&&(d=1/(Math.max(u,this.parent.layout.min_region_scale)/h));var p=Math.floor(l*d);o=this.parent.interaction.zooming.center-this.layout.margin.left-this.layout.origin.x;var c=o/this.layout.cliparea.width,y=Math.max(Math.floor(this.x_scale.invert(a.x_shifted[0])-(p-h)*c),1);a.x_shifted=[this.x_scale(y),this.x_scale(y+p)]}else if(this.parent.interaction.dragging)switch(this.parent.interaction.dragging.method){case"background":a.x_shifted[0]=+this.parent.interaction.dragging.dragged_x,a.x_shifted[1]=this.layout.cliparea.width+this.parent.interaction.dragging.dragged_x;break;case"x_tick":t.event&&t.event.shiftKey?(a.x_shifted[0]=+this.parent.interaction.dragging.dragged_x,a.x_shifted[1]=this.layout.cliparea.width+this.parent.interaction.dragging.dragged_x):(o=this.parent.interaction.dragging.start_x-this.layout.margin.left-this.layout.origin.x,r=e(o/(o+this.parent.interaction.dragging.dragged_x),3),a.x_shifted[0]=0,a.x_shifted[1]=Math.max(this.layout.cliparea.width*(1/r),1));break;case"y1_tick":case"y2_tick":var f="y"+this.parent.interaction.dragging.method[1]+"_shifted";t.event&&t.event.shiftKey?(a[f][0]=this.layout.cliparea.height+this.parent.interaction.dragging.dragged_y,a[f][1]=+this.parent.interaction.dragging.dragged_y):(o=this.layout.cliparea.height-(this.parent.interaction.dragging.start_y-this.layout.margin.top-this.layout.origin.y),r=e(o/(o-this.parent.interaction.dragging.dragged_y),3),a[f][0]=this.layout.cliparea.height,a[f][1]=this.layout.cliparea.height-this.layout.cliparea.height*(1/r))}}if(["x","y1","y2"].forEach(function(e){this[e+"_extent"]&&(this[e+"_scale"]=t.scale.linear().domain(this[e+"_extent"]).range(a[e+"_shifted"]),this[e+"_extent"]=[this[e+"_scale"].invert(a[e][0]),this[e+"_scale"].invert(a[e][1])],this[e+"_scale"]=t.scale.linear().domain(this[e+"_extent"]).range(a[e]),this.renderAxis(e))}.bind(this)),this.layout.interaction.scroll_to_zoom){var g=function(){if(!t.event.shiftKey)return void(this.parent.canInteract(this.id)&&this.loader.show("Press [SHIFT] while scrolling to zoom").hide(1e3));if(t.event.preventDefault(),this.parent.canInteract(this.id)){var e=t.mouse(this.svg.container.node()),a=Math.max(-1,Math.min(1,t.event.wheelDelta||-t.event.detail||-t.event.deltaY));0!==a&&(this.parent.interaction={panel_id:this.id,linked_panel_ids:this.getLinkedPanelIds("x"),zooming:{scale:a<1?.9:1.1,center:e[0]}},this.render(),this.parent.interaction.linked_panel_ids.forEach(function(t){this.parent.panels[t].render()}.bind(this)),null!==this.zoom_timeout&&clearTimeout(this.zoom_timeout),this.zoom_timeout=setTimeout(function(){this.parent.interaction={},this.parent.applyState({start:this.x_extent[0],end:this.x_extent[1]})}.bind(this),500))}}.bind(this);this.zoom_listener=t.behavior.zoom(),this.svg.container.call(this.zoom_listener).on("wheel.zoom",g).on("mousewheel.zoom",g).on("DOMMouseScroll.zoom",g)}return this.data_layer_ids_by_z_index.forEach(function(t){this.data_layers[t].draw().render()}.bind(this)),this},n.Panel.prototype.renderAxis=function(e){if(["x","y1","y2"].indexOf(e)===-1)throw"Unable to render axis; invalid axis identifier: "+e;var a=this.layout.axes[e].render&&"function"==typeof this[e+"_scale"]&&!isNaN(this[e+"_scale"](0));if(this[e+"_axis"]&&this.svg.container.select("g.lz-axis.lz-"+e).style("display",a?null:"none"),!a)return this;var i={x:{position:"translate("+this.layout.margin.left+","+(this.layout.height-this.layout.margin.bottom)+")",orientation:"bottom",label_x:this.layout.cliparea.width/2,label_y:this.layout.axes[e].label_offset||0,label_rotate:null},y1:{position:"translate("+this.layout.margin.left+","+this.layout.margin.top+")",orientation:"left",label_x:-1*(this.layout.axes[e].label_offset||0),label_y:this.layout.cliparea.height/2,label_rotate:-90},y2:{position:"translate("+(this.layout.width-this.layout.margin.right)+","+this.layout.margin.top+")",orientation:"right",label_x:this.layout.axes[e].label_offset||0,label_y:this.layout.cliparea.height/2,label_rotate:-90}};this[e+"_ticks"]=this.generateTicks(e);var s=function(t){for(var e=0;eTop Hits

Get LocusZoom.js

-
Current stable release: v0.7.0
+
Current stable release: v0.7.1

To use LocusZoom.js in your application you will need both LocusZoom's compiled Javascript and CSS and two third-party Javascript libraries (available here in a single vendor bundle).

@@ -82,7 +82,7 @@
Javascript
CSS
@@ -95,7 +95,7 @@
CSS
Dependencies
diff --git a/package-lock.json b/package-lock.json index 9814f5fe..786fe92b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "locuszoom", - "version": "0.7.0", + "version": "0.7.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index b94e0763..b2b0fc73 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "locuszoom", - "version": "0.7.0", + "version": "0.7.1", "description": "Generate interactive visualizations of statistical genetic data", "keywords": [ "visualization",