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.
Files changed (290) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +287 -0
  3. package/dist/igv.d.ts +667 -0
  4. package/dist/igv.esm.js +76708 -0
  5. package/dist/igv.esm.min.js +26 -0
  6. package/dist/igv.esm.min.js.map +1 -0
  7. package/dist/igv.js +76716 -0
  8. package/dist/igv.min.js +26 -0
  9. package/dist/igv.min.js.map +1 -0
  10. package/dist/loom.d.ts +667 -0
  11. package/dist/loom.esm.js +14927 -0
  12. package/dist/loom.esm.min.js +2 -0
  13. package/dist/loom.esm.min.js.map +1 -0
  14. package/dist/loom.js +15114 -0
  15. package/dist/loom.min.js +2 -0
  16. package/dist/loom.min.js.map +1 -0
  17. package/dist/types/agent/index.d.ts +4 -0
  18. package/dist/types/agent/stateProjection.d.ts +115 -0
  19. package/dist/types/agent/trackSelector.d.ts +31 -0
  20. package/dist/types/baseTrackCanvas.d.ts +62 -0
  21. package/dist/types/bigwig/binaryParser.d.ts +25 -0
  22. package/dist/types/bigwig/bpTree.d.ts +40 -0
  23. package/dist/types/bigwig/bwReader.d.ts +69 -0
  24. package/dist/types/bigwig/chromTree.d.ts +28 -0
  25. package/dist/types/bigwig/index.d.ts +66 -0
  26. package/dist/types/bigwig/inflate.d.ts +9 -0
  27. package/dist/types/bigwig/rangeReader.d.ts +48 -0
  28. package/dist/types/bigwig/rpTree.d.ts +27 -0
  29. package/dist/types/canvasProvider.d.ts +36 -0
  30. package/dist/types/commandDispatcher.d.ts +199 -0
  31. package/dist/types/contextMenu.d.ts +64 -0
  32. package/dist/types/contextMenuProvider.d.ts +25 -0
  33. package/dist/types/data/cachedSequence.d.ts +19 -0
  34. package/dist/types/data/ucscApi.d.ts +21 -0
  35. package/dist/types/data/ucscSequence.d.ts +19 -0
  36. package/dist/types/dataLifecycle.d.ts +16 -0
  37. package/dist/types/dataSources/bigWigDataSource.d.ts +24 -0
  38. package/dist/types/dataSources/dataSourceCacheKey.d.ts +9 -0
  39. package/dist/types/dataSources/dynseqDataSource.d.ts +20 -0
  40. package/dist/types/dataSources/featureSourceFactory.d.ts +46 -0
  41. package/dist/types/dataSources/geneDataSource.d.ts +16 -0
  42. package/dist/types/dataSources/gtxDataSource.d.ts +42 -0
  43. package/dist/types/dataSources/sequenceDataSource.d.ts +15 -0
  44. package/dist/types/dataSources/textFeatureSource.d.ts +63 -0
  45. package/dist/types/decode/bed.d.ts +64 -0
  46. package/dist/types/decode/bedpe.d.ts +36 -0
  47. package/dist/types/decode/exonUtils.d.ts +29 -0
  48. package/dist/types/decode/gff.d.ts +58 -0
  49. package/dist/types/decode/interact.d.ts +19 -0
  50. package/dist/types/decode/ucsc.d.ts +56 -0
  51. package/dist/types/dynseqRenderer.d.ts +37 -0
  52. package/dist/types/events.d.ts +23 -0
  53. package/dist/types/export/canvas2svg.d.ts +166 -0
  54. package/dist/types/export/index.d.ts +2 -0
  55. package/dist/types/featureCache.d.ts +69 -0
  56. package/dist/types/formats/featureParser.d.ts +72 -0
  57. package/dist/types/formats/formatDetection.d.ts +46 -0
  58. package/dist/types/geneRenderer.d.ts +17 -0
  59. package/dist/types/geneThemes.d.ts +11 -0
  60. package/dist/types/geneTrackCanvas.d.ts +46 -0
  61. package/dist/types/genome/chromAlias.d.ts +46 -0
  62. package/dist/types/genome/chromSizes.d.ts +53 -0
  63. package/dist/types/genome/genome.d.ts +51 -0
  64. package/dist/types/genomeBrowser.d.ts +189 -0
  65. package/dist/types/gtx/fetchCoordinator.d.ts +34 -0
  66. package/dist/types/gtx/gtxReader.d.ts +144 -0
  67. package/dist/types/gtx/index.d.ts +40 -0
  68. package/dist/types/gtx/zstdWasm.d.ts +22 -0
  69. package/dist/types/headlessGenomeBrowser.d.ts +450 -0
  70. package/dist/types/index.d.ts +123 -0
  71. package/dist/types/intervalTree.d.ts +56 -0
  72. package/dist/types/io/binaryParser.d.ts +25 -0
  73. package/dist/types/io/index.d.ts +7 -0
  74. package/dist/types/io/rangeReader.d.ts +48 -0
  75. package/dist/types/locusUtils.d.ts +37 -0
  76. package/dist/types/pack.d.ts +41 -0
  77. package/dist/types/popupProvider.d.ts +22 -0
  78. package/dist/types/remoteProtocol.d.ts +79 -0
  79. package/dist/types/renderTheme.d.ts +72 -0
  80. package/dist/types/renderThemePresets.d.ts +16 -0
  81. package/dist/types/roi/index.d.ts +3 -0
  82. package/dist/types/roi/roiRenderer.d.ts +24 -0
  83. package/dist/types/roi/roiSet.d.ts +41 -0
  84. package/dist/types/rulerRenderer.d.ts +14 -0
  85. package/dist/types/rulerTrackCanvas.d.ts +32 -0
  86. package/dist/types/sequence/sequenceUtils.d.ts +44 -0
  87. package/dist/types/session.d.ts +55 -0
  88. package/dist/types/src/bigwig/index.d.ts +66 -0
  89. package/dist/types/src/canvasProvider.d.ts +36 -0
  90. package/dist/types/src/commandDispatcher.d.ts +220 -0
  91. package/dist/types/src/contextMenu.d.ts +64 -0
  92. package/dist/types/src/contextMenuProvider.d.ts +25 -0
  93. package/dist/types/src/data/cachedSequence.d.ts +19 -0
  94. package/dist/types/src/data/ucscApi.d.ts +21 -0
  95. package/dist/types/src/data/ucscSequence.d.ts +19 -0
  96. package/dist/types/src/dataLifecycle.d.ts +16 -0
  97. package/dist/types/src/dataSources/bigWigDataSource.d.ts +24 -0
  98. package/dist/types/src/dataSources/dataSourceCacheKey.d.ts +9 -0
  99. package/dist/types/src/dataSources/featureSourceFactory.d.ts +46 -0
  100. package/dist/types/src/dataSources/geneDataSource.d.ts +16 -0
  101. package/dist/types/src/dataSources/gtxDataSource.d.ts +42 -0
  102. package/dist/types/src/dataSources/sequenceDataSource.d.ts +15 -0
  103. package/dist/types/src/dataSources/textFeatureSource.d.ts +63 -0
  104. package/dist/types/src/decode/bed.d.ts +64 -0
  105. package/dist/types/src/decode/bedpe.d.ts +36 -0
  106. package/dist/types/src/decode/exonUtils.d.ts +29 -0
  107. package/dist/types/src/decode/gff.d.ts +58 -0
  108. package/dist/types/src/decode/interact.d.ts +19 -0
  109. package/dist/types/src/decode/ucsc.d.ts +56 -0
  110. package/dist/types/src/events.d.ts +23 -0
  111. package/dist/types/src/export/canvas2svg.d.ts +166 -0
  112. package/dist/types/src/export/index.d.ts +2 -0
  113. package/dist/types/src/featureCache.d.ts +69 -0
  114. package/dist/types/src/formats/featureParser.d.ts +72 -0
  115. package/dist/types/src/formats/formatDetection.d.ts +46 -0
  116. package/dist/types/src/genome/chromAlias.d.ts +46 -0
  117. package/dist/types/src/genome/chromSizes.d.ts +53 -0
  118. package/dist/types/src/genome/genome.d.ts +51 -0
  119. package/dist/types/src/genomeBrowser.d.ts +189 -0
  120. package/dist/types/src/gtx/fetchCoordinator.d.ts +34 -0
  121. package/dist/types/src/gtx/gtxReader.d.ts +144 -0
  122. package/dist/types/src/gtx/index.d.ts +40 -0
  123. package/dist/types/src/gtx/zstdWasm.d.ts +22 -0
  124. package/dist/types/src/headlessGenomeBrowser.d.ts +450 -0
  125. package/dist/types/src/index.d.ts +123 -0
  126. package/dist/types/src/intervalTree.d.ts +56 -0
  127. package/dist/types/src/io/binaryParser.d.ts +25 -0
  128. package/dist/types/src/io/index.d.ts +7 -0
  129. package/dist/types/src/io/rangeReader.d.ts +48 -0
  130. package/dist/types/src/locusUtils.d.ts +37 -0
  131. package/dist/types/src/pack.d.ts +41 -0
  132. package/dist/types/src/popupProvider.d.ts +22 -0
  133. package/dist/types/src/remoteProtocol.d.ts +81 -0
  134. package/dist/types/src/roi/index.d.ts +3 -0
  135. package/dist/types/src/roi/roiRenderer.d.ts +24 -0
  136. package/dist/types/src/roi/roiSet.d.ts +41 -0
  137. package/dist/types/src/sequence/sequenceUtils.d.ts +44 -0
  138. package/dist/types/src/session.d.ts +55 -0
  139. package/dist/types/src/stateProjection.d.ts +115 -0
  140. package/dist/types/src/tabix/index.d.ts +48 -0
  141. package/dist/types/src/themes/index.d.ts +3 -0
  142. package/dist/types/src/themes/renderTheme.d.ts +86 -0
  143. package/dist/types/src/themes/renderThemePresets.d.ts +16 -0
  144. package/dist/types/src/trackRegistry.d.ts +81 -0
  145. package/dist/types/src/trackSelector.d.ts +31 -0
  146. package/dist/types/src/tracks/annotation/annotationRenderer.d.ts +17 -0
  147. package/dist/types/src/tracks/annotation/annotationThemes.d.ts +11 -0
  148. package/dist/types/src/tracks/annotation/annotationTrackCanvas.d.ts +58 -0
  149. package/dist/types/src/tracks/annotation/index.d.ts +4 -0
  150. package/dist/types/src/tracks/axis/axisRenderer.d.ts +19 -0
  151. package/dist/types/src/tracks/axis/index.d.ts +1 -0
  152. package/dist/types/src/tracks/baseTrackCanvas.d.ts +113 -0
  153. package/dist/types/src/tracks/dynseq/dynseqRenderer.d.ts +38 -0
  154. package/dist/types/src/tracks/dynseq/index.d.ts +1 -0
  155. package/dist/types/src/tracks/index.d.ts +7 -0
  156. package/dist/types/src/tracks/interaction/index.d.ts +4 -0
  157. package/dist/types/src/tracks/interaction/interactionRenderer.d.ts +52 -0
  158. package/dist/types/src/tracks/interaction/interactionTrackCanvas.d.ts +54 -0
  159. package/dist/types/src/tracks/ruler/index.d.ts +3 -0
  160. package/dist/types/src/tracks/ruler/rulerRenderer.d.ts +25 -0
  161. package/dist/types/src/tracks/ruler/rulerTrackCanvas.d.ts +43 -0
  162. package/dist/types/src/tracks/sequence/index.d.ts +5 -0
  163. package/dist/types/src/tracks/sequence/sequenceRenderer.d.ts +34 -0
  164. package/dist/types/src/tracks/sequence/sequenceThemes.d.ts +11 -0
  165. package/dist/types/src/tracks/sequence/sequenceTrackCanvas.d.ts +67 -0
  166. package/dist/types/src/tracks/wig/index.d.ts +5 -0
  167. package/dist/types/src/tracks/wig/wigRenderer.d.ts +15 -0
  168. package/dist/types/src/tracks/wig/wigSummary.d.ts +31 -0
  169. package/dist/types/src/tracks/wig/wigThemes.d.ts +15 -0
  170. package/dist/types/src/tracks/wig/wigTrackCanvas.d.ts +82 -0
  171. package/dist/types/src/types.d.ts +885 -0
  172. package/dist/types/src/ui/components/LoomBrowserShell.d.ts +52 -0
  173. package/dist/types/src/ui/components/LoomChromosomeSelect.d.ts +18 -0
  174. package/dist/types/src/ui/components/LoomContextMenu.d.ts +39 -0
  175. package/dist/types/src/ui/components/LoomExportControls.d.ts +13 -0
  176. package/dist/types/src/ui/components/LoomInputDialog.d.ts +27 -0
  177. package/dist/types/src/ui/components/LoomLocusInput.d.ts +18 -0
  178. package/dist/types/src/ui/components/LoomNavbar.d.ts +15 -0
  179. package/dist/types/src/ui/components/LoomPopup.d.ts +32 -0
  180. package/dist/types/src/ui/components/LoomWindowSize.d.ts +14 -0
  181. package/dist/types/src/ui/components/LoomZoomControls.d.ts +10 -0
  182. package/dist/types/src/ui/index.d.ts +21 -0
  183. package/dist/types/src/ui/themes.d.ts +14 -0
  184. package/dist/types/src/worker/nodeWorkerProvider.d.ts +28 -0
  185. package/dist/types/src/worker/taskHandler.d.ts +15 -0
  186. package/dist/types/src/worker/webWorkerProvider.d.ts +51 -0
  187. package/dist/types/src/worker/workerScript.d.ts +11 -0
  188. package/dist/types/src/workerProvider.d.ts +76 -0
  189. package/dist/types/stateProjection.d.ts +115 -0
  190. package/dist/types/tabix/bgzBlockLoader.d.ts +60 -0
  191. package/dist/types/tabix/bgzf.d.ts +43 -0
  192. package/dist/types/tabix/index.d.ts +48 -0
  193. package/dist/types/tabix/tabixIndex.d.ts +85 -0
  194. package/dist/types/tabix/tabixReader.d.ts +60 -0
  195. package/dist/types/tabix/virtualOffset.d.ts +41 -0
  196. package/dist/types/test/src/mockCanvasProvider.d.ts +67 -0
  197. package/dist/types/test/src/testBedDecode.d.ts +1 -0
  198. package/dist/types/test/src/testCanvas2SVG.d.ts +7 -0
  199. package/dist/types/test/src/testChromAlias.d.ts +1 -0
  200. package/dist/types/test/src/testCommandDispatcher.d.ts +1 -0
  201. package/dist/types/test/src/testData.d.ts +7 -0
  202. package/dist/types/test/src/testDataLifecycle.d.ts +1 -0
  203. package/dist/types/test/src/testDataSourceCacheKey.d.ts +1 -0
  204. package/dist/types/test/src/testDataSources.d.ts +5 -0
  205. package/dist/types/test/src/testDecodeUcsc.d.ts +1 -0
  206. package/dist/types/test/src/testEvents.d.ts +1 -0
  207. package/dist/types/test/src/testFeatureCache.d.ts +1 -0
  208. package/dist/types/test/src/testFeatureParser.d.ts +1 -0
  209. package/dist/types/test/src/testFormatDetection.d.ts +1 -0
  210. package/dist/types/test/src/testGffDecode.d.ts +1 -0
  211. package/dist/types/test/src/testHeadlessBrowser.d.ts +1 -0
  212. package/dist/types/test/src/testInteractionDecoder.d.ts +1 -0
  213. package/dist/types/test/src/testIntervalTree.d.ts +1 -0
  214. package/dist/types/test/src/testLocusUtils.d.ts +1 -0
  215. package/dist/types/test/src/testPack.d.ts +1 -0
  216. package/dist/types/test/src/testROI.d.ts +1 -0
  217. package/dist/types/test/src/testRemoteProtocol.d.ts +1 -0
  218. package/dist/types/test/src/testRenderTheme.d.ts +1 -0
  219. package/dist/types/test/src/testSVGExport.d.ts +5 -0
  220. package/dist/types/test/src/testSequence.d.ts +1 -0
  221. package/dist/types/test/src/testSession.d.ts +1 -0
  222. package/dist/types/test/src/testTrackSelector.d.ts +1 -0
  223. package/dist/types/test/src/testTrackSerialize.d.ts +1 -0
  224. package/dist/types/test/src/testWigSummary.d.ts +1 -0
  225. package/dist/types/test/src/testWorkerDispatch.d.ts +9 -0
  226. package/dist/types/themes/index.d.ts +3 -0
  227. package/dist/types/themes/renderTheme.d.ts +86 -0
  228. package/dist/types/themes/renderThemePresets.d.ts +16 -0
  229. package/dist/types/trackRegistry.d.ts +81 -0
  230. package/dist/types/trackSelector.d.ts +31 -0
  231. package/dist/types/tracks/annotation/annotationRenderer.d.ts +17 -0
  232. package/dist/types/tracks/annotation/annotationThemes.d.ts +11 -0
  233. package/dist/types/tracks/annotation/annotationTrackCanvas.d.ts +58 -0
  234. package/dist/types/tracks/annotation/index.d.ts +4 -0
  235. package/dist/types/tracks/axis/axisRenderer.d.ts +19 -0
  236. package/dist/types/tracks/axis/index.d.ts +1 -0
  237. package/dist/types/tracks/baseTrackCanvas.d.ts +113 -0
  238. package/dist/types/tracks/dynseq/dynseqRenderer.d.ts +38 -0
  239. package/dist/types/tracks/dynseq/index.d.ts +1 -0
  240. package/dist/types/tracks/gene/geneRenderer.d.ts +17 -0
  241. package/dist/types/tracks/gene/geneThemes.d.ts +11 -0
  242. package/dist/types/tracks/gene/geneTrackCanvas.d.ts +58 -0
  243. package/dist/types/tracks/gene/index.d.ts +4 -0
  244. package/dist/types/tracks/index.d.ts +7 -0
  245. package/dist/types/tracks/interaction/index.d.ts +4 -0
  246. package/dist/types/tracks/interaction/interactionRenderer.d.ts +52 -0
  247. package/dist/types/tracks/interaction/interactionTrackCanvas.d.ts +54 -0
  248. package/dist/types/tracks/ruler/index.d.ts +3 -0
  249. package/dist/types/tracks/ruler/rulerRenderer.d.ts +25 -0
  250. package/dist/types/tracks/ruler/rulerTrackCanvas.d.ts +43 -0
  251. package/dist/types/tracks/sequence/index.d.ts +5 -0
  252. package/dist/types/tracks/sequence/sequenceRenderer.d.ts +34 -0
  253. package/dist/types/tracks/sequence/sequenceThemes.d.ts +11 -0
  254. package/dist/types/tracks/sequence/sequenceTrackCanvas.d.ts +67 -0
  255. package/dist/types/tracks/wig/index.d.ts +5 -0
  256. package/dist/types/tracks/wig/wigRenderer.d.ts +15 -0
  257. package/dist/types/tracks/wig/wigSummary.d.ts +31 -0
  258. package/dist/types/tracks/wig/wigThemes.d.ts +15 -0
  259. package/dist/types/tracks/wig/wigTrackCanvas.d.ts +82 -0
  260. package/dist/types/types.d.ts +885 -0
  261. package/dist/types/ui/components/IgvBrowserShell.d.ts +52 -0
  262. package/dist/types/ui/components/IgvChromosomeSelect.d.ts +18 -0
  263. package/dist/types/ui/components/IgvExportControls.d.ts +13 -0
  264. package/dist/types/ui/components/IgvLocusInput.d.ts +18 -0
  265. package/dist/types/ui/components/IgvNavbar.d.ts +15 -0
  266. package/dist/types/ui/components/IgvWindowSize.d.ts +14 -0
  267. package/dist/types/ui/components/IgvZoomControls.d.ts +10 -0
  268. package/dist/types/ui/components/LoomBrowserShell.d.ts +52 -0
  269. package/dist/types/ui/components/LoomChromosomeSelect.d.ts +18 -0
  270. package/dist/types/ui/components/LoomContextMenu.d.ts +39 -0
  271. package/dist/types/ui/components/LoomExportControls.d.ts +13 -0
  272. package/dist/types/ui/components/LoomInputDialog.d.ts +27 -0
  273. package/dist/types/ui/components/LoomLocusInput.d.ts +18 -0
  274. package/dist/types/ui/components/LoomNavbar.d.ts +15 -0
  275. package/dist/types/ui/components/LoomPopup.d.ts +32 -0
  276. package/dist/types/ui/components/LoomWindowSize.d.ts +14 -0
  277. package/dist/types/ui/components/LoomZoomControls.d.ts +10 -0
  278. package/dist/types/ui/index.d.ts +21 -0
  279. package/dist/types/ui/themes.d.ts +14 -0
  280. package/dist/types/wigRenderer.d.ts +15 -0
  281. package/dist/types/wigSummary.d.ts +31 -0
  282. package/dist/types/wigThemes.d.ts +15 -0
  283. package/dist/types/wigTrackCanvas.d.ts +46 -0
  284. package/dist/types/worker/decodeWig.d.ts +20 -0
  285. package/dist/types/worker/nodeWorkerProvider.d.ts +28 -0
  286. package/dist/types/worker/taskHandler.d.ts +15 -0
  287. package/dist/types/worker/webWorkerProvider.d.ts +51 -0
  288. package/dist/types/worker/workerScript.d.ts +11 -0
  289. package/dist/types/workerProvider.d.ts +76 -0
  290. package/package.json +102 -0
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Preset render themes for sequence tracks.
3
+ *
4
+ * Each theme is a Partial<SequenceRenderConfig> that can be spread over defaults.
5
+ * Usage: resolveSequenceConfig(theme, modernSequenceTheme)
6
+ */
7
+ import type { SequenceRenderConfig } from '../../types';
8
+ /** Modern theme — softer frame colors, solid text, rounded start/stop badges. */
9
+ export declare const modernSequenceTheme: Partial<SequenceRenderConfig>;
10
+ /** Dark theme — muted backgrounds, bright labels, high contrast on dark canvas. */
11
+ export declare const darkSequenceTheme: Partial<SequenceRenderConfig>;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Sequence track canvas — extends BaseTrackCanvas for DNA/RNA sequence display.
3
+ *
4
+ * Layer 2 (Track Canvas): Manages canvas lifecycle, DPR scaling, config state,
5
+ * and delegates rendering to the pure sequenceRenderer.
6
+ *
7
+ * Port of js/sequenceTrack.ts with full feature parity:
8
+ * - DNA/RNA/protein sequence rendering
9
+ * - Reverse complement toggle
10
+ * - Three-frame amino acid translation toggle
11
+ * - Dynamic height (25px default, 115px with translation)
12
+ * - Context menu items (strand toggle, translation toggle)
13
+ * - Visibility window enforcement (bpPerPixel threshold of 10)
14
+ * - Session serialization
15
+ *
16
+ * Data is provided via the standard DataSource lifecycle — the browser fetches
17
+ * sequence through a SequenceDataSource and pushes it via setFeatures().
18
+ * Also supports direct setSequence() for standalone usage.
19
+ */
20
+ import { BaseTrackCanvas } from '../baseTrackCanvas';
21
+ import type { Locus, RenderContext, SequenceRenderConfig, TrackSessionConfig, ContextMenuItem } from '../../types';
22
+ import type { RenderTheme } from '../../themes/renderTheme';
23
+ import type { SequenceFeature } from './sequenceRenderer';
24
+ import type { CanvasProvider } from '../../canvasProvider';
25
+ /** Options for constructing a SequenceTrackCanvas. */
26
+ export interface SequenceTrackCanvasOptions {
27
+ locus: Locus;
28
+ config?: Partial<SequenceRenderConfig>;
29
+ theme?: Partial<RenderTheme>;
30
+ canvasProvider?: CanvasProvider;
31
+ }
32
+ export declare class SequenceTrackCanvas extends BaseTrackCanvas<SequenceRenderConfig> {
33
+ readonly type = "sequence";
34
+ private _sequence;
35
+ private _theme;
36
+ constructor(canvas: HTMLCanvasElement, options: SequenceTrackCanvasOptions);
37
+ /**
38
+ * Whether the current viewport is zoomed in enough to fetch/render sequence.
39
+ * Matches igv.js bppSequenceThreshold check in getFeatures().
40
+ */
41
+ shouldFetchSequence(bpPerPixel: number): boolean;
42
+ /**
43
+ * Standard DataSource lifecycle: browser pushes SequenceFeature[] from SequenceDataSource.
44
+ * Takes the first element (single sequence region) or clears if empty (zoomed out).
45
+ */
46
+ setFeatures(features: SequenceFeature[]): void;
47
+ /** Set the sequence data directly. For standalone usage without a DataSource. */
48
+ setSequence(feature: SequenceFeature | null): void;
49
+ /** Get the current sequence data (for context menu operations). */
50
+ getSequence(): SequenceFeature | null;
51
+ /** Toggle reverse complement display. */
52
+ toggleReversed(): void;
53
+ /** Toggle three-frame translation display. */
54
+ toggleFrameTranslate(): void;
55
+ /**
56
+ * Return context menu items for the sequence track.
57
+ *
58
+ * Matches igv.js SequenceTrack.menuItemList() + contextMenuItemList():
59
+ * - Strand toggle (Forward/Reverse)
60
+ * - Translation toggle (Three-frame Translate / Close Translation)
61
+ */
62
+ getContextMenuItems(_x: number, _y: number): ContextMenuItem[] | undefined;
63
+ protected computeHeight(_width: number): number;
64
+ protected getBackground(): string;
65
+ protected doRender(ctx: CanvasRenderingContext2D, _width: number, _height: number, rc: RenderContext): void;
66
+ serializeConfig(theme: RenderTheme): TrackSessionConfig;
67
+ }
@@ -0,0 +1,5 @@
1
+ export { renderWigTrack } from './wigRenderer';
2
+ export { WigTrackCanvas } from './wigTrackCanvas';
3
+ export type { WigTrackCanvasOptions } from './wigTrackCanvas';
4
+ export { summarizeWigData, computeWigDataRange } from './wigSummary';
5
+ export { modernWigTheme, darkWigTheme, warmWigTheme, lineWigTheme } from './wigThemes';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Standalone wig track renderer.
3
+ *
4
+ * Adapted from js/feature/wigTrack.ts draw() method with no `this` context —
5
+ * all configuration is passed as explicit parameters.
6
+ *
7
+ * Supports four graph types: bar, line, points, and dynseq.
8
+ */
9
+ import type { WigFeature, WigRenderConfig, RenderContext } from '../../types';
10
+ /**
11
+ * Render wig features onto a canvas context.
12
+ *
13
+ * The canvas should be sized and cleared before calling this.
14
+ */
15
+ export declare function renderWigTrack(ctx: CanvasRenderingContext2D, features: WigFeature[], config: WigRenderConfig, rc: RenderContext): void;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Resolution-aware data summarization for wig tracks.
3
+ *
4
+ * When zoomed out, many data points map to the same pixel. This module bins
5
+ * features and applies a window function (mean, min, max) to produce one
6
+ * summary value per pixel-width bin.
7
+ *
8
+ * Ported from js/feature/wigSummary.ts with strict types, no `any`.
9
+ */
10
+ import type { WigFeature, WindowFunction } from '../../types';
11
+ /**
12
+ * Summarize wig features by binning into pixel-width windows and applying
13
+ * a window function.
14
+ *
15
+ * Features must be sorted by position. Wig features cannot overlap.
16
+ *
17
+ * @param features - sorted array of wig features
18
+ * @param startBP - start position in base pairs (left edge of viewport)
19
+ * @param bpPerPixel - base pairs per pixel (bin size)
20
+ * @param windowFunction - aggregation function: mean, min, max, or none
21
+ * @returns summarized features (one per pixel-bin)
22
+ */
23
+ export declare function summarizeWigData(features: WigFeature[], startBP: number, bpPerPixel: number, windowFunction?: WindowFunction): WigFeature[];
24
+ /**
25
+ * Compute the min/max data range from a set of wig features.
26
+ * Useful for autoscaling.
27
+ */
28
+ export declare function computeWigDataRange(features: WigFeature[]): {
29
+ min: number;
30
+ max: number;
31
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Preset render themes for wig tracks.
3
+ *
4
+ * Each theme is a Partial<WigRenderConfig> that can be spread over defaults.
5
+ * Usage: { ...defaultWigRenderConfig(), ...modernWigTheme }
6
+ */
7
+ import type { WigRenderConfig } from '../../types';
8
+ /** Modern theme — blue bars with subtle styling. */
9
+ export declare const modernWigTheme: Partial<WigRenderConfig>;
10
+ /** Dark theme — bright teal on dark background. */
11
+ export declare const darkWigTheme: Partial<WigRenderConfig>;
12
+ /** Warm red theme — for coverage or signal intensity. */
13
+ export declare const warmWigTheme: Partial<WigRenderConfig>;
14
+ /** Line graph variant — modern blue line. */
15
+ export declare const lineWigTheme: Partial<WigRenderConfig>;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Canvas manager for rendering wig (wiggle) tracks.
3
+ *
4
+ * Extends BaseTrackCanvas — canvas lifecycle is handled by the base class.
5
+ * This class implements wig-specific logic: value scaling, autoscale,
6
+ * and rendering delegation.
7
+ *
8
+ * Data summarization (pixel-width binning) is handled at the data source
9
+ * layer by BigWigDataSource, not here. This keeps the render layer
10
+ * focused on rendering and lets headless consumers benefit from
11
+ * pre-summarized data.
12
+ *
13
+ * For dynseq mode, an optional `sequenceProvider` can be passed at construction.
14
+ * When in dynseq mode, the track automatically fetches and attaches DNA sequence
15
+ * to features at high zoom (bpPerPixel < 2). This matches the igv.js pattern
16
+ * where sequence is fetched during getFeatures(), not during rendering.
17
+ *
18
+ * Usage:
19
+ * const canvas = document.createElement('canvas')
20
+ * const track = new WigTrackCanvas(canvas, { locus, features })
21
+ * track.attachTo(containerDiv)
22
+ */
23
+ import type { WigFeature, WigRenderConfig, WindowFunction, Locus, RenderContext, WigTrackSessionConfig, HitTestResult, AxisInfo, ContextMenuItem, NumericState, SequenceProvider } from '../../types';
24
+ import type { CanvasProvider } from '../../canvasProvider';
25
+ import type { RenderTheme } from '../../themes/renderTheme';
26
+ import { BaseTrackCanvas } from '../baseTrackCanvas';
27
+ export interface WigTrackCanvasOptions {
28
+ locus: Locus;
29
+ features: WigFeature[];
30
+ /** Per-track config overrides. Applied after theme-derived defaults. */
31
+ config?: Partial<WigRenderConfig>;
32
+ /** Unified render theme. Palette drives default colors/fonts. */
33
+ theme?: Partial<RenderTheme>;
34
+ /** Fixed pixel height. If not set, uses config.height (default 50). */
35
+ height?: number;
36
+ /** Background color. Overrides palette.background if set. */
37
+ background?: string;
38
+ /** Canvas provider for environment abstraction. Default: DOMCanvasProvider. */
39
+ canvasProvider?: CanvasProvider;
40
+ /** Track name for axis label. */
41
+ name?: string;
42
+ /** Sequence provider for dynseq rendering. When set, dynseq appears in the graph type menu. */
43
+ sequenceProvider?: SequenceProvider;
44
+ }
45
+ export declare class WigTrackCanvas extends BaseTrackCanvas<WigRenderConfig> {
46
+ private features;
47
+ private fixedHeight;
48
+ private _name;
49
+ private _lastDataRange;
50
+ private _sequenceProvider;
51
+ /** Abort controller for in-flight sequence fetch. */
52
+ private _seqAbort;
53
+ /** Callback invoked when the user changes the windowing function via context menu. */
54
+ private _onWindowFunctionChange?;
55
+ readonly type = "wig";
56
+ constructor(canvas: HTMLCanvasElement, options: WigTrackCanvasOptions);
57
+ /** Set a callback invoked when the user changes the windowing function via context menu. */
58
+ set onWindowFunctionChange(cb: ((wf: WindowFunction) => void) | undefined);
59
+ /** Update features and re-render. Recomputes autoscale if enabled. */
60
+ setFeatures(features: WigFeature[]): void;
61
+ /** Update locus and re-render. Re-fetches sequence in dynseq mode. */
62
+ setLocus(locus: Locus): void;
63
+ /** Merge partial config and re-render. Triggers sequence fetch when switching to dynseq. */
64
+ setConfig(config: Partial<WigRenderConfig>): void;
65
+ /**
66
+ * Fetch DNA sequence for current features and re-render.
67
+ * At low zoom (bpPerPixel >= 2), skips fetch — the renderer falls back to bars.
68
+ */
69
+ private augmentWithSequence;
70
+ protected computeHeight(_width: number): number;
71
+ protected getBackground(): string;
72
+ protected doRender(ctx: CanvasRenderingContext2D, _width: number, height: number, rc: RenderContext): void;
73
+ getAxisInfo(): AxisInfo | undefined;
74
+ getContextMenuItems(_x: number, _y: number): ContextMenuItem[];
75
+ /**
76
+ * Return numeric state for shared menu items (autoscale, log scale, set data range).
77
+ * The browser calls numericDataMenuItems() with this state when assembling context menus.
78
+ */
79
+ getNumericState(): NumericState;
80
+ hitTest(x: number, _y: number): HitTestResult<WigFeature>[];
81
+ serializeConfig(theme: RenderTheme): WigTrackSessionConfig;
82
+ }