@jbrowse/plugin-wiggle 3.0.0 → 3.0.2
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/dist/BigWigAdapter/BigWigAdapter.js +11 -8
- package/dist/DensityRenderer/configSchema.d.ts +3 -0
- package/dist/LinePlotRenderer/configSchema.d.ts +3 -0
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.js +6 -7
- package/dist/LinearWiggleDisplay/model.d.ts +16 -12
- package/dist/LinearWiggleDisplay/model.js +30 -9
- package/dist/LinearWiggleDisplay/renderSvg.js +2 -2
- package/dist/MultiDensityRenderer/configSchema.d.ts +3 -0
- package/dist/MultiLineRenderer/configSchema.d.ts +3 -0
- package/dist/MultiLinearWiggleDisplay/components/ColorLegend.js +2 -2
- package/dist/MultiLinearWiggleDisplay/components/LegendItem.js +2 -2
- package/dist/MultiLinearWiggleDisplay/model.d.ts +1 -1
- package/dist/MultiLinearWiggleDisplay/model.js +2 -2
- package/dist/MultiRowLineRenderer/configSchema.d.ts +3 -0
- package/dist/MultiRowXYPlotRenderer/configSchema.d.ts +3 -0
- package/dist/MultiXYPlotRenderer/configSchema.d.ts +3 -0
- package/dist/WiggleBaseRenderer.d.ts +2 -0
- package/dist/WiggleBaseRenderer.js +2 -1
- package/dist/XYPlotRenderer/XYPlotRenderer.d.ts +1 -2
- package/dist/XYPlotRenderer/XYPlotRenderer.js +4 -3
- package/dist/XYPlotRenderer/configSchema.d.ts +3 -0
- package/dist/configSchema.d.ts +3 -0
- package/dist/configSchema.js +3 -0
- package/dist/drawXY.d.ts +1 -0
- package/dist/drawXY.js +2 -2
- package/dist/index.d.ts +3 -0
- package/esm/BigWigAdapter/BigWigAdapter.js +11 -8
- package/esm/DensityRenderer/configSchema.d.ts +3 -0
- package/esm/LinePlotRenderer/configSchema.d.ts +3 -0
- package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.js +6 -7
- package/esm/LinearWiggleDisplay/model.d.ts +16 -12
- package/esm/LinearWiggleDisplay/model.js +30 -9
- package/esm/LinearWiggleDisplay/renderSvg.js +2 -2
- package/esm/MultiDensityRenderer/configSchema.d.ts +3 -0
- package/esm/MultiLineRenderer/configSchema.d.ts +3 -0
- package/esm/MultiLinearWiggleDisplay/components/ColorLegend.js +2 -2
- package/esm/MultiLinearWiggleDisplay/components/LegendItem.js +2 -2
- package/esm/MultiLinearWiggleDisplay/model.d.ts +1 -1
- package/esm/MultiLinearWiggleDisplay/model.js +2 -2
- package/esm/MultiRowLineRenderer/configSchema.d.ts +3 -0
- package/esm/MultiRowXYPlotRenderer/configSchema.d.ts +3 -0
- package/esm/MultiXYPlotRenderer/configSchema.d.ts +3 -0
- package/esm/WiggleBaseRenderer.d.ts +2 -0
- package/esm/WiggleBaseRenderer.js +2 -1
- package/esm/XYPlotRenderer/XYPlotRenderer.d.ts +1 -2
- package/esm/XYPlotRenderer/XYPlotRenderer.js +4 -3
- package/esm/XYPlotRenderer/configSchema.d.ts +3 -0
- package/esm/configSchema.d.ts +3 -0
- package/esm/configSchema.js +3 -0
- package/esm/drawXY.d.ts +1 -0
- package/esm/drawXY.js +2 -2
- package/esm/index.d.ts +3 -0
- package/package.json +11 -11
|
@@ -9,12 +9,14 @@ const stats_1 = require("@jbrowse/core/util/stats");
|
|
|
9
9
|
class BigWigAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
10
10
|
async setupPre(opts) {
|
|
11
11
|
const { statusCallback = () => { } } = opts || {};
|
|
12
|
-
const
|
|
12
|
+
const pluginManager = this.pluginManager;
|
|
13
13
|
const bigwig = new bbi_1.BigWig({
|
|
14
|
-
filehandle: (0, io_1.openLocation)(this.getConf('bigWigLocation'),
|
|
14
|
+
filehandle: (0, io_1.openLocation)(this.getConf('bigWigLocation'), pluginManager),
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
return {
|
|
17
|
+
bigwig,
|
|
18
|
+
header: await (0, util_1.updateStatus)('Downloading bigwig header', statusCallback, () => bigwig.getHeader(opts)),
|
|
19
|
+
};
|
|
18
20
|
}
|
|
19
21
|
async setup(opts) {
|
|
20
22
|
if (!this.setupP) {
|
|
@@ -42,14 +44,13 @@ class BigWigAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
42
44
|
const { refName, start, end } = region;
|
|
43
45
|
const { bpPerPx = 0, stopToken, resolution = 1, statusCallback = () => { }, } = opts;
|
|
44
46
|
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
45
|
-
statusCallback('Downloading bigwig data');
|
|
46
47
|
const source = this.getConf('source');
|
|
47
48
|
const resolutionMultiplier = this.getConf('resolutionMultiplier');
|
|
48
49
|
const { bigwig } = await this.setup(opts);
|
|
49
|
-
const feats = await bigwig.getFeatures(refName, start, end, {
|
|
50
|
+
const feats = await (0, util_1.updateStatus)('Downloading bigwig data', statusCallback, () => bigwig.getFeatures(refName, start, end, {
|
|
50
51
|
...opts,
|
|
51
52
|
basesPerSpan: (bpPerPx / resolution) * resolutionMultiplier,
|
|
52
|
-
});
|
|
53
|
+
}));
|
|
53
54
|
for (const data of feats) {
|
|
54
55
|
if (source) {
|
|
55
56
|
data.source = source;
|
|
@@ -67,7 +68,9 @@ class BigWigAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
67
68
|
}, stopToken);
|
|
68
69
|
}
|
|
69
70
|
async getMultiRegionFeatureDensityStats(_regions) {
|
|
70
|
-
return {
|
|
71
|
+
return {
|
|
72
|
+
featureDensity: 0,
|
|
73
|
+
};
|
|
71
74
|
}
|
|
72
75
|
freeResources() { }
|
|
73
76
|
}
|
|
@@ -3,16 +3,19 @@ declare const configSchema: import("@jbrowse/core/configuration/configurationSch
|
|
|
3
3
|
type: string;
|
|
4
4
|
description: string;
|
|
5
5
|
defaultValue: string;
|
|
6
|
+
contextVariable: string[];
|
|
6
7
|
};
|
|
7
8
|
posColor: {
|
|
8
9
|
type: string;
|
|
9
10
|
description: string;
|
|
10
11
|
defaultValue: string;
|
|
12
|
+
contextVariable: string[];
|
|
11
13
|
};
|
|
12
14
|
negColor: {
|
|
13
15
|
type: string;
|
|
14
16
|
description: string;
|
|
15
17
|
defaultValue: string;
|
|
18
|
+
contextVariable: string[];
|
|
16
19
|
};
|
|
17
20
|
clipColor: {
|
|
18
21
|
type: string;
|
|
@@ -9,16 +9,19 @@ declare const configSchema: import("@jbrowse/core/configuration/configurationSch
|
|
|
9
9
|
type: string;
|
|
10
10
|
description: string;
|
|
11
11
|
defaultValue: string;
|
|
12
|
+
contextVariable: string[];
|
|
12
13
|
};
|
|
13
14
|
posColor: {
|
|
14
15
|
type: string;
|
|
15
16
|
description: string;
|
|
16
17
|
defaultValue: string;
|
|
18
|
+
contextVariable: string[];
|
|
17
19
|
};
|
|
18
20
|
negColor: {
|
|
19
21
|
type: string;
|
|
20
22
|
description: string;
|
|
21
23
|
defaultValue: string;
|
|
24
|
+
contextVariable: string[];
|
|
22
25
|
};
|
|
23
26
|
clipColor: {
|
|
24
27
|
type: string;
|
|
@@ -9,18 +9,17 @@ const util_1 = require("@jbrowse/core/util");
|
|
|
9
9
|
const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
|
|
10
10
|
const mobx_react_1 = require("mobx-react");
|
|
11
11
|
const YScaleBar_1 = __importDefault(require("../../shared/YScaleBar"));
|
|
12
|
-
const LinearWiggleDisplay = (0, mobx_react_1.observer)((props)
|
|
12
|
+
const LinearWiggleDisplay = (0, mobx_react_1.observer)(function (props) {
|
|
13
13
|
const { model } = props;
|
|
14
|
-
const { stats, height,
|
|
14
|
+
const { stats, height, graphType } = model;
|
|
15
15
|
const { trackLabels } = (0, util_1.getContainingView)(model);
|
|
16
16
|
const track = (0, util_1.getContainingTrack)(model);
|
|
17
|
-
|
|
18
|
-
? (0, util_1.measureText)((0, configuration_1.getConf)(track, 'name'), 12.8) + 100
|
|
19
|
-
: 50;
|
|
20
|
-
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(plugin_linear_genome_view_1.BaseLinearDisplayComponent, { ...props }), stats && needsScalebar ? ((0, jsx_runtime_1.jsx)("svg", { style: {
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(plugin_linear_genome_view_1.BaseLinearDisplayComponent, { ...props }), stats && graphType ? ((0, jsx_runtime_1.jsx)("svg", { style: {
|
|
21
18
|
position: 'absolute',
|
|
22
19
|
top: 0,
|
|
23
|
-
left
|
|
20
|
+
left: trackLabels === 'overlapping'
|
|
21
|
+
? (0, util_1.measureText)((0, configuration_1.getConf)(track, 'name'), 12.8) + 100
|
|
22
|
+
: 50,
|
|
24
23
|
pointerEvents: 'none',
|
|
25
24
|
height,
|
|
26
25
|
width: 50,
|
|
@@ -99,6 +99,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
99
99
|
configuration: AnyConfigurationSchemaType;
|
|
100
100
|
} & {
|
|
101
101
|
type: import("mobx-state-tree").ISimpleType<"LinearWiggleDisplay">;
|
|
102
|
+
invertedSetting: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<boolean>>;
|
|
102
103
|
}, {
|
|
103
104
|
rendererTypeName: string;
|
|
104
105
|
error: unknown;
|
|
@@ -320,10 +321,14 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
320
321
|
})[];
|
|
321
322
|
} & {
|
|
322
323
|
reload(): Promise<void>;
|
|
324
|
+
} & {
|
|
325
|
+
setInverted(arg: boolean): void;
|
|
323
326
|
} & {
|
|
324
327
|
readonly TooltipComponent: AnyReactComponentType;
|
|
325
328
|
readonly rendererTypeName: string;
|
|
326
329
|
readonly quantitativeStatsRelevantToCurrentZoom: boolean;
|
|
330
|
+
readonly graphType: boolean;
|
|
331
|
+
readonly inverted: any;
|
|
327
332
|
} & {
|
|
328
333
|
adapterProps(): any;
|
|
329
334
|
readonly ticks: {
|
|
@@ -334,18 +339,10 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
334
339
|
} | undefined;
|
|
335
340
|
} & {
|
|
336
341
|
renderProps(): any;
|
|
337
|
-
readonly needsScalebar: boolean;
|
|
338
342
|
readonly fillSetting: 2 | 1 | 0;
|
|
339
343
|
readonly quantitativeStatsReady: boolean;
|
|
340
344
|
} & {
|
|
341
345
|
trackMenuItems(): (import("@jbrowse/core/ui").MenuDivider | import("@jbrowse/core/ui").MenuSubHeader | import("@jbrowse/core/ui").NormalMenuItem | import("@jbrowse/core/ui").CheckboxMenuItem | import("@jbrowse/core/ui").RadioMenuItem | import("@jbrowse/core/ui").SubMenuItem | {
|
|
342
|
-
type: string;
|
|
343
|
-
label?: undefined;
|
|
344
|
-
icon?: undefined;
|
|
345
|
-
subMenu?: undefined;
|
|
346
|
-
onClick?: undefined;
|
|
347
|
-
checked?: undefined;
|
|
348
|
-
} | {
|
|
349
346
|
label: string;
|
|
350
347
|
icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
351
348
|
muiName: string;
|
|
@@ -372,8 +369,15 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
372
369
|
subMenu?: undefined;
|
|
373
370
|
})[];
|
|
374
371
|
type?: undefined;
|
|
375
|
-
onClick?: undefined;
|
|
376
372
|
checked?: undefined;
|
|
373
|
+
onClick?: undefined;
|
|
374
|
+
} | {
|
|
375
|
+
label: string;
|
|
376
|
+
type: string;
|
|
377
|
+
checked: any;
|
|
378
|
+
onClick: () => void;
|
|
379
|
+
icon?: undefined;
|
|
380
|
+
subMenu?: undefined;
|
|
377
381
|
} | {
|
|
378
382
|
label: string;
|
|
379
383
|
subMenu: {
|
|
@@ -382,18 +386,18 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
382
386
|
checked: boolean;
|
|
383
387
|
onClick: () => void;
|
|
384
388
|
}[];
|
|
385
|
-
type?: undefined;
|
|
386
389
|
icon?: undefined;
|
|
387
|
-
|
|
390
|
+
type?: undefined;
|
|
388
391
|
checked?: undefined;
|
|
392
|
+
onClick?: undefined;
|
|
389
393
|
} | {
|
|
390
394
|
label: string;
|
|
391
395
|
icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
392
396
|
muiName: string;
|
|
393
397
|
};
|
|
394
398
|
onClick: () => void;
|
|
395
|
-
type?: undefined;
|
|
396
399
|
subMenu?: undefined;
|
|
400
|
+
type?: undefined;
|
|
397
401
|
checked?: undefined;
|
|
398
402
|
} | {
|
|
399
403
|
type: string;
|
|
@@ -57,6 +57,12 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
57
57
|
return mobx_state_tree_1.types
|
|
58
58
|
.compose('LinearWiggleDisplay', (0, SharedWiggleMixin_1.default)(configSchema), mobx_state_tree_1.types.model({
|
|
59
59
|
type: mobx_state_tree_1.types.literal('LinearWiggleDisplay'),
|
|
60
|
+
invertedSetting: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.boolean),
|
|
61
|
+
}))
|
|
62
|
+
.actions(self => ({
|
|
63
|
+
setInverted(arg) {
|
|
64
|
+
self.invertedSetting = arg;
|
|
65
|
+
},
|
|
60
66
|
}))
|
|
61
67
|
.views(self => ({
|
|
62
68
|
get TooltipComponent() {
|
|
@@ -75,6 +81,14 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
75
81
|
const view = (0, util_1.getContainingView)(self);
|
|
76
82
|
return ((_a = self.stats) === null || _a === void 0 ? void 0 : _a.currStatsBpPerPx) === view.bpPerPx;
|
|
77
83
|
},
|
|
84
|
+
get graphType() {
|
|
85
|
+
return (self.rendererTypeName === 'XYPlotRenderer' ||
|
|
86
|
+
self.rendererTypeName === 'LinePlotRenderer');
|
|
87
|
+
},
|
|
88
|
+
get inverted() {
|
|
89
|
+
var _a;
|
|
90
|
+
return (_a = self.invertedSetting) !== null && _a !== void 0 ? _a : (0, configuration_1.getConf)(self, 'inverted');
|
|
91
|
+
},
|
|
78
92
|
}))
|
|
79
93
|
.views(self => {
|
|
80
94
|
const { renderProps: superRenderProps } = self;
|
|
@@ -94,9 +108,8 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
94
108
|
};
|
|
95
109
|
},
|
|
96
110
|
get ticks() {
|
|
97
|
-
const { scaleType, domain, height } = self;
|
|
111
|
+
const { inverted, scaleType, domain, height } = self;
|
|
98
112
|
const minimalTicks = (0, configuration_1.getConf)(self, 'minimalTicks');
|
|
99
|
-
const inverted = (0, configuration_1.getConf)(self, 'inverted');
|
|
100
113
|
if (domain) {
|
|
101
114
|
const ticks = (0, react_d3_axis_mod_1.axisPropsFromTickScale)((0, util_2.getScale)({
|
|
102
115
|
scaleType,
|
|
@@ -119,19 +132,16 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
119
132
|
})
|
|
120
133
|
.views(self => ({
|
|
121
134
|
renderProps() {
|
|
122
|
-
const { ticks, height } = self;
|
|
135
|
+
const { inverted, ticks, height } = self;
|
|
123
136
|
const superProps = self.adapterProps();
|
|
124
137
|
return {
|
|
125
138
|
...self.adapterProps(),
|
|
126
139
|
notReady: superProps.notReady || !self.stats,
|
|
127
140
|
height,
|
|
128
141
|
ticks,
|
|
142
|
+
inverted,
|
|
129
143
|
};
|
|
130
144
|
},
|
|
131
|
-
get needsScalebar() {
|
|
132
|
-
return (self.rendererTypeName === 'XYPlotRenderer' ||
|
|
133
|
-
self.rendererTypeName === 'LinePlotRenderer');
|
|
134
|
-
},
|
|
135
145
|
get fillSetting() {
|
|
136
146
|
if (self.filled) {
|
|
137
147
|
return 0;
|
|
@@ -155,12 +165,23 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
155
165
|
trackMenuItems() {
|
|
156
166
|
return [
|
|
157
167
|
...superTrackMenuItems(),
|
|
158
|
-
{ type: 'divider' },
|
|
159
168
|
{
|
|
160
169
|
label: 'Score',
|
|
161
170
|
icon: Equalizer_1.default,
|
|
162
171
|
subMenu: self.scoreTrackMenuItems(),
|
|
163
172
|
},
|
|
173
|
+
...(self.graphType
|
|
174
|
+
? [
|
|
175
|
+
{
|
|
176
|
+
label: 'Inverted',
|
|
177
|
+
type: 'checkbox',
|
|
178
|
+
checked: self.inverted,
|
|
179
|
+
onClick: () => {
|
|
180
|
+
self.setInverted(!self.inverted);
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
]
|
|
184
|
+
: []),
|
|
164
185
|
...(self.canHaveFill
|
|
165
186
|
? [
|
|
166
187
|
{
|
|
@@ -204,7 +225,7 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
204
225
|
]);
|
|
205
226
|
},
|
|
206
227
|
},
|
|
207
|
-
...(self.
|
|
228
|
+
...(self.graphType
|
|
208
229
|
? [
|
|
209
230
|
{
|
|
210
231
|
type: 'checkbox',
|
|
@@ -10,7 +10,7 @@ const mobx_1 = require("mobx");
|
|
|
10
10
|
const YScaleBar_1 = __importDefault(require("../shared/YScaleBar"));
|
|
11
11
|
async function renderSvg(self, opts, superRenderSvg) {
|
|
12
12
|
await (0, mobx_1.when)(() => !!self.stats && !!self.regionCannotBeRenderedText);
|
|
13
|
-
const {
|
|
13
|
+
const { graphType, stats } = self;
|
|
14
14
|
const { offsetPx } = (0, util_1.getContainingView)(self);
|
|
15
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("g", { children: await superRenderSvg(opts) }),
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("g", { children: await superRenderSvg(opts) }), graphType && stats ? ((0, jsx_runtime_1.jsx)("g", { transform: `translate(${Math.max(-offsetPx, 0)})`, children: (0, jsx_runtime_1.jsx)(YScaleBar_1.default, { model: self, orientation: "left" }) })) : null] }));
|
|
16
16
|
}
|
|
@@ -3,16 +3,19 @@ declare const configSchema: import("@jbrowse/core/configuration/configurationSch
|
|
|
3
3
|
type: string;
|
|
4
4
|
description: string;
|
|
5
5
|
defaultValue: string;
|
|
6
|
+
contextVariable: string[];
|
|
6
7
|
};
|
|
7
8
|
posColor: {
|
|
8
9
|
type: string;
|
|
9
10
|
description: string;
|
|
10
11
|
defaultValue: string;
|
|
12
|
+
contextVariable: string[];
|
|
11
13
|
};
|
|
12
14
|
negColor: {
|
|
13
15
|
type: string;
|
|
14
16
|
description: string;
|
|
15
17
|
defaultValue: string;
|
|
18
|
+
contextVariable: string[];
|
|
16
19
|
};
|
|
17
20
|
clipColor: {
|
|
18
21
|
type: string;
|
|
@@ -15,16 +15,19 @@ declare const configSchema: import("@jbrowse/core/configuration/configurationSch
|
|
|
15
15
|
type: string;
|
|
16
16
|
description: string;
|
|
17
17
|
defaultValue: string;
|
|
18
|
+
contextVariable: string[];
|
|
18
19
|
};
|
|
19
20
|
posColor: {
|
|
20
21
|
type: string;
|
|
21
22
|
description: string;
|
|
22
23
|
defaultValue: string;
|
|
24
|
+
contextVariable: string[];
|
|
23
25
|
};
|
|
24
26
|
negColor: {
|
|
25
27
|
type: string;
|
|
26
28
|
description: string;
|
|
27
29
|
defaultValue: string;
|
|
30
|
+
contextVariable: string[];
|
|
28
31
|
};
|
|
29
32
|
clipColor: {
|
|
30
33
|
type: string;
|
|
@@ -8,11 +8,11 @@ const mobx_react_1 = require("mobx-react");
|
|
|
8
8
|
const LegendItem_1 = __importDefault(require("./LegendItem"));
|
|
9
9
|
const RectBg_1 = __importDefault(require("./RectBg"));
|
|
10
10
|
const ColorLegend = (0, mobx_react_1.observer)(function ({ model, rowHeight, exportSVG, }) {
|
|
11
|
-
const {
|
|
11
|
+
const { graphType, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, sources, labelWidth, } = model;
|
|
12
12
|
const colorBoxWidth = renderColorBoxes ? 15 : 0;
|
|
13
13
|
const legendWidth = labelWidth + colorBoxWidth + 5;
|
|
14
14
|
const svgOffset = exportSVG ? 10 : 0;
|
|
15
|
-
const extraOffset = svgOffset || (
|
|
15
|
+
const extraOffset = svgOffset || (graphType && !rowHeightTooSmallForScalebar ? 50 : 0);
|
|
16
16
|
return sources ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [needsFullHeightScalebar ? ((0, jsx_runtime_1.jsx)(RectBg_1.default, { y: 0, x: extraOffset, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null, sources.map((source, idx) => ((0, jsx_runtime_1.jsx)(LegendItem_1.default, { source: source, idx: idx, model: model, rowHeight: rowHeight, exportSVG: exportSVG, labelWidth: labelWidth }, `${source.name}-${idx}`)))] })) : null;
|
|
17
17
|
});
|
|
18
18
|
exports.default = ColorLegend;
|
|
@@ -7,13 +7,13 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const RectBg_1 = __importDefault(require("./RectBg"));
|
|
8
8
|
const LegendItem = function ({ source, idx, rowHeight, labelWidth, model, exportSVG, }) {
|
|
9
9
|
const boxHeight = Math.min(20, rowHeight);
|
|
10
|
-
const { needsCustomLegend,
|
|
10
|
+
const { needsCustomLegend, graphType, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, } = model;
|
|
11
11
|
const svgFontSize = Math.min(rowHeight, 12);
|
|
12
12
|
const canDisplayLabel = rowHeight > 11;
|
|
13
13
|
const colorBoxWidth = renderColorBoxes ? 15 : 0;
|
|
14
14
|
const legendWidth = labelWidth + colorBoxWidth + 5;
|
|
15
15
|
const svgOffset = exportSVG ? 10 : 0;
|
|
16
|
-
const extraOffset = svgOffset || (
|
|
16
|
+
const extraOffset = svgOffset || (graphType && !rowHeightTooSmallForScalebar ? 50 : 0);
|
|
17
17
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [needsFullHeightScalebar ? null : ((0, jsx_runtime_1.jsx)(RectBg_1.default, { y: idx * rowHeight + 1, x: extraOffset, width: legendWidth, height: boxHeight })), source.color ? ((0, jsx_runtime_1.jsx)(RectBg_1.default, { y: idx * rowHeight + 1, x: extraOffset, width: colorBoxWidth, height: needsCustomLegend ? rowHeight : boxHeight, color: source.color })) : null, canDisplayLabel ? ((0, jsx_runtime_1.jsx)("text", { y: idx * rowHeight + 13, x: extraOffset + colorBoxWidth + 2, fontSize: svgFontSize, children: source.name })) : null] }));
|
|
18
18
|
};
|
|
19
19
|
exports.default = LegendItem;
|
|
@@ -337,7 +337,7 @@ export declare function stateModelFactory(_pluginManager: PluginManager, configS
|
|
|
337
337
|
readonly TooltipComponent: AnyReactComponentType;
|
|
338
338
|
readonly rendererTypeName: string;
|
|
339
339
|
} & {
|
|
340
|
-
readonly
|
|
340
|
+
readonly graphType: boolean;
|
|
341
341
|
readonly needsFullHeightScalebar: boolean;
|
|
342
342
|
readonly isMultiRow: boolean;
|
|
343
343
|
readonly needsCustomLegend: boolean;
|
|
@@ -107,7 +107,7 @@ function stateModelFactory(_pluginManager, configSchema) {
|
|
|
107
107
|
},
|
|
108
108
|
}))
|
|
109
109
|
.views(self => ({
|
|
110
|
-
get
|
|
110
|
+
get graphType() {
|
|
111
111
|
return (self.rendererTypeName === 'MultiXYPlotRenderer' ||
|
|
112
112
|
self.rendererTypeName === 'MultiRowXYPlotRenderer' ||
|
|
113
113
|
self.rendererTypeName === 'MultiLineRenderer' ||
|
|
@@ -293,7 +293,7 @@ function stateModelFactory(_pluginManager, configSchema) {
|
|
|
293
293
|
},
|
|
294
294
|
]
|
|
295
295
|
: []),
|
|
296
|
-
...(self.
|
|
296
|
+
...(self.graphType
|
|
297
297
|
? [
|
|
298
298
|
{
|
|
299
299
|
type: 'checkbox',
|
|
@@ -15,16 +15,19 @@ declare const configSchema: import("@jbrowse/core/configuration/configurationSch
|
|
|
15
15
|
type: string;
|
|
16
16
|
description: string;
|
|
17
17
|
defaultValue: string;
|
|
18
|
+
contextVariable: string[];
|
|
18
19
|
};
|
|
19
20
|
posColor: {
|
|
20
21
|
type: string;
|
|
21
22
|
description: string;
|
|
22
23
|
defaultValue: string;
|
|
24
|
+
contextVariable: string[];
|
|
23
25
|
};
|
|
24
26
|
negColor: {
|
|
25
27
|
type: string;
|
|
26
28
|
description: string;
|
|
27
29
|
defaultValue: string;
|
|
30
|
+
contextVariable: string[];
|
|
28
31
|
};
|
|
29
32
|
clipColor: {
|
|
30
33
|
type: string;
|
|
@@ -23,16 +23,19 @@ declare const configSchema: import("@jbrowse/core/configuration/configurationSch
|
|
|
23
23
|
type: string;
|
|
24
24
|
description: string;
|
|
25
25
|
defaultValue: string;
|
|
26
|
+
contextVariable: string[];
|
|
26
27
|
};
|
|
27
28
|
posColor: {
|
|
28
29
|
type: string;
|
|
29
30
|
description: string;
|
|
30
31
|
defaultValue: string;
|
|
32
|
+
contextVariable: string[];
|
|
31
33
|
};
|
|
32
34
|
negColor: {
|
|
33
35
|
type: string;
|
|
34
36
|
description: string;
|
|
35
37
|
defaultValue: string;
|
|
38
|
+
contextVariable: string[];
|
|
36
39
|
};
|
|
37
40
|
clipColor: {
|
|
38
41
|
type: string;
|
|
@@ -23,16 +23,19 @@ declare const configSchema: import("@jbrowse/core/configuration/configurationSch
|
|
|
23
23
|
type: string;
|
|
24
24
|
description: string;
|
|
25
25
|
defaultValue: string;
|
|
26
|
+
contextVariable: string[];
|
|
26
27
|
};
|
|
27
28
|
posColor: {
|
|
28
29
|
type: string;
|
|
29
30
|
description: string;
|
|
30
31
|
defaultValue: string;
|
|
32
|
+
contextVariable: string[];
|
|
31
33
|
};
|
|
32
34
|
negColor: {
|
|
33
35
|
type: string;
|
|
34
36
|
description: string;
|
|
35
37
|
defaultValue: string;
|
|
38
|
+
contextVariable: string[];
|
|
36
39
|
};
|
|
37
40
|
clipColor: {
|
|
38
41
|
type: string;
|
|
@@ -15,10 +15,12 @@ export interface RenderArgsDeserialized extends FeatureRenderArgsDeserialized {
|
|
|
15
15
|
ticks: {
|
|
16
16
|
values: number[];
|
|
17
17
|
};
|
|
18
|
+
inverted: boolean;
|
|
18
19
|
themeOptions: ThemeOptions;
|
|
19
20
|
}
|
|
20
21
|
export interface RenderArgsDeserializedWithFeatures extends RenderArgsDeserialized {
|
|
21
22
|
features: Map<string, Feature>;
|
|
23
|
+
inverted: boolean;
|
|
22
24
|
}
|
|
23
25
|
export interface MultiRenderArgsDeserialized extends RenderArgsDeserializedWithFeatures {
|
|
24
26
|
sources: Source[];
|
|
@@ -12,12 +12,13 @@ class WiggleBaseRenderer extends FeatureRendererType_1.default {
|
|
|
12
12
|
}
|
|
13
13
|
async render(renderProps) {
|
|
14
14
|
const features = await this.getFeatures(renderProps);
|
|
15
|
-
const { height, regions, bpPerPx } = renderProps;
|
|
15
|
+
const { inverted, height, regions, bpPerPx } = renderProps;
|
|
16
16
|
const region = regions[0];
|
|
17
17
|
const width = (region.end - region.start) / bpPerPx;
|
|
18
18
|
const { reducedFeatures, ...rest } = await (0, util_1.renderToAbstractCanvas)(width, height, renderProps, ctx => this.draw(ctx, {
|
|
19
19
|
...renderProps,
|
|
20
20
|
features,
|
|
21
|
+
inverted,
|
|
21
22
|
}));
|
|
22
23
|
const results = await super.render({
|
|
23
24
|
...renderProps,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import WiggleBaseRenderer from '../WiggleBaseRenderer';
|
|
2
2
|
import type { RenderArgsDeserializedWithFeatures } from '../WiggleBaseRenderer';
|
|
3
|
-
import type { Feature } from '@jbrowse/core/util';
|
|
4
3
|
export default class XYPlotRenderer extends WiggleBaseRenderer {
|
|
5
4
|
draw(ctx: CanvasRenderingContext2D, props: RenderArgsDeserializedWithFeatures): Promise<{
|
|
6
|
-
reducedFeatures: Feature[];
|
|
5
|
+
reducedFeatures: import("@jbrowse/core/util").Feature[];
|
|
7
6
|
}>;
|
|
8
7
|
}
|
|
@@ -41,18 +41,19 @@ const WiggleBaseRenderer_1 = __importDefault(require("../WiggleBaseRenderer"));
|
|
|
41
41
|
const util_1 = require("../util");
|
|
42
42
|
class XYPlotRenderer extends WiggleBaseRenderer_1.default {
|
|
43
43
|
async draw(ctx, props) {
|
|
44
|
-
const { stopToken, features, config } = props;
|
|
44
|
+
const { inverted, stopToken, features, config } = props;
|
|
45
45
|
const { drawXY } = await Promise.resolve().then(() => __importStar(require('../drawXY')));
|
|
46
46
|
const pivotValue = (0, configuration_1.readConfObject)(config, 'bicolorPivotValue');
|
|
47
47
|
const negColor = (0, configuration_1.readConfObject)(config, 'negColor');
|
|
48
48
|
const posColor = (0, configuration_1.readConfObject)(config, 'posColor');
|
|
49
49
|
return drawXY(ctx, {
|
|
50
50
|
...props,
|
|
51
|
-
colorCallback:
|
|
52
|
-
? (
|
|
51
|
+
colorCallback: !config.color.isCallback
|
|
52
|
+
? (_feature, score) => (score < pivotValue ? negColor : posColor)
|
|
53
53
|
: (feature, _score) => (0, configuration_1.readConfObject)(config, 'color', { feature }),
|
|
54
54
|
offset: util_1.YSCALEBAR_LABEL_OFFSET,
|
|
55
55
|
features: [...features.values()],
|
|
56
|
+
inverted,
|
|
56
57
|
stopToken,
|
|
57
58
|
});
|
|
58
59
|
}
|
|
@@ -23,16 +23,19 @@ declare const configSchema: import("@jbrowse/core/configuration/configurationSch
|
|
|
23
23
|
type: string;
|
|
24
24
|
description: string;
|
|
25
25
|
defaultValue: string;
|
|
26
|
+
contextVariable: string[];
|
|
26
27
|
};
|
|
27
28
|
posColor: {
|
|
28
29
|
type: string;
|
|
29
30
|
description: string;
|
|
30
31
|
defaultValue: string;
|
|
32
|
+
contextVariable: string[];
|
|
31
33
|
};
|
|
32
34
|
negColor: {
|
|
33
35
|
type: string;
|
|
34
36
|
description: string;
|
|
35
37
|
defaultValue: string;
|
|
38
|
+
contextVariable: string[];
|
|
36
39
|
};
|
|
37
40
|
clipColor: {
|
|
38
41
|
type: string;
|
package/dist/configSchema.d.ts
CHANGED
|
@@ -3,16 +3,19 @@ declare const WiggleRenderer: import("@jbrowse/core/configuration/configurationS
|
|
|
3
3
|
type: string;
|
|
4
4
|
description: string;
|
|
5
5
|
defaultValue: string;
|
|
6
|
+
contextVariable: string[];
|
|
6
7
|
};
|
|
7
8
|
posColor: {
|
|
8
9
|
type: string;
|
|
9
10
|
description: string;
|
|
10
11
|
defaultValue: string;
|
|
12
|
+
contextVariable: string[];
|
|
11
13
|
};
|
|
12
14
|
negColor: {
|
|
13
15
|
type: string;
|
|
14
16
|
description: string;
|
|
15
17
|
defaultValue: string;
|
|
18
|
+
contextVariable: string[];
|
|
16
19
|
};
|
|
17
20
|
clipColor: {
|
|
18
21
|
type: string;
|
package/dist/configSchema.js
CHANGED
|
@@ -8,16 +8,19 @@ const WiggleRenderer = (0, configuration_1.ConfigurationSchema)('WiggleRenderer'
|
|
|
8
8
|
type: 'color',
|
|
9
9
|
description: 'the color of track, overrides posColor and negColor',
|
|
10
10
|
defaultValue: '#f0f',
|
|
11
|
+
contextVariable: ['feature'],
|
|
11
12
|
},
|
|
12
13
|
posColor: {
|
|
13
14
|
type: 'color',
|
|
14
15
|
description: 'the color to use when the score is positive',
|
|
15
16
|
defaultValue: 'blue',
|
|
17
|
+
contextVariable: ['feature'],
|
|
16
18
|
},
|
|
17
19
|
negColor: {
|
|
18
20
|
type: 'color',
|
|
19
21
|
description: 'the color to use when the score is negative',
|
|
20
22
|
defaultValue: 'red',
|
|
23
|
+
contextVariable: ['feature'],
|
|
21
24
|
},
|
|
22
25
|
clipColor: {
|
|
23
26
|
type: 'color',
|
package/dist/drawXY.d.ts
CHANGED
package/dist/drawXY.js
CHANGED
|
@@ -19,7 +19,7 @@ function darken(color, amount) {
|
|
|
19
19
|
const fudgeFactor = 0.3;
|
|
20
20
|
const clipHeight = 2;
|
|
21
21
|
function drawXY(ctx, props) {
|
|
22
|
-
const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback, } = props;
|
|
22
|
+
const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback, inverted, } = props;
|
|
23
23
|
const region = regions[0];
|
|
24
24
|
const width = (region.end - region.start) / bpPerPx;
|
|
25
25
|
const height = unadjustedHeight - offset * 2;
|
|
@@ -28,7 +28,7 @@ function drawXY(ctx, props) {
|
|
|
28
28
|
const summaryScoreMode = (0, configuration_1.readConfObject)(config, 'summaryScoreMode');
|
|
29
29
|
const pivotValue = (0, configuration_1.readConfObject)(config, 'bicolorPivotValue');
|
|
30
30
|
const minSize = (0, configuration_1.readConfObject)(config, 'minSize');
|
|
31
|
-
const scale = (0, util_2.getScale)({ ...scaleOpts, range: [0, height] });
|
|
31
|
+
const scale = (0, util_2.getScale)({ ...scaleOpts, range: [0, height], inverted });
|
|
32
32
|
const originY = (0, util_2.getOrigin)(scaleOpts.scaleType);
|
|
33
33
|
const domain = scale.domain();
|
|
34
34
|
const niceMin = domain[0];
|
package/dist/index.d.ts
CHANGED
|
@@ -50,16 +50,19 @@ export default class WigglePlugin extends Plugin {
|
|
|
50
50
|
type: string;
|
|
51
51
|
description: string;
|
|
52
52
|
defaultValue: string;
|
|
53
|
+
contextVariable: string[];
|
|
53
54
|
};
|
|
54
55
|
posColor: {
|
|
55
56
|
type: string;
|
|
56
57
|
description: string;
|
|
57
58
|
defaultValue: string;
|
|
59
|
+
contextVariable: string[];
|
|
58
60
|
};
|
|
59
61
|
negColor: {
|
|
60
62
|
type: string;
|
|
61
63
|
description: string;
|
|
62
64
|
defaultValue: string;
|
|
65
|
+
contextVariable: string[];
|
|
63
66
|
};
|
|
64
67
|
clipColor: {
|
|
65
68
|
type: string;
|