@genome-spy/core 0.64.0 → 0.66.1

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 (285) hide show
  1. package/dist/bundle/{index-CCJIjehY.js → AbortablePromiseCache-CcuMrnn7.js} +22 -91
  2. package/dist/bundle/browser-BRemItdO.js +138 -0
  3. package/dist/bundle/index-BatuyGAI.js +271 -0
  4. package/dist/bundle/index-ByuE8dvu.js +332 -0
  5. package/dist/bundle/index-Cq3QFUxX.js +1781 -0
  6. package/dist/bundle/{index-C08YCM2T.js → index-D-w7Mmt9.js} +246 -126
  7. package/dist/bundle/index-D28m8tSW.js +1607 -0
  8. package/dist/bundle/index-D74H8TTz.js +508 -0
  9. package/dist/bundle/index-DbJ0oeYM.js +631 -0
  10. package/dist/bundle/index.es.js +15034 -13842
  11. package/dist/bundle/index.js +223 -237
  12. package/dist/bundle/inflate-GtwLkvSP.js +1048 -0
  13. package/dist/bundle/unzip-NywezaRR.js +1492 -0
  14. package/dist/schema.json +22 -4
  15. package/dist/src/config/scaleDefaults.d.ts +8 -0
  16. package/dist/src/config/scaleDefaults.d.ts.map +1 -0
  17. package/dist/src/config/scaleDefaults.js +45 -0
  18. package/dist/src/data/collector.d.ts +7 -2
  19. package/dist/src/data/collector.d.ts.map +1 -1
  20. package/dist/src/data/collector.js +13 -2
  21. package/dist/src/data/dataFlow.d.ts +20 -42
  22. package/dist/src/data/dataFlow.d.ts.map +1 -1
  23. package/dist/src/data/dataFlow.js +57 -80
  24. package/dist/src/data/flowHandle.d.ts +15 -0
  25. package/dist/src/data/flowHandle.d.ts.map +1 -0
  26. package/dist/src/data/flowHandle.js +13 -0
  27. package/dist/src/data/flowInit.d.ts +85 -0
  28. package/dist/src/data/flowInit.d.ts.map +1 -0
  29. package/dist/src/data/flowInit.js +238 -0
  30. package/dist/src/data/flowInit.test.d.ts +2 -0
  31. package/dist/src/data/flowInit.test.d.ts.map +1 -0
  32. package/dist/src/data/flowOptimizer.d.ts +6 -4
  33. package/dist/src/data/flowOptimizer.d.ts.map +1 -1
  34. package/dist/src/data/flowOptimizer.js +29 -14
  35. package/dist/src/data/sources/lazy/axisTickSource.js +1 -1
  36. package/dist/src/data/sources/lazy/bamSource.js +1 -1
  37. package/dist/src/data/sources/lazy/bigBedSource.js +1 -1
  38. package/dist/src/data/sources/lazy/bigWigSource.js +1 -1
  39. package/dist/src/data/sources/lazy/gff3Source.d.ts +2 -6
  40. package/dist/src/data/sources/lazy/gff3Source.d.ts.map +1 -1
  41. package/dist/src/data/sources/lazy/gff3Source.js +4 -8
  42. package/dist/src/data/sources/lazy/indexedFastaSource.d.ts.map +1 -1
  43. package/dist/src/data/sources/lazy/indexedFastaSource.js +17 -17
  44. package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts +1 -1
  45. package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts.map +1 -1
  46. package/dist/src/data/sources/lazy/singleAxisLazySource.js +10 -3
  47. package/dist/src/data/sources/lazy/singleAxisWindowedSource.d.ts.map +1 -1
  48. package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +5 -1
  49. package/dist/src/data/sources/lazy/tabixSource.js +1 -1
  50. package/dist/src/data/transforms/filterScoredLabels.d.ts +1 -1
  51. package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
  52. package/dist/src/data/transforms/filterScoredLabels.js +1 -1
  53. package/dist/src/data/transforms/linearizeGenomicCoordinate.d.ts.map +1 -1
  54. package/dist/src/data/transforms/linearizeGenomicCoordinate.js +2 -1
  55. package/dist/src/encoder/encoder.d.ts +1 -1
  56. package/dist/src/encoder/encoder.d.ts.map +1 -1
  57. package/dist/src/encoder/encoder.js +1 -1
  58. package/dist/src/genome/scaleLocus.d.ts +39 -0
  59. package/dist/src/genome/scaleLocus.d.ts.map +1 -1
  60. package/dist/src/genome/scaleLocus.js +76 -0
  61. package/dist/src/genomeSpy/canvasExport.d.ts +19 -0
  62. package/dist/src/genomeSpy/canvasExport.d.ts.map +1 -0
  63. package/dist/src/genomeSpy/canvasExport.js +66 -0
  64. package/dist/src/genomeSpy/containerUi.d.ts +17 -0
  65. package/dist/src/genomeSpy/containerUi.d.ts.map +1 -0
  66. package/dist/src/genomeSpy/containerUi.js +78 -0
  67. package/dist/src/genomeSpy/eventListenerRegistry.d.ts +19 -0
  68. package/dist/src/genomeSpy/eventListenerRegistry.d.ts.map +1 -0
  69. package/dist/src/genomeSpy/eventListenerRegistry.js +38 -0
  70. package/dist/src/genomeSpy/inputBindingManager.d.ts +14 -0
  71. package/dist/src/genomeSpy/inputBindingManager.d.ts.map +1 -0
  72. package/dist/src/genomeSpy/inputBindingManager.js +63 -0
  73. package/dist/src/genomeSpy/interactionController.d.ts +40 -0
  74. package/dist/src/genomeSpy/interactionController.d.ts.map +1 -0
  75. package/dist/src/genomeSpy/interactionController.js +371 -0
  76. package/dist/src/genomeSpy/keyboardListenerManager.d.ts +10 -0
  77. package/dist/src/genomeSpy/keyboardListenerManager.d.ts.map +1 -0
  78. package/dist/src/genomeSpy/keyboardListenerManager.js +31 -0
  79. package/dist/src/genomeSpy/loadingIndicatorManager.d.ts +15 -0
  80. package/dist/src/genomeSpy/loadingIndicatorManager.d.ts.map +1 -0
  81. package/dist/src/genomeSpy/loadingIndicatorManager.js +92 -0
  82. package/dist/src/genomeSpy/renderCoordinator.d.ts +22 -0
  83. package/dist/src/genomeSpy/renderCoordinator.d.ts.map +1 -0
  84. package/dist/src/genomeSpy/renderCoordinator.js +118 -0
  85. package/dist/src/genomeSpy/viewContextFactory.d.ts +18 -0
  86. package/dist/src/genomeSpy/viewContextFactory.d.ts.map +1 -0
  87. package/dist/src/genomeSpy/viewContextFactory.js +79 -0
  88. package/dist/src/genomeSpy/viewDataInit.d.ts +12 -0
  89. package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -0
  90. package/dist/src/genomeSpy/viewDataInit.js +41 -0
  91. package/dist/src/genomeSpy/viewHierarchyConfig.d.ts +14 -0
  92. package/dist/src/genomeSpy/viewHierarchyConfig.d.ts.map +1 -0
  93. package/dist/src/genomeSpy/viewHierarchyConfig.js +24 -0
  94. package/dist/src/genomeSpy/viewHighlight.d.ts +5 -0
  95. package/dist/src/genomeSpy/viewHighlight.d.ts.map +1 -0
  96. package/dist/src/genomeSpy/viewHighlight.js +30 -0
  97. package/dist/src/genomeSpy.d.ts +17 -72
  98. package/dist/src/genomeSpy.d.ts.map +1 -1
  99. package/dist/src/genomeSpy.js +180 -789
  100. package/dist/src/gl/glslScaleGenerator.d.ts +1 -1
  101. package/dist/src/gl/webGLHelper.d.ts +2 -2
  102. package/dist/src/gl/webGLHelper.d.ts.map +1 -1
  103. package/dist/src/gl/webGLHelper.js +4 -4
  104. package/dist/src/index.d.ts.map +1 -1
  105. package/dist/src/index.js +2 -12
  106. package/dist/src/marks/mark.d.ts +1 -0
  107. package/dist/src/marks/mark.d.ts.map +1 -1
  108. package/dist/src/marks/mark.js +26 -3
  109. package/dist/src/{view → scales}/axisResolution.d.ts +12 -14
  110. package/dist/src/scales/axisResolution.d.ts.map +1 -0
  111. package/dist/src/{view → scales}/axisResolution.js +38 -12
  112. package/dist/src/scales/axisResolution.test.d.ts.map +1 -0
  113. package/dist/src/scales/scaleDomainAggregator.d.ts +57 -0
  114. package/dist/src/scales/scaleDomainAggregator.d.ts.map +1 -0
  115. package/dist/src/scales/scaleDomainAggregator.js +162 -0
  116. package/dist/src/scales/scaleDomainAggregator.test.d.ts +2 -0
  117. package/dist/src/scales/scaleDomainAggregator.test.d.ts.map +1 -0
  118. package/dist/src/scales/scaleInstanceManager.d.ts +40 -0
  119. package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -0
  120. package/dist/src/scales/scaleInstanceManager.js +313 -0
  121. package/dist/src/scales/scaleInstanceManager.test.d.ts +2 -0
  122. package/dist/src/scales/scaleInstanceManager.test.d.ts.map +1 -0
  123. package/dist/src/scales/scaleInteractionController.d.ts +73 -0
  124. package/dist/src/scales/scaleInteractionController.d.ts.map +1 -0
  125. package/dist/src/scales/scaleInteractionController.js +336 -0
  126. package/dist/src/scales/scaleInteractionController.test.d.ts +2 -0
  127. package/dist/src/scales/scaleInteractionController.test.d.ts.map +1 -0
  128. package/dist/src/scales/scalePropsResolver.d.ts +23 -0
  129. package/dist/src/scales/scalePropsResolver.d.ts.map +1 -0
  130. package/dist/src/scales/scalePropsResolver.js +74 -0
  131. package/dist/src/{view → scales}/scaleResolution.d.ts +53 -31
  132. package/dist/src/scales/scaleResolution.d.ts.map +1 -0
  133. package/dist/src/scales/scaleResolution.js +658 -0
  134. package/dist/src/scales/scaleResolution.test.d.ts.map +1 -0
  135. package/dist/src/scales/scaleResolutionConstants.d.ts +6 -0
  136. package/dist/src/scales/scaleResolutionConstants.d.ts.map +1 -0
  137. package/dist/src/scales/scaleResolutionConstants.js +5 -0
  138. package/dist/src/scales/scaleRules.d.ts +16 -0
  139. package/dist/src/scales/scaleRules.d.ts.map +1 -0
  140. package/dist/src/scales/scaleRules.js +103 -0
  141. package/dist/src/scales/scaleRules.test.d.ts +2 -0
  142. package/dist/src/scales/scaleRules.test.d.ts.map +1 -0
  143. package/dist/src/spec/channel.d.ts +13 -18
  144. package/dist/src/spec/sampleView.d.ts +3 -2
  145. package/dist/src/spec/scale.d.ts +6 -0
  146. package/dist/src/types/embedApi.d.ts +5 -0
  147. package/dist/src/types/scaleResolutionApi.d.ts +1 -1
  148. package/dist/src/types/viewContext.d.ts +1 -1
  149. package/dist/src/view/concatView.d.ts +18 -0
  150. package/dist/src/view/concatView.d.ts.map +1 -1
  151. package/dist/src/view/concatView.js +73 -0
  152. package/dist/src/view/concatView.test.d.ts +2 -0
  153. package/dist/src/view/concatView.test.d.ts.map +1 -0
  154. package/dist/src/view/containerMutationHelper.d.ts +74 -0
  155. package/dist/src/view/containerMutationHelper.d.ts.map +1 -0
  156. package/dist/src/view/containerMutationHelper.js +114 -0
  157. package/dist/src/view/containerView.d.ts +0 -7
  158. package/dist/src/view/containerView.d.ts.map +1 -1
  159. package/dist/src/view/containerView.js +0 -10
  160. package/dist/src/view/facetView.d.ts.map +1 -1
  161. package/dist/src/view/facetView.js +0 -14
  162. package/dist/src/view/flowBuilder.d.ts +2 -2
  163. package/dist/src/view/flowBuilder.d.ts.map +1 -1
  164. package/dist/src/view/flowBuilder.js +21 -4
  165. package/dist/src/view/gridView/gridChild.d.ts +11 -0
  166. package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
  167. package/dist/src/view/gridView/gridChild.js +32 -6
  168. package/dist/src/view/gridView/gridView.d.ts +39 -1
  169. package/dist/src/view/gridView/gridView.d.ts.map +1 -1
  170. package/dist/src/view/gridView/gridView.js +113 -42
  171. package/dist/src/view/gridView/gridView.test.d.ts +2 -0
  172. package/dist/src/view/gridView/gridView.test.d.ts.map +1 -0
  173. package/dist/src/view/gridView/scrollbar.d.ts +39 -8
  174. package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
  175. package/dist/src/view/gridView/scrollbar.js +184 -69
  176. package/dist/src/view/gridView/selectionRect.d.ts +8 -4
  177. package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
  178. package/dist/src/view/gridView/selectionRect.js +28 -3
  179. package/dist/src/view/gridView/selectionRect.test.d.ts +2 -0
  180. package/dist/src/view/gridView/selectionRect.test.d.ts.map +1 -0
  181. package/dist/src/view/layerView.d.ts +14 -0
  182. package/dist/src/view/layerView.d.ts.map +1 -1
  183. package/dist/src/view/layerView.js +66 -0
  184. package/dist/src/view/layerView.test.d.ts +2 -0
  185. package/dist/src/view/layerView.test.d.ts.map +1 -0
  186. package/dist/src/view/paramMediator.d.ts +2 -1
  187. package/dist/src/view/paramMediator.d.ts.map +1 -1
  188. package/dist/src/view/paramMediator.js +13 -1
  189. package/dist/src/view/testUtils.d.ts.map +1 -1
  190. package/dist/src/view/testUtils.js +18 -5
  191. package/dist/src/view/unitView.d.ts.map +1 -1
  192. package/dist/src/view/unitView.js +52 -12
  193. package/dist/src/view/view.d.ts +23 -7
  194. package/dist/src/view/view.d.ts.map +1 -1
  195. package/dist/src/view/view.js +61 -5
  196. package/dist/src/view/viewDispose.test.d.ts +2 -0
  197. package/dist/src/view/viewDispose.test.d.ts.map +1 -0
  198. package/dist/src/view/viewUtils.d.ts +4 -4
  199. package/dist/src/view/viewUtils.d.ts.map +1 -1
  200. package/dist/src/view/viewUtils.js +19 -15
  201. package/dist/src/view/viewUtils.test.d.ts +2 -0
  202. package/dist/src/view/viewUtils.test.d.ts.map +1 -0
  203. package/package.json +10 -10
  204. package/dist/bundle/__vite-browser-external-C--ziKoh.js +0 -8
  205. package/dist/bundle/_commonjsHelpers-DjF3Plf2.js +0 -26
  206. package/dist/bundle/index-5ajWdKly.js +0 -1319
  207. package/dist/bundle/index-B03-Om4z.js +0 -274
  208. package/dist/bundle/index-BftNdA0O.js +0 -27
  209. package/dist/bundle/index-Bg7C4Xat.js +0 -2750
  210. package/dist/bundle/index-C3QR8Lv6.js +0 -2131
  211. package/dist/bundle/index-DTcHjAHp.js +0 -505
  212. package/dist/bundle/index-DnIkxb0L.js +0 -1025
  213. package/dist/bundle/index-Ww3TAo6_.js +0 -71
  214. package/dist/bundle/index-g8iXgW0W.js +0 -651
  215. package/dist/bundle/long-B-FASCSo.js +0 -2387
  216. package/dist/bundle/remoteFile-BuaqFGWk.js +0 -94
  217. package/dist/src/data/collector.test.js +0 -138
  218. package/dist/src/data/dataFlow.test.js +0 -5
  219. package/dist/src/data/flow.test.js +0 -81
  220. package/dist/src/data/flowNode.test.js +0 -50
  221. package/dist/src/data/flowOptimizer.test.js +0 -204
  222. package/dist/src/data/formats/fasta.test.js +0 -27
  223. package/dist/src/data/sources/inlineSource.test.js +0 -63
  224. package/dist/src/data/sources/sequenceSource.test.js +0 -81
  225. package/dist/src/data/transforms/aggregate.test.js +0 -134
  226. package/dist/src/data/transforms/clone.test.js +0 -11
  227. package/dist/src/data/transforms/coverage.test.js +0 -238
  228. package/dist/src/data/transforms/filter.test.js +0 -20
  229. package/dist/src/data/transforms/flatten.test.js +0 -96
  230. package/dist/src/data/transforms/flattenDelimited.test.js +0 -90
  231. package/dist/src/data/transforms/flattenSequence.test.js +0 -34
  232. package/dist/src/data/transforms/formula.test.js +0 -25
  233. package/dist/src/data/transforms/identifier.test.js +0 -92
  234. package/dist/src/data/transforms/pileup.test.js +0 -70
  235. package/dist/src/data/transforms/project.test.js +0 -32
  236. package/dist/src/data/transforms/regexExtract.test.js +0 -70
  237. package/dist/src/data/transforms/regexFold.test.js +0 -201
  238. package/dist/src/data/transforms/sample.test.js +0 -38
  239. package/dist/src/data/transforms/stack.test.js +0 -91
  240. package/dist/src/encoder/accessor.test.js +0 -162
  241. package/dist/src/encoder/encoder.test.js +0 -105
  242. package/dist/src/genome/genome.test.js +0 -268
  243. package/dist/src/genome/genomes.test.js +0 -8
  244. package/dist/src/genome/scaleIndex.test.js +0 -78
  245. package/dist/src/genome/scaleLocus.test.js +0 -4
  246. package/dist/src/scale/scale.test.js +0 -326
  247. package/dist/src/scale/ticks.test.js +0 -46
  248. package/dist/src/selection/selection.test.js +0 -14
  249. package/dist/src/utils/addBaseUrl.test.js +0 -30
  250. package/dist/src/utils/binnedIndex.test.js +0 -201
  251. package/dist/src/utils/cloner.test.js +0 -35
  252. package/dist/src/utils/coalesce.test.js +0 -16
  253. package/dist/src/utils/concatIterables.test.js +0 -8
  254. package/dist/src/utils/domainArray.test.js +0 -130
  255. package/dist/src/utils/indexer.test.js +0 -49
  256. package/dist/src/utils/interactionEvent.test.js +0 -35
  257. package/dist/src/utils/iterateNestedMaps.test.js +0 -33
  258. package/dist/src/utils/kWayMerge.test.js +0 -30
  259. package/dist/src/utils/mergeObjects.test.js +0 -42
  260. package/dist/src/utils/numberExtractor.test.js +0 -6
  261. package/dist/src/utils/propertyCacher.test.js +0 -89
  262. package/dist/src/utils/propertyCoalescer.test.js +0 -25
  263. package/dist/src/utils/radixSort.test.js +0 -51
  264. package/dist/src/utils/reservationMap.test.js +0 -20
  265. package/dist/src/utils/ringBuffer.test.js +0 -39
  266. package/dist/src/utils/topK.test.js +0 -54
  267. package/dist/src/utils/trees.test.js +0 -135
  268. package/dist/src/utils/url.test.js +0 -28
  269. package/dist/src/utils/variableTools.test.js +0 -13
  270. package/dist/src/view/axisResolution.d.ts.map +0 -1
  271. package/dist/src/view/axisResolution.test.d.ts.map +0 -1
  272. package/dist/src/view/axisResolution.test.js +0 -206
  273. package/dist/src/view/flowBuilder.test.js +0 -125
  274. package/dist/src/view/layout/flexLayout.test.js +0 -323
  275. package/dist/src/view/layout/grid.test.js +0 -71
  276. package/dist/src/view/layout/rectangle.test.js +0 -192
  277. package/dist/src/view/paramMediator.test.js +0 -260
  278. package/dist/src/view/scaleResolution.d.ts.map +0 -1
  279. package/dist/src/view/scaleResolution.js +0 -1049
  280. package/dist/src/view/scaleResolution.test.d.ts.map +0 -1
  281. package/dist/src/view/scaleResolution.test.js +0 -645
  282. package/dist/src/view/view.test.js +0 -245
  283. package/dist/src/view/viewFactory.test.js +0 -25
  284. /package/dist/src/{view → scales}/axisResolution.test.d.ts +0 -0
  285. /package/dist/src/{view → scales}/scaleResolution.test.d.ts +0 -0
@@ -1,94 +0,0 @@
1
- import { b as d } from "./index-BftNdA0O.js";
2
- function u(n) {
3
- return (typeof n == "object" && n !== null && "message" in n ? n.message : `${n}`).replace(/\.$/, "");
4
- }
5
- class $ {
6
- async getBufferFromResponse(e) {
7
- const t = await e.arrayBuffer();
8
- return d.Buffer.from(t);
9
- }
10
- constructor(e, t = {}) {
11
- this.baseOverrides = {}, this.url = e;
12
- const r = t.fetch || globalThis.fetch.bind(globalThis);
13
- if (!r)
14
- throw new TypeError("no fetch function supplied, and none found in global environment");
15
- t.overrides && (this.baseOverrides = t.overrides), this.fetchImplementation = r;
16
- }
17
- async fetch(e, t) {
18
- let r;
19
- try {
20
- r = await this.fetchImplementation(e, t);
21
- } catch (s) {
22
- if (`${s}`.includes("Failed to fetch")) {
23
- console.warn(`generic-filehandle: refetching ${e} to attempt to work around chrome CORS header caching bug`);
24
- try {
25
- r = await this.fetchImplementation(e, {
26
- ...t,
27
- cache: "reload"
28
- });
29
- } catch (i) {
30
- throw new Error(`${u(i)} fetching ${e}`, { cause: i });
31
- }
32
- } else
33
- throw new Error(`${u(s)} fetching ${e}`, { cause: s });
34
- }
35
- return r;
36
- }
37
- async read(e, t = 0, r, s = 0, i = {}) {
38
- const { headers: c = {}, signal: o, overrides: f = {} } = i;
39
- r < 1 / 0 ? c.range = `bytes=${s}-${s + r}` : r === 1 / 0 && s !== 0 && (c.range = `bytes=${s}-`);
40
- const a = await this.fetch(this.url, {
41
- ...this.baseOverrides,
42
- ...f,
43
- headers: {
44
- ...c,
45
- ...f.headers,
46
- ...this.baseOverrides.headers
47
- },
48
- method: "GET",
49
- redirect: "follow",
50
- mode: "cors",
51
- signal: o
52
- });
53
- if (!a.ok)
54
- throw new Error(`HTTP ${a.status} fetching ${this.url}`);
55
- if (a.status === 200 && s === 0 || a.status === 206) {
56
- const l = await this.getBufferFromResponse(a), g = l.copy(e, t, 0, Math.min(r, l.length)), w = a.headers.get("content-range"), h = /\/(\d+)$/.exec(w || "");
57
- return h != null && h[1] && (this._stat = { size: parseInt(h[1], 10) }), { bytesRead: g, buffer: e };
58
- }
59
- throw a.status === 200 ? new Error(`${this.url} fetch returned status 200, expected 206`) : new Error(`HTTP ${a.status} fetching ${this.url}`);
60
- }
61
- async readFile(e = {}) {
62
- let t, r;
63
- typeof e == "string" ? (t = e, r = {}) : (t = e.encoding, r = e, delete r.encoding);
64
- const { headers: s = {}, signal: i, overrides: c = {} } = r, o = await this.fetch(this.url, {
65
- headers: s,
66
- method: "GET",
67
- redirect: "follow",
68
- mode: "cors",
69
- signal: i,
70
- ...this.baseOverrides,
71
- ...c
72
- });
73
- if (o.status !== 200)
74
- throw new Error(`HTTP ${o.status} fetching ${this.url}`);
75
- if (t === "utf8")
76
- return o.text();
77
- if (t)
78
- throw new Error(`unsupported encoding: ${t}`);
79
- return this.getBufferFromResponse(o);
80
- }
81
- async stat() {
82
- if (!this._stat) {
83
- const e = d.Buffer.allocUnsafe(10);
84
- if (await this.read(e, 0, 10, 0), !this._stat)
85
- throw new Error(`unable to determine size of file at ${this.url}`);
86
- }
87
- return this._stat;
88
- }
89
- async close() {
90
- }
91
- }
92
- export {
93
- $ as R
94
- };
@@ -1,138 +0,0 @@
1
- import { describe, expect, test } from "vitest";
2
-
3
- import Collector from "./collector.js";
4
- import { UNIQUE_ID_KEY } from "./transforms/identifier.js";
5
-
6
- const data = [1, 5, 2, 4, 3].map((x) => ({ x }));
7
-
8
- test("Collector collects data", () => {
9
- const collector = new Collector();
10
-
11
- for (const d of data) {
12
- collector.handle(d);
13
- }
14
- collector.complete();
15
-
16
- expect(collector.getData()).toEqual(data);
17
- });
18
-
19
- test("Collector collects and sorts data", () => {
20
- const collector = new Collector({
21
- type: "collect",
22
- sort: { field: ["x"] },
23
- });
24
-
25
- for (const d of data) {
26
- collector.handle(d);
27
- }
28
- collector.complete();
29
-
30
- expect([...collector.getData()]).toEqual(
31
- [1, 2, 3, 4, 5].map((x) => ({ x }))
32
- );
33
- });
34
-
35
- test("Collector collects, groups, and sorts data", () => {
36
- const collector = new Collector({
37
- type: "collect",
38
- sort: { field: ["x"] },
39
- groupby: ["a", "b"],
40
- });
41
-
42
- const data = [
43
- { a: 1, b: 1, x: 1 },
44
- { a: 1, b: 2, x: 2 },
45
- { a: 1, b: 2, x: 3 },
46
- { a: 2, b: 1, x: 4 },
47
- { a: 2, b: 1, x: 5 },
48
- { a: 2, b: 2, x: 6 },
49
- ];
50
-
51
- for (const d of data) {
52
- collector.handle(d);
53
- }
54
- collector.complete();
55
-
56
- const cd = [...collector.getData()];
57
-
58
- expect(cd.map((d) => ({ x: d.x }))).toEqual(
59
- [1, 2, 3, 4, 5, 6].map((x) => ({ x }))
60
- );
61
-
62
- /** @param {any[]} group*/
63
- const getGroupX = (group) =>
64
- collector.facetBatches.get(group).map((d) => d.x);
65
-
66
- expect(getGroupX([1, 1])).toEqual([1]);
67
- expect(getGroupX([1, 2])).toEqual([2, 3]);
68
- expect(getGroupX([2, 1])).toEqual([4, 5]);
69
- expect(getGroupX([2, 2])).toEqual([6]);
70
-
71
- expect(new Set(collector.facetBatches.keys())).toEqual(
72
- new Set([
73
- [1, 1],
74
- [1, 2],
75
- [2, 1],
76
- [2, 2],
77
- ])
78
- );
79
- });
80
-
81
- test("Collector throws on incomplete flow", () => {
82
- const collector = new Collector();
83
-
84
- expect(() => collector.getData()).toThrow();
85
- });
86
-
87
- describe("Indexing unique ids", () => {
88
- test("Collector builds a working index when ids are available", () => {
89
- const collector = new Collector({
90
- type: "collect",
91
- groupby: ["a"],
92
- });
93
-
94
- const data = [
95
- { a: 1, x: 1, [UNIQUE_ID_KEY]: 8 },
96
- { a: 1, x: 2, [UNIQUE_ID_KEY]: 2 },
97
- { a: 1, x: 3, [UNIQUE_ID_KEY]: 4 },
98
- { a: 1, x: 4, [UNIQUE_ID_KEY]: 6 },
99
- { a: 2, x: 5, [UNIQUE_ID_KEY]: 9 },
100
- { a: 2, x: 6, [UNIQUE_ID_KEY]: 7 },
101
- { a: 2, x: 7, [UNIQUE_ID_KEY]: 3 },
102
- { a: 2, x: 8, [UNIQUE_ID_KEY]: 1 },
103
- ];
104
-
105
- for (const d of data) {
106
- collector.handle(d);
107
- }
108
- collector.complete();
109
-
110
- expect(collector.findDatumByUniqueId(8)).toEqual(data[0]);
111
- expect(collector.findDatumByUniqueId(2)).toEqual(data[1]);
112
- expect(collector.findDatumByUniqueId(4)).toEqual(data[2]);
113
- expect(collector.findDatumByUniqueId(6)).toEqual(data[3]);
114
- expect(collector.findDatumByUniqueId(9)).toEqual(data[4]);
115
- expect(collector.findDatumByUniqueId(7)).toEqual(data[5]);
116
- expect(collector.findDatumByUniqueId(3)).toEqual(data[6]);
117
- expect(collector.findDatumByUniqueId(1)).toEqual(data[7]);
118
- });
119
-
120
- test("Collector returns undefined when ids are not available", () => {
121
- const collector = new Collector({
122
- type: "collect",
123
- groupby: ["a"],
124
- });
125
-
126
- const data = [
127
- { a: 1, x: 1 },
128
- { a: 2, x: 5 },
129
- ];
130
-
131
- for (const d of data) {
132
- collector.handle(d);
133
- }
134
- collector.complete();
135
-
136
- expect(collector.findDatumByUniqueId(0)).toBeUndefined();
137
- });
138
- });
@@ -1,5 +0,0 @@
1
- import { describe, test } from "vitest";
2
-
3
- describe("DataFlow", () => {
4
- test.todo("TODO");
5
- });
@@ -1,81 +0,0 @@
1
- import { describe, expect, test } from "vitest";
2
- import FilterTransform from "./transforms/filter.js";
3
- import FormulaTransform from "./transforms/formula.js";
4
- import Collector from "./collector.js";
5
- import {
6
- SynchronousSequenceSource,
7
- makeParamMediatorProvider,
8
- } from "./flowTestUtils.js";
9
-
10
- describe("Test flow graphs", () => {
11
- test("Trivial graph: sequence to collector", () => {
12
- const source = new SynchronousSequenceSource(5);
13
- const collector = new Collector();
14
- source.addChild(collector);
15
-
16
- source.dispatch();
17
-
18
- expect(collector.getData()).toEqual(
19
- [0, 1, 2, 3, 4].map((d) => ({
20
- data: d,
21
- }))
22
- );
23
- });
24
-
25
- test("Trivial branching: sequence to two collectors", () => {
26
- const source = new SynchronousSequenceSource(5);
27
- const collector1 = new Collector();
28
- source.addChild(collector1);
29
- const collector2 = new Collector();
30
- source.addChild(collector2);
31
-
32
- source.dispatch();
33
-
34
- expect(collector1.getData()).toEqual(
35
- [0, 1, 2, 3, 4].map((d) => ({
36
- data: d,
37
- }))
38
- );
39
-
40
- expect(collector2.getData()).toEqual(
41
- [0, 1, 2, 3, 4].map((d) => ({
42
- data: d,
43
- }))
44
- );
45
- });
46
-
47
- test.skip("Implement stub for ParamMediator");
48
-
49
- test("Longer chain of nodes", () => {
50
- const source = new SynchronousSequenceSource(10);
51
- const filter = new FilterTransform(
52
- {
53
- type: "filter",
54
- expr: "datum.data < 5",
55
- },
56
- makeParamMediatorProvider()
57
- );
58
- const formula = new FormulaTransform(
59
- {
60
- type: "formula",
61
- expr: "datum.data * 2",
62
- as: "data",
63
- },
64
- makeParamMediatorProvider()
65
- );
66
- const collector = new Collector();
67
-
68
- source.addChild(filter);
69
- filter.addChild(formula);
70
- formula.addChild(collector);
71
-
72
- source.visit((node) => node.initialize());
73
- source.dispatch();
74
-
75
- expect(collector.getData()).toEqual(
76
- [0, 2, 4, 6, 8].map((d) => ({
77
- data: d,
78
- }))
79
- );
80
- });
81
- });
@@ -1,50 +0,0 @@
1
- import { describe, expect, test } from "vitest";
2
- import FlowNode from "./flowNode.js";
3
- import { validateLinks } from "./flowOptimizer.js";
4
-
5
- describe("Flow mutation", () => {
6
- test("Excise a terminal node", () => {
7
- const a = new FlowNode();
8
- const b = new FlowNode();
9
-
10
- a.addChild(b);
11
- b.excise();
12
-
13
- expect(a.children[0]).toBeUndefined();
14
- expect(b.parent).toBeUndefined();
15
-
16
- expect(validateLinks(a)).toBeTruthy();
17
- });
18
-
19
- test("Excise a node in the middle", () => {
20
- const a = new FlowNode();
21
- const b = new FlowNode();
22
- const c = new FlowNode();
23
-
24
- a.addChild(b);
25
- b.addChild(c);
26
- b.excise();
27
-
28
- expect(a.children[0]).toBe(c);
29
- expect(c.parent).toBe(a);
30
-
31
- expect(validateLinks(a)).toBeTruthy();
32
- });
33
-
34
- test("Insert as parent", () => {
35
- const a = new FlowNode();
36
- const b = new FlowNode();
37
- const c = new FlowNode();
38
- const d = new FlowNode();
39
-
40
- a.addChild(c);
41
- a.addChild(d);
42
- c.insertAsParent(b);
43
-
44
- expect(a.children[0]).toBe(b);
45
- expect(a.children[1]).toBe(d);
46
- expect(a.children[0].children[0]).toBe(c);
47
-
48
- expect(validateLinks(a)).toBeTruthy();
49
- });
50
- });
@@ -1,204 +0,0 @@
1
- import { describe, expect, test } from "vitest";
2
- import FlowNode, { BEHAVIOR_CLONES } from "./flowNode.js";
3
- import {
4
- removeRedundantCloneTransforms,
5
- validateLinks,
6
- } from "./flowOptimizer.js";
7
- import CloneTransform from "./transforms/clone.js";
8
- import Collector from "./collector.js";
9
- import DataFlow from "./dataFlow.js";
10
- import { combineIdenticalDataSources } from "./flowOptimizer.js";
11
- import InlineSource from "./sources/inlineSource.js";
12
- import UrlSource from "./sources/urlSource.js";
13
- import { makeParamMediatorProvider } from "./flowTestUtils.js";
14
-
15
- test("validateLinks() detects broken graph", () => {
16
- const root = new FlowNode();
17
- const a = new FlowNode();
18
- const b = new FlowNode();
19
- const c = new FlowNode();
20
-
21
- root.addChild(a);
22
- root.addChild(b);
23
- root.addChild(c);
24
-
25
- expect(validateLinks(root)).toBeTruthy();
26
-
27
- // Break it!
28
- b.parent = undefined;
29
-
30
- expect(validateLinks(root)).toBeFalsy();
31
-
32
- // Check handling of root
33
-
34
- const rootWithParent = new FlowNode();
35
- // Break it!
36
- rootWithParent.parent = new FlowNode();
37
-
38
- expect(validateLinks(rootWithParent)).toBeFalsy();
39
- });
40
-
41
- describe("removeRedundantCloneTransforms", () => {
42
- test("Removes redundancy from linear graph #1", () => {
43
- const a = new FlowNode();
44
- const b = new CloneTransform();
45
- const c = new FlowNode();
46
- const d = new CloneTransform();
47
- const e = new CloneTransform();
48
- const f = new FlowNode();
49
-
50
- a.addChild(b);
51
- b.addChild(c);
52
- c.addChild(d);
53
- d.addChild(e);
54
- e.addChild(f);
55
-
56
- removeRedundantCloneTransforms(a);
57
-
58
- expect(a.children[0]).toBe(c);
59
- expect(c.children[0]).toBe(f);
60
- });
61
-
62
- test("Removes redundancy from linear graph #2", () => {
63
- const a = new FlowNode();
64
- const b = new CloneTransform();
65
- const c = new FlowNode();
66
- const d = new CloneTransform();
67
- const e = new CloneTransform();
68
- const f = new FlowNode();
69
-
70
- a.addChild(b);
71
- b.addChild(c);
72
- c.addChild(d);
73
- d.addChild(e);
74
- e.addChild(f);
75
-
76
- // First CloneTransform should be retained
77
- removeRedundantCloneTransforms(a, true);
78
-
79
- expect(a.children[0]).toBe(b);
80
- expect(b.children[0]).toBe(c);
81
- expect(c.children[0]).toBe(f);
82
- });
83
-
84
- test("Node with cloning behavior satisfies cloning requirement", () => {
85
- class CloningFlowNode extends FlowNode {
86
- get behavior() {
87
- return BEHAVIOR_CLONES;
88
- }
89
- }
90
-
91
- const a = new FlowNode();
92
- const b = new CloningFlowNode();
93
- const c = new FlowNode();
94
- const d = new CloneTransform();
95
- const e = new FlowNode();
96
-
97
- a.addChild(b);
98
- b.addChild(c);
99
- c.addChild(d);
100
- d.addChild(e);
101
-
102
- removeRedundantCloneTransforms(a, true);
103
-
104
- expect(a.children[0]).toBe(b);
105
- expect(b.children[0]).toBe(c);
106
- expect(c.children[0]).toBe(e);
107
- });
108
-
109
- test("Removes redundancy from a branching graph", () => {
110
- const root = new FlowNode();
111
- const branching = new FlowNode();
112
- const a = new CloneTransform();
113
- const al = new FlowNode();
114
- const b = new CloneTransform();
115
- const bl = new FlowNode();
116
- const c = new CloneTransform();
117
- const cl = new FlowNode();
118
-
119
- root.addChild(branching);
120
- branching.addChild(a);
121
- branching.addChild(b);
122
- branching.addChild(c);
123
- a.addChild(al);
124
- b.addChild(bl);
125
- c.addChild(cl);
126
-
127
- removeRedundantCloneTransforms(root);
128
-
129
- // All but the last branch needs cloning
130
- expect(branching.children[0]).toBe(a);
131
- expect(branching.children[1]).toBe(b);
132
- expect(branching.children[2]).toBe(c);
133
- });
134
- });
135
-
136
- /** @type {import("../view/view.js").default} */
137
- const viewStub = /** @type {any} */ (
138
- Object.assign(makeParamMediatorProvider(), {
139
- getBaseUrl: () => "",
140
- })
141
- );
142
-
143
- describe("Merge indentical data sources", () => {
144
- test("Merges correctly", () => {
145
- /** @type {DataFlow<string>} */
146
- const dataFlow = new DataFlow();
147
-
148
- const a = new UrlSource({ url: "http://genomespy.app/" }, viewStub);
149
- const ac = new Collector();
150
- a.addChild(ac);
151
-
152
- const b = new UrlSource({ url: "http://genomespy.app/" }, viewStub);
153
- const bc = new Collector();
154
- b.addChild(bc);
155
-
156
- const c = new UrlSource({ url: "http://helsinki.fi/" }, viewStub);
157
- const cc = new Collector();
158
- c.addChild(cc);
159
-
160
- dataFlow.addDataSource(a, "a");
161
- dataFlow.addDataSource(b, "b");
162
- dataFlow.addDataSource(c, "c");
163
-
164
- dataFlow.addCollector(ac, "a");
165
- dataFlow.addCollector(bc, "b");
166
- dataFlow.addCollector(cc, "c");
167
-
168
- combineIdenticalDataSources(dataFlow);
169
-
170
- expect(dataFlow.dataSources.length).toEqual(2);
171
-
172
- expect(dataFlow.findDataSourceByKey("a")).toBe(a);
173
- expect(dataFlow.findDataSourceByKey("b")).toBe(a); // Merged!
174
- expect(dataFlow.findDataSourceByKey("c")).toBe(c);
175
-
176
- expect(new Set(a.children)).toEqual(new Set([ac, bc]));
177
- expect(c.children[0]).toBe(cc);
178
-
179
- for (const dataSource of dataFlow.dataSources) {
180
- // Cheat that we loaded something
181
- dataSource.complete();
182
- }
183
-
184
- expect(ac.completed).toBeTruthy();
185
- expect(bc.completed).toBeTruthy();
186
- expect(cc.completed).toBeTruthy();
187
- });
188
-
189
- test("Does not merge those with undefined identifier", () => {
190
- /** @type {DataFlow<string>} */
191
- const dataFlow = new DataFlow();
192
-
193
- const a = new InlineSource({ values: [1, 2, 3] }, viewStub);
194
- const b = new InlineSource({ values: [1, 2, 3] }, viewStub);
195
-
196
- dataFlow.addDataSource(a, "a");
197
- dataFlow.addDataSource(b, "b");
198
-
199
- combineIdenticalDataSources(dataFlow);
200
-
201
- expect(dataFlow.findDataSourceByKey("a")).toBe(a);
202
- expect(dataFlow.findDataSourceByKey("b")).toBe(b);
203
- });
204
- });
@@ -1,27 +0,0 @@
1
- import { expect, test } from "vitest";
2
- import fasta from "./fasta.js";
3
-
4
- test("fasta", () => {
5
- const fileContent = `>A stuff
6
- --------------------------AGAGTTTGATCCTGGCTCAGGGTGAACGCTGGCG
7
- GCGTGC----TTAAGACATGCAAGTCGAACGG-CCT------TCTTCG-G-AAGGC-AGT
8
- ---------------------------------
9
- >B other stuff
10
- --------------------------AGAGTTTGATCATGGCTCAGGGTGAACGCTGGCG
11
- GCGTGC----TTAAGACATGCAAGTCGGACGA-TCG------GCTTCG---GCCGGTAGT
12
- ---------------------------------
13
- `;
14
-
15
- expect(fasta(fileContent)).toEqual([
16
- {
17
- identifier: "A",
18
- sequence:
19
- "--------------------------AGAGTTTGATCCTGGCTCAGGGTGAACGCTGGCGGCGTGC----TTAAGACATGCAAGTCGAACGG-CCT------TCTTCG-G-AAGGC-AGT---------------------------------",
20
- },
21
- {
22
- identifier: "B",
23
- sequence:
24
- "--------------------------AGAGTTTGATCATGGCTCAGGGTGAACGCTGGCGGCGTGC----TTAAGACATGCAAGTCGGACGA-TCG------GCTTCG---GCCGGTAGT---------------------------------",
25
- },
26
- ]);
27
- });
@@ -1,63 +0,0 @@
1
- import { expect, test } from "vitest";
2
- import Collector from "../collector.js";
3
- import InlineSource from "./inlineSource.js";
4
-
5
- /**
6
- * @param {InlineSource} source
7
- */
8
- async function collectSource(source) {
9
- const collector = new Collector();
10
- source.addChild(collector);
11
-
12
- await source.load();
13
-
14
- return [...collector.getData()];
15
- }
16
-
17
- test("InlineSource propagates an object", async () => {
18
- expect(
19
- await collectSource(new InlineSource({ values: { x: 1 } }, undefined))
20
- ).toEqual([{ x: 1 }]);
21
- });
22
-
23
- test("InlineSource propagates an array of objects", async () => {
24
- expect(
25
- await collectSource(
26
- new InlineSource({ values: [{ x: 1 }, { x: 2 }] }, undefined)
27
- )
28
- ).toEqual([{ x: 1 }, { x: 2 }]);
29
- });
30
-
31
- test("InlineSource wraps scalars to objects", async () => {
32
- expect(
33
- await collectSource(new InlineSource({ values: [1, 2] }, undefined))
34
- ).toEqual([{ data: 1 }, { data: 2 }]);
35
- });
36
-
37
- test("InlineSource parses a string", async () => {
38
- expect(
39
- await collectSource(
40
- new InlineSource(
41
- {
42
- values: "a\n1\n2\n3",
43
- format: {
44
- type: "csv",
45
- },
46
- },
47
- undefined
48
- )
49
- )
50
- ).toEqual([{ a: 1 }, { a: 2 }, { a: 3 }]);
51
- });
52
-
53
- test("InlineSource throws on a string and a missing format specifier", () => {
54
- expect(
55
- () =>
56
- new InlineSource(
57
- {
58
- values: "a\n1\n2\n3",
59
- },
60
- undefined
61
- )
62
- ).toThrow();
63
- });