loom-browser 0.0.1 → 0.0.3
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/loom.esm.js +27 -21
- package/dist/loom.esm.min.js +1 -1
- package/dist/loom.esm.min.js.map +1 -1
- package/dist/loom.js +27 -21
- package/dist/loom.min.js +1 -1
- package/dist/loom.min.js.map +1 -1
- package/dist/types/commandDispatcher.d.ts +22 -1
- package/dist/types/gtx/zstdWasm.d.ts +4 -1
- package/dist/types/gtx/zstdWasmInlined.d.ts +6 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/remoteProtocol.d.ts +2 -0
- package/package.json +8 -2
- package/dist/igv.d.ts +0 -667
- package/dist/igv.esm.js +0 -76708
- package/dist/igv.esm.min.js +0 -26
- package/dist/igv.esm.min.js.map +0 -1
- package/dist/igv.js +0 -76716
- package/dist/igv.min.js +0 -26
- package/dist/igv.min.js.map +0 -1
- package/dist/loom.d.ts +0 -667
- package/dist/types/agent/index.d.ts +0 -4
- package/dist/types/agent/stateProjection.d.ts +0 -115
- package/dist/types/agent/trackSelector.d.ts +0 -31
- package/dist/types/baseTrackCanvas.d.ts +0 -62
- package/dist/types/bigwig/binaryParser.d.ts +0 -25
- package/dist/types/bigwig/bpTree.d.ts +0 -40
- package/dist/types/bigwig/bwReader.d.ts +0 -69
- package/dist/types/bigwig/chromTree.d.ts +0 -28
- package/dist/types/bigwig/inflate.d.ts +0 -9
- package/dist/types/bigwig/rangeReader.d.ts +0 -48
- package/dist/types/bigwig/rpTree.d.ts +0 -27
- package/dist/types/dataSources/dynseqDataSource.d.ts +0 -20
- package/dist/types/dynseqRenderer.d.ts +0 -37
- package/dist/types/geneRenderer.d.ts +0 -17
- package/dist/types/geneThemes.d.ts +0 -11
- package/dist/types/geneTrackCanvas.d.ts +0 -46
- package/dist/types/renderTheme.d.ts +0 -72
- package/dist/types/renderThemePresets.d.ts +0 -16
- package/dist/types/rulerRenderer.d.ts +0 -14
- package/dist/types/rulerTrackCanvas.d.ts +0 -32
- package/dist/types/src/bigwig/index.d.ts +0 -66
- package/dist/types/src/canvasProvider.d.ts +0 -36
- package/dist/types/src/commandDispatcher.d.ts +0 -220
- package/dist/types/src/contextMenu.d.ts +0 -64
- package/dist/types/src/contextMenuProvider.d.ts +0 -25
- package/dist/types/src/data/cachedSequence.d.ts +0 -19
- package/dist/types/src/data/ucscApi.d.ts +0 -21
- package/dist/types/src/data/ucscSequence.d.ts +0 -19
- package/dist/types/src/dataLifecycle.d.ts +0 -16
- package/dist/types/src/dataSources/bigWigDataSource.d.ts +0 -24
- package/dist/types/src/dataSources/dataSourceCacheKey.d.ts +0 -9
- package/dist/types/src/dataSources/featureSourceFactory.d.ts +0 -46
- package/dist/types/src/dataSources/geneDataSource.d.ts +0 -16
- package/dist/types/src/dataSources/gtxDataSource.d.ts +0 -42
- package/dist/types/src/dataSources/sequenceDataSource.d.ts +0 -15
- package/dist/types/src/dataSources/textFeatureSource.d.ts +0 -63
- package/dist/types/src/decode/bed.d.ts +0 -64
- package/dist/types/src/decode/bedpe.d.ts +0 -36
- package/dist/types/src/decode/exonUtils.d.ts +0 -29
- package/dist/types/src/decode/gff.d.ts +0 -58
- package/dist/types/src/decode/interact.d.ts +0 -19
- package/dist/types/src/decode/ucsc.d.ts +0 -56
- package/dist/types/src/events.d.ts +0 -23
- package/dist/types/src/export/canvas2svg.d.ts +0 -166
- package/dist/types/src/export/index.d.ts +0 -2
- package/dist/types/src/featureCache.d.ts +0 -69
- package/dist/types/src/formats/featureParser.d.ts +0 -72
- package/dist/types/src/formats/formatDetection.d.ts +0 -46
- package/dist/types/src/genome/chromAlias.d.ts +0 -46
- package/dist/types/src/genome/chromSizes.d.ts +0 -53
- package/dist/types/src/genome/genome.d.ts +0 -51
- package/dist/types/src/genomeBrowser.d.ts +0 -189
- package/dist/types/src/gtx/fetchCoordinator.d.ts +0 -34
- package/dist/types/src/gtx/gtxReader.d.ts +0 -144
- package/dist/types/src/gtx/index.d.ts +0 -40
- package/dist/types/src/gtx/zstdWasm.d.ts +0 -22
- package/dist/types/src/headlessGenomeBrowser.d.ts +0 -450
- package/dist/types/src/index.d.ts +0 -123
- package/dist/types/src/intervalTree.d.ts +0 -56
- package/dist/types/src/io/binaryParser.d.ts +0 -25
- package/dist/types/src/io/index.d.ts +0 -7
- package/dist/types/src/io/rangeReader.d.ts +0 -48
- package/dist/types/src/locusUtils.d.ts +0 -37
- package/dist/types/src/pack.d.ts +0 -41
- package/dist/types/src/popupProvider.d.ts +0 -22
- package/dist/types/src/remoteProtocol.d.ts +0 -81
- package/dist/types/src/roi/index.d.ts +0 -3
- package/dist/types/src/roi/roiRenderer.d.ts +0 -24
- package/dist/types/src/roi/roiSet.d.ts +0 -41
- package/dist/types/src/sequence/sequenceUtils.d.ts +0 -44
- package/dist/types/src/session.d.ts +0 -55
- package/dist/types/src/stateProjection.d.ts +0 -115
- package/dist/types/src/tabix/index.d.ts +0 -48
- package/dist/types/src/themes/index.d.ts +0 -3
- package/dist/types/src/themes/renderTheme.d.ts +0 -86
- package/dist/types/src/themes/renderThemePresets.d.ts +0 -16
- package/dist/types/src/trackRegistry.d.ts +0 -81
- package/dist/types/src/trackSelector.d.ts +0 -31
- package/dist/types/src/tracks/annotation/annotationRenderer.d.ts +0 -17
- package/dist/types/src/tracks/annotation/annotationThemes.d.ts +0 -11
- package/dist/types/src/tracks/annotation/annotationTrackCanvas.d.ts +0 -58
- package/dist/types/src/tracks/annotation/index.d.ts +0 -4
- package/dist/types/src/tracks/axis/axisRenderer.d.ts +0 -19
- package/dist/types/src/tracks/axis/index.d.ts +0 -1
- package/dist/types/src/tracks/baseTrackCanvas.d.ts +0 -113
- package/dist/types/src/tracks/dynseq/dynseqRenderer.d.ts +0 -38
- package/dist/types/src/tracks/dynseq/index.d.ts +0 -1
- package/dist/types/src/tracks/index.d.ts +0 -7
- package/dist/types/src/tracks/interaction/index.d.ts +0 -4
- package/dist/types/src/tracks/interaction/interactionRenderer.d.ts +0 -52
- package/dist/types/src/tracks/interaction/interactionTrackCanvas.d.ts +0 -54
- package/dist/types/src/tracks/ruler/index.d.ts +0 -3
- package/dist/types/src/tracks/ruler/rulerRenderer.d.ts +0 -25
- package/dist/types/src/tracks/ruler/rulerTrackCanvas.d.ts +0 -43
- package/dist/types/src/tracks/sequence/index.d.ts +0 -5
- package/dist/types/src/tracks/sequence/sequenceRenderer.d.ts +0 -34
- package/dist/types/src/tracks/sequence/sequenceThemes.d.ts +0 -11
- package/dist/types/src/tracks/sequence/sequenceTrackCanvas.d.ts +0 -67
- package/dist/types/src/tracks/wig/index.d.ts +0 -5
- package/dist/types/src/tracks/wig/wigRenderer.d.ts +0 -15
- package/dist/types/src/tracks/wig/wigSummary.d.ts +0 -31
- package/dist/types/src/tracks/wig/wigThemes.d.ts +0 -15
- package/dist/types/src/tracks/wig/wigTrackCanvas.d.ts +0 -82
- package/dist/types/src/types.d.ts +0 -885
- package/dist/types/src/ui/components/LoomBrowserShell.d.ts +0 -52
- package/dist/types/src/ui/components/LoomChromosomeSelect.d.ts +0 -18
- package/dist/types/src/ui/components/LoomContextMenu.d.ts +0 -39
- package/dist/types/src/ui/components/LoomExportControls.d.ts +0 -13
- package/dist/types/src/ui/components/LoomInputDialog.d.ts +0 -27
- package/dist/types/src/ui/components/LoomLocusInput.d.ts +0 -18
- package/dist/types/src/ui/components/LoomNavbar.d.ts +0 -15
- package/dist/types/src/ui/components/LoomPopup.d.ts +0 -32
- package/dist/types/src/ui/components/LoomWindowSize.d.ts +0 -14
- package/dist/types/src/ui/components/LoomZoomControls.d.ts +0 -10
- package/dist/types/src/ui/index.d.ts +0 -21
- package/dist/types/src/ui/themes.d.ts +0 -14
- package/dist/types/src/worker/nodeWorkerProvider.d.ts +0 -28
- package/dist/types/src/worker/taskHandler.d.ts +0 -15
- package/dist/types/src/worker/webWorkerProvider.d.ts +0 -51
- package/dist/types/src/worker/workerScript.d.ts +0 -11
- package/dist/types/src/workerProvider.d.ts +0 -76
- package/dist/types/tabix/bgzBlockLoader.d.ts +0 -60
- package/dist/types/tabix/bgzf.d.ts +0 -43
- package/dist/types/tabix/tabixIndex.d.ts +0 -85
- package/dist/types/tabix/tabixReader.d.ts +0 -60
- package/dist/types/tabix/virtualOffset.d.ts +0 -41
- package/dist/types/test/src/mockCanvasProvider.d.ts +0 -67
- package/dist/types/test/src/testBedDecode.d.ts +0 -1
- package/dist/types/test/src/testCanvas2SVG.d.ts +0 -7
- package/dist/types/test/src/testChromAlias.d.ts +0 -1
- package/dist/types/test/src/testCommandDispatcher.d.ts +0 -1
- package/dist/types/test/src/testData.d.ts +0 -7
- package/dist/types/test/src/testDataLifecycle.d.ts +0 -1
- package/dist/types/test/src/testDataSourceCacheKey.d.ts +0 -1
- package/dist/types/test/src/testDataSources.d.ts +0 -5
- package/dist/types/test/src/testDecodeUcsc.d.ts +0 -1
- package/dist/types/test/src/testEvents.d.ts +0 -1
- package/dist/types/test/src/testFeatureCache.d.ts +0 -1
- package/dist/types/test/src/testFeatureParser.d.ts +0 -1
- package/dist/types/test/src/testFormatDetection.d.ts +0 -1
- package/dist/types/test/src/testGffDecode.d.ts +0 -1
- package/dist/types/test/src/testHeadlessBrowser.d.ts +0 -1
- package/dist/types/test/src/testInteractionDecoder.d.ts +0 -1
- package/dist/types/test/src/testIntervalTree.d.ts +0 -1
- package/dist/types/test/src/testLocusUtils.d.ts +0 -1
- package/dist/types/test/src/testPack.d.ts +0 -1
- package/dist/types/test/src/testROI.d.ts +0 -1
- package/dist/types/test/src/testRemoteProtocol.d.ts +0 -1
- package/dist/types/test/src/testRenderTheme.d.ts +0 -1
- package/dist/types/test/src/testSVGExport.d.ts +0 -5
- package/dist/types/test/src/testSequence.d.ts +0 -1
- package/dist/types/test/src/testSession.d.ts +0 -1
- package/dist/types/test/src/testTrackSelector.d.ts +0 -1
- package/dist/types/test/src/testTrackSerialize.d.ts +0 -1
- package/dist/types/test/src/testWigSummary.d.ts +0 -1
- package/dist/types/test/src/testWorkerDispatch.d.ts +0 -9
- package/dist/types/tracks/gene/geneRenderer.d.ts +0 -17
- package/dist/types/tracks/gene/geneThemes.d.ts +0 -11
- package/dist/types/tracks/gene/geneTrackCanvas.d.ts +0 -58
- package/dist/types/tracks/gene/index.d.ts +0 -4
- package/dist/types/ui/components/IgvBrowserShell.d.ts +0 -52
- package/dist/types/ui/components/IgvChromosomeSelect.d.ts +0 -18
- package/dist/types/ui/components/IgvExportControls.d.ts +0 -13
- package/dist/types/ui/components/IgvLocusInput.d.ts +0 -18
- package/dist/types/ui/components/IgvNavbar.d.ts +0 -15
- package/dist/types/ui/components/IgvWindowSize.d.ts +0 -14
- package/dist/types/ui/components/IgvZoomControls.d.ts +0 -10
- package/dist/types/wigRenderer.d.ts +0 -15
- package/dist/types/wigSummary.d.ts +0 -31
- package/dist/types/wigThemes.d.ts +0 -15
- package/dist/types/wigTrackCanvas.d.ts +0 -46
- package/dist/types/worker/decodeWig.d.ts +0 -20
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* StateProjection — agent-friendly state snapshots with record/diff support.
|
|
3
|
-
*
|
|
4
|
-
* Wraps a HeadlessGenomeBrowser to produce concise, LLM-optimized state objects.
|
|
5
|
-
* Supports snapshotting (record) and incremental diffs against prior snapshots.
|
|
6
|
-
*
|
|
7
|
-
* Feature summarization reads from the browser's cache via getCachedFeatures(),
|
|
8
|
-
* filters to the visible viewport, and applies type-specific summarization.
|
|
9
|
-
*
|
|
10
|
-
* Swappable: consumers can extend or replace this class for custom projection logic.
|
|
11
|
-
*/
|
|
12
|
-
import type { Locus, TrackFeatureSummary, ROISetConfig } from '../types';
|
|
13
|
-
import type { HeadlessGenomeBrowser, ManagedTrack } from '../headlessGenomeBrowser';
|
|
14
|
-
/** Zoom level classification based on viewport span. */
|
|
15
|
-
export type ZoomLevel = 'base' | 'element' | 'gene' | 'region' | 'chromosome' | 'genome';
|
|
16
|
-
/** Concise summary of a single track, suitable for LLM consumption. */
|
|
17
|
-
export interface TrackSummary {
|
|
18
|
-
id: string;
|
|
19
|
-
type: string;
|
|
20
|
-
name?: string;
|
|
21
|
-
metadata?: Record<string, string>;
|
|
22
|
-
/** True when a data source exists but no cached data is available yet. */
|
|
23
|
-
loading?: boolean;
|
|
24
|
-
featureSummary?: TrackFeatureSummary;
|
|
25
|
-
}
|
|
26
|
-
/** Full projected state of the browser — concise, JSON-serializable. */
|
|
27
|
-
export interface ProjectedState {
|
|
28
|
-
locus: Locus;
|
|
29
|
-
/** Formatted locus string, e.g. "chr17:7,668,421-7,687,490" */
|
|
30
|
-
locusString: string;
|
|
31
|
-
/** Viewport span in base pairs. */
|
|
32
|
-
span: number;
|
|
33
|
-
zoomLevel: ZoomLevel;
|
|
34
|
-
genome?: string;
|
|
35
|
-
tracks: TrackSummary[];
|
|
36
|
-
rois: ROISetConfig[];
|
|
37
|
-
}
|
|
38
|
-
/** Per-field [before, after] diff for a track whose feature summary changed. */
|
|
39
|
-
export interface TrackChangeDiff {
|
|
40
|
-
id: string;
|
|
41
|
-
type: string;
|
|
42
|
-
featureCount?: [number, number];
|
|
43
|
-
signalRange?: [{
|
|
44
|
-
min: number;
|
|
45
|
-
max: number;
|
|
46
|
-
}, {
|
|
47
|
-
min: number;
|
|
48
|
-
max: number;
|
|
49
|
-
}];
|
|
50
|
-
featureNames?: [string[], string[]];
|
|
51
|
-
packingDepth?: [number, number];
|
|
52
|
-
valueRange?: [{
|
|
53
|
-
min: number;
|
|
54
|
-
max: number;
|
|
55
|
-
}, {
|
|
56
|
-
min: number;
|
|
57
|
-
max: number;
|
|
58
|
-
}];
|
|
59
|
-
}
|
|
60
|
-
/** Diff between two projected states — only includes what changed. */
|
|
61
|
-
export interface StateDiff {
|
|
62
|
-
/** Present if locus changed. */
|
|
63
|
-
locus?: [Locus, Locus];
|
|
64
|
-
/** Present if zoom level changed. */
|
|
65
|
-
zoomLevel?: [ZoomLevel, ZoomLevel];
|
|
66
|
-
/** Tracks added since the snapshot. */
|
|
67
|
-
tracksAdded?: TrackSummary[];
|
|
68
|
-
/** Track IDs removed since the snapshot. */
|
|
69
|
-
tracksRemoved?: string[];
|
|
70
|
-
/** Tracks whose feature summary changed, with per-field [before, after] tuples. */
|
|
71
|
-
tracksChanged?: TrackChangeDiff[];
|
|
72
|
-
/** Present if ROIs changed. */
|
|
73
|
-
roisChanged?: boolean;
|
|
74
|
-
/** True if nothing changed. */
|
|
75
|
-
unchanged: boolean;
|
|
76
|
-
}
|
|
77
|
-
export interface GetStateOptions {
|
|
78
|
-
/** If provided, record the state under this key for future diff() calls. */
|
|
79
|
-
record?: string;
|
|
80
|
-
}
|
|
81
|
-
export declare class StateProjection {
|
|
82
|
-
private browser;
|
|
83
|
-
private snapshots;
|
|
84
|
-
constructor(browser: HeadlessGenomeBrowser);
|
|
85
|
-
/** Get the current projected state. Optionally record it under a key. */
|
|
86
|
-
getState(options?: GetStateOptions): ProjectedState;
|
|
87
|
-
/**
|
|
88
|
-
* Diff the current state against a named snapshot.
|
|
89
|
-
* Returns an object describing only what changed.
|
|
90
|
-
* Throws if the key doesn't exist.
|
|
91
|
-
*/
|
|
92
|
-
diff(key: string): StateDiff;
|
|
93
|
-
/** Record the current state under a key without returning it. */
|
|
94
|
-
record(key: string): void;
|
|
95
|
-
/** Delete a snapshot by key. */
|
|
96
|
-
deleteSnapshot(key: string): boolean;
|
|
97
|
-
/** Get a previously recorded snapshot by key. */
|
|
98
|
-
getSnapshot(key: string): ProjectedState | undefined;
|
|
99
|
-
/** List all snapshot keys. */
|
|
100
|
-
snapshotKeys(): string[];
|
|
101
|
-
/** Clear all snapshots. */
|
|
102
|
-
clearSnapshots(): void;
|
|
103
|
-
private project;
|
|
104
|
-
private projectTrack;
|
|
105
|
-
/**
|
|
106
|
-
* Summarize cached features for a track, filtered to the visible viewport.
|
|
107
|
-
* Reads from the browser's cache via getCachedFeatures() and applies
|
|
108
|
-
* type-specific summarization. Override this method in subclasses for
|
|
109
|
-
* custom summary formats.
|
|
110
|
-
*/
|
|
111
|
-
protected summarizeFeatures(mt: ManagedTrack, locus: Locus): TrackFeatureSummary | undefined;
|
|
112
|
-
private summarizeWig;
|
|
113
|
-
private summarizeAnnotation;
|
|
114
|
-
private summarizeInteraction;
|
|
115
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TrackSelector — SQL-ish WHERE clause for matching tracks by metadata.
|
|
3
|
-
*
|
|
4
|
-
* Selectors support matching on track ID, name (string or RegExp), type,
|
|
5
|
-
* and arbitrary metadata key-value pairs. All provided fields use AND semantics:
|
|
6
|
-
* a track must match every specified criterion.
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* // Remove all ATAC-seq tracks
|
|
10
|
-
* browser.removeTracks({ where: { assay: 'ATAC-seq' } })
|
|
11
|
-
*
|
|
12
|
-
* // Find wig tracks from K562
|
|
13
|
-
* browser.findTracks({ type: 'wig', where: { biosample: 'K562' } })
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
import type { ManagedTrack } from '../headlessGenomeBrowser';
|
|
17
|
-
/** Selector for matching tracks by ID, name, type, and/or metadata. */
|
|
18
|
-
export interface TrackSelector {
|
|
19
|
-
/** Exact match against track ID. */
|
|
20
|
-
id?: string;
|
|
21
|
-
/** String: case-insensitive substring match. RegExp: test against track name. */
|
|
22
|
-
name?: string | RegExp;
|
|
23
|
-
/** Exact match against track type (e.g. 'wig', 'annotation', 'interact'). */
|
|
24
|
-
type?: string;
|
|
25
|
-
/** Metadata key-value matching. Every entry must match (AND semantics). */
|
|
26
|
-
where?: Record<string, string>;
|
|
27
|
-
}
|
|
28
|
-
/** Test whether a single managed track matches all criteria in a selector. */
|
|
29
|
-
export declare function matchesSelector(mt: ManagedTrack, selector: TrackSelector): boolean;
|
|
30
|
-
/** Select all managed tracks matching a selector. */
|
|
31
|
-
export declare function selectTracks(tracks: readonly ManagedTrack[], selector: TrackSelector): ManagedTrack[];
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base class for canvas-based genomic track renderers.
|
|
3
|
-
*
|
|
4
|
-
* Handles all shared canvas lifecycle: DPR scaling, sizing, resize observation,
|
|
5
|
-
* attach/detach, background fill, and RenderContext construction.
|
|
6
|
-
*
|
|
7
|
-
* Subclasses implement:
|
|
8
|
-
* - type (track type identifier)
|
|
9
|
-
* - computeHeight(width) — return CSS pixel height for current state
|
|
10
|
-
* - getBackground() — return background fill color
|
|
11
|
-
* - doRender(ctx, width, height, rc) — the actual drawing logic
|
|
12
|
-
*
|
|
13
|
-
* This eliminates ~80 lines of identical boilerplate per track type.
|
|
14
|
-
*/
|
|
15
|
-
import type { Locus, RenderContext, Track, TrackSessionConfig } from './types';
|
|
16
|
-
import type { RenderTheme } from './renderTheme';
|
|
17
|
-
import type { CanvasProvider } from './canvasProvider';
|
|
18
|
-
export declare abstract class BaseTrackCanvas<TConfig> implements Track {
|
|
19
|
-
protected _canvas: HTMLCanvasElement;
|
|
20
|
-
protected _locus: Locus;
|
|
21
|
-
protected _config: TConfig;
|
|
22
|
-
protected _height: number;
|
|
23
|
-
protected canvasProvider: CanvasProvider;
|
|
24
|
-
private resizeObserver;
|
|
25
|
-
private container;
|
|
26
|
-
abstract readonly type: string;
|
|
27
|
-
get canvas(): HTMLCanvasElement;
|
|
28
|
-
get locus(): Locus;
|
|
29
|
-
get height(): number;
|
|
30
|
-
/** Current track config (read-only). Use setConfig() to update. */
|
|
31
|
-
get config(): TConfig;
|
|
32
|
-
constructor(canvas: HTMLCanvasElement, locus: Locus, config: TConfig, canvasProvider?: CanvasProvider);
|
|
33
|
-
/** Update locus and re-render. */
|
|
34
|
-
setLocus(locus: Locus): void;
|
|
35
|
-
/** Merge partial config and re-render. */
|
|
36
|
-
setConfig(config: Partial<TConfig>): void;
|
|
37
|
-
/**
|
|
38
|
-
* Attach the canvas to a container element.
|
|
39
|
-
* Appends the canvas and sets up a ResizeObserver for automatic re-renders.
|
|
40
|
-
*/
|
|
41
|
-
attachTo(container: HTMLElement): void;
|
|
42
|
-
/** Detach from container and stop observing resizes. */
|
|
43
|
-
detach(): void;
|
|
44
|
-
/** Render the track. Handles DPR, sizing, background, then delegates to doRender(). */
|
|
45
|
-
render(): void;
|
|
46
|
-
/**
|
|
47
|
-
* Compute the track height in CSS pixels for the current state.
|
|
48
|
-
* Called at the start of each render(). The width parameter is provided
|
|
49
|
-
* in case height depends on layout (e.g., gene packing).
|
|
50
|
-
*/
|
|
51
|
-
protected abstract computeHeight(width: number): number;
|
|
52
|
-
/** Return the background fill color for the canvas. */
|
|
53
|
-
protected abstract getBackground(): string;
|
|
54
|
-
/** Perform the actual track-specific rendering onto the prepared canvas. */
|
|
55
|
-
protected abstract doRender(ctx: CanvasRenderingContext2D, width: number, height: number, rc: RenderContext): void;
|
|
56
|
-
/**
|
|
57
|
-
* Serialize this track's config for session save/restore.
|
|
58
|
-
* Each subclass diffs its config against theme defaults and returns
|
|
59
|
-
* a typed TrackSessionConfig with only overridden fields.
|
|
60
|
-
*/
|
|
61
|
-
abstract serializeConfig(theme: RenderTheme): TrackSessionConfig;
|
|
62
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Binary data parser for reading structured binary data from a DataView.
|
|
3
|
-
* Port of js/binary.ts, simplified for BigWig reading (no VPointer).
|
|
4
|
-
*/
|
|
5
|
-
export declare class BinaryParser {
|
|
6
|
-
littleEndian: boolean;
|
|
7
|
-
position: number;
|
|
8
|
-
readonly view: DataView;
|
|
9
|
-
readonly length: number;
|
|
10
|
-
constructor(dataView: DataView, littleEndian?: boolean);
|
|
11
|
-
setPosition(position: number): void;
|
|
12
|
-
available(): number;
|
|
13
|
-
remLength(): number;
|
|
14
|
-
getByte(): number;
|
|
15
|
-
getShort(): number;
|
|
16
|
-
getUShort(): number;
|
|
17
|
-
getInt(): number;
|
|
18
|
-
getUInt(): number;
|
|
19
|
-
getLong(): number;
|
|
20
|
-
getString(len?: number): string;
|
|
21
|
-
getFixedLengthString(len: number): string;
|
|
22
|
-
getFloat(): number;
|
|
23
|
-
getDouble(): number;
|
|
24
|
-
skip(n: number): number;
|
|
25
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* B+ tree implementation for BigWig/BigBed chromosome name lookup.
|
|
3
|
-
* Port of js/bigwig/bpTree.ts, simplified:
|
|
4
|
-
* - Only supports 'BPChromTree' type (for chromosome ID lookup)
|
|
5
|
-
* - Uses native fetch via rangeReader
|
|
6
|
-
* - Strict types, no `any`
|
|
7
|
-
*/
|
|
8
|
-
export interface ChromLeafValue {
|
|
9
|
-
id: number;
|
|
10
|
-
size: number;
|
|
11
|
-
}
|
|
12
|
-
interface LeafItem {
|
|
13
|
-
key: string;
|
|
14
|
-
value: ChromLeafValue;
|
|
15
|
-
}
|
|
16
|
-
interface NonLeafItem {
|
|
17
|
-
key: string;
|
|
18
|
-
offset: number;
|
|
19
|
-
}
|
|
20
|
-
type BPTreeItem = LeafItem | NonLeafItem;
|
|
21
|
-
interface BPTreeNode {
|
|
22
|
-
type: number;
|
|
23
|
-
count: number;
|
|
24
|
-
items: BPTreeItem[];
|
|
25
|
-
}
|
|
26
|
-
export declare class BPTree {
|
|
27
|
-
private littleEndian;
|
|
28
|
-
private readonly nodeCache;
|
|
29
|
-
private readonly url;
|
|
30
|
-
private header;
|
|
31
|
-
private readonly startOffset;
|
|
32
|
-
constructor(url: string, startOffset: number);
|
|
33
|
-
init(signal?: AbortSignal): Promise<void>;
|
|
34
|
-
getItemCount(): number;
|
|
35
|
-
search(term: string, signal?: AbortSignal): Promise<ChromLeafValue | undefined>;
|
|
36
|
-
private walkTreeNode;
|
|
37
|
-
readTreeNode(offset: number, signal?: AbortSignal): Promise<BPTreeNode>;
|
|
38
|
-
private getParserFor;
|
|
39
|
-
}
|
|
40
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BigWig file reader.
|
|
3
|
-
* Port of js/bigwig/bwReader.ts, simplified for BigWig only (no BigBed).
|
|
4
|
-
*
|
|
5
|
-
* Reads a BigWig file via HTTP range requests, parses the binary header,
|
|
6
|
-
* zoom level headers, total summary, chromosome tree, and data sections.
|
|
7
|
-
*/
|
|
8
|
-
import type { WigFeature, WindowFunction } from '../types';
|
|
9
|
-
import type { WorkerProvider } from '../workerProvider';
|
|
10
|
-
export interface BigWigHeader {
|
|
11
|
-
bwVersion: number;
|
|
12
|
-
nZoomLevels: number;
|
|
13
|
-
chromTreeOffset: number;
|
|
14
|
-
fullDataOffset: number;
|
|
15
|
-
fullIndexOffset: number;
|
|
16
|
-
fieldCount: number;
|
|
17
|
-
definedFieldCount: number;
|
|
18
|
-
autoSqlOffset: number;
|
|
19
|
-
totalSummaryOffset: number;
|
|
20
|
-
uncompressBuffSize: number;
|
|
21
|
-
extensionOffset: number;
|
|
22
|
-
}
|
|
23
|
-
export interface BigWigTotalSummary {
|
|
24
|
-
basesCovered: number;
|
|
25
|
-
minVal: number;
|
|
26
|
-
maxVal: number;
|
|
27
|
-
sumData: number;
|
|
28
|
-
sumSquares: number;
|
|
29
|
-
mean: number;
|
|
30
|
-
stddev: number;
|
|
31
|
-
}
|
|
32
|
-
export declare class BigWigReader {
|
|
33
|
-
private readonly url;
|
|
34
|
-
private littleEndian;
|
|
35
|
-
private header;
|
|
36
|
-
private chromTree;
|
|
37
|
-
private zoomLevelHeaders;
|
|
38
|
-
private totalSummary;
|
|
39
|
-
private readonly rpTreeCache;
|
|
40
|
-
/** Optional worker provider for offloading CPU-intensive decode work. */
|
|
41
|
-
private readonly workerProvider?;
|
|
42
|
-
constructor(url: string, workerProvider?: WorkerProvider);
|
|
43
|
-
/** Load and parse the BigWig header. Idempotent. */
|
|
44
|
-
loadHeader(signal?: AbortSignal): Promise<BigWigHeader>;
|
|
45
|
-
/** Get the total summary statistics (if available). */
|
|
46
|
-
getTotalSummary(): Promise<BigWigTotalSummary | undefined>;
|
|
47
|
-
/**
|
|
48
|
-
* Read BigWig features for a genomic range.
|
|
49
|
-
*
|
|
50
|
-
* @param chr - Chromosome name (e.g., 'chr17')
|
|
51
|
-
* @param bpStart - Start position (0-based)
|
|
52
|
-
* @param bpEnd - End position
|
|
53
|
-
* @param bpPerPixel - Resolution (used to select zoom level)
|
|
54
|
-
* @param windowFunction - Aggregation function for zoom data ('mean', 'min', 'max')
|
|
55
|
-
*/
|
|
56
|
-
readFeatures(chr: string, bpStart: number, bpEnd: number, bpPerPixel?: number, windowFunction?: WindowFunction, signal?: AbortSignal): Promise<WigFeature[]>;
|
|
57
|
-
/**
|
|
58
|
-
* Read features across all main chromosomes for whole genome view.
|
|
59
|
-
* Resolves chromosome IDs, finds min/max range, and does a cross-chromosome R-tree query.
|
|
60
|
-
* Port of js/bigwig/bwReader.ts readWGFeatures().
|
|
61
|
-
*/
|
|
62
|
-
readWGFeatures(chromNames: string[], bpPerPixel: number, windowFunction?: WindowFunction, signal?: AbortSignal): Promise<WigFeature[]>;
|
|
63
|
-
/**
|
|
64
|
-
* Internal: read features for a range that may span multiple chromosomes.
|
|
65
|
-
*/
|
|
66
|
-
private readFeaturesRange;
|
|
67
|
-
private zoomLevelForScale;
|
|
68
|
-
private loadRPTree;
|
|
69
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Chromosome name ↔ ID mapping backed by a B+ tree.
|
|
3
|
-
* Port of js/bigwig/chromTree.ts.
|
|
4
|
-
*/
|
|
5
|
-
export declare class ChromTree {
|
|
6
|
-
private readonly nameToId;
|
|
7
|
-
private readonly idToName;
|
|
8
|
-
private readonly bpTree;
|
|
9
|
-
private readonly startOffset;
|
|
10
|
-
constructor(url: string, startOffset: number);
|
|
11
|
-
init(signal?: AbortSignal): Promise<void>;
|
|
12
|
-
getItemCount(): number;
|
|
13
|
-
/** Return the chromosome ID for the given name, or undefined if not found. */
|
|
14
|
-
getIdForName(chr: string, signal?: AbortSignal): Promise<number | undefined>;
|
|
15
|
-
/** Return all cached chromosome ID → name mappings. */
|
|
16
|
-
getAllNames(): Map<number, string>;
|
|
17
|
-
/**
|
|
18
|
-
* Pre-resolve a list of chromosome names to IDs, populating the cache.
|
|
19
|
-
* Returns a map of name → ID for successfully resolved chromosomes.
|
|
20
|
-
*/
|
|
21
|
-
resolveAll(names: string[], signal?: AbortSignal): Promise<Map<string, number>>;
|
|
22
|
-
/**
|
|
23
|
-
* Return the chromosome name for the given ID.
|
|
24
|
-
* Potentially expensive — walks the tree until the matching leaf is found.
|
|
25
|
-
*/
|
|
26
|
-
getNameForId(id: number, signal?: AbortSignal): Promise<string | undefined>;
|
|
27
|
-
private reverseSearch;
|
|
28
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zlib inflate (decompress) utility.
|
|
3
|
-
*
|
|
4
|
-
* Uses the Web Streams API DecompressionStream when available (all modern
|
|
5
|
-
* browsers), with a manual raw-deflate fallback for environments that only
|
|
6
|
-
* support 'deflate' format (the BigWig format stores raw deflate data without
|
|
7
|
-
* a zlib header, but some implementations add the header).
|
|
8
|
-
*/
|
|
9
|
-
export declare function inflate(compressedData: Uint8Array): Promise<Uint8Array>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HTTP range request reader using native fetch.
|
|
3
|
-
* Replaces igvxhr + BufferedReader for BigWig file reading.
|
|
4
|
-
*
|
|
5
|
-
* Handles cross-origin 307/302 redirects that strip the Range header.
|
|
6
|
-
* When a redirect causes the server to return 200 (full content) instead of
|
|
7
|
-
* 206 (partial), we either retry against the final URL or slice the correct
|
|
8
|
-
* bytes from the full response — matching igvxhr behavior.
|
|
9
|
-
*/
|
|
10
|
-
export interface ByteRange {
|
|
11
|
-
start: number;
|
|
12
|
-
size: number;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Fetch a byte range from a URL as an ArrayBuffer.
|
|
16
|
-
*
|
|
17
|
-
* Handles two redirect failure modes:
|
|
18
|
-
* 1. Cross-origin redirect strips Range header → server returns 200 (full file).
|
|
19
|
-
* We retry directly against response.url (the final URL post-redirect).
|
|
20
|
-
* 2. If retry still returns 200, we slice the requested bytes from the full
|
|
21
|
-
* response (matching igvxhr's fallback behavior).
|
|
22
|
-
*
|
|
23
|
-
* On HTTP 416 (Range Not Satisfiable), fetches the actual file size via HEAD
|
|
24
|
-
* and retries once with a clamped range.
|
|
25
|
-
*/
|
|
26
|
-
export declare function fetchRange(url: string, range: ByteRange, signal?: AbortSignal): Promise<ArrayBuffer>;
|
|
27
|
-
/**
|
|
28
|
-
* Fetch the Content-Length of a URL via a HEAD request.
|
|
29
|
-
* If redirected and Content-Length is missing, retries against the final URL.
|
|
30
|
-
*/
|
|
31
|
-
export declare function getContentLength(url: string, signal?: AbortSignal): Promise<number>;
|
|
32
|
-
/**
|
|
33
|
-
* Buffered reader that caches fetched data to minimize HTTP requests.
|
|
34
|
-
* When a requested range is within the cached buffer, no fetch is needed.
|
|
35
|
-
*
|
|
36
|
-
* On HTTP 416, recovers by fetching the file's Content-Length and retrying,
|
|
37
|
-
* matching js/bigwig/bufferedReader.ts behavior.
|
|
38
|
-
*/
|
|
39
|
-
export declare class BufferedRangeReader {
|
|
40
|
-
private readonly url;
|
|
41
|
-
private readonly bufferSize;
|
|
42
|
-
private cachedRange;
|
|
43
|
-
private cachedData;
|
|
44
|
-
private contentLength;
|
|
45
|
-
constructor(url: string, bufferSize?: number);
|
|
46
|
-
dataViewForRange(requestedRange: ByteRange, signal?: AbortSignal, retries?: number): Promise<DataView>;
|
|
47
|
-
loadArrayBuffer(range: ByteRange, signal?: AbortSignal): Promise<ArrayBuffer>;
|
|
48
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* R-tree implementation for BigWig spatial range queries.
|
|
3
|
-
* Port of js/bigwig/rpTree.ts.
|
|
4
|
-
*/
|
|
5
|
-
export interface RPTreeLeafItem {
|
|
6
|
-
isLeaf: boolean;
|
|
7
|
-
startChrom: number;
|
|
8
|
-
startBase: number;
|
|
9
|
-
endChrom: number;
|
|
10
|
-
endBase: number;
|
|
11
|
-
childOffset: number;
|
|
12
|
-
dataSize: number;
|
|
13
|
-
dataOffset: number;
|
|
14
|
-
}
|
|
15
|
-
export declare class RPTree {
|
|
16
|
-
private littleEndian;
|
|
17
|
-
private readonly nodeCache;
|
|
18
|
-
private readonly url;
|
|
19
|
-
private readonly startOffset;
|
|
20
|
-
private header;
|
|
21
|
-
constructor(url: string, startOffset: number);
|
|
22
|
-
init(signal?: AbortSignal): Promise<void>;
|
|
23
|
-
/** Find all leaf items that overlap the given genomic range. */
|
|
24
|
-
findLeafItemsOverlapping(chrIdx1: number, startBase: number, chrIdx2: number, endBase: number, signal?: AbortSignal): Promise<RPTreeLeafItem[]>;
|
|
25
|
-
private readNode;
|
|
26
|
-
private getParserFor;
|
|
27
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Data source for dynseq wig tracks.
|
|
3
|
-
*
|
|
4
|
-
* Wraps a BigWig data source and attaches DNA sequence to each feature
|
|
5
|
-
* at fetch time — matching the igv.js pattern where sequence is fetched
|
|
6
|
-
* during getFeatures(), not during rendering.
|
|
7
|
-
*
|
|
8
|
-
* At high zoom (bpPerPixel < 2), fetches the region's sequence in a
|
|
9
|
-
* single call and slices it per-feature. At low zoom, returns features
|
|
10
|
-
* without sequence (the renderer falls back to bars).
|
|
11
|
-
*/
|
|
12
|
-
import type { DataSource, Locus, WigFeature } from '../types';
|
|
13
|
-
/** A function that fetches DNA sequence for a genomic region. */
|
|
14
|
-
export type SequenceProvider = (locus: Locus) => Promise<string>;
|
|
15
|
-
export declare class DynseqDataSource implements DataSource<WigFeature> {
|
|
16
|
-
private wigSource;
|
|
17
|
-
private sequenceProvider;
|
|
18
|
-
constructor(wigSource: DataSource<WigFeature>, sequenceProvider: SequenceProvider);
|
|
19
|
-
fetch(locus: Locus, bpPerPixel: number, signal: AbortSignal): Promise<WigFeature[]>;
|
|
20
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dynamic sequence (dynseq) renderer for wig tracks.
|
|
3
|
-
*
|
|
4
|
-
* Renders DNA base letters (A, C, G, T, N) as filled glyphs whose height
|
|
5
|
-
* is proportional to the wig signal value. Only activates at high zoom
|
|
6
|
-
* (bpPerPixel < 2) where individual bases are resolvable.
|
|
7
|
-
*
|
|
8
|
-
* Ported from js/feature/wigTrack.ts renderDynSeq/drawLetterGlyph/drawSVGPath.
|
|
9
|
-
*/
|
|
10
|
-
/** Default nucleotide color scheme matching igv.js. */
|
|
11
|
-
export declare const defaultNucleotideColors: Readonly<Record<string, string>>;
|
|
12
|
-
/**
|
|
13
|
-
* Draw a single DNA base letter as a filled glyph.
|
|
14
|
-
*
|
|
15
|
-
* @param ctx - Canvas context
|
|
16
|
-
* @param base - The base character (A, C, G, T, N)
|
|
17
|
-
* @param x - Left edge pixel position
|
|
18
|
-
* @param y - Top edge pixel position
|
|
19
|
-
* @param width - Glyph width in pixels
|
|
20
|
-
* @param height - Glyph height in pixels
|
|
21
|
-
* @param color - Fill color
|
|
22
|
-
* @param flipVertical - Flip the glyph vertically (for negative values)
|
|
23
|
-
*/
|
|
24
|
-
export declare function drawLetterGlyph(ctx: CanvasRenderingContext2D, base: string, x: number, y: number, width: number, height: number, color: string, flipVertical?: boolean): void;
|
|
25
|
-
/**
|
|
26
|
-
* Render a single wig feature as dynseq (DNA base glyphs scaled by value).
|
|
27
|
-
*
|
|
28
|
-
* @param ctx - Canvas context
|
|
29
|
-
* @param sequence - DNA sequence string for this feature's region
|
|
30
|
-
* @param x - Left edge pixel position of the feature
|
|
31
|
-
* @param width - Pixel width of the feature
|
|
32
|
-
* @param y - Y pixel of the data value
|
|
33
|
-
* @param y0 - Y pixel of the zero line
|
|
34
|
-
* @param value - The wig data value (for determining negative/flip)
|
|
35
|
-
* @param colors - Nucleotide color map
|
|
36
|
-
*/
|
|
37
|
-
export declare function renderDynSeqFeature(ctx: CanvasRenderingContext2D, sequence: string, x: number, width: number, y: number, y0: number, value: number, colors?: Readonly<Record<string, string>>): void;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standalone gene feature renderer.
|
|
3
|
-
*
|
|
4
|
-
* Adapted from js/feature/render/renderFeature.ts but with no `this` context —
|
|
5
|
-
* all configuration is passed as explicit parameters.
|
|
6
|
-
*
|
|
7
|
-
* Scope: exon/UTR/CDS rendering, intron lines, strand arrows, labels.
|
|
8
|
-
* Deferred: amino acid rendering, QTL selection highlighting.
|
|
9
|
-
*/
|
|
10
|
-
import type { GeneFeature, GeneRenderConfig, RenderContext } from './types';
|
|
11
|
-
/**
|
|
12
|
-
* Render a set of gene features onto a canvas context.
|
|
13
|
-
*
|
|
14
|
-
* Features should already have `.row` assigned (via `pack()`).
|
|
15
|
-
* The canvas should be sized and cleared before calling this.
|
|
16
|
-
*/
|
|
17
|
-
export declare function renderGeneTrack(ctx: CanvasRenderingContext2D, features: GeneFeature[], config: GeneRenderConfig, rc: RenderContext): void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Preset render themes for gene tracks.
|
|
3
|
-
*
|
|
4
|
-
* Each theme is a Partial<GeneRenderConfig> that can be spread over defaults.
|
|
5
|
-
* Usage: { ...defaultGeneRenderConfig(), ...modernTheme }
|
|
6
|
-
*/
|
|
7
|
-
import type { GeneRenderConfig } from './types';
|
|
8
|
-
/** Modern theme — softer colors, rounded exons, strand-based coloring. */
|
|
9
|
-
export declare const modernTheme: Partial<GeneRenderConfig>;
|
|
10
|
-
/** Dark theme — modern theme adapted for dark backgrounds. */
|
|
11
|
-
export declare const darkTheme: Partial<GeneRenderConfig>;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Canvas manager for rendering gene features.
|
|
3
|
-
*
|
|
4
|
-
* Extends BaseTrackCanvas — canvas lifecycle (DPR, resize, attach/detach,
|
|
5
|
-
* background) is handled by the base class. This class only implements
|
|
6
|
-
* gene-specific logic: feature packing, height computation, and rendering.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* const canvas = document.createElement('canvas')
|
|
10
|
-
* const track = new GeneTrackCanvas(canvas, { locus, features })
|
|
11
|
-
* track.attachTo(containerDiv)
|
|
12
|
-
*/
|
|
13
|
-
import type { GeneFeature, GeneRenderConfig, Locus, RenderContext, GeneTrackSessionConfig } from './types';
|
|
14
|
-
import type { CanvasProvider } from './canvasProvider';
|
|
15
|
-
import type { RenderTheme } from './renderTheme';
|
|
16
|
-
import { BaseTrackCanvas } from './baseTrackCanvas';
|
|
17
|
-
export type { Locus } from './types';
|
|
18
|
-
export interface GeneTrackCanvasOptions {
|
|
19
|
-
locus: Locus;
|
|
20
|
-
features: GeneFeature[];
|
|
21
|
-
/** Per-track config overrides. Applied after theme-derived defaults. */
|
|
22
|
-
config?: Partial<GeneRenderConfig>;
|
|
23
|
-
/** Unified render theme. Palette drives default colors/fonts. */
|
|
24
|
-
theme?: Partial<RenderTheme>;
|
|
25
|
-
/** Fixed pixel height. If not set, computed from row count. */
|
|
26
|
-
height?: number;
|
|
27
|
-
/** Background color. Default: palette.background. */
|
|
28
|
-
background?: string;
|
|
29
|
-
/** Canvas provider for environment abstraction. Default: DOMCanvasProvider. */
|
|
30
|
-
canvasProvider?: CanvasProvider;
|
|
31
|
-
}
|
|
32
|
-
export declare class GeneTrackCanvas extends BaseTrackCanvas<GeneRenderConfig> {
|
|
33
|
-
private features;
|
|
34
|
-
private fixedHeight;
|
|
35
|
-
private background;
|
|
36
|
-
/** Most recently packed features, available after render(). */
|
|
37
|
-
private packedFeatures;
|
|
38
|
-
readonly type = "gene";
|
|
39
|
-
constructor(canvas: HTMLCanvasElement, options: GeneTrackCanvasOptions);
|
|
40
|
-
/** Update features and re-render. */
|
|
41
|
-
setFeatures(features: GeneFeature[]): void;
|
|
42
|
-
protected computeHeight(_width: number): number;
|
|
43
|
-
protected getBackground(): string;
|
|
44
|
-
protected doRender(ctx: CanvasRenderingContext2D, _width: number, _height: number, rc: RenderContext): void;
|
|
45
|
-
serializeConfig(theme: RenderTheme): GeneTrackSessionConfig;
|
|
46
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
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 (gene.color = palette.primary)
|
|
9
|
-
* 2. Per-track-type overrides (theme.gene.borderRadius = 3)
|
|
10
|
-
* 3. Per-track instance overrides (options.config.color = 'red')
|
|
11
|
-
*
|
|
12
|
-
* Renderers never see RenderTheme directly — they still consume GeneRenderConfig,
|
|
13
|
-
* WigRenderConfig, etc. The theme system produces those configs.
|
|
14
|
-
*/
|
|
15
|
-
import type { GeneRenderConfig, WigRenderConfig, RulerRenderConfig } 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
|
-
gene?: Partial<GeneRenderConfig>;
|
|
45
|
-
wig?: Partial<WigRenderConfig>;
|
|
46
|
-
ruler?: Partial<RulerRenderConfig>;
|
|
47
|
-
}
|
|
48
|
-
/** Returns the default render theme matching classic igv.js appearance. */
|
|
49
|
-
export declare function defaultRenderTheme(): RenderTheme;
|
|
50
|
-
/**
|
|
51
|
-
* Deep-merge a partial theme into the defaults.
|
|
52
|
-
* If no overrides provided, returns the default theme.
|
|
53
|
-
*/
|
|
54
|
-
export declare function resolveTheme(overrides?: Partial<RenderTheme>): RenderTheme;
|
|
55
|
-
/**
|
|
56
|
-
* Resolve a full GeneRenderConfig from a theme + optional per-track overrides.
|
|
57
|
-
*
|
|
58
|
-
* Resolution: palette-derived defaults → theme.gene overrides → per-track overrides.
|
|
59
|
-
*/
|
|
60
|
-
export declare function resolveGeneConfig(theme: RenderTheme, overrides?: Partial<GeneRenderConfig>): GeneRenderConfig;
|
|
61
|
-
/**
|
|
62
|
-
* Resolve a full WigRenderConfig from a theme + optional per-track overrides.
|
|
63
|
-
*
|
|
64
|
-
* Resolution: palette-derived defaults → theme.wig overrides → per-track overrides.
|
|
65
|
-
*/
|
|
66
|
-
export declare function resolveWigConfig(theme: RenderTheme, overrides?: Partial<WigRenderConfig>): WigRenderConfig;
|
|
67
|
-
/**
|
|
68
|
-
* Resolve a full RulerRenderConfig from a theme + optional per-track overrides.
|
|
69
|
-
*
|
|
70
|
-
* Resolution: palette-derived defaults → theme.ruler overrides → per-track overrides.
|
|
71
|
-
*/
|
|
72
|
-
export declare function resolveRulerConfig(theme: RenderTheme, overrides?: Partial<RulerRenderConfig>): RulerRenderConfig;
|