@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.
- package/dist/bundle/{index-CCJIjehY.js → AbortablePromiseCache-CcuMrnn7.js} +22 -91
- package/dist/bundle/browser-BRemItdO.js +138 -0
- package/dist/bundle/index-BatuyGAI.js +271 -0
- package/dist/bundle/index-ByuE8dvu.js +332 -0
- package/dist/bundle/index-Cq3QFUxX.js +1781 -0
- package/dist/bundle/{index-C08YCM2T.js → index-D-w7Mmt9.js} +246 -126
- package/dist/bundle/index-D28m8tSW.js +1607 -0
- package/dist/bundle/index-D74H8TTz.js +508 -0
- package/dist/bundle/index-DbJ0oeYM.js +631 -0
- package/dist/bundle/index.es.js +15034 -13842
- package/dist/bundle/index.js +223 -237
- package/dist/bundle/inflate-GtwLkvSP.js +1048 -0
- package/dist/bundle/unzip-NywezaRR.js +1492 -0
- package/dist/schema.json +22 -4
- package/dist/src/config/scaleDefaults.d.ts +8 -0
- package/dist/src/config/scaleDefaults.d.ts.map +1 -0
- package/dist/src/config/scaleDefaults.js +45 -0
- package/dist/src/data/collector.d.ts +7 -2
- package/dist/src/data/collector.d.ts.map +1 -1
- package/dist/src/data/collector.js +13 -2
- package/dist/src/data/dataFlow.d.ts +20 -42
- package/dist/src/data/dataFlow.d.ts.map +1 -1
- package/dist/src/data/dataFlow.js +57 -80
- package/dist/src/data/flowHandle.d.ts +15 -0
- package/dist/src/data/flowHandle.d.ts.map +1 -0
- package/dist/src/data/flowHandle.js +13 -0
- package/dist/src/data/flowInit.d.ts +85 -0
- package/dist/src/data/flowInit.d.ts.map +1 -0
- package/dist/src/data/flowInit.js +238 -0
- package/dist/src/data/flowInit.test.d.ts +2 -0
- package/dist/src/data/flowInit.test.d.ts.map +1 -0
- package/dist/src/data/flowOptimizer.d.ts +6 -4
- package/dist/src/data/flowOptimizer.d.ts.map +1 -1
- package/dist/src/data/flowOptimizer.js +29 -14
- package/dist/src/data/sources/lazy/axisTickSource.js +1 -1
- package/dist/src/data/sources/lazy/bamSource.js +1 -1
- package/dist/src/data/sources/lazy/bigBedSource.js +1 -1
- package/dist/src/data/sources/lazy/bigWigSource.js +1 -1
- package/dist/src/data/sources/lazy/gff3Source.d.ts +2 -6
- package/dist/src/data/sources/lazy/gff3Source.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/gff3Source.js +4 -8
- package/dist/src/data/sources/lazy/indexedFastaSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/indexedFastaSource.js +17 -17
- package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts +1 -1
- package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisLazySource.js +10 -3
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +5 -1
- package/dist/src/data/sources/lazy/tabixSource.js +1 -1
- package/dist/src/data/transforms/filterScoredLabels.d.ts +1 -1
- package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
- package/dist/src/data/transforms/filterScoredLabels.js +1 -1
- package/dist/src/data/transforms/linearizeGenomicCoordinate.d.ts.map +1 -1
- package/dist/src/data/transforms/linearizeGenomicCoordinate.js +2 -1
- package/dist/src/encoder/encoder.d.ts +1 -1
- package/dist/src/encoder/encoder.d.ts.map +1 -1
- package/dist/src/encoder/encoder.js +1 -1
- package/dist/src/genome/scaleLocus.d.ts +39 -0
- package/dist/src/genome/scaleLocus.d.ts.map +1 -1
- package/dist/src/genome/scaleLocus.js +76 -0
- package/dist/src/genomeSpy/canvasExport.d.ts +19 -0
- package/dist/src/genomeSpy/canvasExport.d.ts.map +1 -0
- package/dist/src/genomeSpy/canvasExport.js +66 -0
- package/dist/src/genomeSpy/containerUi.d.ts +17 -0
- package/dist/src/genomeSpy/containerUi.d.ts.map +1 -0
- package/dist/src/genomeSpy/containerUi.js +78 -0
- package/dist/src/genomeSpy/eventListenerRegistry.d.ts +19 -0
- package/dist/src/genomeSpy/eventListenerRegistry.d.ts.map +1 -0
- package/dist/src/genomeSpy/eventListenerRegistry.js +38 -0
- package/dist/src/genomeSpy/inputBindingManager.d.ts +14 -0
- package/dist/src/genomeSpy/inputBindingManager.d.ts.map +1 -0
- package/dist/src/genomeSpy/inputBindingManager.js +63 -0
- package/dist/src/genomeSpy/interactionController.d.ts +40 -0
- package/dist/src/genomeSpy/interactionController.d.ts.map +1 -0
- package/dist/src/genomeSpy/interactionController.js +371 -0
- package/dist/src/genomeSpy/keyboardListenerManager.d.ts +10 -0
- package/dist/src/genomeSpy/keyboardListenerManager.d.ts.map +1 -0
- package/dist/src/genomeSpy/keyboardListenerManager.js +31 -0
- package/dist/src/genomeSpy/loadingIndicatorManager.d.ts +15 -0
- package/dist/src/genomeSpy/loadingIndicatorManager.d.ts.map +1 -0
- package/dist/src/genomeSpy/loadingIndicatorManager.js +92 -0
- package/dist/src/genomeSpy/renderCoordinator.d.ts +22 -0
- package/dist/src/genomeSpy/renderCoordinator.d.ts.map +1 -0
- package/dist/src/genomeSpy/renderCoordinator.js +118 -0
- package/dist/src/genomeSpy/viewContextFactory.d.ts +18 -0
- package/dist/src/genomeSpy/viewContextFactory.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewContextFactory.js +79 -0
- package/dist/src/genomeSpy/viewDataInit.d.ts +12 -0
- package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewDataInit.js +41 -0
- package/dist/src/genomeSpy/viewHierarchyConfig.d.ts +14 -0
- package/dist/src/genomeSpy/viewHierarchyConfig.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewHierarchyConfig.js +24 -0
- package/dist/src/genomeSpy/viewHighlight.d.ts +5 -0
- package/dist/src/genomeSpy/viewHighlight.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewHighlight.js +30 -0
- package/dist/src/genomeSpy.d.ts +17 -72
- package/dist/src/genomeSpy.d.ts.map +1 -1
- package/dist/src/genomeSpy.js +180 -789
- package/dist/src/gl/glslScaleGenerator.d.ts +1 -1
- package/dist/src/gl/webGLHelper.d.ts +2 -2
- package/dist/src/gl/webGLHelper.d.ts.map +1 -1
- package/dist/src/gl/webGLHelper.js +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -12
- package/dist/src/marks/mark.d.ts +1 -0
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +26 -3
- package/dist/src/{view → scales}/axisResolution.d.ts +12 -14
- package/dist/src/scales/axisResolution.d.ts.map +1 -0
- package/dist/src/{view → scales}/axisResolution.js +38 -12
- package/dist/src/scales/axisResolution.test.d.ts.map +1 -0
- package/dist/src/scales/scaleDomainAggregator.d.ts +57 -0
- package/dist/src/scales/scaleDomainAggregator.d.ts.map +1 -0
- package/dist/src/scales/scaleDomainAggregator.js +162 -0
- package/dist/src/scales/scaleDomainAggregator.test.d.ts +2 -0
- package/dist/src/scales/scaleDomainAggregator.test.d.ts.map +1 -0
- package/dist/src/scales/scaleInstanceManager.d.ts +40 -0
- package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -0
- package/dist/src/scales/scaleInstanceManager.js +313 -0
- package/dist/src/scales/scaleInstanceManager.test.d.ts +2 -0
- package/dist/src/scales/scaleInstanceManager.test.d.ts.map +1 -0
- package/dist/src/scales/scaleInteractionController.d.ts +73 -0
- package/dist/src/scales/scaleInteractionController.d.ts.map +1 -0
- package/dist/src/scales/scaleInteractionController.js +336 -0
- package/dist/src/scales/scaleInteractionController.test.d.ts +2 -0
- package/dist/src/scales/scaleInteractionController.test.d.ts.map +1 -0
- package/dist/src/scales/scalePropsResolver.d.ts +23 -0
- package/dist/src/scales/scalePropsResolver.d.ts.map +1 -0
- package/dist/src/scales/scalePropsResolver.js +74 -0
- package/dist/src/{view → scales}/scaleResolution.d.ts +53 -31
- package/dist/src/scales/scaleResolution.d.ts.map +1 -0
- package/dist/src/scales/scaleResolution.js +658 -0
- package/dist/src/scales/scaleResolution.test.d.ts.map +1 -0
- package/dist/src/scales/scaleResolutionConstants.d.ts +6 -0
- package/dist/src/scales/scaleResolutionConstants.d.ts.map +1 -0
- package/dist/src/scales/scaleResolutionConstants.js +5 -0
- package/dist/src/scales/scaleRules.d.ts +16 -0
- package/dist/src/scales/scaleRules.d.ts.map +1 -0
- package/dist/src/scales/scaleRules.js +103 -0
- package/dist/src/scales/scaleRules.test.d.ts +2 -0
- package/dist/src/scales/scaleRules.test.d.ts.map +1 -0
- package/dist/src/spec/channel.d.ts +13 -18
- package/dist/src/spec/sampleView.d.ts +3 -2
- package/dist/src/spec/scale.d.ts +6 -0
- package/dist/src/types/embedApi.d.ts +5 -0
- package/dist/src/types/scaleResolutionApi.d.ts +1 -1
- package/dist/src/types/viewContext.d.ts +1 -1
- package/dist/src/view/concatView.d.ts +18 -0
- package/dist/src/view/concatView.d.ts.map +1 -1
- package/dist/src/view/concatView.js +73 -0
- package/dist/src/view/concatView.test.d.ts +2 -0
- package/dist/src/view/concatView.test.d.ts.map +1 -0
- package/dist/src/view/containerMutationHelper.d.ts +74 -0
- package/dist/src/view/containerMutationHelper.d.ts.map +1 -0
- package/dist/src/view/containerMutationHelper.js +114 -0
- package/dist/src/view/containerView.d.ts +0 -7
- package/dist/src/view/containerView.d.ts.map +1 -1
- package/dist/src/view/containerView.js +0 -10
- package/dist/src/view/facetView.d.ts.map +1 -1
- package/dist/src/view/facetView.js +0 -14
- package/dist/src/view/flowBuilder.d.ts +2 -2
- package/dist/src/view/flowBuilder.d.ts.map +1 -1
- package/dist/src/view/flowBuilder.js +21 -4
- package/dist/src/view/gridView/gridChild.d.ts +11 -0
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.js +32 -6
- package/dist/src/view/gridView/gridView.d.ts +39 -1
- package/dist/src/view/gridView/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView/gridView.js +113 -42
- package/dist/src/view/gridView/gridView.test.d.ts +2 -0
- package/dist/src/view/gridView/gridView.test.d.ts.map +1 -0
- package/dist/src/view/gridView/scrollbar.d.ts +39 -8
- package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
- package/dist/src/view/gridView/scrollbar.js +184 -69
- package/dist/src/view/gridView/selectionRect.d.ts +8 -4
- package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
- package/dist/src/view/gridView/selectionRect.js +28 -3
- package/dist/src/view/gridView/selectionRect.test.d.ts +2 -0
- package/dist/src/view/gridView/selectionRect.test.d.ts.map +1 -0
- package/dist/src/view/layerView.d.ts +14 -0
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layerView.js +66 -0
- package/dist/src/view/layerView.test.d.ts +2 -0
- package/dist/src/view/layerView.test.d.ts.map +1 -0
- package/dist/src/view/paramMediator.d.ts +2 -1
- package/dist/src/view/paramMediator.d.ts.map +1 -1
- package/dist/src/view/paramMediator.js +13 -1
- package/dist/src/view/testUtils.d.ts.map +1 -1
- package/dist/src/view/testUtils.js +18 -5
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +52 -12
- package/dist/src/view/view.d.ts +23 -7
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +61 -5
- package/dist/src/view/viewDispose.test.d.ts +2 -0
- package/dist/src/view/viewDispose.test.d.ts.map +1 -0
- package/dist/src/view/viewUtils.d.ts +4 -4
- package/dist/src/view/viewUtils.d.ts.map +1 -1
- package/dist/src/view/viewUtils.js +19 -15
- package/dist/src/view/viewUtils.test.d.ts +2 -0
- package/dist/src/view/viewUtils.test.d.ts.map +1 -0
- package/package.json +10 -10
- package/dist/bundle/__vite-browser-external-C--ziKoh.js +0 -8
- package/dist/bundle/_commonjsHelpers-DjF3Plf2.js +0 -26
- package/dist/bundle/index-5ajWdKly.js +0 -1319
- package/dist/bundle/index-B03-Om4z.js +0 -274
- package/dist/bundle/index-BftNdA0O.js +0 -27
- package/dist/bundle/index-Bg7C4Xat.js +0 -2750
- package/dist/bundle/index-C3QR8Lv6.js +0 -2131
- package/dist/bundle/index-DTcHjAHp.js +0 -505
- package/dist/bundle/index-DnIkxb0L.js +0 -1025
- package/dist/bundle/index-Ww3TAo6_.js +0 -71
- package/dist/bundle/index-g8iXgW0W.js +0 -651
- package/dist/bundle/long-B-FASCSo.js +0 -2387
- package/dist/bundle/remoteFile-BuaqFGWk.js +0 -94
- package/dist/src/data/collector.test.js +0 -138
- package/dist/src/data/dataFlow.test.js +0 -5
- package/dist/src/data/flow.test.js +0 -81
- package/dist/src/data/flowNode.test.js +0 -50
- package/dist/src/data/flowOptimizer.test.js +0 -204
- package/dist/src/data/formats/fasta.test.js +0 -27
- package/dist/src/data/sources/inlineSource.test.js +0 -63
- package/dist/src/data/sources/sequenceSource.test.js +0 -81
- package/dist/src/data/transforms/aggregate.test.js +0 -134
- package/dist/src/data/transforms/clone.test.js +0 -11
- package/dist/src/data/transforms/coverage.test.js +0 -238
- package/dist/src/data/transforms/filter.test.js +0 -20
- package/dist/src/data/transforms/flatten.test.js +0 -96
- package/dist/src/data/transforms/flattenDelimited.test.js +0 -90
- package/dist/src/data/transforms/flattenSequence.test.js +0 -34
- package/dist/src/data/transforms/formula.test.js +0 -25
- package/dist/src/data/transforms/identifier.test.js +0 -92
- package/dist/src/data/transforms/pileup.test.js +0 -70
- package/dist/src/data/transforms/project.test.js +0 -32
- package/dist/src/data/transforms/regexExtract.test.js +0 -70
- package/dist/src/data/transforms/regexFold.test.js +0 -201
- package/dist/src/data/transforms/sample.test.js +0 -38
- package/dist/src/data/transforms/stack.test.js +0 -91
- package/dist/src/encoder/accessor.test.js +0 -162
- package/dist/src/encoder/encoder.test.js +0 -105
- package/dist/src/genome/genome.test.js +0 -268
- package/dist/src/genome/genomes.test.js +0 -8
- package/dist/src/genome/scaleIndex.test.js +0 -78
- package/dist/src/genome/scaleLocus.test.js +0 -4
- package/dist/src/scale/scale.test.js +0 -326
- package/dist/src/scale/ticks.test.js +0 -46
- package/dist/src/selection/selection.test.js +0 -14
- package/dist/src/utils/addBaseUrl.test.js +0 -30
- package/dist/src/utils/binnedIndex.test.js +0 -201
- package/dist/src/utils/cloner.test.js +0 -35
- package/dist/src/utils/coalesce.test.js +0 -16
- package/dist/src/utils/concatIterables.test.js +0 -8
- package/dist/src/utils/domainArray.test.js +0 -130
- package/dist/src/utils/indexer.test.js +0 -49
- package/dist/src/utils/interactionEvent.test.js +0 -35
- package/dist/src/utils/iterateNestedMaps.test.js +0 -33
- package/dist/src/utils/kWayMerge.test.js +0 -30
- package/dist/src/utils/mergeObjects.test.js +0 -42
- package/dist/src/utils/numberExtractor.test.js +0 -6
- package/dist/src/utils/propertyCacher.test.js +0 -89
- package/dist/src/utils/propertyCoalescer.test.js +0 -25
- package/dist/src/utils/radixSort.test.js +0 -51
- package/dist/src/utils/reservationMap.test.js +0 -20
- package/dist/src/utils/ringBuffer.test.js +0 -39
- package/dist/src/utils/topK.test.js +0 -54
- package/dist/src/utils/trees.test.js +0 -135
- package/dist/src/utils/url.test.js +0 -28
- package/dist/src/utils/variableTools.test.js +0 -13
- package/dist/src/view/axisResolution.d.ts.map +0 -1
- package/dist/src/view/axisResolution.test.d.ts.map +0 -1
- package/dist/src/view/axisResolution.test.js +0 -206
- package/dist/src/view/flowBuilder.test.js +0 -125
- package/dist/src/view/layout/flexLayout.test.js +0 -323
- package/dist/src/view/layout/grid.test.js +0 -71
- package/dist/src/view/layout/rectangle.test.js +0 -192
- package/dist/src/view/paramMediator.test.js +0 -260
- package/dist/src/view/scaleResolution.d.ts.map +0 -1
- package/dist/src/view/scaleResolution.js +0 -1049
- package/dist/src/view/scaleResolution.test.d.ts.map +0 -1
- package/dist/src/view/scaleResolution.test.js +0 -645
- package/dist/src/view/view.test.js +0 -245
- package/dist/src/view/viewFactory.test.js +0 -25
- /package/dist/src/{view → scales}/axisResolution.test.d.ts +0 -0
- /package/dist/src/{view → scales}/scaleResolution.test.d.ts +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
class f {
|
|
1
|
+
class h {
|
|
3
2
|
}
|
|
4
|
-
class
|
|
3
|
+
class d {
|
|
5
4
|
constructor() {
|
|
6
5
|
this.signals = /* @__PURE__ */ new Set(), this.abortController = new AbortController();
|
|
7
6
|
}
|
|
@@ -11,7 +10,7 @@ class b {
|
|
|
11
10
|
* longer be abortable.
|
|
12
11
|
*/
|
|
13
12
|
//@ts-ignore
|
|
14
|
-
addSignal(t = new
|
|
13
|
+
addSignal(t = new h()) {
|
|
15
14
|
if (this.signal.aborted)
|
|
16
15
|
throw new Error("cannot add a signal, already aborted!");
|
|
17
16
|
this.signals.add(t), t.aborted ? this.handleAborted(t) : typeof t.addEventListener == "function" && t.addEventListener("abort", () => {
|
|
@@ -28,13 +27,13 @@ class b {
|
|
|
28
27
|
this.abortController.abort();
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
|
-
class
|
|
30
|
+
class b {
|
|
32
31
|
constructor() {
|
|
33
32
|
this.callbacks = /* @__PURE__ */ new Set();
|
|
34
33
|
}
|
|
35
34
|
addCallback(t = () => {
|
|
36
35
|
}) {
|
|
37
|
-
this.callbacks.add(t), t(this.currentMessage);
|
|
36
|
+
this.callbacks.add(t), this.currentMessage && t(this.currentMessage);
|
|
38
37
|
}
|
|
39
38
|
callback(t) {
|
|
40
39
|
this.currentMessage = t;
|
|
@@ -42,7 +41,7 @@ class g {
|
|
|
42
41
|
e(t);
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
class
|
|
44
|
+
class c {
|
|
46
45
|
constructor({ fill: t, cache: e }) {
|
|
47
46
|
if (typeof t != "function")
|
|
48
47
|
throw new TypeError("must pass a fill function");
|
|
@@ -65,16 +64,16 @@ class l {
|
|
|
65
64
|
evict(t, e) {
|
|
66
65
|
this.cache.get(t) === e && this.cache.delete(t);
|
|
67
66
|
}
|
|
68
|
-
fill(t, e, r,
|
|
69
|
-
const
|
|
70
|
-
|
|
67
|
+
fill(t, e, r, s) {
|
|
68
|
+
const o = new d(), i = new b();
|
|
69
|
+
i.addCallback(s);
|
|
71
70
|
const a = {
|
|
72
|
-
aborter:
|
|
73
|
-
promise: this.fillCallback(e,
|
|
74
|
-
|
|
71
|
+
aborter: o,
|
|
72
|
+
promise: this.fillCallback(e, o.signal, (n) => {
|
|
73
|
+
i.callback(n);
|
|
75
74
|
}),
|
|
76
75
|
settled: !1,
|
|
77
|
-
statusReporter:
|
|
76
|
+
statusReporter: i,
|
|
78
77
|
get aborted() {
|
|
79
78
|
return this.aborter.signal.aborted;
|
|
80
79
|
}
|
|
@@ -85,8 +84,8 @@ class l {
|
|
|
85
84
|
a.settled = !0;
|
|
86
85
|
}, () => {
|
|
87
86
|
a.settled = !0, this.evict(t, a);
|
|
88
|
-
}).catch((
|
|
89
|
-
throw console.error(
|
|
87
|
+
}).catch((n) => {
|
|
88
|
+
throw console.error(n), n;
|
|
90
89
|
}), this.cache.set(t, a);
|
|
91
90
|
}
|
|
92
91
|
static checkSinglePromise(t, e) {
|
|
@@ -94,8 +93,8 @@ class l {
|
|
|
94
93
|
if (e != null && e.aborted)
|
|
95
94
|
throw Object.assign(new Error("aborted"), { code: "ERR_ABORTED" });
|
|
96
95
|
}
|
|
97
|
-
return t.then((
|
|
98
|
-
throw r(),
|
|
96
|
+
return t.then((s) => (r(), s), (s) => {
|
|
97
|
+
throw r(), s;
|
|
99
98
|
});
|
|
100
99
|
}
|
|
101
100
|
has(t) {
|
|
@@ -113,12 +112,12 @@ class l {
|
|
|
113
112
|
* @param {AbortSignal} [signal] optional AbortSignal object that aborts the request
|
|
114
113
|
* @param {statusCallback} a callback to get the current status of a pending async operation
|
|
115
114
|
*/
|
|
116
|
-
get(t, e, r,
|
|
115
|
+
get(t, e, r, s) {
|
|
117
116
|
if (!r && e instanceof AbortSignal)
|
|
118
117
|
throw new TypeError("second get argument appears to be an AbortSignal, perhaps you meant to pass `null` for the fill data?");
|
|
119
|
-
const
|
|
120
|
-
return
|
|
121
|
-
//
|
|
118
|
+
const o = this.cache.get(t);
|
|
119
|
+
return o ? o.aborted && !o.settled ? (this.evict(t, o), this.get(t, e, r, s)) : o.settled ? o.promise : (o.aborter.addSignal(r), o.statusReporter.addCallback(s), c.checkSinglePromise(o.promise, r)) : (this.fill(t, e, r, s), c.checkSinglePromise(
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
122
121
|
this.cache.get(t).promise,
|
|
123
122
|
r
|
|
124
123
|
));
|
|
@@ -145,74 +144,6 @@ class l {
|
|
|
145
144
|
return e;
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
|
-
var n, d;
|
|
149
|
-
function p() {
|
|
150
|
-
if (d) return n;
|
|
151
|
-
d = 1;
|
|
152
|
-
class o {
|
|
153
|
-
constructor(e = {}) {
|
|
154
|
-
if (!(e.maxSize && e.maxSize > 0))
|
|
155
|
-
throw new TypeError("`maxSize` must be a number greater than 0");
|
|
156
|
-
this.maxSize = e.maxSize, this.cache = /* @__PURE__ */ new Map(), this.oldCache = /* @__PURE__ */ new Map(), this._size = 0;
|
|
157
|
-
}
|
|
158
|
-
_set(e, r) {
|
|
159
|
-
this.cache.set(e, r), this._size++, this._size >= this.maxSize && (this._size = 0, this.oldCache = this.cache, this.cache = /* @__PURE__ */ new Map());
|
|
160
|
-
}
|
|
161
|
-
get(e) {
|
|
162
|
-
if (this.cache.has(e))
|
|
163
|
-
return this.cache.get(e);
|
|
164
|
-
if (this.oldCache.has(e)) {
|
|
165
|
-
const r = this.oldCache.get(e);
|
|
166
|
-
return this.oldCache.delete(e), this._set(e, r), r;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
set(e, r) {
|
|
170
|
-
return this.cache.has(e) ? this.cache.set(e, r) : this._set(e, r), this;
|
|
171
|
-
}
|
|
172
|
-
has(e) {
|
|
173
|
-
return this.cache.has(e) || this.oldCache.has(e);
|
|
174
|
-
}
|
|
175
|
-
peek(e) {
|
|
176
|
-
if (this.cache.has(e))
|
|
177
|
-
return this.cache.get(e);
|
|
178
|
-
if (this.oldCache.has(e))
|
|
179
|
-
return this.oldCache.get(e);
|
|
180
|
-
}
|
|
181
|
-
delete(e) {
|
|
182
|
-
const r = this.cache.delete(e);
|
|
183
|
-
return r && this._size--, this.oldCache.delete(e) || r;
|
|
184
|
-
}
|
|
185
|
-
clear() {
|
|
186
|
-
this.cache.clear(), this.oldCache.clear(), this._size = 0;
|
|
187
|
-
}
|
|
188
|
-
*keys() {
|
|
189
|
-
for (const [e] of this)
|
|
190
|
-
yield e;
|
|
191
|
-
}
|
|
192
|
-
*values() {
|
|
193
|
-
for (const [, e] of this)
|
|
194
|
-
yield e;
|
|
195
|
-
}
|
|
196
|
-
*[Symbol.iterator]() {
|
|
197
|
-
for (const e of this.cache)
|
|
198
|
-
yield e;
|
|
199
|
-
for (const e of this.oldCache) {
|
|
200
|
-
const [r] = e;
|
|
201
|
-
this.cache.has(r) || (yield e);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
get size() {
|
|
205
|
-
let e = 0;
|
|
206
|
-
for (const r of this.oldCache.keys())
|
|
207
|
-
this.cache.has(r) || e++;
|
|
208
|
-
return this._size + e;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
return n = o, n;
|
|
212
|
-
}
|
|
213
|
-
var m = p();
|
|
214
|
-
const C = /* @__PURE__ */ u(m);
|
|
215
147
|
export {
|
|
216
|
-
|
|
217
|
-
C as L
|
|
148
|
+
c as A
|
|
218
149
|
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
class f {
|
|
2
|
+
constructor(e) {
|
|
3
|
+
this.blob = e;
|
|
4
|
+
}
|
|
5
|
+
async read(e, r = 0) {
|
|
6
|
+
if (!e)
|
|
7
|
+
return new Uint8Array(0);
|
|
8
|
+
const s = r, n = s + e, a = this.blob.slice(s, n);
|
|
9
|
+
return a.bytes ? a.bytes() : new Uint8Array(await a.arrayBuffer());
|
|
10
|
+
}
|
|
11
|
+
async readFile(e) {
|
|
12
|
+
const r = typeof e == "string" ? e : e == null ? void 0 : e.encoding;
|
|
13
|
+
if (r === "utf8")
|
|
14
|
+
return this.blob.text();
|
|
15
|
+
if (r)
|
|
16
|
+
throw new Error(`unsupported encoding: ${r}`);
|
|
17
|
+
return this.blob.bytes ? this.blob.bytes() : new Uint8Array(await this.blob.arrayBuffer());
|
|
18
|
+
}
|
|
19
|
+
async stat() {
|
|
20
|
+
return { size: this.blob.size };
|
|
21
|
+
}
|
|
22
|
+
async close() {
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function d(i) {
|
|
26
|
+
return (typeof i == "object" && i !== null && "message" in i ? i.message : `${i}`).replace(/\.$/, "");
|
|
27
|
+
}
|
|
28
|
+
class u {
|
|
29
|
+
constructor(e, r = {}) {
|
|
30
|
+
this.baseOverrides = {}, this.url = e;
|
|
31
|
+
const s = r.fetch || globalThis.fetch.bind(globalThis);
|
|
32
|
+
r.overrides && (this.baseOverrides = r.overrides), this.fetchImplementation = s;
|
|
33
|
+
}
|
|
34
|
+
async fetch(e, r) {
|
|
35
|
+
const s = (a) => new Error(`${d(a)} fetching ${e}`, { cause: a });
|
|
36
|
+
let n;
|
|
37
|
+
try {
|
|
38
|
+
n = await this.fetchImplementation(e, r);
|
|
39
|
+
} catch (a) {
|
|
40
|
+
if (`${a}`.includes("Failed to fetch")) {
|
|
41
|
+
console.warn(`generic-filehandle: refetching ${e} to attempt to work around chrome CORS header caching bug`);
|
|
42
|
+
try {
|
|
43
|
+
n = await this.fetchImplementation(e, {
|
|
44
|
+
...r,
|
|
45
|
+
cache: "reload"
|
|
46
|
+
});
|
|
47
|
+
} catch (c) {
|
|
48
|
+
throw s(c);
|
|
49
|
+
}
|
|
50
|
+
} else
|
|
51
|
+
throw s(a);
|
|
52
|
+
}
|
|
53
|
+
return n;
|
|
54
|
+
}
|
|
55
|
+
async read(e, r, s = {}) {
|
|
56
|
+
if (e === 0)
|
|
57
|
+
return new Uint8Array(0);
|
|
58
|
+
const { headers: n = {}, signal: a, overrides: c = {} } = s;
|
|
59
|
+
e < 1 / 0 ? n.range = `bytes=${r}-${r + e - 1}` : e === 1 / 0 && r !== 0 && (n.range = `bytes=${r}-`);
|
|
60
|
+
const t = await this.fetch(this.url, {
|
|
61
|
+
...this.baseOverrides,
|
|
62
|
+
...c,
|
|
63
|
+
headers: {
|
|
64
|
+
...this.baseOverrides.headers,
|
|
65
|
+
...c.headers,
|
|
66
|
+
...n
|
|
67
|
+
},
|
|
68
|
+
method: "GET",
|
|
69
|
+
redirect: "follow",
|
|
70
|
+
mode: "cors",
|
|
71
|
+
signal: a
|
|
72
|
+
});
|
|
73
|
+
if (!t.ok)
|
|
74
|
+
throw new Error(`HTTP ${t.status} fetching ${this.url}`);
|
|
75
|
+
if (t.status === 200 && r === 0 || t.status === 206) {
|
|
76
|
+
const l = t.headers.get("content-range"), o = /\/(\d+)$/.exec(l || "");
|
|
77
|
+
o != null && o[1] && (this._stat = {
|
|
78
|
+
size: parseInt(o[1], 10)
|
|
79
|
+
});
|
|
80
|
+
const h = t.bytes ? await t.bytes() : new Uint8Array(await t.arrayBuffer());
|
|
81
|
+
return h.byteLength <= e ? h : h.subarray(0, e);
|
|
82
|
+
}
|
|
83
|
+
throw new Error(t.status === 200 ? `${this.url} fetch returned status 200, expected 206` : `HTTP ${t.status} fetching ${this.url}`);
|
|
84
|
+
}
|
|
85
|
+
async readFile(e = {}) {
|
|
86
|
+
let r, s;
|
|
87
|
+
if (typeof e == "string")
|
|
88
|
+
r = e, s = {};
|
|
89
|
+
else {
|
|
90
|
+
r = e.encoding;
|
|
91
|
+
const { encoding: l, ...o } = e;
|
|
92
|
+
s = o;
|
|
93
|
+
}
|
|
94
|
+
const { headers: n = {}, signal: a, overrides: c = {} } = s, t = await this.fetch(this.url, {
|
|
95
|
+
...this.baseOverrides,
|
|
96
|
+
...c,
|
|
97
|
+
headers: {
|
|
98
|
+
...this.baseOverrides.headers,
|
|
99
|
+
...c.headers,
|
|
100
|
+
...n
|
|
101
|
+
},
|
|
102
|
+
method: "GET",
|
|
103
|
+
redirect: "follow",
|
|
104
|
+
mode: "cors",
|
|
105
|
+
signal: a
|
|
106
|
+
});
|
|
107
|
+
if (!t.ok)
|
|
108
|
+
throw new Error(`HTTP ${t.status} fetching ${this.url}`);
|
|
109
|
+
if (r === "utf8")
|
|
110
|
+
return t.text();
|
|
111
|
+
if (r)
|
|
112
|
+
throw new Error(`unsupported encoding: ${r}`);
|
|
113
|
+
return t.bytes ? t.bytes() : new Uint8Array(await t.arrayBuffer());
|
|
114
|
+
}
|
|
115
|
+
async stat() {
|
|
116
|
+
if (!this._stat && (await this.read(10, 0), !this._stat))
|
|
117
|
+
throw new Error(`unable to determine size of file at ${this.url}`);
|
|
118
|
+
return this._stat;
|
|
119
|
+
}
|
|
120
|
+
async close() {
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
class w {
|
|
124
|
+
readFile() {
|
|
125
|
+
throw new Error("unimplemented");
|
|
126
|
+
}
|
|
127
|
+
read() {
|
|
128
|
+
throw new Error("unimplemented");
|
|
129
|
+
}
|
|
130
|
+
close() {
|
|
131
|
+
throw new Error("unimplemented");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export {
|
|
135
|
+
f as BlobFile,
|
|
136
|
+
w as LocalFile,
|
|
137
|
+
u as RemoteFile
|
|
138
|
+
};
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
var _ = Object.defineProperty;
|
|
2
|
+
var I = (r, e, t) => e in r ? _(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var h = (r, e, t) => I(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { LocalFile as d } from "./browser-BRemItdO.js";
|
|
5
|
+
import { I as b, Z as F } from "./inflate-GtwLkvSP.js";
|
|
6
|
+
const w = 65536, S = w * w;
|
|
7
|
+
function g(r, e = 0) {
|
|
8
|
+
const t = r[e] | r[e + 1] << 8 | r[e + 2] << 16 | r[e + 3] << 24;
|
|
9
|
+
return ((r[e + 4] | r[e + 5] << 8 | r[e + 6] << 16 | r[e + 7] << 24) >>> 0) * S + (t >>> 0);
|
|
10
|
+
}
|
|
11
|
+
const u = 1;
|
|
12
|
+
function m(r, e, t) {
|
|
13
|
+
const n = e[u], s = t ? t[u] : 1 / 0;
|
|
14
|
+
return n <= r && s > r ? 0 : n < r ? -1 : 1;
|
|
15
|
+
}
|
|
16
|
+
class B {
|
|
17
|
+
constructor({ filehandle: e }) {
|
|
18
|
+
h(this, "filehandle");
|
|
19
|
+
h(this, "index");
|
|
20
|
+
this.filehandle = e;
|
|
21
|
+
}
|
|
22
|
+
_getIndex() {
|
|
23
|
+
return this.index || (this.index = this._readIndex().catch((e) => {
|
|
24
|
+
throw this.index = void 0, e;
|
|
25
|
+
})), this.index;
|
|
26
|
+
}
|
|
27
|
+
async _readIndex() {
|
|
28
|
+
const e = await this.filehandle.read(8, 0), t = g(e);
|
|
29
|
+
if (!t)
|
|
30
|
+
return [[0, 0]];
|
|
31
|
+
const n = new Array(t + 1);
|
|
32
|
+
n[0] = [0, 0];
|
|
33
|
+
const s = 16 * t;
|
|
34
|
+
if (s > Number.MAX_SAFE_INTEGER)
|
|
35
|
+
throw new TypeError("integer overflow");
|
|
36
|
+
const i = await this.filehandle.read(s, 8);
|
|
37
|
+
for (let a = 0; a < t; a += 1) {
|
|
38
|
+
const o = g(i, a * 16), c = g(i, a * 16 + 8);
|
|
39
|
+
n[a + 1] = [o, c];
|
|
40
|
+
}
|
|
41
|
+
return n;
|
|
42
|
+
}
|
|
43
|
+
async getLastBlock() {
|
|
44
|
+
return (await this._getIndex()).at(-1);
|
|
45
|
+
}
|
|
46
|
+
async getRelevantBlocksForRead(e, t) {
|
|
47
|
+
const n = t + e;
|
|
48
|
+
if (e === 0)
|
|
49
|
+
return [];
|
|
50
|
+
const s = await this._getIndex(), i = [];
|
|
51
|
+
let a = 0, o = s.length - 1, c = Math.floor(s.length / 2), l = m(t, s[c], s[c + 1]);
|
|
52
|
+
for (; l !== 0; )
|
|
53
|
+
l > 0 ? o = c - 1 : l < 0 && (a = c + 1), c = Math.ceil((o - a) / 2) + a, l = m(t, s[c], s[c + 1]);
|
|
54
|
+
i.push(s[c]);
|
|
55
|
+
let f = c + 1;
|
|
56
|
+
for (; f < s.length && (i.push(s[f]), !(s[f][u] >= n)); f += 1)
|
|
57
|
+
;
|
|
58
|
+
return i[i.length - 1][u] < n && i.push([]), i;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function E(r) {
|
|
62
|
+
let e = 0;
|
|
63
|
+
for (const t of r)
|
|
64
|
+
e += t.length;
|
|
65
|
+
return e;
|
|
66
|
+
}
|
|
67
|
+
function y(r, e) {
|
|
68
|
+
const t = new Uint8Array(e ?? E(r));
|
|
69
|
+
let n = 0;
|
|
70
|
+
for (const s of r)
|
|
71
|
+
t.set(s, n), n += s.length;
|
|
72
|
+
return t;
|
|
73
|
+
}
|
|
74
|
+
async function k(r) {
|
|
75
|
+
try {
|
|
76
|
+
let e, t = 0, n;
|
|
77
|
+
const s = [];
|
|
78
|
+
let i = 0;
|
|
79
|
+
do {
|
|
80
|
+
const a = r.subarray(t);
|
|
81
|
+
if (n = new b(void 0), { strm: e } = n, n.push(a, F), n.err)
|
|
82
|
+
throw new Error(n.msg);
|
|
83
|
+
t += e.next_in;
|
|
84
|
+
const o = n.result;
|
|
85
|
+
s.push(o), i += o.length;
|
|
86
|
+
} while (e.avail_in);
|
|
87
|
+
return y(s, i);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
throw /incorrect header check/.exec(`${e}`) ? new Error("problem decompressing block: incorrect gzip header check") : e;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
class p {
|
|
93
|
+
constructor({ filehandle: e, gziFilehandle: t }) {
|
|
94
|
+
h(this, "filehandle");
|
|
95
|
+
h(this, "gzi");
|
|
96
|
+
this.filehandle = e, this.gzi = new B({
|
|
97
|
+
filehandle: t
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
async _readAndUncompressBlock(e, t) {
|
|
101
|
+
let n = t;
|
|
102
|
+
n || (n = (await this.filehandle.stat()).size);
|
|
103
|
+
const s = n - e, i = await this.filehandle.read(s, e);
|
|
104
|
+
return k(i);
|
|
105
|
+
}
|
|
106
|
+
async read(e, t) {
|
|
107
|
+
const n = await this.gzi.getRelevantBlocksForRead(e, t), s = [];
|
|
108
|
+
for (let i = 0; i < n.length - 1; i += 1) {
|
|
109
|
+
const a = await this._readAndUncompressBlock(n[i][0], n[i + 1][0]), [, o] = n[i], c = o >= t ? 0 : t - o, l = Math.min(t + e, o + a.length) - o;
|
|
110
|
+
c >= 0 && c < a.length && s.push(a.subarray(c, l));
|
|
111
|
+
}
|
|
112
|
+
return y(s);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function x(r, e) {
|
|
116
|
+
return r.offset + r.lineBytes * Math.floor(e / r.lineLength) + e % r.lineLength;
|
|
117
|
+
}
|
|
118
|
+
async function z(r, e = {}) {
|
|
119
|
+
const t = new TextDecoder("utf8");
|
|
120
|
+
return Object.fromEntries(t.decode(await r.readFile(e)).split(/\r?\n/).map((n) => n.trim()).filter((n) => !!n).map((n) => n.split(" ")).map((n) => {
|
|
121
|
+
var s;
|
|
122
|
+
if ((s = n[0]) != null && s.startsWith(">"))
|
|
123
|
+
throw new Error("found > in sequence name, might have supplied FASTA file for the FASTA index");
|
|
124
|
+
return [
|
|
125
|
+
n[0],
|
|
126
|
+
{
|
|
127
|
+
name: n[0],
|
|
128
|
+
length: +n[1],
|
|
129
|
+
start: 0,
|
|
130
|
+
end: +n[1],
|
|
131
|
+
offset: +n[2],
|
|
132
|
+
lineLength: +n[3],
|
|
133
|
+
lineBytes: +n[4]
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
class N {
|
|
139
|
+
constructor({ fasta: e, fai: t, path: n, faiPath: s }) {
|
|
140
|
+
if (e)
|
|
141
|
+
this.fasta = e;
|
|
142
|
+
else if (n)
|
|
143
|
+
this.fasta = new d(n);
|
|
144
|
+
else
|
|
145
|
+
throw new Error("Need to pass filehandle for fasta or path to localfile");
|
|
146
|
+
if (t)
|
|
147
|
+
this.fai = t;
|
|
148
|
+
else if (s)
|
|
149
|
+
this.fai = new d(s);
|
|
150
|
+
else if (n)
|
|
151
|
+
this.fai = new d(`${n}.fai`);
|
|
152
|
+
else
|
|
153
|
+
throw new Error("Need to pass filehandle for or path to localfile");
|
|
154
|
+
}
|
|
155
|
+
async _getIndexes(e) {
|
|
156
|
+
return this.indexes || (this.indexes = z(this.fai, e).catch((t) => {
|
|
157
|
+
throw this.indexes = void 0, t;
|
|
158
|
+
})), this.indexes;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* @returns array of string sequence names that are present in the index, in
|
|
162
|
+
* which the array index indicates the sequence ID, and the value is the
|
|
163
|
+
* sequence name
|
|
164
|
+
*/
|
|
165
|
+
async getSequenceNames(e) {
|
|
166
|
+
return Object.keys(await this._getIndexes(e));
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* @returns array of string sequence names that are present in the index, in
|
|
170
|
+
* which the array index indicates the sequence ID, and the value is the
|
|
171
|
+
* sequence name
|
|
172
|
+
*/
|
|
173
|
+
async getSequenceSizes(e) {
|
|
174
|
+
const t = {}, n = await this._getIndexes(e);
|
|
175
|
+
for (const s of Object.values(n))
|
|
176
|
+
t[s.name] = s.length;
|
|
177
|
+
return t;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* @returns array of string sequence names that are present in the index, in
|
|
181
|
+
* which the array index indicates the sequence ID, and the value is the
|
|
182
|
+
* sequence name
|
|
183
|
+
*/
|
|
184
|
+
async getSequenceSize(e, t) {
|
|
185
|
+
var s;
|
|
186
|
+
return (s = (await this._getIndexes(t))[e]) == null ? void 0 : s.length;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* @param name
|
|
190
|
+
*
|
|
191
|
+
* @returns true if the file contains the given reference sequence name
|
|
192
|
+
*/
|
|
193
|
+
async hasReferenceSequence(e, t) {
|
|
194
|
+
return !!(await this._getIndexes(t))[e];
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* @param seqName
|
|
198
|
+
* @param min
|
|
199
|
+
* @param max
|
|
200
|
+
*/
|
|
201
|
+
async getResiduesByName(e, t, n, s) {
|
|
202
|
+
const i = (await this._getIndexes(s))[e];
|
|
203
|
+
return i ? this._fetchFromIndexEntry(i, t, n, s) : void 0;
|
|
204
|
+
}
|
|
205
|
+
//alias for getResiduesByName
|
|
206
|
+
async getSequence(e, t, n, s) {
|
|
207
|
+
return this.getResiduesByName(e, t, n, s);
|
|
208
|
+
}
|
|
209
|
+
async _fetchFromIndexEntry(e, t = 0, n, s) {
|
|
210
|
+
let i = n;
|
|
211
|
+
if (t < 0)
|
|
212
|
+
throw new TypeError("regionStart cannot be less than 0");
|
|
213
|
+
if ((i === void 0 || i > e.length) && (i = e.length), t >= i)
|
|
214
|
+
return "";
|
|
215
|
+
const a = x(e, t), o = x(e, i) - a, l = new TextDecoder("utf8").decode(await this.fasta.read(o, a, s)).replace(/\s+/g, "");
|
|
216
|
+
if (/[^\x20-\x7e]/.test(l.slice(0, 1e3)))
|
|
217
|
+
throw new Error("Non-ASCII characters detected in sequence. The file may be gzip compressed. Use BgzipIndexedFasta for bgzip files, or decompress the file.");
|
|
218
|
+
return l;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
class O extends N {
|
|
222
|
+
constructor({ fasta: e, path: t, fai: n, faiPath: s, gzi: i, gziPath: a }) {
|
|
223
|
+
super({ fasta: e, path: t, fai: n, faiPath: s }), e && i ? this.fasta = new p({
|
|
224
|
+
filehandle: e,
|
|
225
|
+
gziFilehandle: i
|
|
226
|
+
}) : t && a && (this.fasta = new p({
|
|
227
|
+
filehandle: new d(t),
|
|
228
|
+
gziFilehandle: new d(a)
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function A(r) {
|
|
233
|
+
return r.split(">").filter((e) => /\S/.test(e)).map((e) => {
|
|
234
|
+
const [t, ...n] = e.split(`
|
|
235
|
+
`), [s, ...i] = t.split(" "), a = n.join("").replace(/\s/g, "");
|
|
236
|
+
return {
|
|
237
|
+
id: s,
|
|
238
|
+
description: i.join(" "),
|
|
239
|
+
sequence: a
|
|
240
|
+
};
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
class R {
|
|
244
|
+
constructor({ fasta: e, path: t }) {
|
|
245
|
+
if (e)
|
|
246
|
+
this.fasta = e;
|
|
247
|
+
else if (t)
|
|
248
|
+
this.fasta = new d(t);
|
|
249
|
+
else
|
|
250
|
+
throw new Error("Need to pass fasta or path");
|
|
251
|
+
this.data = this.fasta.readFile().then((n) => {
|
|
252
|
+
const i = new TextDecoder("utf8").decode(n);
|
|
253
|
+
return A(i);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
async fetch(e, t, n) {
|
|
257
|
+
const i = (await this.data).find((o) => o.id === e), a = n - t;
|
|
258
|
+
if (!i)
|
|
259
|
+
throw new Error(`no sequence with id ${e} exists`);
|
|
260
|
+
return i.sequence.slice(t, a);
|
|
261
|
+
}
|
|
262
|
+
async getSequenceNames() {
|
|
263
|
+
return (await this.data).map((t) => t.id);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
export {
|
|
267
|
+
O as BgzipIndexedFasta,
|
|
268
|
+
R as FetchableSmallFasta,
|
|
269
|
+
N as IndexedFasta,
|
|
270
|
+
A as parseSmallFasta
|
|
271
|
+
};
|