@jbrowse/wiggle-core 5.0.0-beta.1 → 5.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -107
- package/esm/AutoscaleGroupDialog.d.ts +7 -0
- package/esm/AutoscaleGroupDialog.js +26 -0
- package/esm/ScoreAxisMixin.d.ts +134 -0
- package/esm/ScoreAxisMixin.js +213 -0
- package/esm/ScoreFieldConfigMixin.d.ts +72 -0
- package/esm/ScoreFieldConfigMixin.js +25 -0
- package/esm/ScorePlotChrome.d.ts +45 -0
- package/esm/ScorePlotChrome.js +47 -0
- package/esm/ScorePlotSvgFrame.d.ts +27 -0
- package/esm/ScorePlotSvgFrame.js +23 -0
- package/esm/ScoreScaleMixin.d.ts +113 -50
- package/esm/ScoreScaleMixin.js +148 -70
- package/esm/SetMinMaxDialog.d.ts +3 -2
- package/esm/SetMinMaxDialog.js +20 -6
- package/esm/SetScoreRulesDialog.d.ts +14 -0
- package/esm/SetScoreRulesDialog.js +45 -0
- package/esm/WiggleScoreConfigMixin.d.ts +89 -0
- package/esm/WiggleScoreConfigMixin.js +54 -0
- package/esm/autoscale.d.ts +54 -14
- package/esm/autoscale.js +105 -180
- package/esm/autoscaleGroup.d.ts +30 -0
- package/esm/autoscaleGroup.js +97 -0
- package/esm/chrome.d.ts +5 -0
- package/esm/chrome.js +7 -0
- package/esm/computeYTicks.d.ts +1 -1
- package/esm/computeYTicks.js +4 -3
- package/esm/constants.d.ts +1 -2
- package/esm/constants.js +1 -10
- package/esm/dataTypes.d.ts +4 -6
- package/esm/displayModel.d.ts +1 -2
- package/esm/gapBreak.d.ts +2 -3
- package/esm/gapBreak.js +2 -3
- package/esm/index.d.ts +24 -25
- package/esm/index.js +20 -18
- package/esm/normalize.d.ts +1 -26
- package/esm/normalize.js +1 -86
- package/esm/pointMarker.d.ts +7 -2
- package/esm/pointMarker.js +14 -18
- package/esm/pointSizeMenu.d.ts +30 -11
- package/esm/pointSizeMenu.js +42 -19
- package/esm/renderingBackendTypes.d.ts +13 -4
- package/esm/renderingBackendTypes.js +4 -1
- package/esm/rowLabelOffset.d.ts +8 -0
- package/esm/rowLabelOffset.js +16 -0
- package/esm/scale.d.ts +12 -8
- package/esm/scale.js +27 -14
- package/esm/scoreFieldConfigSchemaFields.d.ts +10 -0
- package/esm/scoreFieldConfigSchemaFields.js +8 -0
- package/esm/scoreMenuItems.d.ts +35 -16
- package/esm/scoreMenuItems.js +95 -62
- package/esm/scoreRuleMarks.d.ts +14 -39
- package/esm/scoreRuleMarks.js +12 -45
- package/esm/transferables.js +4 -9
- package/esm/valueScaleConfigSchema.d.ts +253 -0
- package/esm/valueScaleConfigSchema.js +270 -0
- package/esm/visibleStatsDomain.d.ts +20 -8
- package/esm/visibleStatsDomain.js +32 -27
- package/esm/wiggleRenderModes.generated.d.ts +1 -2
- package/esm/wiggleRenderModes.generated.js +1 -2
- package/package.json +14 -9
- package/esm/CrossHatches.d.ts +0 -11
- package/esm/CrossHatches.js +0 -32
- package/esm/ScoreRules.d.ts +0 -11
- package/esm/ScoreRules.js +0 -37
- package/esm/YScaleBar.d.ts +0 -6
- package/esm/YScaleBar.js +0 -46
- package/esm/YScaleBarOverlay.d.ts +0 -6
- package/esm/YScaleBarOverlay.js +0 -24
- package/esm/scoreAxisConfigSchemaFields.d.ts +0 -44
- package/esm/scoreAxisConfigSchemaFields.js +0 -54
- package/esm/yScaleTicks.d.ts +0 -59
- package/esm/yScaleTicks.js +0 -59
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type { Instance } from '@jbrowse/mobx-state-tree';
|
|
2
|
+
export declare const VALUE_SCALE_TYPES: readonly ['linear', 'log', 'symlog'];
|
|
3
|
+
export interface ValueScaleOptions {
|
|
4
|
+
/** `domainQuantile`'s default: 1 follows the extremes, 0.99 clips the outermost 1% */
|
|
5
|
+
domainQuantile?: number;
|
|
6
|
+
/** `symlogConstant`'s default */
|
|
7
|
+
symlogConstant?: number;
|
|
8
|
+
}
|
|
9
|
+
declare function valueScaleRuleSchema(): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
10
|
+
readonly value: {
|
|
11
|
+
type: "number";
|
|
12
|
+
} & {
|
|
13
|
+
defaultValue: number;
|
|
14
|
+
};
|
|
15
|
+
readonly color: {
|
|
16
|
+
type: "maybeColor";
|
|
17
|
+
};
|
|
18
|
+
readonly label: {
|
|
19
|
+
type: "string";
|
|
20
|
+
} & {
|
|
21
|
+
defaultValue: string;
|
|
22
|
+
};
|
|
23
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
|
|
24
|
+
export type ValueScaleRuleConfig = Instance<ReturnType<typeof valueScaleRuleSchema>>;
|
|
25
|
+
/**
|
|
26
|
+
* #config ValueScale
|
|
27
|
+
* #category display
|
|
28
|
+
* The value scale of a quantitative display, written as `scales.y`: the
|
|
29
|
+
* wiggle plot, the alignments coverage band and the mark display, the
|
|
30
|
+
* Manhattan plot among them, each carry one, with the axis guides it draws —
|
|
31
|
+
* its ticks, its `grid`, its `rules` and its `title`.
|
|
32
|
+
*
|
|
33
|
+
* Vega-Lite's spelling: a pinned end is `domainMin` or `domainMax`, an end
|
|
34
|
+
* left unset autoscales over the loaded regions, and `zero` says whether an
|
|
35
|
+
* autoscaled linear or symlog axis reaches 0 whatever those regions hold.
|
|
36
|
+
*
|
|
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
|
|
41
|
+
* display and at `1` on the coverage band.
|
|
42
|
+
*
|
|
43
|
+
* Every scale carries the same guides: `rules`, reference lines at chosen
|
|
44
|
+
* 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
|
|
46
|
+
* the chrome rules every plot in, so a red line is a claim its author makes
|
|
47
|
+
* rather than a meaning a display assigns.
|
|
48
|
+
*
|
|
49
|
+
* #example
|
|
50
|
+
* A log axis floored at 1:
|
|
51
|
+
* ```js
|
|
52
|
+
* {
|
|
53
|
+
* type: 'LinearWiggleDisplay',
|
|
54
|
+
* scales: { y: { type: 'log', domainMin: 1 } },
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* #example
|
|
59
|
+
* A GC line plot whose axis spans the loaded values, 30 to 60%:
|
|
60
|
+
* ```js
|
|
61
|
+
* {
|
|
62
|
+
* type: 'LinearWiggleDisplay',
|
|
63
|
+
* scales: { y: { zero: false } },
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* #example
|
|
68
|
+
* The whole visible range, rather than the 99th percentile the wiggle
|
|
69
|
+
* displays start on:
|
|
70
|
+
* ```js
|
|
71
|
+
* {
|
|
72
|
+
* type: 'LinearWiggleDisplay',
|
|
73
|
+
* scales: { y: { domainQuantile: 1 } },
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* #example
|
|
78
|
+
* Three samples' coverage on one axis that still follows the data, each
|
|
79
|
+
* track's display naming the same group:
|
|
80
|
+
* ```js
|
|
81
|
+
* {
|
|
82
|
+
* type: 'LinearAlignmentsDisplay',
|
|
83
|
+
* scales: { y: { autoscaleGroup: 'depth' } },
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* #example
|
|
88
|
+
* A titled axis with a labelled genome-wide threshold over a plain
|
|
89
|
+
* suggestive one:
|
|
90
|
+
* ```js
|
|
91
|
+
* {
|
|
92
|
+
* type: 'LinearMarkDisplay',
|
|
93
|
+
* scales: {
|
|
94
|
+
* y: {
|
|
95
|
+
* title: '-log10 p',
|
|
96
|
+
* rules: [{ value: 7.3, color: 'red', label: 'p = 5e-8' }, 5],
|
|
97
|
+
* },
|
|
98
|
+
* },
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare function valueScaleSchema({ domainQuantile, symlogConstant, }?: ValueScaleOptions): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
103
|
+
readonly type: {
|
|
104
|
+
type: "stringEnum";
|
|
105
|
+
} & {
|
|
106
|
+
model: import("@jbrowse/mobx-state-tree").ISimpleType<"linear" | "log" | "symlog">;
|
|
107
|
+
} & {
|
|
108
|
+
defaultValue: string;
|
|
109
|
+
};
|
|
110
|
+
readonly domainMin: {
|
|
111
|
+
type: "maybeNumber";
|
|
112
|
+
};
|
|
113
|
+
readonly domainMax: {
|
|
114
|
+
type: "maybeNumber";
|
|
115
|
+
};
|
|
116
|
+
readonly zero: {
|
|
117
|
+
type: "boolean";
|
|
118
|
+
} & {
|
|
119
|
+
defaultValue: boolean;
|
|
120
|
+
};
|
|
121
|
+
readonly autoscaleGroup: {
|
|
122
|
+
type: "maybeString";
|
|
123
|
+
};
|
|
124
|
+
readonly symlogConstant: {
|
|
125
|
+
type: "number";
|
|
126
|
+
} & {
|
|
127
|
+
defaultValue: number;
|
|
128
|
+
};
|
|
129
|
+
readonly domainQuantile: {
|
|
130
|
+
type: "number";
|
|
131
|
+
} & {
|
|
132
|
+
defaultValue: number;
|
|
133
|
+
};
|
|
134
|
+
readonly grid: {
|
|
135
|
+
type: "boolean";
|
|
136
|
+
} & {
|
|
137
|
+
defaultValue: boolean;
|
|
138
|
+
};
|
|
139
|
+
readonly minimalTicks: {
|
|
140
|
+
type: "boolean";
|
|
141
|
+
} & {
|
|
142
|
+
defaultValue: boolean;
|
|
143
|
+
};
|
|
144
|
+
readonly title: {
|
|
145
|
+
type: "maybeString";
|
|
146
|
+
};
|
|
147
|
+
readonly rules: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
148
|
+
readonly value: {
|
|
149
|
+
type: "number";
|
|
150
|
+
} & {
|
|
151
|
+
defaultValue: number;
|
|
152
|
+
};
|
|
153
|
+
readonly color: {
|
|
154
|
+
type: "maybeColor";
|
|
155
|
+
};
|
|
156
|
+
readonly label: {
|
|
157
|
+
type: "string";
|
|
158
|
+
} & {
|
|
159
|
+
defaultValue: string;
|
|
160
|
+
};
|
|
161
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>;
|
|
162
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
|
|
163
|
+
export type ValueScaleConfigSchema = ReturnType<typeof valueScaleSchema>;
|
|
164
|
+
/**
|
|
165
|
+
* The axis guides v4 spelt on the display, as `retired` declares them on each
|
|
166
|
+
* display whose scale took them over.
|
|
167
|
+
*/
|
|
168
|
+
export declare const retiredAxisSpellings: {
|
|
169
|
+
displayCrossHatches: (grid: unknown) => {
|
|
170
|
+
scales: {
|
|
171
|
+
y: {
|
|
172
|
+
grid: unknown;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
minimalTicks: (minimalTicks: unknown) => {
|
|
177
|
+
scales: {
|
|
178
|
+
y: {
|
|
179
|
+
minimalTicks: unknown;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* The `scales` object a display declares, one member per aesthetic the
|
|
186
|
+
* grammar gives a scale. `y` is the only one so far, and every mark, bar or
|
|
187
|
+
* bin the display draws is placed through it.
|
|
188
|
+
*/
|
|
189
|
+
export declare function scalesSchema(y: ValueScaleConfigSchema): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
190
|
+
readonly y: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
191
|
+
readonly type: {
|
|
192
|
+
type: "stringEnum";
|
|
193
|
+
} & {
|
|
194
|
+
model: import("@jbrowse/mobx-state-tree").ISimpleType<"linear" | "log" | "symlog">;
|
|
195
|
+
} & {
|
|
196
|
+
defaultValue: string;
|
|
197
|
+
};
|
|
198
|
+
readonly domainMin: {
|
|
199
|
+
type: "maybeNumber";
|
|
200
|
+
};
|
|
201
|
+
readonly domainMax: {
|
|
202
|
+
type: "maybeNumber";
|
|
203
|
+
};
|
|
204
|
+
readonly zero: {
|
|
205
|
+
type: "boolean";
|
|
206
|
+
} & {
|
|
207
|
+
defaultValue: boolean;
|
|
208
|
+
};
|
|
209
|
+
readonly autoscaleGroup: {
|
|
210
|
+
type: "maybeString";
|
|
211
|
+
};
|
|
212
|
+
readonly symlogConstant: {
|
|
213
|
+
type: "number";
|
|
214
|
+
} & {
|
|
215
|
+
defaultValue: number;
|
|
216
|
+
};
|
|
217
|
+
readonly domainQuantile: {
|
|
218
|
+
type: "number";
|
|
219
|
+
} & {
|
|
220
|
+
defaultValue: number;
|
|
221
|
+
};
|
|
222
|
+
readonly grid: {
|
|
223
|
+
type: "boolean";
|
|
224
|
+
} & {
|
|
225
|
+
defaultValue: boolean;
|
|
226
|
+
};
|
|
227
|
+
readonly minimalTicks: {
|
|
228
|
+
type: "boolean";
|
|
229
|
+
} & {
|
|
230
|
+
defaultValue: boolean;
|
|
231
|
+
};
|
|
232
|
+
readonly title: {
|
|
233
|
+
type: "maybeString";
|
|
234
|
+
};
|
|
235
|
+
readonly rules: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
236
|
+
readonly value: {
|
|
237
|
+
type: "number";
|
|
238
|
+
} & {
|
|
239
|
+
defaultValue: number;
|
|
240
|
+
};
|
|
241
|
+
readonly color: {
|
|
242
|
+
type: "maybeColor";
|
|
243
|
+
};
|
|
244
|
+
readonly label: {
|
|
245
|
+
type: "string";
|
|
246
|
+
} & {
|
|
247
|
+
defaultValue: string;
|
|
248
|
+
};
|
|
249
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>>;
|
|
250
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
|
|
251
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, undefined, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
|
|
252
|
+
export type ScalesConfigSchema = ReturnType<typeof scalesSchema>;
|
|
253
|
+
export {};
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
|
+
import { types } from '@jbrowse/mobx-state-tree';
|
|
3
|
+
export const VALUE_SCALE_TYPES = ['linear', 'log', 'symlog'];
|
|
4
|
+
function valueScaleRuleSchema() {
|
|
5
|
+
return ConfigurationSchema('ValueScaleRule', {
|
|
6
|
+
/**
|
|
7
|
+
* #slot scales.y.rules.value
|
|
8
|
+
* Where the rule sits on the axis, in the units the axis plots: a
|
|
9
|
+
* `-log10(p)` over a Manhattan plot, a depth over coverage.
|
|
10
|
+
*/
|
|
11
|
+
value: {
|
|
12
|
+
type: 'number',
|
|
13
|
+
defaultValue: 0,
|
|
14
|
+
description: 'the value the rule is drawn at',
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* #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
|
|
20
|
+
* particular — genome-wide significance, a diploid depth — is one an
|
|
21
|
+
* author paints, on the plot where it means it.
|
|
22
|
+
*/
|
|
23
|
+
color: {
|
|
24
|
+
type: 'maybeColor',
|
|
25
|
+
description: 'line and label colour; unset is the chrome’s own',
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* #slot scales.y.rules.label
|
|
29
|
+
* Free text drawn at the rule's right-hand end. JBrowse assigns it no
|
|
30
|
+
* meaning: "2 copies" over a coverage plot is a claim only the author
|
|
31
|
+
* can make, since no ploidy can be assumed.
|
|
32
|
+
*/
|
|
33
|
+
label: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
defaultValue: '',
|
|
36
|
+
description: "text at the rule's right-hand end",
|
|
37
|
+
},
|
|
38
|
+
}, { shorthand: 'value', closed: true });
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* #config ValueScale
|
|
42
|
+
* #category display
|
|
43
|
+
* The value scale of a quantitative display, written as `scales.y`: the
|
|
44
|
+
* wiggle plot, the alignments coverage band and the mark display, the
|
|
45
|
+
* Manhattan plot among them, each carry one, with the axis guides it draws —
|
|
46
|
+
* its ticks, its `grid`, its `rules` and its `title`.
|
|
47
|
+
*
|
|
48
|
+
* Vega-Lite's spelling: a pinned end is `domainMin` or `domainMax`, an end
|
|
49
|
+
* left unset autoscales over the loaded regions, and `zero` says whether an
|
|
50
|
+
* autoscaled linear or symlog axis reaches 0 whatever those regions hold.
|
|
51
|
+
*
|
|
52
|
+
* 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
|
|
56
|
+
* display and at `1` on the coverage band.
|
|
57
|
+
*
|
|
58
|
+
* Every scale carries the same guides: `rules`, reference lines at chosen
|
|
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
|
|
61
|
+
* the chrome rules every plot in, so a red line is a claim its author makes
|
|
62
|
+
* rather than a meaning a display assigns.
|
|
63
|
+
*
|
|
64
|
+
* #example
|
|
65
|
+
* A log axis floored at 1:
|
|
66
|
+
* ```js
|
|
67
|
+
* {
|
|
68
|
+
* type: 'LinearWiggleDisplay',
|
|
69
|
+
* scales: { y: { type: 'log', domainMin: 1 } },
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* #example
|
|
74
|
+
* A GC line plot whose axis spans the loaded values, 30 to 60%:
|
|
75
|
+
* ```js
|
|
76
|
+
* {
|
|
77
|
+
* type: 'LinearWiggleDisplay',
|
|
78
|
+
* scales: { y: { zero: false } },
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* #example
|
|
83
|
+
* The whole visible range, rather than the 99th percentile the wiggle
|
|
84
|
+
* displays start on:
|
|
85
|
+
* ```js
|
|
86
|
+
* {
|
|
87
|
+
* type: 'LinearWiggleDisplay',
|
|
88
|
+
* scales: { y: { domainQuantile: 1 } },
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* #example
|
|
93
|
+
* Three samples' coverage on one axis that still follows the data, each
|
|
94
|
+
* track's display naming the same group:
|
|
95
|
+
* ```js
|
|
96
|
+
* {
|
|
97
|
+
* type: 'LinearAlignmentsDisplay',
|
|
98
|
+
* scales: { y: { autoscaleGroup: 'depth' } },
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* #example
|
|
103
|
+
* A titled axis with a labelled genome-wide threshold over a plain
|
|
104
|
+
* suggestive one:
|
|
105
|
+
* ```js
|
|
106
|
+
* {
|
|
107
|
+
* type: 'LinearMarkDisplay',
|
|
108
|
+
* scales: {
|
|
109
|
+
* y: {
|
|
110
|
+
* title: '-log10 p',
|
|
111
|
+
* rules: [{ value: 7.3, color: 'red', label: 'p = 5e-8' }, 5],
|
|
112
|
+
* },
|
|
113
|
+
* },
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export function valueScaleSchema({ domainQuantile = 1, symlogConstant = 0, } = {}) {
|
|
118
|
+
return ConfigurationSchema('ValueScale', {
|
|
119
|
+
/**
|
|
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
|
|
123
|
+
* negative values and floors the domain above them; `symlog` is log-like
|
|
124
|
+
* away from zero and linear through it, so a track whose values touch or
|
|
125
|
+
* cross 0 keeps them.
|
|
126
|
+
*/
|
|
127
|
+
// #region stringEnumSlot
|
|
128
|
+
type: {
|
|
129
|
+
type: 'stringEnum',
|
|
130
|
+
model: types.enumeration('ValueScaleType', [...VALUE_SCALE_TYPES]),
|
|
131
|
+
defaultValue: 'linear',
|
|
132
|
+
description: VALUE_SCALE_TYPES.join(' or '),
|
|
133
|
+
},
|
|
134
|
+
// #endregion
|
|
135
|
+
/**
|
|
136
|
+
* #slot scales.y.domainMin
|
|
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.
|
|
140
|
+
*/
|
|
141
|
+
domainMin: {
|
|
142
|
+
type: 'maybeNumber',
|
|
143
|
+
description: 'pinned bottom of the axis; unset autoscales',
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* #slot scales.y.domainMax
|
|
147
|
+
* The top of the axis. Unset autoscales that end.
|
|
148
|
+
*/
|
|
149
|
+
domainMax: {
|
|
150
|
+
type: 'maybeNumber',
|
|
151
|
+
description: 'pinned top of the axis; unset autoscales',
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* #slot scales.y.zero
|
|
155
|
+
* Whether an autoscaled linear or symlog axis reaches 0 whatever the
|
|
156
|
+
* loaded values span, Vega-Lite's `zero`. On, a plot of values between
|
|
157
|
+
* 30 and 60 draws 0 to 60, and a bar always shows its whole height.
|
|
158
|
+
* Off, the axis spans the values alone. A pinned end is unmoved either
|
|
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.
|
|
162
|
+
*/
|
|
163
|
+
zero: {
|
|
164
|
+
type: 'boolean',
|
|
165
|
+
defaultValue: true,
|
|
166
|
+
description: 'an autoscaled linear or symlog axis reaches 0; off, it spans the loaded values',
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* #slot scales.y.autoscaleGroup
|
|
170
|
+
* A name shared by the tracks whose axes autoscale together: each
|
|
171
|
+
* unpinned end spans the data of every track in the view naming the
|
|
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.
|
|
175
|
+
*/
|
|
176
|
+
autoscaleGroup: {
|
|
177
|
+
type: 'maybeString',
|
|
178
|
+
description: 'tracks naming one group autoscale together',
|
|
179
|
+
},
|
|
180
|
+
/**
|
|
181
|
+
* #slot scales.y.symlogConstant
|
|
182
|
+
* Width of symlog's linear region around zero. `0` derives it from
|
|
183
|
+
* the domain, a thousandth of its largest magnitude — right for a
|
|
184
|
+
* wiggle track, whose units are its own. The coverage band starts
|
|
185
|
+
* at `1` instead, which makes symlog exactly `log(depth+1)` and
|
|
186
|
+
* puts the knee at one read.
|
|
187
|
+
*/
|
|
188
|
+
symlogConstant: {
|
|
189
|
+
type: 'number',
|
|
190
|
+
defaultValue: symlogConstant,
|
|
191
|
+
description: "width of symlog's linear region around zero",
|
|
192
|
+
advanced: true,
|
|
193
|
+
},
|
|
194
|
+
/**
|
|
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.
|
|
203
|
+
*/
|
|
204
|
+
domainQuantile: {
|
|
205
|
+
type: 'number',
|
|
206
|
+
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',
|
|
208
|
+
},
|
|
209
|
+
/**
|
|
210
|
+
* #slot scales.y.grid
|
|
211
|
+
* 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.
|
|
214
|
+
*/
|
|
215
|
+
grid: {
|
|
216
|
+
type: 'boolean',
|
|
217
|
+
defaultValue: false,
|
|
218
|
+
description: 'rule the plot at the tick positions',
|
|
219
|
+
},
|
|
220
|
+
/**
|
|
221
|
+
* #slot scales.y.minimalTicks
|
|
222
|
+
* Label only the two ends of the axis.
|
|
223
|
+
*/
|
|
224
|
+
minimalTicks: {
|
|
225
|
+
type: 'boolean',
|
|
226
|
+
defaultValue: false,
|
|
227
|
+
description: 'label only the ends of the axis',
|
|
228
|
+
advanced: true,
|
|
229
|
+
},
|
|
230
|
+
/**
|
|
231
|
+
* #slot scales.y.title
|
|
232
|
+
* The caption beside the axis, naming what it measures, drawn
|
|
233
|
+
* once however many bands the scale rules and at every zoom.
|
|
234
|
+
* Optional, as JBrowse's other captions are: unset, `""` or
|
|
235
|
+
* `null`, the axis has none; some text is that text.
|
|
236
|
+
*/
|
|
237
|
+
title: {
|
|
238
|
+
type: 'maybeString',
|
|
239
|
+
description: 'axis caption; unset draws none',
|
|
240
|
+
},
|
|
241
|
+
/**
|
|
242
|
+
* #slot scales.y.rules
|
|
243
|
+
* Horizontal reference lines at chosen values, across every band
|
|
244
|
+
* the scale rules: a significance threshold, a zero line, an
|
|
245
|
+
* allele-frequency cut. Each is `{ value, color, label }`, or a
|
|
246
|
+
* bare number for a plain line. An autoscaled end widens to keep
|
|
247
|
+
* every rule on the axis; a pinned `domainMin` or `domainMax`
|
|
248
|
+
* that excludes a rule drops it.
|
|
249
|
+
*/
|
|
250
|
+
rules: types.array(valueScaleRuleSchema()),
|
|
251
|
+
}, { closed: true });
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* The axis guides v4 spelt on the display, as `retired` declares them on each
|
|
255
|
+
* display whose scale took them over.
|
|
256
|
+
*/
|
|
257
|
+
export const retiredAxisSpellings = {
|
|
258
|
+
displayCrossHatches: (grid) => ({ scales: { y: { grid } } }),
|
|
259
|
+
minimalTicks: (minimalTicks) => ({
|
|
260
|
+
scales: { y: { minimalTicks } },
|
|
261
|
+
}),
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* The `scales` object a display declares, one member per aesthetic the
|
|
265
|
+
* grammar gives a scale. `y` is the only one so far, and every mark, bar or
|
|
266
|
+
* bin the display draws is placed through it.
|
|
267
|
+
*/
|
|
268
|
+
export function scalesSchema(y) {
|
|
269
|
+
return ConfigurationSchema('Scales', { y }, { closed: true });
|
|
270
|
+
}
|
|
@@ -17,7 +17,7 @@ export interface VisibleEntry<T> {
|
|
|
17
17
|
* `coarseDynamicBlocks`: over the empty initial coarse list every walker below
|
|
18
18
|
* yields no entries, and no entries is not a stale domain but the caller's
|
|
19
19
|
* `[0, 1]` fallback — a bigwig line track drew blank and a density track solid.
|
|
20
|
-
*
|
|
20
|
+
* reference/FETCH_SKELETON.md, "Every fetch autorun runs on the leading edge".
|
|
21
21
|
*/
|
|
22
22
|
export interface SettledBlocksView {
|
|
23
23
|
initialized: boolean;
|
|
@@ -34,7 +34,7 @@ export interface SettledBlocksView {
|
|
|
34
34
|
* are in scope, how those pieces reduce to stats, and what an autoscale mode
|
|
35
35
|
* makes of the stats.
|
|
36
36
|
*/
|
|
37
|
-
export interface
|
|
37
|
+
export interface VisibleStatsRangeSpec<Payload, Item, Stats> {
|
|
38
38
|
/** false when the band this domain scales is not drawn: nothing is walked */
|
|
39
39
|
active: boolean;
|
|
40
40
|
view: SettledBlocksView;
|
|
@@ -44,16 +44,28 @@ export interface VisibleStatsDomainSpec<Payload, Item, Stats> {
|
|
|
44
44
|
accumulate: (entries: VisibleEntry<Item>[]) => Stats | undefined;
|
|
45
45
|
/** stats to a raw `[min, max]`, before bounds and nice-rounding */
|
|
46
46
|
range: (stats: Stats, entries: VisibleEntry<Item>[]) => [number, number];
|
|
47
|
+
}
|
|
48
|
+
/** {@link VisibleStatsRangeSpec} and what nice-rounds its range into a domain. */
|
|
49
|
+
export interface VisibleStatsDomainSpec<Payload, Item, Stats> extends VisibleStatsRangeSpec<Payload, Item, Stats> {
|
|
47
50
|
/** `ScoreScaleMixin`'s resolved bounds; `undefined` autoscales that end */
|
|
48
51
|
bounds: readonly [number | undefined, number | undefined];
|
|
49
52
|
scaleType: string;
|
|
53
|
+
/** whether a linear or symlog domain reaches 0 (`scales.y.zero`) */
|
|
54
|
+
zero: boolean;
|
|
50
55
|
}
|
|
51
56
|
/**
|
|
52
57
|
* #api
|
|
53
|
-
* The
|
|
54
|
-
* blocks, accumulate the stats of what each one
|
|
55
|
-
*
|
|
56
|
-
* nothing to scale against — no data, a hidden
|
|
57
|
-
* initialized — which every caller distinguishes
|
|
58
|
+
* The raw autoscaled range the displays with a value scale derive
|
|
59
|
+
* identically: walk the settled blocks, accumulate the stats of what each one
|
|
60
|
+
* shows, and reduce them to `[min, max]` before any bound or nice-rounding.
|
|
61
|
+
* `undefined` while there is nothing to scale against — no data, a hidden
|
|
62
|
+
* band, or a view that has not initialized — which every caller distinguishes
|
|
63
|
+
* from a range.
|
|
64
|
+
*/
|
|
65
|
+
export declare function visibleStatsRange<Payload, Item, Stats>({ active, view, payloadFor, itemsFor, accumulate, range, }: VisibleStatsRangeSpec<Payload, Item, Stats>): [number, number] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* #api
|
|
68
|
+
* {@link visibleStatsRange} nice-rounded inside the configured bounds: the
|
|
69
|
+
* domain of a display whose range is its own alone.
|
|
58
70
|
*/
|
|
59
|
-
export declare function visibleStatsDomain<Payload, Item, Stats>({
|
|
71
|
+
export declare function visibleStatsDomain<Payload, Item, Stats>({ bounds, scaleType, zero, ...spec }: VisibleStatsDomainSpec<Payload, Item, Stats>): [number, number] | undefined;
|
|
@@ -1,33 +1,38 @@
|
|
|
1
1
|
import { getNiceDomain } from './scale.js';
|
|
2
2
|
/**
|
|
3
3
|
* #api
|
|
4
|
-
* The
|
|
5
|
-
* blocks, accumulate the stats of what each one
|
|
6
|
-
*
|
|
7
|
-
* nothing to scale against — no data, a hidden
|
|
8
|
-
* initialized — which every caller distinguishes
|
|
4
|
+
* The raw autoscaled range the displays with a value scale derive
|
|
5
|
+
* identically: walk the settled blocks, accumulate the stats of what each one
|
|
6
|
+
* shows, and reduce them to `[min, max]` before any bound or nice-rounding.
|
|
7
|
+
* `undefined` while there is nothing to scale against — no data, a hidden
|
|
8
|
+
* band, or a view that has not initialized — which every caller distinguishes
|
|
9
|
+
* from a range.
|
|
9
10
|
*/
|
|
10
|
-
export function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const entries = view.settledDynamicBlocks.flatMap(block => {
|
|
14
|
-
const payload = block.displayedRegionIndex === undefined
|
|
15
|
-
? undefined
|
|
16
|
-
: payloadFor(block.displayedRegionIndex);
|
|
17
|
-
const visStart = Math.floor(block.start);
|
|
18
|
-
const visEnd = Math.ceil(block.end);
|
|
19
|
-
return payload
|
|
20
|
-
? itemsFor(payload).map(data => ({ visStart, visEnd, data }))
|
|
21
|
-
: [];
|
|
22
|
-
});
|
|
23
|
-
const stats = accumulate(entries);
|
|
24
|
-
if (stats) {
|
|
25
|
-
domain = getNiceDomain({
|
|
26
|
-
domain: range(stats, entries),
|
|
27
|
-
bounds,
|
|
28
|
-
scaleType,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
11
|
+
export function visibleStatsRange({ active, view, payloadFor, itemsFor, accumulate, range, }) {
|
|
12
|
+
if (!active || !view.initialized) {
|
|
13
|
+
return undefined;
|
|
31
14
|
}
|
|
32
|
-
|
|
15
|
+
const entries = view.settledDynamicBlocks.flatMap(block => {
|
|
16
|
+
const payload = block.displayedRegionIndex === undefined
|
|
17
|
+
? undefined
|
|
18
|
+
: payloadFor(block.displayedRegionIndex);
|
|
19
|
+
const visStart = Math.floor(block.start);
|
|
20
|
+
const visEnd = Math.ceil(block.end);
|
|
21
|
+
return payload
|
|
22
|
+
? itemsFor(payload).map(data => ({ visStart, visEnd, data }))
|
|
23
|
+
: [];
|
|
24
|
+
});
|
|
25
|
+
const stats = accumulate(entries);
|
|
26
|
+
return stats ? range(stats, entries) : undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* #api
|
|
30
|
+
* {@link visibleStatsRange} nice-rounded inside the configured bounds: the
|
|
31
|
+
* domain of a display whose range is its own alone.
|
|
32
|
+
*/
|
|
33
|
+
export function visibleStatsDomain({ bounds, scaleType, zero, ...spec }) {
|
|
34
|
+
const range = visibleStatsRange(spec);
|
|
35
|
+
return range
|
|
36
|
+
? getNiceDomain({ domain: range, bounds, scaleType, zero })
|
|
37
|
+
: undefined;
|
|
33
38
|
}
|
|
@@ -3,7 +3,6 @@ export declare const RENDERING_TYPE_DENSITY = 1;
|
|
|
3
3
|
export declare const RENDERING_TYPE_LINE = 2;
|
|
4
4
|
export declare const RENDERING_TYPE_SCATTER = 3;
|
|
5
5
|
export declare const RENDERING_TYPE_LINE_CENTER = 4;
|
|
6
|
-
export declare const SCALE_TYPE_LOG = 1;
|
|
7
|
-
export declare const SCALE_TYPE_SYMLOG = 2;
|
|
8
6
|
export declare const NO_PREV_START = 4294967295;
|
|
9
7
|
export declare const MIN_FILL_WIDTH_PX = 1.5;
|
|
8
|
+
export declare const MAX_WIGGLE_CUTS = 8;
|
|
@@ -5,7 +5,6 @@ export const RENDERING_TYPE_DENSITY = 1;
|
|
|
5
5
|
export const RENDERING_TYPE_LINE = 2;
|
|
6
6
|
export const RENDERING_TYPE_SCATTER = 3;
|
|
7
7
|
export const RENDERING_TYPE_LINE_CENTER = 4;
|
|
8
|
-
export const SCALE_TYPE_LOG = 1;
|
|
9
|
-
export const SCALE_TYPE_SYMLOG = 2;
|
|
10
8
|
export const NO_PREV_START = 4294967295;
|
|
11
9
|
export const MIN_FILL_WIDTH_PX = 1.5;
|
|
10
|
+
export const MAX_WIGGLE_CUTS = 8;
|