@genome-spy/core 0.40.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/bundle/index--cKb-dKG.js +615 -0
  2. package/dist/bundle/{index-gn8bhQ8w.js → index-d7k3kkin.js} +365 -366
  3. package/dist/bundle/index.es.js +4260 -3928
  4. package/dist/bundle/index.js +115 -80
  5. package/dist/schema.json +254 -52
  6. package/dist/src/data/sources/dynamic/axisGenomeSource.js +1 -1
  7. package/dist/src/data/sources/dynamic/axisTickSource.js +3 -3
  8. package/dist/src/data/sources/dynamic/bamSource.d.ts +3 -21
  9. package/dist/src/data/sources/dynamic/bamSource.d.ts.map +1 -1
  10. package/dist/src/data/sources/dynamic/bamSource.js +38 -55
  11. package/dist/src/data/sources/dynamic/bigBedSource.d.ts +2 -38
  12. package/dist/src/data/sources/dynamic/bigBedSource.d.ts.map +1 -1
  13. package/dist/src/data/sources/dynamic/bigBedSource.js +14 -71
  14. package/dist/src/data/sources/dynamic/bigWigSource.d.ts +4 -42
  15. package/dist/src/data/sources/dynamic/bigWigSource.d.ts.map +1 -1
  16. package/dist/src/data/sources/dynamic/bigWigSource.js +23 -60
  17. package/dist/src/data/sources/dynamic/gff3Source.d.ts.map +1 -1
  18. package/dist/src/data/sources/dynamic/gff3Source.js +1 -0
  19. package/dist/src/data/sources/dynamic/indexedFastaSource.d.ts +2 -20
  20. package/dist/src/data/sources/dynamic/indexedFastaSource.d.ts.map +1 -1
  21. package/dist/src/data/sources/dynamic/indexedFastaSource.js +23 -41
  22. package/dist/src/data/sources/dynamic/singleAxisLazySource.d.ts +23 -4
  23. package/dist/src/data/sources/dynamic/singleAxisLazySource.d.ts.map +1 -1
  24. package/dist/src/data/sources/dynamic/singleAxisLazySource.js +29 -4
  25. package/dist/src/data/sources/dynamic/singleAxisWindowedSource.d.ts +60 -0
  26. package/dist/src/data/sources/dynamic/singleAxisWindowedSource.d.ts.map +1 -0
  27. package/dist/src/data/sources/dynamic/singleAxisWindowedSource.js +152 -0
  28. package/dist/src/data/sources/dynamic/tabixSource.d.ts +6 -40
  29. package/dist/src/data/sources/dynamic/tabixSource.d.ts.map +1 -1
  30. package/dist/src/data/sources/dynamic/tabixSource.js +29 -78
  31. package/dist/src/data/transforms/regexFold.d.ts.map +1 -1
  32. package/dist/src/data/transforms/regexFold.js +8 -0
  33. package/dist/src/data/transforms/regexFold.test.js +28 -0
  34. package/dist/src/encoder/accessor.js +4 -2
  35. package/dist/src/genomeSpy.d.ts +16 -0
  36. package/dist/src/genomeSpy.d.ts.map +1 -1
  37. package/dist/src/genomeSpy.js +119 -8
  38. package/dist/src/gl/link.vertex.glsl.js +1 -1
  39. package/dist/src/gl/point.common.glsl.js +2 -0
  40. package/dist/src/gl/point.fragment.glsl.js +1 -1
  41. package/dist/src/gl/point.vertex.glsl.js +1 -1
  42. package/dist/src/gl/rect.vertex.glsl.js +1 -1
  43. package/dist/src/gl/rule.common.glsl.js +2 -0
  44. package/dist/src/gl/rule.fragment.glsl.js +1 -1
  45. package/dist/src/gl/rule.vertex.glsl.js +1 -1
  46. package/dist/src/gl/text.common.glsl.js +2 -0
  47. package/dist/src/gl/text.fragment.glsl.js +1 -1
  48. package/dist/src/gl/text.vertex.glsl.js +1 -1
  49. package/dist/src/gl/webGLHelper.d.ts +6 -21
  50. package/dist/src/gl/webGLHelper.d.ts.map +1 -1
  51. package/dist/src/gl/webGLHelper.js +7 -38
  52. package/dist/src/img/90-ring-with-bg.svg +1 -0
  53. package/dist/src/img/README.md +5 -0
  54. package/dist/src/marks/link.d.ts +7 -0
  55. package/dist/src/marks/link.d.ts.map +1 -1
  56. package/dist/src/marks/link.js +99 -50
  57. package/dist/src/marks/mark.d.ts +34 -0
  58. package/dist/src/marks/mark.d.ts.map +1 -1
  59. package/dist/src/marks/mark.js +83 -1
  60. package/dist/src/marks/pointMark.d.ts.map +1 -1
  61. package/dist/src/marks/pointMark.js +21 -9
  62. package/dist/src/marks/rectMark.d.ts +1 -2
  63. package/dist/src/marks/rectMark.d.ts.map +1 -1
  64. package/dist/src/marks/rectMark.js +28 -17
  65. package/dist/src/marks/rule.d.ts.map +1 -1
  66. package/dist/src/marks/rule.js +17 -6
  67. package/dist/src/marks/text.d.ts.map +1 -1
  68. package/dist/src/marks/text.js +32 -18
  69. package/dist/src/paramBroker.d.ts +30 -0
  70. package/dist/src/paramBroker.d.ts.map +1 -0
  71. package/dist/src/paramBroker.js +102 -0
  72. package/dist/src/spec/data.d.ts +28 -13
  73. package/dist/src/spec/mark.d.ts +27 -26
  74. package/dist/src/spec/view.d.ts +2 -1
  75. package/dist/src/styles/genome-spy.css.d.ts +1 -1
  76. package/dist/src/styles/genome-spy.css.d.ts.map +1 -1
  77. package/dist/src/styles/genome-spy.css.js +33 -4
  78. package/dist/src/styles/genome-spy.scss +40 -4
  79. package/dist/src/types/viewContext.d.ts +11 -0
  80. package/dist/src/utils/binnedIndex.d.ts +2 -0
  81. package/dist/src/utils/binnedIndex.d.ts.map +1 -1
  82. package/dist/src/utils/binnedIndex.js +59 -10
  83. package/dist/src/utils/binnedIndex.test.js +46 -0
  84. package/dist/src/utils/expression.d.ts +12 -2
  85. package/dist/src/utils/expression.d.ts.map +1 -1
  86. package/dist/src/utils/expression.js +68 -9
  87. package/dist/src/utils/linearstep.d.ts +7 -0
  88. package/dist/src/utils/linearstep.d.ts.map +1 -0
  89. package/dist/src/utils/linearstep.js +10 -0
  90. package/dist/src/view/gridView.d.ts.map +1 -1
  91. package/dist/src/view/gridView.js +2 -0
  92. package/dist/src/view/layerView.d.ts.map +1 -1
  93. package/dist/src/view/layerView.js +2 -0
  94. package/dist/src/view/unitView.d.ts +0 -6
  95. package/dist/src/view/unitView.d.ts.map +1 -1
  96. package/dist/src/view/unitView.js +2 -9
  97. package/dist/src/view/view.d.ts +6 -0
  98. package/dist/src/view/view.d.ts.map +1 -1
  99. package/dist/src/view/view.js +17 -0
  100. package/package.json +3 -3
  101. package/dist/bundle/index-Cbz74kpR.js +0 -638
  102. package/dist/src/data/sources/dynamic/windowedMixin.d.ts +0 -32
  103. package/dist/src/data/sources/dynamic/windowedMixin.d.ts.map +0 -1
  104. package/dist/src/data/sources/dynamic/windowedMixin.js +0 -53
package/dist/schema.json CHANGED
@@ -313,6 +313,18 @@
313
313
  "$ref": "#/definitions/PrimaryPositionalChannel",
314
314
  "description": "Which channel's scale domain to monitor.\n\n__Default value:__ `\"x\"`"
315
315
  },
316
+ "debounce": {
317
+ "description": "Debounce time for data updates, in milliseconds. Debouncing prevents excessive data updates when the user is zooming or panning around.\n\n__Default value:__ `200`",
318
+ "type": "number"
319
+ },
320
+ "debounceMode": {
321
+ "description": "The debounce mode for data updates. If set to `\"domain\"`, domain change events (panning and zooming) will be debounced. If set to `\"window\"`, the data fetches initiated by the changes to the visible window (or tile) will be debounced. If your data is small, the `\"window\"` is better as it will start fetching data while the user is still panning around, resulting in a shorter perceived latency.\n\n__Default value:__ `\"window\"`",
322
+ "enum": [
323
+ "domain",
324
+ "window"
325
+ ],
326
+ "type": "string"
327
+ },
316
328
  "indexUrl": {
317
329
  "description": "URL of the index file.\n\n__Default value:__ `url` + `\".bai\"`.",
318
330
  "type": "string"
@@ -352,6 +364,18 @@
352
364
  "$ref": "#/definitions/PrimaryPositionalChannel",
353
365
  "description": "Which channel's scale domain to monitor.\n\n__Default value:__ `\"x\"`"
354
366
  },
367
+ "debounce": {
368
+ "description": "Debounce time for data updates, in milliseconds. Debouncing prevents excessive data updates when the user is zooming or panning around.\n\n__Default value:__ `200`",
369
+ "type": "number"
370
+ },
371
+ "debounceMode": {
372
+ "description": "The debounce mode for data updates. If set to `\"domain\"`, domain change events (panning and zooming) will be debounced. If set to `\"window\"`, the data fetches initiated by the changes to the visible window (or tile) will be debounced. If your data is small, the `\"window\"` is better as it will start fetching data while the user is still panning around, resulting in a shorter perceived latency.\n\n__Default value:__ `\"window\"`",
373
+ "enum": [
374
+ "domain",
375
+ "window"
376
+ ],
377
+ "type": "string"
378
+ },
355
379
  "type": {
356
380
  "const": "bigbed",
357
381
  "type": "string"
@@ -378,6 +402,18 @@
378
402
  "$ref": "#/definitions/PrimaryPositionalChannel",
379
403
  "description": "Which channel's scale domain to monitor.\n\n__Default value:__ `\"x\"`"
380
404
  },
405
+ "debounce": {
406
+ "description": "Debounce time for data updates, in milliseconds. Debouncing prevents excessive data updates when the user is zooming or panning around.\n\n__Default value:__ `200`",
407
+ "type": "number"
408
+ },
409
+ "debounceMode": {
410
+ "description": "The debounce mode for data updates. If set to `\"domain\"`, domain change events (panning and zooming) will be debounced. If set to `\"window\"`, the data fetches initiated by the changes to the visible window (or tile) will be debounced. If your data is small, the `\"window\"` is better as it will start fetching data while the user is still panning around, resulting in a shorter perceived latency.\n\n__Default value:__ `\"window\"`",
411
+ "enum": [
412
+ "domain",
413
+ "window"
414
+ ],
415
+ "type": "string"
416
+ },
381
417
  "pixelsPerBin": {
382
418
  "description": "The approximate minimum width of each data bin, in pixels.\n\n__Default value:__ `2`",
383
419
  "type": "number"
@@ -1108,6 +1144,19 @@
1108
1144
  ],
1109
1145
  "type": "object"
1110
1146
  },
1147
+ "ExprRef": {
1148
+ "additionalProperties": false,
1149
+ "properties": {
1150
+ "expr": {
1151
+ "description": "The expression string.",
1152
+ "type": "string"
1153
+ }
1154
+ },
1155
+ "required": [
1156
+ "expr"
1157
+ ],
1158
+ "type": "object"
1159
+ },
1111
1160
  "Field": {
1112
1161
  "description": "The name of the field or a JavaScript expression for accessing nested properties. Dots and brackets in the field name must be escaped.",
1113
1162
  "type": "string"
@@ -1773,10 +1822,18 @@
1773
1822
  "$ref": "#/definitions/PrimaryPositionalChannel",
1774
1823
  "description": "Which channel's scale domain to monitor.\n\n__Default value:__ `\"x\"`"
1775
1824
  },
1776
- "debounceDomainChange": {
1777
- "description": "The debounce time for domain changes, in milliseconds. Debouncing prevents data fetches while the user is still panning around.\n\n__Default value:__ `200`",
1825
+ "debounce": {
1826
+ "description": "Debounce time for data updates, in milliseconds. Debouncing prevents excessive data updates when the user is zooming or panning around.\n\n__Default value:__ `200`",
1778
1827
  "type": "number"
1779
1828
  },
1829
+ "debounceMode": {
1830
+ "description": "The debounce mode for data updates. If set to `\"domain\"`, domain change events (panning and zooming) will be debounced. If set to `\"window\"`, the data fetches initiated by the changes to the visible window (or tile) will be debounced. If your data is small, the `\"window\"` is better as it will start fetching data while the user is still panning around, resulting in a shorter perceived latency.\n\n__Default value:__ `\"window\"`",
1831
+ "enum": [
1832
+ "domain",
1833
+ "window"
1834
+ ],
1835
+ "type": "string"
1836
+ },
1780
1837
  "indexUrl": {
1781
1838
  "description": "Url of the tabix index file.\n\n__Default value:__ `url` + `\".tbi\"`.",
1782
1839
  "type": "string"
@@ -2044,6 +2101,18 @@
2044
2101
  "$ref": "#/definitions/PrimaryPositionalChannel",
2045
2102
  "description": "Which channel's scale domain to monitor.\n\n__Default value:__ `\"x\"`"
2046
2103
  },
2104
+ "debounce": {
2105
+ "description": "Debounce time for data updates, in milliseconds. Debouncing prevents excessive data updates when the user is zooming or panning around.\n\n__Default value:__ `200`",
2106
+ "type": "number"
2107
+ },
2108
+ "debounceMode": {
2109
+ "description": "The debounce mode for data updates. If set to `\"domain\"`, domain change events (panning and zooming) will be debounced. If set to `\"window\"`, the data fetches initiated by the changes to the visible window (or tile) will be debounced. If your data is small, the `\"window\"` is better as it will start fetching data while the user is still panning around, resulting in a shorter perceived latency.\n\n__Default value:__ `\"window\"`",
2110
+ "enum": [
2111
+ "domain",
2112
+ "window"
2113
+ ],
2114
+ "type": "string"
2115
+ },
2047
2116
  "indexUrl": {
2048
2117
  "description": "URL of the index file.\n\n__Default value:__ `url` + `\".fai\"`.",
2049
2118
  "type": "string"
@@ -2470,25 +2539,38 @@
2470
2539
  {
2471
2540
  "const": false,
2472
2541
  "type": "boolean"
2542
+ },
2543
+ {
2544
+ "$ref": "#/definitions/ExprRef"
2473
2545
  }
2474
2546
  ],
2475
2547
  "description": "The range of the `\"arc\"` shape's fading distance in pixels. This property allows for making the arc's opacity fade out as it extends away from the chord. The fading distance is interpolated from one to zero between the interval defined by this property. Both `false` and `[0, 0]` disable fading.\n\n**Default value:** `false`"
2476
2548
  },
2477
2549
  "arcHeightFactor": {
2478
- "description": "Scaling factor for the `\"arc`\" shape's height. The default value `1.0` produces roughly circular arcs.\n\n**Default value:** `1.0`",
2479
- "type": "number"
2550
+ "anyOf": [
2551
+ {
2552
+ "type": "number"
2553
+ },
2554
+ {
2555
+ "$ref": "#/definitions/ExprRef"
2556
+ }
2557
+ ],
2558
+ "description": "Scaling factor for the `\"arc`\" shape's height. The default value `1.0` produces roughly circular arcs.\n\n**Default value:** `1.0`"
2480
2559
  },
2481
2560
  "baseline": {
2482
2561
  "$ref": "#/definitions/Baseline",
2483
2562
  "description": "The vertical alignment of the text. One of `\"top\"`, `\"middle\"`, `\"bottom\"`.\n\n**Default value:** `\"bottom\"`"
2484
2563
  },
2485
- "buildIndex": {
2486
- "description": "Builds and index for efficient rendering of subsets of the data. The data must be sorted by the x coordinate.\n\nTODO: This should be enabled automatically if the data are sorted.",
2487
- "type": "boolean"
2488
- },
2489
2564
  "clampApex": {
2490
- "description": "Whether the apex of the `\"dome\"` shape is clamped to the viewport edge. When over a half of the dome is located outside the viewport, clamping allows for more accurate reading of the value encoded by the apex' position.\n\n**Default value:** `false`",
2491
- "type": "boolean"
2565
+ "anyOf": [
2566
+ {
2567
+ "type": "boolean"
2568
+ },
2569
+ {
2570
+ "$ref": "#/definitions/ExprRef"
2571
+ }
2572
+ ],
2573
+ "description": "Whether the apex of the `\"dome\"` shape is clamped to the viewport edge. When over a half of the dome is located outside the viewport, clamping allows for more accurate reading of the value encoded by the apex' position.\n\n**Default value:** `false`"
2492
2574
  },
2493
2575
  "clip": {
2494
2576
  "anyOf": [
@@ -2506,24 +2588,59 @@
2506
2588
  "type": "string"
2507
2589
  },
2508
2590
  "cornerRadius": {
2509
- "description": "Radius of the rounded corners.\n\n**Default value:** `0`",
2510
- "type": "number"
2591
+ "anyOf": [
2592
+ {
2593
+ "type": "number"
2594
+ },
2595
+ {
2596
+ "$ref": "#/definitions/ExprRef"
2597
+ }
2598
+ ],
2599
+ "description": "Radius of the rounded corners.\n\n**Default value:** `0`"
2511
2600
  },
2512
2601
  "cornerRadiusBottomLeft": {
2513
- "description": "Radius of the bottom left rounded corner. Has higher precedence than `cornerRadius`.\n\n**Default value:** (None)",
2514
- "type": "number"
2602
+ "anyOf": [
2603
+ {
2604
+ "type": "number"
2605
+ },
2606
+ {
2607
+ "$ref": "#/definitions/ExprRef"
2608
+ }
2609
+ ],
2610
+ "description": "Radius of the bottom left rounded corner. Has higher precedence than `cornerRadius`.\n\n**Default value:** (None)"
2515
2611
  },
2516
2612
  "cornerRadiusBottomRight": {
2517
- "description": "Radius of the bottom right rounded corner. Has higher precedence than `cornerRadius`.\n\n**Default value:** (None)",
2518
- "type": "number"
2613
+ "anyOf": [
2614
+ {
2615
+ "type": "number"
2616
+ },
2617
+ {
2618
+ "$ref": "#/definitions/ExprRef"
2619
+ }
2620
+ ],
2621
+ "description": "Radius of the bottom right rounded corner. Has higher precedence than `cornerRadius`.\n\n**Default value:** (None)"
2519
2622
  },
2520
2623
  "cornerRadiusTopLeft": {
2521
- "description": "Radius of the top left rounded corner. Has higher precedence than `cornerRadius`.\n\n**Default value:** (None)",
2522
- "type": "number"
2624
+ "anyOf": [
2625
+ {
2626
+ "type": "number"
2627
+ },
2628
+ {
2629
+ "$ref": "#/definitions/ExprRef"
2630
+ }
2631
+ ],
2632
+ "description": "Radius of the top left rounded corner. Has higher precedence than `cornerRadius`.\n\n**Default value:** (None)"
2523
2633
  },
2524
2634
  "cornerRadiusTopRight": {
2525
- "description": "Radius of the top right rounded corner. Has higher precedence than `cornerRadius`.\n\n**Default value:** (None)",
2526
- "type": "number"
2635
+ "anyOf": [
2636
+ {
2637
+ "type": "number"
2638
+ },
2639
+ {
2640
+ "$ref": "#/definitions/ExprRef"
2641
+ }
2642
+ ],
2643
+ "description": "Radius of the top right rounded corner. Has higher precedence than `cornerRadius`.\n\n**Default value:** (None)"
2527
2644
  },
2528
2645
  "dx": {
2529
2646
  "description": "The horizontal offset between the text and its anchor point, in pixels. Applied after the rotation by `angle`.",
@@ -2582,61 +2699,132 @@
2582
2699
  "type": "boolean"
2583
2700
  },
2584
2701
  "linkShape": {
2585
- "description": "The shape of the link path. Either `\"arc\"`, `\"diagonal\"`, `\"line\"`, or `\"dome\"`.\n\n**Default value:** `\"arc\"`",
2586
- "enum": [
2587
- "arc",
2588
- "diagonal",
2589
- "line",
2590
- "dome"
2702
+ "anyOf": [
2703
+ {
2704
+ "const": "arc",
2705
+ "type": "string"
2706
+ },
2707
+ {
2708
+ "const": "diagonal",
2709
+ "type": "string"
2710
+ },
2711
+ {
2712
+ "const": "line",
2713
+ "type": "string"
2714
+ },
2715
+ {
2716
+ "const": "dome",
2717
+ "type": "string"
2718
+ },
2719
+ {
2720
+ "$ref": "#/definitions/ExprRef"
2721
+ }
2591
2722
  ],
2592
- "type": "string"
2723
+ "description": "The shape of the link path. Either `\"arc\"`, `\"diagonal\"`, `\"line\"`, or `\"dome\"`.\n\n**Default value:** `\"arc\"`"
2593
2724
  },
2594
2725
  "logoLetters": {
2595
2726
  "description": "Stretch letters so that they can be used with [sequence logos](https://en.wikipedia.org/wiki/Sequence_logo), etc...",
2596
2727
  "type": "boolean"
2597
2728
  },
2598
2729
  "maxChordLength": {
2599
- "description": "The maximum length of `\"arc\"` shape's chord in pixels. The chord is the line segment between the two points that define the arc. Limiting the chord length serves two purposes when zooming in close enough: 1) it prevents the arc from becoming a straight line and 2) it mitigates the limited precision of floating point numbers in arc rendering.\n\n**Default value:** `50000`",
2600
- "type": "number"
2730
+ "anyOf": [
2731
+ {
2732
+ "type": "number"
2733
+ },
2734
+ {
2735
+ "$ref": "#/definitions/ExprRef"
2736
+ }
2737
+ ],
2738
+ "description": "The maximum length of `\"arc\"` shape's chord in pixels. The chord is the line segment between the two points that define the arc. Limiting the chord length serves two purposes when zooming in close enough: 1) it prevents the arc from becoming a straight line and 2) it mitigates the limited precision of floating point numbers in arc rendering.\n\n**Default value:** `50000`"
2601
2739
  },
2602
2740
  "minArcHeight": {
2603
- "description": "The minimum height of an `\"arc\"` shape. Makes very short links more clearly visible.\n\n**Default value:** `1.5`",
2604
- "type": "number"
2741
+ "anyOf": [
2742
+ {
2743
+ "type": "number"
2744
+ },
2745
+ {
2746
+ "$ref": "#/definitions/ExprRef"
2747
+ }
2748
+ ],
2749
+ "description": "The minimum height of an `\"arc\"` shape. Makes very short links more clearly visible.\n\n**Default value:** `1.5`"
2605
2750
  },
2606
2751
  "minBufferSize": {
2607
2752
  "description": "Minimum size for WebGL buffers (number of data items). Allows for using `bufferSubData()` to update graphics.\n\nThis property is intended for internal use.",
2608
2753
  "type": "number"
2609
2754
  },
2610
2755
  "minHeight": {
2611
- "description": "The minimum height of a rectangle in pixels. The property clamps rectangles' heights.\n\n**Default value:** `0`",
2612
- "type": "number"
2756
+ "anyOf": [
2757
+ {
2758
+ "type": "number"
2759
+ },
2760
+ {
2761
+ "$ref": "#/definitions/ExprRef"
2762
+ }
2763
+ ],
2764
+ "description": "The minimum height of a rectangle in pixels. The property clamps rectangles' heights.\n\n**Default value:** `0`"
2613
2765
  },
2614
2766
  "minLength": {
2615
- "description": "The minimum length of the rule in pixels. Use this property to ensure that very short ranged rules remain visible even when the user zooms out.\n\n**Default value:** `0`",
2616
- "type": "number"
2767
+ "anyOf": [
2768
+ {
2769
+ "type": "number"
2770
+ },
2771
+ {
2772
+ "$ref": "#/definitions/ExprRef"
2773
+ }
2774
+ ],
2775
+ "description": "The minimum length of the rule in pixels. Use this property to ensure that very short ranged rules remain visible even when the user zooms out.\n\n**Default value:** `0`"
2617
2776
  },
2618
2777
  "minOpacity": {
2619
- "description": "Clamps the minimum size-dependent opacity. The property does not affect the `opacity` channel. Valid values are between `0` and `1`.\n\nWhen a rectangle would be smaller than what is specified in `minHeight` and `minWidth`, it is faded out proportionally. Example: a rectangle would be rendered as one pixel wide, but `minWidth` clamps it to five pixels. The rectangle is actually rendered as five pixels wide, but its opacity is multiplied by 0.2. With this setting, you can limit the factor to, for example, 0.5 to keep the rectangles more clearly visible.\n\n**Default value:** `0`",
2620
- "type": "number"
2778
+ "anyOf": [
2779
+ {
2780
+ "type": "number"
2781
+ },
2782
+ {
2783
+ "$ref": "#/definitions/ExprRef"
2784
+ }
2785
+ ],
2786
+ "description": "Clamps the minimum size-dependent opacity. The property does not affect the `opacity` channel. Valid values are between `0` and `1`.\n\nWhen a rectangle would be smaller than what is specified in `minHeight` and `minWidth`, it is faded out proportionally. Example: a rectangle would be rendered as one pixel wide, but `minWidth` clamps it to five pixels. The rectangle is actually rendered as five pixels wide, but its opacity is multiplied by 0.2. With this setting, you can limit the factor to, for example, 0.5 to keep the rectangles more clearly visible.\n\n**Default value:** `0`"
2621
2787
  },
2622
2788
  "minPickingSize": {
2623
- "description": "The minimum stroke width of the links when pointing with the mouse cursor. Allows making very thin links easier to point at.\n\n**Default value:** `3.0`",
2624
- "type": "number"
2789
+ "anyOf": [
2790
+ {
2791
+ "type": "number"
2792
+ },
2793
+ {
2794
+ "$ref": "#/definitions/ExprRef"
2795
+ }
2796
+ ],
2797
+ "description": "The minimum stroke width of the links when pointing with the mouse cursor. Allows making very thin links easier to point at.\n\n**Default value:** `3.0`"
2625
2798
  },
2626
2799
  "minWidth": {
2627
- "description": "The minimum width of a rectangle in pixels. The property clamps rectangles' widths when the viewport is zoomed out.\n\nThis property also reduces flickering of very narrow rectangles when zooming. The value should generally be at least one.\n\n**Default value:** `1`",
2628
- "type": "number"
2800
+ "anyOf": [
2801
+ {
2802
+ "type": "number"
2803
+ },
2804
+ {
2805
+ "$ref": "#/definitions/ExprRef"
2806
+ }
2807
+ ],
2808
+ "description": "The minimum width of a rectangle in pixels. The property clamps rectangles' widths when the viewport is zoomed out.\n\nThis property also reduces flickering of very narrow rectangles when zooming. The value should generally be at least one.\n\n**Default value:** `1`"
2629
2809
  },
2630
2810
  "opacity": {
2631
2811
  "type": "number"
2632
2812
  },
2633
2813
  "orient": {
2634
- "description": "The orientation of the link path. Either `\"vertical\"` or `\"horizontal\"`. Only applies to diagonal links.\n\n**Default value:** `\"vertical\"`",
2635
- "enum": [
2636
- "vertical",
2637
- "horizontal"
2814
+ "anyOf": [
2815
+ {
2816
+ "const": "vertical",
2817
+ "type": "string"
2818
+ },
2819
+ {
2820
+ "const": "horizontal",
2821
+ "type": "string"
2822
+ },
2823
+ {
2824
+ "$ref": "#/definitions/ExprRef"
2825
+ }
2638
2826
  ],
2639
- "type": "string"
2827
+ "description": "The orientation of the link path. Either `\"vertical\"` or `\"horizontal\"`. Only applies to diagonal links.\n\n**Default value:** `\"vertical\"`"
2640
2828
  },
2641
2829
  "paddingX": {
2642
2830
  "description": "The horizontal padding, in pixels, when the `x2` channel is used for ranged text.\n\n**Default value:** `0`",
@@ -2675,13 +2863,24 @@
2675
2863
  "type": "string"
2676
2864
  },
2677
2865
  "strokeCap": {
2678
- "description": "The style of stroke ends. Available choices: `\"butt\"`, `\"round`\", and `\"square\"`.\n\n**Default value:** `\"butt\"`",
2679
- "enum": [
2680
- "butt",
2681
- "square",
2682
- "round"
2866
+ "anyOf": [
2867
+ {
2868
+ "const": "butt",
2869
+ "type": "string"
2870
+ },
2871
+ {
2872
+ "const": "square",
2873
+ "type": "string"
2874
+ },
2875
+ {
2876
+ "const": "round",
2877
+ "type": "string"
2878
+ },
2879
+ {
2880
+ "$ref": "#/definitions/ExprRef"
2881
+ }
2683
2882
  ],
2684
- "type": "string"
2883
+ "description": "The style of stroke ends. Available choices: `\"butt\"`, `\"round`\", and `\"square\"`.\n\n**Default value:** `\"butt\"`"
2685
2884
  },
2686
2885
  "strokeDash": {
2687
2886
  "description": "An array of of alternating stroke and gap lengths or `null` for solid strokes.\n\n**Default value:** `null`",
@@ -6310,6 +6509,9 @@
6310
6509
  },
6311
6510
  {
6312
6511
  "$ref": "#/definitions/DynamicOpacity"
6512
+ },
6513
+ {
6514
+ "$ref": "#/definitions/ExprRef"
6313
6515
  }
6314
6516
  ]
6315
6517
  },
@@ -14,6 +14,6 @@ export default class AxisGenomeSource extends SingleAxisLazySource {
14
14
  }
15
15
 
16
16
  async load() {
17
- this.publishData(this.genome.chromosomes);
17
+ this.publishData([this.genome.chromosomes]);
18
18
  }
19
19
  }
@@ -65,9 +65,9 @@ export default class AxisTickSource extends SingleAxisLazySource {
65
65
  this.ticks = ticks;
66
66
 
67
67
  const format = tickFormat(scale, requestedCount, axisParams.format);
68
- this.publishData(
69
- ticks.map((tick) => ({ value: tick, label: format(tick) }))
70
- );
68
+ this.publishData([
69
+ ticks.map((tick) => ({ value: tick, label: format(tick) })),
70
+ ]);
71
71
  }
72
72
  }
73
73
  }
@@ -1,21 +1,9 @@
1
- declare const BamSource_base: {
2
- new (...args: any[]): {
3
- [x: string]: any;
4
- lastQuantizedInterval: number[];
5
- quantizeInterval(interval: number[], windowSize: number): number[];
6
- checkAndUpdateLastInterval(interval: number[]): boolean;
7
- };
8
- } & typeof SingleAxisLazySource;
9
- export default class BamSource extends BamSource_base {
1
+ export default class BamSource extends SingleAxisWindowedSource {
10
2
  /**
11
3
  * @param {import("../../../spec/data.js").BamData} params
12
4
  * @param {import("../../../view/view.js").default} view
13
5
  */
14
6
  constructor(params: import("../../../spec/data.js").BamData, view: import("../../../view/view.js").default);
15
- /** Keep track of the order of the requests */
16
- lastRequestId: number;
17
- /** @type {import("@gmod/bam").BamFile} */
18
- bam: import("@gmod/bam").BamFile;
19
7
  /**
20
8
  * Some BAM files lack the "chr" prefix on their reference names. For example:
21
9
  * http://genome.ucsc.edu/goldenPath/help/examples/bamExample.bam
@@ -28,13 +16,7 @@ export default class BamSource extends BamSource_base {
28
16
  chrPrefixFixer: (chr: string) => string;
29
17
  params: import("../../../spec/data.js").BamData;
30
18
  initializedPromise: Promise<any>;
31
- /**
32
- * Listen to the domain change event and update data when the covered windows change.
33
- *
34
- * @param {number[]} domain Linearized domain
35
- */
36
- onDomainChanged(domain: number[]): Promise<void>;
19
+ #private;
37
20
  }
38
- import SingleAxisLazySource from "./singleAxisLazySource.js";
39
- export {};
21
+ import SingleAxisWindowedSource from "./singleAxisWindowedSource.js";
40
22
  //# sourceMappingURL=bamSource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bamSource.d.ts","sourceRoot":"","sources":["../../../../../src/data/sources/dynamic/bamSource.js"],"names":[],"mappings":";;;;;;;;AAIA;IAkBI;;;OAGG;IACH,oBAHW,OAAO,uBAAuB,EAAE,OAAO,QACvC,OAAO,uBAAuB,EAAE,OAAO,EA+CjD;IAlED,8CAA8C;IAC9C,sBAAkB;IAElB,0CAA0C;IAC1C,KADW,OAAO,WAAW,EAAE,OAAO,CAClC;IAEJ;;;;;;;;OAQG;IACH,sBAFgB,MAAM,KAAK,MAAM,CAEH;IAgB1B,gDAAgC;IAMhC,iCA4BE;IAGN;;;;OAIG;IACH,wBAFW,MAAM,EAAE,iBA6ClB;CACJ;iCA1HgC,2BAA2B"}
1
+ {"version":3,"file":"bamSource.d.ts","sourceRoot":"","sources":["../../../../../src/data/sources/dynamic/bamSource.js"],"names":[],"mappings":"AAGA;IAeI;;;OAGG;IACH,oBAHW,OAAO,uBAAuB,EAAE,OAAO,QACvC,OAAO,uBAAuB,EAAE,OAAO,EAmDjD;IAhED;;;;;;;;OAQG;IACH,sBAFgB,MAAM,KAAK,MAAM,CAEH;IAkB1B,gDAAgC;IAQhC,iCA4BE;;CAmCT;qCAxGoC,+BAA+B"}
@@ -1,13 +1,9 @@
1
- import SingleAxisLazySource from "./singleAxisLazySource.js";
2
- import windowedMixin from "./windowedMixin.js";
3
1
  import addBaseUrl from "../../../utils/addBaseUrl.js";
2
+ import SingleAxisWindowedSource from "./singleAxisWindowedSource.js";
4
3
 
5
- export default class BamSource extends windowedMixin(SingleAxisLazySource) {
6
- /** Keep track of the order of the requests */
7
- lastRequestId = 0;
8
-
4
+ export default class BamSource extends SingleAxisWindowedSource {
9
5
  /** @type {import("@gmod/bam").BamFile} */
10
- bam;
6
+ #bam;
11
7
 
12
8
  /**
13
9
  * Some BAM files lack the "chr" prefix on their reference names. For example:
@@ -29,6 +25,8 @@ export default class BamSource extends windowedMixin(SingleAxisLazySource) {
29
25
  const paramsWithDefaults = {
30
26
  channel: "x",
31
27
  windowSize: 20000,
28
+ debounce: 200,
29
+ debounceMode: "domain",
32
30
  ...params,
33
31
  };
34
32
 
@@ -40,6 +38,8 @@ export default class BamSource extends windowedMixin(SingleAxisLazySource) {
40
38
  throw new Error("No URL provided for BamSource");
41
39
  }
42
40
 
41
+ this.setupDebouncing(this.params);
42
+
43
43
  this.initializedPromise = new Promise((resolve) => {
44
44
  Promise.all([
45
45
  import("@gmod/bam"),
@@ -48,17 +48,17 @@ export default class BamSource extends windowedMixin(SingleAxisLazySource) {
48
48
  const withBase = (/** @type {string} */ uri) =>
49
49
  new RemoteFile(addBaseUrl(uri, this.view.getBaseUrl()));
50
50
 
51
- this.bam = new BamFile({
51
+ this.#bam = new BamFile({
52
52
  bamFilehandle: withBase(this.params.url),
53
53
  baiFilehandle: withBase(
54
54
  this.params.indexUrl ?? this.params.url + ".bai"
55
55
  ),
56
56
  });
57
57
 
58
- this.bam.getHeader().then((_header) => {
58
+ this.#bam.getHeader().then((_header) => {
59
59
  const g = this.genome.hasChrPrefix();
60
60
  const b =
61
- this.bam.indexToChr?.[0]?.refName.startsWith("chr");
61
+ this.#bam.indexToChr?.[0]?.refName.startsWith("chr");
62
62
  if (g && !b) {
63
63
  this.chrPrefixFixer = (chr) => chr.replace("chr", "");
64
64
  } else if (!g && b) {
@@ -72,52 +72,35 @@ export default class BamSource extends windowedMixin(SingleAxisLazySource) {
72
72
  }
73
73
 
74
74
  /**
75
- * Listen to the domain change event and update data when the covered windows change.
76
- *
77
- * @param {number[]} domain Linearized domain
75
+ * @param {number[]} interval linearized domain
78
76
  */
79
- async onDomainChanged(domain) {
80
- const windowSize = this.params.windowSize;
81
-
82
- if (domain[1] - domain[0] > windowSize) {
83
- return;
84
- }
85
-
86
- await this.initializedPromise;
87
-
88
- const quantizedInterval = this.quantizeInterval(domain, windowSize);
89
-
90
- if (this.checkAndUpdateLastInterval(quantizedInterval)) {
91
- const discreteChromosomeIntervals =
92
- this.genome.continuousToDiscreteChromosomeIntervals(
93
- quantizedInterval
94
- );
95
-
96
- // TODO: Error handling
97
- const sequencesWithChrom = await Promise.all(
98
- discreteChromosomeIntervals.map((d) =>
99
- this.bam
100
- .getRecordsForRange(
101
- this.chrPrefixFixer(d.chrom),
102
- d.startPos,
103
- d.endPos
104
- )
105
- .then((records) =>
106
- records.map((record) => ({
107
- chrom: d.chrom,
108
- start: record.get("start"),
109
- end: record.get("end"),
110
- name: record.get("name"),
111
- MD: record.get("MD"),
112
- cigar: record.get("cigar"),
113
- mapq: record.get("mq"),
114
- strand: record.get("strand") === 1 ? "+" : "-",
115
- }))
116
- )
117
- )
118
- );
119
-
120
- this.publishData(sequencesWithChrom.flat());
77
+ async loadInterval(interval) {
78
+ const featureChunks = await this.discretizeAndLoad(
79
+ interval,
80
+ async (d, signal) =>
81
+ this.#bam
82
+ .getRecordsForRange(
83
+ this.chrPrefixFixer(d.chrom),
84
+ d.startPos,
85
+ d.endPos,
86
+ { signal }
87
+ )
88
+ .then((records) =>
89
+ records.map((record) => ({
90
+ chrom: d.chrom,
91
+ start: record.get("start"),
92
+ end: record.get("end"),
93
+ name: record.get("name"),
94
+ MD: record.get("MD"),
95
+ cigar: record.get("cigar"),
96
+ mapq: record.get("mq"),
97
+ strand: record.get("strand") === 1 ? "+" : "-",
98
+ }))
99
+ )
100
+ );
101
+
102
+ if (featureChunks) {
103
+ this.publishData(featureChunks);
121
104
  }
122
105
  }
123
106
  }