@genome-spy/core 0.69.1 → 0.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/{AbortablePromiseCache-CcuMrnn7.js → AbortablePromiseCache-Dj0vzLnp.js} +4 -4
- package/dist/bundle/{browser-BRemItdO.js → browser-0iNU5Wit.js} +33 -33
- package/dist/bundle/index-BYsZN7b0.js +1597 -0
- package/dist/bundle/{index-Cq3QFUxX.js → index-C3kClAEN.js} +583 -593
- package/dist/bundle/{index-D-w7Mmt9.js → index-C7wOh6y1.js} +138 -140
- package/dist/bundle/index-CRaQAuki.js +326 -0
- package/dist/bundle/{index-D74H8TTz.js → index-D9v1PCj9.js} +1 -2
- package/dist/bundle/{index-BatuyGAI.js → index-GDOuv_D5.js} +75 -80
- package/dist/bundle/{index-DbJ0oeYM.js → index-Gt44EOIH.js} +160 -163
- package/dist/bundle/index.es.js +9095 -9129
- package/dist/bundle/index.js +121 -163
- package/dist/bundle/{unzip-NywezaRR.js → unzip-Bac01w6X.js} +1 -1
- package/dist/schema.json +0 -48
- package/dist/src/genomeSpy/containerUi.d.ts.map +1 -1
- package/dist/src/genomeSpy/containerUi.js +0 -1
- package/dist/src/genomeSpy/viewHighlight.js +2 -2
- package/dist/src/genomeSpy.d.ts +3 -3
- package/dist/src/genomeSpy.d.ts.map +1 -1
- package/dist/src/genomeSpy.js +27 -3
- package/dist/src/gl/colorUtils.d.ts +2 -1
- package/dist/src/gl/colorUtils.d.ts.map +1 -1
- package/dist/src/gl/colorUtils.js +15 -3
- package/dist/src/gl/webGLHelper.d.ts.map +1 -1
- package/dist/src/gl/webGLHelper.js +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -5
- package/dist/src/marks/mark.d.ts +1 -3
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +0 -8
- package/dist/src/marks/rect.d.ts.map +1 -1
- package/dist/src/marks/rect.js +0 -8
- package/dist/src/spec/view.d.ts +0 -10
- package/dist/src/utils/deepEqual.d.ts +14 -0
- package/dist/src/utils/deepEqual.d.ts.map +1 -0
- package/dist/src/utils/deepEqual.js +63 -0
- package/dist/src/utils/fetchUtils.d.ts +27 -0
- package/dist/src/utils/fetchUtils.d.ts.map +1 -0
- package/dist/src/utils/fetchUtils.js +47 -0
- package/dist/src/utils/keyboardZoomMotion.d.ts +93 -0
- package/dist/src/utils/keyboardZoomMotion.d.ts.map +1 -0
- package/dist/src/utils/keyboardZoomMotion.js +285 -0
- package/dist/src/utils/url.d.ts +12 -0
- package/dist/src/utils/url.d.ts.map +1 -1
- package/dist/src/utils/url.js +45 -0
- package/dist/src/view/axisGridView.d.ts +1 -1
- package/dist/src/view/axisGridView.js +0 -1
- package/dist/src/view/axisView.d.ts +1 -1
- package/dist/src/view/concatView.d.ts +6 -3
- package/dist/src/view/concatView.d.ts.map +1 -1
- package/dist/src/view/concatView.js +9 -2
- package/dist/src/view/containerMutationHelper.d.ts +6 -6
- package/dist/src/view/containerMutationHelper.d.ts.map +1 -1
- package/dist/src/view/containerView.d.ts +7 -5
- package/dist/src/view/containerView.d.ts.map +1 -1
- package/dist/src/view/containerView.js +4 -1
- package/dist/src/view/facetView.d.ts +1 -1
- package/dist/src/view/flowBuilder.d.ts +1 -1
- package/dist/src/view/flowBuilder.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.d.ts +3 -3
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.js +0 -2
- package/dist/src/view/gridView/gridView.d.ts +13 -11
- package/dist/src/view/gridView/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView/gridView.js +17 -26
- package/dist/src/view/gridView/keyboardZoomController.d.ts +21 -0
- package/dist/src/view/gridView/keyboardZoomController.d.ts.map +1 -0
- package/dist/src/view/gridView/keyboardZoomController.js +202 -0
- package/dist/src/view/gridView/scrollbar.d.ts +1 -1
- package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
- package/dist/src/view/gridView/scrollbar.js +0 -1
- package/dist/src/view/gridView/selectionRect.d.ts +1 -1
- package/dist/src/view/gridView/selectionRect.d.ts.map +1 -1
- package/dist/src/view/gridView/selectionRect.js +0 -1
- package/dist/src/view/gridView/separatorView.js +0 -1
- package/dist/src/view/gridView/zoomNavigationUtils.d.ts +19 -0
- package/dist/src/view/gridView/zoomNavigationUtils.d.ts.map +1 -0
- package/dist/src/view/gridView/zoomNavigationUtils.js +51 -0
- package/dist/src/view/layerView.d.ts +8 -5
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layerView.js +6 -2
- package/dist/src/view/title.d.ts.map +1 -1
- package/dist/src/view/title.js +0 -1
- package/dist/src/view/unitView.d.ts +7 -4
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +5 -1
- package/dist/src/view/view.d.ts +13 -9
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +7 -1
- package/dist/src/view/viewError.d.ts +1 -1
- package/dist/src/view/viewError.d.ts.map +1 -1
- package/dist/src/view/viewFactory.d.ts +3 -44
- package/dist/src/view/viewFactory.d.ts.map +1 -1
- package/dist/src/view/viewFactory.js +28 -69
- package/dist/src/view/viewSelectors.d.ts.map +1 -1
- package/dist/src/view/viewSelectors.js +123 -160
- package/dist/src/view/viewSpecGuards.d.ts +43 -0
- package/dist/src/view/viewSpecGuards.d.ts.map +1 -0
- package/dist/src/view/viewSpecGuards.js +69 -0
- package/dist/src/view/viewUtils.d.ts +1 -1
- package/dist/src/view/viewUtils.d.ts.map +1 -1
- package/dist/src/view/viewUtils.js +4 -5
- package/dist/src/view/zoom.d.ts +1 -0
- package/dist/src/view/zoom.d.ts.map +1 -1
- package/dist/src/view/zoom.js +5 -1
- package/package.json +3 -3
- package/dist/bundle/index-ByuE8dvu.js +0 -332
- package/dist/bundle/index-D28m8tSW.js +0 -1607
- package/dist/src/data/collector.test.d.ts +0 -2
- package/dist/src/data/collector.test.d.ts.map +0 -1
- package/dist/src/data/dataFlow.test.d.ts +0 -2
- package/dist/src/data/dataFlow.test.d.ts.map +0 -1
- package/dist/src/data/flow.test.d.ts +0 -2
- package/dist/src/data/flow.test.d.ts.map +0 -1
- package/dist/src/data/flowInit.test.d.ts +0 -2
- package/dist/src/data/flowInit.test.d.ts.map +0 -1
- package/dist/src/data/flowNode.test.d.ts +0 -2
- package/dist/src/data/flowNode.test.d.ts.map +0 -1
- package/dist/src/data/flowOptimizer.test.d.ts +0 -2
- package/dist/src/data/flowOptimizer.test.d.ts.map +0 -1
- package/dist/src/data/formats/fasta.test.d.ts +0 -2
- package/dist/src/data/formats/fasta.test.d.ts.map +0 -1
- package/dist/src/data/keyIndex.test.d.ts +0 -2
- package/dist/src/data/keyIndex.test.d.ts.map +0 -1
- package/dist/src/data/sources/inlineSource.test.d.ts +0 -2
- package/dist/src/data/sources/inlineSource.test.d.ts.map +0 -1
- package/dist/src/data/sources/sequenceSource.test.d.ts +0 -2
- package/dist/src/data/sources/sequenceSource.test.d.ts.map +0 -1
- package/dist/src/data/transforms/aggregate.test.d.ts +0 -2
- package/dist/src/data/transforms/aggregate.test.d.ts.map +0 -1
- package/dist/src/data/transforms/clone.test.d.ts +0 -2
- package/dist/src/data/transforms/clone.test.d.ts.map +0 -1
- package/dist/src/data/transforms/coverage.test.d.ts +0 -2
- package/dist/src/data/transforms/coverage.test.d.ts.map +0 -1
- package/dist/src/data/transforms/filter.test.d.ts +0 -2
- package/dist/src/data/transforms/filter.test.d.ts.map +0 -1
- package/dist/src/data/transforms/filterScoredLabels.test.d.ts +0 -2
- package/dist/src/data/transforms/filterScoredLabels.test.d.ts.map +0 -1
- package/dist/src/data/transforms/flatten.test.d.ts +0 -2
- package/dist/src/data/transforms/flatten.test.d.ts.map +0 -1
- package/dist/src/data/transforms/flattenDelimited.test.d.ts +0 -2
- package/dist/src/data/transforms/flattenDelimited.test.d.ts.map +0 -1
- package/dist/src/data/transforms/flattenSequence.test.d.ts +0 -2
- package/dist/src/data/transforms/flattenSequence.test.d.ts.map +0 -1
- package/dist/src/data/transforms/formula.test.d.ts +0 -2
- package/dist/src/data/transforms/formula.test.d.ts.map +0 -1
- package/dist/src/data/transforms/identifier.test.d.ts +0 -2
- package/dist/src/data/transforms/identifier.test.d.ts.map +0 -1
- package/dist/src/data/transforms/pileup.test.d.ts +0 -2
- package/dist/src/data/transforms/pileup.test.d.ts.map +0 -1
- package/dist/src/data/transforms/project.test.d.ts +0 -2
- package/dist/src/data/transforms/project.test.d.ts.map +0 -1
- package/dist/src/data/transforms/regexExtract.test.d.ts +0 -2
- package/dist/src/data/transforms/regexExtract.test.d.ts.map +0 -1
- package/dist/src/data/transforms/regexFold.test.d.ts +0 -2
- package/dist/src/data/transforms/regexFold.test.d.ts.map +0 -1
- package/dist/src/data/transforms/sample.test.d.ts +0 -2
- package/dist/src/data/transforms/sample.test.d.ts.map +0 -1
- package/dist/src/data/transforms/stack.test.d.ts +0 -2
- package/dist/src/data/transforms/stack.test.d.ts.map +0 -1
- package/dist/src/encoder/accessor.test.d.ts +0 -2
- package/dist/src/encoder/accessor.test.d.ts.map +0 -1
- package/dist/src/encoder/encoder.test.d.ts +0 -2
- package/dist/src/encoder/encoder.test.d.ts.map +0 -1
- package/dist/src/encoder/metadataChannels.test.d.ts +0 -2
- package/dist/src/encoder/metadataChannels.test.d.ts.map +0 -1
- package/dist/src/genome/genome.test.d.ts +0 -2
- package/dist/src/genome/genome.test.d.ts.map +0 -1
- package/dist/src/genome/genomes.test.d.ts +0 -2
- package/dist/src/genome/genomes.test.d.ts.map +0 -1
- package/dist/src/genome/scaleIndex.test.d.ts +0 -2
- package/dist/src/genome/scaleIndex.test.d.ts.map +0 -1
- package/dist/src/genome/scaleLocus.test.d.ts +0 -2
- package/dist/src/genome/scaleLocus.test.d.ts.map +0 -1
- package/dist/src/genomeSpy/viewDataInit.test.d.ts +0 -2
- package/dist/src/genomeSpy/viewDataInit.test.d.ts.map +0 -1
- package/dist/src/paramRuntime/expressionRef.test.d.ts +0 -2
- package/dist/src/paramRuntime/expressionRef.test.d.ts.map +0 -1
- package/dist/src/paramRuntime/graphRuntime.test.d.ts +0 -2
- package/dist/src/paramRuntime/graphRuntime.test.d.ts.map +0 -1
- package/dist/src/paramRuntime/paramRuntime.test.d.ts +0 -2
- package/dist/src/paramRuntime/paramRuntime.test.d.ts.map +0 -1
- package/dist/src/paramRuntime/paramStore.test.d.ts +0 -2
- package/dist/src/paramRuntime/paramStore.test.d.ts.map +0 -1
- package/dist/src/scale/scale.test.d.ts +0 -2
- package/dist/src/scale/scale.test.d.ts.map +0 -1
- package/dist/src/scale/ticks.test.d.ts +0 -2
- package/dist/src/scale/ticks.test.d.ts.map +0 -1
- package/dist/src/scales/axisResolution.test.d.ts +0 -2
- package/dist/src/scales/axisResolution.test.d.ts.map +0 -1
- package/dist/src/scales/domainPlanner.test.d.ts +0 -2
- package/dist/src/scales/domainPlanner.test.d.ts.map +0 -1
- package/dist/src/scales/scaleInstanceManager.test.d.ts +0 -2
- package/dist/src/scales/scaleInstanceManager.test.d.ts.map +0 -1
- package/dist/src/scales/scaleInteractionController.test.d.ts +0 -2
- package/dist/src/scales/scaleInteractionController.test.d.ts.map +0 -1
- package/dist/src/scales/scaleResolution.test.d.ts +0 -2
- package/dist/src/scales/scaleResolution.test.d.ts.map +0 -1
- package/dist/src/scales/scaleRules.test.d.ts +0 -2
- package/dist/src/scales/scaleRules.test.d.ts.map +0 -1
- package/dist/src/selection/selection.test.d.ts +0 -2
- package/dist/src/selection/selection.test.d.ts.map +0 -1
- package/dist/src/tooltip/dataTooltipHandler.test.d.ts +0 -2
- package/dist/src/tooltip/dataTooltipHandler.test.d.ts.map +0 -1
- package/dist/src/tooltip/flattenDatumRows.test.d.ts +0 -2
- package/dist/src/tooltip/flattenDatumRows.test.d.ts.map +0 -1
- package/dist/src/tooltip/tooltipContext.test.d.ts +0 -2
- package/dist/src/tooltip/tooltipContext.test.d.ts.map +0 -1
- package/dist/src/utils/addBaseUrl.test.d.ts +0 -2
- package/dist/src/utils/addBaseUrl.test.d.ts.map +0 -1
- package/dist/src/utils/binnedIndex.test.d.ts +0 -2
- package/dist/src/utils/binnedIndex.test.d.ts.map +0 -1
- package/dist/src/utils/cloner.test.d.ts +0 -2
- package/dist/src/utils/cloner.test.d.ts.map +0 -1
- package/dist/src/utils/coalesce.test.d.ts +0 -2
- package/dist/src/utils/coalesce.test.d.ts.map +0 -1
- package/dist/src/utils/concatIterables.test.d.ts +0 -2
- package/dist/src/utils/concatIterables.test.d.ts.map +0 -1
- package/dist/src/utils/domainArray.test.d.ts +0 -2
- package/dist/src/utils/domainArray.test.d.ts.map +0 -1
- package/dist/src/utils/indexer.test.d.ts +0 -2
- package/dist/src/utils/indexer.test.d.ts.map +0 -1
- package/dist/src/utils/interactionEvent.test.d.ts +0 -2
- package/dist/src/utils/interactionEvent.test.d.ts.map +0 -1
- package/dist/src/utils/iterateNestedMaps.test.d.ts +0 -2
- package/dist/src/utils/iterateNestedMaps.test.d.ts.map +0 -1
- package/dist/src/utils/kWayMerge.test.d.ts +0 -2
- package/dist/src/utils/kWayMerge.test.d.ts.map +0 -1
- package/dist/src/utils/mergeObjects.test.d.ts +0 -2
- package/dist/src/utils/mergeObjects.test.d.ts.map +0 -1
- package/dist/src/utils/numberExtractor.test.d.ts +0 -2
- package/dist/src/utils/numberExtractor.test.d.ts.map +0 -1
- package/dist/src/utils/propertyCacher.test.d.ts +0 -2
- package/dist/src/utils/propertyCacher.test.d.ts.map +0 -1
- package/dist/src/utils/propertyCoalescer.test.d.ts +0 -2
- package/dist/src/utils/propertyCoalescer.test.d.ts.map +0 -1
- package/dist/src/utils/radixSort.test.d.ts +0 -2
- package/dist/src/utils/radixSort.test.d.ts.map +0 -1
- package/dist/src/utils/reservationMap.test.d.ts +0 -2
- package/dist/src/utils/reservationMap.test.d.ts.map +0 -1
- package/dist/src/utils/ringBuffer.test.d.ts +0 -2
- package/dist/src/utils/ringBuffer.test.d.ts.map +0 -1
- package/dist/src/utils/throttle.test.d.ts +0 -2
- package/dist/src/utils/throttle.test.d.ts.map +0 -1
- package/dist/src/utils/topK.test.d.ts +0 -2
- package/dist/src/utils/topK.test.d.ts.map +0 -1
- package/dist/src/utils/trees.test.d.ts +0 -2
- package/dist/src/utils/trees.test.d.ts.map +0 -1
- package/dist/src/utils/ui/tooltip.test.d.ts +0 -2
- package/dist/src/utils/ui/tooltip.test.d.ts.map +0 -1
- package/dist/src/utils/url.test.d.ts +0 -2
- package/dist/src/utils/url.test.d.ts.map +0 -1
- package/dist/src/utils/variableTools.test.d.ts +0 -2
- package/dist/src/utils/variableTools.test.d.ts.map +0 -1
- package/dist/src/view/concatView.test.d.ts +0 -2
- package/dist/src/view/concatView.test.d.ts.map +0 -1
- package/dist/src/view/dataReadiness.test.d.ts +0 -2
- package/dist/src/view/dataReadiness.test.d.ts.map +0 -1
- package/dist/src/view/flowBuilder.test.d.ts +0 -2
- package/dist/src/view/flowBuilder.test.d.ts.map +0 -1
- package/dist/src/view/gridView/gridView.test.d.ts +0 -2
- package/dist/src/view/gridView/gridView.test.d.ts.map +0 -1
- package/dist/src/view/gridView/selectionRect.test.d.ts +0 -2
- package/dist/src/view/gridView/selectionRect.test.d.ts.map +0 -1
- package/dist/src/view/layerView.test.d.ts +0 -2
- package/dist/src/view/layerView.test.d.ts.map +0 -1
- package/dist/src/view/layout/flexLayout.test.d.ts +0 -2
- package/dist/src/view/layout/flexLayout.test.d.ts.map +0 -1
- package/dist/src/view/layout/grid.test.d.ts +0 -2
- package/dist/src/view/layout/grid.test.d.ts.map +0 -1
- package/dist/src/view/layout/rectangle.test.d.ts +0 -2
- package/dist/src/view/layout/rectangle.test.d.ts.map +0 -1
- package/dist/src/view/multiscale.test.d.ts +0 -2
- package/dist/src/view/multiscale.test.d.ts.map +0 -1
- package/dist/src/view/view.test.d.ts +0 -2
- package/dist/src/view/view.test.d.ts.map +0 -1
- package/dist/src/view/viewDispose.test.d.ts +0 -2
- package/dist/src/view/viewDispose.test.d.ts.map +0 -1
- package/dist/src/view/viewFactory.test.d.ts +0 -2
- package/dist/src/view/viewFactory.test.d.ts.map +0 -1
- package/dist/src/view/viewParamRuntime.test.d.ts +0 -2
- package/dist/src/view/viewParamRuntime.test.d.ts.map +0 -1
- package/dist/src/view/viewSelectors.test.d.ts +0 -2
- package/dist/src/view/viewSelectors.test.d.ts.map +0 -1
- package/dist/src/view/viewUtils.test.d.ts +0 -2
- package/dist/src/view/viewUtils.test.d.ts.map +0 -1
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
const _ = /%([0-9A-Fa-f]{2})/g, b = /^\s*##\s*(\S+)\s*(.*)/, C = /\r?\n$/, p = /\s+/, m = /\D/g;
|
|
2
|
+
function f(n) {
|
|
3
|
+
return n.includes("%") ? n.replaceAll(_, (e, r) => String.fromCharCode(parseInt(r, 16))) : n;
|
|
4
|
+
}
|
|
5
|
+
function v(n) {
|
|
6
|
+
if (!n.length || n === ".")
|
|
7
|
+
return {};
|
|
8
|
+
const e = {};
|
|
9
|
+
let r = n;
|
|
10
|
+
r.endsWith(`
|
|
11
|
+
`) && (r = r.slice(0, r.endsWith(`\r
|
|
12
|
+
`) ? -2 : -1));
|
|
13
|
+
for (const t of r.split(";")) {
|
|
14
|
+
const i = t.indexOf("=");
|
|
15
|
+
if (i === -1)
|
|
16
|
+
continue;
|
|
17
|
+
const s = t.slice(i + 1);
|
|
18
|
+
if (!s.length)
|
|
19
|
+
continue;
|
|
20
|
+
const o = t.slice(0, i).trim();
|
|
21
|
+
let c = e[o];
|
|
22
|
+
c || (c = [], e[o] = c);
|
|
23
|
+
for (const l of s.split(","))
|
|
24
|
+
c.push(f(l.trim()));
|
|
25
|
+
}
|
|
26
|
+
return e;
|
|
27
|
+
}
|
|
28
|
+
function F(n) {
|
|
29
|
+
if (!n.length || n === ".")
|
|
30
|
+
return {};
|
|
31
|
+
const e = {};
|
|
32
|
+
let r = n;
|
|
33
|
+
r.endsWith(`
|
|
34
|
+
`) && (r = r.slice(0, r.endsWith(`\r
|
|
35
|
+
`) ? -2 : -1));
|
|
36
|
+
for (const t of r.split(";")) {
|
|
37
|
+
const i = t.indexOf("=");
|
|
38
|
+
if (i === -1)
|
|
39
|
+
continue;
|
|
40
|
+
const s = t.slice(i + 1);
|
|
41
|
+
if (!s.length)
|
|
42
|
+
continue;
|
|
43
|
+
const o = t.slice(0, i).trim();
|
|
44
|
+
let c = e[o];
|
|
45
|
+
c || (c = [], e[o] = c);
|
|
46
|
+
for (const l of s.split(","))
|
|
47
|
+
c.push(l.trim());
|
|
48
|
+
}
|
|
49
|
+
return e;
|
|
50
|
+
}
|
|
51
|
+
function y(n) {
|
|
52
|
+
return d(n.split(" "));
|
|
53
|
+
}
|
|
54
|
+
function a(n) {
|
|
55
|
+
return n === "." || n === "" || n === void 0 ? null : n;
|
|
56
|
+
}
|
|
57
|
+
function d(n) {
|
|
58
|
+
const e = a(n[0]), r = a(n[1]), t = a(n[2]), i = a(n[3]), s = a(n[4]), o = a(n[5]), c = a(n[6]), l = a(n[7]), u = a(n[8]);
|
|
59
|
+
return {
|
|
60
|
+
seq_id: e ? f(e) : null,
|
|
61
|
+
source: r ? f(r) : null,
|
|
62
|
+
type: t ? f(t) : null,
|
|
63
|
+
start: i === null ? null : parseInt(i, 10),
|
|
64
|
+
end: s === null ? null : parseInt(s, 10),
|
|
65
|
+
score: o === null ? null : parseFloat(o),
|
|
66
|
+
strand: c,
|
|
67
|
+
phase: l,
|
|
68
|
+
attributes: u === null ? null : v(u)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function R(n) {
|
|
72
|
+
const e = a(n[0]), r = a(n[1]), t = a(n[2]), i = a(n[3]), s = a(n[4]), o = a(n[5]), c = a(n[6]), l = a(n[7]), u = a(n[8]);
|
|
73
|
+
return {
|
|
74
|
+
seq_id: e,
|
|
75
|
+
source: r,
|
|
76
|
+
type: t,
|
|
77
|
+
start: i === null ? null : parseInt(i, 10),
|
|
78
|
+
end: s === null ? null : parseInt(s, 10),
|
|
79
|
+
score: o === null ? null : parseFloat(o),
|
|
80
|
+
strand: c,
|
|
81
|
+
phase: l,
|
|
82
|
+
attributes: u === null ? null : F(u)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function g(n) {
|
|
86
|
+
const e = b.exec(n);
|
|
87
|
+
if (!e)
|
|
88
|
+
return null;
|
|
89
|
+
const [, r] = e;
|
|
90
|
+
let [, , t] = e;
|
|
91
|
+
const i = { directive: r };
|
|
92
|
+
if (t.length && (t = t.replace(C, ""), i.value = t), r === "sequence-region") {
|
|
93
|
+
const s = t.split(p, 3);
|
|
94
|
+
return {
|
|
95
|
+
...i,
|
|
96
|
+
seq_id: s[0],
|
|
97
|
+
start: s[1]?.replaceAll(m, ""),
|
|
98
|
+
end: s[2]?.replaceAll(m, "")
|
|
99
|
+
};
|
|
100
|
+
} else if (r === "genome-build") {
|
|
101
|
+
const [s, o] = t.split(p, 2);
|
|
102
|
+
return {
|
|
103
|
+
...i,
|
|
104
|
+
source: s,
|
|
105
|
+
buildName: o
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return i;
|
|
109
|
+
}
|
|
110
|
+
const k = /^\s*[^#\s>]/, I = /^\s*(#+)(.*)/, L = /^\s*$/, D = /^\s*>/, A = /\r?\n?$/g;
|
|
111
|
+
class h {
|
|
112
|
+
featureCallback;
|
|
113
|
+
endCallback;
|
|
114
|
+
commentCallback;
|
|
115
|
+
errorCallback;
|
|
116
|
+
disableDerivesFromReferences;
|
|
117
|
+
directiveCallback;
|
|
118
|
+
bufferSize;
|
|
119
|
+
eof = !1;
|
|
120
|
+
lineNumber = 0;
|
|
121
|
+
// features that we have to keep on hand for now because they
|
|
122
|
+
// might be referenced by something else
|
|
123
|
+
_underConstructionTopLevel = [];
|
|
124
|
+
// index of the above by ID
|
|
125
|
+
_underConstructionById = {};
|
|
126
|
+
_completedReferences = {};
|
|
127
|
+
// features that reference something we have not seen yet
|
|
128
|
+
// structured as:
|
|
129
|
+
// { 'some_id' : {
|
|
130
|
+
// 'Parent' : [ orphans that have a Parent attr referencing it ],
|
|
131
|
+
// 'Derives_from' : [ orphans that have a Derives_from attr referencing it ],
|
|
132
|
+
// }
|
|
133
|
+
// }
|
|
134
|
+
_underConstructionOrphans = {};
|
|
135
|
+
constructor(e) {
|
|
136
|
+
const r = () => {
|
|
137
|
+
};
|
|
138
|
+
this.featureCallback = e.featureCallback || r, this.endCallback = e.endCallback || r, this.commentCallback = e.commentCallback || r, this.errorCallback = e.errorCallback || r, this.directiveCallback = e.directiveCallback || r, this.disableDerivesFromReferences = e.disableDerivesFromReferences || !1, this.bufferSize = e.bufferSize === void 0 ? 1 / 0 : e.bufferSize;
|
|
139
|
+
}
|
|
140
|
+
addLine(e) {
|
|
141
|
+
if (this.eof)
|
|
142
|
+
return;
|
|
143
|
+
if (this.lineNumber += 1, k.test(e)) {
|
|
144
|
+
this._bufferLine(e);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const r = I.exec(e);
|
|
148
|
+
if (r) {
|
|
149
|
+
const [, t] = r;
|
|
150
|
+
let [, , i] = r;
|
|
151
|
+
if (t.length === 3)
|
|
152
|
+
this._emitAllUnderConstructionFeatures();
|
|
153
|
+
else if (t.length === 2) {
|
|
154
|
+
const s = g(e);
|
|
155
|
+
s && (s.directive === "FASTA" ? (this._emitAllUnderConstructionFeatures(), this.eof = !0) : this._emitItem(s));
|
|
156
|
+
} else
|
|
157
|
+
this._emitItem({ comment: i.trimStart() });
|
|
158
|
+
} else if (!L.test(e)) if (D.test(e))
|
|
159
|
+
this._emitAllUnderConstructionFeatures(), this.eof = !0;
|
|
160
|
+
else {
|
|
161
|
+
const t = e.replaceAll(A, "");
|
|
162
|
+
throw new Error(`GFF3 parse error. Cannot parse '${t}'.`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
addParsedFeatureLine(e) {
|
|
166
|
+
this.eof || (this.lineNumber += 1, this._bufferParsedLine(e));
|
|
167
|
+
}
|
|
168
|
+
finish() {
|
|
169
|
+
this._emitAllUnderConstructionFeatures(), this.endCallback();
|
|
170
|
+
}
|
|
171
|
+
_emitItem(e) {
|
|
172
|
+
Array.isArray(e) ? this.featureCallback(e) : "directive" in e ? this.directiveCallback(e) : "comment" in e && this.commentCallback(e);
|
|
173
|
+
}
|
|
174
|
+
_enforceBufferSizeLimit(e = 0) {
|
|
175
|
+
const r = (t) => {
|
|
176
|
+
t && Array.isArray(t) && t[0].attributes?.ID?.[0] && (t[0].attributes.ID.forEach((s) => {
|
|
177
|
+
delete this._underConstructionById[s], delete this._completedReferences[s];
|
|
178
|
+
}), t.forEach((s) => {
|
|
179
|
+
s.child_features && s.child_features.forEach((o) => {
|
|
180
|
+
r(o);
|
|
181
|
+
}), s.derived_features && s.derived_features.forEach((o) => {
|
|
182
|
+
r(o);
|
|
183
|
+
});
|
|
184
|
+
}));
|
|
185
|
+
};
|
|
186
|
+
for (; this._underConstructionTopLevel.length + e > this.bufferSize; ) {
|
|
187
|
+
const t = this._underConstructionTopLevel.shift();
|
|
188
|
+
t && (this._emitItem(t), r(t));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* return all under-construction features, called when we know
|
|
193
|
+
* there will be no additional data to attach to them
|
|
194
|
+
*/
|
|
195
|
+
_emitAllUnderConstructionFeatures() {
|
|
196
|
+
this._underConstructionTopLevel.forEach(this._emitItem.bind(this)), this._underConstructionTopLevel = [], this._underConstructionById = {}, this._completedReferences = {};
|
|
197
|
+
const e = Object.keys(this._underConstructionOrphans);
|
|
198
|
+
if (e.length)
|
|
199
|
+
throw new Error(`some features reference other features that do not exist in the file (or in the same '###' scope). ${e.join(",")}`);
|
|
200
|
+
}
|
|
201
|
+
_bufferLine(e) {
|
|
202
|
+
this._bufferParsedLine(y(e));
|
|
203
|
+
}
|
|
204
|
+
_bufferParsedLine(e) {
|
|
205
|
+
const r = e;
|
|
206
|
+
r.child_features = [], r.derived_features = [];
|
|
207
|
+
const t = r.attributes?.ID || [], i = r.attributes?.Parent || [], s = this.disableDerivesFromReferences ? [] : r.attributes?.Derives_from || [];
|
|
208
|
+
if (!t.length && !i.length && !s.length) {
|
|
209
|
+
this._emitItem([r]);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
let o;
|
|
213
|
+
t.forEach((c) => {
|
|
214
|
+
const l = this._underConstructionById[c];
|
|
215
|
+
l ? (l[l.length - 1].type !== r.type && this._parseError(`multi-line feature "${c}" has inconsistent types: "${r.type}", "${l[l.length - 1].type}"`), l.push(r), o = l) : (o = [r], this._enforceBufferSizeLimit(1), !i.length && !s.length && this._underConstructionTopLevel.push(o), this._underConstructionById[c] = o, this._resolveReferencesTo(o, c));
|
|
216
|
+
}), this._resolveReferencesFrom(
|
|
217
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
218
|
+
o || [r],
|
|
219
|
+
{ Parent: i, Derives_from: s },
|
|
220
|
+
t
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
_resolveReferencesTo(e, r) {
|
|
224
|
+
const t = this._underConstructionOrphans[r];
|
|
225
|
+
if (t) {
|
|
226
|
+
for (const i of e)
|
|
227
|
+
i.child_features.push(...t.Parent), i.derived_features.push(...t.Derives_from);
|
|
228
|
+
delete this._underConstructionOrphans[r];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
_parseError(e) {
|
|
232
|
+
this.eof = !0, this.errorCallback(`${this.lineNumber}: ${e}`);
|
|
233
|
+
}
|
|
234
|
+
_resolveReferencesFrom(e, r, t) {
|
|
235
|
+
for (const i of r.Parent) {
|
|
236
|
+
const s = this._underConstructionById[i];
|
|
237
|
+
if (s) {
|
|
238
|
+
let o = !1;
|
|
239
|
+
for (const c of t) {
|
|
240
|
+
const l = `Parent,${i}`, u = this._completedReferences[c] || (this._completedReferences[c] = {});
|
|
241
|
+
u[l] && (o = !0), u[l] = !0;
|
|
242
|
+
}
|
|
243
|
+
if (!o)
|
|
244
|
+
for (const c of s)
|
|
245
|
+
c.child_features.push(e);
|
|
246
|
+
} else {
|
|
247
|
+
let o = this._underConstructionOrphans[i];
|
|
248
|
+
o || (o = { Parent: [], Derives_from: [] }, this._underConstructionOrphans[i] = o), o.Parent.push(e);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
for (const i of r.Derives_from) {
|
|
252
|
+
const s = this._underConstructionById[i];
|
|
253
|
+
if (s) {
|
|
254
|
+
let o = !1;
|
|
255
|
+
for (const c of t) {
|
|
256
|
+
const l = `Derives_from,${i}`, u = this._completedReferences[c] || (this._completedReferences[c] = {});
|
|
257
|
+
u[l] && (o = !0), u[l] = !0;
|
|
258
|
+
}
|
|
259
|
+
if (!o)
|
|
260
|
+
for (const c of s)
|
|
261
|
+
c.derived_features.push(e);
|
|
262
|
+
} else {
|
|
263
|
+
let o = this._underConstructionOrphans[i];
|
|
264
|
+
o || (o = { Parent: [], Derives_from: [] }, this._underConstructionOrphans[i] = o), o.Derives_from.push(e);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function x(n) {
|
|
270
|
+
const e = [], r = new h({
|
|
271
|
+
featureCallback: (t) => e.push(t),
|
|
272
|
+
disableDerivesFromReferences: !0,
|
|
273
|
+
errorCallback: (t) => {
|
|
274
|
+
throw new Error(t);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
for (const t of n.split(/\r?\n/))
|
|
278
|
+
r.addLine(t);
|
|
279
|
+
return r.finish(), e;
|
|
280
|
+
}
|
|
281
|
+
function w(n) {
|
|
282
|
+
const e = [], r = new h({
|
|
283
|
+
featureCallback: (t) => e.push(t),
|
|
284
|
+
disableDerivesFromReferences: !0,
|
|
285
|
+
errorCallback: (t) => {
|
|
286
|
+
throw new Error(t);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
for (const t of n)
|
|
290
|
+
r.addLine(t);
|
|
291
|
+
return r.finish(), e;
|
|
292
|
+
}
|
|
293
|
+
function S(n) {
|
|
294
|
+
const e = [], r = new h({
|
|
295
|
+
featureCallback: (t) => e.push(t),
|
|
296
|
+
disableDerivesFromReferences: !0,
|
|
297
|
+
errorCallback: (t) => {
|
|
298
|
+
throw new Error(t);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
for (const t of n) {
|
|
302
|
+
const i = d(t.fields);
|
|
303
|
+
t.lineHash !== void 0 && (i.attributes || (i.attributes = {}), i.attributes._lineHash = [String(t.lineHash)]), r.addParsedFeatureLine(i);
|
|
304
|
+
}
|
|
305
|
+
return r.finish(), e;
|
|
306
|
+
}
|
|
307
|
+
function E(n, e) {
|
|
308
|
+
const r = [], t = new h({
|
|
309
|
+
featureCallback: (s) => r.push(s),
|
|
310
|
+
disableDerivesFromReferences: !0,
|
|
311
|
+
errorCallback: (s) => {
|
|
312
|
+
throw new Error(s);
|
|
313
|
+
}
|
|
314
|
+
}), i = e ? d : R;
|
|
315
|
+
for (const s of n) {
|
|
316
|
+
const o = i(s.fields);
|
|
317
|
+
s.lineHash !== void 0 && (o.attributes || (o.attributes = {}), o.attributes._lineHash = [String(s.lineHash)]), t.addParsedFeatureLine(o);
|
|
318
|
+
}
|
|
319
|
+
return t.finish(), r;
|
|
320
|
+
}
|
|
321
|
+
export {
|
|
322
|
+
w as parseArraySync,
|
|
323
|
+
S as parseRecordsSync,
|
|
324
|
+
E as parseRecordsSyncFast,
|
|
325
|
+
x as parseStringSync
|
|
326
|
+
};
|
|
@@ -453,8 +453,7 @@ function Y(s) {
|
|
|
453
453
|
}
|
|
454
454
|
const Mt = { ".": 0, "-": -1, "+": 1 };
|
|
455
455
|
function jt(s) {
|
|
456
|
-
|
|
457
|
-
return s.length >= 12 && !Number.isNaN(Number.parseInt(s[9], 10)) && ((m = s[10]) == null ? void 0 : m.split(",").filter((t) => !!t).length) === Number.parseInt(s[9], 10);
|
|
456
|
+
return s.length >= 12 && !Number.isNaN(Number.parseInt(s[9], 10)) && s[10]?.split(",").filter((m) => !!m).length === Number.parseInt(s[9], 10);
|
|
458
457
|
}
|
|
459
458
|
class _t {
|
|
460
459
|
constructor(m = {}) {
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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);
|
|
1
|
+
import { LocalFile as d } from "./browser-0iNU5Wit.js";
|
|
2
|
+
import { I as y, Z as _ } from "./inflate-GtwLkvSP.js";
|
|
3
|
+
const g = 65536, I = g * g;
|
|
4
|
+
function u(i, e = 0) {
|
|
5
|
+
const t = i[e] | i[e + 1] << 8 | i[e + 2] << 16 | i[e + 3] << 24;
|
|
6
|
+
return ((i[e + 4] | i[e + 5] << 8 | i[e + 6] << 16 | i[e + 7] << 24) >>> 0) * I + (t >>> 0);
|
|
10
7
|
}
|
|
11
|
-
const
|
|
12
|
-
function
|
|
13
|
-
const n = e[
|
|
14
|
-
return n <=
|
|
8
|
+
const f = 1;
|
|
9
|
+
function w(i, e, t) {
|
|
10
|
+
const n = e[f], s = t ? t[f] : 1 / 0;
|
|
11
|
+
return n <= i && s > i ? 0 : n < i ? -1 : 1;
|
|
15
12
|
}
|
|
16
|
-
class
|
|
13
|
+
class b {
|
|
14
|
+
filehandle;
|
|
15
|
+
index;
|
|
17
16
|
constructor({ filehandle: e }) {
|
|
18
|
-
h(this, "filehandle");
|
|
19
|
-
h(this, "index");
|
|
20
17
|
this.filehandle = e;
|
|
21
18
|
}
|
|
22
19
|
_getIndex() {
|
|
@@ -25,7 +22,7 @@ class B {
|
|
|
25
22
|
})), this.index;
|
|
26
23
|
}
|
|
27
24
|
async _readIndex() {
|
|
28
|
-
const e = await this.filehandle.read(8, 0), t =
|
|
25
|
+
const e = await this.filehandle.read(8, 0), t = u(e);
|
|
29
26
|
if (!t)
|
|
30
27
|
return [[0, 0]];
|
|
31
28
|
const n = new Array(t + 1);
|
|
@@ -33,9 +30,9 @@ class B {
|
|
|
33
30
|
const s = 16 * t;
|
|
34
31
|
if (s > Number.MAX_SAFE_INTEGER)
|
|
35
32
|
throw new TypeError("integer overflow");
|
|
36
|
-
const
|
|
33
|
+
const r = await this.filehandle.read(s, 8);
|
|
37
34
|
for (let a = 0; a < t; a += 1) {
|
|
38
|
-
const o =
|
|
35
|
+
const o = u(r, a * 16), c = u(r, a * 16 + 8);
|
|
39
36
|
n[a + 1] = [o, c];
|
|
40
37
|
}
|
|
41
38
|
return n;
|
|
@@ -47,79 +44,78 @@ class B {
|
|
|
47
44
|
const n = t + e;
|
|
48
45
|
if (e === 0)
|
|
49
46
|
return [];
|
|
50
|
-
const s = await this._getIndex(),
|
|
51
|
-
let a = 0, o = s.length - 1, c = Math.floor(s.length / 2), l =
|
|
47
|
+
const s = await this._getIndex(), r = [];
|
|
48
|
+
let a = 0, o = s.length - 1, c = Math.floor(s.length / 2), l = w(t, s[c], s[c + 1]);
|
|
52
49
|
for (; l !== 0; )
|
|
53
|
-
l > 0 ? o = c - 1 : l < 0 && (a = c + 1), c = Math.ceil((o - a) / 2) + a, l =
|
|
54
|
-
|
|
55
|
-
let
|
|
56
|
-
for (;
|
|
50
|
+
l > 0 ? o = c - 1 : l < 0 && (a = c + 1), c = Math.ceil((o - a) / 2) + a, l = w(t, s[c], s[c + 1]);
|
|
51
|
+
r.push(s[c]);
|
|
52
|
+
let h = c + 1;
|
|
53
|
+
for (; h < s.length && (r.push(s[h]), !(s[h][f] >= n)); h += 1)
|
|
57
54
|
;
|
|
58
|
-
return
|
|
55
|
+
return r[r.length - 1][f] < n && r.push([]), r;
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
|
-
function
|
|
58
|
+
function F(i) {
|
|
62
59
|
let e = 0;
|
|
63
|
-
for (const t of
|
|
60
|
+
for (const t of i)
|
|
64
61
|
e += t.length;
|
|
65
62
|
return e;
|
|
66
63
|
}
|
|
67
|
-
function
|
|
68
|
-
const t = new Uint8Array(e ??
|
|
64
|
+
function x(i, e) {
|
|
65
|
+
const t = new Uint8Array(e ?? F(i));
|
|
69
66
|
let n = 0;
|
|
70
|
-
for (const s of
|
|
67
|
+
for (const s of i)
|
|
71
68
|
t.set(s, n), n += s.length;
|
|
72
69
|
return t;
|
|
73
70
|
}
|
|
74
|
-
async function
|
|
71
|
+
async function S(i) {
|
|
75
72
|
try {
|
|
76
73
|
let e, t = 0, n;
|
|
77
74
|
const s = [];
|
|
78
|
-
let
|
|
75
|
+
let r = 0;
|
|
79
76
|
do {
|
|
80
|
-
const a =
|
|
81
|
-
if (n = new
|
|
77
|
+
const a = i.subarray(t);
|
|
78
|
+
if (n = new y(void 0), { strm: e } = n, n.push(a, _), n.err)
|
|
82
79
|
throw new Error(n.msg);
|
|
83
80
|
t += e.next_in;
|
|
84
81
|
const o = n.result;
|
|
85
|
-
s.push(o),
|
|
82
|
+
s.push(o), r += o.length;
|
|
86
83
|
} while (e.avail_in);
|
|
87
|
-
return
|
|
84
|
+
return x(s, r);
|
|
88
85
|
} catch (e) {
|
|
89
86
|
throw /incorrect header check/.exec(`${e}`) ? new Error("problem decompressing block: incorrect gzip header check") : e;
|
|
90
87
|
}
|
|
91
88
|
}
|
|
92
|
-
class
|
|
89
|
+
class m {
|
|
90
|
+
filehandle;
|
|
91
|
+
gzi;
|
|
93
92
|
constructor({ filehandle: e, gziFilehandle: t }) {
|
|
94
|
-
|
|
95
|
-
h(this, "gzi");
|
|
96
|
-
this.filehandle = e, this.gzi = new B({
|
|
93
|
+
this.filehandle = e, this.gzi = new b({
|
|
97
94
|
filehandle: t
|
|
98
95
|
});
|
|
99
96
|
}
|
|
100
97
|
async _readAndUncompressBlock(e, t) {
|
|
101
98
|
let n = t;
|
|
102
99
|
n || (n = (await this.filehandle.stat()).size);
|
|
103
|
-
const s = n - e,
|
|
104
|
-
return
|
|
100
|
+
const s = n - e, r = await this.filehandle.read(s, e);
|
|
101
|
+
return S(r);
|
|
105
102
|
}
|
|
106
103
|
async read(e, t) {
|
|
107
104
|
const n = await this.gzi.getRelevantBlocksForRead(e, t), s = [];
|
|
108
|
-
for (let
|
|
109
|
-
const a = await this._readAndUncompressBlock(n[
|
|
105
|
+
for (let r = 0; r < n.length - 1; r += 1) {
|
|
106
|
+
const a = await this._readAndUncompressBlock(n[r][0], n[r + 1][0]), [, o] = n[r], c = o >= t ? 0 : t - o, l = Math.min(t + e, o + a.length) - o;
|
|
110
107
|
c >= 0 && c < a.length && s.push(a.subarray(c, l));
|
|
111
108
|
}
|
|
112
|
-
return
|
|
109
|
+
return x(s);
|
|
113
110
|
}
|
|
114
111
|
}
|
|
115
|
-
function
|
|
116
|
-
return
|
|
112
|
+
function p(i, e) {
|
|
113
|
+
return i.offset + i.lineBytes * Math.floor(e / i.lineLength) + e % i.lineLength;
|
|
117
114
|
}
|
|
118
|
-
async function
|
|
115
|
+
async function B(i, e = {}) {
|
|
119
116
|
const t = new TextDecoder("utf8");
|
|
120
|
-
return Object.fromEntries(t.decode(await
|
|
121
|
-
|
|
122
|
-
if ((s = n[0]) != null && s.startsWith(">"))
|
|
117
|
+
return Object.fromEntries(t.decode(await i.readFile(e)).split(/\r?\n/).map((n) => n.trim()).filter((n) => !!n).map((n) => n.split(" ")).map((n) => {
|
|
118
|
+
if (n[0]?.startsWith(">"))
|
|
123
119
|
throw new Error("found > in sequence name, might have supplied FASTA file for the FASTA index");
|
|
124
120
|
return [
|
|
125
121
|
n[0],
|
|
@@ -135,7 +131,7 @@ async function z(r, e = {}) {
|
|
|
135
131
|
];
|
|
136
132
|
}));
|
|
137
133
|
}
|
|
138
|
-
class
|
|
134
|
+
class E {
|
|
139
135
|
constructor({ fasta: e, fai: t, path: n, faiPath: s }) {
|
|
140
136
|
if (e)
|
|
141
137
|
this.fasta = e;
|
|
@@ -153,7 +149,7 @@ class N {
|
|
|
153
149
|
throw new Error("Need to pass filehandle for or path to localfile");
|
|
154
150
|
}
|
|
155
151
|
async _getIndexes(e) {
|
|
156
|
-
return this.indexes || (this.indexes =
|
|
152
|
+
return this.indexes || (this.indexes = B(this.fai, e).catch((t) => {
|
|
157
153
|
throw this.indexes = void 0, t;
|
|
158
154
|
})), this.indexes;
|
|
159
155
|
}
|
|
@@ -182,8 +178,7 @@ class N {
|
|
|
182
178
|
* sequence name
|
|
183
179
|
*/
|
|
184
180
|
async getSequenceSize(e, t) {
|
|
185
|
-
|
|
186
|
-
return (s = (await this._getIndexes(t))[e]) == null ? void 0 : s.length;
|
|
181
|
+
return (await this._getIndexes(t))[e]?.length;
|
|
187
182
|
}
|
|
188
183
|
/**
|
|
189
184
|
* @param name
|
|
@@ -199,48 +194,48 @@ class N {
|
|
|
199
194
|
* @param max
|
|
200
195
|
*/
|
|
201
196
|
async getResiduesByName(e, t, n, s) {
|
|
202
|
-
const
|
|
203
|
-
return
|
|
197
|
+
const r = (await this._getIndexes(s))[e];
|
|
198
|
+
return r ? this._fetchFromIndexEntry(r, t, n, s) : void 0;
|
|
204
199
|
}
|
|
205
200
|
//alias for getResiduesByName
|
|
206
201
|
async getSequence(e, t, n, s) {
|
|
207
202
|
return this.getResiduesByName(e, t, n, s);
|
|
208
203
|
}
|
|
209
204
|
async _fetchFromIndexEntry(e, t = 0, n, s) {
|
|
210
|
-
let
|
|
205
|
+
let r = n;
|
|
211
206
|
if (t < 0)
|
|
212
207
|
throw new TypeError("regionStart cannot be less than 0");
|
|
213
|
-
if ((
|
|
208
|
+
if ((r === void 0 || r > e.length) && (r = e.length), t >= r)
|
|
214
209
|
return "";
|
|
215
|
-
const a =
|
|
210
|
+
const a = p(e, t), o = p(e, r) - a, l = new TextDecoder("utf8").decode(await this.fasta.read(o, a, s)).replace(/\s+/g, "");
|
|
216
211
|
if (/[^\x20-\x7e]/.test(l.slice(0, 1e3)))
|
|
217
212
|
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
213
|
return l;
|
|
219
214
|
}
|
|
220
215
|
}
|
|
221
|
-
class
|
|
222
|
-
constructor({ fasta: e, path: t, fai: n, faiPath: s, gzi:
|
|
223
|
-
super({ fasta: e, path: t, fai: n, faiPath: s }), e &&
|
|
216
|
+
class A extends E {
|
|
217
|
+
constructor({ fasta: e, path: t, fai: n, faiPath: s, gzi: r, gziPath: a }) {
|
|
218
|
+
super({ fasta: e, path: t, fai: n, faiPath: s }), e && r ? this.fasta = new m({
|
|
224
219
|
filehandle: e,
|
|
225
|
-
gziFilehandle:
|
|
226
|
-
}) : t && a && (this.fasta = new
|
|
220
|
+
gziFilehandle: r
|
|
221
|
+
}) : t && a && (this.fasta = new m({
|
|
227
222
|
filehandle: new d(t),
|
|
228
223
|
gziFilehandle: new d(a)
|
|
229
224
|
}));
|
|
230
225
|
}
|
|
231
226
|
}
|
|
232
|
-
function
|
|
233
|
-
return
|
|
227
|
+
function k(i) {
|
|
228
|
+
return i.split(">").filter((e) => /\S/.test(e)).map((e) => {
|
|
234
229
|
const [t, ...n] = e.split(`
|
|
235
|
-
`), [s, ...
|
|
230
|
+
`), [s, ...r] = t.split(" "), a = n.join("").replace(/\s/g, "");
|
|
236
231
|
return {
|
|
237
232
|
id: s,
|
|
238
|
-
description:
|
|
233
|
+
description: r.join(" "),
|
|
239
234
|
sequence: a
|
|
240
235
|
};
|
|
241
236
|
});
|
|
242
237
|
}
|
|
243
|
-
class
|
|
238
|
+
class q {
|
|
244
239
|
constructor({ fasta: e, path: t }) {
|
|
245
240
|
if (e)
|
|
246
241
|
this.fasta = e;
|
|
@@ -249,23 +244,23 @@ class R {
|
|
|
249
244
|
else
|
|
250
245
|
throw new Error("Need to pass fasta or path");
|
|
251
246
|
this.data = this.fasta.readFile().then((n) => {
|
|
252
|
-
const
|
|
253
|
-
return
|
|
247
|
+
const r = new TextDecoder("utf8").decode(n);
|
|
248
|
+
return k(r);
|
|
254
249
|
});
|
|
255
250
|
}
|
|
256
251
|
async fetch(e, t, n) {
|
|
257
|
-
const
|
|
258
|
-
if (!
|
|
252
|
+
const r = (await this.data).find((o) => o.id === e), a = n - t;
|
|
253
|
+
if (!r)
|
|
259
254
|
throw new Error(`no sequence with id ${e} exists`);
|
|
260
|
-
return
|
|
255
|
+
return r.sequence.slice(t, a);
|
|
261
256
|
}
|
|
262
257
|
async getSequenceNames() {
|
|
263
258
|
return (await this.data).map((t) => t.id);
|
|
264
259
|
}
|
|
265
260
|
}
|
|
266
261
|
export {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
262
|
+
A as BgzipIndexedFasta,
|
|
263
|
+
q as FetchableSmallFasta,
|
|
264
|
+
E as IndexedFasta,
|
|
265
|
+
k as parseSmallFasta
|
|
271
266
|
};
|