@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.
Files changed (53) hide show
  1. package/dist/BigWigAdapter/BigWigAdapter.js +11 -8
  2. package/dist/DensityRenderer/configSchema.d.ts +3 -0
  3. package/dist/LinePlotRenderer/configSchema.d.ts +3 -0
  4. package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.js +6 -7
  5. package/dist/LinearWiggleDisplay/model.d.ts +16 -12
  6. package/dist/LinearWiggleDisplay/model.js +30 -9
  7. package/dist/LinearWiggleDisplay/renderSvg.js +2 -2
  8. package/dist/MultiDensityRenderer/configSchema.d.ts +3 -0
  9. package/dist/MultiLineRenderer/configSchema.d.ts +3 -0
  10. package/dist/MultiLinearWiggleDisplay/components/ColorLegend.js +2 -2
  11. package/dist/MultiLinearWiggleDisplay/components/LegendItem.js +2 -2
  12. package/dist/MultiLinearWiggleDisplay/model.d.ts +1 -1
  13. package/dist/MultiLinearWiggleDisplay/model.js +2 -2
  14. package/dist/MultiRowLineRenderer/configSchema.d.ts +3 -0
  15. package/dist/MultiRowXYPlotRenderer/configSchema.d.ts +3 -0
  16. package/dist/MultiXYPlotRenderer/configSchema.d.ts +3 -0
  17. package/dist/WiggleBaseRenderer.d.ts +2 -0
  18. package/dist/WiggleBaseRenderer.js +2 -1
  19. package/dist/XYPlotRenderer/XYPlotRenderer.d.ts +1 -2
  20. package/dist/XYPlotRenderer/XYPlotRenderer.js +4 -3
  21. package/dist/XYPlotRenderer/configSchema.d.ts +3 -0
  22. package/dist/configSchema.d.ts +3 -0
  23. package/dist/configSchema.js +3 -0
  24. package/dist/drawXY.d.ts +1 -0
  25. package/dist/drawXY.js +2 -2
  26. package/dist/index.d.ts +3 -0
  27. package/esm/BigWigAdapter/BigWigAdapter.js +11 -8
  28. package/esm/DensityRenderer/configSchema.d.ts +3 -0
  29. package/esm/LinePlotRenderer/configSchema.d.ts +3 -0
  30. package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.js +6 -7
  31. package/esm/LinearWiggleDisplay/model.d.ts +16 -12
  32. package/esm/LinearWiggleDisplay/model.js +30 -9
  33. package/esm/LinearWiggleDisplay/renderSvg.js +2 -2
  34. package/esm/MultiDensityRenderer/configSchema.d.ts +3 -0
  35. package/esm/MultiLineRenderer/configSchema.d.ts +3 -0
  36. package/esm/MultiLinearWiggleDisplay/components/ColorLegend.js +2 -2
  37. package/esm/MultiLinearWiggleDisplay/components/LegendItem.js +2 -2
  38. package/esm/MultiLinearWiggleDisplay/model.d.ts +1 -1
  39. package/esm/MultiLinearWiggleDisplay/model.js +2 -2
  40. package/esm/MultiRowLineRenderer/configSchema.d.ts +3 -0
  41. package/esm/MultiRowXYPlotRenderer/configSchema.d.ts +3 -0
  42. package/esm/MultiXYPlotRenderer/configSchema.d.ts +3 -0
  43. package/esm/WiggleBaseRenderer.d.ts +2 -0
  44. package/esm/WiggleBaseRenderer.js +2 -1
  45. package/esm/XYPlotRenderer/XYPlotRenderer.d.ts +1 -2
  46. package/esm/XYPlotRenderer/XYPlotRenderer.js +4 -3
  47. package/esm/XYPlotRenderer/configSchema.d.ts +3 -0
  48. package/esm/configSchema.d.ts +3 -0
  49. package/esm/configSchema.js +3 -0
  50. package/esm/drawXY.d.ts +1 -0
  51. package/esm/drawXY.js +2 -2
  52. package/esm/index.d.ts +3 -0
  53. package/package.json +11 -11
@@ -7,12 +7,14 @@ import { rectifyStats } from '@jbrowse/core/util/stats';
7
7
  class BigWigAdapter extends BaseFeatureDataAdapter {
8
8
  async setupPre(opts) {
9
9
  const { statusCallback = () => { } } = opts || {};
10
- const pm = this.pluginManager;
10
+ const pluginManager = this.pluginManager;
11
11
  const bigwig = new BigWig({
12
- filehandle: openLocation(this.getConf('bigWigLocation'), pm),
12
+ filehandle: openLocation(this.getConf('bigWigLocation'), pluginManager),
13
13
  });
14
- const header = await updateStatus('Downloading bigwig header', statusCallback, () => bigwig.getHeader(opts));
15
- return { bigwig, header };
14
+ return {
15
+ bigwig,
16
+ header: await updateStatus('Downloading bigwig header', statusCallback, () => bigwig.getHeader(opts)),
17
+ };
16
18
  }
17
19
  async setup(opts) {
18
20
  if (!this.setupP) {
@@ -40,14 +42,13 @@ class BigWigAdapter extends BaseFeatureDataAdapter {
40
42
  const { refName, start, end } = region;
41
43
  const { bpPerPx = 0, stopToken, resolution = 1, statusCallback = () => { }, } = opts;
42
44
  return ObservableCreate(async (observer) => {
43
- statusCallback('Downloading bigwig data');
44
45
  const source = this.getConf('source');
45
46
  const resolutionMultiplier = this.getConf('resolutionMultiplier');
46
47
  const { bigwig } = await this.setup(opts);
47
- const feats = await bigwig.getFeatures(refName, start, end, {
48
+ const feats = await updateStatus('Downloading bigwig data', statusCallback, () => bigwig.getFeatures(refName, start, end, {
48
49
  ...opts,
49
50
  basesPerSpan: (bpPerPx / resolution) * resolutionMultiplier,
50
- });
51
+ }));
51
52
  for (const data of feats) {
52
53
  if (source) {
53
54
  data.source = source;
@@ -65,7 +66,9 @@ class BigWigAdapter extends BaseFeatureDataAdapter {
65
66
  }, stopToken);
66
67
  }
67
68
  async getMultiRegionFeatureDensityStats(_regions) {
68
- return { featureDensity: 0 };
69
+ return {
70
+ featureDensity: 0,
71
+ };
69
72
  }
70
73
  freeResources() { }
71
74
  }
@@ -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;
@@ -4,18 +4,17 @@ import { getContainingTrack, getContainingView, measureText, } from '@jbrowse/co
4
4
  import { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
5
5
  import { observer } from 'mobx-react';
6
6
  import YScaleBar from '../../shared/YScaleBar';
7
- const LinearWiggleDisplay = observer((props) => {
7
+ const LinearWiggleDisplay = observer(function (props) {
8
8
  const { model } = props;
9
- const { stats, height, needsScalebar } = model;
9
+ const { stats, height, graphType } = model;
10
10
  const { trackLabels } = getContainingView(model);
11
11
  const track = getContainingTrack(model);
12
- const left = trackLabels === 'overlapping'
13
- ? measureText(getConf(track, 'name'), 12.8) + 100
14
- : 50;
15
- return (_jsxs("div", { children: [_jsx(BaseLinearDisplayComponent, { ...props }), stats && needsScalebar ? (_jsx("svg", { style: {
12
+ return (_jsxs("div", { children: [_jsx(BaseLinearDisplayComponent, { ...props }), stats && graphType ? (_jsx("svg", { style: {
16
13
  position: 'absolute',
17
14
  top: 0,
18
- left,
15
+ left: trackLabels === 'overlapping'
16
+ ? measureText(getConf(track, 'name'), 12.8) + 100
17
+ : 50,
19
18
  pointerEvents: 'none',
20
19
  height,
21
20
  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
- onClick?: undefined;
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;
@@ -19,6 +19,12 @@ function stateModelFactory(pluginManager, configSchema) {
19
19
  return types
20
20
  .compose('LinearWiggleDisplay', SharedWiggleMixin(configSchema), types.model({
21
21
  type: types.literal('LinearWiggleDisplay'),
22
+ invertedSetting: types.maybe(types.boolean),
23
+ }))
24
+ .actions(self => ({
25
+ setInverted(arg) {
26
+ self.invertedSetting = arg;
27
+ },
22
28
  }))
23
29
  .views(self => ({
24
30
  get TooltipComponent() {
@@ -37,6 +43,14 @@ function stateModelFactory(pluginManager, configSchema) {
37
43
  const view = getContainingView(self);
38
44
  return ((_a = self.stats) === null || _a === void 0 ? void 0 : _a.currStatsBpPerPx) === view.bpPerPx;
39
45
  },
46
+ get graphType() {
47
+ return (self.rendererTypeName === 'XYPlotRenderer' ||
48
+ self.rendererTypeName === 'LinePlotRenderer');
49
+ },
50
+ get inverted() {
51
+ var _a;
52
+ return (_a = self.invertedSetting) !== null && _a !== void 0 ? _a : getConf(self, 'inverted');
53
+ },
40
54
  }))
41
55
  .views(self => {
42
56
  const { renderProps: superRenderProps } = self;
@@ -56,9 +70,8 @@ function stateModelFactory(pluginManager, configSchema) {
56
70
  };
57
71
  },
58
72
  get ticks() {
59
- const { scaleType, domain, height } = self;
73
+ const { inverted, scaleType, domain, height } = self;
60
74
  const minimalTicks = getConf(self, 'minimalTicks');
61
- const inverted = getConf(self, 'inverted');
62
75
  if (domain) {
63
76
  const ticks = axisPropsFromTickScale(getScale({
64
77
  scaleType,
@@ -81,19 +94,16 @@ function stateModelFactory(pluginManager, configSchema) {
81
94
  })
82
95
  .views(self => ({
83
96
  renderProps() {
84
- const { ticks, height } = self;
97
+ const { inverted, ticks, height } = self;
85
98
  const superProps = self.adapterProps();
86
99
  return {
87
100
  ...self.adapterProps(),
88
101
  notReady: superProps.notReady || !self.stats,
89
102
  height,
90
103
  ticks,
104
+ inverted,
91
105
  };
92
106
  },
93
- get needsScalebar() {
94
- return (self.rendererTypeName === 'XYPlotRenderer' ||
95
- self.rendererTypeName === 'LinePlotRenderer');
96
- },
97
107
  get fillSetting() {
98
108
  if (self.filled) {
99
109
  return 0;
@@ -117,12 +127,23 @@ function stateModelFactory(pluginManager, configSchema) {
117
127
  trackMenuItems() {
118
128
  return [
119
129
  ...superTrackMenuItems(),
120
- { type: 'divider' },
121
130
  {
122
131
  label: 'Score',
123
132
  icon: EqualizerIcon,
124
133
  subMenu: self.scoreTrackMenuItems(),
125
134
  },
135
+ ...(self.graphType
136
+ ? [
137
+ {
138
+ label: 'Inverted',
139
+ type: 'checkbox',
140
+ checked: self.inverted,
141
+ onClick: () => {
142
+ self.setInverted(!self.inverted);
143
+ },
144
+ },
145
+ ]
146
+ : []),
126
147
  ...(self.canHaveFill
127
148
  ? [
128
149
  {
@@ -166,7 +187,7 @@ function stateModelFactory(pluginManager, configSchema) {
166
187
  ]);
167
188
  },
168
189
  },
169
- ...(self.needsScalebar
190
+ ...(self.graphType
170
191
  ? [
171
192
  {
172
193
  type: 'checkbox',
@@ -4,7 +4,7 @@ import { when } from 'mobx';
4
4
  import YScaleBar from '../shared/YScaleBar';
5
5
  export async function renderSvg(self, opts, superRenderSvg) {
6
6
  await when(() => !!self.stats && !!self.regionCannotBeRenderedText);
7
- const { needsScalebar, stats } = self;
7
+ const { graphType, stats } = self;
8
8
  const { offsetPx } = getContainingView(self);
9
- return (_jsxs(_Fragment, { children: [_jsx("g", { children: await superRenderSvg(opts) }), needsScalebar && stats ? (_jsx("g", { transform: `translate(${Math.max(-offsetPx, 0)})`, children: _jsx(YScaleBar, { model: self, orientation: "left" }) })) : null] }));
9
+ return (_jsxs(_Fragment, { children: [_jsx("g", { children: await superRenderSvg(opts) }), graphType && stats ? (_jsx("g", { transform: `translate(${Math.max(-offsetPx, 0)})`, children: _jsx(YScaleBar, { model: self, orientation: "left" }) })) : null] }));
10
10
  }
@@ -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;
@@ -3,11 +3,11 @@ import { observer } from 'mobx-react';
3
3
  import LegendItem from './LegendItem';
4
4
  import RectBg from './RectBg';
5
5
  const ColorLegend = observer(function ({ model, rowHeight, exportSVG, }) {
6
- const { needsScalebar, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, sources, labelWidth, } = model;
6
+ const { graphType, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, sources, labelWidth, } = model;
7
7
  const colorBoxWidth = renderColorBoxes ? 15 : 0;
8
8
  const legendWidth = labelWidth + colorBoxWidth + 5;
9
9
  const svgOffset = exportSVG ? 10 : 0;
10
- const extraOffset = svgOffset || (needsScalebar && !rowHeightTooSmallForScalebar ? 50 : 0);
10
+ const extraOffset = svgOffset || (graphType && !rowHeightTooSmallForScalebar ? 50 : 0);
11
11
  return sources ? (_jsxs(_Fragment, { children: [needsFullHeightScalebar ? (_jsx(RectBg, { y: 0, x: extraOffset, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null, sources.map((source, idx) => (_jsx(LegendItem, { source: source, idx: idx, model: model, rowHeight: rowHeight, exportSVG: exportSVG, labelWidth: labelWidth }, `${source.name}-${idx}`)))] })) : null;
12
12
  });
13
13
  export default ColorLegend;
@@ -2,13 +2,13 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import RectBg from './RectBg';
3
3
  const LegendItem = function ({ source, idx, rowHeight, labelWidth, model, exportSVG, }) {
4
4
  const boxHeight = Math.min(20, rowHeight);
5
- const { needsCustomLegend, needsScalebar, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, } = model;
5
+ const { needsCustomLegend, graphType, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, } = model;
6
6
  const svgFontSize = Math.min(rowHeight, 12);
7
7
  const canDisplayLabel = rowHeight > 11;
8
8
  const colorBoxWidth = renderColorBoxes ? 15 : 0;
9
9
  const legendWidth = labelWidth + colorBoxWidth + 5;
10
10
  const svgOffset = exportSVG ? 10 : 0;
11
- const extraOffset = svgOffset || (needsScalebar && !rowHeightTooSmallForScalebar ? 50 : 0);
11
+ const extraOffset = svgOffset || (graphType && !rowHeightTooSmallForScalebar ? 50 : 0);
12
12
  return (_jsxs(_Fragment, { children: [needsFullHeightScalebar ? null : (_jsx(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: legendWidth, height: boxHeight })), source.color ? (_jsx(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: colorBoxWidth, height: needsCustomLegend ? rowHeight : boxHeight, color: source.color })) : null, canDisplayLabel ? (_jsx("text", { y: idx * rowHeight + 13, x: extraOffset + colorBoxWidth + 2, fontSize: svgFontSize, children: source.name })) : null] }));
13
13
  };
14
14
  export 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 needsScalebar: boolean;
340
+ readonly graphType: boolean;
341
341
  readonly needsFullHeightScalebar: boolean;
342
342
  readonly isMultiRow: boolean;
343
343
  readonly needsCustomLegend: boolean;
@@ -68,7 +68,7 @@ export function stateModelFactory(_pluginManager, configSchema) {
68
68
  },
69
69
  }))
70
70
  .views(self => ({
71
- get needsScalebar() {
71
+ get graphType() {
72
72
  return (self.rendererTypeName === 'MultiXYPlotRenderer' ||
73
73
  self.rendererTypeName === 'MultiRowXYPlotRenderer' ||
74
74
  self.rendererTypeName === 'MultiLineRenderer' ||
@@ -254,7 +254,7 @@ export function stateModelFactory(_pluginManager, configSchema) {
254
254
  },
255
255
  ]
256
256
  : []),
257
- ...(self.needsScalebar
257
+ ...(self.graphType
258
258
  ? [
259
259
  {
260
260
  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[];
@@ -7,12 +7,13 @@ export default class WiggleBaseRenderer extends FeatureRendererType {
7
7
  }
8
8
  async render(renderProps) {
9
9
  const features = await this.getFeatures(renderProps);
10
- const { height, regions, bpPerPx } = renderProps;
10
+ const { inverted, height, regions, bpPerPx } = renderProps;
11
11
  const region = regions[0];
12
12
  const width = (region.end - region.start) / bpPerPx;
13
13
  const { reducedFeatures, ...rest } = await renderToAbstractCanvas(width, height, renderProps, ctx => this.draw(ctx, {
14
14
  ...renderProps,
15
15
  features,
16
+ inverted,
16
17
  }));
17
18
  const results = await super.render({
18
19
  ...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
  }
@@ -3,18 +3,19 @@ import WiggleBaseRenderer from '../WiggleBaseRenderer';
3
3
  import { YSCALEBAR_LABEL_OFFSET } from '../util';
4
4
  export default class XYPlotRenderer extends WiggleBaseRenderer {
5
5
  async draw(ctx, props) {
6
- const { stopToken, features, config } = props;
6
+ const { inverted, stopToken, features, config } = props;
7
7
  const { drawXY } = await import('../drawXY');
8
8
  const pivotValue = readConfObject(config, 'bicolorPivotValue');
9
9
  const negColor = readConfObject(config, 'negColor');
10
10
  const posColor = readConfObject(config, 'posColor');
11
11
  return drawXY(ctx, {
12
12
  ...props,
13
- colorCallback: readConfObject(config, 'color') === '#f0f'
14
- ? (_, score) => score < pivotValue ? negColor : posColor
13
+ colorCallback: !config.color.isCallback
14
+ ? (_feature, score) => (score < pivotValue ? negColor : posColor)
15
15
  : (feature, _score) => readConfObject(config, 'color', { feature }),
16
16
  offset: YSCALEBAR_LABEL_OFFSET,
17
17
  features: [...features.values()],
18
+ inverted,
18
19
  stopToken,
19
20
  });
20
21
  }
@@ -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;
@@ -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;
@@ -6,16 +6,19 @@ const WiggleRenderer = ConfigurationSchema('WiggleRenderer', {
6
6
  type: 'color',
7
7
  description: 'the color of track, overrides posColor and negColor',
8
8
  defaultValue: '#f0f',
9
+ contextVariable: ['feature'],
9
10
  },
10
11
  posColor: {
11
12
  type: 'color',
12
13
  description: 'the color to use when the score is positive',
13
14
  defaultValue: 'blue',
15
+ contextVariable: ['feature'],
14
16
  },
15
17
  negColor: {
16
18
  type: 'color',
17
19
  description: 'the color to use when the score is negative',
18
20
  defaultValue: 'red',
21
+ contextVariable: ['feature'],
19
22
  },
20
23
  clipColor: {
21
24
  type: 'color',
package/esm/drawXY.d.ts CHANGED
@@ -13,6 +13,7 @@ export declare function drawXY(ctx: CanvasRenderingContext2D, props: {
13
13
  };
14
14
  config: AnyConfigurationModel;
15
15
  displayCrossHatches: boolean;
16
+ inverted: boolean;
16
17
  offset?: number;
17
18
  colorCallback: (f: Feature, score: number) => string;
18
19
  }): {
package/esm/drawXY.js CHANGED
@@ -16,7 +16,7 @@ function darken(color, amount) {
16
16
  const fudgeFactor = 0.3;
17
17
  const clipHeight = 2;
18
18
  export function drawXY(ctx, props) {
19
- const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback, } = props;
19
+ const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback, inverted, } = props;
20
20
  const region = regions[0];
21
21
  const width = (region.end - region.start) / bpPerPx;
22
22
  const height = unadjustedHeight - offset * 2;
@@ -25,7 +25,7 @@ export function drawXY(ctx, props) {
25
25
  const summaryScoreMode = readConfObject(config, 'summaryScoreMode');
26
26
  const pivotValue = readConfObject(config, 'bicolorPivotValue');
27
27
  const minSize = readConfObject(config, 'minSize');
28
- const scale = getScale({ ...scaleOpts, range: [0, height] });
28
+ const scale = getScale({ ...scaleOpts, range: [0, height], inverted });
29
29
  const originY = getOrigin(scaleOpts.scaleType);
30
30
  const domain = scale.domain();
31
31
  const niceMin = domain[0];
package/esm/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;