@genome-spy/core 0.37.4 → 0.39.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/__vite-browser-external-ENoMJThg.js +8 -0
- package/dist/bundle/_commonjsHelpers-QtkX90xp.js +30 -0
- package/dist/bundle/index-1QVesMzU.js +1074 -0
- package/dist/bundle/index-Cbz74kpR.js +638 -0
- package/dist/bundle/index-LD6yPc3X.js +515 -0
- package/dist/bundle/index-Pv3tKJ1W.js +2190 -0
- package/dist/bundle/index-UyrC0vvF.js +72 -0
- package/dist/bundle/index-Y-LdHNIz.js +501 -0
- package/dist/bundle/index-gn8bhQ8w.js +4050 -0
- package/dist/bundle/index-lmJu1tfP.js +1372 -0
- package/dist/bundle/index-z4Cs62EO.js +279 -0
- package/dist/bundle/index.es.js +6467 -20590
- package/dist/bundle/index.js +92 -123
- package/dist/bundle/long-Veu0zKh9.js +2382 -0
- package/dist/bundle/remoteFile-Ur-gRKsH.js +96 -0
- package/dist/schema.json +524 -122
- package/dist/src/data/collector.d.ts +11 -11
- package/dist/src/data/collector.d.ts.map +1 -1
- package/dist/src/data/collector.js +8 -8
- package/dist/src/data/dataFlow.d.ts +18 -18
- package/dist/src/data/dataFlow.d.ts.map +1 -1
- package/dist/src/data/dataFlow.js +7 -7
- package/dist/src/data/flowNode.d.ts +9 -9
- package/dist/src/data/flowNode.d.ts.map +1 -1
- package/dist/src/data/flowNode.js +5 -5
- package/dist/src/data/flowOptimizer.d.ts +11 -11
- package/dist/src/data/flowOptimizer.d.ts.map +1 -1
- package/dist/src/data/flowOptimizer.js +7 -7
- package/dist/src/data/flowTestUtils.d.ts +2 -2
- package/dist/src/data/flowTestUtils.d.ts.map +1 -1
- package/dist/src/data/flowTestUtils.js +1 -1
- package/dist/src/data/sources/dataSource.js +1 -1
- package/dist/src/data/sources/dataSourceFactory.d.ts +3 -3
- package/dist/src/data/sources/dataSourceFactory.d.ts.map +1 -1
- package/dist/src/data/sources/dataSourceFactory.js +20 -20
- package/dist/src/data/sources/dataUtils.d.ts +20 -20
- package/dist/src/data/sources/dataUtils.d.ts.map +1 -1
- package/dist/src/data/sources/dataUtils.js +11 -11
- package/dist/src/data/sources/dynamic/axisGenomeSource.d.ts +3 -3
- package/dist/src/data/sources/dynamic/axisGenomeSource.d.ts.map +1 -1
- package/dist/src/data/sources/dynamic/axisGenomeSource.js +2 -2
- package/dist/src/data/sources/dynamic/axisTickSource.d.ts +6 -6
- package/dist/src/data/sources/dynamic/axisTickSource.d.ts.map +1 -1
- package/dist/src/data/sources/dynamic/axisTickSource.js +4 -4
- package/dist/src/data/sources/dynamic/bamSource.d.ts +7 -13
- package/dist/src/data/sources/dynamic/bamSource.d.ts.map +1 -1
- package/dist/src/data/sources/dynamic/bamSource.js +35 -27
- package/dist/src/data/sources/dynamic/bigBedSource.d.ts +9 -9
- package/dist/src/data/sources/dynamic/bigBedSource.d.ts.map +1 -1
- package/dist/src/data/sources/dynamic/bigBedSource.js +31 -18
- package/dist/src/data/sources/dynamic/bigWigSource.d.ts +7 -7
- package/dist/src/data/sources/dynamic/bigWigSource.d.ts.map +1 -1
- package/dist/src/data/sources/dynamic/bigWigSource.js +33 -26
- package/dist/src/data/sources/dynamic/gff3Source.d.ts +9 -0
- package/dist/src/data/sources/dynamic/gff3Source.d.ts.map +1 -1
- package/dist/src/data/sources/dynamic/gff3Source.js +17 -2
- package/dist/src/data/sources/dynamic/indexedFastaSource.d.ts +6 -9
- package/dist/src/data/sources/dynamic/indexedFastaSource.d.ts.map +1 -1
- package/dist/src/data/sources/dynamic/indexedFastaSource.js +28 -18
- package/dist/src/data/sources/dynamic/singleAxisLazySource.d.ts +10 -10
- package/dist/src/data/sources/dynamic/singleAxisLazySource.d.ts.map +1 -1
- package/dist/src/data/sources/dynamic/singleAxisLazySource.js +6 -6
- package/dist/src/data/sources/dynamic/tabixSource.d.ts +11 -8
- package/dist/src/data/sources/dynamic/tabixSource.d.ts.map +1 -1
- package/dist/src/data/sources/dynamic/tabixSource.js +31 -17
- package/dist/src/data/sources/inlineSource.d.ts +7 -7
- package/dist/src/data/sources/inlineSource.d.ts.map +1 -1
- package/dist/src/data/sources/inlineSource.js +5 -5
- package/dist/src/data/sources/namedSource.d.ts +9 -9
- package/dist/src/data/sources/namedSource.d.ts.map +1 -1
- package/dist/src/data/sources/namedSource.js +6 -6
- package/dist/src/data/sources/sequenceSource.d.ts +7 -7
- package/dist/src/data/sources/sequenceSource.d.ts.map +1 -1
- package/dist/src/data/sources/sequenceSource.js +4 -4
- package/dist/src/data/sources/urlSource.d.ts +7 -7
- package/dist/src/data/sources/urlSource.d.ts.map +1 -1
- package/dist/src/data/sources/urlSource.js +4 -4
- package/dist/src/data/transforms/aggregate.d.ts +3 -3
- package/dist/src/data/transforms/aggregate.d.ts.map +1 -1
- package/dist/src/data/transforms/aggregate.js +2 -2
- package/dist/src/data/transforms/clone.d.ts +2 -2
- package/dist/src/data/transforms/clone.d.ts.map +1 -1
- package/dist/src/data/transforms/clone.js +1 -1
- package/dist/src/data/transforms/coverage.d.ts +3 -3
- package/dist/src/data/transforms/coverage.d.ts.map +1 -1
- package/dist/src/data/transforms/coverage.js +1 -1
- package/dist/src/data/transforms/coverage.test.js +1 -1
- package/dist/src/data/transforms/filter.d.ts +3 -3
- package/dist/src/data/transforms/filter.d.ts.map +1 -1
- package/dist/src/data/transforms/filter.js +2 -2
- package/dist/src/data/transforms/filter.test.js +1 -1
- package/dist/src/data/transforms/filterScoredLabels.d.ts +4 -4
- package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
- package/dist/src/data/transforms/filterScoredLabels.js +3 -3
- package/dist/src/data/transforms/flatten.d.ts +2 -2
- package/dist/src/data/transforms/flatten.d.ts.map +1 -1
- package/dist/src/data/transforms/flatten.js +3 -3
- package/dist/src/data/transforms/flatten.test.js +6 -6
- package/dist/src/data/transforms/flattenCompressedExons.d.ts +2 -2
- package/dist/src/data/transforms/flattenCompressedExons.d.ts.map +1 -1
- package/dist/src/data/transforms/flattenCompressedExons.js +1 -1
- package/dist/src/data/transforms/flattenDelimited.d.ts +2 -2
- package/dist/src/data/transforms/flattenDelimited.d.ts.map +1 -1
- package/dist/src/data/transforms/flattenDelimited.js +2 -2
- package/dist/src/data/transforms/flattenDelimited.test.js +5 -5
- package/dist/src/data/transforms/flattenSequence.d.ts +2 -2
- package/dist/src/data/transforms/flattenSequence.d.ts.map +1 -1
- package/dist/src/data/transforms/flattenSequence.js +1 -1
- package/dist/src/data/transforms/flattenSequence.test.js +1 -1
- package/dist/src/data/transforms/formula.d.ts +3 -3
- package/dist/src/data/transforms/formula.d.ts.map +1 -1
- package/dist/src/data/transforms/formula.js +2 -2
- package/dist/src/data/transforms/identifier.d.ts +3 -3
- package/dist/src/data/transforms/identifier.d.ts.map +1 -1
- package/dist/src/data/transforms/identifier.js +2 -2
- package/dist/src/data/transforms/linearizeGenomicCoordinate.d.ts +3 -3
- package/dist/src/data/transforms/linearizeGenomicCoordinate.d.ts.map +1 -1
- package/dist/src/data/transforms/linearizeGenomicCoordinate.js +2 -2
- package/dist/src/data/transforms/measureText.d.ts +2 -2
- package/dist/src/data/transforms/measureText.d.ts.map +1 -1
- package/dist/src/data/transforms/measureText.js +1 -1
- package/dist/src/data/transforms/pileup.d.ts +3 -3
- package/dist/src/data/transforms/pileup.d.ts.map +1 -1
- package/dist/src/data/transforms/pileup.js +1 -1
- package/dist/src/data/transforms/pileup.test.js +1 -1
- package/dist/src/data/transforms/project.d.ts +2 -2
- package/dist/src/data/transforms/project.d.ts.map +1 -1
- package/dist/src/data/transforms/project.js +1 -1
- package/dist/src/data/transforms/project.test.js +1 -1
- package/dist/src/data/transforms/regexExtract.d.ts +2 -2
- package/dist/src/data/transforms/regexExtract.d.ts.map +1 -1
- package/dist/src/data/transforms/regexExtract.js +1 -1
- package/dist/src/data/transforms/regexExtract.test.js +3 -3
- package/dist/src/data/transforms/regexFold.d.ts +2 -2
- package/dist/src/data/transforms/regexFold.d.ts.map +1 -1
- package/dist/src/data/transforms/regexFold.js +2 -2
- package/dist/src/data/transforms/regexFold.test.js +3 -3
- package/dist/src/data/transforms/sample.d.ts +2 -2
- package/dist/src/data/transforms/sample.d.ts.map +1 -1
- package/dist/src/data/transforms/sample.js +2 -2
- package/dist/src/data/transforms/stack.d.ts +3 -3
- package/dist/src/data/transforms/stack.d.ts.map +1 -1
- package/dist/src/data/transforms/stack.js +2 -2
- package/dist/src/data/transforms/stack.test.js +2 -2
- package/dist/src/data/transforms/transformFactory.d.ts +5 -5
- package/dist/src/data/transforms/transformFactory.d.ts.map +1 -1
- package/dist/src/data/transforms/transformFactory.js +3 -3
- package/dist/src/encoder/accessor.d.ts +6 -6
- package/dist/src/encoder/accessor.d.ts.map +1 -1
- package/dist/src/encoder/accessor.js +4 -4
- package/dist/src/encoder/encoder.d.ts +59 -59
- package/dist/src/encoder/encoder.d.ts.map +1 -1
- package/dist/src/encoder/encoder.js +47 -42
- package/dist/src/encoder/encoder.test.js +4 -4
- package/dist/src/fonts/bmFontManager.d.ts +7 -7
- package/dist/src/fonts/bmFontManager.d.ts.map +1 -1
- package/dist/src/fonts/bmFontManager.js +3 -3
- package/dist/src/fonts/bmFontMetrics.d.ts +6 -6
- package/dist/src/fonts/bmFontMetrics.d.ts.map +1 -1
- package/dist/src/fonts/bmFontMetrics.js +4 -4
- package/dist/src/genome/genome.d.ts +7 -7
- package/dist/src/genome/genome.d.ts.map +1 -1
- package/dist/src/genome/genome.js +2 -2
- package/dist/src/genome/genomeStore.d.ts +2 -2
- package/dist/src/genome/genomeStore.d.ts.map +1 -1
- package/dist/src/genome/genomeStore.js +1 -1
- package/dist/src/genome/locusFormat.d.ts +7 -7
- package/dist/src/genome/locusFormat.d.ts.map +1 -1
- package/dist/src/genome/locusFormat.js +4 -4
- package/dist/src/genome/scaleIndex.d.ts +1 -1
- package/dist/src/genome/scaleIndex.d.ts.map +1 -1
- package/dist/src/genome/scaleIndex.js +1 -1
- package/dist/src/genome/scaleLocus.d.ts +2 -2
- package/dist/src/genome/scaleLocus.d.ts.map +1 -1
- package/dist/src/genome/scaleLocus.js +3 -3
- package/dist/src/genomeSpy.d.ts +12 -12
- package/dist/src/genomeSpy.d.ts.map +1 -1
- package/dist/src/genomeSpy.js +51 -34
- package/dist/src/gl/arrayBuilder.d.ts.map +1 -1
- package/dist/src/gl/dataToVertices.d.ts +19 -19
- package/dist/src/gl/dataToVertices.d.ts.map +1 -1
- package/dist/src/gl/dataToVertices.js +11 -11
- package/dist/src/gl/link.vertex.glsl.js +1 -1
- package/dist/src/gl/point.fragment.glsl.js +1 -1
- package/dist/src/gl/point.vertex.glsl.js +1 -1
- package/dist/src/gl/webGLHelper.d.ts +4 -4
- package/dist/src/gl/webGLHelper.d.ts.map +1 -1
- package/dist/src/gl/webGLHelper.js +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/marks/link.d.ts.map +1 -1
- package/dist/src/marks/link.js +35 -14
- package/dist/src/marks/mark.d.ts +35 -32
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +26 -23
- package/dist/src/marks/markUtils.d.ts +10 -10
- package/dist/src/marks/markUtils.d.ts.map +1 -1
- package/dist/src/marks/markUtils.js +5 -5
- package/dist/src/marks/pointMark.d.ts +1 -1
- package/dist/src/marks/pointMark.d.ts.map +1 -1
- package/dist/src/marks/pointMark.js +7 -7
- package/dist/src/marks/rectMark.d.ts +2 -2
- package/dist/src/marks/rectMark.d.ts.map +1 -1
- package/dist/src/marks/rectMark.js +7 -7
- package/dist/src/marks/rule.js +6 -6
- package/dist/src/marks/text.d.ts +1 -1
- package/dist/src/marks/text.d.ts.map +1 -1
- package/dist/src/marks/text.js +6 -6
- package/dist/src/scale/colorUtils.d.ts +4 -4
- package/dist/src/scale/colorUtils.d.ts.map +1 -1
- package/dist/src/scale/colorUtils.js +2 -2
- package/dist/src/scale/glslScaleGenerator.d.ts +3 -3
- package/dist/src/scale/glslScaleGenerator.d.ts.map +1 -1
- package/dist/src/scale/glslScaleGenerator.js +2 -2
- package/dist/src/scale/scale.d.ts +3 -3
- package/dist/src/scale/scale.d.ts.map +1 -1
- package/dist/src/scale/scale.js +2 -2
- package/dist/src/scale/ticks.d.ts +4 -4
- package/dist/src/scale/ticks.js +4 -4
- package/dist/src/spec/axis.d.ts +1 -1
- package/dist/src/spec/channel.d.ts +2 -2
- package/dist/src/spec/data.d.ts +2 -2
- package/dist/src/spec/mark.d.ts +36 -14
- package/dist/src/spec/root.d.ts +2 -2
- package/dist/src/spec/sampleView.d.ts +5 -5
- package/dist/src/spec/scale.d.ts +1 -1
- package/dist/src/spec/title.d.ts +1 -1
- package/dist/src/spec/view.d.ts +36 -9
- package/dist/src/tooltip/dataTooltipHandler.js +1 -1
- package/dist/src/tooltip/refseqGeneTooltipHandler.d.ts.map +1 -1
- package/dist/src/tooltip/refseqGeneTooltipHandler.js +1 -1
- package/dist/src/tooltip/tooltipHandler.d.ts +1 -1
- package/dist/src/tooltip/tooltipHandler.d.ts.map +1 -1
- package/dist/src/tooltip/tooltipHandler.ts +1 -1
- package/dist/src/types/embedApi.d.ts +3 -3
- package/dist/src/types/encoder.d.ts +4 -4
- package/dist/src/types/flowBatch.d.ts +1 -1
- package/dist/src/types/rendering.d.ts +3 -3
- package/dist/src/types/scaleResolutionApi.d.ts +2 -2
- package/dist/src/types/viewContext.d.ts +41 -12
- package/dist/src/utils/animator.d.ts +2 -2
- package/dist/src/utils/animator.d.ts.map +1 -1
- package/dist/src/utils/animator.js +1 -1
- package/dist/src/utils/inertia.d.ts +3 -3
- package/dist/src/utils/inertia.d.ts.map +1 -1
- package/dist/src/utils/inertia.js +1 -1
- package/dist/src/utils/interactionEvent.d.ts +5 -5
- package/dist/src/utils/interactionEvent.d.ts.map +1 -1
- package/dist/src/utils/interactionEvent.js +2 -2
- package/dist/src/utils/trees.js +1 -1
- package/dist/src/view/axisGridView.d.ts +17 -16
- package/dist/src/view/axisGridView.d.ts.map +1 -1
- package/dist/src/view/axisGridView.js +24 -20
- package/dist/src/view/axisResolution.d.ts +10 -10
- package/dist/src/view/axisResolution.d.ts.map +1 -1
- package/dist/src/view/axisResolution.js +6 -6
- package/dist/src/view/axisResolution.test.js +1 -1
- package/dist/src/view/axisView.d.ts +18 -17
- package/dist/src/view/axisView.d.ts.map +1 -1
- package/dist/src/view/axisView.js +39 -35
- package/dist/src/view/concatView.d.ts +5 -5
- package/dist/src/view/concatView.d.ts.map +1 -1
- package/dist/src/view/concatView.js +23 -23
- package/dist/src/view/containerView.d.ts +10 -8
- package/dist/src/view/containerView.d.ts.map +1 -1
- package/dist/src/view/containerView.js +18 -13
- package/dist/src/view/facetView.d.ts +12 -12
- package/dist/src/view/facetView.d.ts.map +1 -1
- package/dist/src/view/facetView.js +19 -19
- package/dist/src/view/flowBuilder.d.ts +4 -4
- package/dist/src/view/flowBuilder.d.ts.map +1 -1
- package/dist/src/view/flowBuilder.js +13 -13
- package/dist/src/view/flowBuilder.test.js +7 -7
- package/dist/src/view/gridView.d.ts +63 -35
- package/dist/src/view/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView.js +400 -113
- package/dist/src/view/layerView.d.ts +12 -14
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layerView.js +55 -26
- package/dist/src/{utils → view}/layout/flexLayout.d.ts +6 -6
- package/dist/src/view/layout/flexLayout.d.ts.map +1 -0
- package/dist/src/{utils → view}/layout/flexLayout.js +4 -4
- package/dist/src/view/layout/grid.d.ts.map +1 -0
- package/dist/src/{utils → view}/layout/padding.d.ts +4 -4
- package/dist/src/view/layout/padding.d.ts.map +1 -0
- package/dist/src/{utils → view}/layout/padding.js +2 -2
- package/dist/src/view/layout/point.d.ts.map +1 -0
- package/dist/src/{utils → view}/layout/rectangle.d.ts +8 -2
- package/dist/src/view/layout/rectangle.d.ts.map +1 -0
- package/dist/src/{utils → view}/layout/rectangle.js +22 -2
- package/dist/src/{utils → view}/layout/rectangle.test.js +8 -0
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts +10 -10
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/bufferedViewRenderingContext.js +10 -10
- package/dist/src/view/renderingContext/compositeViewRenderingContext.d.ts +2 -2
- package/dist/src/view/renderingContext/compositeViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/compositeViewRenderingContext.js +4 -4
- package/dist/src/view/renderingContext/debuggingViewRenderingContext.d.ts +4 -4
- package/dist/src/view/renderingContext/debuggingViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/debuggingViewRenderingContext.js +3 -3
- package/dist/src/view/renderingContext/layoutRecorderViewRenderingContext.d.ts +8 -8
- package/dist/src/view/renderingContext/layoutRecorderViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/layoutRecorderViewRenderingContext.js +4 -4
- package/dist/src/view/renderingContext/simpleViewRenderingContext.d.ts +6 -6
- package/dist/src/view/renderingContext/simpleViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/simpleViewRenderingContext.js +7 -7
- package/dist/src/view/renderingContext/svgViewRenderingContext.d.ts +4 -4
- package/dist/src/view/renderingContext/svgViewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/svgViewRenderingContext.js +6 -6
- package/dist/src/view/renderingContext/viewRenderingContext.d.ts +10 -10
- package/dist/src/view/renderingContext/viewRenderingContext.d.ts.map +1 -1
- package/dist/src/view/renderingContext/viewRenderingContext.js +5 -5
- package/dist/src/view/scaleResolution.d.ts +21 -17
- package/dist/src/view/scaleResolution.d.ts.map +1 -1
- package/dist/src/view/scaleResolution.js +33 -26
- package/dist/src/view/scaleResolution.test.js +57 -72
- package/dist/src/view/testUtils.d.ts +6 -15
- package/dist/src/view/testUtils.d.ts.map +1 -1
- package/dist/src/view/testUtils.js +40 -44
- package/dist/src/view/title.d.ts +3 -3
- package/dist/src/view/title.d.ts.map +1 -1
- package/dist/src/view/title.js +12 -12
- package/dist/src/view/unitView.d.ts +31 -30
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +30 -22
- package/dist/src/view/view.d.ts +86 -57
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +148 -103
- package/dist/src/view/view.test.js +9 -8
- package/dist/src/view/viewError.d.ts +9 -0
- package/dist/src/view/viewError.d.ts.map +1 -0
- package/dist/src/view/viewError.js +11 -0
- package/dist/src/view/viewFactory.d.ts +53 -20
- package/dist/src/view/viewFactory.d.ts.map +1 -1
- package/dist/src/view/viewFactory.js +148 -33
- package/dist/src/view/viewFactory.test.js +8 -0
- package/dist/src/view/viewUtils.d.ts +14 -12
- package/dist/src/view/viewUtils.d.ts.map +1 -1
- package/dist/src/view/viewUtils.js +10 -63
- package/dist/src/view/zoom.d.ts +4 -4
- package/dist/src/view/zoom.d.ts.map +1 -1
- package/dist/src/view/zoom.js +3 -3
- package/package.json +7 -5
- package/dist/src/utils/layout/flexLayout.d.ts.map +0 -1
- package/dist/src/utils/layout/grid.d.ts.map +0 -1
- package/dist/src/utils/layout/padding.d.ts.map +0 -1
- package/dist/src/utils/layout/point.d.ts.map +0 -1
- package/dist/src/utils/layout/rectangle.d.ts.map +0 -1
- package/dist/src/view/implicitRootView.d.ts +0 -9
- package/dist/src/view/implicitRootView.d.ts.map +0 -1
- package/dist/src/view/implicitRootView.js +0 -23
- package/dist/src/view/importView.d.ts +0 -17
- package/dist/src/view/importView.d.ts.map +0 -1
- package/dist/src/view/importView.js +0 -22
- /package/dist/src/{utils → view}/layout/flexLayout.test.js +0 -0
- /package/dist/src/{utils → view}/layout/grid.d.ts +0 -0
- /package/dist/src/{utils → view}/layout/grid.js +0 -0
- /package/dist/src/{utils → view}/layout/grid.test.js +0 -0
- /package/dist/src/{utils → view}/layout/point.d.ts +0 -0
- /package/dist/src/{utils → view}/layout/point.js +0 -0
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
import { _ as J, L as K } from "./index-LD6yPc3X.js";
|
|
2
|
+
import { L as N } from "./__vite-browser-external-ENoMJThg.js";
|
|
3
|
+
import "./index-1QVesMzU.js";
|
|
4
|
+
import { u as z, L as G, a as Q } from "./long-Veu0zKh9.js";
|
|
5
|
+
import "./_commonjsHelpers-QtkX90xp.js";
|
|
6
|
+
function H(a) {
|
|
7
|
+
if (a.greaterThan(Number.MAX_SAFE_INTEGER) || a.lessThan(Number.MIN_SAFE_INTEGER))
|
|
8
|
+
throw new Error("integer overflow");
|
|
9
|
+
return a.toNumber();
|
|
10
|
+
}
|
|
11
|
+
class W extends Error {
|
|
12
|
+
}
|
|
13
|
+
function L(a) {
|
|
14
|
+
if (a && a.aborted) {
|
|
15
|
+
if (typeof DOMException < "u")
|
|
16
|
+
throw new DOMException("aborted", "AbortError");
|
|
17
|
+
{
|
|
18
|
+
const e = new W("aborted");
|
|
19
|
+
throw e.code = "ERR_ABORTED", e;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function Z(a, e) {
|
|
24
|
+
return e.minv.blockPosition - a.maxv.blockPosition < 65e3 && e.maxv.blockPosition - a.minv.blockPosition < 5e6;
|
|
25
|
+
}
|
|
26
|
+
function j(a, e) {
|
|
27
|
+
const t = [];
|
|
28
|
+
let n = null;
|
|
29
|
+
return a.length === 0 ? a : (a.sort(function(r, i) {
|
|
30
|
+
const o = r.minv.blockPosition - i.minv.blockPosition;
|
|
31
|
+
return o !== 0 ? o : r.minv.dataPosition - i.minv.dataPosition;
|
|
32
|
+
}), a.forEach((r) => {
|
|
33
|
+
(!e || r.maxv.compareTo(e) > 0) && (n === null ? (t.push(r), n = r) : Z(n, r) ? r.maxv.compareTo(n.maxv) > 0 && (n.maxv = r.maxv) : (t.push(r), n = r));
|
|
34
|
+
}), t);
|
|
35
|
+
}
|
|
36
|
+
class R {
|
|
37
|
+
constructor(e, t) {
|
|
38
|
+
this.blockPosition = e, this.dataPosition = t;
|
|
39
|
+
}
|
|
40
|
+
toString() {
|
|
41
|
+
return `${this.blockPosition}:${this.dataPosition}`;
|
|
42
|
+
}
|
|
43
|
+
compareTo(e) {
|
|
44
|
+
return this.blockPosition - e.blockPosition || this.dataPosition - e.dataPosition;
|
|
45
|
+
}
|
|
46
|
+
static min(...e) {
|
|
47
|
+
let t, n = 0;
|
|
48
|
+
for (; !t; n += 1)
|
|
49
|
+
t = e[n];
|
|
50
|
+
for (; n < e.length; n += 1)
|
|
51
|
+
t.compareTo(e[n]) > 0 && (t = e[n]);
|
|
52
|
+
return t;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function v(a, e = 0, t = !1) {
|
|
56
|
+
if (t)
|
|
57
|
+
throw new Error("big-endian virtual file offsets not implemented");
|
|
58
|
+
return new R(a[e + 7] * 1099511627776 + a[e + 6] * 4294967296 + a[e + 5] * 16777216 + a[e + 4] * 65536 + a[e + 3] * 256 + a[e + 2], a[e + 1] << 8 | a[e]);
|
|
59
|
+
}
|
|
60
|
+
class P {
|
|
61
|
+
/**
|
|
62
|
+
* @param {VirtualOffset} minv
|
|
63
|
+
* @param {VirtualOffset} maxv
|
|
64
|
+
* @param {number} bin
|
|
65
|
+
* @param {number} [fetchedSize]
|
|
66
|
+
*/
|
|
67
|
+
constructor(e, t, n, r = void 0) {
|
|
68
|
+
this.minv = e, this.maxv = t, this.bin = n, this._fetchedSize = r;
|
|
69
|
+
}
|
|
70
|
+
toUniqueString() {
|
|
71
|
+
return `${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`;
|
|
72
|
+
}
|
|
73
|
+
toString() {
|
|
74
|
+
return this.toUniqueString();
|
|
75
|
+
}
|
|
76
|
+
compareTo(e) {
|
|
77
|
+
return this.minv.compareTo(e.minv) || this.maxv.compareTo(e.maxv) || this.bin - e.bin;
|
|
78
|
+
}
|
|
79
|
+
fetchedSize() {
|
|
80
|
+
return this._fetchedSize !== void 0 ? this._fetchedSize : this.maxv.blockPosition + 65536 - this.minv.blockPosition;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
class X {
|
|
84
|
+
constructor({ filehandle: e, renameRefSeqs: t = (n) => n }) {
|
|
85
|
+
this.filehandle = e, this.renameRefSeq = t;
|
|
86
|
+
}
|
|
87
|
+
async getMetadata(e = {}) {
|
|
88
|
+
const { indices: t, ...n } = await this.parse(e);
|
|
89
|
+
return n;
|
|
90
|
+
}
|
|
91
|
+
_findFirstData(e, t) {
|
|
92
|
+
return e ? e.compareTo(t) > 0 ? t : e : t;
|
|
93
|
+
}
|
|
94
|
+
async parse(e = {}) {
|
|
95
|
+
return this.parseP || (this.parseP = this._parse(e).catch((t) => {
|
|
96
|
+
throw this.parseP = void 0, t;
|
|
97
|
+
})), this.parseP;
|
|
98
|
+
}
|
|
99
|
+
async hasRefSeq(e, t = {}) {
|
|
100
|
+
return !!((await this.parse(t)).indices[e] || {}).binIndex;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const ee = 21578324, O = 14;
|
|
104
|
+
function te(a, e) {
|
|
105
|
+
return a += 1, e -= 1, [
|
|
106
|
+
[0, 0],
|
|
107
|
+
[1 + (a >> 26), 1 + (e >> 26)],
|
|
108
|
+
[9 + (a >> 23), 9 + (e >> 23)],
|
|
109
|
+
[73 + (a >> 20), 73 + (e >> 20)],
|
|
110
|
+
[585 + (a >> 17), 585 + (e >> 17)],
|
|
111
|
+
[4681 + (a >> 14), 4681 + (e >> 14)]
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
class A extends X {
|
|
115
|
+
async lineCount(e, t = {}) {
|
|
116
|
+
const n = await this.parse(t);
|
|
117
|
+
if (!n)
|
|
118
|
+
return -1;
|
|
119
|
+
const r = n.refNameToId[e];
|
|
120
|
+
if (!n.indices[r])
|
|
121
|
+
return -1;
|
|
122
|
+
const { stats: o } = n.indices[r];
|
|
123
|
+
return o ? o.lineCount : -1;
|
|
124
|
+
}
|
|
125
|
+
// fetch and parse the index
|
|
126
|
+
async _parse(e = {}) {
|
|
127
|
+
const t = await this.filehandle.readFile(e), n = await z(t);
|
|
128
|
+
if (L(e.signal), n.readUInt32LE(0) !== ee)
|
|
129
|
+
throw new Error("Not a TBI file");
|
|
130
|
+
const r = n.readInt32LE(4), i = n.readInt32LE(8), o = i & 65536 ? "zero-based-half-open" : "1-based-closed", u = {
|
|
131
|
+
0: "generic",
|
|
132
|
+
1: "SAM",
|
|
133
|
+
2: "VCF"
|
|
134
|
+
}[i & 15];
|
|
135
|
+
if (!u)
|
|
136
|
+
throw new Error(`invalid Tabix preset format flags ${i}`);
|
|
137
|
+
const c = {
|
|
138
|
+
ref: n.readInt32LE(12),
|
|
139
|
+
start: n.readInt32LE(16),
|
|
140
|
+
end: n.readInt32LE(20)
|
|
141
|
+
}, h = n.readInt32LE(24), f = 5, l = ((1 << (f + 1) * 3) - 1) / 7, I = 2 ** (14 + f * 3), x = h ? String.fromCharCode(h) : null, w = n.readInt32LE(28), b = n.readInt32LE(32), { refNameToId: m, refIdToName: p } = this._parseNameBytes(n.slice(36, 36 + b));
|
|
142
|
+
let d = 36 + b, g;
|
|
143
|
+
return {
|
|
144
|
+
indices: new Array(r).fill(0).map(() => {
|
|
145
|
+
const E = n.readInt32LE(d);
|
|
146
|
+
d += 4;
|
|
147
|
+
const k = {};
|
|
148
|
+
let $;
|
|
149
|
+
for (let C = 0; C < E; C += 1) {
|
|
150
|
+
const y = n.readUInt32LE(d);
|
|
151
|
+
if (d += 4, y > l + 1)
|
|
152
|
+
throw new Error("tabix index contains too many bins, please use a CSI index");
|
|
153
|
+
if (y === l + 1) {
|
|
154
|
+
const S = n.readInt32LE(d);
|
|
155
|
+
d += 4, S === 2 && ($ = this.parsePseudoBin(n, d)), d += 16 * S;
|
|
156
|
+
} else {
|
|
157
|
+
const S = n.readInt32LE(d);
|
|
158
|
+
d += 4;
|
|
159
|
+
const M = new Array(S);
|
|
160
|
+
for (let B = 0; B < S; B += 1) {
|
|
161
|
+
const V = v(n, d), Y = v(n, d + 8);
|
|
162
|
+
d += 16, g = this._findFirstData(g, V), M[B] = new P(V, Y, y);
|
|
163
|
+
}
|
|
164
|
+
k[y] = M;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const F = n.readInt32LE(d);
|
|
168
|
+
d += 4;
|
|
169
|
+
const _ = new Array(F);
|
|
170
|
+
for (let C = 0; C < F; C += 1)
|
|
171
|
+
_[C] = v(n, d), d += 8, g = this._findFirstData(g, _[C]);
|
|
172
|
+
return { binIndex: k, linearIndex: _, stats: $ };
|
|
173
|
+
}),
|
|
174
|
+
metaChar: x,
|
|
175
|
+
maxBinNumber: l,
|
|
176
|
+
maxRefLength: I,
|
|
177
|
+
skipLines: w,
|
|
178
|
+
firstDataLine: g,
|
|
179
|
+
columnNumbers: c,
|
|
180
|
+
coordinateType: o,
|
|
181
|
+
format: u,
|
|
182
|
+
refIdToName: p,
|
|
183
|
+
refNameToId: m,
|
|
184
|
+
maxBlockSize: 65536
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
parsePseudoBin(e, t) {
|
|
188
|
+
return { lineCount: H(G.fromBytesLE(e.slice(t + 16, t + 24), !0)) };
|
|
189
|
+
}
|
|
190
|
+
_parseNameBytes(e) {
|
|
191
|
+
let t = 0, n = 0;
|
|
192
|
+
const r = [], i = {};
|
|
193
|
+
for (let o = 0; o < e.length; o += 1)
|
|
194
|
+
if (!e[o]) {
|
|
195
|
+
if (n < o) {
|
|
196
|
+
let s = e.toString("utf8", n, o);
|
|
197
|
+
s = this.renameRefSeq(s), r[t] = s, i[s] = t;
|
|
198
|
+
}
|
|
199
|
+
n = o + 1, t += 1;
|
|
200
|
+
}
|
|
201
|
+
return { refNameToId: i, refIdToName: r };
|
|
202
|
+
}
|
|
203
|
+
async blocksForRange(e, t, n, r = {}) {
|
|
204
|
+
t < 0 && (t = 0);
|
|
205
|
+
const i = await this.parse(r);
|
|
206
|
+
if (!i)
|
|
207
|
+
return [];
|
|
208
|
+
const o = i.refNameToId[e], s = i.indices[o];
|
|
209
|
+
if (!s)
|
|
210
|
+
return [];
|
|
211
|
+
(s.linearIndex.length ? s.linearIndex[t >> O >= s.linearIndex.length ? s.linearIndex.length - 1 : t >> O] : new R(0, 0)) || console.warn("querying outside of possible tabix range");
|
|
212
|
+
const c = te(t, n), h = [];
|
|
213
|
+
for (const [w, b] of c)
|
|
214
|
+
for (let m = w; m <= b; m++)
|
|
215
|
+
if (s.binIndex[m]) {
|
|
216
|
+
const p = s.binIndex[m];
|
|
217
|
+
for (let d = 0; d < p.length; ++d)
|
|
218
|
+
h.push(new P(p[d].minv, p[d].maxv, m));
|
|
219
|
+
}
|
|
220
|
+
const f = s.linearIndex.length;
|
|
221
|
+
let l = null;
|
|
222
|
+
const I = Math.min(t >> 14, f - 1), x = Math.min(n >> 14, f - 1);
|
|
223
|
+
for (let w = I; w <= x; ++w) {
|
|
224
|
+
const b = s.linearIndex[w];
|
|
225
|
+
b && (!l || b.compareTo(l) < 0) && (l = b);
|
|
226
|
+
}
|
|
227
|
+
return j(h, l);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const ne = 21582659, ie = 38359875;
|
|
231
|
+
function re(a, e) {
|
|
232
|
+
return a * 2 ** e;
|
|
233
|
+
}
|
|
234
|
+
function q(a, e) {
|
|
235
|
+
return Math.floor(a / 2 ** e);
|
|
236
|
+
}
|
|
237
|
+
class U extends X {
|
|
238
|
+
constructor(e) {
|
|
239
|
+
super(e), this.maxBinNumber = 0, this.depth = 0, this.minShift = 0;
|
|
240
|
+
}
|
|
241
|
+
async lineCount(e, t = {}) {
|
|
242
|
+
const n = await this.parse(t);
|
|
243
|
+
if (!n)
|
|
244
|
+
return -1;
|
|
245
|
+
const r = n.refNameToId[e];
|
|
246
|
+
if (!n.indices[r])
|
|
247
|
+
return -1;
|
|
248
|
+
const { stats: o } = n.indices[r];
|
|
249
|
+
return o ? o.lineCount : -1;
|
|
250
|
+
}
|
|
251
|
+
async indexCov() {
|
|
252
|
+
throw new Error("CSI indexes do not support indexcov");
|
|
253
|
+
}
|
|
254
|
+
parseAuxData(e, t) {
|
|
255
|
+
const n = e.readInt32LE(t), r = n & 65536 ? "zero-based-half-open" : "1-based-closed", i = { 0: "generic", 1: "SAM", 2: "VCF" }[n & 15];
|
|
256
|
+
if (!i)
|
|
257
|
+
throw new Error(`invalid Tabix preset format flags ${n}`);
|
|
258
|
+
const o = {
|
|
259
|
+
ref: e.readInt32LE(t + 4),
|
|
260
|
+
start: e.readInt32LE(t + 8),
|
|
261
|
+
end: e.readInt32LE(t + 12)
|
|
262
|
+
}, s = e.readInt32LE(t + 16), u = s ? String.fromCharCode(s) : null, c = e.readInt32LE(t + 20), h = e.readInt32LE(t + 24), { refIdToName: f, refNameToId: l } = this._parseNameBytes(e.slice(t + 28, t + 28 + h));
|
|
263
|
+
return {
|
|
264
|
+
refIdToName: f,
|
|
265
|
+
refNameToId: l,
|
|
266
|
+
skipLines: c,
|
|
267
|
+
metaChar: u,
|
|
268
|
+
columnNumbers: o,
|
|
269
|
+
format: i,
|
|
270
|
+
coordinateType: r
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
_parseNameBytes(e) {
|
|
274
|
+
let t = 0, n = 0;
|
|
275
|
+
const r = [], i = {};
|
|
276
|
+
for (let o = 0; o < e.length; o += 1)
|
|
277
|
+
if (!e[o]) {
|
|
278
|
+
if (n < o) {
|
|
279
|
+
let s = e.toString("utf8", n, o);
|
|
280
|
+
s = this.renameRefSeq(s), r[t] = s, i[s] = t;
|
|
281
|
+
}
|
|
282
|
+
n = o + 1, t += 1;
|
|
283
|
+
}
|
|
284
|
+
return { refNameToId: i, refIdToName: r };
|
|
285
|
+
}
|
|
286
|
+
// fetch and parse the index
|
|
287
|
+
async _parse(e = {}) {
|
|
288
|
+
const t = await z(await this.filehandle.readFile(e));
|
|
289
|
+
let n;
|
|
290
|
+
if (t.readUInt32LE(0) === ne)
|
|
291
|
+
n = 1;
|
|
292
|
+
else if (t.readUInt32LE(0) === ie)
|
|
293
|
+
n = 2;
|
|
294
|
+
else
|
|
295
|
+
throw new Error("Not a CSI file");
|
|
296
|
+
this.minShift = t.readInt32LE(4), this.depth = t.readInt32LE(8), this.maxBinNumber = ((1 << (this.depth + 1) * 3) - 1) / 7;
|
|
297
|
+
const r = 2 ** (this.minShift + this.depth * 3), i = t.readInt32LE(12), o = i && i >= 30 ? this.parseAuxData(t, 16) : {
|
|
298
|
+
refIdToName: [],
|
|
299
|
+
refNameToId: {},
|
|
300
|
+
metaChar: null,
|
|
301
|
+
columnNumbers: { ref: 0, start: 1, end: 2 },
|
|
302
|
+
coordinateType: "zero-based-half-open",
|
|
303
|
+
format: "generic"
|
|
304
|
+
}, s = t.readInt32LE(16 + i);
|
|
305
|
+
let u, c = 16 + i + 4;
|
|
306
|
+
const h = new Array(s).fill(0).map(() => {
|
|
307
|
+
const f = t.readInt32LE(c);
|
|
308
|
+
c += 4;
|
|
309
|
+
const l = {};
|
|
310
|
+
let I;
|
|
311
|
+
for (let x = 0; x < f; x += 1) {
|
|
312
|
+
const w = t.readUInt32LE(c);
|
|
313
|
+
if (w > this.maxBinNumber)
|
|
314
|
+
I = this.parsePseudoBin(t, c + 4), c += 4 + 8 + 4 + 16 + 16;
|
|
315
|
+
else {
|
|
316
|
+
const b = v(t, c + 4);
|
|
317
|
+
u = this._findFirstData(u, b);
|
|
318
|
+
const m = t.readInt32LE(c + 12);
|
|
319
|
+
c += 16;
|
|
320
|
+
const p = new Array(m);
|
|
321
|
+
for (let d = 0; d < m; d += 1) {
|
|
322
|
+
const g = v(t, c), T = v(t, c + 8);
|
|
323
|
+
c += 16, p[d] = new P(g, T, w);
|
|
324
|
+
}
|
|
325
|
+
l[w] = p;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return { binIndex: l, stats: I };
|
|
329
|
+
});
|
|
330
|
+
return {
|
|
331
|
+
...o,
|
|
332
|
+
csi: !0,
|
|
333
|
+
refCount: s,
|
|
334
|
+
maxBlockSize: 65536,
|
|
335
|
+
firstDataLine: u,
|
|
336
|
+
csiVersion: n,
|
|
337
|
+
indices: h,
|
|
338
|
+
depth: this.depth,
|
|
339
|
+
maxBinNumber: this.maxBinNumber,
|
|
340
|
+
maxRefLength: r
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
parsePseudoBin(e, t) {
|
|
344
|
+
return { lineCount: H(G.fromBytesLE(e.slice(t + 28, t + 36), !0)) };
|
|
345
|
+
}
|
|
346
|
+
async blocksForRange(e, t, n, r = {}) {
|
|
347
|
+
t < 0 && (t = 0);
|
|
348
|
+
const i = await this.parse(r);
|
|
349
|
+
if (!i)
|
|
350
|
+
return [];
|
|
351
|
+
const o = i.refNameToId[e], s = i.indices[o];
|
|
352
|
+
if (!s)
|
|
353
|
+
return [];
|
|
354
|
+
const u = this.reg2bins(t, n), c = [];
|
|
355
|
+
for (const [h, f] of u)
|
|
356
|
+
for (let l = h; l <= f; l++)
|
|
357
|
+
if (s.binIndex[l]) {
|
|
358
|
+
const I = s.binIndex[l];
|
|
359
|
+
for (let x = 0; x < I.length; ++x)
|
|
360
|
+
c.push(new P(I[x].minv, I[x].maxv, l));
|
|
361
|
+
}
|
|
362
|
+
return j(c, new R(0, 0));
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)
|
|
366
|
+
*/
|
|
367
|
+
reg2bins(e, t) {
|
|
368
|
+
e -= 1, e < 1 && (e = 1), t > 2 ** 50 && (t = 2 ** 34), t -= 1;
|
|
369
|
+
let n = 0, r = 0, i = this.minShift + this.depth * 3;
|
|
370
|
+
const o = [];
|
|
371
|
+
for (; n <= this.depth; i -= 3, r += re(1, n * 3), n += 1) {
|
|
372
|
+
const s = r + q(e, i), u = r + q(t, i);
|
|
373
|
+
if (u - s + o.length > this.maxBinNumber)
|
|
374
|
+
throw new Error(`query ${e}-${t} is too large for current binning scheme (shift ${this.minShift}, depth ${this.depth}), try a smaller query or a coarser index binning scheme`);
|
|
375
|
+
o.push([s, u]);
|
|
376
|
+
}
|
|
377
|
+
return o;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
const D = typeof TextDecoder < "u" ? new TextDecoder("utf-8") : void 0;
|
|
381
|
+
function oe(a) {
|
|
382
|
+
return new Promise((e) => setTimeout(e, a));
|
|
383
|
+
}
|
|
384
|
+
class fe {
|
|
385
|
+
/**
|
|
386
|
+
* @param {object} args
|
|
387
|
+
* @param {string} [args.path]
|
|
388
|
+
* @param {filehandle} [args.filehandle]
|
|
389
|
+
* @param {string} [args.tbiPath]
|
|
390
|
+
* @param {filehandle} [args.tbiFilehandle]
|
|
391
|
+
* @param {string} [args.csiPath]
|
|
392
|
+
* @param {filehandle} [args.csiFilehandle]
|
|
393
|
+
* @param {number} [args.yieldTime] yield to main thread after N milliseconds if reading features is taking a long time to avoid hanging main thread
|
|
394
|
+
* @param {function} [args.renameRefSeqs] optional function with sig `string => string` to transform
|
|
395
|
+
* reference sequence names for the purpose of indexing and querying. note that the data that is returned is
|
|
396
|
+
* not altered, just the names of the reference sequences that are used for querying.
|
|
397
|
+
*/
|
|
398
|
+
constructor({ path: e, filehandle: t, tbiPath: n, tbiFilehandle: r, csiPath: i, csiFilehandle: o, yieldTime: s = 500, chunkSizeLimit: u = 5e7, renameRefSeqs: c = (f) => f, chunkCacheSize: h = 5 * 2 ** 20 }) {
|
|
399
|
+
if (t)
|
|
400
|
+
this.filehandle = t;
|
|
401
|
+
else if (e)
|
|
402
|
+
this.filehandle = new N(e);
|
|
403
|
+
else
|
|
404
|
+
throw new TypeError("must provide either filehandle or path");
|
|
405
|
+
if (r)
|
|
406
|
+
this.index = new A({
|
|
407
|
+
filehandle: r,
|
|
408
|
+
renameRefSeqs: c
|
|
409
|
+
});
|
|
410
|
+
else if (o)
|
|
411
|
+
this.index = new U({
|
|
412
|
+
filehandle: o,
|
|
413
|
+
renameRefSeqs: c
|
|
414
|
+
});
|
|
415
|
+
else if (n)
|
|
416
|
+
this.index = new A({
|
|
417
|
+
filehandle: new N(n),
|
|
418
|
+
renameRefSeqs: c
|
|
419
|
+
});
|
|
420
|
+
else if (i)
|
|
421
|
+
this.index = new U({
|
|
422
|
+
filehandle: new N(i),
|
|
423
|
+
renameRefSeqs: c
|
|
424
|
+
});
|
|
425
|
+
else if (e)
|
|
426
|
+
this.index = new A({
|
|
427
|
+
filehandle: new N(`${e}.tbi`),
|
|
428
|
+
renameRefSeqs: c
|
|
429
|
+
});
|
|
430
|
+
else
|
|
431
|
+
throw new TypeError("must provide one of tbiFilehandle, tbiPath, csiFilehandle, or csiPath");
|
|
432
|
+
this.chunkSizeLimit = u, this.renameRefSeq = c, this.yieldTime = s, this.chunkCache = new J({
|
|
433
|
+
cache: new K({ maxSize: Math.floor(h / 65536) }),
|
|
434
|
+
fill: (f, l) => this.readChunk(f, { signal: l })
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* @param refName name of the reference sequence
|
|
439
|
+
* @param start start of the region (in 0-based half-open coordinates)
|
|
440
|
+
* @param end end of the region (in 0-based half-open coordinates)
|
|
441
|
+
* @param opts callback called for each line in the region. can also pass a object param containing obj.lineCallback, obj.signal, etc
|
|
442
|
+
* @returns promise that is resolved when the whole read is finished, rejected on error
|
|
443
|
+
*/
|
|
444
|
+
async getLines(e, t, n, r) {
|
|
445
|
+
let i, o = {}, s;
|
|
446
|
+
if (typeof r > "u")
|
|
447
|
+
throw new TypeError("line callback must be provided");
|
|
448
|
+
if (typeof r == "function" ? s = r : (o = r, s = r.lineCallback), e === void 0)
|
|
449
|
+
throw new TypeError("must provide a reference sequence name");
|
|
450
|
+
if (!s)
|
|
451
|
+
throw new TypeError("line callback must be provided");
|
|
452
|
+
const u = await this.index.getMetadata(o);
|
|
453
|
+
if (L(i), t || (t = 0), n || (n = u.maxRefLength), !(t <= n))
|
|
454
|
+
throw new TypeError("invalid start and end coordinates. start must be less than or equal to end");
|
|
455
|
+
if (t === n)
|
|
456
|
+
return;
|
|
457
|
+
const c = await this.index.blocksForRange(e, t, n, o);
|
|
458
|
+
L(i);
|
|
459
|
+
for (let f = 0; f < c.length; f += 1) {
|
|
460
|
+
const l = c[f].fetchedSize();
|
|
461
|
+
if (l > this.chunkSizeLimit)
|
|
462
|
+
throw new Error(`Too much data. Chunk size ${l.toLocaleString()} bytes exceeds chunkSizeLimit of ${this.chunkSizeLimit.toLocaleString()}.`);
|
|
463
|
+
}
|
|
464
|
+
let h = Date.now();
|
|
465
|
+
for (let f = 0; f < c.length; f += 1) {
|
|
466
|
+
let l;
|
|
467
|
+
const I = c[f], { buffer: x, cpositions: w, dpositions: b } = await this.chunkCache.get(I.toString(), I);
|
|
468
|
+
L(i);
|
|
469
|
+
let m = 0, p = 0;
|
|
470
|
+
for (; m < x.length; ) {
|
|
471
|
+
const d = x.indexOf(`
|
|
472
|
+
`, m);
|
|
473
|
+
if (d === -1)
|
|
474
|
+
break;
|
|
475
|
+
const g = x.slice(m, d), T = (D == null ? void 0 : D.decode(g)) || g.toString();
|
|
476
|
+
if (b) {
|
|
477
|
+
for (; m + I.minv.dataPosition >= b[p++]; )
|
|
478
|
+
;
|
|
479
|
+
p--;
|
|
480
|
+
}
|
|
481
|
+
const { startCoordinate: E, overlaps: k } = this.checkLine(u, e, t, n, T);
|
|
482
|
+
if (l !== void 0 && E !== void 0 && l > E)
|
|
483
|
+
throw new Error(`Lines not sorted by start coordinate (${l} > ${E}), this file is not usable with Tabix.`);
|
|
484
|
+
if (l = E, k)
|
|
485
|
+
s(
|
|
486
|
+
T.trim(),
|
|
487
|
+
// cpositions[pos] refers to actual file offset of a bgzip block boundaries
|
|
488
|
+
//
|
|
489
|
+
// we multiply by (1 <<8) in order to make sure each block has a "unique"
|
|
490
|
+
// address space so that data in that block could never overlap
|
|
491
|
+
//
|
|
492
|
+
// then the blockStart-dpositions is an uncompressed file offset from
|
|
493
|
+
// that bgzip block boundary, and since the cpositions are multiplied by
|
|
494
|
+
// (1 << 8) these uncompressed offsets get a unique space
|
|
495
|
+
w[p] * 256 + (m - b[p]) + I.minv.dataPosition + 1
|
|
496
|
+
);
|
|
497
|
+
else if (E !== void 0 && E >= n)
|
|
498
|
+
return;
|
|
499
|
+
this.yieldTime && h - Date.now() > this.yieldTime && (h = Date.now(), L(i), await oe(1)), m = d + 1;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
async getMetadata(e = {}) {
|
|
504
|
+
return this.index.getMetadata(e);
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* get a buffer containing the "header" region of
|
|
508
|
+
* the file, which are the bytes up to the first
|
|
509
|
+
* non-meta line
|
|
510
|
+
*/
|
|
511
|
+
async getHeaderBuffer(e = {}) {
|
|
512
|
+
const { firstDataLine: t, metaChar: n, maxBlockSize: r } = await this.getMetadata(e);
|
|
513
|
+
L(e.signal);
|
|
514
|
+
const i = ((t == null ? void 0 : t.blockPosition) || 0) + r;
|
|
515
|
+
let o = await this._readRegion(0, i, e);
|
|
516
|
+
L(e.signal);
|
|
517
|
+
try {
|
|
518
|
+
o = await z(o);
|
|
519
|
+
} catch (s) {
|
|
520
|
+
throw console.error(s), new Error(
|
|
521
|
+
//@ts-ignore
|
|
522
|
+
`error decompressing block ${s.code} at 0 (length ${i}) ${s}`
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
if (n) {
|
|
526
|
+
let s = -1;
|
|
527
|
+
const u = `
|
|
528
|
+
`.charCodeAt(0), c = n.charCodeAt(0);
|
|
529
|
+
for (let h = 0; h < o.length && !(h === s + 1 && o[h] !== c); h += 1)
|
|
530
|
+
o[h] === u && (s = h);
|
|
531
|
+
o = o.slice(0, s + 1);
|
|
532
|
+
}
|
|
533
|
+
return o;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* get a string containing the "header" region of the
|
|
537
|
+
* file, is the portion up to the first non-meta line
|
|
538
|
+
*
|
|
539
|
+
* @returns {Promise} for a string
|
|
540
|
+
*/
|
|
541
|
+
async getHeader(e = {}) {
|
|
542
|
+
return (await this.getHeaderBuffer(e)).toString("utf8");
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* get an array of reference sequence names, in the order in which
|
|
546
|
+
* they occur in the file. reference sequence renaming is not applied
|
|
547
|
+
* to these names.
|
|
548
|
+
*/
|
|
549
|
+
async getReferenceSequenceNames(e = {}) {
|
|
550
|
+
return (await this.getMetadata(e)).refIdToName;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* @param {object} metadata metadata object from the parsed index,
|
|
554
|
+
* containing columnNumbers, metaChar, and format
|
|
555
|
+
* @param {string} regionRefName
|
|
556
|
+
* @param {number} regionStart region start coordinate (0-based-half-open)
|
|
557
|
+
* @param {number} regionEnd region end coordinate (0-based-half-open)
|
|
558
|
+
* @param {array[string]} line
|
|
559
|
+
* @returns {object} like `{startCoordinate, overlaps}`. overlaps is boolean,
|
|
560
|
+
* true if line is a data line that overlaps the given region
|
|
561
|
+
*/
|
|
562
|
+
checkLine(e, t, n, r, i) {
|
|
563
|
+
const { columnNumbers: o, metaChar: s, coordinateType: u, format: c } = e;
|
|
564
|
+
if (i.charAt(0) === s)
|
|
565
|
+
return { overlaps: !1 };
|
|
566
|
+
let { ref: h, start: f, end: l } = o;
|
|
567
|
+
h || (h = 0), f || (f = 0), l || (l = 0), c === "VCF" && (l = 8);
|
|
568
|
+
const I = Math.max(h, f, l);
|
|
569
|
+
let x = 1, w = 0, b = "", m = -1 / 0;
|
|
570
|
+
for (let p = 0; p < i.length + 1; p += 1)
|
|
571
|
+
if (i[p] === " " || p === i.length) {
|
|
572
|
+
if (x === h) {
|
|
573
|
+
if (this.renameRefSeq(i.slice(w, p)) !== t)
|
|
574
|
+
return { overlaps: !1 };
|
|
575
|
+
} else if (x === f) {
|
|
576
|
+
if (m = parseInt(i.slice(w, p), 10), u === "1-based-closed" && (m -= 1), m >= r)
|
|
577
|
+
return { startCoordinate: m, overlaps: !1 };
|
|
578
|
+
if ((l === 0 || l === f) && m + 1 <= n)
|
|
579
|
+
return { startCoordinate: m, overlaps: !1 };
|
|
580
|
+
} else if (c === "VCF" && x === 4)
|
|
581
|
+
b = i.slice(w, p);
|
|
582
|
+
else if (x === l) {
|
|
583
|
+
let d;
|
|
584
|
+
if (c === "VCF" ? d = this._getVcfEnd(m, b, i.slice(w, p)) : d = parseInt(i.slice(w, p), 10), d <= n)
|
|
585
|
+
return { overlaps: !1 };
|
|
586
|
+
}
|
|
587
|
+
if (w = p + 1, x += 1, x > I)
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
return { startCoordinate: m, overlaps: !0 };
|
|
591
|
+
}
|
|
592
|
+
_getVcfEnd(e, t, n) {
|
|
593
|
+
let r = e + t.length;
|
|
594
|
+
const i = n.indexOf("SVTYPE=TRA") !== -1;
|
|
595
|
+
if (n[0] !== "." && !i) {
|
|
596
|
+
let o = ";";
|
|
597
|
+
for (let s = 0; s < n.length; s += 1) {
|
|
598
|
+
if (o === ";" && n.slice(s, s + 4) === "END=") {
|
|
599
|
+
let u = n.indexOf(";", s);
|
|
600
|
+
u === -1 && (u = n.length), r = parseInt(n.slice(s + 4, u), 10);
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
o = n[s];
|
|
604
|
+
}
|
|
605
|
+
} else if (i)
|
|
606
|
+
return e + 1;
|
|
607
|
+
return r;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* return the approximate number of data lines in the given reference sequence
|
|
611
|
+
* @param refSeq reference sequence name
|
|
612
|
+
* @returns number of data lines present on that reference sequence
|
|
613
|
+
*/
|
|
614
|
+
async lineCount(e, t = {}) {
|
|
615
|
+
return this.index.lineCount(e, t);
|
|
616
|
+
}
|
|
617
|
+
async _readRegion(e, t, n = {}) {
|
|
618
|
+
const r = Buffer.alloc(t), { bytesRead: i, buffer: o } = await this.filehandle.read(r, 0, t, e, n);
|
|
619
|
+
return o.slice(0, i);
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* read and uncompress the data in a chunk (composed of one or more
|
|
623
|
+
* contiguous bgzip blocks) of the file
|
|
624
|
+
*/
|
|
625
|
+
async readChunk(e, t = {}) {
|
|
626
|
+
const n = await this._readRegion(e.minv.blockPosition, e.fetchedSize(), t);
|
|
627
|
+
try {
|
|
628
|
+
return Q(n, e);
|
|
629
|
+
} catch (r) {
|
|
630
|
+
throw new Error(`error decompressing c ${e.toString()} ${r}`);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
export {
|
|
635
|
+
U as CSI,
|
|
636
|
+
A as TBI,
|
|
637
|
+
fe as TabixIndexedFile
|
|
638
|
+
};
|