@jbrowse/wiggle-core 5.0.0-beta.13 → 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 (40) hide show
  1. package/README.md +8 -7
  2. package/esm/ResolutionStepper.js +1 -1
  3. package/esm/ScoreAxisWidget/ReferenceLines.d.ts +1 -1
  4. package/esm/ScoreAxisWidget/ReferenceLines.js +1 -1
  5. package/esm/ScoreAxisWidget/ResetAxisButton.d.ts +3 -2
  6. package/esm/ScoreAxisWidget/ResetAxisButton.js +4 -2
  7. package/esm/ScoreAxisWidget/ScoreAxisWidget.js +1 -1
  8. package/esm/ScoreAxisWidget/Section.d.ts +3 -2
  9. package/esm/ScoreAxisWidget/Section.js +4 -2
  10. package/esm/ScorePlotChrome.d.ts +8 -8
  11. package/esm/ScorePlotChrome.js +16 -8
  12. package/esm/ScoreScaleMixin.d.ts +2 -9
  13. package/esm/ScoreScaleMixin.js +2 -16
  14. package/esm/WiggleScoreConfigMixin.d.ts +5 -22
  15. package/esm/WiggleScoreConfigMixin.js +5 -25
  16. package/esm/{ScoreFieldConfigMixin.d.ts → YFieldConfigMixin.d.ts} +11 -15
  17. package/esm/YFieldConfigMixin.js +25 -0
  18. package/esm/autoscale.d.ts +10 -9
  19. package/esm/autoscale.js +21 -25
  20. package/esm/chrome.d.ts +1 -2
  21. package/esm/chrome.js +1 -1
  22. package/esm/dataTypes.d.ts +2 -0
  23. package/esm/index.d.ts +5 -6
  24. package/esm/index.js +4 -5
  25. package/esm/pointSizeMenu.d.ts +12 -24
  26. package/esm/pointSizeMenu.js +9 -20
  27. package/esm/renderingBackendTypes.d.ts +1 -0
  28. package/esm/renderingBackendTypes.js +1 -1
  29. package/esm/scale.d.ts +5 -4
  30. package/esm/scale.js +5 -9
  31. package/esm/valueScaleConfigSchema.d.ts +76 -1
  32. package/esm/valueScaleConfigSchema.js +49 -11
  33. package/esm/yFieldConfigSchemaFields.d.ts +10 -0
  34. package/esm/yFieldConfigSchemaFields.js +8 -0
  35. package/package.json +8 -8
  36. package/esm/ScoreFieldConfigMixin.js +0 -25
  37. package/esm/rowLabelOffset.d.ts +0 -8
  38. package/esm/rowLabelOffset.js +0 -16
  39. package/esm/scoreFieldConfigSchemaFields.d.ts +0 -10
  40. package/esm/scoreFieldConfigSchemaFields.js +0 -8
package/esm/autoscale.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { fenceOutliers, quantileExtent, } from '@jbrowse/core/util/quantileExtent';
2
- /** The wiggle packer's arrays as a span, under a summary mode. */
3
- export function datasetSpan({ data, visStart, visEnd }, summaryScoreMode) {
4
- const { low, high } = boundArrays(summaryScoreMode);
2
+ /** The wiggle packer's arrays as a span, under an aggregate and an extent. */
3
+ export function datasetSpan({ data, visStart, visEnd }, aggregate, extent) {
4
+ const { low, high } = boundArrays(aggregate, extent);
5
5
  return {
6
6
  count: data.numFeatures,
7
7
  starts: data.featurePositions,
@@ -17,13 +17,13 @@ export function datasetSpan({ data, visStart, visEnd }, summaryScoreMode) {
17
17
  }
18
18
  /**
19
19
  * #api
20
- * Per-feature scalar score array for a summary mode: the min/max summary array
20
+ * Per-feature scalar score array for an aggregate: the min/max summary array
21
21
  * for `'min'`/`'max'`, otherwise the average score.
22
22
  */
23
- export function getEffectiveScores(data, summaryScoreMode) {
24
- return summaryScoreMode === 'min'
23
+ export function getEffectiveScores(data, aggregate) {
24
+ return aggregate === 'min'
25
25
  ? data.featureMinScores
26
- : summaryScoreMode === 'max'
26
+ : aggregate === 'max'
27
27
  ? data.featureMaxScores
28
28
  : data.featureScores;
29
29
  }
@@ -31,19 +31,15 @@ export function getEffectiveScores(data, summaryScoreMode) {
31
31
  function overlaps(fStart, fEnd, visStart, visEnd) {
32
32
  return fEnd > visStart && fStart < visEnd;
33
33
  }
34
- // Which per-feature array each end of the domain comes from. Whiskers spreads
35
- // the two ends across the min/max summary arrays; every other mode draws both
36
- // from a single scalar. One table because the extent and the clipped bound have
37
- // to read the same arrays, or a domain clips its own data.
38
- function boundArrays(summaryScoreMode) {
39
- const useWhiskers = summaryScoreMode === 'whiskers';
34
+ // Which per-feature array each end of the domain comes from. A min-max extent
35
+ // spreads the two ends across the min/max summary arrays; without one both come
36
+ // from the aggregate's single array. One table because the data's span and the
37
+ // clipped bound have to read the same arrays, or a domain clips its own data.
38
+ function boundArrays(aggregate, extent) {
39
+ const minMax = extent === 'min-max';
40
40
  return {
41
- low: (data) => useWhiskers
42
- ? data.featureMinScores
43
- : getEffectiveScores(data, summaryScoreMode),
44
- high: (data) => useWhiskers
45
- ? data.featureMaxScores
46
- : getEffectiveScores(data, summaryScoreMode),
41
+ low: (data) => minMax ? data.featureMinScores : getEffectiveScores(data, aggregate),
42
+ high: (data) => minMax ? data.featureMaxScores : getEffectiveScores(data, aggregate),
47
43
  };
48
44
  }
49
45
  // First index whose instance STARTS at or after `bp`. `starts` is sorted by
@@ -122,8 +118,8 @@ export function computeSpanStats(spans) {
122
118
  : undefined;
123
119
  }
124
120
  /** `computeSpanStats` over the wiggle packer's datasets. */
125
- export function computeScoreStats(summaryScoreMode, datasets) {
126
- return computeSpanStats(datasets.map(d => datasetSpan(d, summaryScoreMode)));
121
+ export function computeScoreStats(aggregate, datasets, extent) {
122
+ return computeSpanStats(datasets.map(d => datasetSpan(d, aggregate, extent)));
127
123
  }
128
124
  /**
129
125
  * #api
@@ -161,12 +157,12 @@ export function autoscaleDomainFromSpans({ stats, quantile, zero, spans, }) {
161
157
  });
162
158
  }
163
159
  /** `autoscaleDomainFromSpans` over the wiggle packer's datasets. */
164
- export function autoscaleDomainFromStats({ stats, quantile, zero, summaryScoreMode, visibleEntries, }) {
160
+ export function autoscaleDomainFromStats({ stats, quantile, zero, aggregate, extent, visibleEntries, }) {
165
161
  return autoscaleDomainFromSpans({
166
162
  stats,
167
163
  quantile,
168
164
  zero,
169
- spans: visibleEntries.map(d => datasetSpan(d, summaryScoreMode)),
165
+ spans: visibleEntries.map(d => datasetSpan(d, aggregate, extent)),
170
166
  });
171
167
  }
172
168
  /**
@@ -175,8 +171,8 @@ export function autoscaleDomainFromStats({ stats, quantile, zero, summaryScoreMo
175
171
  * `scales.y.domainQuantile` says, its outliers fenced for an axis that
176
172
  * reaches 0 under `zero`.
177
173
  */
178
- export function computeAutoscaleDomain(quantile, summaryScoreMode, visibleEntries, zero) {
179
- const spans = visibleEntries.map(d => datasetSpan(d, summaryScoreMode));
174
+ export function computeAutoscaleDomain(quantile, aggregate, visibleEntries, zero, extent = 'none') {
175
+ const spans = visibleEntries.map(d => datasetSpan(d, aggregate, extent));
180
176
  const stats = computeSpanStats(spans);
181
177
  return stats
182
178
  ? autoscaleDomainFromSpans({ stats, quantile, zero, spans })
package/esm/chrome.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export { AxisGutter, CrossHatchLines, CrossHatches, ScoreDomainCaption, ScoreRuleLines, ScoreRules, YScaleBar, YScaleBarOverlay, } from '@jbrowse/display-ui';
2
2
  export { makeResolutionSubMenuItem } from './ResolutionStepper.tsx';
3
- export { makePointSizeSubMenu, pointSizeAccess } from './pointSizeMenu.tsx';
4
- export type { PointSizeAccess } from './pointSizeMenu.tsx';
3
+ export { makeMarkSizeSubMenu } from './pointSizeMenu.tsx';
package/esm/chrome.js CHANGED
@@ -3,4 +3,4 @@
3
3
  // an adapter or an RPC method never does.
4
4
  export { AxisGutter, CrossHatchLines, CrossHatches, ScoreDomainCaption, ScoreRuleLines, ScoreRules, YScaleBar, YScaleBarOverlay, } from '@jbrowse/display-ui';
5
5
  export { makeResolutionSubMenuItem } from './ResolutionStepper.js';
6
- export { makePointSizeSubMenu, pointSizeAccess } from './pointSizeMenu.js';
6
+ export { makeMarkSizeSubMenu } from './pointSizeMenu.js';
@@ -20,4 +20,6 @@ export interface WiggleDataResult {
20
20
  zoomRange?: ZoomRange;
21
21
  /** The bounds the adapter's values lie in by definition (`getValueDomain`). */
22
22
  valueDomain?: [number, number];
23
+ /** What the adapter's source listing dropped or could not match. */
24
+ warnings?: string[];
23
25
  }
package/esm/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { retiredAxisSpellings, scalesSchema, valueScaleSchema, } from './valueScaleConfigSchema.ts';
2
- export type { ScalesConfigSchema, ValueScaleConfigSchema, ValueScaleOptions, } from './valueScaleConfigSchema.ts';
1
+ export { retiredAxisSpellings, retiredScaleSpellings, scalesSchema, valueScaleOf, valueScaleSchema, } from './valueScaleConfigSchema.ts';
2
+ export type { ScalesConfigSchema, ValueScaleConfigSchema, ValueScaleOptions, ValueScaleRuleConfig, } from './valueScaleConfigSchema.ts';
3
3
  export { getNiceDomain, getNiceScale, getScale } from './scale.ts';
4
4
  export type { ScaleOpts } from './scale.ts';
5
5
  export { toP } from './formatNumber.ts';
@@ -11,7 +11,6 @@ export { DEFAULT_RULE_COLOR, SCORE_CAPTION_HEIGHT, YSCALEBAR_LABEL_OFFSET, } fro
11
11
  export { AXIS_GUTTER_WIDTH_PX, axisPlotBox, clampStrokeInsideAxis, scoreToAxisY, } from '@jbrowse/display-ui/yScaleTicks';
12
12
  export type { ValueScale, ValueScaleRule, YAxis, YScaleTicks, } from '@jbrowse/display-ui';
13
13
  export { computeYTicks } from './computeYTicks.ts';
14
- export { rowLabelOffset } from './rowLabelOffset.ts';
15
14
  export { resolveRenderState } from './resolveRenderState.ts';
16
15
  export { visibleStatsDomain, visibleStatsRange } from './visibleStatsDomain.ts';
17
16
  export type { SettledBlocksView, VisibleEntry, VisibleStatsDomainSpec, VisibleStatsRangeSpec, } from './visibleStatsDomain.ts';
@@ -23,10 +22,10 @@ export type { ScoreAxisMenuItemOptions, ScoreRulesModel, ScoreScaleModel, } from
23
22
  export { ScoreAxisMixin } from './ScoreAxisMixin.ts';
24
23
  export { ScoreScaleMixin } from './ScoreScaleMixin.ts';
25
24
  export type { ScoreScaleHost } from './ScoreScaleMixin.ts';
26
- export { WiggleScoreConfigMixin, wiggleScoreConfigExtraSlots, } from './WiggleScoreConfigMixin.ts';
25
+ export { WiggleScoreConfigMixin } from './WiggleScoreConfigMixin.ts';
27
26
  export type { WiggleScoreConfigHost } from './WiggleScoreConfigMixin.ts';
28
- export { ScoreFieldConfigMixin } from './ScoreFieldConfigMixin.ts';
29
- export { DEFAULT_SCORE_FIELD, scoreFieldConfigSchemaFields, } from './scoreFieldConfigSchemaFields.ts';
27
+ export { YFieldConfigMixin } from './YFieldConfigMixin.ts';
28
+ export { DEFAULT_SCORE_FIELD, yFieldConfigSchemaFields, } from './yFieldConfigSchemaFields.ts';
30
29
  export { MAX_WIGGLE_CUTS, MIN_FILL_WIDTH_PX, NO_PREV_START, RENDERING_TYPE_DENSITY, RENDERING_TYPE_LINE, RENDERING_TYPE_LINE_CENTER, RENDERING_TYPE_SCATTER, RENDERING_TYPE_XYPLOT, } from './renderingBackendTypes.ts';
31
30
  export type { SourceRenderData, WiggleGPURenderState, WiggleRenderingBackend, WiggleRenderingType, } from './renderingBackendTypes.ts';
32
31
  export type { SourceInfo, WiggleDataResult, WiggleFeatureArrays, WiggleSourceData, } from './dataTypes.ts';
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { retiredAxisSpellings, scalesSchema, valueScaleSchema, } from './valueScaleConfigSchema.js';
1
+ export { retiredAxisSpellings, retiredScaleSpellings, scalesSchema, valueScaleOf, valueScaleSchema, } from './valueScaleConfigSchema.js';
2
2
  export { getNiceDomain, getNiceScale, getScale } from './scale.js';
3
3
  export { toP } from './formatNumber.js';
4
4
  export { SCALE_TYPE_LINEAR, SCALE_TYPE_LOG, SCALE_TYPE_SYMLOG, makeScoreNormalizer, resolveSymlogConstant, } from './normalize.js';
@@ -11,7 +11,6 @@ export { axisDrawn } from '@jbrowse/display-ui/axisPlacement';
11
11
  export { DEFAULT_RULE_COLOR, SCORE_CAPTION_HEIGHT, YSCALEBAR_LABEL_OFFSET, } from '@jbrowse/display-ui/yAxisConstants';
12
12
  export { AXIS_GUTTER_WIDTH_PX, axisPlotBox, clampStrokeInsideAxis, scoreToAxisY, } from '@jbrowse/display-ui/yScaleTicks';
13
13
  export { computeYTicks } from './computeYTicks.js';
14
- export { rowLabelOffset } from './rowLabelOffset.js';
15
14
  export { resolveRenderState } from './resolveRenderState.js';
16
15
  export { visibleStatsDomain, visibleStatsRange } from './visibleStatsDomain.js';
17
16
  export { scoreRuleMarks, widenRangeToRules } from './scoreRuleMarks.js';
@@ -19,9 +18,9 @@ export { DEFAULT_POINT_DIAMETER_PX, SMALL_POINT_MAX_DIAMETER_PX, appendPointMark
19
18
  export { COVERAGE_AXIS_LABEL, SCORE_RANGE_LABEL, Y_AXIS_LABEL, makeScoreAxisMenuItem, } from './scoreMenuItems.js';
20
19
  export { ScoreAxisMixin } from './ScoreAxisMixin.js';
21
20
  export { ScoreScaleMixin } from './ScoreScaleMixin.js';
22
- export { WiggleScoreConfigMixin, wiggleScoreConfigExtraSlots, } from './WiggleScoreConfigMixin.js';
23
- export { ScoreFieldConfigMixin } from './ScoreFieldConfigMixin.js';
24
- export { DEFAULT_SCORE_FIELD, scoreFieldConfigSchemaFields, } from './scoreFieldConfigSchemaFields.js';
21
+ export { WiggleScoreConfigMixin } from './WiggleScoreConfigMixin.js';
22
+ export { YFieldConfigMixin } from './YFieldConfigMixin.js';
23
+ export { DEFAULT_SCORE_FIELD, yFieldConfigSchemaFields, } from './yFieldConfigSchemaFields.js';
25
24
  export { MAX_WIGGLE_CUTS, MIN_FILL_WIDTH_PX, NO_PREV_START, RENDERING_TYPE_DENSITY, RENDERING_TYPE_LINE, RENDERING_TYPE_LINE_CENTER, RENDERING_TYPE_SCATTER, RENDERING_TYPE_XYPLOT, } from './renderingBackendTypes.js';
26
25
  export {} from './displayModel.js';
27
26
  export { collectWiggleTransferables } from './transferables.js';
@@ -1,32 +1,20 @@
1
- import type { ConfigModelForFields } from '@jbrowse/core/configuration';
2
1
  import type { MenuItem } from '@jbrowse/core/ui';
3
- /** Where a display keeps its point size: the value shown, its default, and the write. */
4
- export interface PointSizeAccess {
5
- value: () => number;
6
- defaultValue: number;
7
- set: (n?: number) => void;
8
- }
9
- /**
10
- * The point size a display holding `WiggleScoreConfigMixin`'s `size` slot
11
- * shows and writes.
12
- */
13
- export declare function pointSizeAccess(self: {
14
- size: number;
15
- setSize: (n?: number) => void;
16
- configuration: ConfigModelForFields<{
17
- size: {
18
- type: 'number';
19
- defaultValue: number;
20
- };
21
- }>;
22
- }): PointSizeAccess;
2
+ import type { ElementType } from 'react';
23
3
  /**
24
- * A top-level submenu holding the point-size slider, or nothing where the plot
25
- * draws no points, so every score plot's menu resets and clamps alike.
4
+ * A top-level submenu holding a mark's size slider, or nothing where the plot
5
+ * draws no such mark, so every score plot's menu resets and clamps alike.
26
6
  * Top-level rather than under Score because the size describes the mark, not
27
7
  * the axis.
28
8
  */
29
- export declare function makePointSizeSubMenu({ label, applies, value, defaultValue, set, }: PointSizeAccess & {
9
+ export declare function makeMarkSizeSubMenu({ label, title, icon, applies, value, isDefault, set, min, max, step, }: {
30
10
  label: string;
11
+ title?: string;
12
+ icon?: ElementType;
31
13
  applies: boolean;
14
+ value: () => number;
15
+ isDefault: boolean;
16
+ set: (n?: number) => void;
17
+ min?: number;
18
+ max?: number;
19
+ step?: number;
32
20
  }): MenuItem[];
@@ -1,37 +1,26 @@
1
- import { getSlotDefinition } from '@jbrowse/core/configuration';
2
1
  import { makeSizeMenu } from '@jbrowse/core/ui';
3
2
  import ScatterPlotIcon from '@mui/icons-material/ScatterPlot';
4
3
  /**
5
- * The point size a display holding `WiggleScoreConfigMixin`'s `size` slot
6
- * shows and writes.
7
- */
8
- export function pointSizeAccess(self) {
9
- return {
10
- value: () => self.size,
11
- defaultValue: Number(getSlotDefinition(self.configuration, 'size').defaultValue),
12
- set: n => {
13
- self.setSize(n);
14
- },
15
- };
16
- }
17
- /**
18
- * A top-level submenu holding the point-size slider, or nothing where the plot
19
- * draws no points, so every score plot's menu resets and clamps alike.
4
+ * A top-level submenu holding a mark's size slider, or nothing where the plot
5
+ * draws no such mark, so every score plot's menu resets and clamps alike.
20
6
  * Top-level rather than under Score because the size describes the mark, not
21
7
  * the axis.
22
8
  */
23
- export function makePointSizeSubMenu({ label, applies, value, defaultValue, set, }) {
9
+ export function makeMarkSizeSubMenu({ label, title = 'Point size', icon = ScatterPlotIcon, applies, value, isDefault, set, min, max, step, }) {
24
10
  return applies
25
11
  ? [
26
12
  {
27
13
  label,
28
- icon: ScatterPlotIcon,
14
+ icon,
29
15
  subMenu: [
30
16
  makeSizeMenu({
31
17
  label,
32
- title: 'Point size',
18
+ title,
19
+ min,
20
+ max,
21
+ step,
33
22
  getValue: value,
34
- isDefault: value() === defaultValue,
23
+ isDefault,
35
24
  onChange: set,
36
25
  onReset: () => {
37
26
  set();
@@ -41,6 +41,7 @@ export interface SourceRenderData {
41
41
  colorsAbgr?: Uint32Array;
42
42
  negColor?: [number, number, number];
43
43
  gapLimitBp?: number;
44
+ gapScore?: number;
44
45
  band?: {
45
46
  minScores: Float32Array;
46
47
  };
@@ -27,6 +27,6 @@ export const NO_PREV_START = GENERATED_NO_PREV_START;
27
27
  // It was a `1.5` in each, kept together by a comment in each pointing at the
28
28
  // other.
29
29
  export const MIN_FILL_WIDTH_PX = GENERATED_MIN_FILL_WIDTH_PX;
30
- // The most cuts a threshold colour parts a plot at: the shader's uniform
30
+ // The most cuts a threshold color parts a plot at: the shader's uniform
31
31
  // block holds this many.
32
32
  export const MAX_WIGGLE_CUTS = GENERATED_MAX_WIGGLE_CUTS;
package/esm/scale.d.ts CHANGED
@@ -37,10 +37,11 @@ export declare function getScale({ domain, range, scaleType, symlogConstant, nic
37
37
  /**
38
38
  * #api
39
39
  * Rounds a domain to "nice" endpoints. `zero` reaches a linear or symlog
40
- * domain to 0 (`scales.y.zero`, ADR-182); a log domain has no 0 and floors at
41
- * 1 instead. An end given an explicit `bounds` value keeps that value exactly
42
- * — only an autoscaled end is rounded. A log scale's floor still outranks a
43
- * bound it cannot hold.
40
+ * domain to 0 (`scales.y.zero`, ADR-182); a log domain has no 0, so a min at
41
+ * or below it floors to a positive value and a positive min stays where the
42
+ * data put it. An end given an explicit `bounds` value keeps that value
43
+ * exactly — only an autoscaled end is rounded. A log scale's floor still
44
+ * outranks a bound it cannot hold, which the `log-floor` rule reports.
44
45
  *
45
46
  * The result never descends and never collapses: a bound that would put `min`
46
47
  * above `max` widens the other end instead, and one value in view widens
package/esm/scale.js CHANGED
@@ -65,10 +65,11 @@ export function getScale({ domain, range, scaleType, symlogConstant, nice = true
65
65
  /**
66
66
  * #api
67
67
  * Rounds a domain to "nice" endpoints. `zero` reaches a linear or symlog
68
- * domain to 0 (`scales.y.zero`, ADR-182); a log domain has no 0 and floors at
69
- * 1 instead. An end given an explicit `bounds` value keeps that value exactly
70
- * — only an autoscaled end is rounded. A log scale's floor still outranks a
71
- * bound it cannot hold.
68
+ * domain to 0 (`scales.y.zero`, ADR-182); a log domain has no 0, so a min at
69
+ * or below it floors to a positive value and a positive min stays where the
70
+ * data put it. An end given an explicit `bounds` value keeps that value
71
+ * exactly — only an autoscaled end is rounded. A log scale's floor still
72
+ * outranks a bound it cannot hold, which the `log-floor` rule reports.
72
73
  *
73
74
  * The result never descends and never collapses: a bound that would put `min`
74
75
  * above `max` widens the other end instead, and one value in view widens
@@ -92,11 +93,6 @@ export function getNiceDomain({ scaleType, domain, bounds, zero, }) {
92
93
  min = 0;
93
94
  }
94
95
  }
95
- if (scaleType === 'log') {
96
- if (min >= 0 && max > 1) {
97
- min = 1;
98
- }
99
- }
100
96
  if (minScore !== undefined) {
101
97
  min = minScore;
102
98
  }
@@ -41,7 +41,7 @@ export type ValueScaleRuleConfig = Instance<ReturnType<typeof valueScaleRuleSche
41
41
  *
42
42
  * Every scale carries the same guides: `rules`, reference lines at chosen
43
43
  * values, `grid`, a line at every tick, `minimalTicks`, and `title`, the
44
- * 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
45
45
  * the chrome rules every plot in, so a red line is a claim its author makes
46
46
  * rather than a meaning a display assigns.
47
47
  *
@@ -180,6 +180,81 @@ export declare const retiredAxisSpellings: {
180
180
  };
181
181
  };
182
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
+ };
183
258
  /**
184
259
  * The `scales` object a display declares, one member per aesthetic the
185
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
@@ -56,7 +57,7 @@ function valueScaleRuleSchema() {
56
57
  *
57
58
  * Every scale carries the same guides: `rules`, reference lines at chosen
58
59
  * values, `grid`, a line at every tick, `minimalTicks`, and `title`, the
59
- * 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
60
61
  * the chrome rules every plot in, so a red line is a claim its author makes
61
62
  * rather than a meaning a display assigns.
62
63
  *
@@ -117,8 +118,8 @@ export function valueScaleSchema({ domainQuantile = 1, symlogConstant = 0, } = {
117
118
  return ConfigurationSchema('ValueScale', {
118
119
  /**
119
120
  * #slot scales.y.type
120
- * How the axis reads its domain — the ticks, the cross-hatches and the
121
- * 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
122
123
  * negative values and floors the domain above them; `symlog` is log-like
123
124
  * away from zero and linear through it, so a track whose values touch or
124
125
  * cross 0 keeps them.
@@ -156,7 +157,7 @@ export function valueScaleSchema({ domainQuantile = 1, symlogConstant = 0, } = {
156
157
  * 30 and 60 draws 0 to 60, and a bar always shows its whole height.
157
158
  * Off, the axis spans the values alone. A pinned end is unmoved either
158
159
  * way, a log axis has no 0, and a density plot, which maps score to
159
- * colour and has no axis, spans its values whatever this says.
160
+ * color and has no axis, spans its values whatever this says.
160
161
  * The Y axis panel's "Include 0" toggles it.
161
162
  */
162
163
  zero: {
@@ -192,15 +193,15 @@ export function valueScaleSchema({ domainQuantile = 1, symlogConstant = 0, } = {
192
193
  },
193
194
  /**
194
195
  * #slot scales.y.domainQuantile
195
- * Where an unpinned end's outliers are fenced. An end follows the
196
+ * The fence for an unpinned end's outliers. An end follows the
196
197
  * loaded values' extreme; below `1`, an extreme that would stretch the
197
198
  * axis past twice the span this quantile of the values draws stops at
198
199
  * that fence, and the bars past it wear the red clip strip. So `0.99`
199
200
  * leaves a plot with no spike whole and keeps one spike from flattening
200
201
  * the rest. Each end's quantile is measured among the values on its side
201
202
  * of 0, so a sparse minority tail stays visible, and the span includes 0
202
- * where `zero` reaches it. A colour ramp's `domainQuantile` clips at the
203
- * quantile itself, since a saturated colour hides nothing its key does
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
204
205
  * not say. The Y axis panel's "Clip extreme outliers" toggles it.
205
206
  */
206
207
  domainQuantile: {
@@ -262,6 +263,43 @@ export const retiredAxisSpellings = {
262
263
  scales: { y: { minimalTicks } },
263
264
  }),
264
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
+ };
265
303
  /**
266
304
  * The `scales` object a display declares, one member per aesthetic the
267
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.13",
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": [
@@ -33,15 +33,15 @@
33
33
  "esm"
34
34
  ],
35
35
  "dependencies": {
36
- "@jbrowse/mobx-state-tree": "^6.7.0",
37
- "@mui/icons-material": "^9.4.0",
38
- "@mui/material": "^9.4.0",
36
+ "@jbrowse/mobx-state-tree": "^6.9.0",
37
+ "@mui/icons-material": "^9.5.0",
38
+ "@mui/material": "^9.5.0",
39
39
  "mobx": "^7.0.6",
40
40
  "mobx-react": "^10.0.2",
41
- "@jbrowse/core": "^5.0.0-beta.13",
42
- "@jbrowse/display-kit": "^5.0.0-beta.13",
43
- "@jbrowse/render-core": "^5.0.0-beta.13",
44
- "@jbrowse/display-ui": "^5.0.0-beta.13"
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"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "react": ">=19.0.0",
@@ -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,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;