@jbrowse/wiggle-core 5.0.0-beta.11 → 5.0.0-beta.14

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 (68) hide show
  1. package/README.md +28 -13
  2. package/esm/ResolutionStepper.d.ts +1 -0
  3. package/esm/ResolutionStepper.js +5 -2
  4. package/esm/ScoreAxisWidget/RangeFields.d.ts +5 -0
  5. package/esm/ScoreAxisWidget/RangeFields.js +70 -0
  6. package/esm/ScoreAxisWidget/ReferenceLines.d.ts +10 -0
  7. package/esm/ScoreAxisWidget/ReferenceLines.js +53 -0
  8. package/esm/ScoreAxisWidget/ResetAxisButton.d.ts +7 -0
  9. package/esm/ScoreAxisWidget/ResetAxisButton.js +22 -0
  10. package/esm/ScoreAxisWidget/ScoreAxisHeading.d.ts +5 -0
  11. package/esm/ScoreAxisWidget/ScoreAxisHeading.js +9 -0
  12. package/esm/ScoreAxisWidget/ScoreAxisWidget.d.ts +5 -0
  13. package/esm/ScoreAxisWidget/ScoreAxisWidget.js +69 -0
  14. package/esm/ScoreAxisWidget/Section.d.ts +6 -0
  15. package/esm/ScoreAxisWidget/Section.js +15 -0
  16. package/esm/ScoreAxisWidget/ShareAxisWith.d.ts +5 -0
  17. package/esm/ScoreAxisWidget/ShareAxisWith.js +32 -0
  18. package/esm/ScoreAxisWidget/constants.d.ts +1 -0
  19. package/esm/ScoreAxisWidget/constants.js +1 -0
  20. package/esm/ScoreAxisWidget/index.d.ts +8 -0
  21. package/esm/ScoreAxisWidget/index.js +22 -0
  22. package/esm/ScoreAxisWidget/stateModel.d.ts +30 -0
  23. package/esm/ScoreAxisWidget/stateModel.js +30 -0
  24. package/esm/ScoreAxisWidget/types.d.ts +10 -0
  25. package/esm/ScoreAxisWidget/types.js +1 -0
  26. package/esm/ScoreAxisWidget/writeThrough.d.ts +2 -0
  27. package/esm/ScoreAxisWidget/writeThrough.js +7 -0
  28. package/esm/ScorePlotChrome.d.ts +9 -8
  29. package/esm/ScorePlotChrome.js +16 -8
  30. package/esm/ScorePlotSvgFrame.d.ts +7 -12
  31. package/esm/ScorePlotSvgFrame.js +6 -14
  32. package/esm/ScoreScaleMixin.d.ts +7 -14
  33. package/esm/ScoreScaleMixin.js +7 -21
  34. package/esm/WiggleScoreConfigMixin.d.ts +5 -22
  35. package/esm/WiggleScoreConfigMixin.js +5 -25
  36. package/esm/{ScoreFieldConfigMixin.d.ts → YFieldConfigMixin.d.ts} +11 -15
  37. package/esm/YFieldConfigMixin.js +25 -0
  38. package/esm/autoscale.d.ts +20 -15
  39. package/esm/autoscale.js +37 -34
  40. package/esm/chrome.d.ts +1 -3
  41. package/esm/chrome.js +1 -2
  42. package/esm/dataTypes.d.ts +2 -1
  43. package/esm/index.d.ts +7 -8
  44. package/esm/index.js +5 -6
  45. package/esm/pointSizeMenu.d.ts +12 -24
  46. package/esm/pointSizeMenu.js +9 -20
  47. package/esm/renderingBackendTypes.d.ts +1 -0
  48. package/esm/renderingBackendTypes.js +1 -1
  49. package/esm/scale.d.ts +5 -4
  50. package/esm/scale.js +6 -10
  51. package/esm/scoreMenuItems.d.ts +14 -28
  52. package/esm/scoreMenuItems.js +35 -130
  53. package/esm/valueScaleConfigSchema.d.ts +80 -6
  54. package/esm/valueScaleConfigSchema.js +67 -27
  55. package/esm/yFieldConfigSchemaFields.d.ts +10 -0
  56. package/esm/yFieldConfigSchemaFields.js +8 -0
  57. package/package.json +11 -10
  58. package/esm/AutoscaleGroupDialog.d.ts +0 -7
  59. package/esm/AutoscaleGroupDialog.js +0 -26
  60. package/esm/ScoreFieldConfigMixin.js +0 -25
  61. package/esm/SetMinMaxDialog.d.ts +0 -12
  62. package/esm/SetMinMaxDialog.js +0 -32
  63. package/esm/SetScoreRulesDialog.d.ts +0 -14
  64. package/esm/SetScoreRulesDialog.js +0 -45
  65. package/esm/rowLabelOffset.d.ts +0 -8
  66. package/esm/rowLabelOffset.js +0 -16
  67. package/esm/scoreFieldConfigSchemaFields.d.ts +0 -10
  68. package/esm/scoreFieldConfigSchemaFields.js +0 -8
@@ -1,7 +1,7 @@
1
1
  import type { Instance } from '@jbrowse/mobx-state-tree';
2
2
  export declare const VALUE_SCALE_TYPES: readonly ['linear', 'log', 'symlog'];
3
3
  export interface ValueScaleOptions {
4
- /** `domainQuantile`'s default: 1 follows the extremes, 0.99 clips the outermost 1% */
4
+ /** `domainQuantile`'s default: 1 follows the extremes, 0.99 fences a spike */
5
5
  domainQuantile?: number;
6
6
  /** `symlogConstant`'s default */
7
7
  symlogConstant?: number;
@@ -35,14 +35,13 @@ export type ValueScaleRuleConfig = Instance<ReturnType<typeof valueScaleRuleSche
35
35
  * autoscaled linear or symlog axis reaches 0 whatever those regions hold.
36
36
  *
37
37
  * Two defaults come from the display rather than from the scale.
38
- * `domainQuantile` starts at `0.99` on the wiggle plot, clipping the outermost
39
- * 1% of each sign, and at `1`, the extremes, on the coverage band and the mark
40
- * display. `symlogConstant` starts at `0` on the wiggle family and the mark
38
+ * `domainQuantile` starts at `0.99` on the wiggle plot, fencing a spike, and
39
+ * at `1`, the extremes, on the coverage band and the mark display. `symlogConstant` starts at `0` on the wiggle family and the mark
41
40
  * display and at `1` on the coverage band.
42
41
  *
43
42
  * Every scale carries the same guides: `rules`, reference lines at chosen
44
43
  * values, `grid`, a line at every tick, `minimalTicks`, and `title`, the
45
- * caption beside the axis. A rule naming no `color` draws in the one colour
44
+ * caption beside the axis. A rule naming no `color` draws in the one color
46
45
  * the chrome rules every plot in, so a red line is a claim its author makes
47
46
  * rather than a meaning a display assigns.
48
47
  *
@@ -65,7 +64,7 @@ export type ValueScaleRuleConfig = Instance<ReturnType<typeof valueScaleRuleSche
65
64
  * ```
66
65
  *
67
66
  * #example
68
- * The whole visible range, rather than the 99th percentile the wiggle
67
+ * The whole visible range, spikes included, rather than the fence the wiggle
69
68
  * displays start on:
70
69
  * ```js
71
70
  * {
@@ -181,6 +180,81 @@ export declare const retiredAxisSpellings: {
181
180
  };
182
181
  };
183
182
  };
183
+ /**
184
+ * v4's display-level scale settings as the `scales.y` members they became.
185
+ * `localpercentile` is a clip; `local`, `localsd`, `global` and `globalsd`
186
+ * all follow the extremes closely enough to become one.
187
+ */
188
+ export declare function valueScaleOf({ scale, autoscale, constraints, }: Record<string, unknown>): {
189
+ scales: {
190
+ y: {
191
+ type?: string | undefined;
192
+ domainQuantile?: number | undefined;
193
+ domainMin?: number | undefined;
194
+ domainMax?: number | undefined;
195
+ };
196
+ };
197
+ } | {
198
+ scales?: undefined;
199
+ };
200
+ /**
201
+ * The scale slots v4 declared on a display, as `retired` declares them on
202
+ * each display whose `scales.y` took them over. `minScore` and `maxScore`
203
+ * were unset at v4's own sentinels; `numStdDev` and `inverted` have no
204
+ * successor and are let go.
205
+ */
206
+ export declare const retiredScaleSpellings: {
207
+ scaleType: (scale: unknown) => {
208
+ scales: {
209
+ y: {
210
+ type?: string | undefined;
211
+ domainQuantile?: number | undefined;
212
+ domainMin?: number | undefined;
213
+ domainMax?: number | undefined;
214
+ };
215
+ };
216
+ } | {
217
+ scales?: undefined;
218
+ };
219
+ autoscale: (autoscale: unknown) => {
220
+ scales: {
221
+ y: {
222
+ type?: string | undefined;
223
+ domainQuantile?: number | undefined;
224
+ domainMin?: number | undefined;
225
+ domainMax?: number | undefined;
226
+ };
227
+ };
228
+ } | {
229
+ scales?: undefined;
230
+ };
231
+ minScore: (min: unknown) => {
232
+ scales: {
233
+ y: {
234
+ type?: string | undefined;
235
+ domainQuantile?: number | undefined;
236
+ domainMin?: number | undefined;
237
+ domainMax?: number | undefined;
238
+ };
239
+ };
240
+ } | {
241
+ scales?: undefined;
242
+ };
243
+ maxScore: (max: unknown) => {
244
+ scales: {
245
+ y: {
246
+ type?: string | undefined;
247
+ domainQuantile?: number | undefined;
248
+ domainMin?: number | undefined;
249
+ domainMax?: number | undefined;
250
+ };
251
+ };
252
+ } | {
253
+ scales?: undefined;
254
+ };
255
+ numStdDev: () => {};
256
+ inverted: () => {};
257
+ };
184
258
  /**
185
259
  * The `scales` object a display declares, one member per aesthetic the
186
260
  * grammar gives a scale. `y` is the only one so far, and every mark, bar or
@@ -1,11 +1,12 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
+ import { DEFAULT_CLIP_QUANTILE } from '@jbrowse/core/util/quantileExtent';
2
3
  import { types } from '@jbrowse/mobx-state-tree';
3
4
  export const VALUE_SCALE_TYPES = ['linear', 'log', 'symlog'];
4
5
  function valueScaleRuleSchema() {
5
6
  return ConfigurationSchema('ValueScaleRule', {
6
7
  /**
7
8
  * #slot scales.y.rules.value
8
- * Where the rule sits on the axis, in the units the axis plots: a
9
+ * The rule's position on the axis, in the units the axis plots: a
9
10
  * `-log10(p)` over a Manhattan plot, a depth over coverage.
10
11
  */
11
12
  value: {
@@ -15,14 +16,14 @@ function valueScaleRuleSchema() {
15
16
  },
16
17
  /**
17
18
  * #slot scales.y.rules.color
18
- * The line's colour, and its label's. Unset draws every rule in the one
19
- * colour the chrome rules plots in, so a threshold that means something
19
+ * The line's color, and its label's. Unset draws every rule in the one
20
+ * color the chrome rules plots in, so a threshold that means something
20
21
  * particular — genome-wide significance, a diploid depth — is one an
21
22
  * author paints, on the plot where it means it.
22
23
  */
23
24
  color: {
24
25
  type: 'maybeColor',
25
- description: 'line and label colour; unset is the chrome’s own',
26
+ description: 'line and label color; unset is the chrome’s own',
26
27
  },
27
28
  /**
28
29
  * #slot scales.y.rules.label
@@ -50,14 +51,13 @@ function valueScaleRuleSchema() {
50
51
  * autoscaled linear or symlog axis reaches 0 whatever those regions hold.
51
52
  *
52
53
  * Two defaults come from the display rather than from the scale.
53
- * `domainQuantile` starts at `0.99` on the wiggle plot, clipping the outermost
54
- * 1% of each sign, and at `1`, the extremes, on the coverage band and the mark
55
- * display. `symlogConstant` starts at `0` on the wiggle family and the mark
54
+ * `domainQuantile` starts at `0.99` on the wiggle plot, fencing a spike, and
55
+ * at `1`, the extremes, on the coverage band and the mark display. `symlogConstant` starts at `0` on the wiggle family and the mark
56
56
  * display and at `1` on the coverage band.
57
57
  *
58
58
  * Every scale carries the same guides: `rules`, reference lines at chosen
59
59
  * values, `grid`, a line at every tick, `minimalTicks`, and `title`, the
60
- * caption beside the axis. A rule naming no `color` draws in the one colour
60
+ * caption beside the axis. A rule naming no `color` draws in the one color
61
61
  * the chrome rules every plot in, so a red line is a claim its author makes
62
62
  * rather than a meaning a display assigns.
63
63
  *
@@ -80,7 +80,7 @@ function valueScaleRuleSchema() {
80
80
  * ```
81
81
  *
82
82
  * #example
83
- * The whole visible range, rather than the 99th percentile the wiggle
83
+ * The whole visible range, spikes included, rather than the fence the wiggle
84
84
  * displays start on:
85
85
  * ```js
86
86
  * {
@@ -118,8 +118,8 @@ export function valueScaleSchema({ domainQuantile = 1, symlogConstant = 0, } = {
118
118
  return ConfigurationSchema('ValueScale', {
119
119
  /**
120
120
  * #slot scales.y.type
121
- * How the axis reads its domain — the ticks, the cross-hatches and the
122
- * renderer's placement all come from it. `log` cannot represent 0 or
121
+ * The axis's scale type, which sets the ticks, the cross-hatches and the
122
+ * renderer's placement. `log` cannot represent 0 or
123
123
  * negative values and floors the domain above them; `symlog` is log-like
124
124
  * away from zero and linear through it, so a track whose values touch or
125
125
  * cross 0 keeps them.
@@ -135,8 +135,8 @@ export function valueScaleSchema({ domainQuantile = 1, symlogConstant = 0, } = {
135
135
  /**
136
136
  * #slot scales.y.domainMin
137
137
  * The bottom of the axis, pinning what would otherwise autoscale to the
138
- * loaded regions. Unset autoscales that end. The score menu's "Set
139
- * min/max" writes here.
138
+ * loaded regions. Unset autoscales that end. The Y axis panel's Min
139
+ * field writes here.
140
140
  */
141
141
  domainMin: {
142
142
  type: 'maybeNumber',
@@ -157,8 +157,8 @@ export function valueScaleSchema({ domainQuantile = 1, symlogConstant = 0, } = {
157
157
  * 30 and 60 draws 0 to 60, and a bar always shows its whole height.
158
158
  * Off, the axis spans the values alone. A pinned end is unmoved either
159
159
  * way, a log axis has no 0, and a density plot, which maps score to
160
- * colour and has no axis, spans its values whatever this says.
161
- * The score menu's "Start axis at 0" toggles it.
160
+ * color and has no axis, spans its values whatever this says.
161
+ * The Y axis panel's "Include 0" toggles it.
162
162
  */
163
163
  zero: {
164
164
  type: 'boolean',
@@ -170,8 +170,8 @@ export function valueScaleSchema({ domainQuantile = 1, symlogConstant = 0, } = {
170
170
  * A name shared by the tracks whose axes autoscale together: each
171
171
  * unpinned end spans the data of every track in the view naming the
172
172
  * same group, so three coverage lanes stay comparable as the view
173
- * moves. A pinned end stays this track's own. The score menu's
174
- * "Autoscale with other tracks" writes it.
173
+ * moves. A pinned end stays this track's own. The Y axis panel's
174
+ * "Share axis with" writes it.
175
175
  */
176
176
  autoscaleGroup: {
177
177
  type: 'maybeString',
@@ -193,24 +193,27 @@ export function valueScaleSchema({ domainQuantile = 1, symlogConstant = 0, } = {
193
193
  },
194
194
  /**
195
195
  * #slot scales.y.domainQuantile
196
- * What an unpinned end follows over the loaded values: `1` their
197
- * extremes, and below it that quantile of the values on its side of 0,
198
- * so `0.99` drops the outermost 1% at each end and one spike no longer
199
- * flattens the rest. Where both signs appear each end is measured on its
200
- * own sign, so a sparse minority tail stays visible; whether the axis
201
- * then reaches 0 is `zero`'s. The score menu's "Clip outliers" toggles
202
- * it.
196
+ * The fence for an unpinned end's outliers. An end follows the
197
+ * loaded values' extreme; below `1`, an extreme that would stretch the
198
+ * axis past twice the span this quantile of the values draws stops at
199
+ * that fence, and the bars past it wear the red clip strip. So `0.99`
200
+ * leaves a plot with no spike whole and keeps one spike from flattening
201
+ * the rest. Each end's quantile is measured among the values on its side
202
+ * of 0, so a sparse minority tail stays visible, and the span includes 0
203
+ * where `zero` reaches it. A color ramp's `domainQuantile` clips at the
204
+ * quantile itself, since a saturated color hides nothing its key does
205
+ * not say. The Y axis panel's "Clip extreme outliers" toggles it.
203
206
  */
204
207
  domainQuantile: {
205
208
  type: 'number',
206
209
  defaultValue: domainQuantile,
207
- description: 'the quantile an unpinned end follows: 1 the extremes, 0.99 drops the outermost 1% at each end, each sign measured on its own',
210
+ description: 'fences outliers: 1 follows the extremes; below it an extreme past twice the span this quantile draws is cut there',
208
211
  },
209
212
  /**
210
213
  * #slot scales.y.grid
211
214
  * Rule the plot across at every tick, ggplot2's panel grid and
212
- * Vega-Lite's `axis.grid`. The score menu's "Show cross hatches"
213
- * toggles it.
215
+ * Vega-Lite's `axis.grid`. The Y axis panel's "Grid lines" toggles
216
+ * it.
214
217
  */
215
218
  grid: {
216
219
  type: 'boolean',
@@ -260,6 +263,43 @@ export const retiredAxisSpellings = {
260
263
  scales: { y: { minimalTicks } },
261
264
  }),
262
265
  };
266
+ const isRecord = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
267
+ /**
268
+ * v4's display-level scale settings as the `scales.y` members they became.
269
+ * `localpercentile` is a clip; `local`, `localsd`, `global` and `globalsd`
270
+ * all follow the extremes closely enough to become one.
271
+ */
272
+ export function valueScaleOf({ scale, autoscale, constraints, }) {
273
+ const y = {
274
+ ...(typeof scale === 'string' ? { type: scale } : {}),
275
+ ...(typeof autoscale === 'string'
276
+ ? {
277
+ domainQuantile: autoscale === 'localpercentile' ? DEFAULT_CLIP_QUANTILE : 1,
278
+ }
279
+ : {}),
280
+ ...(isRecord(constraints) && typeof constraints.min === 'number'
281
+ ? { domainMin: constraints.min }
282
+ : {}),
283
+ ...(isRecord(constraints) && typeof constraints.max === 'number'
284
+ ? { domainMax: constraints.max }
285
+ : {}),
286
+ };
287
+ return Object.keys(y).length > 0 ? { scales: { y } } : {};
288
+ }
289
+ /**
290
+ * The scale slots v4 declared on a display, as `retired` declares them on
291
+ * each display whose `scales.y` took them over. `minScore` and `maxScore`
292
+ * were unset at v4's own sentinels; `numStdDev` and `inverted` have no
293
+ * successor and are let go.
294
+ */
295
+ export const retiredScaleSpellings = {
296
+ scaleType: (scale) => valueScaleOf({ scale }),
297
+ autoscale: (autoscale) => valueScaleOf({ autoscale }),
298
+ minScore: (min) => min === Number.MIN_VALUE ? {} : valueScaleOf({ constraints: { min } }),
299
+ maxScore: (max) => max === Number.MAX_VALUE ? {} : valueScaleOf({ constraints: { max } }),
300
+ numStdDev: () => ({}),
301
+ inverted: () => ({}),
302
+ };
263
303
  /**
264
304
  * The `scales` object a display declares, one member per aesthetic the
265
305
  * grammar gives a scale. `y` is the only one so far, and every mark, bar or
@@ -0,0 +1,10 @@
1
+ import type { ConfigModelForFields } from '@jbrowse/core/configuration';
2
+ export declare const DEFAULT_SCORE_FIELD = "score";
3
+ export declare const yFieldConfigSchemaFields: {
4
+ readonly y: {
5
+ readonly type: 'featureField';
6
+ readonly defaultValue: "score";
7
+ readonly description: "the feature field plotted on the value axis, as a mark's encoding.y names one: a name, a dotted path or a `jexl:` expression. The default `score` is the field every adapter serves, including the value a BED adapter's `scoreColumn` rewrote it to; an explicit name reaches a raw column the adapter left alone (a BED extra column, a GFF attribute). A feature with no finite value in the field plots at 0";
8
+ };
9
+ };
10
+ export type YFieldConfigModel = ConfigModelForFields<typeof yFieldConfigSchemaFields>;
@@ -0,0 +1,8 @@
1
+ export const DEFAULT_SCORE_FIELD = 'score';
2
+ export const yFieldConfigSchemaFields = {
3
+ y: {
4
+ type: 'featureField',
5
+ defaultValue: DEFAULT_SCORE_FIELD,
6
+ description: "the feature field plotted on the value axis, as a mark's encoding.y names one: a name, a dotted path or a `jexl:` expression. The default `score` is the field every adapter serves, including the value a BED adapter's `scoreColumn` rewrote it to; an explicit name reaches a raw column the adapter left alone (a BED extra column, a GFF attribute). A feature with no finite value in the field plots at 0",
7
+ },
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/wiggle-core",
3
- "version": "5.0.0-beta.11",
3
+ "version": "5.0.0-beta.14",
4
4
  "type": "module",
5
5
  "description": "Score-axis scale, autoscale, config mixins and plot chrome shared by wiggle, Manhattan, mark and coverage displays",
6
6
  "keywords": [
@@ -26,21 +26,22 @@
26
26
  "./chrome": "./esm/chrome.js",
27
27
  "./constants": "./esm/constants.js",
28
28
  "./normalize": "./esm/normalize.js",
29
- "./renderingBackendTypes": "./esm/renderingBackendTypes.js"
29
+ "./renderingBackendTypes": "./esm/renderingBackendTypes.js",
30
+ "./scoreAxisWidget": "./esm/ScoreAxisWidget/index.js"
30
31
  },
31
32
  "files": [
32
33
  "esm"
33
34
  ],
34
35
  "dependencies": {
35
- "@jbrowse/mobx-state-tree": "^6.7.0",
36
- "@mui/icons-material": "^9.4.0",
37
- "@mui/material": "^9.4.0",
38
- "mobx": "^7.0.5",
36
+ "@jbrowse/mobx-state-tree": "^6.9.0",
37
+ "@mui/icons-material": "^9.5.0",
38
+ "@mui/material": "^9.5.0",
39
+ "mobx": "^7.0.6",
39
40
  "mobx-react": "^10.0.2",
40
- "@jbrowse/core": "^5.0.0-beta.11",
41
- "@jbrowse/display-ui": "^5.0.0-beta.11",
42
- "@jbrowse/display-kit": "^5.0.0-beta.11",
43
- "@jbrowse/render-core": "^5.0.0-beta.11"
41
+ "@jbrowse/display-ui": "^5.0.0-beta.14",
42
+ "@jbrowse/render-core": "^5.0.0-beta.14",
43
+ "@jbrowse/display-kit": "^5.0.0-beta.14",
44
+ "@jbrowse/core": "^5.0.0-beta.14"
44
45
  },
45
46
  "peerDependencies": {
46
47
  "react": ">=19.0.0",
@@ -1,7 +0,0 @@
1
- import type { AutoscalePeer } from './autoscaleGroup.ts';
2
- import type { IStateTreeNode } from '@jbrowse/mobx-state-tree';
3
- declare const _default: ({ model, handleClose, }: {
4
- model: AutoscalePeer & IStateTreeNode;
5
- handleClose: () => void;
6
- }) => import("react").JSX.Element;
7
- export default _default;
@@ -1,26 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { LabeledCheckbox, SubmitDialog } from '@jbrowse/core/ui';
4
- import { Typography } from '@mui/material';
5
- import { observer } from 'mobx-react';
6
- import { autoscalePeers, autoscaleWith } from './autoscaleGroup.js';
7
- export default observer(function AutoscaleGroupDialog({ model, handleClose, }) {
8
- const peers = autoscalePeers(model);
9
- const group = model.autoscaleGroup;
10
- const [chosen, setChosen] = useState(() => new Set(group === undefined
11
- ? []
12
- : peers.map(p => p.display).filter(d => d.autoscaleGroup === group)));
13
- return (_jsxs(SubmitDialog, { open: true, title: "Autoscale with other tracks", submitText: "Apply", onCancel: handleClose, onSubmit: () => {
14
- autoscaleWith(model, peers.map(p => p.display), chosen);
15
- handleClose();
16
- }, children: [_jsx(Typography, { color: "text.secondary", children: "The tracks ticked here share this track's axis: each end nobody pinned spans all of their data, and follows it as the view moves." }), peers.map(({ display, key, name }) => (_jsx("div", { children: _jsx(LabeledCheckbox, { checked: chosen.has(display), label: name, onChange: checked => {
17
- const next = new Set(chosen);
18
- if (checked) {
19
- next.add(display);
20
- }
21
- else {
22
- next.delete(display);
23
- }
24
- setChosen(next);
25
- } }) }, key)))] }));
26
- });
@@ -1,25 +0,0 @@
1
- import { getConf } from '@jbrowse/core/configuration';
2
- import { WiggleScoreConfigMixin } from './WiggleScoreConfigMixin.js';
3
- const confNode = (self) => self;
4
- /**
5
- * #stateModel ScoreFieldConfigMixin
6
- * #category display
7
- *
8
- * `WiggleScoreConfigMixin` plus `scoreField`, for a display that plots one
9
- * configured feature field and so declares `scoreFieldConfigSchemaFields`:
10
- * the wiggle display. `LinearMarkDisplay` names a field per mark and composes
11
- * the base instead.
12
- */
13
- export function ScoreFieldConfigMixin() {
14
- return WiggleScoreConfigMixin().views(self => ({
15
- /**
16
- * #getter
17
- * The feature field the worker plots on the score axis, `score` by
18
- * default. A fetch input: every composing display carries it in its
19
- * `rpcProps()`, since the field is read where the features are.
20
- */
21
- get scoreField() {
22
- return getConf(confNode(self), 'scoreField');
23
- },
24
- }));
25
- }
@@ -1,12 +0,0 @@
1
- declare const _default: (props: {
2
- model: {
3
- manualMinScore: number | undefined;
4
- manualMaxScore: number | undefined;
5
- scaleType: string;
6
- setMinScore: (arg?: number) => void;
7
- setMaxScore: (arg?: number) => void;
8
- };
9
- domain?: [number, number];
10
- handleClose: () => void;
11
- }) => import("react").JSX.Element;
12
- export default _default;
@@ -1,32 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { NumberTextField, SubmitDialog } from '@jbrowse/core/ui';
4
- import { Button, Typography } from '@mui/material';
5
- import { observer } from 'mobx-react';
6
- // The two fields open on what the config really pins, which is the mixin's
7
- // `manual*` pair rather than the raw slots — the sentinel comparison is one
8
- // answer per end and lives there. Submitting `undefined` writes the sentinel
9
- // back, so an emptied field is how autoscale resumes.
10
- export default observer(function SetMinMaxDialog(props) {
11
- const { model, domain, handleClose } = props;
12
- const { manualMinScore, manualMaxScore, scaleType } = model;
13
- const [min, setMin] = useState(manualMinScore);
14
- const [max, setMax] = useState(manualMaxScore);
15
- // The fields own their text, so filling them from the button remounts them.
16
- const [fill, setFill] = useState(0);
17
- const rangeOk = min === undefined || max === undefined || max > min;
18
- const logOk = !(scaleType === 'log' && min !== undefined && min <= 0);
19
- return (_jsxs(SubmitDialog, { open: true, title: "Set min/max score for track", submitDisabled: !rangeOk || !logOk, onCancel: handleClose, onSubmit: () => {
20
- model.setMinScore(min);
21
- model.setMaxScore(max);
22
- handleClose();
23
- }, children: [_jsx(Typography, { children: "Enter min/max score, or leave a field empty to autoscale that end" }), !rangeOk ? (_jsx(Typography, { color: "error", children: "Max must be greater than min" })) : null, !logOk ? (_jsx(Typography, { color: "error", children: "Min score should be greater than 0 for log scale" })) : null, _jsx(NumberTextField, { defaultValue: min, onValueChange: setMin, placeholder: "Enter min score" }, `min-${fill}`), _jsx(NumberTextField, { defaultValue: max, onValueChange: setMax, placeholder: "Enter max score" }, `max-${fill}`), _jsxs("div", { children: [domain ? (_jsx(Button, { onClick: () => {
24
- setMin(domain[0]);
25
- setMax(domain[1]);
26
- setFill(n => n + 1);
27
- }, children: "Use current range" })) : null, _jsx(Button, { disabled: min === undefined && max === undefined, onClick: () => {
28
- setMin(undefined);
29
- setMax(undefined);
30
- setFill(n => n + 1);
31
- }, children: "Clear" })] })] }));
32
- });
@@ -1,14 +0,0 @@
1
- import type { ValueScaleRule } from '@jbrowse/display-ui';
2
- /**
3
- * The score menu's editor for `scales.y.rules`: one row per reference line,
4
- * its value on the plot's own scale, its label and its colour. An empty colour
5
- * is the display's default, and removing every row removes every line.
6
- */
7
- declare const _default: ({ model, handleClose, }: {
8
- model: {
9
- scoreRules: ValueScaleRule[];
10
- setScoreRules: (rules: ValueScaleRule[]) => void;
11
- };
12
- handleClose: () => void;
13
- }) => import("react").JSX.Element;
14
- export default _default;
@@ -1,45 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { SubmitDialog } from '@jbrowse/core/ui';
4
- import { isCssColor } from '@jbrowse/core/util/colorBits';
5
- import DeleteIcon from '@mui/icons-material/Delete';
6
- import { Button, IconButton, TextField, Typography } from '@mui/material';
7
- import { observer } from 'mobx-react';
8
- function rowOf({ value, label = '', color = '' }) {
9
- return { value: String(value), label, color };
10
- }
11
- function valueOk({ value }) {
12
- return value.trim() !== '' && Number.isFinite(Number(value));
13
- }
14
- function colorOk({ color }) {
15
- return color.trim() === '' || isCssColor(color);
16
- }
17
- /**
18
- * The score menu's editor for `scales.y.rules`: one row per reference line,
19
- * its value on the plot's own scale, its label and its colour. An empty colour
20
- * is the display's default, and removing every row removes every line.
21
- */
22
- export default observer(function SetScoreRulesDialog({ model, handleClose, }) {
23
- const [rows, setRows] = useState(() => model.scoreRules.map(rowOf));
24
- const setRow = (index, patch) => {
25
- setRows(rows.map((row, i) => (i === index ? { ...row, ...patch } : row)));
26
- };
27
- return (_jsxs(SubmitDialog, { open: true, title: "Reference lines", submitDisabled: !rows.every(row => valueOk(row) && colorOk(row)), onCancel: handleClose, onSubmit: () => {
28
- model.setScoreRules(rows.map(row => ({
29
- value: Number(row.value),
30
- ...(row.label ? { label: row.label } : {}),
31
- ...(row.color.trim() ? { color: row.color.trim() } : {}),
32
- })));
33
- handleClose();
34
- }, children: [_jsx(Typography, { children: "A horizontal line at each value, on the same scale as the plot" }), rows.map((row, index) => (_jsxs("div", { style: { display: 'flex', gap: 8, marginTop: 8 }, children: [_jsx(TextField, { label: "Value", value: row.value, error: !valueOk(row), onChange: event => {
35
- setRow(index, { value: event.target.value });
36
- } }), _jsx(TextField, { label: "Label", value: row.label, onChange: event => {
37
- setRow(index, { label: event.target.value });
38
- } }), _jsx(TextField, { label: "Color", value: row.color, error: !colorOk(row), onChange: event => {
39
- setRow(index, { color: event.target.value });
40
- } }), _jsx(IconButton, { "aria-label": "remove line", onClick: () => {
41
- setRows(rows.filter((_, i) => i !== index));
42
- }, children: _jsx(DeleteIcon, {}) })] }, index))), _jsx(Button, { onClick: () => {
43
- setRows([...rows, { value: '', label: '', color: '' }]);
44
- }, children: "Add line" })] }));
45
- });
@@ -1,8 +0,0 @@
1
- import type { YAxis } from '@jbrowse/display-ui';
2
- /**
3
- * Where row labels start: `offset`, past the dendrogram, or past the axis each
4
- * row repeats where one draws, since a label grows rightward over the plot.
5
- * `exportContentLeft` is the export shell's, which moves an axis nothing
6
- * pushes right into the margin, so the labels follow it there.
7
- */
8
- export declare function rowLabelOffset(axes: readonly YAxis[], offset: number, exportContentLeft?: number): number;
@@ -1,16 +0,0 @@
1
- import { axisDrawn, axisGutterLeft, axisGutterWidth, } from '@jbrowse/display-ui/axisPlacement';
2
- const AXIS_TO_LABEL_GAP_PX = 4;
3
- /**
4
- * Where row labels start: `offset`, past the dendrogram, or past the axis each
5
- * row repeats where one draws, since a label grows rightward over the plot.
6
- * `exportContentLeft` is the export shell's, which moves an axis nothing
7
- * pushes right into the margin, so the labels follow it there.
8
- */
9
- export function rowLabelOffset(axes, offset, exportContentLeft) {
10
- const axis = axes.find(axisDrawn);
11
- return axis
12
- ? Math.max(offset, axisGutterLeft(axis, 0, 0, exportContentLeft) +
13
- axisGutterWidth(axis) +
14
- AXIS_TO_LABEL_GAP_PX)
15
- : offset;
16
- }
@@ -1,10 +0,0 @@
1
- import type { ConfigModelForFields } from '@jbrowse/core/configuration';
2
- export declare const DEFAULT_SCORE_FIELD = "score";
3
- export declare const scoreFieldConfigSchemaFields: {
4
- readonly scoreField: {
5
- readonly type: 'string';
6
- readonly defaultValue: "score";
7
- readonly description: "Feature field plotted on the score axis, read natively off each feature. The default `score` is the field every adapter serves — including the value a BED adapter's `scoreColumn` rewrote it to — so an explicit name here reaches a raw column the adapter left alone (a BED extra column, a GFF attribute) and takes precedence over that adapter-tier rewrite. The Manhattan plot skips a feature with no finite value in the field; the wiggle renderings plot it at 0";
8
- };
9
- };
10
- export type ScoreFieldConfigModel = ConfigModelForFields<typeof scoreFieldConfigSchemaFields>;
@@ -1,8 +0,0 @@
1
- export const DEFAULT_SCORE_FIELD = 'score';
2
- export const scoreFieldConfigSchemaFields = {
3
- scoreField: {
4
- type: 'string',
5
- defaultValue: DEFAULT_SCORE_FIELD,
6
- description: "Feature field plotted on the score axis, read natively off each feature. The default `score` is the field every adapter serves — including the value a BED adapter's `scoreColumn` rewrote it to — so an explicit name here reaches a raw column the adapter left alone (a BED extra column, a GFF attribute) and takes precedence over that adapter-tier rewrite. The Manhattan plot skips a feature with no finite value in the field; the wiggle renderings plot it at 0",
7
- },
8
- };