loom-browser 0.0.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/LICENSE +21 -0
- package/README.md +287 -0
- package/dist/igv.d.ts +667 -0
- package/dist/igv.esm.js +76708 -0
- package/dist/igv.esm.min.js +26 -0
- package/dist/igv.esm.min.js.map +1 -0
- package/dist/igv.js +76716 -0
- package/dist/igv.min.js +26 -0
- package/dist/igv.min.js.map +1 -0
- package/dist/loom.d.ts +667 -0
- package/dist/loom.esm.js +14927 -0
- package/dist/loom.esm.min.js +2 -0
- package/dist/loom.esm.min.js.map +1 -0
- package/dist/loom.js +15114 -0
- package/dist/loom.min.js +2 -0
- package/dist/loom.min.js.map +1 -0
- package/dist/types/agent/index.d.ts +4 -0
- package/dist/types/agent/stateProjection.d.ts +115 -0
- package/dist/types/agent/trackSelector.d.ts +31 -0
- package/dist/types/baseTrackCanvas.d.ts +62 -0
- package/dist/types/bigwig/binaryParser.d.ts +25 -0
- package/dist/types/bigwig/bpTree.d.ts +40 -0
- package/dist/types/bigwig/bwReader.d.ts +69 -0
- package/dist/types/bigwig/chromTree.d.ts +28 -0
- package/dist/types/bigwig/index.d.ts +66 -0
- package/dist/types/bigwig/inflate.d.ts +9 -0
- package/dist/types/bigwig/rangeReader.d.ts +48 -0
- package/dist/types/bigwig/rpTree.d.ts +27 -0
- package/dist/types/canvasProvider.d.ts +36 -0
- package/dist/types/commandDispatcher.d.ts +199 -0
- package/dist/types/contextMenu.d.ts +64 -0
- package/dist/types/contextMenuProvider.d.ts +25 -0
- package/dist/types/data/cachedSequence.d.ts +19 -0
- package/dist/types/data/ucscApi.d.ts +21 -0
- package/dist/types/data/ucscSequence.d.ts +19 -0
- package/dist/types/dataLifecycle.d.ts +16 -0
- package/dist/types/dataSources/bigWigDataSource.d.ts +24 -0
- package/dist/types/dataSources/dataSourceCacheKey.d.ts +9 -0
- package/dist/types/dataSources/dynseqDataSource.d.ts +20 -0
- package/dist/types/dataSources/featureSourceFactory.d.ts +46 -0
- package/dist/types/dataSources/geneDataSource.d.ts +16 -0
- package/dist/types/dataSources/gtxDataSource.d.ts +42 -0
- package/dist/types/dataSources/sequenceDataSource.d.ts +15 -0
- package/dist/types/dataSources/textFeatureSource.d.ts +63 -0
- package/dist/types/decode/bed.d.ts +64 -0
- package/dist/types/decode/bedpe.d.ts +36 -0
- package/dist/types/decode/exonUtils.d.ts +29 -0
- package/dist/types/decode/gff.d.ts +58 -0
- package/dist/types/decode/interact.d.ts +19 -0
- package/dist/types/decode/ucsc.d.ts +56 -0
- package/dist/types/dynseqRenderer.d.ts +37 -0
- package/dist/types/events.d.ts +23 -0
- package/dist/types/export/canvas2svg.d.ts +166 -0
- package/dist/types/export/index.d.ts +2 -0
- package/dist/types/featureCache.d.ts +69 -0
- package/dist/types/formats/featureParser.d.ts +72 -0
- package/dist/types/formats/formatDetection.d.ts +46 -0
- package/dist/types/geneRenderer.d.ts +17 -0
- package/dist/types/geneThemes.d.ts +11 -0
- package/dist/types/geneTrackCanvas.d.ts +46 -0
- package/dist/types/genome/chromAlias.d.ts +46 -0
- package/dist/types/genome/chromSizes.d.ts +53 -0
- package/dist/types/genome/genome.d.ts +51 -0
- package/dist/types/genomeBrowser.d.ts +189 -0
- package/dist/types/gtx/fetchCoordinator.d.ts +34 -0
- package/dist/types/gtx/gtxReader.d.ts +144 -0
- package/dist/types/gtx/index.d.ts +40 -0
- package/dist/types/gtx/zstdWasm.d.ts +22 -0
- package/dist/types/headlessGenomeBrowser.d.ts +450 -0
- package/dist/types/index.d.ts +123 -0
- package/dist/types/intervalTree.d.ts +56 -0
- package/dist/types/io/binaryParser.d.ts +25 -0
- package/dist/types/io/index.d.ts +7 -0
- package/dist/types/io/rangeReader.d.ts +48 -0
- package/dist/types/locusUtils.d.ts +37 -0
- package/dist/types/pack.d.ts +41 -0
- package/dist/types/popupProvider.d.ts +22 -0
- package/dist/types/remoteProtocol.d.ts +79 -0
- package/dist/types/renderTheme.d.ts +72 -0
- package/dist/types/renderThemePresets.d.ts +16 -0
- package/dist/types/roi/index.d.ts +3 -0
- package/dist/types/roi/roiRenderer.d.ts +24 -0
- package/dist/types/roi/roiSet.d.ts +41 -0
- package/dist/types/rulerRenderer.d.ts +14 -0
- package/dist/types/rulerTrackCanvas.d.ts +32 -0
- package/dist/types/sequence/sequenceUtils.d.ts +44 -0
- package/dist/types/session.d.ts +55 -0
- package/dist/types/src/bigwig/index.d.ts +66 -0
- package/dist/types/src/canvasProvider.d.ts +36 -0
- package/dist/types/src/commandDispatcher.d.ts +220 -0
- package/dist/types/src/contextMenu.d.ts +64 -0
- package/dist/types/src/contextMenuProvider.d.ts +25 -0
- package/dist/types/src/data/cachedSequence.d.ts +19 -0
- package/dist/types/src/data/ucscApi.d.ts +21 -0
- package/dist/types/src/data/ucscSequence.d.ts +19 -0
- package/dist/types/src/dataLifecycle.d.ts +16 -0
- package/dist/types/src/dataSources/bigWigDataSource.d.ts +24 -0
- package/dist/types/src/dataSources/dataSourceCacheKey.d.ts +9 -0
- package/dist/types/src/dataSources/featureSourceFactory.d.ts +46 -0
- package/dist/types/src/dataSources/geneDataSource.d.ts +16 -0
- package/dist/types/src/dataSources/gtxDataSource.d.ts +42 -0
- package/dist/types/src/dataSources/sequenceDataSource.d.ts +15 -0
- package/dist/types/src/dataSources/textFeatureSource.d.ts +63 -0
- package/dist/types/src/decode/bed.d.ts +64 -0
- package/dist/types/src/decode/bedpe.d.ts +36 -0
- package/dist/types/src/decode/exonUtils.d.ts +29 -0
- package/dist/types/src/decode/gff.d.ts +58 -0
- package/dist/types/src/decode/interact.d.ts +19 -0
- package/dist/types/src/decode/ucsc.d.ts +56 -0
- package/dist/types/src/events.d.ts +23 -0
- package/dist/types/src/export/canvas2svg.d.ts +166 -0
- package/dist/types/src/export/index.d.ts +2 -0
- package/dist/types/src/featureCache.d.ts +69 -0
- package/dist/types/src/formats/featureParser.d.ts +72 -0
- package/dist/types/src/formats/formatDetection.d.ts +46 -0
- package/dist/types/src/genome/chromAlias.d.ts +46 -0
- package/dist/types/src/genome/chromSizes.d.ts +53 -0
- package/dist/types/src/genome/genome.d.ts +51 -0
- package/dist/types/src/genomeBrowser.d.ts +189 -0
- package/dist/types/src/gtx/fetchCoordinator.d.ts +34 -0
- package/dist/types/src/gtx/gtxReader.d.ts +144 -0
- package/dist/types/src/gtx/index.d.ts +40 -0
- package/dist/types/src/gtx/zstdWasm.d.ts +22 -0
- package/dist/types/src/headlessGenomeBrowser.d.ts +450 -0
- package/dist/types/src/index.d.ts +123 -0
- package/dist/types/src/intervalTree.d.ts +56 -0
- package/dist/types/src/io/binaryParser.d.ts +25 -0
- package/dist/types/src/io/index.d.ts +7 -0
- package/dist/types/src/io/rangeReader.d.ts +48 -0
- package/dist/types/src/locusUtils.d.ts +37 -0
- package/dist/types/src/pack.d.ts +41 -0
- package/dist/types/src/popupProvider.d.ts +22 -0
- package/dist/types/src/remoteProtocol.d.ts +81 -0
- package/dist/types/src/roi/index.d.ts +3 -0
- package/dist/types/src/roi/roiRenderer.d.ts +24 -0
- package/dist/types/src/roi/roiSet.d.ts +41 -0
- package/dist/types/src/sequence/sequenceUtils.d.ts +44 -0
- package/dist/types/src/session.d.ts +55 -0
- package/dist/types/src/stateProjection.d.ts +115 -0
- package/dist/types/src/tabix/index.d.ts +48 -0
- package/dist/types/src/themes/index.d.ts +3 -0
- package/dist/types/src/themes/renderTheme.d.ts +86 -0
- package/dist/types/src/themes/renderThemePresets.d.ts +16 -0
- package/dist/types/src/trackRegistry.d.ts +81 -0
- package/dist/types/src/trackSelector.d.ts +31 -0
- package/dist/types/src/tracks/annotation/annotationRenderer.d.ts +17 -0
- package/dist/types/src/tracks/annotation/annotationThemes.d.ts +11 -0
- package/dist/types/src/tracks/annotation/annotationTrackCanvas.d.ts +58 -0
- package/dist/types/src/tracks/annotation/index.d.ts +4 -0
- package/dist/types/src/tracks/axis/axisRenderer.d.ts +19 -0
- package/dist/types/src/tracks/axis/index.d.ts +1 -0
- package/dist/types/src/tracks/baseTrackCanvas.d.ts +113 -0
- package/dist/types/src/tracks/dynseq/dynseqRenderer.d.ts +38 -0
- package/dist/types/src/tracks/dynseq/index.d.ts +1 -0
- package/dist/types/src/tracks/index.d.ts +7 -0
- package/dist/types/src/tracks/interaction/index.d.ts +4 -0
- package/dist/types/src/tracks/interaction/interactionRenderer.d.ts +52 -0
- package/dist/types/src/tracks/interaction/interactionTrackCanvas.d.ts +54 -0
- package/dist/types/src/tracks/ruler/index.d.ts +3 -0
- package/dist/types/src/tracks/ruler/rulerRenderer.d.ts +25 -0
- package/dist/types/src/tracks/ruler/rulerTrackCanvas.d.ts +43 -0
- package/dist/types/src/tracks/sequence/index.d.ts +5 -0
- package/dist/types/src/tracks/sequence/sequenceRenderer.d.ts +34 -0
- package/dist/types/src/tracks/sequence/sequenceThemes.d.ts +11 -0
- package/dist/types/src/tracks/sequence/sequenceTrackCanvas.d.ts +67 -0
- package/dist/types/src/tracks/wig/index.d.ts +5 -0
- package/dist/types/src/tracks/wig/wigRenderer.d.ts +15 -0
- package/dist/types/src/tracks/wig/wigSummary.d.ts +31 -0
- package/dist/types/src/tracks/wig/wigThemes.d.ts +15 -0
- package/dist/types/src/tracks/wig/wigTrackCanvas.d.ts +82 -0
- package/dist/types/src/types.d.ts +885 -0
- package/dist/types/src/ui/components/LoomBrowserShell.d.ts +52 -0
- package/dist/types/src/ui/components/LoomChromosomeSelect.d.ts +18 -0
- package/dist/types/src/ui/components/LoomContextMenu.d.ts +39 -0
- package/dist/types/src/ui/components/LoomExportControls.d.ts +13 -0
- package/dist/types/src/ui/components/LoomInputDialog.d.ts +27 -0
- package/dist/types/src/ui/components/LoomLocusInput.d.ts +18 -0
- package/dist/types/src/ui/components/LoomNavbar.d.ts +15 -0
- package/dist/types/src/ui/components/LoomPopup.d.ts +32 -0
- package/dist/types/src/ui/components/LoomWindowSize.d.ts +14 -0
- package/dist/types/src/ui/components/LoomZoomControls.d.ts +10 -0
- package/dist/types/src/ui/index.d.ts +21 -0
- package/dist/types/src/ui/themes.d.ts +14 -0
- package/dist/types/src/worker/nodeWorkerProvider.d.ts +28 -0
- package/dist/types/src/worker/taskHandler.d.ts +15 -0
- package/dist/types/src/worker/webWorkerProvider.d.ts +51 -0
- package/dist/types/src/worker/workerScript.d.ts +11 -0
- package/dist/types/src/workerProvider.d.ts +76 -0
- package/dist/types/stateProjection.d.ts +115 -0
- package/dist/types/tabix/bgzBlockLoader.d.ts +60 -0
- package/dist/types/tabix/bgzf.d.ts +43 -0
- package/dist/types/tabix/index.d.ts +48 -0
- package/dist/types/tabix/tabixIndex.d.ts +85 -0
- package/dist/types/tabix/tabixReader.d.ts +60 -0
- package/dist/types/tabix/virtualOffset.d.ts +41 -0
- package/dist/types/test/src/mockCanvasProvider.d.ts +67 -0
- package/dist/types/test/src/testBedDecode.d.ts +1 -0
- package/dist/types/test/src/testCanvas2SVG.d.ts +7 -0
- package/dist/types/test/src/testChromAlias.d.ts +1 -0
- package/dist/types/test/src/testCommandDispatcher.d.ts +1 -0
- package/dist/types/test/src/testData.d.ts +7 -0
- package/dist/types/test/src/testDataLifecycle.d.ts +1 -0
- package/dist/types/test/src/testDataSourceCacheKey.d.ts +1 -0
- package/dist/types/test/src/testDataSources.d.ts +5 -0
- package/dist/types/test/src/testDecodeUcsc.d.ts +1 -0
- package/dist/types/test/src/testEvents.d.ts +1 -0
- package/dist/types/test/src/testFeatureCache.d.ts +1 -0
- package/dist/types/test/src/testFeatureParser.d.ts +1 -0
- package/dist/types/test/src/testFormatDetection.d.ts +1 -0
- package/dist/types/test/src/testGffDecode.d.ts +1 -0
- package/dist/types/test/src/testHeadlessBrowser.d.ts +1 -0
- package/dist/types/test/src/testInteractionDecoder.d.ts +1 -0
- package/dist/types/test/src/testIntervalTree.d.ts +1 -0
- package/dist/types/test/src/testLocusUtils.d.ts +1 -0
- package/dist/types/test/src/testPack.d.ts +1 -0
- package/dist/types/test/src/testROI.d.ts +1 -0
- package/dist/types/test/src/testRemoteProtocol.d.ts +1 -0
- package/dist/types/test/src/testRenderTheme.d.ts +1 -0
- package/dist/types/test/src/testSVGExport.d.ts +5 -0
- package/dist/types/test/src/testSequence.d.ts +1 -0
- package/dist/types/test/src/testSession.d.ts +1 -0
- package/dist/types/test/src/testTrackSelector.d.ts +1 -0
- package/dist/types/test/src/testTrackSerialize.d.ts +1 -0
- package/dist/types/test/src/testWigSummary.d.ts +1 -0
- package/dist/types/test/src/testWorkerDispatch.d.ts +9 -0
- package/dist/types/themes/index.d.ts +3 -0
- package/dist/types/themes/renderTheme.d.ts +86 -0
- package/dist/types/themes/renderThemePresets.d.ts +16 -0
- package/dist/types/trackRegistry.d.ts +81 -0
- package/dist/types/trackSelector.d.ts +31 -0
- package/dist/types/tracks/annotation/annotationRenderer.d.ts +17 -0
- package/dist/types/tracks/annotation/annotationThemes.d.ts +11 -0
- package/dist/types/tracks/annotation/annotationTrackCanvas.d.ts +58 -0
- package/dist/types/tracks/annotation/index.d.ts +4 -0
- package/dist/types/tracks/axis/axisRenderer.d.ts +19 -0
- package/dist/types/tracks/axis/index.d.ts +1 -0
- package/dist/types/tracks/baseTrackCanvas.d.ts +113 -0
- package/dist/types/tracks/dynseq/dynseqRenderer.d.ts +38 -0
- package/dist/types/tracks/dynseq/index.d.ts +1 -0
- package/dist/types/tracks/gene/geneRenderer.d.ts +17 -0
- package/dist/types/tracks/gene/geneThemes.d.ts +11 -0
- package/dist/types/tracks/gene/geneTrackCanvas.d.ts +58 -0
- package/dist/types/tracks/gene/index.d.ts +4 -0
- package/dist/types/tracks/index.d.ts +7 -0
- package/dist/types/tracks/interaction/index.d.ts +4 -0
- package/dist/types/tracks/interaction/interactionRenderer.d.ts +52 -0
- package/dist/types/tracks/interaction/interactionTrackCanvas.d.ts +54 -0
- package/dist/types/tracks/ruler/index.d.ts +3 -0
- package/dist/types/tracks/ruler/rulerRenderer.d.ts +25 -0
- package/dist/types/tracks/ruler/rulerTrackCanvas.d.ts +43 -0
- package/dist/types/tracks/sequence/index.d.ts +5 -0
- package/dist/types/tracks/sequence/sequenceRenderer.d.ts +34 -0
- package/dist/types/tracks/sequence/sequenceThemes.d.ts +11 -0
- package/dist/types/tracks/sequence/sequenceTrackCanvas.d.ts +67 -0
- package/dist/types/tracks/wig/index.d.ts +5 -0
- package/dist/types/tracks/wig/wigRenderer.d.ts +15 -0
- package/dist/types/tracks/wig/wigSummary.d.ts +31 -0
- package/dist/types/tracks/wig/wigThemes.d.ts +15 -0
- package/dist/types/tracks/wig/wigTrackCanvas.d.ts +82 -0
- package/dist/types/types.d.ts +885 -0
- package/dist/types/ui/components/IgvBrowserShell.d.ts +52 -0
- package/dist/types/ui/components/IgvChromosomeSelect.d.ts +18 -0
- package/dist/types/ui/components/IgvExportControls.d.ts +13 -0
- package/dist/types/ui/components/IgvLocusInput.d.ts +18 -0
- package/dist/types/ui/components/IgvNavbar.d.ts +15 -0
- package/dist/types/ui/components/IgvWindowSize.d.ts +14 -0
- package/dist/types/ui/components/IgvZoomControls.d.ts +10 -0
- package/dist/types/ui/components/LoomBrowserShell.d.ts +52 -0
- package/dist/types/ui/components/LoomChromosomeSelect.d.ts +18 -0
- package/dist/types/ui/components/LoomContextMenu.d.ts +39 -0
- package/dist/types/ui/components/LoomExportControls.d.ts +13 -0
- package/dist/types/ui/components/LoomInputDialog.d.ts +27 -0
- package/dist/types/ui/components/LoomLocusInput.d.ts +18 -0
- package/dist/types/ui/components/LoomNavbar.d.ts +15 -0
- package/dist/types/ui/components/LoomPopup.d.ts +32 -0
- package/dist/types/ui/components/LoomWindowSize.d.ts +14 -0
- package/dist/types/ui/components/LoomZoomControls.d.ts +10 -0
- package/dist/types/ui/index.d.ts +21 -0
- package/dist/types/ui/themes.d.ts +14 -0
- package/dist/types/wigRenderer.d.ts +15 -0
- package/dist/types/wigSummary.d.ts +31 -0
- package/dist/types/wigThemes.d.ts +15 -0
- package/dist/types/wigTrackCanvas.d.ts +46 -0
- package/dist/types/worker/decodeWig.d.ts +20 -0
- package/dist/types/worker/nodeWorkerProvider.d.ts +28 -0
- package/dist/types/worker/taskHandler.d.ts +15 -0
- package/dist/types/worker/webWorkerProvider.d.ts +51 -0
- package/dist/types/worker/workerScript.d.ts +11 -0
- package/dist/types/workerProvider.d.ts +76 -0
- package/package.json +102 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BGZF (Block GZipped Format) detection and decompression.
|
|
3
|
+
*
|
|
4
|
+
* BGZF is a variant of gzip that stores data in independently compressed
|
|
5
|
+
* blocks, enabling random access. Each block has a standard gzip header
|
|
6
|
+
* with a BGZF-specific extra field encoding the block size.
|
|
7
|
+
*
|
|
8
|
+
* Uses pako.inflateRaw() for synchronous decompression — matching igv.js
|
|
9
|
+
* which uses the same library via igv-utils. No async overhead, no stream
|
|
10
|
+
* setup per block.
|
|
11
|
+
*
|
|
12
|
+
* Port of js/bam/bgzBlockLoader.ts inflateBlocks() and
|
|
13
|
+
* igv-utils/bgzf.js unbgzf().
|
|
14
|
+
*
|
|
15
|
+
* Layer 1 (Data + Layout): pure data, no DOM.
|
|
16
|
+
*/
|
|
17
|
+
/** Check if data starts with BGZF magic (gzip header + BGZF extra field). */
|
|
18
|
+
export declare function isBgzf(data: ArrayBuffer | Uint8Array): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Read BGZF block size from header bytes 16-17.
|
|
21
|
+
* Returns total block size in bytes (bsize field + 1).
|
|
22
|
+
*/
|
|
23
|
+
export declare function bgzBlockSize(data: ArrayBuffer | Uint8Array): number;
|
|
24
|
+
/**
|
|
25
|
+
* Decompress all concatenated BGZF blocks in a buffer.
|
|
26
|
+
*
|
|
27
|
+
* Returns array of decompressed blocks (one Uint8Array per BGZF block).
|
|
28
|
+
* Optionally decompresses only blocks starting between startBlock and endBlock
|
|
29
|
+
* (byte offsets relative to beginning of data buffer).
|
|
30
|
+
*
|
|
31
|
+
* Uses synchronous pako.inflateRaw() per block — no async overhead.
|
|
32
|
+
* Matches igv.js inflateBlocks() which uses the same synchronous approach.
|
|
33
|
+
*
|
|
34
|
+
* Port of js/bam/bgzBlockLoader.ts inflateBlocks().
|
|
35
|
+
*/
|
|
36
|
+
export declare function inflateBgzfBlocks(data: ArrayBuffer, startBlock?: number, endBlock?: number): Uint8Array[];
|
|
37
|
+
/**
|
|
38
|
+
* Decompress entire BGZF buffer into a single concatenated Uint8Array.
|
|
39
|
+
* Used for decompressing .tbi index files.
|
|
40
|
+
*
|
|
41
|
+
* Port of igv-utils/bgzf.js unbgzf().
|
|
42
|
+
*/
|
|
43
|
+
export declare function unbgzf(data: ArrayBuffer): Uint8Array;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabix/BGZF reader — public API.
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper around @gmod/tabix that preserves the existing public API.
|
|
5
|
+
* All BGZF decompression, index parsing, and block fetching is handled
|
|
6
|
+
* by @gmod/tabix internally.
|
|
7
|
+
*/
|
|
8
|
+
import type { WorkerProvider } from '../workerProvider';
|
|
9
|
+
export interface TabixReaderOptions {
|
|
10
|
+
/** URL to the .tbi index file. Defaults to `url + '.tbi'`. */
|
|
11
|
+
indexUrl?: string;
|
|
12
|
+
/** @deprecated Worker dispatch is handled internally by @gmod/tabix. */
|
|
13
|
+
workerProvider?: WorkerProvider;
|
|
14
|
+
}
|
|
15
|
+
export interface TabixHeader {
|
|
16
|
+
nref: number;
|
|
17
|
+
format: number;
|
|
18
|
+
colSeq: number;
|
|
19
|
+
colBeg: number;
|
|
20
|
+
colEnd: number;
|
|
21
|
+
meta: number;
|
|
22
|
+
skip: number;
|
|
23
|
+
sequenceNames: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Thin wrapper around @gmod/tabix TabixIndexedFile that preserves the legacy API.
|
|
27
|
+
*/
|
|
28
|
+
export declare class TabixReader {
|
|
29
|
+
private readonly tabix;
|
|
30
|
+
constructor(url: string, options?: TabixReaderOptions);
|
|
31
|
+
/** Get the tabix header metadata. */
|
|
32
|
+
getHeader(signal?: AbortSignal): Promise<TabixHeader>;
|
|
33
|
+
/** Get sequence names from the index. */
|
|
34
|
+
getSequenceNames(signal?: AbortSignal): Promise<string[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Read header lines from the beginning of the BGZF data file.
|
|
37
|
+
* Returns lines that start with the meta character (e.g. '#' for VCF).
|
|
38
|
+
*/
|
|
39
|
+
readHeaderLines(signal?: AbortSignal): Promise<string[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Read all text lines overlapping a genomic range.
|
|
42
|
+
*
|
|
43
|
+
* @param chr - Chromosome/sequence name
|
|
44
|
+
* @param start - Start position (0-based)
|
|
45
|
+
* @param end - End position (exclusive)
|
|
46
|
+
*/
|
|
47
|
+
readLines(chr: string, start: number, end: number, signal?: AbortSignal): Promise<string[]>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabix (.tbi) index parser and range query engine.
|
|
3
|
+
*
|
|
4
|
+
* Parses the binary .tbi format (a BGZF-compressed index for tab-delimited
|
|
5
|
+
* genomic files) and provides efficient range queries via hierarchical binning.
|
|
6
|
+
*
|
|
7
|
+
* Port of js/bam/bamIndex.ts (tabix path) and js/bam/indexUtils.ts.
|
|
8
|
+
* Layer 1 (Data + Layout): pure data, no DOM.
|
|
9
|
+
*/
|
|
10
|
+
import type { VirtualOffset, Chunk } from './virtualOffset';
|
|
11
|
+
/** Tabix format codes (from spec). */
|
|
12
|
+
export declare const enum TabixFormat {
|
|
13
|
+
BED = 0,// 0-based half-open
|
|
14
|
+
SAM = 1,// 1-based
|
|
15
|
+
VCF = 2
|
|
16
|
+
}
|
|
17
|
+
/** Parsed tabix header metadata. */
|
|
18
|
+
export interface TabixHeader {
|
|
19
|
+
/** Number of reference sequences. */
|
|
20
|
+
nref: number;
|
|
21
|
+
/** Format code: 0=BED, 1=SAM, 2=VCF/GFF. */
|
|
22
|
+
format: TabixFormat;
|
|
23
|
+
/** 1-based column index for sequence name. */
|
|
24
|
+
colSeq: number;
|
|
25
|
+
/** 1-based column index for start position. */
|
|
26
|
+
colBeg: number;
|
|
27
|
+
/** 1-based column index for end position (0 = compute from start). */
|
|
28
|
+
colEnd: number;
|
|
29
|
+
/** ASCII code of meta character (lines starting with this are skipped, e.g. 35='#'). */
|
|
30
|
+
meta: number;
|
|
31
|
+
/** Number of header lines to skip before data. */
|
|
32
|
+
skip: number;
|
|
33
|
+
/** Sequence names in index order. */
|
|
34
|
+
sequenceNames: string[];
|
|
35
|
+
}
|
|
36
|
+
interface BinIndex {
|
|
37
|
+
[binNumber: number]: Chunk[];
|
|
38
|
+
}
|
|
39
|
+
interface RefIndex {
|
|
40
|
+
binIndex: BinIndex;
|
|
41
|
+
linearIndex: (VirtualOffset | null)[];
|
|
42
|
+
}
|
|
43
|
+
/** Parsed tabix index with range query support. */
|
|
44
|
+
export interface TabixIndex {
|
|
45
|
+
header: TabixHeader;
|
|
46
|
+
/** Map from sequence name to reference index (0-based). */
|
|
47
|
+
sequenceIndexMap: Record<string, number>;
|
|
48
|
+
/** Per-reference bin + linear indices. */
|
|
49
|
+
indices: (RefIndex | undefined)[];
|
|
50
|
+
/** Byte offset of first data block in the BGZF file. */
|
|
51
|
+
firstBlockPosition: number;
|
|
52
|
+
/** Byte offset of last data block in the BGZF file. */
|
|
53
|
+
lastBlockPosition: number;
|
|
54
|
+
/** Get chunks overlapping a genomic range. */
|
|
55
|
+
chunksForRange(refId: number, min: number, max: number): Chunk[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Parse a decompressed .tbi binary buffer into a TabixIndex.
|
|
59
|
+
*
|
|
60
|
+
* The .tbi file is BGZF-compressed; caller must decompress with unbgzf() first.
|
|
61
|
+
* Binary format mirrors BAI but with an extra header for column metadata and
|
|
62
|
+
* sequence names.
|
|
63
|
+
*
|
|
64
|
+
* Port of js/bam/bamIndex.ts BamIndex.parse() with tabix=true.
|
|
65
|
+
*/
|
|
66
|
+
export declare function parseTabixIndex(data: ArrayBuffer): TabixIndex;
|
|
67
|
+
/**
|
|
68
|
+
* Calculate the list of bin ranges that overlap with region [beg, end).
|
|
69
|
+
* Uses the standard 5-level hierarchical binning scheme (same as BAI).
|
|
70
|
+
*
|
|
71
|
+
* Returns array of [startBin, endBin] inclusive ranges.
|
|
72
|
+
*
|
|
73
|
+
* Port of js/bam/bamIndex.ts reg2bins().
|
|
74
|
+
*/
|
|
75
|
+
export declare function reg2bins(beg: number, end: number): number[][];
|
|
76
|
+
/**
|
|
77
|
+
* Sort chunks by position, filter by linear index minimum, merge adjacent chunks.
|
|
78
|
+
*
|
|
79
|
+
* Merge criteria (from igv.js): gap between chunks < 65KB and total span < 5MB.
|
|
80
|
+
* This reduces the number of HTTP range requests.
|
|
81
|
+
*
|
|
82
|
+
* Port of js/bam/indexUtils.ts optimizeChunks().
|
|
83
|
+
*/
|
|
84
|
+
export declare function optimizeChunks(chunks: Chunk[], lowest?: VirtualOffset): Chunk[];
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabix file reader — top-level API for querying BGZF-compressed,
|
|
3
|
+
* tabix-indexed genomic files.
|
|
4
|
+
*
|
|
5
|
+
* Combines index loading, BGZF block fetching, and line extraction to
|
|
6
|
+
* return raw text lines for a genomic range. Format-specific parsing
|
|
7
|
+
* (BED→features, VCF→variants, GFF→annotations) is a separate concern
|
|
8
|
+
* (Infrastructure Gap #7).
|
|
9
|
+
*
|
|
10
|
+
* Port of js/feature/featureFileReader.ts (tabix path).
|
|
11
|
+
* Layer 1 (Data + Layout): pure data, no DOM.
|
|
12
|
+
*/
|
|
13
|
+
import type { TabixIndex, TabixHeader } from './tabixIndex';
|
|
14
|
+
import type { WorkerProvider } from '../workerProvider';
|
|
15
|
+
export interface TabixReaderOptions {
|
|
16
|
+
/** URL to the .tbi index file. Defaults to `url + '.tbi'`. */
|
|
17
|
+
indexUrl?: string;
|
|
18
|
+
/** Worker provider for offloading BGZF decompression. */
|
|
19
|
+
workerProvider?: WorkerProvider;
|
|
20
|
+
}
|
|
21
|
+
export declare class TabixReader {
|
|
22
|
+
private readonly url;
|
|
23
|
+
private readonly indexUrl;
|
|
24
|
+
private readonly blockLoader;
|
|
25
|
+
private readonly workerProvider?;
|
|
26
|
+
private _index;
|
|
27
|
+
constructor(url: string, options?: TabixReaderOptions);
|
|
28
|
+
/**
|
|
29
|
+
* Lazy-load and cache the tabix index.
|
|
30
|
+
* Fetches the entire .tbi file, decompresses (BGZF), and parses the binary index.
|
|
31
|
+
*/
|
|
32
|
+
getIndex(signal?: AbortSignal): Promise<TabixIndex>;
|
|
33
|
+
/** Get the tabix header metadata (format, column indices, meta char, skip count). */
|
|
34
|
+
getHeader(signal?: AbortSignal): Promise<TabixHeader>;
|
|
35
|
+
/** Get sequence names from the index. */
|
|
36
|
+
getSequenceNames(signal?: AbortSignal): Promise<string[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Read header lines from the beginning of the BGZF data file.
|
|
39
|
+
*
|
|
40
|
+
* Returns lines that start with the meta character (e.g. '#' for VCF)
|
|
41
|
+
* or are within the skip count declared in the index header.
|
|
42
|
+
*/
|
|
43
|
+
readHeaderLines(signal?: AbortSignal): Promise<string[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Read all text lines overlapping a genomic range.
|
|
46
|
+
*
|
|
47
|
+
* Returns raw tab-delimited lines (not parsed). The caller is responsible
|
|
48
|
+
* for format-specific parsing (BED, VCF, GFF, etc.).
|
|
49
|
+
*
|
|
50
|
+
* @param chr - Chromosome/sequence name (must match the name in the index)
|
|
51
|
+
* @param start - Start position (0-based)
|
|
52
|
+
* @param end - End position (exclusive)
|
|
53
|
+
*/
|
|
54
|
+
readLines(chr: string, start: number, end: number, signal?: AbortSignal): Promise<string[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Parse a position value from a token array.
|
|
57
|
+
* BED format (format=0) is 0-based; VCF/GFF (format=2) and SAM (format=1) are 1-based.
|
|
58
|
+
*/
|
|
59
|
+
private parsePosition;
|
|
60
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BGZF virtual file offsets.
|
|
3
|
+
*
|
|
4
|
+
* A virtual offset is a 64-bit value encoding both the position of a
|
|
5
|
+
* compressed BGZF block in the file and the byte offset within the
|
|
6
|
+
* decompressed block. Used by tabix (.tbi) and BAI (.bai) indices.
|
|
7
|
+
*
|
|
8
|
+
* Port of js/binary.ts VPointer class, reimplemented as plain interfaces
|
|
9
|
+
* + pure functions (matching src/ conventions).
|
|
10
|
+
*/
|
|
11
|
+
import type { BinaryParser } from '../bigwig/binaryParser';
|
|
12
|
+
/** A BGZF virtual file offset: compressed block position + offset within decompressed block. */
|
|
13
|
+
export interface VirtualOffset {
|
|
14
|
+
/** Byte offset of the BGZF block start in the compressed file. */
|
|
15
|
+
block: number;
|
|
16
|
+
/** Byte offset within the decompressed block. */
|
|
17
|
+
offset: number;
|
|
18
|
+
}
|
|
19
|
+
/** A span of data in a BGZF file between two virtual offsets. */
|
|
20
|
+
export interface Chunk {
|
|
21
|
+
minv: VirtualOffset;
|
|
22
|
+
maxv: VirtualOffset;
|
|
23
|
+
}
|
|
24
|
+
export declare function createVirtualOffset(block: number, offset: number): VirtualOffset;
|
|
25
|
+
export declare function isGreaterThan(a: VirtualOffset, b: VirtualOffset): boolean;
|
|
26
|
+
export declare function isLessThan(a: VirtualOffset, b: VirtualOffset): boolean;
|
|
27
|
+
export declare function isEqualTo(a: VirtualOffset, b: VirtualOffset): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Read an 8-byte virtual offset from a BinaryParser.
|
|
30
|
+
*
|
|
31
|
+
* Byte layout (all little-endian):
|
|
32
|
+
* bytes 0–1: within-block offset (uint16 LE)
|
|
33
|
+
* bytes 2–6: compressed block file offset (5-byte uint, LE)
|
|
34
|
+
* byte 7: unused
|
|
35
|
+
*
|
|
36
|
+
* Uses multiplication (not bitwise ops) for the upper bytes to avoid
|
|
37
|
+
* JavaScript's 32-bit integer limit on bitwise operations.
|
|
38
|
+
*
|
|
39
|
+
* Port of js/binary.ts BinaryParser.getVPointer().
|
|
40
|
+
*/
|
|
41
|
+
export declare function readVirtualOffset(parser: BinaryParser): VirtualOffset;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock CanvasProvider for headless tests — no DOM required.
|
|
3
|
+
*/
|
|
4
|
+
import type { CanvasProvider, CanvasAndContext } from '../../src/canvasProvider';
|
|
5
|
+
import type { Locus, Track, TrackSessionConfig } from '../../src/types';
|
|
6
|
+
import type { RenderTheme } from '../../src/themes/renderTheme';
|
|
7
|
+
export interface MockCanvasOptions {
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
}
|
|
11
|
+
/** Create a mock HTMLCanvasElement-like object. */
|
|
12
|
+
export declare function createMockCanvas(options?: MockCanvasOptions): HTMLCanvasElement;
|
|
13
|
+
export declare class MockCanvasProvider implements CanvasProvider {
|
|
14
|
+
readonly devicePixelRatio = 1;
|
|
15
|
+
createCanvas(width: number, height: number): CanvasAndContext;
|
|
16
|
+
}
|
|
17
|
+
export declare const mockCanvasProvider: MockCanvasProvider;
|
|
18
|
+
export interface MockTrackOptions {
|
|
19
|
+
type?: string;
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Minimal Track implementation for browser tests.
|
|
25
|
+
* Records calls for assertion.
|
|
26
|
+
*/
|
|
27
|
+
export declare class MockTrack implements Track {
|
|
28
|
+
readonly type: string;
|
|
29
|
+
readonly canvas: HTMLCanvasElement;
|
|
30
|
+
private _locus;
|
|
31
|
+
private _height;
|
|
32
|
+
setLocusCalls: Locus[];
|
|
33
|
+
renderCalls: number;
|
|
34
|
+
features: unknown[] | null;
|
|
35
|
+
get locus(): Locus;
|
|
36
|
+
get height(): number;
|
|
37
|
+
constructor(options?: MockTrackOptions);
|
|
38
|
+
setLocus(locus: Locus): void;
|
|
39
|
+
render(): void;
|
|
40
|
+
attachTo(_container: HTMLElement): void;
|
|
41
|
+
detach(): void;
|
|
42
|
+
setFeatures(features: unknown[]): void;
|
|
43
|
+
suspendRendering(): void;
|
|
44
|
+
resumeRendering(): void;
|
|
45
|
+
setError(_error: Error | null): void;
|
|
46
|
+
hitTest(_x: number, _y: number): never[];
|
|
47
|
+
renderToContext(_ctx: CanvasRenderingContext2D, _width: number, _height: number): void;
|
|
48
|
+
serializeConfig(_theme: RenderTheme): TrackSessionConfig;
|
|
49
|
+
}
|
|
50
|
+
export interface MockDataSourceOptions<F = unknown> {
|
|
51
|
+
features?: F[];
|
|
52
|
+
/** If set, fetch will reject with this error. */
|
|
53
|
+
error?: Error;
|
|
54
|
+
/** Delay in ms before resolving. */
|
|
55
|
+
delay?: number;
|
|
56
|
+
}
|
|
57
|
+
export declare class MockDataSource<F = unknown> {
|
|
58
|
+
private features;
|
|
59
|
+
private error;
|
|
60
|
+
private delay;
|
|
61
|
+
fetchCalls: Array<{
|
|
62
|
+
locus: Locus;
|
|
63
|
+
bpPerPixel: number;
|
|
64
|
+
}>;
|
|
65
|
+
constructor(options?: MockDataSourceOptions<F>);
|
|
66
|
+
fetch(locus: Locus, bpPerPixel: number, signal?: AbortSignal): Promise<F[]>;
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for worker task dispatch wiring.
|
|
3
|
+
*
|
|
4
|
+
* Verifies that:
|
|
5
|
+
* 1. MainThreadProvider correctly handles all task types (including new ones)
|
|
6
|
+
* 2. WorkerProvider is threaded through data sources and track canvases
|
|
7
|
+
* 3. Tasks are dispatched (not just executed synchronously) when workerProvider is set
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified RenderTheme system — shadcn-style palette-driven theming.
|
|
3
|
+
*
|
|
4
|
+
* Users define a global palette (primary, secondary, background, foreground, etc.)
|
|
5
|
+
* and each track type knows how to derive its specific config defaults from that
|
|
6
|
+
* palette. Everything is overridable at three levels:
|
|
7
|
+
*
|
|
8
|
+
* 1. Palette-derived defaults (annotation.color = palette.primary)
|
|
9
|
+
* 2. Per-track-type overrides (theme.annotation.borderRadius = 3)
|
|
10
|
+
* 3. Per-track instance overrides (options.config.color = 'red')
|
|
11
|
+
*
|
|
12
|
+
* Renderers never see RenderTheme directly — they still consume AnnotationRenderConfig,
|
|
13
|
+
* WigRenderConfig, etc. The theme system produces those configs.
|
|
14
|
+
*/
|
|
15
|
+
import type { AnnotationRenderConfig, WigRenderConfig, RulerRenderConfig, SequenceRenderConfig, InteractionRenderConfig } from '../types';
|
|
16
|
+
/** Global color palette — the primary customization surface. */
|
|
17
|
+
export interface ThemePalette {
|
|
18
|
+
/** Main track color (CDS exons, wig bars, signal fill). */
|
|
19
|
+
primary: string;
|
|
20
|
+
/** Alternate strand, negative values. */
|
|
21
|
+
secondary: string;
|
|
22
|
+
/** Highlights, selections, active states. */
|
|
23
|
+
accent: string;
|
|
24
|
+
/** Track canvas background. */
|
|
25
|
+
background: string;
|
|
26
|
+
/** Text, labels, tick marks. */
|
|
27
|
+
foreground: string;
|
|
28
|
+
/** Subtle elements: baselines, introns, borders. */
|
|
29
|
+
muted: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Unified render theme. Defines a global palette, typography, and nucleotide
|
|
33
|
+
* colors. Each track type derives its config defaults from the palette, with
|
|
34
|
+
* optional per-track-type overrides.
|
|
35
|
+
*/
|
|
36
|
+
export interface RenderTheme {
|
|
37
|
+
palette: ThemePalette;
|
|
38
|
+
/** CSS font-family string. Default: 'sans-serif'. */
|
|
39
|
+
fontFamily: string;
|
|
40
|
+
/** Base font size in pixels. Default: 10. */
|
|
41
|
+
fontSize: number;
|
|
42
|
+
/** Nucleotide color mapping (A, C, G, T, N). */
|
|
43
|
+
nucleotideColors: Record<string, string>;
|
|
44
|
+
annotation?: Partial<AnnotationRenderConfig>;
|
|
45
|
+
wig?: Partial<WigRenderConfig>;
|
|
46
|
+
ruler?: Partial<RulerRenderConfig>;
|
|
47
|
+
sequence?: Partial<SequenceRenderConfig>;
|
|
48
|
+
interaction?: Partial<InteractionRenderConfig>;
|
|
49
|
+
}
|
|
50
|
+
/** Returns the default render theme matching classic igv.js appearance. */
|
|
51
|
+
export declare function defaultRenderTheme(): RenderTheme;
|
|
52
|
+
/**
|
|
53
|
+
* Deep-merge a partial theme into the defaults.
|
|
54
|
+
* If no overrides provided, returns the default theme.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveTheme(overrides?: Partial<RenderTheme>): RenderTheme;
|
|
57
|
+
/**
|
|
58
|
+
* Resolve a full AnnotationRenderConfig from a theme + optional per-track overrides.
|
|
59
|
+
*
|
|
60
|
+
* Resolution: palette-derived defaults → theme.annotation overrides → per-track overrides.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveAnnotationConfig(theme: RenderTheme, overrides?: Partial<AnnotationRenderConfig>): AnnotationRenderConfig;
|
|
63
|
+
/**
|
|
64
|
+
* Resolve a full WigRenderConfig from a theme + optional per-track overrides.
|
|
65
|
+
*
|
|
66
|
+
* Resolution: palette-derived defaults → theme.wig overrides → per-track overrides.
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveWigConfig(theme: RenderTheme, overrides?: Partial<WigRenderConfig>): WigRenderConfig;
|
|
69
|
+
/**
|
|
70
|
+
* Resolve a full RulerRenderConfig from a theme + optional per-track overrides.
|
|
71
|
+
*
|
|
72
|
+
* Resolution: palette-derived defaults → theme.ruler overrides → per-track overrides.
|
|
73
|
+
*/
|
|
74
|
+
export declare function resolveRulerConfig(theme: RenderTheme, overrides?: Partial<RulerRenderConfig>): RulerRenderConfig;
|
|
75
|
+
/**
|
|
76
|
+
* Resolve a full SequenceRenderConfig from a theme + optional per-track overrides.
|
|
77
|
+
*
|
|
78
|
+
* Resolution: palette-derived defaults → theme.sequence overrides → per-track overrides.
|
|
79
|
+
*/
|
|
80
|
+
export declare function resolveSequenceConfig(theme: RenderTheme, overrides?: Partial<SequenceRenderConfig>): SequenceRenderConfig;
|
|
81
|
+
/**
|
|
82
|
+
* Resolve a full InteractionRenderConfig from a theme + optional per-track overrides.
|
|
83
|
+
*
|
|
84
|
+
* Resolution: palette-derived defaults → theme.interaction overrides → per-track overrides.
|
|
85
|
+
*/
|
|
86
|
+
export declare function resolveInteractionConfig(theme: RenderTheme, overrides?: Partial<InteractionRenderConfig>): InteractionRenderConfig;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in RenderTheme presets.
|
|
3
|
+
*
|
|
4
|
+
* These are Partial<RenderTheme> objects — pass them to resolveTheme() to get
|
|
5
|
+
* a fully resolved theme with defaults filled in.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import {resolveTheme} from './renderTheme'
|
|
9
|
+
* import {modernRenderTheme} from './renderThemePresets'
|
|
10
|
+
* const theme = resolveTheme(modernRenderTheme)
|
|
11
|
+
*/
|
|
12
|
+
import type { RenderTheme } from './renderTheme';
|
|
13
|
+
/** Modern theme — blue/pink palette, rounded exons, system font. */
|
|
14
|
+
export declare const modernRenderTheme: Partial<RenderTheme>;
|
|
15
|
+
/** Dark theme — adapted for dark backgrounds, high contrast. */
|
|
16
|
+
export declare const darkRenderTheme: Partial<RenderTheme>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Track registry — extensible factory for creating tracks from session configs.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors igv.js `trackFactory.ts` (`js/trackFactory.ts`), which uses a
|
|
5
|
+
* `Map<string, TrackCreator>` with type alias resolution and runtime
|
|
6
|
+
* registration via `registerTrackClass()` / `registerTrackCreatorFunction()`.
|
|
7
|
+
*
|
|
8
|
+
* Our implementation follows the same pattern: a central `Map` of creators,
|
|
9
|
+
* type aliases, and public registration functions. The key difference is that
|
|
10
|
+
* igv.js creators take `(config, browser)` and return a Track, whereas ours
|
|
11
|
+
* take `(trackConfig, context)` and return a `CreatedTrack` (track + data
|
|
12
|
+
* source + metadata) since data sources are first-class in our architecture.
|
|
13
|
+
*/
|
|
14
|
+
import type { Locus, Track, DataSource, DataSourceConfig, TrackSessionConfig, SequenceProvider } from './types';
|
|
15
|
+
import type { CanvasProvider } from './canvasProvider';
|
|
16
|
+
import type { WorkerProvider } from './workerProvider';
|
|
17
|
+
import type { RenderTheme } from './themes/renderTheme';
|
|
18
|
+
/** Context passed to every track creator function. */
|
|
19
|
+
export interface TrackCreatorContext {
|
|
20
|
+
locus: Locus;
|
|
21
|
+
canvasProvider: CanvasProvider;
|
|
22
|
+
workerProvider?: WorkerProvider;
|
|
23
|
+
theme?: Partial<RenderTheme>;
|
|
24
|
+
/** Sequence provider from the genome, used by sequence tracks. */
|
|
25
|
+
sequenceProvider?: SequenceProvider;
|
|
26
|
+
}
|
|
27
|
+
/** Result of creating a track — the track itself plus optional data source. */
|
|
28
|
+
export interface CreatedTrack {
|
|
29
|
+
track: Track;
|
|
30
|
+
dataSource: DataSource | null;
|
|
31
|
+
dataSourceConfig: DataSourceConfig | null;
|
|
32
|
+
name?: string;
|
|
33
|
+
order?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Factory function that creates a track + data source from a session config.
|
|
37
|
+
*
|
|
38
|
+
* Mirrors igv.js `TrackCreator = (config, browser) => Track` but returns
|
|
39
|
+
* a richer result since we separate track rendering from data sourcing.
|
|
40
|
+
*/
|
|
41
|
+
export type TrackCreator = (trackConfig: TrackSessionConfig, context: TrackCreatorContext) => CreatedTrack;
|
|
42
|
+
/**
|
|
43
|
+
* Register a track creator for a given type string.
|
|
44
|
+
*
|
|
45
|
+
* Mirrors igv.js `registerTrackCreatorFunction()` (js/trackFactory.ts).
|
|
46
|
+
*/
|
|
47
|
+
export declare function registerTrackCreator(type: string, creator: TrackCreator): void;
|
|
48
|
+
/**
|
|
49
|
+
* Register a type alias so that e.g. "gene" resolves to "annotation".
|
|
50
|
+
*
|
|
51
|
+
* Mirrors igv.js alias resolution in `getTrack()` (js/trackFactory.ts lines 78-96)
|
|
52
|
+
* where switch/case maps "annotation"→"feature", "genes"→"feature", etc.
|
|
53
|
+
*/
|
|
54
|
+
export declare function registerTypeAlias(alias: string, canonicalType: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Look up a track creator by type (resolving aliases first).
|
|
57
|
+
*
|
|
58
|
+
* Mirrors igv.js `getTrack()` (js/trackFactory.ts) which resolves aliases
|
|
59
|
+
* then looks up in the `trackFunctions` Map.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getTrackCreator(type: string): TrackCreator | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Return all known track type strings (canonical + aliases).
|
|
64
|
+
*
|
|
65
|
+
* Mirrors igv.js `knownTrackTypes()` (js/trackFactory.ts).
|
|
66
|
+
*/
|
|
67
|
+
export declare function knownTrackTypes(): Set<string>;
|
|
68
|
+
export declare function createDataSource(config: DataSourceConfig, workerProvider?: WorkerProvider): DataSource;
|
|
69
|
+
/**
|
|
70
|
+
* Create a track from a session config using the registry.
|
|
71
|
+
*
|
|
72
|
+
* This replaces the switch/case in the old `createTrackFromSession()`.
|
|
73
|
+
* Unknown types throw an error (mirrors igv.js behavior where `getTrack()`
|
|
74
|
+
* returns undefined and the browser logs a warning).
|
|
75
|
+
*/
|
|
76
|
+
export declare function createTrackFromConfig(trackConfig: TrackSessionConfig, locus: Locus, options?: {
|
|
77
|
+
canvasProvider?: CanvasProvider;
|
|
78
|
+
workerProvider?: WorkerProvider;
|
|
79
|
+
theme?: Partial<RenderTheme>;
|
|
80
|
+
sequenceProvider?: SequenceProvider;
|
|
81
|
+
}): CreatedTrack;
|