@genome-spy/core 0.43.0 → 0.43.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/{index-d7k3kkin.js → index-noY1e-G6.js} +365 -361
- package/dist/bundle/index.es.js +3442 -3338
- package/dist/bundle/index.js +91 -79
- package/dist/src/data/sources/lazy/bigBedSource.d.ts +6 -0
- package/dist/src/data/sources/lazy/bigBedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/bigBedSource.js +149 -6
- package/dist/src/data/transforms/coverage.d.ts +10 -2
- package/dist/src/data/transforms/coverage.d.ts.map +1 -1
- package/dist/src/data/transforms/coverage.js +22 -9
- package/dist/src/data/transforms/coverage.test.js +202 -87
- package/dist/src/gl/arrayBuilder.d.ts +11 -4
- package/dist/src/gl/arrayBuilder.d.ts.map +1 -1
- package/dist/src/gl/arrayBuilder.js +36 -13
- package/dist/src/gl/dataToVertices.d.ts +3 -2
- package/dist/src/gl/dataToVertices.d.ts.map +1 -1
- package/dist/src/gl/dataToVertices.js +45 -14
- package/dist/src/gl/glslScaleGenerator.d.ts +12 -0
- package/dist/src/gl/glslScaleGenerator.d.ts.map +1 -1
- package/dist/src/gl/glslScaleGenerator.js +38 -4
- package/dist/src/gl/includes/scales.glsl.js +1 -1
- package/dist/src/marks/link.d.ts.map +1 -1
- package/dist/src/marks/link.js +2 -1
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +3 -1
- package/dist/src/utils/kWayMerge.d.ts +3 -2
- package/dist/src/utils/kWayMerge.d.ts.map +1 -1
- package/dist/src/utils/kWayMerge.js +4 -3
- package/dist/src/utils/kWayMerge.test.js +5 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayBuilder.d.ts","sourceRoot":"","sources":["../../../src/gl/arrayBuilder.js"],"names":[],"mappings":"AASA
|
|
1
|
+
{"version":3,"file":"arrayBuilder.d.ts","sourceRoot":"","sources":["../../../src/gl/arrayBuilder.js"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AACH;IAKI;;;OAGG;IACH,kBAFW,MAAM,EAehB;IAZG,aAAgB;IAEhB,mJAAmJ;IACnJ;YADmB,MAAM,GAAE;YAAC,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,CAAC;YAAC,aAAa,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAC;MAC9H;IAEhB,kCAAkC;IAClC,SADW,OAAY,IAAI,CAAC,EAAE,CACb;IAEjB,qCAAqC;IACrC,cADW,QAAU,GAAG,KAAE,IAAI,CAAC,EAAE,CACX;IAEtB,oBAAoB;IAGxB,kBAOC;IAED;;;;OAIG;IACH,wBAHW,MAAM,YACN,iBAAiB,QAe3B;IAED;;;;;;;OAOG;IACH,6BANW,MAAM,iBACN,MAAM,oBACN,kBAAkB,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,mBAAmB,mBACrG,MAAM,EAAE,UACE,MAAM,GAAC,MAAM,EAAE,SAoFnC;IAED,gBAEC;IAED;;OAEG;IACH,uBAFW,MAAM,QAIhB;IAuDD;;;OAGG;IACH,qBAFW,MAAM,QAKhB;;CACJ;;;;;;;;;cA9NkB,MAAM,KAAE,GAAG;;;;qBACpB,MAAM,EAAE;oBACR,MAAM;;;;sBACN,kBAAkB,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,mBAAmB"}
|
|
@@ -14,10 +14,13 @@ const UNROLL_LIMIT = 10000;
|
|
|
14
14
|
* @prop {function(object):any} f The converter
|
|
15
15
|
* @prop {number[]} [arrayReference] An optimization for fp64 mainly
|
|
16
16
|
* @prop {number} [numComponents]
|
|
17
|
+
* @prop {typeof Uint16Array | typeof Int16Array | typeof Uint32Array | typeof Int32Array | typeof Float32Array} [targetArrayType] Defaults to Float32Array
|
|
17
18
|
*/
|
|
18
19
|
export default class ArrayBuilder {
|
|
19
20
|
// TODO: Support strided layout. May yield better performance or not. No consensus in literature.
|
|
20
21
|
|
|
22
|
+
#configured = false;
|
|
23
|
+
|
|
21
24
|
/**
|
|
22
25
|
*
|
|
23
26
|
* @param {number} size Size if known, uses TypedArray
|
|
@@ -25,7 +28,7 @@ export default class ArrayBuilder {
|
|
|
25
28
|
constructor(size) {
|
|
26
29
|
this.size = size;
|
|
27
30
|
|
|
28
|
-
/** @type {Object.<string, {data:
|
|
31
|
+
/** @type {Object.<string, {data: Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array, numComponents: number, divisor?: number}>} */
|
|
29
32
|
this.arrays = {};
|
|
30
33
|
|
|
31
34
|
/** @type {(function():void)[]} */
|
|
@@ -37,6 +40,15 @@ export default class ArrayBuilder {
|
|
|
37
40
|
this.vertexCount = 0;
|
|
38
41
|
}
|
|
39
42
|
|
|
43
|
+
configure() {
|
|
44
|
+
if (this.#configured) {
|
|
45
|
+
throw new Error("Already configured!");
|
|
46
|
+
}
|
|
47
|
+
this.#configurePushAll();
|
|
48
|
+
this.#configureUpdateFromDatum();
|
|
49
|
+
this.#configured = true;
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
/**
|
|
41
53
|
*
|
|
42
54
|
* @param {string} attribute
|
|
@@ -46,6 +58,7 @@ export default class ArrayBuilder {
|
|
|
46
58
|
const updater = this.createUpdater(
|
|
47
59
|
ATTRIBUTE_PREFIX + attribute,
|
|
48
60
|
metadata.numComponents || 1,
|
|
61
|
+
metadata.targetArrayType ?? Float32Array,
|
|
49
62
|
metadata.arrayReference
|
|
50
63
|
);
|
|
51
64
|
const f = metadata.f;
|
|
@@ -60,10 +73,16 @@ export default class ArrayBuilder {
|
|
|
60
73
|
*
|
|
61
74
|
* @param {string} attributeName
|
|
62
75
|
* @param {number} numComponents
|
|
76
|
+
* @param {typeof Uint16Array | typeof Int16Array | typeof Uint32Array | typeof Int32Array | typeof Float32Array} [targetArrayType]
|
|
63
77
|
* @param {number[]} [arrayReference]
|
|
64
78
|
* @return {function(number|number[])}
|
|
65
79
|
*/
|
|
66
|
-
createUpdater(
|
|
80
|
+
createUpdater(
|
|
81
|
+
attributeName,
|
|
82
|
+
numComponents,
|
|
83
|
+
targetArrayType = Float32Array,
|
|
84
|
+
arrayReference = undefined
|
|
85
|
+
) {
|
|
67
86
|
if (!isNumber(this.size)) {
|
|
68
87
|
throw new Error("The number of vertices must be defined!");
|
|
69
88
|
}
|
|
@@ -73,7 +92,8 @@ export default class ArrayBuilder {
|
|
|
73
92
|
let updater;
|
|
74
93
|
let i = 0;
|
|
75
94
|
|
|
76
|
-
|
|
95
|
+
// eslint-disable-next-line new-cap
|
|
96
|
+
const array = new targetArrayType(this.size * numComponents);
|
|
77
97
|
|
|
78
98
|
this.arrays[attributeName] = {
|
|
79
99
|
data: array,
|
|
@@ -142,6 +162,17 @@ export default class ArrayBuilder {
|
|
|
142
162
|
}
|
|
143
163
|
|
|
144
164
|
pushAll() {
|
|
165
|
+
throw new Error("Call configure() first!");
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @param {object} datum
|
|
170
|
+
*/
|
|
171
|
+
updateFromDatum(datum) {
|
|
172
|
+
throw new Error("Call configure() first!");
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
#configurePushAll() {
|
|
145
176
|
if (this.size > UNROLL_LIMIT) {
|
|
146
177
|
const preps = this.pushers
|
|
147
178
|
.map((_v, i) => `const p${i} = that.pushers[${i}];`)
|
|
@@ -165,15 +196,9 @@ ${pushs}
|
|
|
165
196
|
this.vertexCount++;
|
|
166
197
|
};
|
|
167
198
|
}
|
|
168
|
-
|
|
169
|
-
this.pushAll();
|
|
170
199
|
}
|
|
171
200
|
|
|
172
|
-
|
|
173
|
-
*
|
|
174
|
-
* @param {object} datum
|
|
175
|
-
*/
|
|
176
|
-
updateFromDatum(datum) {
|
|
201
|
+
#configureUpdateFromDatum() {
|
|
177
202
|
if (this.size > UNROLL_LIMIT) {
|
|
178
203
|
const preps = this.dataUpdaters
|
|
179
204
|
.map((_v, i) => `const u${i} = that.dataUpdaters[${i}];`)
|
|
@@ -192,14 +217,12 @@ ${updates}
|
|
|
192
217
|
};`
|
|
193
218
|
)(this);
|
|
194
219
|
} else {
|
|
195
|
-
this.updateFromDatum = (datum) => {
|
|
220
|
+
this.updateFromDatum = (/** @type {object} */ datum) => {
|
|
196
221
|
for (let i = 0; i < this.dataUpdaters.length; i++) {
|
|
197
222
|
this.dataUpdaters[i](datum);
|
|
198
223
|
}
|
|
199
224
|
};
|
|
200
225
|
}
|
|
201
|
-
|
|
202
|
-
this.updateFromDatum(datum);
|
|
203
226
|
}
|
|
204
227
|
|
|
205
228
|
/**
|
|
@@ -63,9 +63,9 @@ export class GeometryBuilder {
|
|
|
63
63
|
getIndex: () => import("../utils/binnedIndex.js").Lookup;
|
|
64
64
|
};
|
|
65
65
|
toArrays(): {
|
|
66
|
-
/** @type {Record<string, {data:
|
|
66
|
+
/** @type {Record<string, {data: Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array, numComponents: number, divisor?: number}>} */
|
|
67
67
|
arrays: Record<string, {
|
|
68
|
-
data:
|
|
68
|
+
data: Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array;
|
|
69
69
|
numComponents: number;
|
|
70
70
|
divisor?: number;
|
|
71
71
|
}>;
|
|
@@ -89,6 +89,7 @@ export class RectVertexBuilder extends GeometryBuilder {
|
|
|
89
89
|
attributes: string[];
|
|
90
90
|
numItems?: number;
|
|
91
91
|
});
|
|
92
|
+
pushAllSixTimes: any;
|
|
92
93
|
}
|
|
93
94
|
export class RuleVertexBuilder extends GeometryBuilder {
|
|
94
95
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataToVertices.d.ts","sourceRoot":"","sources":["../../../src/gl/dataToVertices.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dataToVertices.d.ts","sourceRoot":"","sources":["../../../src/gl/d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M;OAShB;CAYJ;AAED;IACI;;;;;;;;;OASG;IACH;;oBANW,MAAM,EAAE;qBACR,OAAO,2BAA2B,EAAE,aAAa;oBACjD,OAAO,MAAM,EAAE,GAAG,CAAC;wBACnB,MAAM;sBACN,OAAO;OA8CjB;IA/BG,4DAA2B;IAC3B,2DAA0B;IAE1B,gCAA4B;IAQ5B,qCAAqC;IACrC,sBADmB,GAAG,KAAK,MAAM,CAMf;IAElB,oDAGC;IACD,qDAGC;IAED,8CAAiE;CAgJxE;;;;;;;;YAvmBS,MAAM;;;;WACN,MAAM;YACN,OAAO,yBAAyB,EAAE,MAAM;;yBAjBzB,mBAAmB"}
|
|
@@ -8,10 +8,11 @@ import { isValueDef } from "../encoder/encoder.js";
|
|
|
8
8
|
import {
|
|
9
9
|
dedupeEncodingFields,
|
|
10
10
|
isHighPrecisionScale,
|
|
11
|
+
isLargeGenome,
|
|
11
12
|
makeAttributeName,
|
|
12
|
-
|
|
13
|
+
splitLargeHighPrecision,
|
|
13
14
|
} from "./glslScaleGenerator.js";
|
|
14
|
-
import { isContinuous } from "vega-scale";
|
|
15
|
+
import { isContinuous, isDiscrete } from "vega-scale";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* @typedef {object} RangeEntry Represents a location of a vertex subset
|
|
@@ -67,8 +68,9 @@ export class GeometryBuilder {
|
|
|
67
68
|
|
|
68
69
|
const accessor = ce.accessor;
|
|
69
70
|
|
|
70
|
-
const doubleArray = [0, 0];
|
|
71
71
|
const hp = isHighPrecisionScale(ce.scale.type);
|
|
72
|
+
const largeHp = hp && isLargeGenome(ce.scale.domain());
|
|
73
|
+
const largeHpArray = [0, 0];
|
|
72
74
|
|
|
73
75
|
const indexer = ce.indexer;
|
|
74
76
|
|
|
@@ -81,8 +83,8 @@ export class GeometryBuilder {
|
|
|
81
83
|
*/
|
|
82
84
|
const f = indexer
|
|
83
85
|
? (d) => indexer(accessor(d))
|
|
84
|
-
:
|
|
85
|
-
? (d) =>
|
|
86
|
+
: largeHp
|
|
87
|
+
? (d) => splitLargeHighPrecision(accessor(d), largeHpArray)
|
|
86
88
|
: accessor;
|
|
87
89
|
|
|
88
90
|
const attributeName = sharedChannels
|
|
@@ -91,8 +93,13 @@ export class GeometryBuilder {
|
|
|
91
93
|
|
|
92
94
|
this.variableBuilder.addConverter(attributeName, {
|
|
93
95
|
f,
|
|
94
|
-
numComponents:
|
|
95
|
-
arrayReference:
|
|
96
|
+
numComponents: largeHp ? 2 : 1,
|
|
97
|
+
arrayReference: largeHp ? largeHpArray : undefined,
|
|
98
|
+
targetArrayType: isDiscrete(ce.scale.type)
|
|
99
|
+
? Uint16Array
|
|
100
|
+
: hp
|
|
101
|
+
? Uint32Array
|
|
102
|
+
: Float32Array,
|
|
96
103
|
});
|
|
97
104
|
}
|
|
98
105
|
|
|
@@ -226,7 +233,7 @@ export class GeometryBuilder {
|
|
|
226
233
|
|
|
227
234
|
toArrays() {
|
|
228
235
|
return {
|
|
229
|
-
/** @type {Record<string, {data:
|
|
236
|
+
/** @type {Record<string, {data: Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array, numComponents: number, divisor?: number}>} */
|
|
230
237
|
arrays: this.variableBuilder.arrays,
|
|
231
238
|
/** Number of vertices used */
|
|
232
239
|
vertexCount: this.variableBuilder.vertexCount,
|
|
@@ -251,6 +258,29 @@ export class RectVertexBuilder extends GeometryBuilder {
|
|
|
251
258
|
attributes,
|
|
252
259
|
numVertices: numItems * 6,
|
|
253
260
|
});
|
|
261
|
+
this.variableBuilder.configure();
|
|
262
|
+
|
|
263
|
+
const pushAll = this.variableBuilder.pushAll;
|
|
264
|
+
|
|
265
|
+
this.pushAllSixTimes =
|
|
266
|
+
// TODO: Don't do this stupid comparison. Instead, reuse the previous GeometryBuilder.
|
|
267
|
+
numItems > 500
|
|
268
|
+
? // Make a new function instance where the JS engine can inline
|
|
269
|
+
// all pushAll calls to avoid the function call overhead.
|
|
270
|
+
new Function(
|
|
271
|
+
"pushAll",
|
|
272
|
+
`return function unrolledPushAllSixTimes() {
|
|
273
|
+
pushAll(); pushAll(); pushAll(); pushAll(); pushAll(); pushAll();
|
|
274
|
+
};`
|
|
275
|
+
)(pushAll)
|
|
276
|
+
: function pushAllSixTimes() {
|
|
277
|
+
pushAll();
|
|
278
|
+
pushAll();
|
|
279
|
+
pushAll();
|
|
280
|
+
pushAll();
|
|
281
|
+
pushAll();
|
|
282
|
+
pushAll();
|
|
283
|
+
};
|
|
254
284
|
}
|
|
255
285
|
|
|
256
286
|
/**
|
|
@@ -273,12 +303,7 @@ export class RectVertexBuilder extends GeometryBuilder {
|
|
|
273
303
|
|
|
274
304
|
// Six vertices per rect. The vertex shader is using gl_VertexID to
|
|
275
305
|
// determine the vertex position within the rect.
|
|
276
|
-
this.
|
|
277
|
-
this.variableBuilder.pushAll();
|
|
278
|
-
this.variableBuilder.pushAll();
|
|
279
|
-
this.variableBuilder.pushAll();
|
|
280
|
-
this.variableBuilder.pushAll();
|
|
281
|
-
this.variableBuilder.pushAll();
|
|
306
|
+
this.pushAllSixTimes();
|
|
282
307
|
|
|
283
308
|
this.addToXIndex(d);
|
|
284
309
|
}
|
|
@@ -318,6 +343,8 @@ export class RuleVertexBuilder extends GeometryBuilder {
|
|
|
318
343
|
|
|
319
344
|
this.updateSide = this.variableBuilder.createUpdater("side", 1);
|
|
320
345
|
this.updatePos = this.variableBuilder.createUpdater("pos", 1);
|
|
346
|
+
|
|
347
|
+
this.variableBuilder.configure();
|
|
321
348
|
}
|
|
322
349
|
|
|
323
350
|
/* eslint-disable complexity */
|
|
@@ -376,6 +403,7 @@ export class PointVertexBuilder extends GeometryBuilder {
|
|
|
376
403
|
attributes,
|
|
377
404
|
numVertices: numItems,
|
|
378
405
|
});
|
|
406
|
+
this.variableBuilder.configure();
|
|
379
407
|
}
|
|
380
408
|
}
|
|
381
409
|
|
|
@@ -392,6 +420,7 @@ export class LinkVertexBuilder extends GeometryBuilder {
|
|
|
392
420
|
attributes,
|
|
393
421
|
numVertices: numItems,
|
|
394
422
|
});
|
|
423
|
+
this.variableBuilder.configure();
|
|
395
424
|
}
|
|
396
425
|
|
|
397
426
|
toArrays() {
|
|
@@ -459,6 +488,8 @@ export class TextVertexBuilder extends GeometryBuilder {
|
|
|
459
488
|
);
|
|
460
489
|
|
|
461
490
|
this.updateWidth = this.variableBuilder.createUpdater("width", 1);
|
|
491
|
+
|
|
492
|
+
this.variableBuilder.configure();
|
|
462
493
|
}
|
|
463
494
|
|
|
464
495
|
/**
|
|
@@ -18,15 +18,27 @@ export function generateScaleGlsl(channel: Channel, scale: any, channelDef: impo
|
|
|
18
18
|
domainUniform: string;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
+
* True if scale needs more than 24 bits (float32) of precision.
|
|
21
22
|
*
|
|
22
23
|
* @param {string} type
|
|
23
24
|
*/
|
|
24
25
|
export function isHighPrecisionScale(type: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* True if Uint32 cannot represent the domain.
|
|
28
|
+
*
|
|
29
|
+
* @param {number[]} domain
|
|
30
|
+
*/
|
|
31
|
+
export function isLargeGenome(domain: number[]): boolean;
|
|
25
32
|
/**
|
|
26
33
|
* @param {number} x Must be an integer
|
|
27
34
|
* @param {number[]} [arr]
|
|
28
35
|
*/
|
|
29
36
|
export function splitHighPrecision(x: number, arr?: number[]): number[];
|
|
37
|
+
/**
|
|
38
|
+
* @param {number} x Must be an integer
|
|
39
|
+
* @param {number[]} [arr]
|
|
40
|
+
*/
|
|
41
|
+
export function splitLargeHighPrecision(x: number, arr?: number[]): number[];
|
|
30
42
|
/**
|
|
31
43
|
* @param {number[]} domain
|
|
32
44
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glslScaleGenerator.d.ts","sourceRoot":"","sources":["../../../src/gl/glslScaleGenerator.js"],"names":[],"mappings":";AAmDA;;;;GAIG;AACH,2CAHW,OAAO,SACP,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,UAsC9C;AAED;;;;;;GAMG;AAEH,2CANW,OAAO,SACP,GAAG,cACH,OAAO,oBAAoB,EAAE,UAAU,+BACvC,OAAO,EAAE;;;;
|
|
1
|
+
{"version":3,"file":"glslScaleGenerator.d.ts","sourceRoot":"","sources":["../../../src/gl/glslScaleGenerator.js"],"names":[],"mappings":";AAmDA;;;;GAIG;AACH,2CAHW,OAAO,SACP,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,UAsC9C;AAED;;;;;;GAMG;AAEH,2CANW,OAAO,SACP,GAAG,cACH,OAAO,oBAAoB,EAAE,UAAU,+BACvC,OAAO,EAAE;;;;EA8RnB;AA+FD;;;;GAIG;AACH,2CAFW,MAAM,WAIhB;AAED;;;;GAIG;AACH,sCAFW,MAAM,EAAE,WAIlB;AAMD;;;GAGG;AACH,sCAHW,MAAM,QACN,MAAM,EAAE,YAYlB;AAED;;;GAGG;AACH,2CAHW,MAAM,QACN,MAAM,EAAE,YAUlB;AAYD;;GAEG;AACH,qDAFW,MAAM,EAAE,YAIlB;AAED;;GAEG;AAEH;;;;;GAKG;AACH,+CAFW,QAAQ,OAAO,OAAO,oBAAoB,EAAE,OAAO,EAAE,OAAO,qBAAqB,EAAE,OAAO,CAAC,CAAC,+DA4BtG;AAED;;GAEG;AACH,2CAFW,OAAO,oBAAoB,EAAE,OAAO,GAAG,OAAO,oBAAoB,EAAE,OAAO,EAAE,UAIvF;AA3jBD,uCAAwC;AACxC,uCAAwC;AACxC,oCAAqC;AACrC,6CAA8C;AAC9C,kDAAmD;AACnD,oDAAqD;sBAMxC,OAAO,oBAAoB,EAAE,OAAO;;;;8BAiYpC,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE;;;;uBAqIhD,CAAC,MAAM,EAAE,OAAO,CAAC;0BAnhBJ,WAAW"}
|
|
@@ -122,8 +122,19 @@ export function generateScaleGlsl(
|
|
|
122
122
|
const domainUniformName = DOMAIN_PREFIX + primary;
|
|
123
123
|
const rangeName = RANGE_PREFIX + primary;
|
|
124
124
|
|
|
125
|
+
// The attribute has discrete values
|
|
126
|
+
const discrete = isDiscrete(scale.type);
|
|
127
|
+
|
|
125
128
|
const hp = isHighPrecisionScale(scale.type);
|
|
126
|
-
const
|
|
129
|
+
const largeHp = hp && isLargeGenome(scale.domain());
|
|
130
|
+
|
|
131
|
+
const attributeType = largeHp
|
|
132
|
+
? "uvec2"
|
|
133
|
+
: hp
|
|
134
|
+
? "uint"
|
|
135
|
+
: discrete
|
|
136
|
+
? "uint"
|
|
137
|
+
: "float";
|
|
127
138
|
|
|
128
139
|
const domainLength = scale.domain ? scale.domain().length : undefined;
|
|
129
140
|
|
|
@@ -468,6 +479,7 @@ function makeFunctionCall(name, ...args) {
|
|
|
468
479
|
}
|
|
469
480
|
|
|
470
481
|
/**
|
|
482
|
+
* True if scale needs more than 24 bits (float32) of precision.
|
|
471
483
|
*
|
|
472
484
|
* @param {string} type
|
|
473
485
|
*/
|
|
@@ -475,9 +487,17 @@ export function isHighPrecisionScale(type) {
|
|
|
475
487
|
return type == "index" || type == "locus";
|
|
476
488
|
}
|
|
477
489
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
490
|
+
/**
|
|
491
|
+
* True if Uint32 cannot represent the domain.
|
|
492
|
+
*
|
|
493
|
+
* @param {number[]} domain
|
|
494
|
+
*/
|
|
495
|
+
export function isLargeGenome(domain) {
|
|
496
|
+
return domain[1] > 2 ** 32;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const LOW_BITS = 12;
|
|
500
|
+
const BS = 2 ** LOW_BITS;
|
|
481
501
|
const BM = BS - 1;
|
|
482
502
|
|
|
483
503
|
/**
|
|
@@ -496,6 +516,20 @@ export function splitHighPrecision(x, arr = []) {
|
|
|
496
516
|
return arr;
|
|
497
517
|
}
|
|
498
518
|
|
|
519
|
+
/**
|
|
520
|
+
* @param {number} x Must be an integer
|
|
521
|
+
* @param {number[]} [arr]
|
|
522
|
+
*/
|
|
523
|
+
export function splitLargeHighPrecision(x, arr = []) {
|
|
524
|
+
const lo = x % BS;
|
|
525
|
+
const hi = (x - lo) / BS;
|
|
526
|
+
|
|
527
|
+
arr[0] = hi;
|
|
528
|
+
arr[1] = lo;
|
|
529
|
+
|
|
530
|
+
return arr;
|
|
531
|
+
}
|
|
532
|
+
|
|
499
533
|
/**
|
|
500
534
|
* @param {number} x
|
|
501
535
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const shader = "uniform highp float uZero;vec3 getDiscreteColor(sampler2D s,int index){return texelFetch(s,ivec2(index % textureSize(s,0).x,0),0).rgb;}vec3 getInterpolatedColor(sampler2D s,float unitValue){return texture(s,vec2(unitValue,0.0)).rgb;}float clampToRange(float value,vec2 range){return clamp(value,min(range[0],range[1]),max(range[0],range[1]));}float scaleIdentity(float value){return value;}float scaleLinear(float value,vec2 domain,vec2 range){float domainSpan=domain[1]-domain[0];float rangeSpan=range[1]-range[0];return(value-domain[0])/domainSpan*rangeSpan+range[0];}float scaleLog(float value,vec2 domain,vec2 range,float base){return scaleLinear(log(value)/log(base),log(domain)/log(base),range);}float symlog(float value,float constant){return sign(value)*log(abs(value/constant)+1.0);}float scaleSymlog(float value,vec2 domain,vec2 range,float constant){return scaleLinear(symlog(value,constant),vec2(symlog(domain[0],constant),symlog(domain[1],constant)),range);}float scalePow(float value,vec2 domain,vec2 range,float exponent){return scaleLinear(pow(abs(value),exponent)*sign(value),pow(abs(domain),vec2(exponent))*sign(domain),range);}float scaleBand(
|
|
1
|
+
const shader = "uniform highp float uZero;vec3 getDiscreteColor(sampler2D s,int index){return texelFetch(s,ivec2(index % textureSize(s,0).x,0),0).rgb;}vec3 getInterpolatedColor(sampler2D s,float unitValue){return texture(s,vec2(unitValue,0.0)).rgb;}float clampToRange(float value,vec2 range){return clamp(value,min(range[0],range[1]),max(range[0],range[1]));}float scaleIdentity(float value){return value;}float scaleIdentity(uint value){return float(value);}float scaleLinear(float value,vec2 domain,vec2 range){float domainSpan=domain[1]-domain[0];float rangeSpan=range[1]-range[0];return(value-domain[0])/domainSpan*rangeSpan+range[0];}float scaleLog(float value,vec2 domain,vec2 range,float base){return scaleLinear(log(value)/log(base),log(domain)/log(base),range);}float symlog(float value,float constant){return sign(value)*log(abs(value/constant)+1.0);}float scaleSymlog(float value,vec2 domain,vec2 range,float constant){return scaleLinear(symlog(value,constant),vec2(symlog(domain[0],constant),symlog(domain[1],constant)),range);}float scalePow(float value,vec2 domain,vec2 range,float exponent){return scaleLinear(pow(abs(value),exponent)*sign(value),pow(abs(domain),vec2(exponent))*sign(domain),range);}float scaleBand(uint value,vec2 domainExtent,vec2 range,float paddingInner,float paddingOuter,float align,float band){float start=range[0];float stop=range[1];float rangeSpan=stop-start;float n=domainExtent[1]-domainExtent[0];paddingInner=int(n)>1 ? paddingInner : 0.0;float step=rangeSpan/max(1.0,n-paddingInner+paddingOuter*2.0);start+=(rangeSpan-step*(n-paddingInner))*align;float bandwidth=step*(1.0-paddingInner);return start+(float(value)-domainExtent[0])*step+bandwidth*band;}const int lowBits=12;const float lowDivisor=pow(2.0,float(lowBits));const uint lowMask=uint(lowDivisor-1.0);vec2 splitUint(uint value){uint valueLo=value&lowMask;uint valueHi=value-valueLo;return vec2(float(valueHi),float(valueLo));}/***High precision variant of scaleBand for index/locus scales*/float scaleBandHp(uint value,vec3 domainExtent,vec2 range,float paddingInner,float paddingOuter,float align,float band){float start=range[0];float stop=range[1];float rangeSpan=stop-start;vec2 domainStart=domainExtent.xy;float n=domainExtent[2];float step=rangeSpan/max(1.0,n-paddingInner+paddingOuter*2.0);start+=(rangeSpan-step*(n-paddingInner))*align;float bandwidth=step*(1.0-paddingInner);vec2 splitValue=splitUint(value);float inf=1.0/uZero;float hi=max(splitValue[0]-domainStart[0],-inf);float lo=max(splitValue[1]-domainStart[1],-inf);return dot(vec4(start,hi,lo,bandwidth),vec4(1.0,step,step,band));}/***High precision variant of scaleBand for index/locus scales for large*domains where 32bit uints are not sufficient to represent the domain.*/float scaleBandHp(uvec2 value,vec3 domainExtent,vec2 range,float paddingInner,float paddingOuter,float align,float band){float start=range[0];float stop=range[1];float rangeSpan=stop-start;vec2 domainStart=domainExtent.xy;float n=domainExtent[2];float step=rangeSpan/max(1.0,n-paddingInner+paddingOuter*2.0);start+=(rangeSpan-step*(n-paddingInner))*align;float bandwidth=step*(1.0-paddingInner);vec2 splitValue=vec2(float(value[0])*lowDivisor,float(value[1]));float inf=1.0/uZero;float hi=max(splitValue[0]-domainStart[0],-inf);float lo=max(splitValue[1]-domainStart[1],-inf);return dot(vec4(start,hi,lo,bandwidth),vec4(1.0,step,step,band));}";
|
|
2
2
|
export default shader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/marks/link.js"],"names":[],"mappings":"AAWA;IA+BQ;;;;;OAKG;IACH,yBAEC;
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/marks/link.js"],"names":[],"mappings":"AAWA;IA+BQ;;;;;OAKG;IACH,yBAEC;IAmGD;;;;;;MAKC;CAoFR;iBAzOgB,WAAW"}
|
package/dist/src/marks/link.js
CHANGED
|
@@ -139,6 +139,7 @@ export default class LinkMark extends Mark {
|
|
|
139
139
|
|
|
140
140
|
const vertexData = builder.toArrays();
|
|
141
141
|
|
|
142
|
+
// TODO: Use gl_VertexID to calculate the strip in the vertex shader
|
|
142
143
|
vertexData.arrays.strip = {
|
|
143
144
|
data: createStrip(this.properties.segments),
|
|
144
145
|
numComponents: 2,
|
|
@@ -245,5 +246,5 @@ function createStrip(/** @type number */ segments) {
|
|
|
245
246
|
coords.push(i / segments, 0.5);
|
|
246
247
|
coords.push(i / segments, -0.5);
|
|
247
248
|
}
|
|
248
|
-
return coords;
|
|
249
|
+
return new Float32Array(coords);
|
|
249
250
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mark.d.ts","sourceRoot":"","sources":["../../../src/marks/mark.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"mark.d.ts","sourceRoot":"","sources":["../../../src/marks/mark.js"],"names":[],"mappings":";AA+lCA;;;GAGG;AACH,6BAHW,GAAG,0CAKb;AAzjCD,0DAA2D;AAC3D,0DAA2D;AAE3D;;;;;;;;;;;;GAYG;AACH;IACI;;;;;;OAMG;IAEH;;OAEG;IACH,sBAFW,OAAO,qBAAqB,EAAE,OAAO,EAkF/C;IA/EG,gDAAwB;IAExB,oEAAoE;IACpE,UADW,OAAO,MAAM,EAAE,OAAO,qBAAqB,EAAE,OAAO,CAAC,CACvC;IAIzB,0FAA0F;IAC1F,YADW,OAAO,SAAS,EAAE,UAAU,GAAG;QAAE,iBAAiB,CAAC,EAAE,MAAM,CAAA;KAAE,CAC7C;IAE3B,0DAA0D;IAC1D,aADW,OAAO,SAAS,EAAE,WAAW,CACZ;IAE5B,8DAA8D;IAC9D,iBADW,OAAO,SAAS,EAAE,eAAe,CACZ;IAEhC,+DAA+D;IAC/D,mBADW,OAAO,SAAS,EAAE,gBAAgB,CACX;IAElC,+DAA+D;IAC/D,iBADW,OAAO,SAAS,EAAE,gBAAgB,CACb;IAEhC;;;OAGG;IACH,iBAFU,OAAO,SAAS,EAAE,gBAAgB,CAEZ;IAEhC;;;;;OAKG;IACH,uCAA+B;IAE/B,kFAAkF;IAClF,UADW,SAAS,GAAG,CAAC,CACM;IAG9B,yBAAyB;IACzB,wDAqBC;IAED;;;;;;;;OAQG;IACH,mEAKC;IAGL,sBAEC;IAED;;;;;;;OAOG;IACH,iBAFa,MAAM,EAAE,CAKpB;IAED;;OAEG;IACH,+DAWC;IAED;;OAEG;IACH,oEAcC;IAED;;;;;OAKG;IACH,oHAEC;IAED;;;;OAIG;IACH,8DA+CC;IAED,wDAEC;IAED,8CAEC;IAED,uBAEC;IAED;;;OAGG;IACH,2BAEC;IAED;;OAEG;IACH,oCAEC;IAED;;OAEG;IACH,2BAEC;IAED,sEAeC;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-1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Merges multiple sorted arrays.
|
|
3
3
|
*
|
|
4
4
|
* @param {T[][]} arrays
|
|
5
|
+
* @param {function(T):void} handler a function that will be called for each element
|
|
5
6
|
* @param {function(T):number} [accessor]
|
|
6
7
|
* @template T
|
|
7
8
|
*/
|
|
8
|
-
export default function kWayMerge<T>(arrays: T[][], accessor?: (arg0: T) => number):
|
|
9
|
+
export default function kWayMerge<T>(arrays: T[][], handler: (arg0: T) => void, accessor?: (arg0: T) => number): void;
|
|
9
10
|
//# sourceMappingURL=kWayMerge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kWayMerge.d.ts","sourceRoot":"","sources":["../../../src/utils/kWayMerge.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"kWayMerge.d.ts","sourceRoot":"","sources":["../../../src/utils/kWayMerge.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,0EAJuB,IAAI,0BACJ,MAAM,QAmC5B"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import FlatQueue from "flatqueue";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Merges multiple sorted arrays.
|
|
5
5
|
*
|
|
6
6
|
* @param {T[][]} arrays
|
|
7
|
+
* @param {function(T):void} handler a function that will be called for each element
|
|
7
8
|
* @param {function(T):number} [accessor]
|
|
8
9
|
* @template T
|
|
9
10
|
*/
|
|
10
|
-
export default function
|
|
11
|
+
export default function kWayMerge(arrays, handler, accessor = (x) => +x) {
|
|
11
12
|
// https://www.wikiwand.com/en/K-way_merge_algorithm
|
|
12
13
|
|
|
13
14
|
// This could be optimized by implementing a tournament tree or
|
|
@@ -31,7 +32,7 @@ export default function* kWayMerge(arrays, accessor = (x) => +x) {
|
|
|
31
32
|
let pointer = pointers[i];
|
|
32
33
|
const element = array[pointer++];
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
handler(element);
|
|
35
36
|
|
|
36
37
|
if (pointer < array.length) {
|
|
37
38
|
const newValue = accessor(array[pointer]);
|
|
@@ -22,5 +22,9 @@ test("k-way merge merges multiple sorted arrays", () => {
|
|
|
22
22
|
/** @type {function(any):number} */
|
|
23
23
|
const accessor = (d) => d.a;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
/** @type {{a: number}[]} */
|
|
26
|
+
const result = [];
|
|
27
|
+
kWayMerge(arrays, (d) => result.push(d), accessor);
|
|
28
|
+
|
|
29
|
+
expect(result).toEqual(sorted);
|
|
26
30
|
});
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"contributors": [],
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"version": "0.43.
|
|
10
|
+
"version": "0.43.2",
|
|
11
11
|
"jsdelivr": "dist/bundle/index.js",
|
|
12
12
|
"unpkg": "dist/bundle/index.js",
|
|
13
13
|
"browser": "dist/bundle/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@gmod/bam": "^2.0.0",
|
|
40
|
-
"@gmod/bbi": "^4.0.
|
|
40
|
+
"@gmod/bbi": "^4.0.3",
|
|
41
41
|
"@gmod/bed": "^2.1.2",
|
|
42
42
|
"@gmod/bgzf-filehandle": "^1.4.7",
|
|
43
43
|
"@gmod/gff": "^1.3.0",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"vega-scale": "^7.1.1",
|
|
66
66
|
"vega-util": "^1.16.0"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "12ff70326672ed7ca34ef081c01fc25f19cf1ede"
|
|
69
69
|
}
|