higlass 1.13.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (392) hide show
  1. package/README.md +48 -54
  2. package/app/globals.d.ts +1 -1
  3. package/app/missing-types.d.ts +4 -1
  4. package/app/scripts/AddTrackDialog.jsx +11 -4
  5. package/app/scripts/AddTrackPositionMenu.jsx +28 -7
  6. package/app/scripts/Annotations1dTrack.js +90 -251
  7. package/app/scripts/Annotations2dTrack.js +12 -7
  8. package/app/scripts/Autocomplete.jsx +13 -28
  9. package/app/scripts/AxisPixi.js +6 -10
  10. package/app/scripts/BarTrack.js +3 -3
  11. package/app/scripts/BedLikeTrack.js +556 -449
  12. package/app/scripts/Button.jsx +1 -1
  13. package/app/scripts/CNVIntervalTrack.js +1 -1
  14. package/app/scripts/CenterTrack.jsx +8 -7
  15. package/app/scripts/Chromosome2DAnnotations.js +1 -1
  16. package/app/scripts/Chromosome2DLabels.js +1 -1
  17. package/app/scripts/ChromosomeGrid.js +49 -38
  18. package/app/scripts/ChromosomeInfo.js +1 -1
  19. package/app/scripts/CombinedTrack.js +3 -1
  20. package/app/scripts/ConfigTrackMenu.jsx +1 -1
  21. package/app/scripts/ConfigViewMenu.jsx +2 -2
  22. package/app/scripts/ContextMenuContainer.jsx +4 -2
  23. package/app/scripts/ContextMenuItem.jsx +14 -2
  24. package/app/scripts/CrossRule.js +1 -1
  25. package/app/scripts/CustomTrackDialog.jsx +2 -2
  26. package/app/scripts/Dialog.jsx +2 -2
  27. package/app/scripts/DragListeningDiv.jsx +1 -1
  28. package/app/scripts/DraggableDiv.jsx +2 -3
  29. package/app/scripts/ExportLinkDialog.jsx +1 -1
  30. package/app/scripts/FilledLine.js +349 -0
  31. package/app/scripts/GalleryTracks.jsx +77 -78
  32. package/app/scripts/GenomePositionSearchBox.jsx +184 -482
  33. package/app/scripts/HeatmapOptions.jsx +4 -2
  34. package/app/scripts/HeatmapTiledPixiTrack.js +23 -32
  35. package/app/scripts/HiGlassComponent.jsx +515 -444
  36. package/app/scripts/HiGlassComponentContext.js +5 -0
  37. package/app/scripts/Horizontal1dHeatmapTrack.js +1 -1
  38. package/app/scripts/Horizontal2DDomainsTrack.js +1 -1
  39. package/app/scripts/HorizontalChromosomeLabels.js +28 -22
  40. package/app/scripts/HorizontalGeneAnnotationsTrack.js +1 -1
  41. package/app/scripts/HorizontalHeatmapTrack.js +2 -2
  42. package/app/scripts/HorizontalMultivecTrack.js +6 -7
  43. package/app/scripts/HorizontalRule.js +1 -2
  44. package/app/scripts/HorizontalTiled1DPixiTrack.js +4 -4
  45. package/app/scripts/HorizontalTiledPlot.jsx +9 -9
  46. package/app/scripts/LeftTrackModifier.js +4 -0
  47. package/app/scripts/ListWrapper.jsx +1 -2
  48. package/app/scripts/MapboxTilesTrack.js +1 -2
  49. package/app/scripts/Modal.jsx +2 -2
  50. package/app/scripts/MoveableTrack.jsx +10 -12
  51. package/app/scripts/NestedContextMenu.jsx +2 -1
  52. package/app/scripts/OSMTileIdsTrack.js +1 -1
  53. package/app/scripts/OverlayTrack.js +4 -4
  54. package/app/scripts/PixiTrack.js +27 -13
  55. package/app/scripts/PlotTypeChooser.jsx +3 -4
  56. package/app/scripts/SearchField.js +5 -5
  57. package/app/scripts/SeriesListItems.jsx +3 -4
  58. package/app/scripts/SeriesListMenu.jsx +95 -53
  59. package/app/scripts/SeriesListSubmenuMixin.jsx +2 -1
  60. package/app/scripts/SketchInlinePicker.jsx +2 -2
  61. package/app/scripts/SortableList.jsx +1 -1
  62. package/app/scripts/Tiled1DPixiTrack.js +4 -1
  63. package/app/scripts/TiledPixiTrack.js +244 -102
  64. package/app/scripts/TiledPlot.jsx +565 -118
  65. package/app/scripts/TilesetFinder.jsx +12 -4
  66. package/app/scripts/Track.js +1 -1
  67. package/app/scripts/TrackArea.jsx +4 -0
  68. package/app/scripts/TrackControl.jsx +2 -2
  69. package/app/scripts/TrackRenderer.jsx +32 -33
  70. package/app/scripts/ValueIntervalTrack.js +1 -1
  71. package/app/scripts/VerticalRule.js +2 -2
  72. package/app/scripts/VerticalTiledPlot.jsx +7 -7
  73. package/app/scripts/ViewConfigEditor.jsx +1 -1
  74. package/app/scripts/ViewContextMenu.jsx +53 -5
  75. package/app/scripts/ViewHeader.jsx +9 -9
  76. package/app/scripts/ViewportTracker2D.js +1 -1
  77. package/app/scripts/api.js +92 -12
  78. package/app/scripts/configs/available-track-types.js +1 -1
  79. package/app/scripts/configs/index.js +6 -1
  80. package/app/scripts/configs/positions-by-datatype.js +2 -2
  81. package/app/scripts/configs/primitives.js +2 -0
  82. package/app/scripts/configs/themes.js +0 -1
  83. package/app/scripts/configs/tracks-info-by-type.js +11 -8
  84. package/app/scripts/configs/tracks-info.js +3 -2
  85. package/app/scripts/d3-context-menu.js +3 -4
  86. package/app/scripts/data-fetchers/DataFetcher.js +35 -36
  87. package/app/scripts/data-fetchers/genbank-fetcher.js +13 -22
  88. package/app/scripts/data-fetchers/local-tile-fetcher.js +10 -8
  89. package/app/scripts/hglib.jsx +62 -71
  90. package/app/scripts/hocs/with-modal.jsx +32 -10
  91. package/app/scripts/hocs/with-pub-sub.js +12 -3
  92. package/app/scripts/hocs/with-theme.jsx +21 -14
  93. package/app/scripts/icons.jsx +3 -2
  94. package/app/scripts/mixwith.js +2 -2
  95. package/app/scripts/options-info.js +49 -11
  96. package/app/scripts/plugins/get-data-fetcher.js +2 -3
  97. package/app/scripts/services/chrom-info.js +32 -4
  98. package/app/scripts/services/element-resize-listener.js +2 -2
  99. package/app/scripts/services/index.js +0 -1
  100. package/app/scripts/services/tile-proxy.js +368 -285
  101. package/app/scripts/services/worker.js +31 -28
  102. package/app/scripts/test-helpers/index.js +2 -1
  103. package/app/scripts/test-helpers/test-helpers.jsx +157 -69
  104. package/app/scripts/types.ts +118 -47
  105. package/app/scripts/utils/LruCache.js +3 -2
  106. package/app/scripts/utils/assert.js +19 -0
  107. package/app/scripts/utils/background-task-scheduler.js +2 -0
  108. package/app/scripts/utils/color-domain-to-rgba-array.js +13 -3
  109. package/app/scripts/utils/copy-text-to-clipboard.js +36 -0
  110. package/app/scripts/utils/decompress.js +33 -0
  111. package/app/scripts/utils/default-tracks.js +46 -0
  112. package/app/scripts/utils/dict-items.js +1 -0
  113. package/app/scripts/utils/dict-keys.js +1 -0
  114. package/app/scripts/utils/dict-values.js +1 -0
  115. package/app/scripts/utils/expand-combined-tracks.js +11 -7
  116. package/app/scripts/utils/fill-in-min-widths.js +47 -21
  117. package/app/scripts/utils/flatten.js +0 -1
  118. package/app/scripts/utils/get-aggregation-function.js +1 -1
  119. package/app/scripts/utils/get-default-track-for-datatype.js +37 -10
  120. package/app/scripts/utils/get-default-tracks-for-datatype.ts +46 -0
  121. package/app/scripts/utils/get-higlass-components.js +27 -3
  122. package/app/scripts/utils/get-track-position-by-uid.js +8 -1
  123. package/app/scripts/utils/get-xylofon.js +12 -9
  124. package/app/scripts/utils/has-parent.js +5 -5
  125. package/app/scripts/utils/hex-string-to-int.js +1 -1
  126. package/app/scripts/utils/index.js +1 -0
  127. package/app/scripts/utils/interval-tree.js +222 -177
  128. package/app/scripts/utils/load-chrom-infos.js +4 -1
  129. package/app/scripts/utils/pixi-text-to-svg.js +5 -9
  130. package/app/scripts/utils/positioned-tracks-to-all-tracks.js +55 -0
  131. package/app/scripts/utils/range-query-2d.js +3 -3
  132. package/app/scripts/utils/reduce.js +12 -5
  133. package/app/scripts/utils/segments-to-rows.js +14 -11
  134. package/app/scripts/utils/svg-line.js +7 -8
  135. package/app/scripts/utils/type-guards.js +16 -7
  136. package/app/scripts/utils/visit-positioned-tracks.js +9 -4
  137. package/app/styles/AddTrackPositionMenu.module.scss +37 -0
  138. package/app/styles/HiGlass.module.scss +3 -1
  139. package/app/styles/d3-context-menu.css +0 -1
  140. package/app/styles/prism.css +1 -0
  141. package/dist/app/schema.json +525 -0
  142. package/dist/app/scripts/AddTrackDialog.d.ts +64 -0
  143. package/dist/app/scripts/AddTrackPositionMenu.d.ts +5 -0
  144. package/dist/app/scripts/Annotations1dTrack.d.ts +15 -0
  145. package/dist/app/scripts/Annotations2dTrack.d.ts +95 -0
  146. package/dist/app/scripts/ArrowheadDomainsTrack.d.ts +36 -0
  147. package/dist/app/scripts/Autocomplete.d.ts +102 -0
  148. package/dist/app/scripts/AxisPixi.d.ts +25 -0
  149. package/dist/app/scripts/BarTrack.d.ts +28 -0
  150. package/dist/app/scripts/BedLikeTrack.d.ts +84 -0
  151. package/dist/app/scripts/Button.d.ts +3 -0
  152. package/dist/app/scripts/CNVIntervalTrack.d.ts +12 -0
  153. package/dist/app/scripts/CenterTiledPlot.d.ts +3 -0
  154. package/dist/app/scripts/CenterTrack.d.ts +92 -0
  155. package/dist/app/scripts/Chromosome2DAnnotations.d.ts +10 -0
  156. package/dist/app/scripts/Chromosome2DLabels.d.ts +13 -0
  157. package/dist/app/scripts/ChromosomeGrid.d.ts +24 -0
  158. package/dist/app/scripts/ChromosomeInfo.d.ts +14 -0
  159. package/dist/app/scripts/CloseTrackMenu.d.ts +10 -0
  160. package/dist/app/scripts/CombinedTrack.d.ts +32 -0
  161. package/dist/app/scripts/ConfigTrackMenu.d.ts +10 -0
  162. package/dist/app/scripts/ConfigViewMenu.d.ts +34 -0
  163. package/dist/app/scripts/ConfigureSeriesMenu.d.ts +3 -0
  164. package/dist/app/scripts/ContextMenuContainer.d.ts +36 -0
  165. package/dist/app/scripts/ContextMenuItem.d.ts +34 -0
  166. package/dist/app/scripts/Cross.d.ts +3 -0
  167. package/dist/app/scripts/CrossRule.d.ts +24 -0
  168. package/dist/app/scripts/CustomTrackDialog.d.ts +17 -0
  169. package/dist/app/scripts/Dialog.d.ts +5 -0
  170. package/dist/app/scripts/DivergentBarTrack.d.ts +4 -0
  171. package/dist/app/scripts/DragListeningDiv.d.ts +32 -0
  172. package/dist/app/scripts/DraggableDiv.d.ts +63 -0
  173. package/dist/app/scripts/ExportLinkDialog.d.ts +21 -0
  174. package/dist/app/scripts/FilledLine.d.ts +5 -0
  175. package/dist/app/scripts/FixedTrack.d.ts +5 -0
  176. package/dist/app/scripts/GalleryTracks.d.ts +20 -0
  177. package/dist/app/scripts/GenomePositionSearchBox.d.ts +95 -0
  178. package/dist/app/scripts/HeatmapOptions.d.ts +30 -0
  179. package/dist/app/scripts/HeatmapTiledPixiTrack.d.ts +184 -0
  180. package/dist/app/scripts/HiGlassComponent.d.ts +762 -0
  181. package/dist/app/scripts/HiGlassComponentContext.d.ts +3 -0
  182. package/dist/app/scripts/HiGlassTrackComponent.d.ts +37 -0
  183. package/dist/app/scripts/Horizontal1dHeatmapTrack.d.ts +9 -0
  184. package/dist/app/scripts/Horizontal2DDomainsTrack.d.ts +21 -0
  185. package/dist/app/scripts/HorizontalChromosomeLabels.d.ts +47 -0
  186. package/dist/app/scripts/HorizontalGeneAnnotationsTrack.d.ts +25 -0
  187. package/dist/app/scripts/HorizontalHeatmapTrack.d.ts +12 -0
  188. package/dist/app/scripts/HorizontalItem.d.ts +3 -0
  189. package/dist/app/scripts/HorizontalLine1DPixiTrack.d.ts +23 -0
  190. package/dist/app/scripts/HorizontalMultivecTrack.d.ts +50 -0
  191. package/dist/app/scripts/HorizontalPoint1DPixiTrack.d.ts +5 -0
  192. package/dist/app/scripts/HorizontalRule.d.ts +22 -0
  193. package/dist/app/scripts/HorizontalTiled1DPixiTrack.d.ts +26 -0
  194. package/dist/app/scripts/HorizontalTiledPlot.d.ts +49 -0
  195. package/dist/app/scripts/HorizontalTrack.d.ts +6 -0
  196. package/dist/app/scripts/Id2DTiledPixiTrack.d.ts +10 -0
  197. package/dist/app/scripts/IdHorizontal1DTiledPixiTrack.d.ts +6 -0
  198. package/dist/app/scripts/IdVertical1DTiledPixiTrack.d.ts +7 -0
  199. package/dist/app/scripts/LeftAxisTrack.d.ts +9 -0
  200. package/dist/app/scripts/LeftTrackModifier.d.ts +29 -0
  201. package/dist/app/scripts/ListWrapper.d.ts +64 -0
  202. package/dist/app/scripts/MapboxTilesTrack.d.ts +9 -0
  203. package/dist/app/scripts/Modal.d.ts +5 -0
  204. package/dist/app/scripts/MoveableTrack.d.ts +18 -0
  205. package/dist/app/scripts/NestedContextMenu.d.ts +7 -0
  206. package/dist/app/scripts/OSMTileIdsTrack.d.ts +5 -0
  207. package/dist/app/scripts/OSMTilesTrack.d.ts +129 -0
  208. package/dist/app/scripts/OverlayTrack.d.ts +13 -0
  209. package/dist/app/scripts/PixiTrack.d.ts +174 -0
  210. package/dist/app/scripts/PlotTypeChooser.d.ts +25 -0
  211. package/dist/app/scripts/PopupMenu.d.ts +28 -0
  212. package/dist/app/scripts/RasterTilesTrack.d.ts +9 -0
  213. package/dist/app/scripts/RuleMixin.d.ts +2 -0
  214. package/dist/app/scripts/SVGTrack.d.ts +15 -0
  215. package/dist/app/scripts/SearchField.d.ts +13 -0
  216. package/dist/app/scripts/SeriesListItems.d.ts +2 -0
  217. package/dist/app/scripts/SeriesListMenu.d.ts +51 -0
  218. package/dist/app/scripts/SeriesListSubmenuMixin.d.ts +2 -0
  219. package/dist/app/scripts/SketchInlinePicker.d.ts +25 -0
  220. package/dist/app/scripts/SortableList.d.ts +22 -0
  221. package/dist/app/scripts/SquareMarkersTrack.d.ts +22 -0
  222. package/dist/app/scripts/Tiled1DPixiTrack.d.ts +60 -0
  223. package/dist/app/scripts/TiledPixiTrack.d.ts +369 -0
  224. package/dist/app/scripts/TiledPlot.d.ts +313 -0
  225. package/dist/app/scripts/TilesetFinder.d.ts +65 -0
  226. package/dist/app/scripts/TopAxisTrack.d.ts +9 -0
  227. package/dist/app/scripts/Track.d.ts +196 -0
  228. package/dist/app/scripts/TrackArea.d.ts +26 -0
  229. package/dist/app/scripts/TrackControl.d.ts +5 -0
  230. package/dist/app/scripts/TrackRenderer.d.ts +724 -0
  231. package/dist/app/scripts/UnknownPixiTrack.d.ts +7 -0
  232. package/dist/app/scripts/ValueIntervalTrack.d.ts +6 -0
  233. package/dist/app/scripts/VerticalItem.d.ts +3 -0
  234. package/dist/app/scripts/VerticalRule.d.ts +21 -0
  235. package/dist/app/scripts/VerticalTiled1DPixiTrack.d.ts +6 -0
  236. package/dist/app/scripts/VerticalTiledPlot.d.ts +50 -0
  237. package/dist/app/scripts/VerticalTrack.d.ts +6 -0
  238. package/dist/app/scripts/ViewConfigEditor.d.ts +53 -0
  239. package/dist/app/scripts/ViewContextMenu.d.ts +17 -0
  240. package/dist/app/scripts/ViewHeader.d.ts +75 -0
  241. package/dist/app/scripts/ViewportTracker2D.d.ts +17 -0
  242. package/dist/app/scripts/ViewportTracker2DPixi.d.ts +11 -0
  243. package/dist/app/scripts/ViewportTrackerHorizontal.d.ts +17 -0
  244. package/dist/app/scripts/ViewportTrackerVertical.d.ts +17 -0
  245. package/dist/app/scripts/api.d.ts +640 -0
  246. package/dist/app/scripts/configs/available-track-types.d.ts +2 -0
  247. package/dist/app/scripts/configs/colormaps.d.ts +2 -0
  248. package/dist/app/scripts/configs/datatype-to-track-type.d.ts +4 -0
  249. package/dist/app/scripts/configs/default-tracks-for-datatype.d.ts +38 -0
  250. package/dist/app/scripts/configs/dense-data-extrema-config.d.ts +2 -0
  251. package/dist/app/scripts/configs/globals.d.ts +5 -0
  252. package/dist/app/scripts/configs/index.d.ts +16 -0
  253. package/dist/app/scripts/configs/positions-by-datatype.d.ts +2 -0
  254. package/dist/app/scripts/configs/primitives.d.ts +20 -0
  255. package/dist/app/scripts/configs/themes.d.ts +3 -0
  256. package/dist/app/scripts/configs/tracks-info-by-type.d.ts +4 -0
  257. package/dist/app/scripts/configs/tracks-info.d.ts +24 -0
  258. package/dist/app/scripts/d3-context-menu.d.ts +2 -0
  259. package/dist/app/scripts/data-fetchers/DataFetcher.d.ts +151 -0
  260. package/dist/app/scripts/data-fetchers/genbank-fetcher.d.ts +86 -0
  261. package/dist/app/scripts/data-fetchers/index.d.ts +3 -0
  262. package/dist/app/scripts/data-fetchers/local-tile-fetcher.d.ts +47 -0
  263. package/dist/app/scripts/gosling-exports.d.ts +17 -0
  264. package/dist/app/scripts/hglib.d.ts +24 -0
  265. package/dist/app/scripts/hocs/with-modal.d.ts +19 -0
  266. package/dist/app/scripts/hocs/with-pub-sub.d.ts +22 -0
  267. package/dist/app/scripts/hocs/with-theme.d.ts +13 -0
  268. package/dist/app/scripts/icons.d.ts +161 -0
  269. package/dist/app/scripts/mixwith.d.ts +27 -0
  270. package/dist/app/scripts/options-info.d.ts +1355 -0
  271. package/dist/app/scripts/plugins/available-for-plugins.d.ts +2338 -0
  272. package/dist/app/scripts/plugins/get-data-fetcher.d.ts +2 -0
  273. package/dist/app/scripts/plugins/index.d.ts +2 -0
  274. package/dist/app/scripts/services/chrom-info.d.ts +10 -0
  275. package/dist/app/scripts/services/dom-event.d.ts +7 -0
  276. package/dist/app/scripts/services/element-resize-listener.d.ts +5 -0
  277. package/dist/app/scripts/services/index.d.ts +5 -0
  278. package/dist/app/scripts/services/tile-proxy.d.ts +180 -0
  279. package/dist/app/scripts/services/worker.d.ts +157 -0
  280. package/dist/app/scripts/symbol.d.ts +13 -0
  281. package/dist/app/scripts/test-helpers/index.d.ts +1 -0
  282. package/dist/app/scripts/test-helpers/test-helpers.d.ts +33 -0
  283. package/dist/app/scripts/track-utils.d.ts +73 -0
  284. package/dist/app/scripts/types.d.ts +199 -0
  285. package/dist/app/scripts/utils/DenseDataExtrema1D.d.ts +88 -0
  286. package/dist/app/scripts/utils/DenseDataExtrema2D.d.ts +97 -0
  287. package/dist/app/scripts/utils/LruCache.d.ts +44 -0
  288. package/dist/app/scripts/utils/abs-to-chr.d.ts +14 -0
  289. package/dist/app/scripts/utils/accessor-transposition.d.ts +14 -0
  290. package/dist/app/scripts/utils/add-arrays.d.ts +18 -0
  291. package/dist/app/scripts/utils/add-class.d.ts +8 -0
  292. package/dist/app/scripts/utils/add-event-listener-once.d.ts +11 -0
  293. package/dist/app/scripts/utils/assert.d.ts +17 -0
  294. package/dist/app/scripts/utils/background-task-scheduler.d.ts +47 -0
  295. package/dist/app/scripts/utils/base64-to-canvas.d.ts +9 -0
  296. package/dist/app/scripts/utils/chr-to-abs.d.ts +10 -0
  297. package/dist/app/scripts/utils/chrom-info-bisector.d.ts +4 -0
  298. package/dist/app/scripts/utils/clone-event.d.ts +12 -0
  299. package/dist/app/scripts/utils/color-domain-to-rgba-array.d.ts +13 -0
  300. package/dist/app/scripts/utils/color-to-hex.d.ts +9 -0
  301. package/dist/app/scripts/utils/color-to-rgba.d.ts +9 -0
  302. package/dist/app/scripts/utils/copy-text-to-clipboard.d.ts +2 -0
  303. package/dist/app/scripts/utils/data-to-genomic-loci.d.ts +11 -0
  304. package/dist/app/scripts/utils/debounce.d.ts +5 -0
  305. package/dist/app/scripts/utils/dec-to-hex-str.d.ts +8 -0
  306. package/dist/app/scripts/utils/decompress.d.ts +27 -0
  307. package/dist/app/scripts/utils/default-tracks.d.ts +3 -0
  308. package/dist/app/scripts/utils/dict-from-tuples.d.ts +11 -0
  309. package/dist/app/scripts/utils/dict-items.d.ts +18 -0
  310. package/dist/app/scripts/utils/dict-keys.d.ts +10 -0
  311. package/dist/app/scripts/utils/dict-values.d.ts +8 -0
  312. package/dist/app/scripts/utils/download.d.ts +7 -0
  313. package/dist/app/scripts/utils/expand-combined-tracks.d.ts +11 -0
  314. package/dist/app/scripts/utils/fake-pub-sub.d.ts +11 -0
  315. package/dist/app/scripts/utils/fill-in-min-widths.d.ts +44 -0
  316. package/dist/app/scripts/utils/flatten.d.ts +9 -0
  317. package/dist/app/scripts/utils/for-each.d.ts +9 -0
  318. package/dist/app/scripts/utils/forward-event.d.ts +7 -0
  319. package/dist/app/scripts/utils/genome-loci-to-pixels.d.ts +9 -0
  320. package/dist/app/scripts/utils/genomic-range-to-chromosome-chunks.d.ts +21 -0
  321. package/dist/app/scripts/utils/get-aggregation-function.d.ts +10 -0
  322. package/dist/app/scripts/utils/get-default-track-for-datatype.d.ts +21 -0
  323. package/dist/app/scripts/utils/get-default-tracks-for-datatype.d.ts +3 -0
  324. package/dist/app/scripts/utils/get-element-dim.d.ts +7 -0
  325. package/dist/app/scripts/utils/get-higlass-components.d.ts +7 -0
  326. package/dist/app/scripts/utils/get-track-by-uid.d.ts +7 -0
  327. package/dist/app/scripts/utils/get-track-conf-from-hgc.d.ts +10 -0
  328. package/dist/app/scripts/utils/get-track-obj-by-id.d.ts +2 -0
  329. package/dist/app/scripts/utils/get-track-position-by-uid.d.ts +13 -0
  330. package/dist/app/scripts/utils/get-xylofon.d.ts +2 -0
  331. package/dist/app/scripts/utils/gradient.d.ts +14 -0
  332. package/dist/app/scripts/utils/has-class.d.ts +8 -0
  333. package/dist/app/scripts/utils/has-parent.d.ts +9 -0
  334. package/dist/app/scripts/utils/hex-string-to-int.d.ts +14 -0
  335. package/dist/app/scripts/utils/index.d.ts +89 -0
  336. package/dist/app/scripts/utils/interval-tree.d.ts +109 -0
  337. package/dist/app/scripts/utils/into-the-void.d.ts +6 -0
  338. package/dist/app/scripts/utils/is-track-or-child-track.d.ts +7 -0
  339. package/dist/app/scripts/utils/is-track-range-selectable.d.ts +2 -0
  340. package/dist/app/scripts/utils/is-within.d.ts +12 -0
  341. package/dist/app/scripts/utils/lat-to-y.d.ts +9 -0
  342. package/dist/app/scripts/utils/lng-to-x.d.ts +8 -0
  343. package/dist/app/scripts/utils/load-chrom-infos.d.ts +8 -0
  344. package/dist/app/scripts/utils/map.d.ts +13 -0
  345. package/dist/app/scripts/utils/max-non-zero.d.ts +6 -0
  346. package/dist/app/scripts/utils/max.d.ts +10 -0
  347. package/dist/app/scripts/utils/min-non-zero.d.ts +6 -0
  348. package/dist/app/scripts/utils/min.d.ts +10 -0
  349. package/dist/app/scripts/utils/mod.d.ts +9 -0
  350. package/dist/app/scripts/utils/ndarray-assign.d.ts +2 -0
  351. package/dist/app/scripts/utils/ndarray-flatten.d.ts +2 -0
  352. package/dist/app/scripts/utils/ndarray-to-list.d.ts +2 -0
  353. package/dist/app/scripts/utils/numericify-version.d.ts +6 -0
  354. package/dist/app/scripts/utils/obj-vals.d.ts +8 -0
  355. package/dist/app/scripts/utils/or.d.ts +8 -0
  356. package/dist/app/scripts/utils/parse-chromsizes-rows.d.ts +34 -0
  357. package/dist/app/scripts/utils/pixi-text-to-svg.d.ts +2 -0
  358. package/dist/app/scripts/utils/positioned-tracks-to-all-tracks.d.ts +26 -0
  359. package/dist/app/scripts/utils/q.d.ts +18 -0
  360. package/dist/app/scripts/utils/rad-to-deg.d.ts +7 -0
  361. package/dist/app/scripts/utils/range-query-2d.d.ts +17 -0
  362. package/dist/app/scripts/utils/reduce.d.ts +14 -0
  363. package/dist/app/scripts/utils/rel-to-abs-chrom-pos.d.ts +10 -0
  364. package/dist/app/scripts/utils/remove-class.d.ts +7 -0
  365. package/dist/app/scripts/utils/reset-d3-brush-style.d.ts +10 -0
  366. package/dist/app/scripts/utils/rgb-to-hex.d.ts +8 -0
  367. package/dist/app/scripts/utils/scales-center-and-k.d.ts +12 -0
  368. package/dist/app/scripts/utils/scales-to-genome-loci.d.ts +3 -0
  369. package/dist/app/scripts/utils/segments-to-rows.d.ts +15 -0
  370. package/dist/app/scripts/utils/selected-items-to-cum-weights.d.ts +12 -0
  371. package/dist/app/scripts/utils/selected-items-to-size.d.ts +13 -0
  372. package/dist/app/scripts/utils/show-mouse-position.d.ts +54 -0
  373. package/dist/app/scripts/utils/some.d.ts +10 -0
  374. package/dist/app/scripts/utils/sum.d.ts +8 -0
  375. package/dist/app/scripts/utils/svg-line.d.ts +2 -0
  376. package/dist/app/scripts/utils/throttle-and-debounce.d.ts +33 -0
  377. package/dist/app/scripts/utils/tile-to-canvas.d.ts +9 -0
  378. package/dist/app/scripts/utils/timeout.d.ts +3 -0
  379. package/dist/app/scripts/utils/to-void.d.ts +3 -0
  380. package/dist/app/scripts/utils/total-track-pixel-height.d.ts +27 -0
  381. package/dist/app/scripts/utils/trim-trailing-slash.d.ts +7 -0
  382. package/dist/app/scripts/utils/type-guards.d.ts +36 -0
  383. package/dist/app/scripts/utils/value-to-color.d.ts +12 -0
  384. package/dist/app/scripts/utils/visit-positioned-tracks.d.ts +18 -0
  385. package/dist/app/scripts/utils/visit-tracks.d.ts +9 -0
  386. package/dist/esm.html +1 -3
  387. package/dist/hglib.js +86315 -100592
  388. package/dist/hglib.min.js +123 -131
  389. package/dist/higlass.mjs +88861 -103138
  390. package/dist/index.html +1 -3
  391. package/dist/package.json +134 -0
  392. package/package.json +25 -27
@@ -1,31 +1,33 @@
1
1
  // @ts-nocheck
2
- import { pointer } from 'd3-selection';
3
- import slugid from 'slugid';
4
- import React from 'react';
5
- import ReactDOM from 'react-dom';
2
+ import clsx from 'clsx';
3
+ import { ElementQueries, ResizeSensor } from 'css-element-queries';
4
+ import { brush, brushX, brushY } from 'd3-brush';
5
+ import { format } from 'd3-format';
6
+ import { pointer, select } from 'd3-selection';
6
7
  import PropTypes from 'prop-types';
7
- import { ResizeSensor, ElementQueries } from 'css-element-queries';
8
+ import React from 'react';
9
+ import slugid from 'slugid';
8
10
 
11
+ import AddTrackDialog from './AddTrackDialog';
12
+ import CenterTrack from './CenterTrack';
13
+ import CloseTrackMenu from './CloseTrackMenu';
14
+ import ConfigTrackMenu from './ConfigTrackMenu';
15
+ import ContextMenuContainer from './ContextMenuContainer';
9
16
  // Components
10
17
  import ContextMenuItem from './ContextMenuItem';
11
- import CenterTrack from './CenterTrack';
18
+ import CustomTrackDialog from './CustomTrackDialog';
12
19
  import DragListeningDiv from './DragListeningDiv';
13
20
  import GalleryTracks from './GalleryTracks';
14
- import TrackRenderer from './TrackRenderer';
15
- import AddTrackDialog from './AddTrackDialog';
16
- import CustomTrackDialog from './CustomTrackDialog';
17
- import ConfigTrackMenu from './ConfigTrackMenu';
18
- import CloseTrackMenu from './CloseTrackMenu';
19
- import PopupMenu from './PopupMenu';
20
- import ContextMenuContainer from './ContextMenuContainer';
21
21
  import HorizontalTiledPlot from './HorizontalTiledPlot';
22
+ import PopupMenu from './PopupMenu';
23
+ import TrackRenderer from './TrackRenderer';
22
24
  import VerticalTiledPlot from './VerticalTiledPlot';
23
25
  import ViewContextMenu from './ViewContextMenu';
24
26
  // import {HeatmapOptions} from './HeatmapOptions';
25
27
 
28
+ import withModal from './hocs/with-modal';
26
29
  // Higher-order components
27
30
  import withPubSub from './hocs/with-pub-sub';
28
- import withModal from './hocs/with-modal';
29
31
  import withTheme from './hocs/with-theme';
30
32
 
31
33
  // Utils
@@ -37,26 +39,29 @@ import {
37
39
  sum,
38
40
  visitPositionedTracks,
39
41
  } from './utils';
42
+ import getDefaultTracksForDataType from './utils/get-default-tracks-for-datatype';
40
43
 
41
44
  // Configs
42
45
  import {
43
- DEFAULT_TRACKS_FOR_DATATYPE,
44
46
  MOUSE_TOOL_SELECT,
47
+ MOUSE_TOOL_TRACK_SELECT,
45
48
  TRACKS_INFO_BY_TYPE,
46
49
  TRACK_LOCATIONS,
47
50
  } from './configs';
48
51
 
52
+ import stylesCenterTrack from '../styles/CenterTrack.module.scss';
49
53
  // Styles
50
- import styles from '../styles/TiledPlot.module.scss'; // eslint-disable-line no-unused-vars
51
- import stylesCenterTrack from '../styles/CenterTrack.module.scss'; // eslint-disable-line no-unused-vars
54
+ import styles from '../styles/TiledPlot.module.scss';
52
55
 
53
- class TiledPlot extends React.Component {
56
+ export class TiledPlot extends React.Component {
54
57
  constructor(props) {
55
58
  super(props);
56
59
 
57
60
  this.closing = false;
58
61
  // that the tracks will be drawn on
59
62
 
63
+ this.brushX = brushX();
64
+
60
65
  const { tracks } = this.props;
61
66
  this.canvasElement = null;
62
67
 
@@ -79,6 +84,8 @@ class TiledPlot extends React.Component {
79
84
  }
80
85
  });
81
86
 
87
+ this.annotationUid = null;
88
+ this.annotationCreatedNotified = false;
82
89
  this.xScale = null;
83
90
  this.yScale = null;
84
91
 
@@ -88,8 +95,8 @@ class TiledPlot extends React.Component {
88
95
  this.trackToReplace = null;
89
96
  this.trackRenderer = null;
90
97
 
98
+ this.brushSelection = null;
91
99
  this.configTrackMenu = null;
92
-
93
100
  /*
94
101
  let trackOptions = this.props.editable ?
95
102
  {'track': this.props.tracks.center[0].contents[0],
@@ -105,6 +112,7 @@ class TiledPlot extends React.Component {
105
112
 
106
113
  tracks,
107
114
  init: false,
115
+ addTrackExtent: null,
108
116
  addTrackPosition: null,
109
117
  customDialog: null,
110
118
  mouseOverOverlayUid: null,
@@ -150,6 +158,10 @@ class TiledPlot extends React.Component {
150
158
  this.dragTimeout = null;
151
159
  this.previousPropsStr = '';
152
160
 
161
+ this.brushesCreated = {};
162
+
163
+ this.appZoomedBound = this.appZoomed.bind(this);
164
+ this.handleClickBound = this.handleClick.bind(this);
153
165
  this.contextMenuHandlerBound = this.contextMenuHandler.bind(this);
154
166
  this.handleNoTrackAddedBound = this.handleNoTrackAdded.bind(this);
155
167
  this.handleTracksAddedBound = this.handleTracksAdded.bind(this);
@@ -172,7 +184,7 @@ class TiledPlot extends React.Component {
172
184
  waitForDOMAttachment(callback) {
173
185
  if (!this.mounted) return;
174
186
 
175
- const thisElement = ReactDOM.findDOMNode(this);
187
+ const thisElement = this.divTiledPlot;
176
188
 
177
189
  if (document.body.contains(thisElement)) {
178
190
  callback();
@@ -183,8 +195,7 @@ class TiledPlot extends React.Component {
183
195
 
184
196
  componentDidMount() {
185
197
  this.mounted = true;
186
- this.element = ReactDOM.findDOMNode(this);
187
- this.canvasElement = ReactDOM.findDOMNode(this.props.canvasElement);
198
+ this.element = this.divTiledPlot;
188
199
 
189
200
  // new ResizeSensor(this.element, this.measureSize.bind(this));
190
201
  this.waitForDOMAttachment(() => {
@@ -205,9 +216,462 @@ class TiledPlot extends React.Component {
205
216
  this.pubSubs.push(
206
217
  this.props.pubSub.subscribe('contextmenu', this.contextMenuHandlerBound),
207
218
  );
219
+
220
+ // this.pubSubs.push(
221
+ // this.props.pubSub.subscribe('click', evt => {
222
+ // if (this.brushEl) {
223
+ // const pos = pointer(evt, this.brushEl);
224
+
225
+ // console.log('click pos:', pos);
226
+ // console.log('this.brushEl', this.brushEl.node());
227
+ // }
228
+ // }),
229
+ // );
230
+ }
231
+
232
+ /** Get the data in the selection */
233
+ getTracksData(positionedTracks, extent) {
234
+ let tracks = [];
235
+
236
+ const allTrackObjs = this.listAllTrackObjects();
237
+
238
+ // get a list of viewconf track defs
239
+ for (const track of positionedTracks) {
240
+ if (track.track.contents) {
241
+ tracks = [...tracks, ...track.track.contents];
242
+ } else {
243
+ tracks = [...tracks, track.track];
244
+ }
245
+ }
246
+
247
+ // console.log('extent:', extent);
248
+
249
+ const trackDatas = [];
250
+
251
+ // get data
252
+ for (const track of tracks) {
253
+ if (track.type === 'heatmap') {
254
+ // console.log('trackDefObjs', this.trackRenderer.trackDefObjects);
255
+
256
+ const trackObj = allTrackObjs.filter((x) => x.id === track.uid)[0];
257
+
258
+ const x1 = trackObj._xScale(extent[0][0]);
259
+ const x2 = trackObj._xScale(extent[1][0]);
260
+
261
+ const y1 = trackObj._yScale(extent[0][1]);
262
+ const y2 = trackObj._yScale(extent[1][1]);
263
+
264
+ const height = y2 - y1;
265
+ const width = x2 - x1;
266
+
267
+ const data = trackObj.getVisibleRectangleData(x1, y1, height, width);
268
+ const sumValue = data.data.reduce((a, b) => a + b, 0);
269
+ const mean = sumValue / data.data.length;
270
+
271
+ trackDatas.push({
272
+ name: track.options.name,
273
+ mean,
274
+ trackUid: track.uid,
275
+ });
276
+ }
277
+ }
278
+
279
+ return trackDatas;
280
+ }
281
+
282
+ appZoomed() {
283
+ if (this.brushCurrent && this.brushEl) {
284
+ if (this.brushType === 'horizontal') {
285
+ const newSelection = [
286
+ this.xScale(this.brushSelection[0]) + this.brushTrack.left,
287
+ this.xScale(this.brushSelection[1]) + this.brushTrack.left,
288
+ ];
289
+
290
+ this.brushEl.call(this.brushCurrent.move, newSelection);
291
+ }
292
+
293
+ if (this.brushType === 'vertical') {
294
+ const newSelection = [
295
+ this.yScale(this.brushSelection[0]) + this.brushTrack.top,
296
+ this.yScale(this.brushSelection[1]) + this.brushTrack.top,
297
+ ];
298
+
299
+ this.brushEl.call(this.brushCurrent.move, newSelection);
300
+ }
301
+
302
+ if (this.brushType === '2d') {
303
+ const newSelection = [
304
+ [
305
+ this.xScale(this.brushSelection[0][0]) + this.brushTrack.left,
306
+ this.yScale(this.brushSelection[0][1]) + this.brushTrack.top,
307
+ ],
308
+ [
309
+ this.xScale(this.brushSelection[1][0]) + this.brushTrack.left,
310
+ this.yScale(this.brushSelection[1][1]) + this.brushTrack.top,
311
+ ],
312
+ ];
313
+
314
+ this.brushEl.call(this.brushCurrent.move, newSelection);
315
+ }
316
+ }
317
+ }
318
+
319
+ clearOtherBrushes(myBrush) {
320
+ for (const aBrush of Object.values(this.brushes)) {
321
+ aBrush.on('brush', null);
322
+ }
323
+
324
+ for (const trackUid in this.brushes) {
325
+ const otherBrush = this.brushes[trackUid];
326
+
327
+ if (otherBrush !== myBrush) {
328
+ this.brushEls[trackUid].call(otherBrush.move, null);
329
+ // this.brushEls[trackUid].selectAll('.selection').remove();
330
+ }
331
+ }
332
+
333
+ for (const aBrush of Object.values(this.brushes)) {
334
+ aBrush.on('brush', () => this.clearOtherBrushes(aBrush));
335
+ }
336
+ }
337
+
338
+ handleClick(evt) {
339
+ const pos = pointer(evt, this.divTiledPlot);
340
+ let inside = false;
341
+
342
+ if (this.brushEl) {
343
+ const selection = this.brushSelectionRaw;
344
+
345
+ const track = this.brushTrack;
346
+
347
+ if (this.brushType === '2d') {
348
+ if (
349
+ pos[0] >= selection[0][0] &&
350
+ pos[0] <= selection[1][0] &&
351
+ pos[1] >= selection[0][1] &&
352
+ pos[1] <= selection[1][1]
353
+ ) {
354
+ inside = true;
355
+ }
356
+ } else if (this.brushType === 'horizontal') {
357
+ if (
358
+ pos[0] >= selection[0] &&
359
+ pos[0] <= selection[1] &&
360
+ pos[1] >= track.top &&
361
+ pos[1] <= track.top + track.height
362
+ ) {
363
+ inside = true;
364
+ }
365
+ } else if (this.brushType === 'vertical') {
366
+ if (
367
+ pos[1] >= selection[0] &&
368
+ pos[1] <= selection[1] &&
369
+ pos[0] >= track.left &&
370
+ pos[0] <= track.left + track.width
371
+ ) {
372
+ inside = true;
373
+ }
374
+ }
375
+
376
+ if (!inside) {
377
+ this.cancelBrushes();
378
+ }
379
+ }
380
+ }
381
+
382
+ cancelBrushes() {
383
+ this.brushEl.call(this.brushCurrent.move, null);
384
+ this.brushEl = null;
385
+ this.props.apiPublish('annotationRemoved', this.annotationUid);
386
+ this.annotationUid = null;
387
+ this.annotationCreatedNotified = false;
388
+
389
+ this.removeBrushText();
390
+ }
391
+
392
+ removeBrushText() {
393
+ select(this.divTiledPlot)
394
+ .selectAll('.brush-svg')
395
+ .selectAll('.data-values')
396
+ .remove();
397
+ }
398
+
399
+ enableBrushes() {
400
+ const overlays = select(this.divTiledPlot)
401
+ .selectAll('.brush-svg')
402
+ .selectAll('.overlay');
403
+
404
+ overlays.style('pointer-events', 'all');
405
+ }
406
+
407
+ disableBrushes() {
408
+ select(this.divTiledPlot)
409
+ // .selectAll('.brush-svg')
410
+ .selectAll('.overlay')
411
+ .attr('pointer-events', 'none');
412
+
413
+ select(this.divTiledPlot)
414
+ .selectAll('.brush-rect')
415
+ .attr('pointer-events', 'none');
416
+
417
+ select(this.divTiledPlot)
418
+ .selectAll('.selection')
419
+ .attr('pointer-events', 'all');
420
+
421
+ select(this.divTiledPlot)
422
+ .selectAll('.brush-svg')
423
+ .attr('pointer-events', 'none');
424
+ }
425
+
426
+ createBrushes(positionedTracks) {
427
+ const brushes = {};
428
+ this.brushCurrent = null;
429
+
430
+ const apiPublish = this.props.apiPublish;
431
+ const tiledPlot = this;
432
+
433
+ for (const track of positionedTracks) {
434
+ if (brushes[track.track.uid]) continue;
435
+
436
+ let myBrush = null;
437
+
438
+ if (['top', 'bottom'].includes(track.track.position)) {
439
+ myBrush = brushX();
440
+ myBrush.on('brush', (event) => {
441
+ if (!event.selection) {
442
+ return;
443
+ }
444
+ this.brushCurrent = myBrush;
445
+ this.brushType = 'horizontal';
446
+ this.brushTrack = track;
447
+ this.brushSelectionRaw = event.selection;
448
+ this.brushSelection = [
449
+ this.xScale.invert(event.selection[0] - track.left),
450
+ this.xScale.invert(event.selection[1] - track.left),
451
+ ];
452
+
453
+ apiPublish('annotationChanged', {
454
+ annotationUid: this.annotationUid,
455
+ viewUid: this.props.uid,
456
+ track: track.track,
457
+ extent: [this.brushSelection, [null, null]],
458
+ });
459
+ });
460
+
461
+ myBrush.on('end', (evt) => {
462
+ if (!this.annotationCreatedNotified) {
463
+ apiPublish('annotationCreated', {
464
+ annotationUid: tiledPlot.annotationUid,
465
+ track: track.track,
466
+ viewUid: this.props.uid,
467
+ extent: [this.brushSelection, [null, null]],
468
+ });
469
+ }
470
+ });
471
+ } else if (['left', 'right'].includes(track.track.position)) {
472
+ myBrush = brushY();
473
+ myBrush.on('brush', (event) => {
474
+ if (!event.selection) {
475
+ return;
476
+ }
477
+ this.brushCurrent = myBrush;
478
+ this.brushType = 'vertical';
479
+ this.brushTrack = track;
480
+ this.brushSelectionRaw = event.selection;
481
+ this.brushSelection = [
482
+ this.yScale.invert(event.selection[0] - track.top),
483
+ this.yScale.invert(event.selection[1] - track.top),
484
+ ];
485
+
486
+ apiPublish('annotationChanged', {
487
+ annotationUid: this.annotationUid,
488
+ track: track.track,
489
+ viewUid: this.props.uid,
490
+ extent: [[null, null], this.brushSelection],
491
+ });
492
+ });
493
+
494
+ myBrush.on('end', (evt) => {
495
+ if (!this.annotationCreatedNotified) {
496
+ apiPublish('annotationCreated', {
497
+ annotationUid: tiledPlot.annotationUid,
498
+ track: track.track,
499
+ viewUid: this.props.uid,
500
+ extent: [[null, null], this.brushSelection],
501
+ });
502
+ }
503
+ });
504
+ } else {
505
+ myBrush = brush();
506
+ myBrush.on('brush', (event) => {
507
+ if (!event.selection) {
508
+ return;
509
+ }
510
+ this.brushCurrent = myBrush;
511
+ this.brushType = '2d';
512
+ this.brushTrack = track;
513
+ this.brushSelectionRaw = event.selection;
514
+ this.brushSelection = [
515
+ [
516
+ this.xScale.invert(event.selection[0][0] - track.left),
517
+ this.yScale.invert(event.selection[0][1] - track.top),
518
+ ],
519
+ [
520
+ this.xScale.invert(event.selection[1][0] - track.left),
521
+ this.yScale.invert(event.selection[1][1] - track.top),
522
+ ],
523
+ ];
524
+
525
+ const tracksData = this.getTracksData(
526
+ positionedTracks.filter((t) => t.track.position === 'center'),
527
+ this.brushSelection,
528
+ );
529
+
530
+ const dataValues = Object.values(tracksData)
531
+ .filter((x) => x.mean !== undefined)
532
+ .map((x) => x.mean);
533
+
534
+ if (dataValues.length) {
535
+ const selection = select(this.divTiledPlot)
536
+ .selectAll('.brush-svg')
537
+ .selectAll('.data-values')
538
+ .data(dataValues);
539
+
540
+ selection.enter().append('text').classed('data-values', true);
541
+
542
+ const numFormat = format('.3f');
543
+
544
+ select(this.divTiledPlot)
545
+ .selectAll('.data-values')
546
+ .attr('x', event.selection[0][0])
547
+ .attr('y', event.selection[0][1])
548
+ .text((x) => `mean: ${numFormat(x)}`);
549
+ }
550
+
551
+ apiPublish('annotationChanged', {
552
+ annotationUid: this.annotationUid,
553
+ extent: this.brushSelection,
554
+ data: tracksData,
555
+ track: track.track,
556
+ viewUid: this.props.uid,
557
+ });
558
+ });
559
+
560
+ myBrush.on('end', (evt) => {
561
+ let tracksData = {};
562
+
563
+ if (this.brushSelection?.[0].length) {
564
+ tracksData = this.getTracksData(
565
+ positionedTracks.filter((t) => t.track.position === 'center'),
566
+ this.brushSelection,
567
+ );
568
+ }
569
+
570
+ if (!this.annotationCreatedNotified) {
571
+ apiPublish('annotationCreated', {
572
+ annotationUid: tiledPlot.annotationUid,
573
+ track: track.track,
574
+ viewUid: this.props.uid,
575
+ extent: this.brushSelection,
576
+ data: tracksData,
577
+ });
578
+ this.annotationCreatedNotified = true;
579
+ } else if (!evt.selection) {
580
+ this.removeBrushText();
581
+ }
582
+ });
583
+ }
584
+
585
+ // turn off d3-brush's control of the shift, meta, ctrl keys
586
+ myBrush.keyModifiers(false);
587
+ myBrush.extent([
588
+ [track.left, track.top],
589
+ [track.left + track.width, track.top + track.height],
590
+ ]);
591
+
592
+ myBrush.on('start', function (event) {
593
+ if (!tiledPlot.annotationUid) {
594
+ tiledPlot.annotationUid = slugid.nice();
595
+ track.annotationUid = tiledPlot.annotationUid;
596
+ }
597
+ tiledPlot.brushEl = select(this);
598
+ });
599
+
600
+ brushes[track.track.uid] = myBrush;
601
+ }
602
+
603
+ return brushes;
604
+ }
605
+
606
+ removeBrushes() {
607
+ select(this.divTiledPlot).selectAll('.brush-svg').remove();
608
+ }
609
+
610
+ addBrushes() {
611
+ if (this.annotationUid) {
612
+ // we already have a selection, no need to create a new one
613
+ return;
614
+ }
615
+
616
+ // get all tracks and remove the ones that are in the
617
+ // "whole" position (e.g. rules)
618
+ const positionedTracks = this.positionedTracks().filter(
619
+ (x) => x.track.position !== 'whole',
620
+ );
621
+
622
+ const brushes = this.createBrushes(positionedTracks);
623
+ this.brushes = brushes;
624
+ const brushEls = {};
625
+ this.brushEls = brushEls;
626
+
627
+ select(this.divTiledPlot).selectAll('.brush').remove();
628
+
629
+ select(this.divTiledPlot)
630
+ .selectAll('.brush-svg')
631
+ .data([1])
632
+ .enter()
633
+ .append('svg')
634
+ .classed('brush-svg', true)
635
+ .style('position', 'absolute')
636
+ .style('left', 0)
637
+ .style('top', 0)
638
+ .style('z-index', 101);
639
+
640
+ const brushG = select(this.divTiledPlot)
641
+ .select('.brush-svg')
642
+ .selectAll('.brush')
643
+ .data(positionedTracks, (d) => d.track.uid)
644
+ .enter()
645
+ .append('g')
646
+ .attr('class', 'brush');
647
+
648
+ select(this.divTiledPlot)
649
+ .selectAll('.brush-svg')
650
+ .attr('width', this.state.width)
651
+ .attr('height', this.state.height);
652
+
653
+ select(this.divTiledPlot)
654
+ .selectAll('.brush-rect')
655
+ .attr('x', (d) => d.left)
656
+ .attr('y', (d) => d.top)
657
+ .style('stroke', '1px solid black')
658
+ .style('fill', 'transparent')
659
+ .attr('width', (d) => d.width)
660
+ .attr('height', (d) => d.height);
661
+
662
+ brushG.each(function (d) {
663
+ brushEls[d.track.uid] = select(this);
664
+ brushEls[d.track.uid].call(brushes[d.track.uid]);
665
+ });
666
+
667
+ // select(this.divTiledPlot).on('click', () => console.log('yyclick'));
668
+ // select(this.divTiledPlot)
669
+ // .select('.brush-svg')
670
+ // .selectAll('.brush');
671
+
672
+ // .attr('x', d => d.)
208
673
  }
209
674
 
210
- // eslint-disable-next-line camelcase
211
675
  UNSAFE_componentWillReceiveProps(newProps) {
212
676
  this.addUidsToTracks(newProps.tracks);
213
677
 
@@ -248,15 +712,15 @@ class TiledPlot extends React.Component {
248
712
 
249
713
  if (!this.numTracks) this.tracksByUidInit = {};
250
714
 
251
- return toUpdate;
252
- }
715
+ if (nextProps.mouseTool === MOUSE_TOOL_TRACK_SELECT) {
716
+ // this.enableBrushes();
717
+ this.addBrushes();
718
+ } else {
719
+ this.disableBrushes();
720
+ // this.removeBrushes();
721
+ }
253
722
 
254
- // eslint-disable-next-line camelcase
255
- UNSAFE_componentWillUpdate() {
256
- /**
257
- * Need to determine the offset of this element relative to the canvas on which stuff
258
- * will be drawn
259
- */
723
+ return toUpdate;
260
724
  }
261
725
 
262
726
  componentDidUpdate(prevProps, prevState) {
@@ -265,7 +729,7 @@ class TiledPlot extends React.Component {
265
729
 
266
730
  if (
267
731
  this.state.defaultChromSizes &&
268
- this.state.rangeSelection.every((range) => range && range.length)
732
+ this.state.rangeSelection.every((range) => range?.length)
269
733
  ) {
270
734
  // Convert data into genomic loci
271
735
  genomicRange = this.state.rangeSelection.map((range) =>
@@ -291,7 +755,8 @@ class TiledPlot extends React.Component {
291
755
 
292
756
  this.props.modal.open(
293
757
  <CustomTrackDialog
294
- children={componentArray} // eslint-disable-line react/no-children-prop
758
+ // biome-ignore lint/correctness/noChildrenProp: We should consider refactoring
759
+ children={componentArray}
295
760
  bodyProps={bodyPropsArray}
296
761
  onCancel={this.props.closeCustomDialog}
297
762
  title={dialogData[0].title}
@@ -307,6 +772,7 @@ class TiledPlot extends React.Component {
307
772
  if (this.state.addTrackPosition || this.props.addTrackPosition) {
308
773
  this.props.modal.open(
309
774
  <AddTrackDialog
775
+ extent={this.state.addTrackExtent || this.props.addTrackExtent}
310
776
  host={this.state.addTrackHost}
311
777
  onCancel={this.handleNoTrackAddedBound}
312
778
  onTracksChosen={this.handleTracksAddedBound}
@@ -433,6 +899,8 @@ class TiledPlot extends React.Component {
433
899
  this.xScale = x;
434
900
  this.yScale = y;
435
901
 
902
+ this.appZoomed();
903
+
436
904
  this.props.onScalesChanged(x, y);
437
905
  }
438
906
 
@@ -471,6 +939,9 @@ class TiledPlot extends React.Component {
471
939
  } else {
472
940
  track.maxZoom = tilesetInfo.max_zoom;
473
941
  }
942
+ if (tilesetInfo.row_infos) {
943
+ track.row_infos = tilesetInfo.row_infos;
944
+ }
474
945
  track.coordSystem = tilesetInfo.coordSystem;
475
946
  track.datatype = tilesetInfo.datatype;
476
947
  }
@@ -524,6 +995,7 @@ class TiledPlot extends React.Component {
524
995
  this.setState({
525
996
  mouseOverOverlayUid: uid,
526
997
  });
998
+ this.props.setOverTrackChooser(true);
527
999
  }
528
1000
 
529
1001
  handleOverlayMouseLeave(uid) {
@@ -532,11 +1004,12 @@ class TiledPlot extends React.Component {
532
1004
  mouseOverOverlayUid: null,
533
1005
  });
534
1006
  }
1007
+ this.props.setOverTrackChooser(false);
535
1008
  }
536
1009
 
537
- handleTrackPositionChosen(pTrack) {
1010
+ handleTrackPositionChosen(pTrack, evt) {
538
1011
  this.setState({ mouseOverOverlayUid: null });
539
- this.props.chooseTrackHandler(pTrack.track.uid);
1012
+ this.props.chooseTrackHandler(pTrack.track.uid, evt);
540
1013
  }
541
1014
 
542
1015
  handleNoTrackAdded() {
@@ -549,6 +1022,7 @@ class TiledPlot extends React.Component {
549
1022
  this.props.onNoTrackAdded();
550
1023
 
551
1024
  this.setState({
1025
+ addTrackExtent: null,
552
1026
  addTrackPosition: null,
553
1027
  addTrackHost: null,
554
1028
  });
@@ -620,8 +1094,9 @@ class TiledPlot extends React.Component {
620
1094
  this.handleAddTrack(orientation);
621
1095
  }
622
1096
 
623
- handleAddTrack(position) {
1097
+ handleAddTrack(position, extent) {
624
1098
  this.setState({
1099
+ addTrackExtent: extent,
625
1100
  addTrackPosition: position,
626
1101
  addTrackHost: null,
627
1102
  });
@@ -695,7 +1170,7 @@ class TiledPlot extends React.Component {
695
1170
  this.props.onChangeTrackData(uid, newData);
696
1171
  }
697
1172
 
698
- handleTracksAdded(newTracks, position, host) {
1173
+ handleTracksAdded(newTracks, position, extent, host) {
699
1174
  /**
700
1175
  * Arguments
701
1176
  * ---------
@@ -723,9 +1198,10 @@ class TiledPlot extends React.Component {
723
1198
 
724
1199
  // if host is defined, then we're adding a new series
725
1200
  // further down the chain a combined track will be created
726
- this.props.onTracksAdded(newTracks, position, host);
1201
+ this.props.onTracksAdded(newTracks, position, extent, host);
727
1202
 
728
1203
  this.setState({
1204
+ addTrackExtent: null,
729
1205
  addTrackPosition: null,
730
1206
  addTrackHost: null,
731
1207
  });
@@ -858,9 +1334,8 @@ class TiledPlot extends React.Component {
858
1334
  for (let i = 0; i < this.state.tracks.top.length; i++) {
859
1335
  if (this.state.tracks.top[i].uid === track.uid) {
860
1336
  break;
861
- } else {
862
- top += this.state.tracks.top[i].height;
863
1337
  }
1338
+ top += this.state.tracks.top[i].height;
864
1339
  }
865
1340
 
866
1341
  break;
@@ -872,9 +1347,8 @@ class TiledPlot extends React.Component {
872
1347
  for (let i = 0; i < this.state.tracks.bottom.length; i++) {
873
1348
  if (this.state.tracks.bottom[i].uid === track.uid) {
874
1349
  break;
875
- } else {
876
- top += this.state.tracks.bottom[i].height;
877
1350
  }
1351
+ top += this.state.tracks.bottom[i].height;
878
1352
  }
879
1353
 
880
1354
  break;
@@ -887,9 +1361,8 @@ class TiledPlot extends React.Component {
887
1361
  for (let i = 0; i < this.state.tracks.left.length; i++) {
888
1362
  if (this.state.tracks.left[i].uid === track.uid) {
889
1363
  break;
890
- } else {
891
- left += this.state.tracks.left[i].width;
892
1364
  }
1365
+ left += this.state.tracks.left[i].width;
893
1366
  }
894
1367
 
895
1368
  break;
@@ -903,9 +1376,8 @@ class TiledPlot extends React.Component {
903
1376
  for (let i = 0; i < this.state.tracks.right.length; i++) {
904
1377
  if (this.state.tracks.right[i].uid === track.uid) {
905
1378
  break;
906
- } else {
907
- left += this.state.tracks.right[i].width;
908
1379
  }
1380
+ left += this.state.tracks.right[i].width;
909
1381
  }
910
1382
 
911
1383
  break;
@@ -936,14 +1408,13 @@ class TiledPlot extends React.Component {
936
1408
  for (let i = 0; i < this.state.tracks.gallery.length; i++) {
937
1409
  if (this.state.tracks.gallery[i].uid === track.uid) {
938
1410
  break;
939
- } else {
940
- width -= 2 * this.state.tracks.gallery[i].height;
941
- height -= 2 * this.state.tracks.gallery[i].height;
942
- left += this.state.tracks.gallery[i].height;
943
- top += this.state.tracks.gallery[i].height;
944
- offsetX -= this.state.tracks.gallery[i].height;
945
- offsetY -= this.state.tracks.gallery[i].height;
946
1411
  }
1412
+ width -= 2 * this.state.tracks.gallery[i].height;
1413
+ height -= 2 * this.state.tracks.gallery[i].height;
1414
+ left += this.state.tracks.gallery[i].height;
1415
+ top += this.state.tracks.gallery[i].height;
1416
+ offsetX -= this.state.tracks.gallery[i].height;
1417
+ offsetY -= this.state.tracks.gallery[i].height;
947
1418
  }
948
1419
 
949
1420
  for (let i = 0; i < this.state.tracks.right.length; i++) {
@@ -961,8 +1432,6 @@ class TiledPlot extends React.Component {
961
1432
  track.offsetLeft = left;
962
1433
 
963
1434
  break;
964
-
965
- case 'whole':
966
1435
  default:
967
1436
  width = this.leftWidth + this.centerWidth + this.rightWidth;
968
1437
  height = this.topHeight + this.centerHeight + this.bottomHeight;
@@ -1030,10 +1499,7 @@ class TiledPlot extends React.Component {
1030
1499
  */
1031
1500
  if (this.props.overlays) {
1032
1501
  const overlayDefs = this.props.overlays
1033
- .filter(
1034
- (overlayTrack) =>
1035
- overlayTrack.includes && overlayTrack.includes.length,
1036
- )
1502
+ .filter((overlayTrack) => overlayTrack.includes?.length)
1037
1503
  .map((overlayTrack) => {
1038
1504
  const type = overlayTrack.type
1039
1505
  ? `overlay-${overlayTrack.type}-track`
@@ -1228,8 +1694,7 @@ class TiledPlot extends React.Component {
1228
1694
  }
1229
1695
  }
1230
1696
  } else if (
1231
- this.props.tracks.center &&
1232
- this.props.tracks.center.length &&
1697
+ this.props.tracks.center?.length &&
1233
1698
  this.props.tracks.center[0].uid === uid
1234
1699
  ) {
1235
1700
  trackObj.is2d = true;
@@ -1377,6 +1842,7 @@ class TiledPlot extends React.Component {
1377
1842
  overlays: props.overlays,
1378
1843
  viewOptions: props.viewOptions,
1379
1844
  uid: props.uid,
1845
+ addTrackExtent: props.addTrackExtent,
1380
1846
  addTrackPosition: props.addTrackPosition,
1381
1847
  editable: props.editable,
1382
1848
  marginTop: props.marginTop,
@@ -1422,8 +1888,8 @@ class TiledPlot extends React.Component {
1422
1888
  if (!scale) return [null, null];
1423
1889
 
1424
1890
  return [
1425
- parseInt(scale.invert(range[0]), 10),
1426
- parseInt(scale.invert(range[1]), 10),
1891
+ Number.parseInt(scale.invert(range[0]), 10),
1892
+ Number.parseInt(scale.invert(range[1]), 10),
1427
1893
  ];
1428
1894
  }
1429
1895
 
@@ -1590,16 +2056,23 @@ class TiledPlot extends React.Component {
1590
2056
  return (
1591
2057
  <PopupMenu onMenuClosed={this.closeMenusBound}>
1592
2058
  <ViewContextMenu
2059
+ apiPublish={this.props.apiPublish}
1593
2060
  closeMenu={this.closeMenusBound}
1594
2061
  coords={[this.state.contextMenuDataX, this.state.contextMenuDataY]}
1595
2062
  customItems={this.state.contextMenuCustomItems}
2063
+ genomePositionSearchBox={this.props.genomePositionSearchBox}
1596
2064
  onAddDivisor={this.handleAddDivisorBound}
1597
2065
  onAddSeries={this.handleAddSeriesBound}
1598
2066
  // Can only add one new track at a time
1599
2067
  // because "whole" tracks are always drawn on top of each other,
1600
2068
  // the notion of Series is unnecessary and so 'host' is null
1601
2069
  onAddTrack={(newTrack) => {
1602
- this.props.onTracksAdded([newTrack], newTrack.position, null);
2070
+ this.props.onTracksAdded(
2071
+ [newTrack],
2072
+ newTrack.position,
2073
+ null,
2074
+ null,
2075
+ );
1603
2076
  this.handleCloseContextMenu();
1604
2077
  }}
1605
2078
  onChangeTrackData={this.handleChangeTrackDataBound}
@@ -1614,8 +2087,8 @@ class TiledPlot extends React.Component {
1614
2087
  orientation="right"
1615
2088
  position={this.state.contextMenuPosition}
1616
2089
  theme={this.props.theme}
1617
- tracks={relevantTracks}
1618
2090
  trackRenderer={this.trackRenderer}
2091
+ tracks={relevantTracks}
1619
2092
  trackSourceServers={this.props.trackSourceServers}
1620
2093
  />
1621
2094
  </PopupMenu>
@@ -1631,41 +2104,15 @@ class TiledPlot extends React.Component {
1631
2104
  */
1632
2105
  getIdealizedTrackPositionsOverlay() {
1633
2106
  const evtJson = this.props.draggingHappening;
2107
+ const { datatype } = evtJson;
1634
2108
 
1635
- // For whatever reason, evtJson is sometimes a boolean. This rest of
1636
- // this code block assumes it's an object, so we return undefined if
1637
- // it's not.
1638
- if (typeof evtJson === 'boolean') {
1639
- return undefined;
1640
- }
1641
-
1642
- const datatype = evtJson.datatype;
1643
-
1644
- if (!(datatype in DEFAULT_TRACKS_FOR_DATATYPE) && !evtJson.defaultTracks) {
1645
- console.warn('unknown data type:', evtJson.higlassTrack);
1646
- return undefined;
1647
- }
1648
-
1649
- const orientationToPositions = {
1650
- '1d-horizontal': ['top', 'bottom', 'left', 'right'],
1651
- '2d': ['center'],
1652
- '1d-vertical': ['left', 'right'],
1653
- };
1654
-
1655
- const defaultTracks = DEFAULT_TRACKS_FOR_DATATYPE[datatype] || {};
2109
+ const defaultTracks = getDefaultTracksForDataType(
2110
+ datatype,
2111
+ evtJson.defaultTracks,
2112
+ );
1656
2113
 
1657
- if (evtJson.defaultTracks) {
1658
- for (const trackType of evtJson.defaultTracks) {
1659
- if (!TRACKS_INFO_BY_TYPE[trackType]) {
1660
- console.warn('unknown track type', trackType);
1661
- } else {
1662
- for (const position of orientationToPositions[
1663
- TRACKS_INFO_BY_TYPE[trackType].orientation
1664
- ]) {
1665
- defaultTracks[position] = trackType;
1666
- }
1667
- }
1668
- }
2114
+ if (!defaultTracks) {
2115
+ return null;
1669
2116
  }
1670
2117
 
1671
2118
  const presentTracks = new Set(
@@ -1866,12 +2313,13 @@ class TiledPlot extends React.Component {
1866
2313
  const verticalPadding = this.props.paddingTop + this.props.paddingBottom;
1867
2314
  const horizontalPadding = this.props.paddingLeft + this.props.paddingRight;
1868
2315
 
2316
+ // Maintain at least 1 minimum center width to avoid degenerate (range: [0,0]) scales
1869
2317
  this.centerHeight = Math.max(
1870
- 0,
2318
+ 1,
1871
2319
  this.state.height - this.topHeight - this.bottomHeight - verticalPadding,
1872
2320
  );
1873
2321
  this.centerWidth = Math.max(
1874
- 0,
2322
+ 1,
1875
2323
  this.state.width - this.leftWidth - this.rightWidth - horizontalPadding,
1876
2324
  );
1877
2325
 
@@ -2059,10 +2507,10 @@ class TiledPlot extends React.Component {
2059
2507
 
2060
2508
  let centerTrack = (
2061
2509
  <div
2062
- className={[
2510
+ className={clsx(
2063
2511
  'center-track-container',
2064
2512
  stylesCenterTrack['center-track-container'],
2065
- ].join(' ')}
2513
+ )}
2066
2514
  style={{
2067
2515
  left: this.leftWidth + this.props.paddingLeft,
2068
2516
  top: this.topHeight + this.props.paddingTop,
@@ -2076,10 +2524,10 @@ class TiledPlot extends React.Component {
2076
2524
  if (this.props.tracks.center.length) {
2077
2525
  centerTrack = (
2078
2526
  <div
2079
- className={[
2527
+ className={clsx(
2080
2528
  'center-track-container',
2081
2529
  stylesCenterTrack['center-track-container'],
2082
- ].join(' ')}
2530
+ )}
2083
2531
  style={{
2084
2532
  left: this.leftWidth + this.props.paddingLeft,
2085
2533
  top: this.topHeight + this.props.paddingTop,
@@ -2144,7 +2592,7 @@ class TiledPlot extends React.Component {
2144
2592
  this.checkAllTilesetInfoReceived();
2145
2593
  }}
2146
2594
  // Custom props
2147
- canvasElement={this.canvasElement}
2595
+ canvasElement={this.props.canvasElement}
2148
2596
  centerHeight={this.centerHeight}
2149
2597
  centerWidth={this.centerWidth}
2150
2598
  disableTrackMenu={this.props.disableTrackMenu}
@@ -2211,6 +2659,7 @@ class TiledPlot extends React.Component {
2211
2659
  ref={(c) => {
2212
2660
  this.configTrackMenu = c;
2213
2661
  }}
2662
+ apiPublish={this.props.apiPublish}
2214
2663
  closeMenu={this.closeMenusBound}
2215
2664
  onAddDivisor={this.handleAddDivisorBound}
2216
2665
  onAddSeries={this.handleAddSeriesBound}
@@ -2263,23 +2712,24 @@ class TiledPlot extends React.Component {
2263
2712
  overlays = positionedTracks
2264
2713
  .filter((pTrack) => pTrack.track.position !== 'whole')
2265
2714
  .map((pTrack) => {
2266
- let background = 'transparent';
2267
- let border = 'none';
2715
+ let className = 'tiled-plot-track-overlay-animate';
2716
+
2717
+ if (this.state.mouseOverOverlayUid || this.props.overTrackChooser) {
2718
+ className = 'tiled-plot-track-overlay-plain';
2719
+ }
2268
2720
 
2269
2721
  if (this.state.mouseOverOverlayUid === pTrack.track.uid) {
2270
- background = 'yellow';
2271
- border = '1px solid black';
2722
+ className = 'tiled-plot-track-overlay-selected';
2272
2723
  }
2273
2724
 
2274
2725
  return (
2275
2726
  <div
2727
+ className={styles[className]}
2276
2728
  key={pTrack.track.uid}
2277
- className="tiled-plot-track-overlay"
2278
2729
  // we want to remove the mouseOverOverlayUid so that next time we try
2279
2730
  // to choose an overlay track, the previously selected one isn't
2280
2731
  // automatically highlighted
2281
-
2282
- onClick={() => this.handleTrackPositionChosen(pTrack)}
2732
+ onClick={(evt) => this.handleTrackPositionChosen(pTrack, evt)}
2283
2733
  onDragEnter={(evt) => {
2284
2734
  this.handleOverlayMouseEnter(pTrack.track.uid);
2285
2735
  evt.preventDefault();
@@ -2299,9 +2749,6 @@ class TiledPlot extends React.Component {
2299
2749
  top: pTrack.top,
2300
2750
  width: pTrack.width,
2301
2751
  height: pTrack.height,
2302
- background,
2303
- opacity: 0.4,
2304
- border,
2305
2752
  zIndex: 1,
2306
2753
  }}
2307
2754
  />
@@ -2349,7 +2796,8 @@ class TiledPlot extends React.Component {
2349
2796
  ref={(c) => {
2350
2797
  this.divTiledPlot = c;
2351
2798
  }}
2352
- className={['tiled-plot-div', styles['tiled-plot']].join(' ')}
2799
+ className={clsx('tiled-plot-div', styles['tiled-plot'])}
2800
+ onClick={this.handleClickBound}
2353
2801
  style={{
2354
2802
  marginBottom: this.props.marginBottom,
2355
2803
  marginLeft: this.props.marginLeft,
@@ -2388,13 +2836,13 @@ class TiledPlot extends React.Component {
2388
2836
 
2389
2837
  TiledPlot.defaultProps = {
2390
2838
  isShowGlobalMousePosition: false,
2391
- pluginDataFetchers: {},
2392
2839
  pluginTracks: {},
2393
2840
  metaTracks: [],
2394
2841
  zoomable: true,
2395
2842
  };
2396
2843
 
2397
2844
  TiledPlot.propTypes = {
2845
+ addTrackExtent: PropTypes.string,
2398
2846
  addTrackPosition: PropTypes.string,
2399
2847
  canvasElement: PropTypes.object,
2400
2848
  chooseTrackHandler: PropTypes.func,
@@ -2441,7 +2889,6 @@ TiledPlot.propTypes = {
2441
2889
  openModal: PropTypes.func,
2442
2890
  pixiRenderer: PropTypes.object,
2443
2891
  pixiStage: PropTypes.object,
2444
- pluginDataFetchers: PropTypes.object,
2445
2892
  pluginTracks: PropTypes.object,
2446
2893
  pubSub: PropTypes.object.isRequired,
2447
2894
  rangeSelection1dSize: PropTypes.array,