@jbrowse/plugin-wiggle 2.16.1 → 2.17.0

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 (83) hide show
  1. package/dist/LinearWiggleDisplay/components/Tooltip.js +1 -1
  2. package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +1 -1
  3. package/dist/LinearWiggleDisplay/{models/configSchema.js → configSchema.js} +2 -2
  4. package/dist/LinearWiggleDisplay/index.d.ts +1 -1
  5. package/dist/LinearWiggleDisplay/index.js +3 -3
  6. package/{esm/LinearWiggleDisplay/models → dist/LinearWiggleDisplay}/model.d.ts +22 -6
  7. package/dist/LinearWiggleDisplay/{models/model.js → model.js} +82 -47
  8. package/dist/LinearWiggleDisplay/{models/renderSvg.js → renderSvg.js} +2 -1
  9. package/dist/MultiLinearWiggleDisplay/components/ColorLegend.d.ts +1 -1
  10. package/dist/MultiLinearWiggleDisplay/components/ScoreLegend.d.ts +1 -1
  11. package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +1 -1
  12. package/dist/MultiLinearWiggleDisplay/components/YScaleBars.d.ts +1 -1
  13. package/dist/MultiLinearWiggleDisplay/components/util.d.ts +1 -1
  14. package/dist/MultiLinearWiggleDisplay/{models/configSchema.js → configSchema.js} +2 -2
  15. package/dist/MultiLinearWiggleDisplay/index.js +2 -2
  16. package/dist/MultiLinearWiggleDisplay/{models/model.d.ts → model.d.ts} +30 -12
  17. package/dist/MultiLinearWiggleDisplay/{models/model.js → model.js} +118 -87
  18. package/dist/MultiLinearWiggleDisplay/{models/renderSvg.js → renderSvg.js} +1 -1
  19. package/dist/MultiRowXYPlotRenderer/configSchema.js +1 -1
  20. package/dist/MultiWiggleAdapter/MultiWiggleAdapter.d.ts +1 -1
  21. package/dist/MultiWiggleAdapter/MultiWiggleAdapter.js +4 -2
  22. package/dist/MultiXYPlotRenderer/configSchema.js +1 -1
  23. package/dist/WiggleBaseRenderer.d.ts +1 -1
  24. package/dist/XYPlotRenderer/configSchema.js +1 -1
  25. package/dist/getMultiWiggleSourcesAutorun.d.ts +17 -0
  26. package/dist/getMultiWiggleSourcesAutorun.js +35 -0
  27. package/dist/getQuantitativeStats.d.ts +13 -0
  28. package/dist/getQuantitativeStats.js +78 -0
  29. package/dist/getQuantitativeStatsAutorun.d.ts +13 -0
  30. package/dist/getQuantitativeStatsAutorun.js +37 -0
  31. package/dist/index.d.ts +2 -2
  32. package/{esm/shared/modelShared.d.ts → dist/shared/SharedWiggleMixin.d.ts} +17 -3
  33. package/dist/shared/{modelShared.js → SharedWiggleMixin.js} +21 -10
  34. package/dist/util.d.ts +5 -29
  35. package/dist/util.js +4 -100
  36. package/esm/LinearWiggleDisplay/components/Tooltip.js +1 -1
  37. package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +1 -1
  38. package/esm/LinearWiggleDisplay/{models/configSchema.js → configSchema.js} +1 -1
  39. package/esm/LinearWiggleDisplay/index.d.ts +1 -1
  40. package/esm/LinearWiggleDisplay/index.js +3 -3
  41. package/{dist/LinearWiggleDisplay/models → esm/LinearWiggleDisplay}/model.d.ts +22 -6
  42. package/esm/LinearWiggleDisplay/{models/model.js → model.js} +82 -47
  43. package/esm/LinearWiggleDisplay/{models/renderSvg.js → renderSvg.js} +2 -1
  44. package/esm/MultiLinearWiggleDisplay/components/ColorLegend.d.ts +1 -1
  45. package/esm/MultiLinearWiggleDisplay/components/ScoreLegend.d.ts +1 -1
  46. package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +1 -1
  47. package/esm/MultiLinearWiggleDisplay/components/YScaleBars.d.ts +1 -1
  48. package/esm/MultiLinearWiggleDisplay/components/util.d.ts +1 -1
  49. package/esm/MultiLinearWiggleDisplay/{models/configSchema.js → configSchema.js} +1 -1
  50. package/esm/MultiLinearWiggleDisplay/index.js +2 -2
  51. package/esm/MultiLinearWiggleDisplay/{models/model.d.ts → model.d.ts} +30 -12
  52. package/esm/MultiLinearWiggleDisplay/{models/model.js → model.js} +119 -88
  53. package/esm/MultiLinearWiggleDisplay/{models/renderSvg.js → renderSvg.js} +1 -1
  54. package/esm/MultiRowXYPlotRenderer/configSchema.js +1 -1
  55. package/esm/MultiWiggleAdapter/MultiWiggleAdapter.d.ts +1 -1
  56. package/esm/MultiWiggleAdapter/MultiWiggleAdapter.js +4 -2
  57. package/esm/MultiXYPlotRenderer/configSchema.js +1 -1
  58. package/esm/WiggleBaseRenderer.d.ts +1 -1
  59. package/esm/XYPlotRenderer/configSchema.js +1 -1
  60. package/esm/getMultiWiggleSourcesAutorun.d.ts +17 -0
  61. package/esm/getMultiWiggleSourcesAutorun.js +32 -0
  62. package/esm/getQuantitativeStats.d.ts +13 -0
  63. package/esm/getQuantitativeStats.js +75 -0
  64. package/esm/getQuantitativeStatsAutorun.d.ts +13 -0
  65. package/esm/getQuantitativeStatsAutorun.js +34 -0
  66. package/esm/index.d.ts +2 -2
  67. package/{dist/shared/modelShared.d.ts → esm/shared/SharedWiggleMixin.d.ts} +17 -3
  68. package/esm/shared/{modelShared.js → SharedWiggleMixin.js} +21 -10
  69. package/esm/util.d.ts +5 -29
  70. package/esm/util.js +4 -98
  71. package/package.json +2 -2
  72. /package/dist/LinearWiggleDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
  73. /package/dist/LinearWiggleDisplay/{models/renderSvg.d.ts → renderSvg.d.ts} +0 -0
  74. /package/dist/MultiLinearWiggleDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
  75. /package/dist/MultiLinearWiggleDisplay/{models/renderSvg.d.ts → renderSvg.d.ts} +0 -0
  76. /package/dist/shared/{configShared.d.ts → SharedWiggleConfigSchema.d.ts} +0 -0
  77. /package/dist/shared/{configShared.js → SharedWiggleConfigSchema.js} +0 -0
  78. /package/esm/LinearWiggleDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
  79. /package/esm/LinearWiggleDisplay/{models/renderSvg.d.ts → renderSvg.d.ts} +0 -0
  80. /package/esm/MultiLinearWiggleDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
  81. /package/esm/MultiLinearWiggleDisplay/{models/renderSvg.d.ts → renderSvg.d.ts} +0 -0
  82. /package/esm/shared/{configShared.d.ts → SharedWiggleConfigSchema.d.ts} +0 -0
  83. /package/esm/shared/{configShared.js → SharedWiggleConfigSchema.js} +0 -0
@@ -100,8 +100,17 @@ function SharedWiggleMixin(configSchema) {
100
100
  configuration: (0, configuration_1.ConfigurationReference)(configSchema),
101
101
  }))
102
102
  .volatile(() => ({
103
+ /**
104
+ * #volatile
105
+ */
103
106
  message: undefined,
107
+ /**
108
+ * #volatile
109
+ */
104
110
  stats: undefined,
111
+ /**
112
+ * #volatile
113
+ */
105
114
  statsFetchInProgress: undefined,
106
115
  }))
107
116
  .actions(self => ({
@@ -109,14 +118,16 @@ function SharedWiggleMixin(configSchema) {
109
118
  * #action
110
119
  */
111
120
  updateQuantitativeStats(stats) {
112
- const { scoreMin, scoreMax } = stats;
121
+ const { currStatsBpPerPx, scoreMin, scoreMax } = stats;
113
122
  const EPSILON = 0.000001;
114
- if (!self.stats) {
115
- self.stats = { scoreMin, scoreMax };
116
- }
117
- else if (Math.abs(self.stats.scoreMax - scoreMax) > EPSILON ||
123
+ if (!self.stats ||
124
+ Math.abs(self.stats.scoreMax - scoreMax) > EPSILON ||
118
125
  Math.abs(self.stats.scoreMin - scoreMin) > EPSILON) {
119
- self.stats = { scoreMin, scoreMax };
126
+ self.stats = {
127
+ currStatsBpPerPx,
128
+ scoreMin,
129
+ scoreMax,
130
+ };
120
131
  }
121
132
  },
122
133
  /**
@@ -140,10 +151,10 @@ function SharedWiggleMixin(configSchema) {
140
151
  /**
141
152
  * #action
142
153
  */
143
- setLoading(aborter) {
144
- const { statsFetchInProgress: statsFetch } = self;
145
- if (statsFetch !== undefined && !statsFetch.signal.aborted) {
146
- statsFetch.abort();
154
+ setStatsLoading(aborter) {
155
+ if (self.statsFetchInProgress !== undefined &&
156
+ !self.statsFetchInProgress.signal.aborted) {
157
+ self.statsFetchInProgress.abort();
147
158
  }
148
159
  self.statsFetchInProgress = aborter;
149
160
  },
package/dist/util.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { QuantitativeStats } from '@jbrowse/core/util/stats';
2
- import { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
1
  export declare const YSCALEBAR_LABEL_OFFSET = 5;
4
2
  export interface ScaleOpts {
5
3
  domain: number[];
@@ -27,14 +25,15 @@ export interface Source {
27
25
  */
28
26
  export declare function getScale({ domain, range, scaleType, pivotValue, inverted, }: ScaleOpts): import("d3-scale").ScaleLinear<number, number, never> | import("d3-scale").ScaleLogarithmic<number, number, never> | import("d3-scale").ScaleQuantize<number, never>;
29
27
  /**
30
- * gets the origin for drawing the graph. for linear this is 0, for log this is arbitrarily set to log(1)==0
28
+ * gets the origin for drawing the graph. for linear this is 0, for log this is
29
+ * arbitrarily set to log(1)==0
31
30
  *
32
31
  * @param scaleType -
33
32
  */
34
- export declare function getOrigin(scaleType: string): 0 | 1;
33
+ export declare function getOrigin(scaleType: string): 1 | 0;
35
34
  /**
36
- * produces a "nice" domain that actually rounds down to 0 for the min
37
- * or 0 to the max depending on if all values are positive or negative
35
+ * produces a "nice" domain that actually rounds down to 0 for the min or 0 to
36
+ * the max depending on if all values are positive or negative
38
37
  *
39
38
  * @param object - containing attributes
40
39
  * - domain [min,max]
@@ -48,29 +47,6 @@ export declare function getNiceDomain({ scaleType, domain, bounds, }: {
48
47
  domain: readonly [number, number];
49
48
  bounds: readonly [number | undefined, number | undefined];
50
49
  }): [number, number];
51
- export declare function getQuantitativeStats(self: {
52
- adapterConfig: AnyConfigurationModel;
53
- configuration: AnyConfigurationModel;
54
- autoscaleType: string;
55
- setMessage: (str: string) => void;
56
- }, opts: {
57
- headers?: Record<string, string>;
58
- signal?: AbortSignal;
59
- filters: string[];
60
- }): Promise<QuantitativeStats>;
61
- export declare function quantitativeStatsAutorun(self: {
62
- featureDensityStatsReady: boolean;
63
- regionTooLarge: boolean;
64
- error: unknown;
65
- setLoading: (aborter: AbortController) => void;
66
- setError: (error: unknown) => void;
67
- updateQuantitativeStats: (stats: QuantitativeStats, statsRegion: string) => void;
68
- renderProps: () => Record<string, unknown>;
69
- configuration: AnyConfigurationModel;
70
- adapterConfig: AnyConfigurationModel;
71
- autoscaleType: string;
72
- setMessage: (str: string) => void;
73
- }): void;
74
50
  export declare function toP(s?: number): number;
75
51
  export declare function round(value: number): number;
76
52
  export declare function fillRectCtx(x: number, y: number, width: number, height: number, ctx: CanvasRenderingContext2D, color?: string): void;
package/dist/util.js CHANGED
@@ -4,17 +4,10 @@ exports.YSCALEBAR_LABEL_OFFSET = void 0;
4
4
  exports.getScale = getScale;
5
5
  exports.getOrigin = getOrigin;
6
6
  exports.getNiceDomain = getNiceDomain;
7
- exports.getQuantitativeStats = getQuantitativeStats;
8
- exports.quantitativeStatsAutorun = quantitativeStatsAutorun;
9
7
  exports.toP = toP;
10
8
  exports.round = round;
11
9
  exports.fillRectCtx = fillRectCtx;
12
10
  const d3_scale_1 = require("@mui/x-charts-vendor/d3-scale");
13
- const mobx_1 = require("mobx");
14
- const util_1 = require("@jbrowse/core/util");
15
- const tracks_1 = require("@jbrowse/core/util/tracks");
16
- const mobx_state_tree_1 = require("mobx-state-tree");
17
- const configuration_1 = require("@jbrowse/core/configuration");
18
11
  exports.YSCALEBAR_LABEL_OFFSET = 5;
19
12
  /**
20
13
  * produces a d3-scale from arguments. applies a "nice domain" adjustment
@@ -55,7 +48,8 @@ function getScale({ domain = [], range = [], scaleType, pivotValue, inverted, })
55
48
  return scale;
56
49
  }
57
50
  /**
58
- * gets the origin for drawing the graph. for linear this is 0, for log this is arbitrarily set to log(1)==0
51
+ * gets the origin for drawing the graph. for linear this is 0, for log this is
52
+ * arbitrarily set to log(1)==0
59
53
  *
60
54
  * @param scaleType -
61
55
  */
@@ -78,8 +72,8 @@ function getOrigin(scaleType /* , pivot, stats */) {
78
72
  return 0;
79
73
  }
80
74
  /**
81
- * produces a "nice" domain that actually rounds down to 0 for the min
82
- * or 0 to the max depending on if all values are positive or negative
75
+ * produces a "nice" domain that actually rounds down to 0 for the min or 0 to
76
+ * the max depending on if all values are positive or negative
83
77
  *
84
78
  * @param object - containing attributes
85
79
  * - domain [min,max]
@@ -132,96 +126,6 @@ function getNiceDomain({ scaleType, domain, bounds, }) {
132
126
  scale.nice();
133
127
  return scale.domain();
134
128
  }
135
- async function getQuantitativeStats(self, opts) {
136
- const { rpcManager } = (0, util_1.getSession)(self);
137
- const numStdDev = (0, configuration_1.getConf)(self, 'numStdDev') || 3;
138
- const { adapterConfig, autoscaleType } = self;
139
- const sessionId = (0, tracks_1.getRpcSessionId)(self);
140
- const params = {
141
- sessionId,
142
- adapterConfig,
143
- statusCallback: (message) => {
144
- if ((0, mobx_state_tree_1.isAlive)(self)) {
145
- self.setMessage(message);
146
- }
147
- },
148
- ...opts,
149
- };
150
- if (autoscaleType === 'global' || autoscaleType === 'globalsd') {
151
- const results = (await rpcManager.call(sessionId, 'WiggleGetGlobalQuantitativeStats', params));
152
- const { scoreMin, scoreMean, scoreStdDev } = results;
153
- // globalsd uses heuristic to avoid unnecessary scoreMin<0
154
- // if the scoreMin is never less than 0
155
- // helps with most coverage bigwigs just being >0
156
- return autoscaleType === 'globalsd'
157
- ? {
158
- ...results,
159
- scoreMin: scoreMin >= 0 ? 0 : scoreMean - numStdDev * scoreStdDev,
160
- scoreMax: scoreMean + numStdDev * scoreStdDev,
161
- }
162
- : results;
163
- }
164
- if (autoscaleType === 'local' || autoscaleType === 'localsd') {
165
- const { dynamicBlocks, bpPerPx } = (0, util_1.getContainingView)(self);
166
- const results = (await rpcManager.call(sessionId, 'WiggleGetMultiRegionQuantitativeStats', {
167
- ...params,
168
- regions: dynamicBlocks.contentBlocks.map(region => {
169
- const { start, end } = region;
170
- return {
171
- ...JSON.parse(JSON.stringify(region)),
172
- start: Math.floor(start),
173
- end: Math.ceil(end),
174
- };
175
- }),
176
- bpPerPx,
177
- }));
178
- const { scoreMin, scoreMean, scoreStdDev } = results;
179
- // localsd uses heuristic to avoid unnecessary scoreMin<0 if the
180
- // scoreMin is never less than 0 helps with most coverage bigwigs
181
- // just being >0
182
- return autoscaleType === 'localsd'
183
- ? {
184
- ...results,
185
- scoreMin: scoreMin >= 0 ? 0 : scoreMean - numStdDev * scoreStdDev,
186
- scoreMax: scoreMean + numStdDev * scoreStdDev,
187
- }
188
- : results;
189
- }
190
- if (autoscaleType === 'zscale') {
191
- return rpcManager.call(sessionId, 'WiggleGetGlobalQuantitativeStats', params);
192
- }
193
- throw new Error(`invalid autoscaleType '${autoscaleType}'`);
194
- }
195
- function quantitativeStatsAutorun(self) {
196
- (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(async () => {
197
- try {
198
- const aborter = new AbortController();
199
- const view = (0, util_1.getContainingView)(self);
200
- self.setLoading(aborter);
201
- if (!view.initialized ||
202
- !self.featureDensityStatsReady ||
203
- self.regionTooLarge ||
204
- self.error) {
205
- return;
206
- }
207
- const statsRegion = JSON.stringify(view.dynamicBlocks);
208
- const wiggleStats = await getQuantitativeStats(self, {
209
- signal: aborter.signal,
210
- filters: [],
211
- ...self.renderProps(),
212
- });
213
- if ((0, mobx_state_tree_1.isAlive)(self)) {
214
- self.updateQuantitativeStats(wiggleStats, statsRegion);
215
- }
216
- }
217
- catch (e) {
218
- if (!(0, util_1.isAbortException)(e) && (0, mobx_state_tree_1.isAlive)(self)) {
219
- console.error(e);
220
- self.setError(e);
221
- }
222
- }
223
- }, { delay: 1000 }));
224
- }
225
129
  function toP(s = 0) {
226
130
  return +(+s).toPrecision(6);
227
131
  }
@@ -5,7 +5,7 @@ import Tooltip from '../../Tooltip';
5
5
  import { toP } from '../../util';
6
6
  const en = (n) => n.toLocaleString('en-US');
7
7
  const TooltipContents = React.forwardRef(function TooltipContents2({ feature }, ref) {
8
- const start = feature.get('start');
8
+ const start = feature.get('start') + 1;
9
9
  const end = feature.get('end');
10
10
  const refName = feature.get('refName');
11
11
  const name = feature.get('name');
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { WiggleDisplayModel } from '../models/model';
2
+ import { WiggleDisplayModel } from '../model';
3
3
  declare const LinearWiggleDisplay: (props: {
4
4
  model: WiggleDisplayModel;
5
5
  }) => React.JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
2
  import { types } from 'mobx-state-tree';
3
3
  // locals
4
- import sharedWiggleConfigFactory from '../../shared/configShared';
4
+ import sharedWiggleConfigFactory from '../shared/SharedWiggleConfigSchema';
5
5
  /**
6
6
  * #config LinearWiggleDisplay
7
7
  * extends
@@ -2,4 +2,4 @@ import PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function LinearWiggleDisplayF(pluginManager: PluginManager): void;
3
3
  export { default as Tooltip } from './components/Tooltip';
4
4
  export { default as ReactComponent } from './components/WiggleDisplayComponent';
5
- export { default as modelFactory } from './models/model';
5
+ export { default as modelFactory } from './model';
@@ -1,6 +1,6 @@
1
1
  import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType';
2
- import configSchemaFactory from './models/configSchema';
3
- import modelFactory from './models/model';
2
+ import configSchemaFactory from './configSchema';
3
+ import modelFactory from './model';
4
4
  import { lazy } from 'react';
5
5
  export default function LinearWiggleDisplayF(pluginManager) {
6
6
  pluginManager.addDisplayType(() => {
@@ -19,4 +19,4 @@ export default function LinearWiggleDisplayF(pluginManager) {
19
19
  }
20
20
  export { default as Tooltip } from './components/Tooltip';
21
21
  export { default as ReactComponent } from './components/WiggleDisplayComponent';
22
- export { default as modelFactory } from './models/model';
22
+ export { default as modelFactory } from './model';
@@ -49,7 +49,9 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
49
49
  reload: () => void;
50
50
  message: React.ReactNode;
51
51
  filled?: boolean;
52
- status?: string;
52
+ status? /**
53
+ * #getter
54
+ */: string;
53
55
  reactElement?: React.ReactElement;
54
56
  };
55
57
  }) => import("react").JSX.Element | undefined;
@@ -145,9 +147,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
145
147
  error: unknown;
146
148
  message: string | undefined;
147
149
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
148
- onHorizontalScroll? /**
149
- * #getter
150
- */: () => void;
150
+ onHorizontalScroll?: () => void;
151
151
  blockState?: Record<string, any>;
152
152
  }>;
153
153
  readonly DisplayBlurb: React.FC<{
@@ -252,19 +252,21 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
252
252
  } & {
253
253
  message: undefined | string;
254
254
  stats: {
255
+ currStatsBpPerPx: number;
255
256
  scoreMin: number;
256
257
  scoreMax: number;
257
258
  } | undefined;
258
259
  statsFetchInProgress: undefined | AbortController;
259
260
  } & {
260
261
  updateQuantitativeStats(stats: {
262
+ currStatsBpPerPx: number;
261
263
  scoreMin: number;
262
264
  scoreMax: number;
263
265
  }): void;
264
266
  setColor(color?: string): void;
265
267
  setPosColor(color?: string): void;
266
268
  setNegColor(color?: string): void;
267
- setLoading(aborter: AbortController): void;
269
+ setStatsLoading(aborter: AbortController): void;
268
270
  selectFeature(feature: import("@jbrowse/core/util").Feature): void;
269
271
  setResolution(res: number): void;
270
272
  setFill(fill: number): void;
@@ -306,6 +308,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
306
308
  readonly scaleOpts: {
307
309
  domain: number[] | undefined;
308
310
  stats: {
311
+ currStatsBpPerPx: number;
309
312
  scoreMin: number;
310
313
  scoreMax: number;
311
314
  } | undefined;
@@ -350,7 +353,16 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
350
353
  * #getter
351
354
  */
352
355
  readonly rendererTypeName: string;
356
+ /**
357
+ * #getter
358
+ * unused currently
359
+ */
360
+ readonly quantitativeStatsRelevantToCurrentZoom: boolean;
353
361
  } & {
362
+ /**
363
+ * #method
364
+ */
365
+ adapterProps(): any;
354
366
  /**
355
367
  * #getter
356
368
  */
@@ -372,7 +384,11 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
372
384
  /**
373
385
  * #getter
374
386
  */
375
- readonly fillSetting: 2 | 0 | 1;
387
+ readonly fillSetting: 2 | 1 | 0;
388
+ /**
389
+ * #getter
390
+ */
391
+ readonly quantitativeStatsReady: boolean;
376
392
  } & {
377
393
  /**
378
394
  * #method
@@ -1,14 +1,14 @@
1
1
  import { lazy } from 'react';
2
2
  import { getConf, } from '@jbrowse/core/configuration';
3
- import { getSession } from '@jbrowse/core/util';
3
+ import { getContainingView, getSession, } from '@jbrowse/core/util';
4
4
  import { types } from 'mobx-state-tree';
5
5
  import { axisPropsFromTickScale } from 'react-d3-axis-mod';
6
6
  // locals
7
- import { getScale, YSCALEBAR_LABEL_OFFSET } from '../../util';
8
- import SharedWiggleMixin from '../../shared/modelShared';
7
+ import { getScale, YSCALEBAR_LABEL_OFFSET } from '../util';
8
+ import SharedWiggleMixin from '../shared/SharedWiggleMixin';
9
9
  // lazies
10
- const Tooltip = lazy(() => import('../components/Tooltip'));
11
- const SetColorDialog = lazy(() => import('../components/SetColorDialog'));
10
+ const Tooltip = lazy(() => import('./components/Tooltip'));
11
+ const SetColorDialog = lazy(() => import('./components/SetColorDialog'));
12
12
  // using a map because it preserves order
13
13
  const rendererTypes = new Map([
14
14
  ['xyplot', 'XYPlotRenderer'],
@@ -46,29 +46,14 @@ function stateModelFactory(pluginManager, configSchema) {
46
46
  }
47
47
  return rendererType;
48
48
  },
49
- }))
50
- .views(self => ({
51
49
  /**
52
50
  * #getter
51
+ * unused currently
53
52
  */
54
- get ticks() {
55
- const { scaleType, domain, height } = self;
56
- const minimalTicks = getConf(self, 'minimalTicks');
57
- const inverted = getConf(self, 'inverted');
58
- const range = [height - YSCALEBAR_LABEL_OFFSET, YSCALEBAR_LABEL_OFFSET];
59
- if (!domain) {
60
- return undefined;
61
- }
62
- const scale = getScale({
63
- scaleType,
64
- domain,
65
- range,
66
- inverted,
67
- });
68
- const ticks = axisPropsFromTickScale(scale, 4);
69
- return height < 100 || minimalTicks
70
- ? { ...ticks, values: domain }
71
- : ticks;
53
+ get quantitativeStatsRelevantToCurrentZoom() {
54
+ var _a;
55
+ const view = getContainingView(self);
56
+ return ((_a = self.stats) === null || _a === void 0 ? void 0 : _a.currStatsBpPerPx) === view.bpPerPx;
72
57
  },
73
58
  }))
74
59
  .views(self => {
@@ -77,46 +62,93 @@ function stateModelFactory(pluginManager, configSchema) {
77
62
  /**
78
63
  * #method
79
64
  */
80
- renderProps() {
65
+ adapterProps() {
81
66
  const superProps = superRenderProps();
82
- const { filters, ticks, height, resolution, scaleOpts } = self;
67
+ const { filters, resolution, scaleOpts } = self;
83
68
  return {
84
69
  ...superProps,
85
- notReady: superProps.notReady || !self.stats,
86
70
  rpcDriverName: self.rpcDriverName,
87
71
  displayModel: self,
88
72
  config: self.rendererConfig,
89
73
  displayCrossHatches: self.displayCrossHatchesSetting,
90
74
  scaleOpts,
91
75
  resolution,
92
- height,
93
- ticks,
94
76
  filters,
95
77
  };
96
78
  },
97
79
  /**
98
80
  * #getter
99
81
  */
100
- get needsScalebar() {
101
- const { rendererTypeName: type } = self;
102
- return type === 'XYPlotRenderer' || type === 'LinePlotRenderer';
103
- },
104
- /**
105
- * #getter
106
- */
107
- get fillSetting() {
108
- if (self.filled) {
109
- return 0;
110
- }
111
- else if (self.minSize === 1) {
112
- return 1;
82
+ get ticks() {
83
+ const { scaleType, domain, height } = self;
84
+ const minimalTicks = getConf(self, 'minimalTicks');
85
+ const inverted = getConf(self, 'inverted');
86
+ if (domain) {
87
+ const ticks = axisPropsFromTickScale(getScale({
88
+ scaleType,
89
+ domain,
90
+ range: [
91
+ height - YSCALEBAR_LABEL_OFFSET,
92
+ YSCALEBAR_LABEL_OFFSET,
93
+ ],
94
+ inverted,
95
+ }), 4);
96
+ return height < 100 || minimalTicks
97
+ ? { ...ticks, values: domain }
98
+ : ticks;
113
99
  }
114
100
  else {
115
- return 2;
101
+ return undefined;
116
102
  }
117
103
  },
118
104
  };
119
105
  })
106
+ .views(self => ({
107
+ /**
108
+ * #method
109
+ */
110
+ renderProps() {
111
+ const { ticks, height } = self;
112
+ const superProps = self.adapterProps();
113
+ return {
114
+ ...self.adapterProps(),
115
+ notReady: superProps.notReady || !self.stats,
116
+ height,
117
+ ticks,
118
+ };
119
+ },
120
+ /**
121
+ * #getter
122
+ */
123
+ get needsScalebar() {
124
+ return (self.rendererTypeName === 'XYPlotRenderer' ||
125
+ self.rendererTypeName === 'LinePlotRenderer');
126
+ },
127
+ /**
128
+ * #getter
129
+ */
130
+ get fillSetting() {
131
+ if (self.filled) {
132
+ return 0;
133
+ }
134
+ else if (self.minSize === 1) {
135
+ return 1;
136
+ }
137
+ else {
138
+ return 2;
139
+ }
140
+ },
141
+ /**
142
+ * #getter
143
+ */
144
+ get quantitativeStatsReady() {
145
+ const view = getContainingView(self);
146
+ return (view.initialized &&
147
+ self.featureDensityStatsReady &&
148
+ !self.regionTooLarge &&
149
+ !self.error);
150
+ },
151
+ }))
120
152
  .views(self => {
121
153
  const { trackMenuItems: superTrackMenuItems } = self;
122
154
  const hasRenderings = getConf(self, 'defaultRendering');
@@ -178,7 +210,10 @@ function stateModelFactory(pluginManager, configSchema) {
178
210
  onClick: () => {
179
211
  getSession(self).queueDialog(handleClose => [
180
212
  SetColorDialog,
181
- { model: self, handleClose },
213
+ {
214
+ model: self,
215
+ handleClose,
216
+ },
182
217
  ]);
183
218
  },
184
219
  },
@@ -193,8 +228,8 @@ function stateModelFactory(pluginManager, configSchema) {
193
228
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
194
229
  ;
195
230
  (async () => {
196
- const { quantitativeStatsAutorun } = await import('../../util');
197
- quantitativeStatsAutorun(self);
231
+ const { getQuantitativeStatsAutorun } = await import('../getQuantitativeStatsAutorun');
232
+ getQuantitativeStatsAutorun(self);
198
233
  })();
199
234
  },
200
235
  /**
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { getContainingView } from '@jbrowse/core/util';
3
3
  import { when } from 'mobx';
4
- import YScaleBar from '../../shared/YScaleBar';
4
+ // locals
5
+ import YScaleBar from '../shared/YScaleBar';
5
6
  export async function renderSvg(self, opts, superRenderSvg) {
6
7
  await when(() => !!self.stats && !!self.regionCannotBeRenderedText);
7
8
  const { needsScalebar, stats } = self;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { WiggleDisplayModel } from '../models/model';
2
+ import { WiggleDisplayModel } from '../model';
3
3
  declare const ColorLegend: ({ model, rowHeight, labelWidth, exportSVG, }: {
4
4
  model: WiggleDisplayModel;
5
5
  rowHeight: number;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { WiggleDisplayModel } from '../models/model';
2
+ import { WiggleDisplayModel } from '../model';
3
3
  declare const ScoreLegend: ({ model }: {
4
4
  model: WiggleDisplayModel;
5
5
  }) => React.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { WiggleDisplayModel } from '../models/model';
2
+ import { WiggleDisplayModel } from '../model';
3
3
  declare const MultiLinearWiggleDisplayComponent: (props: {
4
4
  model: WiggleDisplayModel;
5
5
  }) => React.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { WiggleDisplayModel } from '../models/model';
2
+ import { WiggleDisplayModel } from '../model';
3
3
  export declare const YScaleBars: (props: {
4
4
  model: WiggleDisplayModel;
5
5
  orientation?: string;
@@ -1,4 +1,4 @@
1
- import { WiggleDisplayModel } from '../models/model';
1
+ import { WiggleDisplayModel } from '../model';
2
2
  export declare function moveUp(arr: {
3
3
  name: string;
4
4
  }[], sel: string[], by?: number): {
@@ -1,7 +1,7 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
2
  import { types } from 'mobx-state-tree';
3
3
  // locals
4
- import sharedWiggleConfigFactory from '../../shared/configShared';
4
+ import sharedWiggleConfigFactory from '../shared/SharedWiggleConfigSchema';
5
5
  /**
6
6
  * #config MultiLinearWiggleDisplay
7
7
  * extends
@@ -1,6 +1,6 @@
1
1
  import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType';
2
- import configSchemaFactory from './models/configSchema';
3
- import modelFactory from './models/model';
2
+ import configSchemaFactory from './configSchema';
3
+ import modelFactory from './model';
4
4
  import { lazy } from 'react';
5
5
  export default function MultiLinearWiggleDisplayF(pluginManager) {
6
6
  pluginManager.addDisplayType(() => {