higlass 1.13.2 → 1.13.3

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 (244) hide show
  1. package/README.md +0 -2
  2. package/app/globals.d.ts +4 -4
  3. package/app/missing-types.d.ts +3 -3
  4. package/app/scripts/AddTrackDialog.jsx +1 -0
  5. package/app/scripts/AddTrackPositionMenu.jsx +17 -4
  6. package/app/scripts/Annotations1dTrack.js +1 -0
  7. package/app/scripts/Annotations2dTrack.js +1 -0
  8. package/app/scripts/ArrowheadDomainsTrack.js +1 -0
  9. package/app/scripts/Autocomplete.jsx +1 -0
  10. package/app/scripts/AxisPixi.js +1 -0
  11. package/app/scripts/BarTrack.js +1 -0
  12. package/app/scripts/BedLikeTrack.js +1 -0
  13. package/app/scripts/Button.jsx +1 -0
  14. package/app/scripts/CNVIntervalTrack.js +1 -0
  15. package/app/scripts/CenterTiledPlot.jsx +1 -0
  16. package/app/scripts/CenterTrack.jsx +1 -0
  17. package/app/scripts/Chromosome2DAnnotations.js +1 -0
  18. package/app/scripts/Chromosome2DLabels.js +1 -0
  19. package/app/scripts/ChromosomeGrid.js +1 -0
  20. package/app/scripts/ChromosomeInfo.js +1 -0
  21. package/app/scripts/CloseTrackMenu.jsx +1 -0
  22. package/app/scripts/CombinedTrack.js +1 -0
  23. package/app/scripts/ConfigTrackMenu.jsx +1 -0
  24. package/app/scripts/ConfigViewMenu.jsx +1 -0
  25. package/app/scripts/ConfigureSeriesMenu.jsx +1 -0
  26. package/app/scripts/ContextMenuContainer.jsx +1 -0
  27. package/app/scripts/ContextMenuItem.jsx +1 -0
  28. package/app/scripts/Cross.jsx +1 -0
  29. package/app/scripts/CrossRule.js +1 -0
  30. package/app/scripts/CustomTrackDialog.jsx +1 -0
  31. package/app/scripts/Dialog.jsx +1 -0
  32. package/app/scripts/DivergentBarTrack.js +1 -0
  33. package/app/scripts/DragListeningDiv.jsx +1 -0
  34. package/app/scripts/DraggableDiv.jsx +1 -0
  35. package/app/scripts/ExportLinkDialog.jsx +1 -0
  36. package/app/scripts/FixedTrack.jsx +1 -0
  37. package/app/scripts/GalleryTracks.jsx +1 -0
  38. package/app/scripts/GenomePositionSearchBox.jsx +1 -0
  39. package/app/scripts/HeatmapOptions.jsx +1 -0
  40. package/app/scripts/HeatmapTiledPixiTrack.js +1 -0
  41. package/app/scripts/HiGlassComponent.jsx +1 -0
  42. package/app/scripts/HiGlassTrackComponent.jsx +1 -0
  43. package/app/scripts/Horizontal1dHeatmapTrack.js +1 -0
  44. package/app/scripts/Horizontal2DDomainsTrack.js +1 -0
  45. package/app/scripts/HorizontalChromosomeLabels.js +1 -0
  46. package/app/scripts/HorizontalGeneAnnotationsTrack.js +1 -0
  47. package/app/scripts/HorizontalHeatmapTrack.js +1 -0
  48. package/app/scripts/HorizontalItem.jsx +1 -0
  49. package/app/scripts/HorizontalLine1DPixiTrack.js +1 -0
  50. package/app/scripts/HorizontalMultivecTrack.js +1 -0
  51. package/app/scripts/HorizontalPoint1DPixiTrack.js +1 -0
  52. package/app/scripts/HorizontalRule.js +1 -0
  53. package/app/scripts/HorizontalTiled1DPixiTrack.js +1 -0
  54. package/app/scripts/HorizontalTiledPlot.jsx +1 -0
  55. package/app/scripts/HorizontalTrack.jsx +1 -0
  56. package/app/scripts/Id2DTiledPixiTrack.js +1 -0
  57. package/app/scripts/IdHorizontal1DTiledPixiTrack.js +1 -0
  58. package/app/scripts/IdVertical1DTiledPixiTrack.js +1 -0
  59. package/app/scripts/LeftAxisTrack.js +1 -0
  60. package/app/scripts/LeftTrackModifier.js +1 -0
  61. package/app/scripts/ListWrapper.jsx +1 -0
  62. package/app/scripts/MapboxTilesTrack.js +1 -0
  63. package/app/scripts/Modal.jsx +1 -0
  64. package/app/scripts/MoveableTrack.jsx +1 -0
  65. package/app/scripts/NestedContextMenu.jsx +1 -0
  66. package/app/scripts/OSMTileIdsTrack.js +1 -0
  67. package/app/scripts/OSMTilesTrack.js +1 -0
  68. package/app/scripts/OverlayTrack.js +1 -0
  69. package/app/scripts/PixiTrack.js +0 -1
  70. package/app/scripts/PlotTypeChooser.jsx +1 -0
  71. package/app/scripts/PopupMenu.jsx +1 -0
  72. package/app/scripts/RasterTilesTrack.js +1 -0
  73. package/app/scripts/RuleMixin.js +1 -0
  74. package/app/scripts/SVGTrack.js +1 -0
  75. package/app/scripts/SearchField.js +1 -0
  76. package/app/scripts/SeriesListItems.jsx +1 -0
  77. package/app/scripts/SeriesListMenu.jsx +1 -0
  78. package/app/scripts/SeriesListSubmenuMixin.jsx +1 -0
  79. package/app/scripts/SketchInlinePicker.jsx +1 -0
  80. package/app/scripts/SortableList.jsx +1 -0
  81. package/app/scripts/SquareMarkersTrack.js +1 -0
  82. package/app/scripts/Tiled1DPixiTrack.js +1 -0
  83. package/app/scripts/TiledPixiTrack.js +1 -0
  84. package/app/scripts/TiledPlot.jsx +1 -0
  85. package/app/scripts/TilesetFinder.jsx +1 -0
  86. package/app/scripts/TopAxisTrack.js +1 -0
  87. package/app/scripts/Track.js +0 -1
  88. package/app/scripts/TrackArea.jsx +1 -0
  89. package/app/scripts/TrackControl.jsx +1 -0
  90. package/app/scripts/TrackRenderer.jsx +0 -1
  91. package/app/scripts/UnknownPixiTrack.js +1 -0
  92. package/app/scripts/ValueIntervalTrack.js +1 -0
  93. package/app/scripts/VerticalItem.jsx +1 -0
  94. package/app/scripts/VerticalRule.js +1 -0
  95. package/app/scripts/VerticalTiled1DPixiTrack.js +1 -0
  96. package/app/scripts/VerticalTiledPlot.jsx +1 -0
  97. package/app/scripts/VerticalTrack.jsx +1 -0
  98. package/app/scripts/ViewConfigEditor.jsx +1 -0
  99. package/app/scripts/ViewContextMenu.jsx +1 -0
  100. package/app/scripts/ViewHeader.jsx +1 -0
  101. package/app/scripts/ViewportTracker2D.js +1 -0
  102. package/app/scripts/ViewportTracker2DPixi.js +1 -0
  103. package/app/scripts/ViewportTrackerHorizontal.js +1 -0
  104. package/app/scripts/ViewportTrackerVertical.js +1 -0
  105. package/app/scripts/api.js +1 -0
  106. package/app/scripts/configs/available-track-types.js +1 -0
  107. package/app/scripts/configs/colormaps.js +1 -0
  108. package/app/scripts/configs/datatype-to-track-type.js +1 -0
  109. package/app/scripts/configs/default-tracks-for-datatype.js +0 -1
  110. package/app/scripts/configs/dense-data-extrema-config.js +1 -0
  111. package/app/scripts/configs/globals.js +1 -0
  112. package/app/scripts/configs/index.js +1 -0
  113. package/app/scripts/configs/positions-by-datatype.js +1 -0
  114. package/app/scripts/configs/primitives.js +0 -1
  115. package/app/scripts/configs/themes.js +1 -0
  116. package/app/scripts/configs/tracks-info-by-type.js +0 -1
  117. package/app/scripts/configs/tracks-info.js +0 -1
  118. package/app/scripts/d3-context-menu.js +1 -0
  119. package/app/scripts/data-fetchers/DataFetcher.js +193 -153
  120. package/app/scripts/data-fetchers/genbank-fetcher.js +205 -87
  121. package/app/scripts/data-fetchers/index.js +1 -0
  122. package/app/scripts/data-fetchers/local-tile-fetcher.js +37 -4
  123. package/app/scripts/hglib.jsx +1 -0
  124. package/app/scripts/hocs/with-modal.jsx +1 -0
  125. package/app/scripts/hocs/with-pub-sub.jsx +1 -0
  126. package/app/scripts/hocs/with-theme.jsx +1 -0
  127. package/app/scripts/icons.jsx +1 -0
  128. package/app/scripts/mixwith.js +1 -0
  129. package/app/scripts/options-info.js +1 -0
  130. package/app/scripts/plugins/available-for-plugins.js +1 -0
  131. package/app/scripts/plugins/get-data-fetcher.js +1 -0
  132. package/app/scripts/plugins/index.js +1 -0
  133. package/app/scripts/services/chrom-info.js +1 -0
  134. package/app/scripts/services/dom-event.js +1 -0
  135. package/app/scripts/services/element-resize-listener.js +1 -0
  136. package/app/scripts/services/index.js +1 -0
  137. package/app/scripts/services/tile-proxy.js +14 -10
  138. package/app/scripts/services/worker.js +161 -84
  139. package/app/scripts/symbol.js +1 -0
  140. package/app/scripts/test-helpers/index.js +1 -0
  141. package/app/scripts/test-helpers/test-helpers.jsx +1 -0
  142. package/app/scripts/track-utils.js +1 -0
  143. package/app/scripts/types.ts +59 -22
  144. package/app/scripts/utils/DenseDataExtrema1D.js +32 -19
  145. package/app/scripts/utils/DenseDataExtrema2D.js +51 -31
  146. package/app/scripts/utils/LruCache.js +1 -0
  147. package/app/scripts/utils/abs-to-chr.js +0 -1
  148. package/app/scripts/utils/accessor-transposition.js +0 -2
  149. package/app/scripts/utils/add-arrays.js +0 -2
  150. package/app/scripts/utils/add-class.js +0 -1
  151. package/app/scripts/utils/add-event-listener-once.js +0 -2
  152. package/app/scripts/utils/background-task-scheduler.js +0 -2
  153. package/app/scripts/utils/base64-to-canvas.js +0 -2
  154. package/app/scripts/utils/chr-to-abs.js +0 -2
  155. package/app/scripts/utils/chrom-info-bisector.js +0 -1
  156. package/app/scripts/utils/clone-event.js +0 -2
  157. package/app/scripts/utils/color-domain-to-rgba-array.js +1 -0
  158. package/app/scripts/utils/color-to-hex.js +0 -1
  159. package/app/scripts/utils/color-to-rgba.js +0 -1
  160. package/app/scripts/utils/data-to-genomic-loci.js +0 -1
  161. package/app/scripts/utils/debounce.js +0 -2
  162. package/app/scripts/utils/dec-to-hex-str.js +0 -1
  163. package/app/scripts/utils/dict-from-tuples.js +0 -2
  164. package/app/scripts/utils/dict-items.js +0 -2
  165. package/app/scripts/utils/dict-keys.js +0 -2
  166. package/app/scripts/utils/dict-values.js +0 -2
  167. package/app/scripts/utils/download.js +0 -2
  168. package/app/scripts/utils/expand-combined-tracks.js +1 -0
  169. package/app/scripts/utils/fill-in-min-widths.js +1 -0
  170. package/app/scripts/utils/flatten.js +1 -0
  171. package/app/scripts/utils/for-each.js +0 -1
  172. package/app/scripts/utils/forward-event.js +0 -1
  173. package/app/scripts/utils/genome-loci-to-pixels.js +0 -1
  174. package/app/scripts/utils/genomic-range-to-chromosome-chunks.js +0 -2
  175. package/app/scripts/utils/get-aggregation-function.js +6 -12
  176. package/app/scripts/utils/get-default-track-for-datatype.js +1 -0
  177. package/app/scripts/utils/get-element-dim.js +0 -1
  178. package/app/scripts/utils/get-higlass-components.js +1 -0
  179. package/app/scripts/utils/get-track-by-uid.js +1 -0
  180. package/app/scripts/utils/get-track-conf-from-hgc.js +1 -0
  181. package/app/scripts/utils/get-track-obj-by-id.js +1 -0
  182. package/app/scripts/utils/get-track-position-by-uid.js +1 -0
  183. package/app/scripts/utils/get-xylofon.js +1 -0
  184. package/app/scripts/utils/gradient.js +0 -2
  185. package/app/scripts/utils/has-class.js +0 -2
  186. package/app/scripts/utils/has-parent.js +1 -0
  187. package/app/scripts/utils/hex-string-to-int.js +0 -1
  188. package/app/scripts/utils/index.js +0 -1
  189. package/app/scripts/utils/interval-tree.js +1 -0
  190. package/app/scripts/utils/into-the-void.js +0 -1
  191. package/app/scripts/utils/is-track-or-child-track.js +0 -1
  192. package/app/scripts/utils/is-track-range-selectable.js +0 -1
  193. package/app/scripts/utils/is-within.js +0 -2
  194. package/app/scripts/utils/lat-to-y.js +0 -2
  195. package/app/scripts/utils/lng-to-x.js +0 -1
  196. package/app/scripts/utils/load-chrom-infos.js +1 -0
  197. package/app/scripts/utils/map.js +0 -1
  198. package/app/scripts/utils/max-non-zero.js +0 -1
  199. package/app/scripts/utils/max.js +0 -1
  200. package/app/scripts/utils/min-non-zero.js +0 -1
  201. package/app/scripts/utils/min.js +0 -1
  202. package/app/scripts/utils/mod.js +0 -1
  203. package/app/scripts/utils/ndarray-assign.js +1 -0
  204. package/app/scripts/utils/ndarray-flatten.js +1 -0
  205. package/app/scripts/utils/ndarray-to-list.js +1 -0
  206. package/app/scripts/utils/numericify-version.js +0 -1
  207. package/app/scripts/utils/obj-vals.js +1 -0
  208. package/app/scripts/utils/or.js +0 -1
  209. package/app/scripts/utils/parse-chromsizes-rows.js +0 -2
  210. package/app/scripts/utils/pixi-text-to-svg.js +1 -0
  211. package/app/scripts/utils/q.js +1 -0
  212. package/app/scripts/utils/rad-to-deg.js +0 -1
  213. package/app/scripts/utils/range-query-2d.js +1 -0
  214. package/app/scripts/utils/reduce.js +1 -0
  215. package/app/scripts/utils/rel-to-abs-chrom-pos.js +0 -2
  216. package/app/scripts/utils/remove-class.js +0 -1
  217. package/app/scripts/utils/reset-d3-brush-style.js +0 -2
  218. package/app/scripts/utils/rgb-to-hex.js +0 -2
  219. package/app/scripts/utils/scales-center-and-k.js +0 -2
  220. package/app/scripts/utils/scales-to-genome-loci.js +0 -1
  221. package/app/scripts/utils/segments-to-rows.js +1 -0
  222. package/app/scripts/utils/selected-items-to-cum-weights.js +0 -1
  223. package/app/scripts/utils/selected-items-to-size.js +0 -1
  224. package/app/scripts/utils/show-mouse-position.js +0 -1
  225. package/app/scripts/utils/some.js +0 -1
  226. package/app/scripts/utils/sum.js +0 -1
  227. package/app/scripts/utils/svg-line.js +1 -0
  228. package/app/scripts/utils/throttle-and-debounce.js +0 -1
  229. package/app/scripts/utils/tile-to-canvas.js +0 -1
  230. package/app/scripts/utils/timeout.js +0 -1
  231. package/app/scripts/utils/to-void.js +0 -1
  232. package/app/scripts/utils/total-track-pixel-height.js +0 -1
  233. package/app/scripts/utils/trim-trailing-slash.js +0 -1
  234. package/app/scripts/utils/type-guards.js +0 -2
  235. package/app/scripts/utils/value-to-color.js +0 -1
  236. package/app/scripts/utils/visit-positioned-tracks.js +0 -1
  237. package/app/scripts/utils/visit-tracks.js +0 -1
  238. package/dist/esm.html +13 -14
  239. package/dist/hglib.css +1 -1724
  240. package/dist/hglib.js +122661 -28
  241. package/dist/hglib.min.js +116 -119
  242. package/dist/higlass.mjs +122643 -28
  243. package/dist/index.html +5 -6
  244. package/package.json +23 -16
@@ -1,27 +1,36 @@
1
1
  import { NUM_PRECOMP_SUBSETS_PER_1D_TTILE } from '../configs';
2
2
 
3
+ /**
4
+ * @template {ArrayLike<number>} [T=ArrayLike<number>]
5
+ */
3
6
  class DenseDataExtrema1D {
4
7
  /**
5
8
  * This module efficiently computes extrema of arbitrary subsets of a given data array.
6
9
  * The array is subdivided into 'numSubsets' subsets where extrema are precomputed.
7
10
  * These values are used to compute extrema given arbitrary start and end indices via
8
11
  * the getMinNonZeroInSubset and getMaxNonZeroInSubset methods.
9
- * @param {array} data
12
+ * @param {T} data
10
13
  */
11
14
  constructor(data) {
15
+ /** @type {number} */
12
16
  this.epsilon = 1e-6;
17
+ /** @type {T} */
13
18
  this.data = data;
14
19
 
20
+ /** @type {number} */
15
21
  this.tileSize = this.data.length; // might not be a power of 2
22
+ /** @type {number} */
16
23
  this.paddedTileSize = 2 ** Math.ceil(Math.log2(this.tileSize));
17
24
 
18
25
  // This controls how many subsets are created and precomputed.
19
26
  // Setting numSubsets to 1, is equivalent to no precomputation in
20
27
  // most cases
28
+ /** @type {number} */
21
29
  this.numSubsets = Math.min(
22
30
  NUM_PRECOMP_SUBSETS_PER_1D_TTILE,
23
31
  this.paddedTileSize,
24
32
  );
33
+ /** @type {number} */
25
34
  this.subsetSize = this.paddedTileSize / this.numSubsets;
26
35
 
27
36
  this.subsetMinimums = this.computeSubsetNonZeroMinimums();
@@ -33,8 +42,9 @@ class DenseDataExtrema1D {
33
42
  /**
34
43
  * Computes the non-zero minimum in a subset using precomputed values,
35
44
  * if possible. data[end] is not considered.
36
- * @param {array} indexBounds [start, end]
37
- * @return {number} non-zero minium of the subset
45
+ *
46
+ * @param {[start: number, end: number]} indexBounds
47
+ * @return {number} non-zero minium of the subset
38
48
  */
39
49
  getMinNonZeroInSubset(indexBounds) {
40
50
  const start = indexBounds[0];
@@ -79,10 +89,10 @@ class DenseDataExtrema1D {
79
89
  }
80
90
 
81
91
  /**
82
- * Computes the non-zero maximum in a subset using precomputed values,
83
- * if possible
84
- * @param {array} indexBounds [start, end]
85
- * @return {number} non-zero maxium of the subset
92
+ * Computes the non-zero maximum in a subset using precomputed values, if possible
93
+ *
94
+ * @param {[start: number, end: number]} indexBounds
95
+ * @return {number} non-zero maxium of the subset
86
96
  */
87
97
  getMaxNonZeroInSubset(indexBounds) {
88
98
  const start = indexBounds[0];
@@ -128,10 +138,11 @@ class DenseDataExtrema1D {
128
138
 
129
139
  /**
130
140
  * Precomputes non-zero minimums of subsets of the given data vector
131
- * @return {array} array containing minimums of the regularly subdivided
132
- * data vector
141
+ *
142
+ * @returns {Array<number>} - Minimums of the regularly subdivided data vector
133
143
  */
134
144
  computeSubsetNonZeroMinimums() {
145
+ /** @type {Array<number>} */
135
146
  const minimums = [];
136
147
 
137
148
  for (let i = 0; i < this.numSubsets; i++) {
@@ -159,10 +170,10 @@ class DenseDataExtrema1D {
159
170
 
160
171
  /**
161
172
  * Precomputes non-zero maximums of subsets of the given data vector
162
- * @return {array} array containing maximums of the regularly subdivided
163
- * data vector
173
+ * @return {Array<number>} Maximums of the regularly subdivided data vector
164
174
  */
165
175
  computeSubsetNonZeroMaximums() {
176
+ /** @type {Array<number>} */
166
177
  const maximums = [];
167
178
 
168
179
  for (let i = 0; i < this.numSubsets; i++) {
@@ -190,7 +201,8 @@ class DenseDataExtrema1D {
190
201
 
191
202
  /**
192
203
  * Computes the non-zero minimum in the entire data array using precomputed values
193
- * @return {number} non-zeros maximum of the data
204
+ *
205
+ * @return {number} Non-zeros maximum of the data
194
206
  */
195
207
  getMinNonZeroInTile() {
196
208
  return Math.min(...this.subsetMinimums);
@@ -198,7 +210,8 @@ class DenseDataExtrema1D {
198
210
 
199
211
  /**
200
212
  * Computes the non-zero maximum in the entire data array using precomputed values
201
- * @return {number} non-zeros maximum of the data
213
+ *
214
+ * @return {number} Non-zeros maximum of the data
202
215
  */
203
216
  getMaxNonZeroInTile() {
204
217
  return Math.max(...this.subsetMaximums);
@@ -208,9 +221,9 @@ class DenseDataExtrema1D {
208
221
  * Calculate the minimum non-zero value in the data from start
209
222
  * to end. No precomputations are used to compute the min.
210
223
  *
211
- * @param {Float32Array} data
212
- * @param {int} start
213
- * @param {int} end
224
+ * @param {ArrayLike<number>} data
225
+ * @param {number} start
226
+ * @param {number} end
214
227
  * @return {number} non-zero min in subset
215
228
  */
216
229
  minNonZero(data, start, end) {
@@ -235,9 +248,9 @@ class DenseDataExtrema1D {
235
248
  * Calculate the maximum non-zero value in the data from start
236
249
  * to end. No precomputations are used to compute the max.
237
250
  *
238
- * @param {Float32Array} data
239
- ` * @param {int} start
240
- * @param {int} end
251
+ * @param {ArrayLike<number>} data
252
+ * @param {number} start
253
+ * @param {number} end
241
254
  * @return {number} non-zero max in subset
242
255
  */
243
256
  maxNonZero(data, start, end) {
@@ -1,7 +1,12 @@
1
1
  import ndarray from 'ndarray';
2
-
3
2
  import { NUM_PRECOMP_SUBSETS_PER_2D_TTILE } from '../configs';
4
3
 
4
+ /**
5
+ * @typedef View2D
6
+ * @property {(i: number, j: number) => number} get
7
+ * @property {(i: number, j: number, v: number) => void} set
8
+ */
9
+
5
10
  class DenseDataExtrema2D {
6
11
  /**
7
12
  * This module efficiently computes extrema of subsets of a given data matrix.
@@ -9,11 +14,12 @@ class DenseDataExtrema2D {
9
14
  * These values are used to efficiently approximate extrema given arbitrary subsets.
10
15
  * Larger values of 'numSubsets' lead to more accurate approximations (more expensive).
11
16
  *
12
- * @param {array} data array of quadratic length
17
+ * @param {ArrayLike<number>} data array of quadratic length
13
18
  */
14
19
  constructor(data) {
20
+ /** @type {number} */
15
21
  this.epsilon = 1e-6;
16
-
22
+ /** @type {number} */
17
23
  this.tileSize = Math.sqrt(data.length);
18
24
 
19
25
  if (!Number.isSafeInteger(this.tileSize)) {
@@ -23,25 +29,33 @@ class DenseDataExtrema2D {
23
29
  }
24
30
 
25
31
  // if this.numSubsets == this.tilesize the extrema are computed exactly (expensive).
32
+ /** @type {number} */
26
33
  this.numSubsets = Math.min(NUM_PRECOMP_SUBSETS_PER_2D_TTILE, this.tileSize);
34
+ /** @type {number} */
27
35
  this.subsetSize = this.tileSize / this.numSubsets;
28
36
 
29
37
  // Convert data to 2d array
38
+ /** @type {View2D} */
30
39
  const dataMatrix = ndarray(Array.from(data), [
31
40
  this.tileSize,
32
41
  this.tileSize,
33
42
  ]);
34
43
 
44
+ /** @type {View2D} */
35
45
  this.subsetMinimums = this.computeSubsetNonZeroMinimums(dataMatrix);
46
+ /** @type {View2D} */
36
47
  this.subsetMaximums = this.computeSubsetNonZeroMaximums(dataMatrix);
48
+ /** @type {number} */
37
49
  this.minNonZeroInTile = this.getMinNonZeroInTile();
50
+ /** @type {number} */
38
51
  this.maxNonZeroInTile = this.getMaxNonZeroInTile();
39
52
  }
40
53
 
41
54
  /**
42
55
  * Computes an approximation of the non-zero minimum in a subset
43
- * @param {array} indexBounds [startX, startY, endX, endY]
44
- * @return {number} non-zero minium of the subset
56
+ *
57
+ * @param {[startX: number, startY: number, endX: number, endY: number]} indexBounds
58
+ * @return {number} Non-zero minium of the subset
45
59
  */
46
60
  getMinNonZeroInSubset(indexBounds) {
47
61
  const startX = indexBounds[0];
@@ -69,8 +83,9 @@ class DenseDataExtrema2D {
69
83
 
70
84
  /**
71
85
  * Computes an approximation of the non-zero maximum in a subset
72
- * @param {array} indexBounds [startX, startY, endX, endY]
73
- * @return {number} non-zero maxium of the subset
86
+ *
87
+ * @param {[startX: number, startY: number, endX: number, endY: number]} indexBounds
88
+ * @return {number} Non-zero maxium of the subset
74
89
  */
75
90
  getMaxNonZeroInSubset(indexBounds) {
76
91
  const startX = indexBounds[0];
@@ -98,13 +113,14 @@ class DenseDataExtrema2D {
98
113
 
99
114
  /**
100
115
  * Precomputes non-zero minimums of subsets of a given matrix
101
- * @param {ndarray} dataMatrix
102
- * @return {ndarray} matrix containing minimums of the dataMatrix
103
- * after subdivision using a regular grid
116
+ * @param {View2D} dataMatrix
117
+ * @return {View2D} Matrix containing minimums of the dataMatrix after subdivision using a regular grid
104
118
  */
105
119
  computeSubsetNonZeroMinimums(dataMatrix) {
106
- let minimums = new Array(this.numSubsets ** 2);
107
- minimums = ndarray(minimums, [this.numSubsets, this.numSubsets]);
120
+ const minimums = ndarray(new Array(this.numSubsets ** 2), [
121
+ this.numSubsets,
122
+ this.numSubsets,
123
+ ]);
108
124
 
109
125
  for (let i = 0; i < this.numSubsets; i++) {
110
126
  for (let j = 0; j < this.numSubsets; j++) {
@@ -123,13 +139,15 @@ class DenseDataExtrema2D {
123
139
 
124
140
  /**
125
141
  * Precomputes non-zero maximums of subsets of a given matrix
126
- * @param {ndarray} dataMatrix
127
- * @return {ndarray} matrix containing maximums of the dataMatrix
128
- * after subdivision using a regular grid
142
+ *
143
+ * @param {View2D} dataMatrix
144
+ * @return {View2D} Matrix containing maximums of the dataMatrix after subdivision using a regular grid
129
145
  */
130
146
  computeSubsetNonZeroMaximums(dataMatrix) {
131
- let maximums = new Array(this.numSubsets ** 2);
132
- maximums = ndarray(maximums, [this.numSubsets, this.numSubsets]);
147
+ const maximums = ndarray(new Array(this.numSubsets ** 2), [
148
+ this.numSubsets,
149
+ this.numSubsets,
150
+ ]);
133
151
 
134
152
  for (let i = 0; i < this.numSubsets; i++) {
135
153
  for (let j = 0; j < this.numSubsets; j++) {
@@ -148,12 +166,12 @@ class DenseDataExtrema2D {
148
166
 
149
167
  /**
150
168
  * Computes the non-zero minimum of a subset of a matrix (ndarray)
151
- * @param {ndarray} arr
152
- * @param {int} rowOffset Starting row of the subset
153
- * @param {int} colOffset Starting column of the subset
154
- * @param {int} width Width (num columns) of the subset
155
- * @param {int} height Height (num rows) of the subset
156
- * @return {number} non-zeros minimum of the subset
169
+ * @param {View2D} arr
170
+ * @param {number} rowOffset - Starting row of the subset
171
+ * @param {number} colOffset - Starting column of the subset
172
+ * @param {number} width - Width (num columns) of the subset
173
+ * @param {number} height - Height (num rows) of the subset
174
+ * @return {number} Non-zeros - minimum of the subset
157
175
  */
158
176
  getMinNonZeroInNdarraySubset(arr, rowOffset, colOffset, width, height) {
159
177
  let curMin = Number.MAX_SAFE_INTEGER;
@@ -175,12 +193,12 @@ class DenseDataExtrema2D {
175
193
 
176
194
  /**
177
195
  * Computes the non-zero maximum of a subset of a matrix (ndarray)
178
- * @param {ndarray} arr
179
- * @param {int} rowOffset Starting row of the subset
180
- * @param {int} colOffset Starting column of the subset
181
- * @param {int} width Width (num columns) of the subset
182
- * @param {int} height Height (num rows) of the subset
183
- * @return {number} non-zeros maximum of the subset
196
+ * @param {View2D} arr
197
+ * @param {number} rowOffset - Starting row of the subset
198
+ * @param {number} colOffset - Starting column of the subset
199
+ * @param {number} width - Width (num columns) of the subset
200
+ * @param {number} height - Height (num rows) of the subset
201
+ * @return {number} Non-zeros maximum of the subset
184
202
  */
185
203
  getMaxNonZeroInNdarraySubset(arr, rowOffset, colOffset, width, height) {
186
204
  let curMax = Number.MIN_SAFE_INTEGER;
@@ -211,7 +229,8 @@ class DenseDataExtrema2D {
211
229
 
212
230
  /**
213
231
  * Computes the non-zero minimum in the entire data array using precomputed values
214
- * @return {number} non-zeros minimum of the data
232
+ *
233
+ * @return {number} Non-zeros minimum of the data
215
234
  */
216
235
  getMinNonZeroInTile() {
217
236
  return this.getMinNonZeroInNdarraySubset(
@@ -225,7 +244,8 @@ class DenseDataExtrema2D {
225
244
 
226
245
  /**
227
246
  * Computes the non-zero maximum in the entire data array using precomputed values
228
- * @return {number} non-zeros maximum of the data
247
+ *
248
+ * @return {number} Non-zeros maximum of the data
229
249
  */
230
250
  getMaxNonZeroInTile() {
231
251
  return this.getMaxNonZeroInNdarraySubset(
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * A doubly linked list-based Least Recently Used (LRU) cache. Will keep most
3
4
  * recently used items while discarding least recently used items when its limit
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import chromInfoBisector from './chrom-info-bisector';
3
2
 
4
3
  /**
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * Factory function for a transposition accessor for a 2D matrix in form of a 1D
5
3
  * array.
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /** @type {<T>(index: T) => T} */
4
2
  const identity = (i) => i;
5
3
 
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import hasClass from './has-class';
3
2
 
4
3
  const XMLNS = 'http://www.w3.org/2000/svg';
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * Add an event listener that fires only once and auto-removes itself
5
3
  *
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * @template T
5
3
  * @typedef DataTask
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * Convert a base64 encoded image into a canvas object.
5
3
  * @param {string} base64 - Base64 string encoding the image.
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * Convert a chromosome position to an absolute genome position.
5
3
  *
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { bisector } from 'd3-array';
3
2
 
4
3
  const chromInfoBisector = bisector(
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * Clone an event by invoking the source event's constructor and passing in the source event.
5
3
  *
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  import { scaleLinear } from 'd3-scale';
2
3
  import { range } from 'd3-array';
3
4
  import { rgb } from 'd3-color';
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { color } from 'd3-color';
3
2
 
4
3
  // Configs
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { color } from 'd3-color';
3
2
 
4
3
  /**
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import absToChr from './abs-to-chr';
3
2
 
4
3
  /** @typedef {[startChromName: string, startChromPos: number, endChromName: string, endChromPos: number]} GenomicLoci */
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * Debounce a function call
5
3
  *
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  /**
3
2
  * Converts a decimal number to a hex string.
4
3
  *
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * Create a dictionary from a list of [key, value] pairs.
5
3
  *
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * @template T
5
3
  * @typedef {Array<{ [Key in keyof T]: [Key, T[Key]] }[keyof T]>} DictItems
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * Return an array of keys that are present in this dictionary
5
3
  *
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * Return an array of values that are present in this dictionary
5
3
  *
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * Download a file to the user's computer.
5
3
  * @param {string} filename - Name of the file to download
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Go through a list of tracks and expand combined
3
4
  * tracks.
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  // Configs
2
3
  import {
3
4
  MIN_HORIZONTAL_HEIGHT,
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  import reduce from './reduce';
2
3
 
3
4
  /**
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  /**
3
2
  * Functional version of `Array.forEach`. More flexible and applicable to other array-like data types.
4
3
  *
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import cloneEvent from './clone-event';
3
2
 
4
3
  /**
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import chrToAbs from './chr-to-abs';
3
2
 
4
3
  /**
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * Using the [genomicStart, genomicEnd] range, get an array of "chromosome chunks",
5
3
  * where each chunk range starts and ends with the same chromosome.
@@ -1,20 +1,15 @@
1
- // @ts-check
2
1
  import { mean, sum, variance, deviation } from 'd3-array';
3
2
 
3
+ /** @typedef {(values: number[]) => number | undefined} Aggregation */
4
+
4
5
  /**
5
6
  * Get an aggregation function from a function name.
6
- * @template {'mean' | 'sum' | 'variance' | 'deviation'} Type
7
- * @param {Type} name - The name of an aggregation function
8
- * ('mean', 'sum', 'variance', 'deviation'). If an unknown string is passed,
9
- * the mean function will be used, and a console warning will be thrown.
10
- * @returns {{
11
- * mean: typeof mean,
12
- * sum: typeof sum,
13
- * variance: typeof variance,
14
- * deviation: typeof deviation,
15
- * }[Type]} The function of interest as determined by the string,
7
+ * @param {'mean' | 'sum' | 'variance' | 'deviation'} name - The type of aggregation.
8
+ * If an unknown string is passed, the mean function will be used (and a warning will be logged).
9
+ * @returns {Aggregation} The function of interest as determined by the string,
16
10
  */
17
11
  const getAggregationFunction = (name) => {
12
+ /** @type {Aggregation} */
18
13
  let aggFunc;
19
14
  const lowerCaseName = name ? name.toLowerCase() : name;
20
15
  switch (lowerCaseName) {
@@ -36,7 +31,6 @@ const getAggregationFunction = (name) => {
36
31
  'Encountered an unsupported selectedRowsAggregationMode option.',
37
32
  );
38
33
  }
39
- // @ts-expect-error - TS can't infer type-mapping
40
34
  return aggFunc;
41
35
  };
42
36
 
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  // Configs
2
3
  import { DEFAULT_TRACKS_FOR_DATATYPE } from '../configs';
3
4
 
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import { ElementResizeListener } from '../services';
3
2
 
4
3
  /**
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  export const getTrackObjectFromHGC = (hgc, viewUid, trackUid) => {
2
3
  let newViewUid = viewUid;
3
4
  let newTrackUid = trackUid;
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Return the track object for the track corresponding to this uid
3
4
  *
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Get a track's config (not the track object) from a higlass component.
3
4
  *
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  const getTrackObjById = (tiledPlots, viewId, trackId) => {
2
3
  const tiledPlot = viewId ? tiledPlots[viewId] : Object.values(tiledPlots)[0];
3
4
 
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  import visitPositionedTracks from './visit-positioned-tracks';
2
3
 
3
4
  /**
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /* global XYLOPHON:false */
2
3
 
3
4
  import map from './map';
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * @param {{ from: number, color: string }[]} steps
5
3
  * @param {number} width
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  const XMLNS = 'http://www.w3.org/2000/svg';
4
2
 
5
3
  /**
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  /**
2
3
  * Test whether a DOM element is the parent of another DOM element.
3
4
  *
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  /**
3
2
  * Convert a HEX string into a HEX integer.
4
3
  *
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  export { default as absToChr } from './abs-to-chr';
3
2
  export { default as accessorTransposition } from './accessor-transposition';
4
3
  export { default as addArrays } from './add-arrays';
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  function IntervalTreeNode(start, end, left, right) {
2
3
  /**
3
4
  * Node interval.
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  /**
3
2
  * An adventure into the abyss of void!
4
3
  * @type {(...args: any[]) => void} The explorers find nothing but void.
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import CombinedTrack from '../CombinedTrack';
3
2
 
4
3
  /**
@@ -1,4 +1,3 @@
1
- // @ts-check
2
1
  import or from './or';
3
2
 
4
3
  /**
@@ -1,5 +1,3 @@
1
- // @ts-check
2
-
3
1
  /**
4
2
  * Check if a 2D or 1D point is within a rectangle or range
5
3
  * @param {number} x - The point's X coordinate.