jbrowse-plugin-gwas 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +12 -67
- package/dist/LinearManhattanDisplay/configSchemaFactory.d.ts +2 -0
- package/dist/LinearManhattanDisplay/index.d.ts +2 -1
- package/dist/LinearManhattanRenderer/index.d.ts +1 -1
- package/dist/jbrowse-plugin-gwas.cjs.development.js +26 -25
- package/dist/jbrowse-plugin-gwas.cjs.development.js.map +1 -1
- package/dist/jbrowse-plugin-gwas.cjs.production.min.js +1 -1
- package/dist/jbrowse-plugin-gwas.cjs.production.min.js.map +1 -1
- package/dist/jbrowse-plugin-gwas.esm.js +22 -21
- package/dist/jbrowse-plugin-gwas.esm.js.map +1 -1
- package/dist/jbrowse-plugin-gwas.umd.development.js +28 -29
- package/dist/jbrowse-plugin-gwas.umd.development.js.map +1 -1
- package/dist/jbrowse-plugin-gwas.umd.production.min.js +1 -1
- package/dist/jbrowse-plugin-gwas.umd.production.min.js.map +1 -1
- package/package.json +1 -1
- package/src/LinearManhattanDisplay/configSchemaFactory.ts +64 -0
- package/src/LinearManhattanDisplay/index.ts +4 -66
- package/src/LinearManhattanRenderer/LinearManhattanRenderer.ts +1 -2
- package/src/LinearManhattanRenderer/index.ts +14 -0
- package/src/index.ts +8 -15
- package/src/LinearManhattanRenderer/index.js +0 -19
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,89 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jbrowse-plugin-gwas
|
|
2
2
|
|
|
3
3
|
Plugin for displaying GWAS results such as manhattan plot renderings
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
### For use in [JBrowse Web](https://jbrowse.org/jb2/docs/quickstart_web)
|
|
8
|
-
|
|
9
|
-
No installation required
|
|
10
|
-
|
|
11
|
-
### For use in [`@jbrowse/react-linear-view`](https://www.npmjs.com/package/@jbrowse/react-linear-genome-view)
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
yarn add jbrowse-plugin-gwas
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
### In [JBrowse Web](https://jbrowse.org/jb2/docs/quickstart_web)
|
|
20
|
-
|
|
21
|
-
#### Development
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
git clone https://github.com/cmdcolin/jbrowse-plugin-gwas.git
|
|
25
|
-
cd jbrowse-plugin-gwas
|
|
26
|
-
yarn
|
|
27
|
-
yarn start
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Then open JBrowse Web to (assuming it is running on port 3000):
|
|
31
|
-
|
|
32
|
-
http://localhost:3000/?config=http://localhost:9000/config.json
|
|
33
|
-
|
|
34
|
-
#### Demo
|
|
5
|
+
## Screenshot
|
|
35
6
|
|
|
36
|
-
|
|
7
|
+

|
|
8
|
+

|
|
37
9
|
|
|
38
|
-
|
|
10
|
+
## Usage in jbrowse-web
|
|
39
11
|
|
|
40
|
-
Add to the "plugins" of your JBrowse Web config
|
|
12
|
+
Add to the "plugins" of your JBrowse Web config. The unpkg CDN should be stable, or you can download the js file to your server
|
|
41
13
|
|
|
42
14
|
```json
|
|
43
15
|
{
|
|
44
16
|
"plugins": [
|
|
45
17
|
{
|
|
46
|
-
"name": "
|
|
18
|
+
"name": "GWAS",
|
|
47
19
|
"url": "https://unpkg.com/jbrowse-plugin-gwas/dist/jbrowse-plugin-gwas.umd.production.min.js"
|
|
48
20
|
}
|
|
49
21
|
]
|
|
50
22
|
}
|
|
51
23
|
```
|
|
52
24
|
|
|
53
|
-
|
|
25
|
+
This plugin is currently quite basic, and there is no mouseover interactivity or drawn labels on features
|
|
54
26
|
|
|
55
|
-
|
|
56
|
-
import React from "react";
|
|
57
|
-
import "fontsource-roboto";
|
|
58
|
-
import {
|
|
59
|
-
createViewState,
|
|
60
|
-
createJBrowseTheme,
|
|
61
|
-
JBrowseLinearGenomeView,
|
|
62
|
-
ThemeProvider,
|
|
63
|
-
} from "@jbrowse/react-linear-view";
|
|
64
|
-
import GWAS from "jbrowse-plugin-gwas";
|
|
27
|
+
#### Demo
|
|
65
28
|
|
|
66
|
-
|
|
29
|
+
https://jbrowse.org/code/jb2/main/index.html?config=https%3A%2F%2Funpkg.com%2Fjbrowse-plugin-gwas%2Fdist%2Fconfig.json&session=share-iehjT6AoHd&password=lZS7v
|
|
67
30
|
|
|
68
|
-
function View() {
|
|
69
|
-
const state = createViewState({
|
|
70
|
-
assembly: {
|
|
71
|
-
/* assembly */
|
|
72
|
-
},
|
|
73
|
-
tracks: [
|
|
74
|
-
/* tracks */
|
|
75
|
-
],
|
|
76
|
-
plugins: [GWAS],
|
|
77
|
-
});
|
|
78
|
-
return (
|
|
79
|
-
<ThemeProvider theme={theme}>
|
|
80
|
-
<JBrowseLinearGenomeView viewState={state} />
|
|
81
|
-
</ThemeProvider>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
31
|
|
|
86
|
-
|
|
32
|
+
### For use in jbrowse/react-linear-genome-view
|
|
87
33
|
|
|
88
|
-
|
|
89
|
-

|
|
34
|
+
See [DEVELOPMENT](DEVELOPMENT.md)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import PluginManager from "@jbrowse/core/PluginManager";
|
|
2
|
-
export
|
|
2
|
+
export { configSchemaFactory } from "./configSchemaFactory";
|
|
3
3
|
export declare function stateModelFactory(pluginManager: PluginManager, configSchema: any): import("mobx-state-tree").IModelType<import("mobx-state-tree").ModelProperties & {
|
|
4
4
|
type: import("mobx-state-tree").ISimpleType<"LinearManhattanDisplay">;
|
|
5
5
|
}, {
|
|
6
6
|
readonly rendererTypeName: string;
|
|
7
7
|
readonly needsScalebar: boolean;
|
|
8
|
+
readonly regionTooLarge: boolean;
|
|
8
9
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
9
10
|
export declare type LinearManhattanDisplayModel = ReturnType<typeof stateModelFactory>;
|
|
@@ -5,7 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
7
|
var Plugin = _interopDefault(require('@jbrowse/core/Plugin'));
|
|
8
|
+
var DisplayType = _interopDefault(require('@jbrowse/core/pluggableElementTypes/DisplayType'));
|
|
8
9
|
var configuration = require('@jbrowse/core/configuration');
|
|
10
|
+
var util = require('@jbrowse/core/util');
|
|
11
|
+
var mobxStateTree = require('mobx-state-tree');
|
|
9
12
|
|
|
10
13
|
function _classCallCheck(instance, Constructor) {
|
|
11
14
|
if (!(instance instanceof Constructor)) {
|
|
@@ -275,7 +278,6 @@ function rendererFactory(pluginManager) {
|
|
|
275
278
|
var _WigglePlugin$exports = WigglePlugin.exports,
|
|
276
279
|
getScale = _WigglePlugin$exports.utils.getScale,
|
|
277
280
|
WiggleBaseRenderer = _WigglePlugin$exports.WiggleBaseRenderer;
|
|
278
|
-
var featureSpanPx = pluginManager.lib["@jbrowse/core/util"].featureSpanPx;
|
|
279
281
|
return /*#__PURE__*/function (_WiggleBaseRenderer) {
|
|
280
282
|
_inherits(ManhattanPlotRenderer, _WiggleBaseRenderer);
|
|
281
283
|
|
|
@@ -323,7 +325,7 @@ function rendererFactory(pluginManager) {
|
|
|
323
325
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
324
326
|
var feature = _step.value;
|
|
325
327
|
|
|
326
|
-
var _featureSpanPx = featureSpanPx(feature, region, bpPerPx),
|
|
328
|
+
var _featureSpanPx = util.featureSpanPx(feature, region, bpPerPx),
|
|
327
329
|
_featureSpanPx2 = _slicedToArray(_featureSpanPx, 1),
|
|
328
330
|
leftPx = _featureSpanPx2[0];
|
|
329
331
|
|
|
@@ -356,30 +358,25 @@ function rendererFactory(pluginManager) {
|
|
|
356
358
|
}(WiggleBaseRenderer);
|
|
357
359
|
}
|
|
358
360
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
explicitlyTyped: true
|
|
369
|
-
});
|
|
370
|
-
}
|
|
361
|
+
var configSchema = /*#__PURE__*/configuration.ConfigurationSchema("LinearManhattanRenderer", {
|
|
362
|
+
color: {
|
|
363
|
+
type: "color",
|
|
364
|
+
description: "the color of the marks",
|
|
365
|
+
defaultValue: "darkblue"
|
|
366
|
+
}
|
|
367
|
+
}, {
|
|
368
|
+
explicitlyTyped: true
|
|
369
|
+
});
|
|
371
370
|
|
|
372
|
-
function configSchemaFactory
|
|
373
|
-
var types = pluginManager.lib["mobx-state-tree"].types;
|
|
374
|
-
var ConfigurationSchema = pluginManager.lib["@jbrowse/core/configuration"].ConfigurationSchema;
|
|
371
|
+
function configSchemaFactory(pluginManager) {
|
|
375
372
|
var LGVPlugin = pluginManager.getPlugin("LinearGenomeViewPlugin"); //@ts-ignore
|
|
376
373
|
|
|
377
374
|
var baseLinearDisplayConfigSchema = LGVPlugin.exports.baseLinearDisplayConfigSchema;
|
|
378
|
-
return ConfigurationSchema("LinearManhattanDisplay", {
|
|
375
|
+
return configuration.ConfigurationSchema("LinearManhattanDisplay", {
|
|
379
376
|
autoscale: {
|
|
380
377
|
type: "stringEnum",
|
|
381
378
|
defaultValue: "local",
|
|
382
|
-
model: types.enumeration("Autoscale type", ["global", "local", "globalsd", "localsd", "zscore"]),
|
|
379
|
+
model: mobxStateTree.types.enumeration("Autoscale type", ["global", "local", "globalsd", "localsd", "zscore"]),
|
|
383
380
|
description: "global/local using their min/max values or w/ standard deviations (globalsd/localsd)"
|
|
384
381
|
},
|
|
385
382
|
minScore: {
|
|
@@ -399,7 +396,7 @@ function configSchemaFactory$1(pluginManager) {
|
|
|
399
396
|
},
|
|
400
397
|
scaleType: {
|
|
401
398
|
type: "stringEnum",
|
|
402
|
-
model: types.enumeration("Scale type", ["linear", "log"]),
|
|
399
|
+
model: mobxStateTree.types.enumeration("Scale type", ["linear", "log"]),
|
|
403
400
|
description: "The type of scale to use",
|
|
404
401
|
defaultValue: "linear"
|
|
405
402
|
},
|
|
@@ -410,7 +407,7 @@ function configSchemaFactory$1(pluginManager) {
|
|
|
410
407
|
},
|
|
411
408
|
defaultRendering: {
|
|
412
409
|
type: "stringEnum",
|
|
413
|
-
model: types.enumeration("Rendering", ["density", "xyplot", "line"]),
|
|
410
|
+
model: mobxStateTree.types.enumeration("Rendering", ["density", "xyplot", "line"]),
|
|
414
411
|
defaultValue: "xyplot"
|
|
415
412
|
}
|
|
416
413
|
}, {
|
|
@@ -418,6 +415,7 @@ function configSchemaFactory$1(pluginManager) {
|
|
|
418
415
|
explicitlyTyped: true
|
|
419
416
|
});
|
|
420
417
|
}
|
|
418
|
+
|
|
421
419
|
function stateModelFactory(pluginManager, configSchema) {
|
|
422
420
|
var types = pluginManager.lib["mobx-state-tree"].types;
|
|
423
421
|
var WigglePlugin = pluginManager.getPlugin("WigglePlugin"); //@ts-ignore
|
|
@@ -433,6 +431,10 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
433
431
|
|
|
434
432
|
get needsScalebar() {
|
|
435
433
|
return true;
|
|
434
|
+
},
|
|
435
|
+
|
|
436
|
+
get regionTooLarge() {
|
|
437
|
+
return false;
|
|
436
438
|
}
|
|
437
439
|
|
|
438
440
|
};
|
|
@@ -458,12 +460,11 @@ var AlignmentsPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
458
460
|
key: "install",
|
|
459
461
|
value: function install(pluginManager) {
|
|
460
462
|
var WigglePlugin = pluginManager.getPlugin("WigglePlugin");
|
|
461
|
-
var DisplayType = pluginManager.lib["@jbrowse/core/pluggableElementTypes/DisplayType"];
|
|
462
463
|
var _WigglePlugin$exports = WigglePlugin.exports,
|
|
463
464
|
LinearWiggleDisplayReactComponent = _WigglePlugin$exports.LinearWiggleDisplayReactComponent,
|
|
464
465
|
XYPlotRendererReactComponent = _WigglePlugin$exports.XYPlotRendererReactComponent;
|
|
465
466
|
pluginManager.addDisplayType(function () {
|
|
466
|
-
var configSchema = configSchemaFactory
|
|
467
|
+
var configSchema = configSchemaFactory(pluginManager);
|
|
467
468
|
return new DisplayType({
|
|
468
469
|
name: "LinearManhattanDisplay",
|
|
469
470
|
configSchema: configSchema,
|
|
@@ -476,11 +477,11 @@ var AlignmentsPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
476
477
|
pluginManager.addRendererType(function () {
|
|
477
478
|
//@ts-ignore
|
|
478
479
|
var ManhattanRenderer = new rendererFactory(pluginManager);
|
|
479
|
-
var configSchema =
|
|
480
|
+
var configSchema$1 = configSchema;
|
|
480
481
|
return new ManhattanRenderer({
|
|
481
482
|
name: "LinearManhattanRenderer",
|
|
482
483
|
ReactComponent: XYPlotRendererReactComponent,
|
|
483
|
-
configSchema: configSchema,
|
|
484
|
+
configSchema: configSchema$1,
|
|
484
485
|
pluginManager: pluginManager
|
|
485
486
|
});
|
|
486
487
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jbrowse-plugin-gwas.cjs.development.js","sources":["../src/LinearManhattanRenderer/LinearManhattanRenderer.ts","../src/LinearManhattanRenderer/index.js","../src/LinearManhattanDisplay/index.ts","../src/index.ts"],"sourcesContent":["import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { readConfObject } from \"@jbrowse/core/configuration\";\n\nexport default function rendererFactory(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const {\n utils: { getScale },\n WiggleBaseRenderer,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n const { featureSpanPx } = pluginManager.lib[\"@jbrowse/core/util\"];\n\n return class ManhattanPlotRenderer extends WiggleBaseRenderer {\n draw(ctx: CanvasRenderingContext2D, props: any) {\n const {\n features,\n regions,\n bpPerPx,\n config,\n scaleOpts,\n height: unadjustedHeight,\n displayCrossHatches,\n ticks: { values },\n } = props;\n const [region] = regions;\n const YSCALEBAR_LABEL_OFFSET = 5;\n const height = unadjustedHeight - YSCALEBAR_LABEL_OFFSET * 2;\n const opts = { ...scaleOpts, range: [0, height] };\n const width = (region.end - region.start) / bpPerPx;\n\n const scale = getScale(opts);\n const toY = (n: number) => height - scale(n) + YSCALEBAR_LABEL_OFFSET;\n\n for (const feature of features.values()) {\n const [leftPx] = featureSpanPx(feature, region, bpPerPx);\n const score = feature.get(\"score\") as number;\n ctx.fillStyle = readConfObject(config, \"color\", [feature]);\n ctx.beginPath();\n ctx.arc(leftPx, toY(score), 2, 0, 2 * Math.PI);\n ctx.fill();\n }\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"rgba(200,200,200,0.8)\";\n values.forEach((tick: number) => {\n ctx.beginPath();\n ctx.moveTo(0, Math.round(toY(tick)));\n ctx.lineTo(width, Math.round(toY(tick)));\n ctx.stroke();\n });\n }\n }\n };\n}\n","export { default } from \"./LinearManhattanRenderer\";\n\nexport function configSchemaFactory(pluginManager) {\n const { ConfigurationSchema } = pluginManager.lib[\n \"@jbrowse/core/configuration\"\n ];\n\n return ConfigurationSchema(\n \"LinearManhattanRenderer\",\n {\n color: {\n type: \"color\",\n description: \"the color of the marks\",\n defaultValue: \"darkblue\",\n },\n },\n { explicitlyTyped: true },\n );\n}\n","import PluginManager from \"@jbrowse/core/PluginManager\";\n\nexport function configSchemaFactory(pluginManager: PluginManager) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const { ConfigurationSchema } = pluginManager.lib[\n \"@jbrowse/core/configuration\"\n ];\n\n const LGVPlugin = pluginManager.getPlugin(\n \"LinearGenomeViewPlugin\",\n ) as import(\"@jbrowse/plugin-linear-genome-view\").default;\n //@ts-ignore\n const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;\n\n return ConfigurationSchema(\n \"LinearManhattanDisplay\",\n {\n autoscale: {\n type: \"stringEnum\",\n defaultValue: \"local\",\n model: types.enumeration(\"Autoscale type\", [\n \"global\",\n \"local\",\n \"globalsd\",\n \"localsd\",\n \"zscore\",\n ]),\n description:\n \"global/local using their min/max values or w/ standard deviations (globalsd/localsd)\",\n },\n minScore: {\n type: \"number\",\n defaultValue: Number.MIN_VALUE,\n description: \"minimum value for the y-scale\",\n },\n maxScore: {\n type: \"number\",\n description: \"maximum value for the y-scale\",\n defaultValue: Number.MAX_VALUE,\n },\n numStdDev: {\n type: \"number\",\n description:\n \"number of standard deviations to use for autoscale types globalsd or localsd\",\n defaultValue: 3,\n },\n scaleType: {\n type: \"stringEnum\",\n model: types.enumeration(\"Scale type\", [\"linear\", \"log\"]), // todo zscale\n description: \"The type of scale to use\",\n defaultValue: \"linear\",\n },\n inverted: {\n type: \"boolean\",\n description: \"draw upside down\",\n defaultValue: false,\n },\n\n defaultRendering: {\n type: \"stringEnum\",\n model: types.enumeration(\"Rendering\", [\"density\", \"xyplot\", \"line\"]),\n defaultValue: \"xyplot\",\n },\n },\n { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },\n );\n}\n\nexport function stateModelFactory(\n pluginManager: PluginManager,\n configSchema: any,\n) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n //@ts-ignore\n const { linearWiggleDisplayModelFactory } = WigglePlugin.exports;\n return types.compose(\n \"LinearManhattanDisplay\",\n linearWiggleDisplayModelFactory(pluginManager, configSchema),\n types\n .model({\n type: types.literal(\"LinearManhattanDisplay\"),\n })\n .views(() => ({\n get rendererTypeName() {\n return \"LinearManhattanRenderer\";\n },\n get needsScalebar() {\n return true;\n },\n })),\n );\n}\n\nexport type LinearManhattanDisplayModel = ReturnType<typeof stateModelFactory>;\n","import Plugin from \"@jbrowse/core/Plugin\";\nimport PluginManager from \"@jbrowse/core/PluginManager\";\nimport rendererFactory, {\n configSchemaFactory as linearManhattanRendererConfigSchemaFactory,\n} from \"./LinearManhattanRenderer\";\nimport {\n configSchemaFactory as linearManhattanDisplayConfigSchemaFactory,\n stateModelFactory as linearManhattanDisplayModelFactory,\n} from \"./LinearManhattanDisplay\";\n\nexport default class AlignmentsPlugin extends Plugin {\n name = \"GWASPlugin\";\n\n install(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const DisplayType =\n pluginManager.lib[\"@jbrowse/core/pluggableElementTypes/DisplayType\"];\n const {\n LinearWiggleDisplayReactComponent,\n XYPlotRendererReactComponent,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n pluginManager.addDisplayType(() => {\n const configSchema = linearManhattanDisplayConfigSchemaFactory(\n pluginManager,\n );\n return new DisplayType({\n name: \"LinearManhattanDisplay\",\n configSchema,\n stateModel: linearManhattanDisplayModelFactory(\n pluginManager,\n configSchema,\n ),\n trackType: \"FeatureTrack\",\n viewType: \"LinearGenomeView\",\n ReactComponent: LinearWiggleDisplayReactComponent,\n });\n });\n\n pluginManager.addRendererType(() => {\n //@ts-ignore\n const ManhattanRenderer = new rendererFactory(pluginManager);\n const configSchema = linearManhattanRendererConfigSchemaFactory(\n pluginManager,\n );\n return new ManhattanRenderer({\n name: \"LinearManhattanRenderer\",\n ReactComponent: XYPlotRendererReactComponent,\n configSchema,\n pluginManager,\n });\n });\n }\n}\n"],"names":["rendererFactory","pluginManager","WigglePlugin","getPlugin","exports","getScale","utils","WiggleBaseRenderer","featureSpanPx","lib","ctx","props","features","regions","bpPerPx","config","scaleOpts","unadjustedHeight","height","displayCrossHatches","values","ticks","region","YSCALEBAR_LABEL_OFFSET","opts","range","width","end","start","scale","toY","n","feature","leftPx","score","get","fillStyle","readConfObject","beginPath","arc","Math","PI","fill","lineWidth","strokeStyle","forEach","tick","moveTo","round","lineTo","stroke","configSchemaFactory","ConfigurationSchema","color","type","description","defaultValue","explicitlyTyped","types","LGVPlugin","baseLinearDisplayConfigSchema","autoscale","model","enumeration","minScore","Number","MIN_VALUE","maxScore","MAX_VALUE","numStdDev","scaleType","inverted","defaultRendering","baseConfiguration","stateModelFactory","configSchema","linearWiggleDisplayModelFactory","compose","literal","views","rendererTypeName","needsScalebar","AlignmentsPlugin","DisplayType","LinearWiggleDisplayReactComponent","XYPlotRendererReactComponent","addDisplayType","linearManhattanDisplayConfigSchemaFactory","name","stateModel","linearManhattanDisplayModelFactory","trackType","viewType","ReactComponent","addRendererType","ManhattanRenderer","linearManhattanRendererConfigSchemaFactory","Plugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAGwBA,gBAAgBC;AACtC,MAAMC,YAAY,GAAGD,aAAa,CAACE,SAAd,CACnB,cADmB,CAArB;8BAOID,YAAY,CAACE;MAHNC,iCAATC,MAASD;MACTE,2CAAAA;MAIMC,gBAAkBP,aAAa,CAACQ,GAAd,CAAkB,oBAAlB,EAAlBD;AAER;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA,2BACOE,GADP,EACsCC,KADtC;YAGMC,WAQED,MARFC;YACAC,UAOEF,MAPFE;YACAC,UAMEH,MANFG;YACAC,SAKEJ,MALFI;YACAC,YAIEL,MAJFK;YACQC,mBAGNN,MAHFO;YACAC,sBAEER,MAFFQ;YACSC,SACPT,MADFU,MAASD;;sCAEMP;YAAVS;;AACP,YAAMC,sBAAsB,GAAG,CAA/B;AACA,YA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AoBC,aAApB,CAA1B;AACA,YAAM0E,YAAY,GAAGqB,mBAA0C,CAC7D/F,aAD6D,CAA/D;AAGA,eAAO,IAAI8F,iBAAJ,CAAsB;AAC3BP,UAAAA,IAAI,EAAE,yBADqB;AAE3BK,UAAAA,cAAc,EAAER,4BAFW;AAG3BV,UAAAA,YAAY,EAAZA,YAH2B;AAI3B1E,UAAAA,aAAa,EAAbA;AAJ2B,SAAtB,CAAP;AAMD,OAZD;AAaD;;;;EA7C2CgG;;;;"}
|
|
1
|
+
{"version":3,"file":"jbrowse-plugin-gwas.cjs.development.js","sources":["../src/LinearManhattanRenderer/LinearManhattanRenderer.ts","../src/LinearManhattanRenderer/index.ts","../src/LinearManhattanDisplay/configSchemaFactory.ts","../src/LinearManhattanDisplay/index.ts","../src/index.ts"],"sourcesContent":["import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { readConfObject } from \"@jbrowse/core/configuration\";\nimport { featureSpanPx } from \"@jbrowse/core/util\";\n\nexport default function rendererFactory(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const {\n utils: { getScale },\n WiggleBaseRenderer,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n return class ManhattanPlotRenderer extends WiggleBaseRenderer {\n draw(ctx: CanvasRenderingContext2D, props: any) {\n const {\n features,\n regions,\n bpPerPx,\n config,\n scaleOpts,\n height: unadjustedHeight,\n displayCrossHatches,\n ticks: { values },\n } = props;\n const [region] = regions;\n const YSCALEBAR_LABEL_OFFSET = 5;\n const height = unadjustedHeight - YSCALEBAR_LABEL_OFFSET * 2;\n const opts = { ...scaleOpts, range: [0, height] };\n const width = (region.end - region.start) / bpPerPx;\n\n const scale = getScale(opts);\n const toY = (n: number) => height - scale(n) + YSCALEBAR_LABEL_OFFSET;\n\n for (const feature of features.values()) {\n const [leftPx] = featureSpanPx(feature, region, bpPerPx);\n const score = feature.get(\"score\") as number;\n ctx.fillStyle = readConfObject(config, \"color\", [feature]);\n ctx.beginPath();\n ctx.arc(leftPx, toY(score), 2, 0, 2 * Math.PI);\n ctx.fill();\n }\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"rgba(200,200,200,0.8)\";\n values.forEach((tick: number) => {\n ctx.beginPath();\n ctx.moveTo(0, Math.round(toY(tick)));\n ctx.lineTo(width, Math.round(toY(tick)));\n ctx.stroke();\n });\n }\n }\n };\n}\n","export { default } from \"./LinearManhattanRenderer\";\nimport { ConfigurationSchema } from \"@jbrowse/core/configuration\";\n\nexport const configSchema = ConfigurationSchema(\n \"LinearManhattanRenderer\",\n {\n color: {\n type: \"color\",\n description: \"the color of the marks\",\n defaultValue: \"darkblue\",\n },\n },\n { explicitlyTyped: true },\n);\n","import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { types } from \"mobx-state-tree\";\nimport { ConfigurationSchema } from \"@jbrowse/core/configuration\";\n\nexport function configSchemaFactory(pluginManager: PluginManager) {\n const LGVPlugin = pluginManager.getPlugin(\n \"LinearGenomeViewPlugin\",\n ) as import(\"@jbrowse/plugin-linear-genome-view\").default;\n //@ts-ignore\n const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;\n\n return ConfigurationSchema(\n \"LinearManhattanDisplay\",\n {\n autoscale: {\n type: \"stringEnum\",\n defaultValue: \"local\",\n model: types.enumeration(\"Autoscale type\", [\n \"global\",\n \"local\",\n \"globalsd\",\n \"localsd\",\n \"zscore\",\n ]),\n description:\n \"global/local using their min/max values or w/ standard deviations (globalsd/localsd)\",\n },\n minScore: {\n type: \"number\",\n defaultValue: Number.MIN_VALUE,\n description: \"minimum value for the y-scale\",\n },\n maxScore: {\n type: \"number\",\n description: \"maximum value for the y-scale\",\n defaultValue: Number.MAX_VALUE,\n },\n numStdDev: {\n type: \"number\",\n description:\n \"number of standard deviations to use for autoscale types globalsd or localsd\",\n defaultValue: 3,\n },\n scaleType: {\n type: \"stringEnum\",\n model: types.enumeration(\"Scale type\", [\"linear\", \"log\"]), // todo zscale\n description: \"The type of scale to use\",\n defaultValue: \"linear\",\n },\n inverted: {\n type: \"boolean\",\n description: \"draw upside down\",\n defaultValue: false,\n },\n\n defaultRendering: {\n type: \"stringEnum\",\n model: types.enumeration(\"Rendering\", [\"density\", \"xyplot\", \"line\"]),\n defaultValue: \"xyplot\",\n },\n },\n { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },\n );\n}\n","import PluginManager from \"@jbrowse/core/PluginManager\";\nexport { configSchemaFactory } from \"./configSchemaFactory\";\n\nexport function stateModelFactory(\n pluginManager: PluginManager,\n configSchema: any,\n) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n //@ts-ignore\n const { linearWiggleDisplayModelFactory } = WigglePlugin.exports;\n return types.compose(\n \"LinearManhattanDisplay\",\n linearWiggleDisplayModelFactory(pluginManager, configSchema),\n types\n .model({\n type: types.literal(\"LinearManhattanDisplay\"),\n })\n .views(() => ({\n get rendererTypeName() {\n return \"LinearManhattanRenderer\";\n },\n get needsScalebar() {\n return true;\n },\n get regionTooLarge() {\n return false;\n },\n })),\n );\n}\n\nexport type LinearManhattanDisplayModel = ReturnType<typeof stateModelFactory>;\n","import Plugin from \"@jbrowse/core/Plugin\";\nimport PluginManager from \"@jbrowse/core/PluginManager\";\nimport DisplayType from \"@jbrowse/core/pluggableElementTypes/DisplayType\";\nimport rendererFactory, {\n configSchema as rendererConfigSchema,\n} from \"./LinearManhattanRenderer\";\nimport {\n configSchemaFactory as displayConfigSchemaFactory,\n stateModelFactory as displayModelFactory,\n} from \"./LinearManhattanDisplay\";\n\nexport default class AlignmentsPlugin extends Plugin {\n name = \"GWASPlugin\";\n\n install(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n\n const {\n LinearWiggleDisplayReactComponent,\n XYPlotRendererReactComponent,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n pluginManager.addDisplayType(() => {\n const configSchema = displayConfigSchemaFactory(pluginManager);\n return new DisplayType({\n name: \"LinearManhattanDisplay\",\n configSchema,\n stateModel: displayModelFactory(pluginManager, configSchema),\n trackType: \"FeatureTrack\",\n viewType: \"LinearGenomeView\",\n ReactComponent: LinearWiggleDisplayReactComponent,\n });\n });\n\n pluginManager.addRendererType(() => {\n //@ts-ignore\n const ManhattanRenderer = new rendererFactory(pluginManager);\n const configSchema = rendererConfigSchema;\n return new ManhattanRenderer({\n name: \"LinearManhattanRenderer\",\n ReactComponent: XYPlotRendererReactComponent,\n configSchema,\n pluginManager,\n });\n });\n }\n}\n"],"names":["rendererFactory","pluginManager","WigglePlugin","getPlugin","exports","getScale","utils","WiggleBaseRenderer","ctx","props","features","regions","bpPerPx","config","scaleOpts","unadjustedHeight","height","displayCrossHatches","values","ticks","region","YSCALEBAR_LABEL_OFFSET","opts","range","width","end","start","scale","toY","n","feature","featureSpanPx","leftPx","score","get","fillStyle","readConfObject","beginPath","arc","Math","PI","fill","lineWidth","strokeStyle","forEach","tick","moveTo","round","lineTo","stroke","configSchema","ConfigurationSchema","color","type","description","defaultValue","explicitlyTyped","configSchemaFactory","LGVPlugin","baseLinearDisplayConfigSchema","autoscale","model","types","enumeration","minScore","Number","MIN_VALUE","maxScore","MAX_VALUE","numStdDev","scaleType","inverted","defaultRendering","baseConfiguration","stateModelFactory","lib","linearWiggleDisplayModelFactory","compose","literal","views","rendererTypeName","needsScalebar","regionTooLarge","AlignmentsPlugin","LinearWiggleDisplayReactComponent","XYPlotRendererReactComponent","addDisplayType","displayConfigSchemaFactory","DisplayType","name","stateModel","displayModelFactory","trackType","viewType","ReactComponent","addRendererType","ManhattanRenderer","rendererConfigSchema","Plugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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YAAMpC,YAAY,GAAGqC,mBAA0B,CAACtF,aAAD,CAA/C;AACA,eAAO,IAAIuF,WAAJ,CAAgB;AACrBC,UAAAA,IAAI,EAAE,wBADe;AAErBvC,UAAAA,YAAY,EAAZA,YAFqB;AAGrBwC,UAAAA,UAAU,EAAEC,iBAAmB,CAAC1F,aAAD,EAAgBiD,YAAhB,CAHV;AAIrB0C,UAAAA,SAAS,EAAE,cAJU;AAKrBC,UAAAA,QAAQ,EAAE,kBALW;AAMrBC,UAAAA,cAAc,EAAEV;AANK,SAAhB,CAAP;AAQD,OAVD;AAYAnF,MAAAA,aAAa,CAAC8F,eAAd,CAA8B;AAC5B;AACA,YAAMC,iBAAiB,GAAG,IAAIhG,eAAJ,CAAoBC,aAApB,CAA1B;AACA,YAAMiD,cAAY,GAAG+C,YAArB;AACA,eAAO,IAAID,iBAAJ,CAAsB;AAC3BP,UAAAA,IAAI,EAAE,yBADqB;AAE3BK,UAAAA,cAAc,EAAET,4BAFW;AAG3BnC,UAAAA,YAAY,EAAZA,cAH2B;AAI3BjD,UAAAA,aAAa,EAAbA;AAJ2B,SAAtB,CAAP;AAMD,OAVD;AAWD;;;;EArC2CiG;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@jbrowse/core/Plugin")),r=e(require("@jbrowse/core/pluggableElementTypes/DisplayType")),n=require("@jbrowse/core/configuration"),o=require("@jbrowse/core/util"),a=require("mobx-state-tree");function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function b(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=y(e);if(t){var o=y(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return d(this,r)}}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return r}}(e,t)||m(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){if(e){if("string"==typeof e)return h(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(e,t):void 0}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e){var t=e.getPlugin("WigglePlugin").exports,r=t.utils.getScale;return function(e){p(a,e);var t=b(a);function a(){return i(this,a),t.apply(this,arguments)}return l(a,[{key:"draw",value:function(e,t){var a,i=t.features,u=t.bpPerPx,l=t.config,c=t.scaleOpts,f=t.height,p=t.displayCrossHatches,y=t.ticks.values,d=g(t.regions,1)[0],b=f-10,h=s(s({},c),{},{range:[0,b]}),v=(d.end-d.start)/u,w=r(h),O=function(e){return b-w(e)+5},P=function(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=m(e))){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){u=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw a}}}}(i.values());try{for(P.s();!(a=P.n()).done;){var j=a.value,S=g(o.featureSpanPx(j,d,u),1)[0],x=j.get("score");e.fillStyle=n.readConfObject(l,"color",[j]),e.beginPath(),e.arc(S,O(x),2,0,2*Math.PI),e.fill()}}catch(e){P.e(e)}finally{P.f()}p&&(e.lineWidth=1,e.strokeStyle="rgba(200,200,200,0.8)",y.forEach((function(t){e.beginPath(),e.moveTo(0,Math.round(O(t))),e.lineTo(v,Math.round(O(t))),e.stroke()})))}}]),a}(t.WiggleBaseRenderer)}var w=n.ConfigurationSchema("LinearManhattanRenderer",{color:{type:"color",description:"the color of the marks",defaultValue:"darkblue"}},{explicitlyTyped:!0});function O(e,t){var r=e.lib["mobx-state-tree"].types,n=e.getPlugin("WigglePlugin");return r.compose("LinearManhattanDisplay",(0,n.exports.linearWiggleDisplayModelFactory)(e,t),r.model({type:r.literal("LinearManhattanDisplay")}).views((function(){return{get rendererTypeName(){return"LinearManhattanRenderer"},get needsScalebar(){return!0},get regionTooLarge(){return!1}}})))}exports.default=function(e){p(u,t);var o=b(u);function u(){var e;return i(this,u),(e=o.apply(this,arguments)).name="GWASPlugin",e}return l(u,[{key:"install",value:function(e){var t=e.getPlugin("WigglePlugin").exports,o=t.LinearWiggleDisplayReactComponent,i=t.XYPlotRendererReactComponent;e.addDisplayType((function(){var t=function(e){var t=e.getPlugin("LinearGenomeViewPlugin").exports.baseLinearDisplayConfigSchema;return n.ConfigurationSchema("LinearManhattanDisplay",{autoscale:{type:"stringEnum",defaultValue:"local",model:a.types.enumeration("Autoscale type",["global","local","globalsd","localsd","zscore"]),description:"global/local using their min/max values or w/ standard deviations (globalsd/localsd)"},minScore:{type:"number",defaultValue:Number.MIN_VALUE,description:"minimum value for the y-scale"},maxScore:{type:"number",description:"maximum value for the y-scale",defaultValue:Number.MAX_VALUE},numStdDev:{type:"number",description:"number of standard deviations to use for autoscale types globalsd or localsd",defaultValue:3},scaleType:{type:"stringEnum",model:a.types.enumeration("Scale type",["linear","log"]),description:"The type of scale to use",defaultValue:"linear"},inverted:{type:"boolean",description:"draw upside down",defaultValue:!1},defaultRendering:{type:"stringEnum",model:a.types.enumeration("Rendering",["density","xyplot","line"]),defaultValue:"xyplot"}},{baseConfiguration:t,explicitlyTyped:!0})}(e);return new r({name:"LinearManhattanDisplay",configSchema:t,stateModel:O(e,t),trackType:"FeatureTrack",viewType:"LinearGenomeView",ReactComponent:o})})),e.addRendererType((function(){return new new v(e)({name:"LinearManhattanRenderer",ReactComponent:i,configSchema:w,pluginManager:e})}))}}]),u}();
|
|
2
2
|
//# sourceMappingURL=jbrowse-plugin-gwas.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jbrowse-plugin-gwas.cjs.production.min.js","sources":["../src/LinearManhattanRenderer/LinearManhattanRenderer.ts","../src/LinearManhattanDisplay/index.ts","../src/index.ts","../src/LinearManhattanRenderer/index.js"],"sourcesContent":["import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { readConfObject } from \"@jbrowse/core/configuration\";\n\nexport default function rendererFactory(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const {\n utils: { getScale },\n WiggleBaseRenderer,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n const { featureSpanPx } = pluginManager.lib[\"@jbrowse/core/util\"];\n\n return class ManhattanPlotRenderer extends WiggleBaseRenderer {\n draw(ctx: CanvasRenderingContext2D, props: any) {\n const {\n features,\n regions,\n bpPerPx,\n config,\n scaleOpts,\n height: unadjustedHeight,\n displayCrossHatches,\n ticks: { values },\n } = props;\n const [region] = regions;\n const YSCALEBAR_LABEL_OFFSET = 5;\n const height = unadjustedHeight - YSCALEBAR_LABEL_OFFSET * 2;\n const opts = { ...scaleOpts, range: [0, height] };\n const width = (region.end - region.start) / bpPerPx;\n\n const scale = getScale(opts);\n const toY = (n: number) => height - scale(n) + YSCALEBAR_LABEL_OFFSET;\n\n for (const feature of features.values()) {\n const [leftPx] = featureSpanPx(feature, region, bpPerPx);\n const score = feature.get(\"score\") as number;\n ctx.fillStyle = readConfObject(config, \"color\", [feature]);\n ctx.beginPath();\n ctx.arc(leftPx, toY(score), 2, 0, 2 * Math.PI);\n ctx.fill();\n }\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"rgba(200,200,200,0.8)\";\n values.forEach((tick: number) => {\n ctx.beginPath();\n ctx.moveTo(0, Math.round(toY(tick)));\n ctx.lineTo(width, Math.round(toY(tick)));\n ctx.stroke();\n });\n }\n }\n };\n}\n","import PluginManager from \"@jbrowse/core/PluginManager\";\n\nexport function configSchemaFactory(pluginManager: PluginManager) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const { ConfigurationSchema } = pluginManager.lib[\n \"@jbrowse/core/configuration\"\n ];\n\n const LGVPlugin = pluginManager.getPlugin(\n \"LinearGenomeViewPlugin\",\n ) as import(\"@jbrowse/plugin-linear-genome-view\").default;\n //@ts-ignore\n const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;\n\n return ConfigurationSchema(\n \"LinearManhattanDisplay\",\n {\n autoscale: {\n type: \"stringEnum\",\n defaultValue: \"local\",\n model: types.enumeration(\"Autoscale type\", [\n \"global\",\n \"local\",\n \"globalsd\",\n \"localsd\",\n \"zscore\",\n ]),\n description:\n \"global/local using their min/max values or w/ standard deviations (globalsd/localsd)\",\n },\n minScore: {\n type: \"number\",\n defaultValue: Number.MIN_VALUE,\n description: \"minimum value for the y-scale\",\n },\n maxScore: {\n type: \"number\",\n description: \"maximum value for the y-scale\",\n defaultValue: Number.MAX_VALUE,\n },\n numStdDev: {\n type: \"number\",\n description:\n \"number of standard deviations to use for autoscale types globalsd or localsd\",\n defaultValue: 3,\n },\n scaleType: {\n type: \"stringEnum\",\n model: types.enumeration(\"Scale type\", [\"linear\", \"log\"]), // todo zscale\n description: \"The type of scale to use\",\n defaultValue: \"linear\",\n },\n inverted: {\n type: \"boolean\",\n description: \"draw upside down\",\n defaultValue: false,\n },\n\n defaultRendering: {\n type: \"stringEnum\",\n model: types.enumeration(\"Rendering\", [\"density\", \"xyplot\", \"line\"]),\n defaultValue: \"xyplot\",\n },\n },\n { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },\n );\n}\n\nexport function stateModelFactory(\n pluginManager: PluginManager,\n configSchema: any,\n) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n //@ts-ignore\n const { linearWiggleDisplayModelFactory } = WigglePlugin.exports;\n return types.compose(\n \"LinearManhattanDisplay\",\n linearWiggleDisplayModelFactory(pluginManager, configSchema),\n types\n .model({\n type: types.literal(\"LinearManhattanDisplay\"),\n })\n .views(() => ({\n get rendererTypeName() {\n return \"LinearManhattanRenderer\";\n },\n get needsScalebar() {\n return true;\n },\n })),\n );\n}\n\nexport type LinearManhattanDisplayModel = ReturnType<typeof stateModelFactory>;\n","import Plugin from \"@jbrowse/core/Plugin\";\nimport PluginManager from \"@jbrowse/core/PluginManager\";\nimport rendererFactory, {\n configSchemaFactory as linearManhattanRendererConfigSchemaFactory,\n} from \"./LinearManhattanRenderer\";\nimport {\n configSchemaFactory as linearManhattanDisplayConfigSchemaFactory,\n stateModelFactory as linearManhattanDisplayModelFactory,\n} from \"./LinearManhattanDisplay\";\n\nexport default class AlignmentsPlugin extends Plugin {\n name = \"GWASPlugin\";\n\n install(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const DisplayType =\n pluginManager.lib[\"@jbrowse/core/pluggableElementTypes/DisplayType\"];\n const {\n LinearWiggleDisplayReactComponent,\n XYPlotRendererReactComponent,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n pluginManager.addDisplayType(() => {\n const configSchema = linearManhattanDisplayConfigSchemaFactory(\n pluginManager,\n );\n return new DisplayType({\n name: \"LinearManhattanDisplay\",\n configSchema,\n stateModel: linearManhattanDisplayModelFactory(\n pluginManager,\n configSchema,\n ),\n trackType: \"FeatureTrack\",\n viewType: \"LinearGenomeView\",\n ReactComponent: LinearWiggleDisplayReactComponent,\n });\n });\n\n pluginManager.addRendererType(() => {\n //@ts-ignore\n const ManhattanRenderer = new rendererFactory(pluginManager);\n const configSchema = linearManhattanRendererConfigSchemaFactory(\n pluginManager,\n );\n return new ManhattanRenderer({\n name: \"LinearManhattanRenderer\",\n ReactComponent: XYPlotRendererReactComponent,\n configSchema,\n pluginManager,\n });\n });\n }\n}\n","export { default } from \"./LinearManhattanRenderer\";\n\nexport function configSchemaFactory(pluginManager) {\n const { ConfigurationSchema } = pluginManager.lib[\n \"@jbrowse/core/configuration\"\n ];\n\n return ConfigurationSchema(\n \"LinearManhattanRenderer\",\n {\n color: {\n type: \"color\",\n description: \"the color of the marks\",\n defaultValue: \"darkblue\",\n },\n },\n { explicitlyTyped: true },\n );\n}\n"],"names":["rendererFactory","pluginManager","getPlugin","exports","getScale","utils","featureSpanPx","lib","ctx","props","features","bpPerPx","config","scaleOpts","unadjustedHeight","height","displayCrossHatches","values","ticks","region","regions","YSCALEBAR_LABEL_OFFSET","opts","range","width","end","start","scale","toY","n","feature","leftPx","score","get","fillStyle","readConfObject","beginPath","arc","Math","PI","fill","lineWidth","strokeStyle","forEach","tick","moveTo","round","lineTo","stroke","WiggleBaseRenderer","stateModelFactory","configSchema","types","WigglePlugin","compose","linearWiggleDisplayModelFactory","model","type","literal","views","Plugin","DisplayType","LinearWiggleDisplayReactComponent","XYPlotRendererReactComponent","addDisplayType","ConfigurationSchema","baseLinearDisplayConfigSchema","autoscale","defaultValue","enumeration","description","minScore","Number","MIN_VALUE","maxScore","MAX_VALUE","numStdDev","scaleType","inverted","defaultRendering","baseConfiguration","explicitlyTyped","linearManhattanDisplayConfigSchemaFactory","name","stateModel","linearManhattanDisplayModelFactory","trackType","viewType","ReactComponent","addRendererType","ManhattanRenderer","color","linearManhattanRendererConfigSchemaFactory"],"mappings":"goGAGwBA,EAAgBC,SACjBA,EAAcC,UACjC,gBAMeC,QAHNC,IAATC,MAASD,SAKHE,EAAkBL,EAAcM,IAAI,sBAApCD,gJAGDE,EAA+BC,SAEhCC,EAQED,EARFC,SAEAC,EAMEF,EANF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":["../src/LinearManhattanRenderer/LinearManhattanRenderer.ts","../src/LinearManhattanRenderer/index.ts","../src/LinearManhattanDisplay/index.ts","../src/index.ts","../src/LinearManhattanDisplay/configSchemaFactory.ts"],"sourcesContent":["import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { readConfObject } from \"@jbrowse/core/configuration\";\nimport { featureSpanPx } from \"@jbrowse/core/util\";\n\nexport default function rendererFactory(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const {\n utils: { getScale },\n WiggleBaseRenderer,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n return class ManhattanPlotRenderer extends WiggleBaseRenderer {\n draw(ctx: CanvasRenderingContext2D, props: any) {\n const {\n features,\n regions,\n bpPerPx,\n config,\n scaleOpts,\n height: unadjustedHeight,\n displayCrossHatches,\n ticks: { values },\n } = props;\n const [region] = regions;\n const YSCALEBAR_LABEL_OFFSET = 5;\n const height = unadjustedHeight - YSCALEBAR_LABEL_OFFSET * 2;\n const opts = { ...scaleOpts, range: [0, height] };\n const width = (region.end - region.start) / bpPerPx;\n\n const scale = getScale(opts);\n const toY = (n: number) => height - scale(n) + YSCALEBAR_LABEL_OFFSET;\n\n for (const feature of features.values()) {\n const [leftPx] = featureSpanPx(feature, region, bpPerPx);\n const score = feature.get(\"score\") as number;\n ctx.fillStyle = readConfObject(config, \"color\", [feature]);\n ctx.beginPath();\n ctx.arc(leftPx, toY(score), 2, 0, 2 * Math.PI);\n ctx.fill();\n }\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"rgba(200,200,200,0.8)\";\n values.forEach((tick: number) => {\n ctx.beginPath();\n ctx.moveTo(0, Math.round(toY(tick)));\n ctx.lineTo(width, Math.round(toY(tick)));\n ctx.stroke();\n });\n }\n }\n };\n}\n","export { default } from \"./LinearManhattanRenderer\";\nimport { ConfigurationSchema } from \"@jbrowse/core/configuration\";\n\nexport const configSchema = ConfigurationSchema(\n \"LinearManhattanRenderer\",\n {\n color: {\n type: \"color\",\n description: \"the color of the marks\",\n defaultValue: \"darkblue\",\n },\n },\n { explicitlyTyped: true },\n);\n","import PluginManager from \"@jbrowse/core/PluginManager\";\nexport { configSchemaFactory } from \"./configSchemaFactory\";\n\nexport function stateModelFactory(\n pluginManager: PluginManager,\n configSchema: any,\n) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n //@ts-ignore\n const { linearWiggleDisplayModelFactory } = WigglePlugin.exports;\n return types.compose(\n \"LinearManhattanDisplay\",\n linearWiggleDisplayModelFactory(pluginManager, configSchema),\n types\n .model({\n type: types.literal(\"LinearManhattanDisplay\"),\n })\n .views(() => ({\n get rendererTypeName() {\n return \"LinearManhattanRenderer\";\n },\n get needsScalebar() {\n return true;\n },\n get regionTooLarge() {\n return false;\n },\n })),\n );\n}\n\nexport type LinearManhattanDisplayModel = ReturnType<typeof stateModelFactory>;\n","import Plugin from \"@jbrowse/core/Plugin\";\nimport PluginManager from \"@jbrowse/core/PluginManager\";\nimport DisplayType from \"@jbrowse/core/pluggableElementTypes/DisplayType\";\nimport rendererFactory, {\n configSchema as rendererConfigSchema,\n} from \"./LinearManhattanRenderer\";\nimport {\n configSchemaFactory as displayConfigSchemaFactory,\n stateModelFactory as displayModelFactory,\n} from \"./LinearManhattanDisplay\";\n\nexport default class AlignmentsPlugin extends Plugin {\n name = \"GWASPlugin\";\n\n install(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n\n const {\n LinearWiggleDisplayReactComponent,\n XYPlotRendererReactComponent,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n pluginManager.addDisplayType(() => {\n const configSchema = displayConfigSchemaFactory(pluginManager);\n return new DisplayType({\n name: \"LinearManhattanDisplay\",\n configSchema,\n stateModel: displayModelFactory(pluginManager, configSchema),\n trackType: \"FeatureTrack\",\n viewType: \"LinearGenomeView\",\n ReactComponent: LinearWiggleDisplayReactComponent,\n });\n });\n\n pluginManager.addRendererType(() => {\n //@ts-ignore\n const ManhattanRenderer = new rendererFactory(pluginManager);\n const configSchema = rendererConfigSchema;\n return new ManhattanRenderer({\n name: \"LinearManhattanRenderer\",\n ReactComponent: XYPlotRendererReactComponent,\n configSchema,\n pluginManager,\n });\n });\n }\n}\n","import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { types } from \"mobx-state-tree\";\nimport { ConfigurationSchema } from \"@jbrowse/core/configuration\";\n\nexport function configSchemaFactory(pluginManager: PluginManager) {\n const LGVPlugin = pluginManager.getPlugin(\n \"LinearGenomeViewPlugin\",\n ) as import(\"@jbrowse/plugin-linear-genome-view\").default;\n //@ts-ignore\n const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;\n\n return ConfigurationSchema(\n \"LinearManhattanDisplay\",\n {\n autoscale: {\n type: \"stringEnum\",\n defaultValue: \"local\",\n model: types.enumeration(\"Autoscale type\", [\n \"global\",\n \"local\",\n \"globalsd\",\n \"localsd\",\n \"zscore\",\n ]),\n description:\n \"global/local using their min/max values or w/ standard deviations (globalsd/localsd)\",\n },\n minScore: {\n type: \"number\",\n defaultValue: Number.MIN_VALUE,\n description: \"minimum value for the y-scale\",\n },\n maxScore: {\n type: \"number\",\n description: \"maximum value for the y-scale\",\n defaultValue: Number.MAX_VALUE,\n },\n numStdDev: {\n type: \"number\",\n description:\n \"number of standard deviations to use for autoscale types globalsd or localsd\",\n defaultValue: 3,\n },\n scaleType: {\n type: \"stringEnum\",\n model: types.enumeration(\"Scale type\", [\"linear\", \"log\"]), // todo zscale\n description: \"The type of scale to use\",\n defaultValue: \"linear\",\n },\n inverted: {\n type: \"boolean\",\n description: \"draw upside down\",\n defaultValue: false,\n },\n\n defaultRendering: {\n type: \"stringEnum\",\n model: types.enumeration(\"Rendering\", [\"density\", \"xyplot\", \"line\"]),\n defaultValue: \"xyplot\",\n },\n },\n { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },\n );\n}\n"],"names":["rendererFactory","pluginManager","getPlugin","exports","getScale","utils","ctx","props","features","bpPerPx","config","scaleOpts","unadjustedHeight","height","displayCrossHatches","values","ticks","region","regions","YSCALEBAR_LABEL_OFFSET","opts","range","width","end","start","scale","toY","n","feature","leftPx","featureSpanPx","score","get","fillStyle","readConfObject","beginPath","arc","Math","PI","fill","lineWidth","strokeStyle","forEach","tick","moveTo","round","lineTo","stroke","WiggleBaseRenderer","configSchema","ConfigurationSchema","color","type","description","defaultValue","explicitlyTyped","stateModelFactory","types","lib","WigglePlugin","compose","linearWiggleDisplayModelFactory","model","literal","views","Plugin","LinearWiggleDisplayReactComponent","XYPlotRendererReactComponent","addDisplayType","baseLinearDisplayConfigSchema","autoscale","enumeration","minScore","Number","MIN_VALUE","maxScore","MAX_VALUE","numStdDev","scaleType","inverted","defaultRendering","baseConfiguration","displayConfigSchemaFactory","DisplayType","name","stateModel","displayModelFactory","trackType","viewType","ReactComponent","addRendererType","rendererConfigSchema"],"mappings":"ixGAIwBA,EAAgBC,SACjBA,EAAcC,UACjC,gBAMeC,QAHNC,IAATC,MAASD,2IAMJE,EAA+BC,SAEhCC,EAQED,EARFC,SAEAC,EAMEF,EANFE,QACAC,EAKEH,EALFG,OACAC,EAIEJ,EAJFI,UACQC,EAGNL,EAHFM,OACAC,EAEEP,EAFFO,oBACSC,EACPR,EADFS,MAASD,OAEJE,IADHV,EAPFW,cAUIL,EAASD,EAAmBO,GAC5BC,SAAYT,OAAWU,MAAO,CAAC,EAAGR,KAClCS,GAASL,EAAOM,IAAMN,EAAOO,OAASf,EAEtCgB,EAAQrB,EAASgB,GACjBM,EAAM,SAACC,UAAcd,EAASY,EAAME,GANX,kmBAQTnB,EAASO,yCAAU,KAA9Ba,UACFC,IAAUC,gBAAcF,EAASX,EAAQR,SAC1CsB,EA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BC,UAAW,CACTzB,KAAM,SACNC,YACE,+EACFC,aAAc,GAEhBwB,UAAW,CACT1B,KAAM,aACNU,MAAOL,QAAMc,YAAY,aAAc,CAAC,SAAU,QAClDlB,YAAa,2BACbC,aAAc,UAEhByB,SAAU,CACR3B,KAAM,UACNC,YAAa,mBACbC,cAAc,GAGhB0B,iBAAkB,CAChB5B,KAAM,aACNU,MAAOL,QAAMc,YAAY,YAAa,CAAC,UAAW,SAAU,SAC5DjB,aAAc,WAGlB,CAAE2B,kBAAmBZ,EAA+Bd,iBAAiB,IDnC9C2B,CAA2BjF,UACzC,IAAIkF,EAAY,CACrBC,KAAM,yBACNnC,aAAAA,EACAoC,WAAYC,EAAoBrF,EAAegD,GAC/CsC,UAAW,eACXC,SAAU,mBACVC,eAAgBvB,OAIpBjE,EAAcyF,iBAAgB,kBAIrB,IAFmB,IAAI1F,EAAgBC,EAEvC,CAAsB,CAC3BmF,KAAM,0BACNK,eAAgBtB,EAChBlB,aAJmB0C,EAKnB1F,cAAAA"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import
|
|
2
|
+
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType';
|
|
3
|
+
import { readConfObject, ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
4
|
+
import { featureSpanPx } from '@jbrowse/core/util';
|
|
5
|
+
import { types } from 'mobx-state-tree';
|
|
3
6
|
|
|
4
7
|
function _classCallCheck(instance, Constructor) {
|
|
5
8
|
if (!(instance instanceof Constructor)) {
|
|
@@ -269,7 +272,6 @@ function rendererFactory(pluginManager) {
|
|
|
269
272
|
var _WigglePlugin$exports = WigglePlugin.exports,
|
|
270
273
|
getScale = _WigglePlugin$exports.utils.getScale,
|
|
271
274
|
WiggleBaseRenderer = _WigglePlugin$exports.WiggleBaseRenderer;
|
|
272
|
-
var featureSpanPx = pluginManager.lib["@jbrowse/core/util"].featureSpanPx;
|
|
273
275
|
return /*#__PURE__*/function (_WiggleBaseRenderer) {
|
|
274
276
|
_inherits(ManhattanPlotRenderer, _WiggleBaseRenderer);
|
|
275
277
|
|
|
@@ -350,22 +352,17 @@ function rendererFactory(pluginManager) {
|
|
|
350
352
|
}(WiggleBaseRenderer);
|
|
351
353
|
}
|
|
352
354
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
explicitlyTyped: true
|
|
363
|
-
});
|
|
364
|
-
}
|
|
355
|
+
var configSchema = /*#__PURE__*/ConfigurationSchema("LinearManhattanRenderer", {
|
|
356
|
+
color: {
|
|
357
|
+
type: "color",
|
|
358
|
+
description: "the color of the marks",
|
|
359
|
+
defaultValue: "darkblue"
|
|
360
|
+
}
|
|
361
|
+
}, {
|
|
362
|
+
explicitlyTyped: true
|
|
363
|
+
});
|
|
365
364
|
|
|
366
|
-
function configSchemaFactory
|
|
367
|
-
var types = pluginManager.lib["mobx-state-tree"].types;
|
|
368
|
-
var ConfigurationSchema = pluginManager.lib["@jbrowse/core/configuration"].ConfigurationSchema;
|
|
365
|
+
function configSchemaFactory(pluginManager) {
|
|
369
366
|
var LGVPlugin = pluginManager.getPlugin("LinearGenomeViewPlugin"); //@ts-ignore
|
|
370
367
|
|
|
371
368
|
var baseLinearDisplayConfigSchema = LGVPlugin.exports.baseLinearDisplayConfigSchema;
|
|
@@ -412,6 +409,7 @@ function configSchemaFactory$1(pluginManager) {
|
|
|
412
409
|
explicitlyTyped: true
|
|
413
410
|
});
|
|
414
411
|
}
|
|
412
|
+
|
|
415
413
|
function stateModelFactory(pluginManager, configSchema) {
|
|
416
414
|
var types = pluginManager.lib["mobx-state-tree"].types;
|
|
417
415
|
var WigglePlugin = pluginManager.getPlugin("WigglePlugin"); //@ts-ignore
|
|
@@ -427,6 +425,10 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
427
425
|
|
|
428
426
|
get needsScalebar() {
|
|
429
427
|
return true;
|
|
428
|
+
},
|
|
429
|
+
|
|
430
|
+
get regionTooLarge() {
|
|
431
|
+
return false;
|
|
430
432
|
}
|
|
431
433
|
|
|
432
434
|
};
|
|
@@ -452,12 +454,11 @@ var AlignmentsPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
452
454
|
key: "install",
|
|
453
455
|
value: function install(pluginManager) {
|
|
454
456
|
var WigglePlugin = pluginManager.getPlugin("WigglePlugin");
|
|
455
|
-
var DisplayType = pluginManager.lib["@jbrowse/core/pluggableElementTypes/DisplayType"];
|
|
456
457
|
var _WigglePlugin$exports = WigglePlugin.exports,
|
|
457
458
|
LinearWiggleDisplayReactComponent = _WigglePlugin$exports.LinearWiggleDisplayReactComponent,
|
|
458
459
|
XYPlotRendererReactComponent = _WigglePlugin$exports.XYPlotRendererReactComponent;
|
|
459
460
|
pluginManager.addDisplayType(function () {
|
|
460
|
-
var configSchema = configSchemaFactory
|
|
461
|
+
var configSchema = configSchemaFactory(pluginManager);
|
|
461
462
|
return new DisplayType({
|
|
462
463
|
name: "LinearManhattanDisplay",
|
|
463
464
|
configSchema: configSchema,
|
|
@@ -470,11 +471,11 @@ var AlignmentsPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
470
471
|
pluginManager.addRendererType(function () {
|
|
471
472
|
//@ts-ignore
|
|
472
473
|
var ManhattanRenderer = new rendererFactory(pluginManager);
|
|
473
|
-
var configSchema =
|
|
474
|
+
var configSchema$1 = configSchema;
|
|
474
475
|
return new ManhattanRenderer({
|
|
475
476
|
name: "LinearManhattanRenderer",
|
|
476
477
|
ReactComponent: XYPlotRendererReactComponent,
|
|
477
|
-
configSchema: configSchema,
|
|
478
|
+
configSchema: configSchema$1,
|
|
478
479
|
pluginManager: pluginManager
|
|
479
480
|
});
|
|
480
481
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jbrowse-plugin-gwas.esm.js","sources":["../src/LinearManhattanRenderer/LinearManhattanRenderer.ts","../src/LinearManhattanRenderer/index.js","../src/LinearManhattanDisplay/index.ts","../src/index.ts"],"sourcesContent":["import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { readConfObject } from \"@jbrowse/core/configuration\";\n\nexport default function rendererFactory(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const {\n utils: { getScale },\n WiggleBaseRenderer,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n const { featureSpanPx } = pluginManager.lib[\"@jbrowse/core/util\"];\n\n return class ManhattanPlotRenderer extends WiggleBaseRenderer {\n draw(ctx: CanvasRenderingContext2D, props: any) {\n const {\n features,\n regions,\n bpPerPx,\n config,\n scaleOpts,\n height: unadjustedHeight,\n displayCrossHatches,\n ticks: { values },\n } = props;\n const [region] = regions;\n const YSCALEBAR_LABEL_OFFSET = 5;\n const height = unadjustedHeight - YSCALEBAR_LABEL_OFFSET * 2;\n const opts = { ...scaleOpts, range: [0, height] };\n const width = (region.end - region.start) / bpPerPx;\n\n const scale = getScale(opts);\n const toY = (n: number) => height - scale(n) + YSCALEBAR_LABEL_OFFSET;\n\n for (const feature of features.values()) {\n const [leftPx] = featureSpanPx(feature, region, bpPerPx);\n const score = feature.get(\"score\") as number;\n ctx.fillStyle = readConfObject(config, \"color\", [feature]);\n ctx.beginPath();\n ctx.arc(leftPx, toY(score), 2, 0, 2 * Math.PI);\n ctx.fill();\n }\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"rgba(200,200,200,0.8)\";\n values.forEach((tick: number) => {\n ctx.beginPath();\n ctx.moveTo(0, Math.round(toY(tick)));\n ctx.lineTo(width, Math.round(toY(tick)));\n ctx.stroke();\n });\n }\n }\n };\n}\n","export { default } from \"./LinearManhattanRenderer\";\n\nexport function configSchemaFactory(pluginManager) {\n const { ConfigurationSchema } = pluginManager.lib[\n \"@jbrowse/core/configuration\"\n ];\n\n return ConfigurationSchema(\n \"LinearManhattanRenderer\",\n {\n color: {\n type: \"color\",\n description: \"the color of the marks\",\n defaultValue: \"darkblue\",\n },\n },\n { explicitlyTyped: true },\n );\n}\n","import PluginManager from \"@jbrowse/core/PluginManager\";\n\nexport function configSchemaFactory(pluginManager: PluginManager) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const { ConfigurationSchema } = pluginManager.lib[\n \"@jbrowse/core/configuration\"\n ];\n\n const LGVPlugin = pluginManager.getPlugin(\n \"LinearGenomeViewPlugin\",\n ) as import(\"@jbrowse/plugin-linear-genome-view\").default;\n //@ts-ignore\n const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;\n\n return ConfigurationSchema(\n \"LinearManhattanDisplay\",\n {\n autoscale: {\n type: \"stringEnum\",\n defaultValue: \"local\",\n model: types.enumeration(\"Autoscale type\", [\n \"global\",\n \"local\",\n \"globalsd\",\n \"localsd\",\n \"zscore\",\n ]),\n description:\n \"global/local using their min/max values or w/ standard deviations (globalsd/localsd)\",\n },\n minScore: {\n type: \"number\",\n defaultValue: Number.MIN_VALUE,\n description: \"minimum value for the y-scale\",\n },\n maxScore: {\n type: \"number\",\n description: \"maximum value for the y-scale\",\n defaultValue: Number.MAX_VALUE,\n },\n numStdDev: {\n type: \"number\",\n description:\n \"number of standard deviations to use for autoscale types globalsd or localsd\",\n defaultValue: 3,\n },\n scaleType: {\n type: \"stringEnum\",\n model: types.enumeration(\"Scale type\", [\"linear\", \"log\"]), // todo zscale\n description: \"The type of scale to use\",\n defaultValue: \"linear\",\n },\n inverted: {\n type: \"boolean\",\n description: \"draw upside down\",\n defaultValue: false,\n },\n\n defaultRendering: {\n type: \"stringEnum\",\n model: types.enumeration(\"Rendering\", [\"density\", \"xyplot\", \"line\"]),\n defaultValue: \"xyplot\",\n },\n },\n { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },\n );\n}\n\nexport function stateModelFactory(\n pluginManager: PluginManager,\n configSchema: any,\n) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n //@ts-ignore\n const { linearWiggleDisplayModelFactory } = WigglePlugin.exports;\n return types.compose(\n \"LinearManhattanDisplay\",\n linearWiggleDisplayModelFactory(pluginManager, configSchema),\n types\n .model({\n type: types.literal(\"LinearManhattanDisplay\"),\n })\n .views(() => ({\n get rendererTypeName() {\n return \"LinearManhattanRenderer\";\n },\n get needsScalebar() {\n return true;\n },\n })),\n );\n}\n\nexport type LinearManhattanDisplayModel = ReturnType<typeof stateModelFactory>;\n","import Plugin from \"@jbrowse/core/Plugin\";\nimport PluginManager from \"@jbrowse/core/PluginManager\";\nimport rendererFactory, {\n configSchemaFactory as linearManhattanRendererConfigSchemaFactory,\n} from \"./LinearManhattanRenderer\";\nimport {\n configSchemaFactory as linearManhattanDisplayConfigSchemaFactory,\n stateModelFactory as linearManhattanDisplayModelFactory,\n} from \"./LinearManhattanDisplay\";\n\nexport default class AlignmentsPlugin extends Plugin {\n name = \"GWASPlugin\";\n\n install(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const DisplayType =\n pluginManager.lib[\"@jbrowse/core/pluggableElementTypes/DisplayType\"];\n const {\n LinearWiggleDisplayReactComponent,\n XYPlotRendererReactComponent,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n pluginManager.addDisplayType(() => {\n const configSchema = linearManhattanDisplayConfigSchemaFactory(\n pluginManager,\n );\n return new DisplayType({\n name: \"LinearManhattanDisplay\",\n configSchema,\n stateModel: linearManhattanDisplayModelFactory(\n pluginManager,\n configSchema,\n ),\n trackType: \"FeatureTrack\",\n viewType: \"LinearGenomeView\",\n ReactComponent: LinearWiggleDisplayReactComponent,\n });\n });\n\n pluginManager.addRendererType(() => {\n //@ts-ignore\n const ManhattanRenderer = new rendererFactory(pluginManager);\n const configSchema = linearManhattanRendererConfigSchemaFactory(\n pluginManager,\n );\n return new ManhattanRenderer({\n name: \"LinearManhattanRenderer\",\n ReactComponent: XYPlotRendererReactComponent,\n configSchema,\n pluginManager,\n });\n });\n }\n}\n"],"names":["rendererFactory","pluginManager","WigglePlugin","getPlugin","exports","getScale","utils","WiggleBaseRenderer","featureSpanPx","lib","ctx","props","features","regions","bpPerPx","config","scaleOpts","unadjustedHeight","height","displayCrossHatches","values","ticks","region","YSCALEBAR_LABEL_OFFSET","opts","range","width","end","start","scale","toY","n","feature","leftPx","score","get","fillStyle","readConfObject","beginPath","arc","Math","PI","fill","lineWidth","strokeStyle","forEach","tick","moveTo","round","lineTo","stroke","configSchemaFactory","ConfigurationSchema","color","type","description","defaultValue","explicitlyTyped","types","LGVPlugin","baseLinearDisplayConfigSchema","autoscale","model","enumeration","minScore","Number","MIN_VALUE","maxScore","MAX_VALUE","numStdDev","scaleType","inverted","defaultRendering","baseConfiguration","stateModelFactory","configSchema","linearWiggleDisplayModelFactory","compose","literal","views","rendererTypeName","needsScalebar","AlignmentsPlugin","DisplayType","LinearWiggleDisplayReactComponent","XYPlotRendererReactComponent","addDisplayType","linearManhattanDisplayConfigSchemaFactory","name","stateModel","linearManhattanDisplayModelFactory","trackType","viewType","ReactComponent","addRendererType","ManhattanRenderer","linearManhattanRendererConfigSchemaFactory","Plugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAGwBA,gBAAgBC;AACtC,MAAMC,YAAY,GAAGD,aAAa,CAAC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AAMX,YAAY,GAAGY,qBAAyC,CAC5DtF,aAD4D,CAA9D;AAGA,eAAO,IAAIkF,WAAJ,CAAgB;AACrBK,UAAAA,IAAI,EAAE,wBADe;AAErBb,UAAAA,YAAY,EAAZA,YAFqB;AAGrBc,UAAAA,UAAU,EAAEC,iBAAkC,CAC5CzF,aAD4C,EAE5C0E,YAF4C,CAHzB;AAOrBgB,UAAAA,SAAS,EAAE,cAPU;AAQrBC,UAAAA,QAAQ,EAAE,kBARW;AASrBC,UAAAA,cAAc,EAAET;AATK,SAAhB,CAAP;AAWD,OAfD;AAiBAnF,MAAAA,aAAa,CAAC6F,eAAd,CAA8B;AAC5B;AACA,YAAMC,iBAAiB,GAAG,IAAI/F,eAAJ,CAAoBC,aAApB,CAA1B;AACA,YAAM0E,YAAY,GAAGqB,mBAA0C,CAC7D/F,aAD6D,CAA/D;AAGA,eAAO,IAAI8F,iBAAJ,CAAsB;AAC3BP,UAAAA,IAAI,EAAE,yBADqB;AAE3BK,UAAAA,cAAc,EAAER,4BAFW;AAG3BV,UAAAA,YAAY,EAAZA,YAH2B;AAI3B1E,UAAAA,aAAa,EAAbA;AAJ2B,SAAtB,CAAP;AAMD,OAZD;AAaD;;;;EA7C2CgG;;;;"}
|
|
1
|
+
{"version":3,"file":"jbrowse-plugin-gwas.esm.js","sources":["../src/LinearManhattanRenderer/LinearManhattanRenderer.ts","../src/LinearManhattanRenderer/index.ts","../src/LinearManhattanDisplay/configSchemaFactory.ts","../src/LinearManhattanDisplay/index.ts","../src/index.ts"],"sourcesContent":["import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { readConfObject } from \"@jbrowse/core/configuration\";\nimport { featureSpanPx } from \"@jbrowse/core/util\";\n\nexport default function rendererFactory(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const {\n utils: { getScale },\n WiggleBaseRenderer,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n return class ManhattanPlotRenderer extends WiggleBaseRenderer {\n draw(ctx: CanvasRenderingContext2D, props: any) {\n const {\n features,\n regions,\n bpPerPx,\n config,\n scaleOpts,\n height: unadjustedHeight,\n displayCrossHatches,\n ticks: { values },\n } = props;\n const [region] = regions;\n const YSCALEBAR_LABEL_OFFSET = 5;\n const height = unadjustedHeight - YSCALEBAR_LABEL_OFFSET * 2;\n const opts = { ...scaleOpts, range: [0, height] };\n const width = (region.end - region.start) / bpPerPx;\n\n const scale = getScale(opts);\n const toY = (n: number) => height - scale(n) + YSCALEBAR_LABEL_OFFSET;\n\n for (const feature of features.values()) {\n const [leftPx] = featureSpanPx(feature, region, bpPerPx);\n const score = feature.get(\"score\") as number;\n ctx.fillStyle = readConfObject(config, \"color\", [feature]);\n ctx.beginPath();\n ctx.arc(leftPx, toY(score), 2, 0, 2 * Math.PI);\n ctx.fill();\n }\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"rgba(200,200,200,0.8)\";\n values.forEach((tick: number) => {\n ctx.beginPath();\n ctx.moveTo(0, Math.round(toY(tick)));\n ctx.lineTo(width, Math.round(toY(tick)));\n ctx.stroke();\n });\n }\n }\n };\n}\n","export { default } from \"./LinearManhattanRenderer\";\nimport { ConfigurationSchema } from \"@jbrowse/core/configuration\";\n\nexport const configSchema = ConfigurationSchema(\n \"LinearManhattanRenderer\",\n {\n color: {\n type: \"color\",\n description: \"the color of the marks\",\n defaultValue: \"darkblue\",\n },\n },\n { explicitlyTyped: true },\n);\n","import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { types } from \"mobx-state-tree\";\nimport { ConfigurationSchema } from \"@jbrowse/core/configuration\";\n\nexport function configSchemaFactory(pluginManager: PluginManager) {\n const LGVPlugin = pluginManager.getPlugin(\n \"LinearGenomeViewPlugin\",\n ) as import(\"@jbrowse/plugin-linear-genome-view\").default;\n //@ts-ignore\n const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;\n\n return ConfigurationSchema(\n \"LinearManhattanDisplay\",\n {\n autoscale: {\n type: \"stringEnum\",\n defaultValue: \"local\",\n model: types.enumeration(\"Autoscale type\", [\n \"global\",\n \"local\",\n \"globalsd\",\n \"localsd\",\n \"zscore\",\n ]),\n description:\n \"global/local using their min/max values or w/ standard deviations (globalsd/localsd)\",\n },\n minScore: {\n type: \"number\",\n defaultValue: Number.MIN_VALUE,\n description: \"minimum value for the y-scale\",\n },\n maxScore: {\n type: \"number\",\n description: \"maximum value for the y-scale\",\n defaultValue: Number.MAX_VALUE,\n },\n numStdDev: {\n type: \"number\",\n description:\n \"number of standard deviations to use for autoscale types globalsd or localsd\",\n defaultValue: 3,\n },\n scaleType: {\n type: \"stringEnum\",\n model: types.enumeration(\"Scale type\", [\"linear\", \"log\"]), // todo zscale\n description: \"The type of scale to use\",\n defaultValue: \"linear\",\n },\n inverted: {\n type: \"boolean\",\n description: \"draw upside down\",\n defaultValue: false,\n },\n\n defaultRendering: {\n type: \"stringEnum\",\n model: types.enumeration(\"Rendering\", [\"density\", \"xyplot\", \"line\"]),\n defaultValue: \"xyplot\",\n },\n },\n { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },\n );\n}\n","import PluginManager from \"@jbrowse/core/PluginManager\";\nexport { configSchemaFactory } from \"./configSchemaFactory\";\n\nexport function stateModelFactory(\n pluginManager: PluginManager,\n configSchema: any,\n) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n //@ts-ignore\n const { linearWiggleDisplayModelFactory } = WigglePlugin.exports;\n return types.compose(\n \"LinearManhattanDisplay\",\n linearWiggleDisplayModelFactory(pluginManager, configSchema),\n types\n .model({\n type: types.literal(\"LinearManhattanDisplay\"),\n })\n .views(() => ({\n get rendererTypeName() {\n return \"LinearManhattanRenderer\";\n },\n get needsScalebar() {\n return true;\n },\n get regionTooLarge() {\n return false;\n },\n })),\n );\n}\n\nexport type LinearManhattanDisplayModel = ReturnType<typeof stateModelFactory>;\n","import Plugin from \"@jbrowse/core/Plugin\";\nimport PluginManager from \"@jbrowse/core/PluginManager\";\nimport DisplayType from \"@jbrowse/core/pluggableElementTypes/DisplayType\";\nimport rendererFactory, {\n configSchema as rendererConfigSchema,\n} from \"./LinearManhattanRenderer\";\nimport {\n configSchemaFactory as displayConfigSchemaFactory,\n stateModelFactory as displayModelFactory,\n} from \"./LinearManhattanDisplay\";\n\nexport default class AlignmentsPlugin extends Plugin {\n name = \"GWASPlugin\";\n\n install(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n\n const {\n LinearWiggleDisplayReactComponent,\n XYPlotRendererReactComponent,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n pluginManager.addDisplayType(() => {\n const configSchema = displayConfigSchemaFactory(pluginManager);\n return new DisplayType({\n name: \"LinearManhattanDisplay\",\n configSchema,\n stateModel: displayModelFactory(pluginManager, configSchema),\n trackType: \"FeatureTrack\",\n viewType: \"LinearGenomeView\",\n ReactComponent: LinearWiggleDisplayReactComponent,\n });\n });\n\n pluginManager.addRendererType(() => {\n //@ts-ignore\n const ManhattanRenderer = new rendererFactory(pluginManager);\n const configSchema = rendererConfigSchema;\n return new ManhattanRenderer({\n name: \"LinearManhattanRenderer\",\n ReactComponent: XYPlotRendererReactComponent,\n configSchema,\n pluginManager,\n });\n });\n }\n}\n"],"names":["rendererFactory","pluginManager","WigglePlugin","getPlugin","exports","getScale","utils","WiggleBaseRenderer","ctx","props","features","regions","bpPerPx","config","scaleOpts","unadjustedHeight","height","displayCrossHatches","values","ticks","region","YSCALEBAR_LABEL_OFFSET","opts","range","width","end","start","scale","toY","n","feature","featureSpanPx","leftPx","score","get","fillStyle","readConfObject","beginPath","arc","Math","PI","fill","lineWidth","strokeStyle","forEach","tick","moveTo","round","lineTo","stroke","configSchema","ConfigurationSchema","color","type","description","defaultValue","explicitlyTyped","configSchemaFactory","LGVPlugin","baseLinearDisplayConfigSchema","autoscale","model","types","enumeration","minScore","Number","MIN_VALUE","maxScore","MAX_VALUE","numStdDev","scaleType","inverted","defaultRendering","baseConfiguration","stateModelFactory","lib","linearWiggleDisplayModelFactory","compose","literal","views","rendererTypeName","needsScalebar","regionTooLarge","AlignmentsPlugin","LinearWiggleDisplayReactComponent","XYPlotRendererReactComponent","addDisplayType","displayConfigSchemaFactory","DisplayType","name","stateModel","displayModelFactory","trackType","viewType","ReactComponent","addRendererType","ManhattanRenderer","rendererConfigSchema","Plugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAIwBA,gBAAgBC;AACtC,MAAMC,YAAY,GAAGD,aAAa,CAACE,SAAd,CACnB,cADmB,CAArB;8BAOID,YAAY,CAACE;MAHNC,iCAATC,MAASD;MACTE,2CAAAA;AAIF;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA,2BACOC,GADP,EACsCC,KADtC;YAGMC,WAQED,MARFC;YACAC,UAOEF,MAPFE;YACAC,UAMEH,MANFG;YACAC,SAKEJ,MALFI;YACAC,YAIEL,MAJFK;YACQC,mBAGNN,MAHFO;YACAC,sBAEER,MAFFQ;YACSC,SACPT,MADFU,MAASD;;sCAEMP;YAAVS;;AACP,YAAMC,sBAAsB,GAAG,CAA/B;AACA,YAAML,MAAM,GAAGD,gBAAgB,GAAGM,sBAAsB,GAAG,CAA3D;;AACA,YAAMC,IAAI,q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|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jbrowse/core/Plugin'), require('@jbrowse/core/configuration')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@jbrowse/core/Plugin', '@jbrowse/core/configuration'], factory) :
|
|
4
|
-
(global = global || self, factory(global.JBrowsePluginGWAS = {}, global.JBrowseExports['@jbrowse/core/Plugin'], global.JBrowseExports['@jbrowse/core/configuration']));
|
|
5
|
-
}(this, (function (exports, Plugin, configuration) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jbrowse/core/Plugin'), require('@jbrowse/core/pluggableElementTypes/DisplayType'), require('@jbrowse/core/configuration'), require('@jbrowse/core/util'), require('mobx-state-tree')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@jbrowse/core/Plugin', '@jbrowse/core/pluggableElementTypes/DisplayType', '@jbrowse/core/configuration', '@jbrowse/core/util', 'mobx-state-tree'], factory) :
|
|
4
|
+
(global = global || self, factory(global.JBrowsePluginGWAS = {}, global.JBrowseExports['@jbrowse/core/Plugin'], global.JBrowseExports['@jbrowse/core/pluggableElementTypes/DisplayType'], global.JBrowseExports['@jbrowse/core/configuration'], global.JBrowseExports['@jbrowse/core/util'], global.JBrowseExports['mobx-state-tree']));
|
|
5
|
+
}(this, (function (exports, Plugin, DisplayType, configuration, util, mobxStateTree) { 'use strict';
|
|
6
6
|
|
|
7
7
|
Plugin = Plugin && Object.prototype.hasOwnProperty.call(Plugin, 'default') ? Plugin['default'] : Plugin;
|
|
8
|
+
DisplayType = DisplayType && Object.prototype.hasOwnProperty.call(DisplayType, 'default') ? DisplayType['default'] : DisplayType;
|
|
8
9
|
|
|
9
10
|
function _classCallCheck(instance, Constructor) {
|
|
10
11
|
if (!(instance instanceof Constructor)) {
|
|
@@ -274,7 +275,6 @@
|
|
|
274
275
|
var _WigglePlugin$exports = WigglePlugin.exports,
|
|
275
276
|
getScale = _WigglePlugin$exports.utils.getScale,
|
|
276
277
|
WiggleBaseRenderer = _WigglePlugin$exports.WiggleBaseRenderer;
|
|
277
|
-
var featureSpanPx = pluginManager.lib["@jbrowse/core/util"].featureSpanPx;
|
|
278
278
|
return /*#__PURE__*/function (_WiggleBaseRenderer) {
|
|
279
279
|
_inherits(ManhattanPlotRenderer, _WiggleBaseRenderer);
|
|
280
280
|
|
|
@@ -322,7 +322,7 @@
|
|
|
322
322
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
323
323
|
var feature = _step.value;
|
|
324
324
|
|
|
325
|
-
var _featureSpanPx = featureSpanPx(feature, region, bpPerPx),
|
|
325
|
+
var _featureSpanPx = util.featureSpanPx(feature, region, bpPerPx),
|
|
326
326
|
_featureSpanPx2 = _slicedToArray(_featureSpanPx, 1),
|
|
327
327
|
leftPx = _featureSpanPx2[0];
|
|
328
328
|
|
|
@@ -355,30 +355,25 @@
|
|
|
355
355
|
}(WiggleBaseRenderer);
|
|
356
356
|
}
|
|
357
357
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
explicitlyTyped: true
|
|
368
|
-
});
|
|
369
|
-
}
|
|
358
|
+
var configSchema = /*#__PURE__*/configuration.ConfigurationSchema("LinearManhattanRenderer", {
|
|
359
|
+
color: {
|
|
360
|
+
type: "color",
|
|
361
|
+
description: "the color of the marks",
|
|
362
|
+
defaultValue: "darkblue"
|
|
363
|
+
}
|
|
364
|
+
}, {
|
|
365
|
+
explicitlyTyped: true
|
|
366
|
+
});
|
|
370
367
|
|
|
371
|
-
function configSchemaFactory
|
|
372
|
-
var types = pluginManager.lib["mobx-state-tree"].types;
|
|
373
|
-
var ConfigurationSchema = pluginManager.lib["@jbrowse/core/configuration"].ConfigurationSchema;
|
|
368
|
+
function configSchemaFactory(pluginManager) {
|
|
374
369
|
var LGVPlugin = pluginManager.getPlugin("LinearGenomeViewPlugin"); //@ts-ignore
|
|
375
370
|
|
|
376
371
|
var baseLinearDisplayConfigSchema = LGVPlugin.exports.baseLinearDisplayConfigSchema;
|
|
377
|
-
return ConfigurationSchema("LinearManhattanDisplay", {
|
|
372
|
+
return configuration.ConfigurationSchema("LinearManhattanDisplay", {
|
|
378
373
|
autoscale: {
|
|
379
374
|
type: "stringEnum",
|
|
380
375
|
defaultValue: "local",
|
|
381
|
-
model: types.enumeration("Autoscale type", ["global", "local", "globalsd", "localsd", "zscore"]),
|
|
376
|
+
model: mobxStateTree.types.enumeration("Autoscale type", ["global", "local", "globalsd", "localsd", "zscore"]),
|
|
382
377
|
description: "global/local using their min/max values or w/ standard deviations (globalsd/localsd)"
|
|
383
378
|
},
|
|
384
379
|
minScore: {
|
|
@@ -398,7 +393,7 @@
|
|
|
398
393
|
},
|
|
399
394
|
scaleType: {
|
|
400
395
|
type: "stringEnum",
|
|
401
|
-
model: types.enumeration("Scale type", ["linear", "log"]),
|
|
396
|
+
model: mobxStateTree.types.enumeration("Scale type", ["linear", "log"]),
|
|
402
397
|
description: "The type of scale to use",
|
|
403
398
|
defaultValue: "linear"
|
|
404
399
|
},
|
|
@@ -409,7 +404,7 @@
|
|
|
409
404
|
},
|
|
410
405
|
defaultRendering: {
|
|
411
406
|
type: "stringEnum",
|
|
412
|
-
model: types.enumeration("Rendering", ["density", "xyplot", "line"]),
|
|
407
|
+
model: mobxStateTree.types.enumeration("Rendering", ["density", "xyplot", "line"]),
|
|
413
408
|
defaultValue: "xyplot"
|
|
414
409
|
}
|
|
415
410
|
}, {
|
|
@@ -417,6 +412,7 @@
|
|
|
417
412
|
explicitlyTyped: true
|
|
418
413
|
});
|
|
419
414
|
}
|
|
415
|
+
|
|
420
416
|
function stateModelFactory(pluginManager, configSchema) {
|
|
421
417
|
var types = pluginManager.lib["mobx-state-tree"].types;
|
|
422
418
|
var WigglePlugin = pluginManager.getPlugin("WigglePlugin"); //@ts-ignore
|
|
@@ -432,6 +428,10 @@
|
|
|
432
428
|
|
|
433
429
|
get needsScalebar() {
|
|
434
430
|
return true;
|
|
431
|
+
},
|
|
432
|
+
|
|
433
|
+
get regionTooLarge() {
|
|
434
|
+
return false;
|
|
435
435
|
}
|
|
436
436
|
|
|
437
437
|
};
|
|
@@ -457,12 +457,11 @@
|
|
|
457
457
|
key: "install",
|
|
458
458
|
value: function install(pluginManager) {
|
|
459
459
|
var WigglePlugin = pluginManager.getPlugin("WigglePlugin");
|
|
460
|
-
var DisplayType = pluginManager.lib["@jbrowse/core/pluggableElementTypes/DisplayType"];
|
|
461
460
|
var _WigglePlugin$exports = WigglePlugin.exports,
|
|
462
461
|
LinearWiggleDisplayReactComponent = _WigglePlugin$exports.LinearWiggleDisplayReactComponent,
|
|
463
462
|
XYPlotRendererReactComponent = _WigglePlugin$exports.XYPlotRendererReactComponent;
|
|
464
463
|
pluginManager.addDisplayType(function () {
|
|
465
|
-
var configSchema = configSchemaFactory
|
|
464
|
+
var configSchema = configSchemaFactory(pluginManager);
|
|
466
465
|
return new DisplayType({
|
|
467
466
|
name: "LinearManhattanDisplay",
|
|
468
467
|
configSchema: configSchema,
|
|
@@ -475,11 +474,11 @@
|
|
|
475
474
|
pluginManager.addRendererType(function () {
|
|
476
475
|
//@ts-ignore
|
|
477
476
|
var ManhattanRenderer = new rendererFactory(pluginManager);
|
|
478
|
-
var configSchema =
|
|
477
|
+
var configSchema$1 = configSchema;
|
|
479
478
|
return new ManhattanRenderer({
|
|
480
479
|
name: "LinearManhattanRenderer",
|
|
481
480
|
ReactComponent: XYPlotRendererReactComponent,
|
|
482
|
-
configSchema: configSchema,
|
|
481
|
+
configSchema: configSchema$1,
|
|
483
482
|
pluginManager: pluginManager
|
|
484
483
|
});
|
|
485
484
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jbrowse-plugin-gwas.umd.development.js","sources":["../src/LinearManhattanRenderer/LinearManhattanRenderer.ts","../src/LinearManhattanRenderer/index.js","../src/LinearManhattanDisplay/index.ts","../src/index.ts"],"sourcesContent":["import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { readConfObject } from \"@jbrowse/core/configuration\";\n\nexport default function rendererFactory(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const {\n utils: { getScale },\n WiggleBaseRenderer,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n const { featureSpanPx } = pluginManager.lib[\"@jbrowse/core/util\"];\n\n return class ManhattanPlotRenderer extends WiggleBaseRenderer {\n draw(ctx: CanvasRenderingContext2D, props: any) {\n const {\n features,\n regions,\n bpPerPx,\n config,\n scaleOpts,\n height: unadjustedHeight,\n displayCrossHatches,\n ticks: { values },\n } = props;\n const [region] = regions;\n const YSCALEBAR_LABEL_OFFSET = 5;\n const height = unadjustedHeight - YSCALEBAR_LABEL_OFFSET * 2;\n const opts = { ...scaleOpts, range: [0, height] };\n const width = (region.end - region.start) / bpPerPx;\n\n const scale = getScale(opts);\n const toY = (n: number) => height - scale(n) + YSCALEBAR_LABEL_OFFSET;\n\n for (const feature of features.values()) {\n const [leftPx] = featureSpanPx(feature, region, bpPerPx);\n const score = feature.get(\"score\") as number;\n ctx.fillStyle = readConfObject(config, \"color\", [feature]);\n ctx.beginPath();\n ctx.arc(leftPx, toY(score), 2, 0, 2 * Math.PI);\n ctx.fill();\n }\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"rgba(200,200,200,0.8)\";\n values.forEach((tick: number) => {\n ctx.beginPath();\n ctx.moveTo(0, Math.round(toY(tick)));\n ctx.lineTo(width, Math.round(toY(tick)));\n ctx.stroke();\n });\n }\n }\n };\n}\n","export { default } from \"./LinearManhattanRenderer\";\n\nexport function configSchemaFactory(pluginManager) {\n const { ConfigurationSchema } = pluginManager.lib[\n \"@jbrowse/core/configuration\"\n ];\n\n return ConfigurationSchema(\n \"LinearManhattanRenderer\",\n {\n color: {\n type: \"color\",\n description: \"the color of the marks\",\n defaultValue: \"darkblue\",\n },\n },\n { explicitlyTyped: true },\n );\n}\n","import PluginManager from \"@jbrowse/core/PluginManager\";\n\nexport function configSchemaFactory(pluginManager: PluginManager) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const { ConfigurationSchema } = pluginManager.lib[\n \"@jbrowse/core/configuration\"\n ];\n\n const LGVPlugin = pluginManager.getPlugin(\n \"LinearGenomeViewPlugin\",\n ) as import(\"@jbrowse/plugin-linear-genome-view\").default;\n //@ts-ignore\n const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;\n\n return ConfigurationSchema(\n \"LinearManhattanDisplay\",\n {\n autoscale: {\n type: \"stringEnum\",\n defaultValue: \"local\",\n model: types.enumeration(\"Autoscale type\", [\n \"global\",\n \"local\",\n \"globalsd\",\n \"localsd\",\n \"zscore\",\n ]),\n description:\n \"global/local using their min/max values or w/ standard deviations (globalsd/localsd)\",\n },\n minScore: {\n type: \"number\",\n defaultValue: Number.MIN_VALUE,\n description: \"minimum value for the y-scale\",\n },\n maxScore: {\n type: \"number\",\n description: \"maximum value for the y-scale\",\n defaultValue: Number.MAX_VALUE,\n },\n numStdDev: {\n type: \"number\",\n description:\n \"number of standard deviations to use for autoscale types globalsd or localsd\",\n defaultValue: 3,\n },\n scaleType: {\n type: \"stringEnum\",\n model: types.enumeration(\"Scale type\", [\"linear\", \"log\"]), // todo zscale\n description: \"The type of scale to use\",\n defaultValue: \"linear\",\n },\n inverted: {\n type: \"boolean\",\n description: \"draw upside down\",\n defaultValue: false,\n },\n\n defaultRendering: {\n type: \"stringEnum\",\n model: types.enumeration(\"Rendering\", [\"density\", \"xyplot\", \"line\"]),\n defaultValue: \"xyplot\",\n },\n },\n { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },\n );\n}\n\nexport function stateModelFactory(\n pluginManager: PluginManager,\n configSchema: any,\n) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n //@ts-ignore\n const { linearWiggleDisplayModelFactory } = WigglePlugin.exports;\n return types.compose(\n \"LinearManhattanDisplay\",\n linearWiggleDisplayModelFactory(pluginManager, configSchema),\n types\n .model({\n type: types.literal(\"LinearManhattanDisplay\"),\n })\n .views(() => ({\n get rendererTypeName() {\n return \"LinearManhattanRenderer\";\n },\n get needsScalebar() {\n return true;\n },\n })),\n );\n}\n\nexport type LinearManhattanDisplayModel = ReturnType<typeof stateModelFactory>;\n","import Plugin from \"@jbrowse/core/Plugin\";\nimport PluginManager from \"@jbrowse/core/PluginManager\";\nimport rendererFactory, {\n configSchemaFactory as linearManhattanRendererConfigSchemaFactory,\n} from \"./LinearManhattanRenderer\";\nimport {\n configSchemaFactory as linearManhattanDisplayConfigSchemaFactory,\n stateModelFactory as linearManhattanDisplayModelFactory,\n} from \"./LinearManhattanDisplay\";\n\nexport default class AlignmentsPlugin extends Plugin {\n name = \"GWASPlugin\";\n\n install(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const DisplayType =\n pluginManager.lib[\"@jbrowse/core/pluggableElementTypes/DisplayType\"];\n const {\n LinearWiggleDisplayReactComponent,\n XYPlotRendererReactComponent,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n pluginManager.addDisplayType(() => {\n const configSchema = linearManhattanDisplayConfigSchemaFactory(\n pluginManager,\n );\n return new DisplayType({\n name: \"LinearManhattanDisplay\",\n configSchema,\n stateModel: linearManhattanDisplayModelFactory(\n pluginManager,\n configSchema,\n ),\n trackType: \"FeatureTrack\",\n viewType: \"LinearGenomeView\",\n ReactComponent: LinearWiggleDisplayReactComponent,\n });\n });\n\n pluginManager.addRendererType(() => {\n //@ts-ignore\n const ManhattanRenderer = new rendererFactory(pluginManager);\n const configSchema = linearManhattanRendererConfigSchemaFactory(\n pluginManager,\n );\n return new ManhattanRenderer({\n name: \"LinearManhattanRenderer\",\n ReactComponent: XYPlotRendererReactComponent,\n configSchema,\n pluginManager,\n });\n });\n }\n}\n"],"names":["rendererFactory","pluginManager","WigglePlugin","getPlugin","exports","getScale","utils","WiggleBaseRenderer","featureSpanPx","lib","ctx","props","features","regions","bpPerPx","config","scaleOpts","unadjustedHeight","height","displayCrossHatches","values","ticks","region","YSCALEBAR_LABEL_OFFSET","opts","range","width","end","start","scale","toY","n","feature","leftPx","score","get","fillStyle","readConfObject","beginPath","arc","Math","PI","fill","lineWidth","strokeStyle","forEach","tick","moveTo","round","lineTo","stroke","configSchemaFactory","ConfigurationSchema","color","type","description","defaultValue","explicitlyTyped","types","LGVPlugin","baseLinearDisplayConfigSchema","autoscale","model","enumeration","minScore","Number","MIN_VALUE","maxScore","MAX_VALUE","numStdDev","scaleType","inverted","defaultRendering","baseConfiguration","stateModelFactory","configSchema","linearWiggleDisplayModelFactory","compose","literal","views","rendererTypeName","needsScalebar","AlignmentsPlugin","DisplayType","LinearWiggleDisplayReactComponent","XYPlotRendererReactComponent","addDisplayType","linearManhattanDisplayConfigSchemaFactory","name","stateModel","linearManhattanDisplayModelFactory","trackType","viewType","ReactComponent","addRendererType","ManhattanRenderer","linearManhattanRendererConfigSchemaFactory","Plugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAGwBA,gBAAgBC;EACtC,MAAMC,YAAY,GAAGD,aAAa,CAACE,SAAd,CACnB,cADmB,CAArB;gCAOID,YAAY,CAACE;QA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A9D;EAGA,eAAO,IAAIkF,WAAJ,CAAgB;EACrBK,UAAAA,IAAI,EAAE,wBADe;EAErBb,UAAAA,YAAY,EAAZA,YAFqB;EAGrBc,UAAAA,UAAU,EAAEC,iBAAkC,CAC5CzF,aAD4C,EAE5C0E,YAF4C,CAHzB;EAOrBgB,UAAAA,SAAS,EAAE,cAPU;EAQrBC,UAAAA,QAAQ,EAAE,kBARW;EASrBC,UAAAA,cAAc,EAAET;EATK,SAAhB,CAAP;EAWD,OAfD;EAiBAnF,MAAAA,aAAa,CAAC6F,eAAd,CAA8B;EAC5B;EACA,YAAMC,iBAAiB,GAAG,IAAI/F,eAAJ,CAAoBC,aAApB,CAA1B;EACA,YAAM0E,YAAY,GAAGqB,mBAA0C,CAC7D/F,aAD6D,CAA/D;EAGA,eAAO,IAAI8F,iBAAJ,CAAsB;EAC3BP,UAAAA,IAAI,EAAE,yBADqB;EAE3BK,UAAAA,cAAc,EAAER,4BAFW;EAG3BV,UAAAA,YAAY,EAAZA,YAH2B;EAI3B1E,UAAAA,aAAa,EAAbA;EAJ2B,SAAtB,CAAP;EAMD,OAZD;EAaD;;;;IA7C2CgG;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"jbrowse-plugin-gwas.umd.development.js","sources":["../src/LinearManhattanRenderer/LinearManhattanRenderer.ts","../src/LinearManhattanRenderer/index.ts","../src/LinearManhattanDisplay/configSchemaFactory.ts","../src/LinearManhattanDisplay/index.ts","../src/index.ts"],"sourcesContent":["import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { readConfObject } from \"@jbrowse/core/configuration\";\nimport { featureSpanPx } from \"@jbrowse/core/util\";\n\nexport default function rendererFactory(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const {\n utils: { getScale },\n WiggleBaseRenderer,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n return class ManhattanPlotRenderer extends WiggleBaseRenderer {\n draw(ctx: CanvasRenderingContext2D, props: any) {\n const {\n features,\n regions,\n bpPerPx,\n config,\n scaleOpts,\n height: unadjustedHeight,\n displayCrossHatches,\n ticks: { values },\n } = props;\n const [region] = regions;\n const YSCALEBAR_LABEL_OFFSET = 5;\n const height = unadjustedHeight - YSCALEBAR_LABEL_OFFSET * 2;\n const opts = { ...scaleOpts, range: [0, height] };\n const width = (region.end - region.start) / bpPerPx;\n\n const scale = getScale(opts);\n const toY = (n: number) => height - scale(n) + YSCALEBAR_LABEL_OFFSET;\n\n for (const feature of features.values()) {\n const [leftPx] = featureSpanPx(feature, region, bpPerPx);\n const score = feature.get(\"score\") as number;\n ctx.fillStyle = readConfObject(config, \"color\", [feature]);\n ctx.beginPath();\n ctx.arc(leftPx, toY(score), 2, 0, 2 * Math.PI);\n ctx.fill();\n }\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"rgba(200,200,200,0.8)\";\n values.forEach((tick: number) => {\n ctx.beginPath();\n ctx.moveTo(0, Math.round(toY(tick)));\n ctx.lineTo(width, Math.round(toY(tick)));\n ctx.stroke();\n });\n }\n }\n };\n}\n","export { default } from \"./LinearManhattanRenderer\";\nimport { ConfigurationSchema } from \"@jbrowse/core/configuration\";\n\nexport const configSchema = ConfigurationSchema(\n \"LinearManhattanRenderer\",\n {\n color: {\n type: \"color\",\n description: \"the color of the marks\",\n defaultValue: \"darkblue\",\n },\n },\n { explicitlyTyped: true },\n);\n","import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { types } from \"mobx-state-tree\";\nimport { ConfigurationSchema } from \"@jbrowse/core/configuration\";\n\nexport function configSchemaFactory(pluginManager: PluginManager) {\n const LGVPlugin = pluginManager.getPlugin(\n \"LinearGenomeViewPlugin\",\n ) as import(\"@jbrowse/plugin-linear-genome-view\").default;\n //@ts-ignore\n const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;\n\n return ConfigurationSchema(\n \"LinearManhattanDisplay\",\n {\n autoscale: {\n type: \"stringEnum\",\n defaultValue: \"local\",\n model: types.enumeration(\"Autoscale type\", [\n \"global\",\n \"local\",\n \"globalsd\",\n \"localsd\",\n \"zscore\",\n ]),\n description:\n \"global/local using their min/max values or w/ standard deviations (globalsd/localsd)\",\n },\n minScore: {\n type: \"number\",\n defaultValue: Number.MIN_VALUE,\n description: \"minimum value for the y-scale\",\n },\n maxScore: {\n type: \"number\",\n description: \"maximum value for the y-scale\",\n defaultValue: Number.MAX_VALUE,\n },\n numStdDev: {\n type: \"number\",\n description:\n \"number of standard deviations to use for autoscale types globalsd or localsd\",\n defaultValue: 3,\n },\n scaleType: {\n type: \"stringEnum\",\n model: types.enumeration(\"Scale type\", [\"linear\", \"log\"]), // todo zscale\n description: \"The type of scale to use\",\n defaultValue: \"linear\",\n },\n inverted: {\n type: \"boolean\",\n description: \"draw upside down\",\n defaultValue: false,\n },\n\n defaultRendering: {\n type: \"stringEnum\",\n model: types.enumeration(\"Rendering\", [\"density\", \"xyplot\", \"line\"]),\n defaultValue: \"xyplot\",\n },\n },\n { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },\n );\n}\n","import PluginManager from \"@jbrowse/core/PluginManager\";\nexport { configSchemaFactory } from \"./configSchemaFactory\";\n\nexport function stateModelFactory(\n pluginManager: PluginManager,\n configSchema: any,\n) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n //@ts-ignore\n const { linearWiggleDisplayModelFactory } = WigglePlugin.exports;\n return types.compose(\n \"LinearManhattanDisplay\",\n linearWiggleDisplayModelFactory(pluginManager, configSchema),\n types\n .model({\n type: types.literal(\"LinearManhattanDisplay\"),\n })\n .views(() => ({\n get rendererTypeName() {\n return \"LinearManhattanRenderer\";\n },\n get needsScalebar() {\n return true;\n },\n get regionTooLarge() {\n return false;\n },\n })),\n );\n}\n\nexport type LinearManhattanDisplayModel = ReturnType<typeof stateModelFactory>;\n","import Plugin from \"@jbrowse/core/Plugin\";\nimport PluginManager from \"@jbrowse/core/PluginManager\";\nimport DisplayType from \"@jbrowse/core/pluggableElementTypes/DisplayType\";\nimport rendererFactory, {\n configSchema as rendererConfigSchema,\n} from \"./LinearManhattanRenderer\";\nimport {\n configSchemaFactory as displayConfigSchemaFactory,\n stateModelFactory as displayModelFactory,\n} from \"./LinearManhattanDisplay\";\n\nexport default class AlignmentsPlugin extends Plugin {\n name = \"GWASPlugin\";\n\n install(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n\n const {\n LinearWiggleDisplayReactComponent,\n XYPlotRendererReactComponent,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n pluginManager.addDisplayType(() => {\n const configSchema = displayConfigSchemaFactory(pluginManager);\n return new DisplayType({\n name: \"LinearManhattanDisplay\",\n configSchema,\n stateModel: displayModelFactory(pluginManager, configSchema),\n trackType: \"FeatureTrack\",\n viewType: \"LinearGenomeView\",\n ReactComponent: LinearWiggleDisplayReactComponent,\n });\n });\n\n pluginManager.addRendererType(() => {\n //@ts-ignore\n const ManhattanRenderer = new rendererFactory(pluginManager);\n const configSchema = rendererConfigSchema;\n return new ManhattanRenderer({\n name: \"LinearManhattanRenderer\",\n ReactComponent: XYPlotRendererReactComponent,\n configSchema,\n pluginManager,\n });\n });\n }\n}\n"],"names":["rendererFactory","pluginManager","WigglePlugin","getPlugin","exports","getScale","utils","WiggleBaseRenderer","ctx","props","features","regions","bpPerPx","config","scaleOpts","unadjustedHeight","height","displayCrossHatches","values","ticks","region","YSCALEBAR_LABEL_OFFSET","opts","range","width","end","start","scale","toY","n","feature","featureSpanPx","leftPx","score","get","fillStyle","readConfObject","beginPath","arc","Math","PI","fill","lineWidth","strokeStyle","forEach","tick","moveTo","round","lineTo","stroke","configSchema","ConfigurationSchema","color","type","description","defaultValue","explicitlyTyped","configSchemaFactory","LGVPlugin","baseLinearDisplayConfigSchema","autoscale","model","types","enumeration","minScore","Number","MIN_VALUE","maxScore","MAX_VALUE","numStdDev","scaleType","inverted","defaultRendering","baseConfiguration","stateModelFactory","lib","linearWiggleDisplayModelFactory","compose","literal","views","rendererTypeName","needsScalebar","regionTooLarge","AlignmentsPlugin","LinearWiggleDisplayReactComponent","XYPlotRendererReactComponent","addDisplayType","displayConfigSchemaFactory","DisplayType","name","stateModel","displayModelFactory","trackType","viewType","ReactComponent","addRendererType","ManhattanRenderer","rendererConfigSchema","Plugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAIwBA,gBAAgBC;EACtC,MAAMC,YAAY,GAAGD,aAAa,CAACE,SAAd,CACnB,cADmB,CAArB;gCAOID,YAAY,CAACE;QAHNC,iCAATC,MAASD;QACTE,2CAAAA;EAIF;EAAA;;EAAA;;EAAA;EAAA;;EAAA;EAAA;;EAAA;EAAA;EAAA,2BACOC,GADP,EACsCC,KADtC;cAGMC,WAQED,MARFC;cACAC,UAOEF,MAPFE;cACAC,UAMEH,MANFG;cACAC,SAKEJ,MALFI;cACAC,YAIEL,MAJFK;cACQC,mBAGNN,MAHFO;cACAC,sBAEER,MAFFQ;cACSC,SACPT,MADFU,MAASD;;wCAEMP;cAAVS;;EACP,YAAMC,sBAAsB,GAAG,CAA/B;EACA,YAAML,MAAM,GAAGD,gBAAgB,GAAGM,sBAAsB,GAAG,CAA3D;;EACA,YAAMC,IAAI,qCAAQR,SAAR;EAAmBS,UAAAA,KA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?t(exports,require("@jbrowse/core/Plugin"),require("@jbrowse/core/configuration")):"function"==typeof define&&define.amd?define(["exports","@jbrowse/core/Plugin","@jbrowse/core/configuration"],t):t((e=e||self).JBrowsePluginGWAS={},e.JBrowseExports["@jbrowse/core/Plugin"],e.JBrowseExports["@jbrowse/core/configuration"])}(this,(function(e,t,r){"use strict";function
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@jbrowse/core/Plugin"),require("@jbrowse/core/pluggableElementTypes/DisplayType"),require("@jbrowse/core/configuration"),require("@jbrowse/core/util"),require("mobx-state-tree")):"function"==typeof define&&define.amd?define(["exports","@jbrowse/core/Plugin","@jbrowse/core/pluggableElementTypes/DisplayType","@jbrowse/core/configuration","@jbrowse/core/util","mobx-state-tree"],t):t((e=e||self).JBrowsePluginGWAS={},e.JBrowseExports["@jbrowse/core/Plugin"],e.JBrowseExports["@jbrowse/core/pluggableElementTypes/DisplayType"],e.JBrowseExports["@jbrowse/core/configuration"],e.JBrowseExports["@jbrowse/core/util"],e.JBrowseExports["mobx-state-tree"])}(this,(function(e,t,r,n,o,a){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function b(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=y(e);if(t){var o=y(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return d(this,r)}}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw a}}return r}}(e,t)||m(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){if(e){if("string"==typeof e)return h(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(e,t):void 0}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e){var t=e.getPlugin("WigglePlugin").exports,r=t.utils.getScale;return function(e){p(a,e);var t=b(a);function a(){return i(this,a),t.apply(this,arguments)}return u(a,[{key:"draw",value:function(e,t){var a,i=t.features,l=t.bpPerPx,u=t.config,c=t.scaleOpts,s=t.height,p=t.displayCrossHatches,y=t.ticks.values,d=g(t.regions,1)[0],b=s-10,h=f(f({},c),{},{range:[0,b]}),v=(d.end-d.start)/l,w=r(h),j=function(e){return b-w(e)+5},O=function(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=m(e))){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){l=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw a}}}}(i.values());try{for(O.s();!(a=O.n()).done;){var P=a.value,S=g(o.featureSpanPx(P,d,l),1)[0],x=P.get("score");e.fillStyle=n.readConfObject(u,"color",[P]),e.beginPath(),e.arc(S,j(x),2,0,2*Math.PI),e.fill()}}catch(e){O.e(e)}finally{O.f()}p&&(e.lineWidth=1,e.strokeStyle="rgba(200,200,200,0.8)",y.forEach((function(t){e.beginPath(),e.moveTo(0,Math.round(j(t))),e.lineTo(v,Math.round(j(t))),e.stroke()})))}}]),a}(t.WiggleBaseRenderer)}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,r=r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r;var w=n.ConfigurationSchema("LinearManhattanRenderer",{color:{type:"color",description:"the color of the marks",defaultValue:"darkblue"}},{explicitlyTyped:!0});function j(e,t){var r=e.lib["mobx-state-tree"].types,n=e.getPlugin("WigglePlugin");return r.compose("LinearManhattanDisplay",(0,n.exports.linearWiggleDisplayModelFactory)(e,t),r.model({type:r.literal("LinearManhattanDisplay")}).views((function(){return{get rendererTypeName(){return"LinearManhattanRenderer"},get needsScalebar(){return!0},get regionTooLarge(){return!1}}})))}e.default=function(e){p(o,e);var t=b(o);function o(){var e;return i(this,o),(e=t.apply(this,arguments)).name="GWASPlugin",e}return u(o,[{key:"install",value:function(e){var t=e.getPlugin("WigglePlugin").exports,o=t.LinearWiggleDisplayReactComponent,i=t.XYPlotRendererReactComponent;e.addDisplayType((function(){var t=function(e){var t=e.getPlugin("LinearGenomeViewPlugin").exports.baseLinearDisplayConfigSchema;return n.ConfigurationSchema("LinearManhattanDisplay",{autoscale:{type:"stringEnum",defaultValue:"local",model:a.types.enumeration("Autoscale type",["global","local","globalsd","localsd","zscore"]),description:"global/local using their min/max values or w/ standard deviations (globalsd/localsd)"},minScore:{type:"number",defaultValue:Number.MIN_VALUE,description:"minimum value for the y-scale"},maxScore:{type:"number",description:"maximum value for the y-scale",defaultValue:Number.MAX_VALUE},numStdDev:{type:"number",description:"number of standard deviations to use for autoscale types globalsd or localsd",defaultValue:3},scaleType:{type:"stringEnum",model:a.types.enumeration("Scale type",["linear","log"]),description:"The type of scale to use",defaultValue:"linear"},inverted:{type:"boolean",description:"draw upside down",defaultValue:!1},defaultRendering:{type:"stringEnum",model:a.types.enumeration("Rendering",["density","xyplot","line"]),defaultValue:"xyplot"}},{baseConfiguration:t,explicitlyTyped:!0})}(e);return new r({name:"LinearManhattanDisplay",configSchema:t,stateModel:j(e,t),trackType:"FeatureTrack",viewType:"LinearGenomeView",ReactComponent:o})})),e.addRendererType((function(){return new new v(e)({name:"LinearManhattanRenderer",ReactComponent:i,configSchema:w,pluginManager:e})}))}}]),o}(t),Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=jbrowse-plugin-gwas.umd.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jbrowse-plugin-gwas.umd.production.min.js","sources":["../src/LinearManhattanRenderer/LinearManhattanRenderer.ts","../src/LinearManhattanDisplay/index.ts","../src/index.ts","../src/LinearManhattanRenderer/index.js"],"sourcesContent":["import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { readConfObject } from \"@jbrowse/core/configuration\";\n\nexport default function rendererFactory(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const {\n utils: { getScale },\n WiggleBaseRenderer,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n const { featureSpanPx } = pluginManager.lib[\"@jbrowse/core/util\"];\n\n return class ManhattanPlotRenderer extends WiggleBaseRenderer {\n draw(ctx: CanvasRenderingContext2D, props: any) {\n const {\n features,\n regions,\n bpPerPx,\n config,\n scaleOpts,\n height: unadjustedHeight,\n displayCrossHatches,\n ticks: { values },\n } = props;\n const [region] = regions;\n const YSCALEBAR_LABEL_OFFSET = 5;\n const height = unadjustedHeight - YSCALEBAR_LABEL_OFFSET * 2;\n const opts = { ...scaleOpts, range: [0, height] };\n const width = (region.end - region.start) / bpPerPx;\n\n const scale = getScale(opts);\n const toY = (n: number) => height - scale(n) + YSCALEBAR_LABEL_OFFSET;\n\n for (const feature of features.values()) {\n const [leftPx] = featureSpanPx(feature, region, bpPerPx);\n const score = feature.get(\"score\") as number;\n ctx.fillStyle = readConfObject(config, \"color\", [feature]);\n ctx.beginPath();\n ctx.arc(leftPx, toY(score), 2, 0, 2 * Math.PI);\n ctx.fill();\n }\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"rgba(200,200,200,0.8)\";\n values.forEach((tick: number) => {\n ctx.beginPath();\n ctx.moveTo(0, Math.round(toY(tick)));\n ctx.lineTo(width, Math.round(toY(tick)));\n ctx.stroke();\n });\n }\n }\n };\n}\n","import PluginManager from \"@jbrowse/core/PluginManager\";\n\nexport function configSchemaFactory(pluginManager: PluginManager) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const { ConfigurationSchema } = pluginManager.lib[\n \"@jbrowse/core/configuration\"\n ];\n\n const LGVPlugin = pluginManager.getPlugin(\n \"LinearGenomeViewPlugin\",\n ) as import(\"@jbrowse/plugin-linear-genome-view\").default;\n //@ts-ignore\n const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;\n\n return ConfigurationSchema(\n \"LinearManhattanDisplay\",\n {\n autoscale: {\n type: \"stringEnum\",\n defaultValue: \"local\",\n model: types.enumeration(\"Autoscale type\", [\n \"global\",\n \"local\",\n \"globalsd\",\n \"localsd\",\n \"zscore\",\n ]),\n description:\n \"global/local using their min/max values or w/ standard deviations (globalsd/localsd)\",\n },\n minScore: {\n type: \"number\",\n defaultValue: Number.MIN_VALUE,\n description: \"minimum value for the y-scale\",\n },\n maxScore: {\n type: \"number\",\n description: \"maximum value for the y-scale\",\n defaultValue: Number.MAX_VALUE,\n },\n numStdDev: {\n type: \"number\",\n description:\n \"number of standard deviations to use for autoscale types globalsd or localsd\",\n defaultValue: 3,\n },\n scaleType: {\n type: \"stringEnum\",\n model: types.enumeration(\"Scale type\", [\"linear\", \"log\"]), // todo zscale\n description: \"The type of scale to use\",\n defaultValue: \"linear\",\n },\n inverted: {\n type: \"boolean\",\n description: \"draw upside down\",\n defaultValue: false,\n },\n\n defaultRendering: {\n type: \"stringEnum\",\n model: types.enumeration(\"Rendering\", [\"density\", \"xyplot\", \"line\"]),\n defaultValue: \"xyplot\",\n },\n },\n { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },\n );\n}\n\nexport function stateModelFactory(\n pluginManager: PluginManager,\n configSchema: any,\n) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n //@ts-ignore\n const { linearWiggleDisplayModelFactory } = WigglePlugin.exports;\n return types.compose(\n \"LinearManhattanDisplay\",\n linearWiggleDisplayModelFactory(pluginManager, configSchema),\n types\n .model({\n type: types.literal(\"LinearManhattanDisplay\"),\n })\n .views(() => ({\n get rendererTypeName() {\n return \"LinearManhattanRenderer\";\n },\n get needsScalebar() {\n return true;\n },\n })),\n );\n}\n\nexport type LinearManhattanDisplayModel = ReturnType<typeof stateModelFactory>;\n","import Plugin from \"@jbrowse/core/Plugin\";\nimport PluginManager from \"@jbrowse/core/PluginManager\";\nimport rendererFactory, {\n configSchemaFactory as linearManhattanRendererConfigSchemaFactory,\n} from \"./LinearManhattanRenderer\";\nimport {\n configSchemaFactory as linearManhattanDisplayConfigSchemaFactory,\n stateModelFactory as linearManhattanDisplayModelFactory,\n} from \"./LinearManhattanDisplay\";\n\nexport default class AlignmentsPlugin extends Plugin {\n name = \"GWASPlugin\";\n\n install(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const DisplayType =\n pluginManager.lib[\"@jbrowse/core/pluggableElementTypes/DisplayType\"];\n const {\n LinearWiggleDisplayReactComponent,\n XYPlotRendererReactComponent,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n pluginManager.addDisplayType(() => {\n const configSchema = linearManhattanDisplayConfigSchemaFactory(\n pluginManager,\n );\n return new DisplayType({\n name: \"LinearManhattanDisplay\",\n configSchema,\n stateModel: linearManhattanDisplayModelFactory(\n pluginManager,\n configSchema,\n ),\n trackType: \"FeatureTrack\",\n viewType: \"LinearGenomeView\",\n ReactComponent: LinearWiggleDisplayReactComponent,\n });\n });\n\n pluginManager.addRendererType(() => {\n //@ts-ignore\n const ManhattanRenderer = new rendererFactory(pluginManager);\n const configSchema = linearManhattanRendererConfigSchemaFactory(\n pluginManager,\n );\n return new ManhattanRenderer({\n name: \"LinearManhattanRenderer\",\n ReactComponent: XYPlotRendererReactComponent,\n configSchema,\n pluginManager,\n });\n });\n }\n}\n","export { default } from \"./LinearManhattanRenderer\";\n\nexport function configSchemaFactory(pluginManager) {\n const { ConfigurationSchema } = pluginManager.lib[\n \"@jbrowse/core/configuration\"\n ];\n\n return ConfigurationSchema(\n \"LinearManhattanRenderer\",\n {\n color: {\n type: \"color\",\n description: \"the color of the marks\",\n defaultValue: \"darkblue\",\n },\n },\n { explicitlyTyped: true },\n );\n}\n"],"names":["rendererFactory","pluginManager","getPlugin","exports","getScale","utils","featureSpanPx","lib","ctx","props","features","bpPerPx","config","scaleOpts","unadjustedHeight","height","displayCrossHatches","values","ticks","region","regions","YSCALEBAR_LABEL_OFFSET","opts","range","width","end","start","scale","toY","n","feature","leftPx","score","get","fillStyle","readConfObject","beginPath","arc","Math","PI","fill","lineWidth","strokeStyle","forEach","tick","moveTo","round","lineTo","stroke","WiggleBaseRenderer","stateModelFactory","configSchema","types","WigglePlugin","compose","linearWiggleDisplayModelFactory","model","type","literal","views","DisplayType","LinearWiggleDisplayReactComponent","XYPlotRendererReactComponent","addDisplayType","ConfigurationSchema","baseLinearDisplayConfigSchema","autoscale","defaultValue","enumeration","description","minScore","Number","MIN_VALUE","maxScore","MAX_VALUE","numStdDev","scaleType","inverted","defaultRendering","baseConfiguration","explicitlyTyped","linearManhattanDisplayConfigSchemaFactory","name","stateModel","linearManhattanDisplayModelFactory","trackType","viewType","ReactComponent","addRendererType","ManhattanRenderer","color","linearManhattanRendererConfigSchemaFactory","Plugin"],"mappings":"g2GAGwBA,EAAgBC,SACjBA,EAAcC,UACjC,gBAMeC,QAHNC,IAATC,MAASD,SAKHE,EAAkBL,EAAcM,IAAI,sBAApCD,gJAGDE,EAA+BC,SAEhCC,EAQED,EARFC,SAEAC,EAMEF,EANFE,QACAC,EAKEH,EALFG,OACAC,EAIEJ,EAJFI,UACQC,EAGNL,EAHFM,OACAC,EAEEP,EAFFO,oBACSC,EACPR,EADFS,MAASD,OAEJE,IADHV,EAPFW,cAUIL,EAASD,EAAmBO,GAC5BC,SAAYT,OAAWU,MAAO,CAAC,EAAGR,KAClCS,GA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AAkB,CACzC,SACA,QACA,WACA,UACA,WAEFC,YACE,wFAEJC,SAAU,CACRb,KAAM,SACNU,aAAcI,OAAOC,UACrBH,YAAa,iCAEfI,SAAU,CACRhB,KAAM,SACNY,YAAa,gCACbF,aAAcI,OAAOG,WAEvBC,UAAW,CACTlB,KAAM,SACNY,YACE,+EACFF,aAAc,GAEhBS,UAAW,CACTnB,KAAM,aACND,MAAOJ,EAAMgB,YAAY,aAAc,CAAC,SAAU,QAClDC,YAAa,2BACbF,aAAc,UAEhBU,SAAU,CACRpB,KAAM,UACNY,YAAa,mBACbF,cAAc,GAGhBW,iBAAkB,CAChBrB,KAAM,aACND,MAAOJ,EAAMgB,YAAY,YAAa,CAAC,UAAW,SAAU,SAC5DD,aAAc,WAGlB,CAAEY,kBAAmBd,EAA+Be,iBAAiB,ICtC9CC,CACnBhF,UAEK,IAAI2D,EAAY,CACrBsB,KAAM,yBACN/B,aAAAA,EACAgC,WAAYC,EACVnF,EACAkD,GAEFkC,UAAW,eACXC,SAAU,mBACVC,eAAgB1B,OAIpB5D,EAAcuF,iBAAgB,eAEtBC,EAAoB,IAAIzF,EAAgBC,GACxCkD,EC3CL,SAA6BlD,UAK3B+D,EAJyB/D,EAAcM,IAC5C,+BADMyD,qBAKN,0BACA,CACE0B,MAAO,CACLjC,KAAM,QACNY,YAAa,yBACbF,aAAc,aAGlB,CAAEa,iBAAiB,ID6BIW,CACnB1F,UAEK,IAAIwF,EAAkB,CAC3BP,KAAM,0BACNK,eAAgBzB,EAChBX,aAAAA,EACAlD,cAAAA,cA1CsC2F"}
|
|
1
|
+
{"version":3,"file":"jbrowse-plugin-gwas.umd.production.min.js","sources":["../src/LinearManhattanRenderer/LinearManhattanRenderer.ts","../src/LinearManhattanRenderer/index.ts","../src/LinearManhattanDisplay/index.ts","../src/index.ts","../src/LinearManhattanDisplay/configSchemaFactory.ts"],"sourcesContent":["import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { readConfObject } from \"@jbrowse/core/configuration\";\nimport { featureSpanPx } from \"@jbrowse/core/util\";\n\nexport default function rendererFactory(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n const {\n utils: { getScale },\n WiggleBaseRenderer,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n return class ManhattanPlotRenderer extends WiggleBaseRenderer {\n draw(ctx: CanvasRenderingContext2D, props: any) {\n const {\n features,\n regions,\n bpPerPx,\n config,\n scaleOpts,\n height: unadjustedHeight,\n displayCrossHatches,\n ticks: { values },\n } = props;\n const [region] = regions;\n const YSCALEBAR_LABEL_OFFSET = 5;\n const height = unadjustedHeight - YSCALEBAR_LABEL_OFFSET * 2;\n const opts = { ...scaleOpts, range: [0, height] };\n const width = (region.end - region.start) / bpPerPx;\n\n const scale = getScale(opts);\n const toY = (n: number) => height - scale(n) + YSCALEBAR_LABEL_OFFSET;\n\n for (const feature of features.values()) {\n const [leftPx] = featureSpanPx(feature, region, bpPerPx);\n const score = feature.get(\"score\") as number;\n ctx.fillStyle = readConfObject(config, \"color\", [feature]);\n ctx.beginPath();\n ctx.arc(leftPx, toY(score), 2, 0, 2 * Math.PI);\n ctx.fill();\n }\n\n if (displayCrossHatches) {\n ctx.lineWidth = 1;\n ctx.strokeStyle = \"rgba(200,200,200,0.8)\";\n values.forEach((tick: number) => {\n ctx.beginPath();\n ctx.moveTo(0, Math.round(toY(tick)));\n ctx.lineTo(width, Math.round(toY(tick)));\n ctx.stroke();\n });\n }\n }\n };\n}\n","export { default } from \"./LinearManhattanRenderer\";\nimport { ConfigurationSchema } from \"@jbrowse/core/configuration\";\n\nexport const configSchema = ConfigurationSchema(\n \"LinearManhattanRenderer\",\n {\n color: {\n type: \"color\",\n description: \"the color of the marks\",\n defaultValue: \"darkblue\",\n },\n },\n { explicitlyTyped: true },\n);\n","import PluginManager from \"@jbrowse/core/PluginManager\";\nexport { configSchemaFactory } from \"./configSchemaFactory\";\n\nexport function stateModelFactory(\n pluginManager: PluginManager,\n configSchema: any,\n) {\n const { types } = pluginManager.lib[\"mobx-state-tree\"];\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n //@ts-ignore\n const { linearWiggleDisplayModelFactory } = WigglePlugin.exports;\n return types.compose(\n \"LinearManhattanDisplay\",\n linearWiggleDisplayModelFactory(pluginManager, configSchema),\n types\n .model({\n type: types.literal(\"LinearManhattanDisplay\"),\n })\n .views(() => ({\n get rendererTypeName() {\n return \"LinearManhattanRenderer\";\n },\n get needsScalebar() {\n return true;\n },\n get regionTooLarge() {\n return false;\n },\n })),\n );\n}\n\nexport type LinearManhattanDisplayModel = ReturnType<typeof stateModelFactory>;\n","import Plugin from \"@jbrowse/core/Plugin\";\nimport PluginManager from \"@jbrowse/core/PluginManager\";\nimport DisplayType from \"@jbrowse/core/pluggableElementTypes/DisplayType\";\nimport rendererFactory, {\n configSchema as rendererConfigSchema,\n} from \"./LinearManhattanRenderer\";\nimport {\n configSchemaFactory as displayConfigSchemaFactory,\n stateModelFactory as displayModelFactory,\n} from \"./LinearManhattanDisplay\";\n\nexport default class AlignmentsPlugin extends Plugin {\n name = \"GWASPlugin\";\n\n install(pluginManager: PluginManager) {\n const WigglePlugin = pluginManager.getPlugin(\n \"WigglePlugin\",\n ) as import(\"@jbrowse/plugin-wiggle\").default;\n\n const {\n LinearWiggleDisplayReactComponent,\n XYPlotRendererReactComponent,\n //@ts-ignore\n } = WigglePlugin.exports;\n\n pluginManager.addDisplayType(() => {\n const configSchema = displayConfigSchemaFactory(pluginManager);\n return new DisplayType({\n name: \"LinearManhattanDisplay\",\n configSchema,\n stateModel: displayModelFactory(pluginManager, configSchema),\n trackType: \"FeatureTrack\",\n viewType: \"LinearGenomeView\",\n ReactComponent: LinearWiggleDisplayReactComponent,\n });\n });\n\n pluginManager.addRendererType(() => {\n //@ts-ignore\n const ManhattanRenderer = new rendererFactory(pluginManager);\n const configSchema = rendererConfigSchema;\n return new ManhattanRenderer({\n name: \"LinearManhattanRenderer\",\n ReactComponent: XYPlotRendererReactComponent,\n configSchema,\n pluginManager,\n });\n });\n }\n}\n","import PluginManager from \"@jbrowse/core/PluginManager\";\nimport { types } from \"mobx-state-tree\";\nimport { ConfigurationSchema } from \"@jbrowse/core/configuration\";\n\nexport function configSchemaFactory(pluginManager: PluginManager) {\n const LGVPlugin = pluginManager.getPlugin(\n \"LinearGenomeViewPlugin\",\n ) as import(\"@jbrowse/plugin-linear-genome-view\").default;\n //@ts-ignore\n const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;\n\n return ConfigurationSchema(\n \"LinearManhattanDisplay\",\n {\n autoscale: {\n type: \"stringEnum\",\n defaultValue: \"local\",\n model: types.enumeration(\"Autoscale type\", [\n \"global\",\n \"local\",\n \"globalsd\",\n \"localsd\",\n \"zscore\",\n ]),\n description:\n \"global/local using their min/max values or w/ standard deviations (globalsd/localsd)\",\n },\n minScore: {\n type: \"number\",\n defaultValue: Number.MIN_VALUE,\n description: \"minimum value for the y-scale\",\n },\n maxScore: {\n type: \"number\",\n description: \"maximum value for the y-scale\",\n defaultValue: Number.MAX_VALUE,\n },\n numStdDev: {\n type: \"number\",\n description:\n \"number of standard deviations to use for autoscale types globalsd or localsd\",\n defaultValue: 3,\n },\n scaleType: {\n type: \"stringEnum\",\n model: types.enumeration(\"Scale type\", [\"linear\", \"log\"]), // todo zscale\n description: \"The type of scale to use\",\n defaultValue: \"linear\",\n },\n inverted: {\n type: \"boolean\",\n description: \"draw upside down\",\n defaultValue: false,\n },\n\n defaultRendering: {\n type: \"stringEnum\",\n model: types.enumeration(\"Rendering\", [\"density\", \"xyplot\", \"line\"]),\n defaultValue: \"xyplot\",\n },\n },\n { baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },\n );\n}\n"],"names":["rendererFactory","pluginManager","getPlugin","exports","getScale","utils","ctx","props","features","bpPerPx","config","scaleOpts","unadjustedHeight","height","displayCrossHatches","values","ticks","region","regions","YSCALEBAR_LABEL_OFFSET","opts","range","width","end","start","scale","toY","n","feature","leftPx","featureSpanPx","score","get","fillStyle","readConfObject","beginPath","arc","Math","PI","fill","lineWidth","strokeStyle","forEach","tick","moveTo","round","lineTo","stroke","WiggleBaseRenderer","configSchema","ConfigurationSchema","color","type","description","defaultValue","explicitlyTyped","stateModelFactory","types","lib","WigglePlugin","compose","linearWiggleDisplayModelFactory","model","literal","views","LinearWiggleDisplayReactComponent","XYPlotRendererReactComponent","addDisplayType","baseLinearDisplayConfigSchema","autoscale","enumeration","minScore","Number","MIN_VALUE","maxScore","MAX_VALUE","numStdDev","scaleType","inverted","defaultRendering","baseConfiguration","displayConfigSchemaFactory","DisplayType","name","stateModel","displayModelFactory","trackType","viewType","ReactComponent","addRendererType","rendererConfigSchema","Plugin"],"mappings":"ksHAIwBA,EAAgBC,SACjBA,EAAcC,UACjC,gBAMeC,QAHNC,IAATC,MAASD,2IAMJE,EAA+BC,SAEhCC,EAQED,EARFC,SAEAC,EAMEF,EANFE,QACAC,EAKEH,EALFG,OACAC,EAIEJ,EAJFI,UACQC,EAGNL,EAHFM,OACAC,EAEEP,EAFFO,oBACSC,EACPR,EADFS,MAASD,OAEJE,IADHV,EAPFW,cAUIL,EAASD,EAAmBO,GAC5BC,SAAYT,OAAWU,MAAO,CAAC,EAAGR,KAClCS,GAASL,EAAOM,IAAMN,EAAOO,OAASf,EAEtCgB,EAAQrB,EAASgB,GACjBM,EAAM,SAACC,UAAcd,EAASY,EAAME,GANX,kmBAQTnB,EAASO,yCAAU,KAA9Ba,UACFC,IAAUC,gBAAcF,EAASX,EAAQR,SAC1CsB,EAAQH,EAAQI,IAAI,SAC1B1B,EAAI2B,UAAYC,iBAAexB,EAAQ,QAAS,CAACkB,IACjDtB,EAAI6B,YACJ7B,EAAI8B,IAAIP,EAAQH,EAAIK,GAAQ,EAAG,EAAG,EAAIM,KAAKC,IAC3ChC,EAAIiC,sCAGFzB,IACFR,EAAIkC,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B,CAChB3B,KAAM,aACNU,MAAOL,QAAMa,YAAY,YAAa,CAAC,UAAW,SAAU,SAC5DhB,aAAc,WAGlB,CAAE0B,kBAAmBZ,EAA+Bb,iBAAiB,IDnC9C0B,CAA2BhF,UACzC,IAAIiF,EAAY,CACrBC,KAAM,yBACNlC,aAAAA,EACAmC,WAAYC,EAAoBpF,EAAegD,GAC/CqC,UAAW,eACXC,SAAU,mBACVC,eAAgBvB,OAIpBhE,EAAcwF,iBAAgB,kBAIrB,IAFmB,IAAIzF,EAAgBC,EAEvC,CAAsB,CAC3BkF,KAAM,0BACNK,eAAgBtB,EAChBjB,aAJmByC,EAKnBzF,cAAAA,cAlCsC0F"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import PluginManager from "@jbrowse/core/PluginManager";
|
|
2
|
+
import { types } from "mobx-state-tree";
|
|
3
|
+
import { ConfigurationSchema } from "@jbrowse/core/configuration";
|
|
4
|
+
|
|
5
|
+
export function configSchemaFactory(pluginManager: PluginManager) {
|
|
6
|
+
const LGVPlugin = pluginManager.getPlugin(
|
|
7
|
+
"LinearGenomeViewPlugin",
|
|
8
|
+
) as import("@jbrowse/plugin-linear-genome-view").default;
|
|
9
|
+
//@ts-ignore
|
|
10
|
+
const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;
|
|
11
|
+
|
|
12
|
+
return ConfigurationSchema(
|
|
13
|
+
"LinearManhattanDisplay",
|
|
14
|
+
{
|
|
15
|
+
autoscale: {
|
|
16
|
+
type: "stringEnum",
|
|
17
|
+
defaultValue: "local",
|
|
18
|
+
model: types.enumeration("Autoscale type", [
|
|
19
|
+
"global",
|
|
20
|
+
"local",
|
|
21
|
+
"globalsd",
|
|
22
|
+
"localsd",
|
|
23
|
+
"zscore",
|
|
24
|
+
]),
|
|
25
|
+
description:
|
|
26
|
+
"global/local using their min/max values or w/ standard deviations (globalsd/localsd)",
|
|
27
|
+
},
|
|
28
|
+
minScore: {
|
|
29
|
+
type: "number",
|
|
30
|
+
defaultValue: Number.MIN_VALUE,
|
|
31
|
+
description: "minimum value for the y-scale",
|
|
32
|
+
},
|
|
33
|
+
maxScore: {
|
|
34
|
+
type: "number",
|
|
35
|
+
description: "maximum value for the y-scale",
|
|
36
|
+
defaultValue: Number.MAX_VALUE,
|
|
37
|
+
},
|
|
38
|
+
numStdDev: {
|
|
39
|
+
type: "number",
|
|
40
|
+
description:
|
|
41
|
+
"number of standard deviations to use for autoscale types globalsd or localsd",
|
|
42
|
+
defaultValue: 3,
|
|
43
|
+
},
|
|
44
|
+
scaleType: {
|
|
45
|
+
type: "stringEnum",
|
|
46
|
+
model: types.enumeration("Scale type", ["linear", "log"]), // todo zscale
|
|
47
|
+
description: "The type of scale to use",
|
|
48
|
+
defaultValue: "linear",
|
|
49
|
+
},
|
|
50
|
+
inverted: {
|
|
51
|
+
type: "boolean",
|
|
52
|
+
description: "draw upside down",
|
|
53
|
+
defaultValue: false,
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
defaultRendering: {
|
|
57
|
+
type: "stringEnum",
|
|
58
|
+
model: types.enumeration("Rendering", ["density", "xyplot", "line"]),
|
|
59
|
+
defaultValue: "xyplot",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{ baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -1,70 +1,5 @@
|
|
|
1
1
|
import PluginManager from "@jbrowse/core/PluginManager";
|
|
2
|
-
|
|
3
|
-
export function configSchemaFactory(pluginManager: PluginManager) {
|
|
4
|
-
const { types } = pluginManager.lib["mobx-state-tree"];
|
|
5
|
-
const { ConfigurationSchema } = pluginManager.lib[
|
|
6
|
-
"@jbrowse/core/configuration"
|
|
7
|
-
];
|
|
8
|
-
|
|
9
|
-
const LGVPlugin = pluginManager.getPlugin(
|
|
10
|
-
"LinearGenomeViewPlugin",
|
|
11
|
-
) as import("@jbrowse/plugin-linear-genome-view").default;
|
|
12
|
-
//@ts-ignore
|
|
13
|
-
const { baseLinearDisplayConfigSchema } = LGVPlugin.exports;
|
|
14
|
-
|
|
15
|
-
return ConfigurationSchema(
|
|
16
|
-
"LinearManhattanDisplay",
|
|
17
|
-
{
|
|
18
|
-
autoscale: {
|
|
19
|
-
type: "stringEnum",
|
|
20
|
-
defaultValue: "local",
|
|
21
|
-
model: types.enumeration("Autoscale type", [
|
|
22
|
-
"global",
|
|
23
|
-
"local",
|
|
24
|
-
"globalsd",
|
|
25
|
-
"localsd",
|
|
26
|
-
"zscore",
|
|
27
|
-
]),
|
|
28
|
-
description:
|
|
29
|
-
"global/local using their min/max values or w/ standard deviations (globalsd/localsd)",
|
|
30
|
-
},
|
|
31
|
-
minScore: {
|
|
32
|
-
type: "number",
|
|
33
|
-
defaultValue: Number.MIN_VALUE,
|
|
34
|
-
description: "minimum value for the y-scale",
|
|
35
|
-
},
|
|
36
|
-
maxScore: {
|
|
37
|
-
type: "number",
|
|
38
|
-
description: "maximum value for the y-scale",
|
|
39
|
-
defaultValue: Number.MAX_VALUE,
|
|
40
|
-
},
|
|
41
|
-
numStdDev: {
|
|
42
|
-
type: "number",
|
|
43
|
-
description:
|
|
44
|
-
"number of standard deviations to use for autoscale types globalsd or localsd",
|
|
45
|
-
defaultValue: 3,
|
|
46
|
-
},
|
|
47
|
-
scaleType: {
|
|
48
|
-
type: "stringEnum",
|
|
49
|
-
model: types.enumeration("Scale type", ["linear", "log"]), // todo zscale
|
|
50
|
-
description: "The type of scale to use",
|
|
51
|
-
defaultValue: "linear",
|
|
52
|
-
},
|
|
53
|
-
inverted: {
|
|
54
|
-
type: "boolean",
|
|
55
|
-
description: "draw upside down",
|
|
56
|
-
defaultValue: false,
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
defaultRendering: {
|
|
60
|
-
type: "stringEnum",
|
|
61
|
-
model: types.enumeration("Rendering", ["density", "xyplot", "line"]),
|
|
62
|
-
defaultValue: "xyplot",
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
{ baseConfiguration: baseLinearDisplayConfigSchema, explicitlyTyped: true },
|
|
66
|
-
);
|
|
67
|
-
}
|
|
2
|
+
export { configSchemaFactory } from "./configSchemaFactory";
|
|
68
3
|
|
|
69
4
|
export function stateModelFactory(
|
|
70
5
|
pluginManager: PluginManager,
|
|
@@ -90,6 +25,9 @@ export function stateModelFactory(
|
|
|
90
25
|
get needsScalebar() {
|
|
91
26
|
return true;
|
|
92
27
|
},
|
|
28
|
+
get regionTooLarge() {
|
|
29
|
+
return false;
|
|
30
|
+
},
|
|
93
31
|
})),
|
|
94
32
|
);
|
|
95
33
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import PluginManager from "@jbrowse/core/PluginManager";
|
|
2
2
|
import { readConfObject } from "@jbrowse/core/configuration";
|
|
3
|
+
import { featureSpanPx } from "@jbrowse/core/util";
|
|
3
4
|
|
|
4
5
|
export default function rendererFactory(pluginManager: PluginManager) {
|
|
5
6
|
const WigglePlugin = pluginManager.getPlugin(
|
|
@@ -11,8 +12,6 @@ export default function rendererFactory(pluginManager: PluginManager) {
|
|
|
11
12
|
//@ts-ignore
|
|
12
13
|
} = WigglePlugin.exports;
|
|
13
14
|
|
|
14
|
-
const { featureSpanPx } = pluginManager.lib["@jbrowse/core/util"];
|
|
15
|
-
|
|
16
15
|
return class ManhattanPlotRenderer extends WiggleBaseRenderer {
|
|
17
16
|
draw(ctx: CanvasRenderingContext2D, props: any) {
|
|
18
17
|
const {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { default } from "./LinearManhattanRenderer";
|
|
2
|
+
import { ConfigurationSchema } from "@jbrowse/core/configuration";
|
|
3
|
+
|
|
4
|
+
export const configSchema = ConfigurationSchema(
|
|
5
|
+
"LinearManhattanRenderer",
|
|
6
|
+
{
|
|
7
|
+
color: {
|
|
8
|
+
type: "color",
|
|
9
|
+
description: "the color of the marks",
|
|
10
|
+
defaultValue: "darkblue",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
{ explicitlyTyped: true },
|
|
14
|
+
);
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import Plugin from "@jbrowse/core/Plugin";
|
|
2
2
|
import PluginManager from "@jbrowse/core/PluginManager";
|
|
3
|
+
import DisplayType from "@jbrowse/core/pluggableElementTypes/DisplayType";
|
|
3
4
|
import rendererFactory, {
|
|
4
|
-
|
|
5
|
+
configSchema as rendererConfigSchema,
|
|
5
6
|
} from "./LinearManhattanRenderer";
|
|
6
7
|
import {
|
|
7
|
-
configSchemaFactory as
|
|
8
|
-
stateModelFactory as
|
|
8
|
+
configSchemaFactory as displayConfigSchemaFactory,
|
|
9
|
+
stateModelFactory as displayModelFactory,
|
|
9
10
|
} from "./LinearManhattanDisplay";
|
|
10
11
|
|
|
11
12
|
export default class AlignmentsPlugin extends Plugin {
|
|
@@ -15,8 +16,7 @@ export default class AlignmentsPlugin extends Plugin {
|
|
|
15
16
|
const WigglePlugin = pluginManager.getPlugin(
|
|
16
17
|
"WigglePlugin",
|
|
17
18
|
) as import("@jbrowse/plugin-wiggle").default;
|
|
18
|
-
|
|
19
|
-
pluginManager.lib["@jbrowse/core/pluggableElementTypes/DisplayType"];
|
|
19
|
+
|
|
20
20
|
const {
|
|
21
21
|
LinearWiggleDisplayReactComponent,
|
|
22
22
|
XYPlotRendererReactComponent,
|
|
@@ -24,16 +24,11 @@ export default class AlignmentsPlugin extends Plugin {
|
|
|
24
24
|
} = WigglePlugin.exports;
|
|
25
25
|
|
|
26
26
|
pluginManager.addDisplayType(() => {
|
|
27
|
-
const configSchema =
|
|
28
|
-
pluginManager,
|
|
29
|
-
);
|
|
27
|
+
const configSchema = displayConfigSchemaFactory(pluginManager);
|
|
30
28
|
return new DisplayType({
|
|
31
29
|
name: "LinearManhattanDisplay",
|
|
32
30
|
configSchema,
|
|
33
|
-
stateModel:
|
|
34
|
-
pluginManager,
|
|
35
|
-
configSchema,
|
|
36
|
-
),
|
|
31
|
+
stateModel: displayModelFactory(pluginManager, configSchema),
|
|
37
32
|
trackType: "FeatureTrack",
|
|
38
33
|
viewType: "LinearGenomeView",
|
|
39
34
|
ReactComponent: LinearWiggleDisplayReactComponent,
|
|
@@ -43,9 +38,7 @@ export default class AlignmentsPlugin extends Plugin {
|
|
|
43
38
|
pluginManager.addRendererType(() => {
|
|
44
39
|
//@ts-ignore
|
|
45
40
|
const ManhattanRenderer = new rendererFactory(pluginManager);
|
|
46
|
-
const configSchema =
|
|
47
|
-
pluginManager,
|
|
48
|
-
);
|
|
41
|
+
const configSchema = rendererConfigSchema;
|
|
49
42
|
return new ManhattanRenderer({
|
|
50
43
|
name: "LinearManhattanRenderer",
|
|
51
44
|
ReactComponent: XYPlotRendererReactComponent,
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export { default } from "./LinearManhattanRenderer";
|
|
2
|
-
|
|
3
|
-
export function configSchemaFactory(pluginManager) {
|
|
4
|
-
const { ConfigurationSchema } = pluginManager.lib[
|
|
5
|
-
"@jbrowse/core/configuration"
|
|
6
|
-
];
|
|
7
|
-
|
|
8
|
-
return ConfigurationSchema(
|
|
9
|
-
"LinearManhattanRenderer",
|
|
10
|
-
{
|
|
11
|
-
color: {
|
|
12
|
-
type: "color",
|
|
13
|
-
description: "the color of the marks",
|
|
14
|
-
defaultValue: "darkblue",
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
{ explicitlyTyped: true },
|
|
18
|
-
);
|
|
19
|
-
}
|