@jbrowse/plugin-linear-genome-view 2.5.0 → 2.6.2

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 (459) hide show
  1. package/dist/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +1 -1
  2. package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js +0 -1
  3. package/dist/BaseLinearDisplay/components/Block.d.ts +3 -3
  4. package/dist/BaseLinearDisplay/components/Block.js +0 -1
  5. package/dist/BaseLinearDisplay/components/BlockMsg.d.ts +1 -1
  6. package/dist/BaseLinearDisplay/components/BlockMsg.js +0 -1
  7. package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +3 -2
  8. package/dist/BaseLinearDisplay/components/LinearBlocks.js +0 -1
  9. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +0 -1
  10. package/dist/BaseLinearDisplay/components/TooLargeMessage.d.ts +2 -1
  11. package/dist/BaseLinearDisplay/components/TooLargeMessage.js +0 -1
  12. package/dist/BaseLinearDisplay/components/Tooltip.d.ts +2 -1
  13. package/dist/BaseLinearDisplay/components/Tooltip.js +0 -1
  14. package/dist/BaseLinearDisplay/index.d.ts +5 -2
  15. package/dist/BaseLinearDisplay/index.js +7 -2
  16. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +62 -142
  17. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +34 -356
  18. package/dist/BaseLinearDisplay/models/FeatureDensityMixin.d.ts +99 -0
  19. package/dist/BaseLinearDisplay/models/FeatureDensityMixin.js +189 -0
  20. package/dist/BaseLinearDisplay/models/TrackHeightMixin.d.ts +30 -0
  21. package/dist/BaseLinearDisplay/models/TrackHeightMixin.js +55 -0
  22. package/dist/BaseLinearDisplay/models/autorunFeatureDensityStats.d.ts +2 -0
  23. package/dist/BaseLinearDisplay/models/autorunFeatureDensityStats.js +41 -0
  24. package/dist/BaseLinearDisplay/models/configSchema.js +1 -1
  25. package/dist/BaseLinearDisplay/models/renderSvg.d.ts +8 -0
  26. package/dist/BaseLinearDisplay/models/renderSvg.js +82 -0
  27. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +20 -17
  28. package/dist/BaseLinearDisplay/models/util.js +0 -1
  29. package/dist/BasicTrack/configSchema.js +1 -1
  30. package/dist/BasicTrack/index.js +0 -1
  31. package/dist/FeatureTrack/configSchema.d.ts +1 -3
  32. package/dist/FeatureTrack/configSchema.js +1 -1
  33. package/dist/FeatureTrack/index.js +0 -1
  34. package/dist/LaunchLinearGenomeView/index.js +0 -1
  35. package/dist/LinearBareDisplay/configSchema.d.ts +1 -0
  36. package/dist/LinearBareDisplay/configSchema.js +1 -1
  37. package/dist/LinearBareDisplay/index.js +0 -1
  38. package/dist/LinearBareDisplay/model.d.ts +52 -39
  39. package/dist/LinearBareDisplay/model.js +1 -1
  40. package/dist/LinearBasicDisplay/components/SetMaxHeight.d.ts +2 -1
  41. package/dist/LinearBasicDisplay/components/SetMaxHeight.js +0 -1
  42. package/dist/LinearBasicDisplay/configSchema.d.ts +1 -0
  43. package/dist/LinearBasicDisplay/configSchema.js +1 -1
  44. package/dist/LinearBasicDisplay/index.js +0 -1
  45. package/dist/LinearBasicDisplay/model.d.ts +67 -66
  46. package/dist/LinearBasicDisplay/model.js +1 -1
  47. package/dist/LinearGenomeView/components/CenterLine.d.ts +2 -1
  48. package/dist/LinearGenomeView/components/CenterLine.js +0 -1
  49. package/dist/LinearGenomeView/components/Cytobands.d.ts +2 -1
  50. package/dist/LinearGenomeView/components/Cytobands.js +0 -1
  51. package/dist/LinearGenomeView/components/ExportSvgDialog.d.ts +2 -1
  52. package/dist/LinearGenomeView/components/ExportSvgDialog.js +0 -1
  53. package/dist/LinearGenomeView/components/GetSequenceDialog.d.ts +2 -1
  54. package/dist/LinearGenomeView/components/GetSequenceDialog.js +0 -1
  55. package/dist/LinearGenomeView/components/Gridlines.d.ts +2 -1
  56. package/dist/LinearGenomeView/components/Gridlines.js +0 -1
  57. package/dist/LinearGenomeView/components/Header.d.ts +2 -1
  58. package/dist/LinearGenomeView/components/Header.js +0 -1
  59. package/dist/LinearGenomeView/components/ImportForm.d.ts +2 -1
  60. package/dist/LinearGenomeView/components/ImportForm.js +0 -1
  61. package/dist/LinearGenomeView/components/LinearGenomeView.d.ts +2 -1
  62. package/dist/LinearGenomeView/components/LinearGenomeView.js +28 -5
  63. package/dist/LinearGenomeView/components/MiniControls.d.ts +3 -2
  64. package/dist/LinearGenomeView/components/MiniControls.js +20 -41
  65. package/dist/LinearGenomeView/components/OverviewRubberband.d.ts +1 -1
  66. package/dist/LinearGenomeView/components/OverviewRubberband.js +0 -1
  67. package/dist/LinearGenomeView/components/OverviewScalebar.d.ts +2 -2
  68. package/dist/LinearGenomeView/components/OverviewScalebar.js +10 -5
  69. package/dist/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.d.ts +10 -0
  70. package/dist/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.js +21 -0
  71. package/dist/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.d.ts +5 -0
  72. package/dist/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.js +51 -0
  73. package/dist/LinearGenomeView/components/{HelpDialog.d.ts → RefNameAutocomplete/HelpDialog.d.ts} +2 -1
  74. package/dist/LinearGenomeView/components/{HelpDialog.js → RefNameAutocomplete/HelpDialog.js} +0 -1
  75. package/dist/LinearGenomeView/components/RefNameAutocomplete/index.d.ts +18 -0
  76. package/dist/LinearGenomeView/components/RefNameAutocomplete/index.js +110 -0
  77. package/dist/LinearGenomeView/components/RefNameAutocomplete/util.d.ts +12 -0
  78. package/dist/LinearGenomeView/components/RefNameAutocomplete/util.js +58 -0
  79. package/dist/LinearGenomeView/components/Rubberband.d.ts +1 -1
  80. package/dist/LinearGenomeView/components/Rubberband.js +0 -1
  81. package/dist/LinearGenomeView/components/RubberbandSpan.d.ts +2 -1
  82. package/dist/LinearGenomeView/components/RubberbandSpan.js +0 -1
  83. package/dist/LinearGenomeView/components/Scalebar.js +0 -1
  84. package/dist/LinearGenomeView/components/SearchBox.d.ts +2 -1
  85. package/dist/LinearGenomeView/components/SearchBox.js +0 -1
  86. package/dist/LinearGenomeView/components/SearchResultsDialog.d.ts +2 -1
  87. package/dist/LinearGenomeView/components/SearchResultsDialog.js +0 -1
  88. package/dist/LinearGenomeView/components/SearchResultsTable.d.ts +2 -1
  89. package/dist/LinearGenomeView/components/SearchResultsTable.js +0 -1
  90. package/dist/LinearGenomeView/components/SequenceSearchDialog.d.ts +2 -1
  91. package/dist/LinearGenomeView/components/SequenceSearchDialog.js +0 -1
  92. package/dist/LinearGenomeView/components/TrackContainer.d.ts +3 -3
  93. package/dist/LinearGenomeView/components/TrackContainer.js +12 -69
  94. package/dist/LinearGenomeView/components/TrackLabel.js +7 -12
  95. package/dist/LinearGenomeView/components/TrackLabelContainer.d.ts +9 -0
  96. package/dist/LinearGenomeView/components/TrackLabelContainer.js +31 -0
  97. package/dist/LinearGenomeView/components/TrackRenderingContainer.d.ts +10 -0
  98. package/dist/LinearGenomeView/components/TrackRenderingContainer.js +73 -0
  99. package/dist/LinearGenomeView/components/TracksContainer.d.ts +1 -1
  100. package/dist/LinearGenomeView/components/TracksContainer.js +2 -3
  101. package/dist/LinearGenomeView/components/VerticalGuide.d.ts +2 -1
  102. package/dist/LinearGenomeView/components/VerticalGuide.js +0 -1
  103. package/dist/LinearGenomeView/components/ZoomControls.d.ts +2 -1
  104. package/dist/LinearGenomeView/components/ZoomControls.js +0 -1
  105. package/dist/LinearGenomeView/components/hooks.js +0 -1
  106. package/dist/LinearGenomeView/components/util.js +0 -1
  107. package/dist/LinearGenomeView/index.js +0 -1
  108. package/dist/LinearGenomeView/model.d.ts +13 -12
  109. package/dist/LinearGenomeView/model.js +25 -26
  110. package/dist/LinearGenomeView/svgcomponents/SVGBackground.d.ts +2 -1
  111. package/dist/LinearGenomeView/svgcomponents/SVGBackground.js +0 -1
  112. package/dist/LinearGenomeView/svgcomponents/SVGHeader.d.ts +3 -4
  113. package/dist/LinearGenomeView/svgcomponents/SVGHeader.js +7 -3
  114. package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +1 -2
  115. package/dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +2 -1
  116. package/dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.js +0 -1
  117. package/dist/LinearGenomeView/svgcomponents/SVGRuler.d.ts +2 -1
  118. package/dist/LinearGenomeView/svgcomponents/SVGRuler.js +0 -1
  119. package/dist/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +2 -1
  120. package/dist/LinearGenomeView/svgcomponents/SVGScalebar.js +0 -1
  121. package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +2 -1
  122. package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.js +0 -1
  123. package/dist/LinearGenomeView/svgcomponents/SVGTracks.d.ts +2 -1
  124. package/dist/LinearGenomeView/svgcomponents/SVGTracks.js +0 -1
  125. package/dist/LinearGenomeView/util.d.ts +2 -2
  126. package/dist/LinearGenomeView/util.js +0 -1
  127. package/dist/index.d.ts +160 -134
  128. package/dist/index.js +6 -4
  129. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +1 -1
  130. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +0 -1
  131. package/esm/BaseLinearDisplay/components/Block.d.ts +3 -3
  132. package/esm/BaseLinearDisplay/components/Block.js +0 -1
  133. package/esm/BaseLinearDisplay/components/BlockMsg.d.ts +1 -1
  134. package/esm/BaseLinearDisplay/components/BlockMsg.js +0 -1
  135. package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +3 -2
  136. package/esm/BaseLinearDisplay/components/LinearBlocks.js +0 -1
  137. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +0 -1
  138. package/esm/BaseLinearDisplay/components/TooLargeMessage.d.ts +2 -1
  139. package/esm/BaseLinearDisplay/components/TooLargeMessage.js +0 -1
  140. package/esm/BaseLinearDisplay/components/Tooltip.d.ts +2 -1
  141. package/esm/BaseLinearDisplay/components/Tooltip.js +0 -1
  142. package/esm/BaseLinearDisplay/index.d.ts +5 -2
  143. package/esm/BaseLinearDisplay/index.js +3 -1
  144. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +62 -142
  145. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +36 -335
  146. package/esm/BaseLinearDisplay/models/FeatureDensityMixin.d.ts +99 -0
  147. package/esm/BaseLinearDisplay/models/FeatureDensityMixin.js +183 -0
  148. package/esm/BaseLinearDisplay/models/TrackHeightMixin.d.ts +30 -0
  149. package/esm/BaseLinearDisplay/models/TrackHeightMixin.js +52 -0
  150. package/esm/BaseLinearDisplay/models/autorunFeatureDensityStats.d.ts +2 -0
  151. package/esm/BaseLinearDisplay/models/autorunFeatureDensityStats.js +38 -0
  152. package/esm/BaseLinearDisplay/models/configSchema.js +1 -1
  153. package/esm/BaseLinearDisplay/models/renderSvg.d.ts +8 -0
  154. package/esm/BaseLinearDisplay/models/renderSvg.js +53 -0
  155. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +20 -17
  156. package/esm/BaseLinearDisplay/models/util.js +0 -1
  157. package/esm/BasicTrack/configSchema.js +1 -1
  158. package/esm/BasicTrack/index.js +0 -1
  159. package/esm/FeatureTrack/configSchema.d.ts +1 -3
  160. package/esm/FeatureTrack/configSchema.js +1 -1
  161. package/esm/FeatureTrack/index.js +0 -1
  162. package/esm/LaunchLinearGenomeView/index.js +0 -1
  163. package/esm/LinearBareDisplay/configSchema.d.ts +1 -0
  164. package/esm/LinearBareDisplay/configSchema.js +1 -1
  165. package/esm/LinearBareDisplay/index.js +0 -1
  166. package/esm/LinearBareDisplay/model.d.ts +52 -39
  167. package/esm/LinearBareDisplay/model.js +1 -1
  168. package/esm/LinearBasicDisplay/components/SetMaxHeight.d.ts +2 -1
  169. package/esm/LinearBasicDisplay/components/SetMaxHeight.js +0 -1
  170. package/esm/LinearBasicDisplay/configSchema.d.ts +1 -0
  171. package/esm/LinearBasicDisplay/configSchema.js +1 -1
  172. package/esm/LinearBasicDisplay/index.js +0 -1
  173. package/esm/LinearBasicDisplay/model.d.ts +67 -66
  174. package/esm/LinearBasicDisplay/model.js +1 -1
  175. package/esm/LinearGenomeView/components/CenterLine.d.ts +2 -1
  176. package/esm/LinearGenomeView/components/CenterLine.js +0 -1
  177. package/esm/LinearGenomeView/components/Cytobands.d.ts +2 -1
  178. package/esm/LinearGenomeView/components/Cytobands.js +0 -1
  179. package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +2 -1
  180. package/esm/LinearGenomeView/components/ExportSvgDialog.js +0 -1
  181. package/esm/LinearGenomeView/components/GetSequenceDialog.d.ts +2 -1
  182. package/esm/LinearGenomeView/components/GetSequenceDialog.js +0 -1
  183. package/esm/LinearGenomeView/components/Gridlines.d.ts +2 -1
  184. package/esm/LinearGenomeView/components/Gridlines.js +0 -1
  185. package/esm/LinearGenomeView/components/Header.d.ts +2 -1
  186. package/esm/LinearGenomeView/components/Header.js +0 -1
  187. package/esm/LinearGenomeView/components/ImportForm.d.ts +2 -1
  188. package/esm/LinearGenomeView/components/ImportForm.js +0 -1
  189. package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +2 -1
  190. package/esm/LinearGenomeView/components/LinearGenomeView.js +4 -4
  191. package/esm/LinearGenomeView/components/MiniControls.d.ts +3 -2
  192. package/esm/LinearGenomeView/components/MiniControls.js +20 -18
  193. package/esm/LinearGenomeView/components/OverviewRubberband.d.ts +1 -1
  194. package/esm/LinearGenomeView/components/OverviewRubberband.js +0 -1
  195. package/esm/LinearGenomeView/components/OverviewScalebar.d.ts +2 -2
  196. package/esm/LinearGenomeView/components/OverviewScalebar.js +10 -5
  197. package/esm/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.d.ts +10 -0
  198. package/esm/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.js +15 -0
  199. package/esm/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.d.ts +5 -0
  200. package/esm/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.js +22 -0
  201. package/esm/LinearGenomeView/components/{HelpDialog.d.ts → RefNameAutocomplete/HelpDialog.d.ts} +2 -1
  202. package/esm/LinearGenomeView/components/{HelpDialog.js → RefNameAutocomplete/HelpDialog.js} +0 -1
  203. package/esm/LinearGenomeView/components/RefNameAutocomplete/index.d.ts +18 -0
  204. package/esm/LinearGenomeView/components/RefNameAutocomplete/index.js +82 -0
  205. package/esm/LinearGenomeView/components/RefNameAutocomplete/util.d.ts +12 -0
  206. package/esm/LinearGenomeView/components/RefNameAutocomplete/util.js +49 -0
  207. package/esm/LinearGenomeView/components/Rubberband.d.ts +1 -1
  208. package/esm/LinearGenomeView/components/Rubberband.js +0 -1
  209. package/esm/LinearGenomeView/components/RubberbandSpan.d.ts +2 -1
  210. package/esm/LinearGenomeView/components/RubberbandSpan.js +0 -1
  211. package/esm/LinearGenomeView/components/Scalebar.js +0 -1
  212. package/esm/LinearGenomeView/components/SearchBox.d.ts +2 -1
  213. package/esm/LinearGenomeView/components/SearchBox.js +0 -1
  214. package/esm/LinearGenomeView/components/SearchResultsDialog.d.ts +2 -1
  215. package/esm/LinearGenomeView/components/SearchResultsDialog.js +0 -1
  216. package/esm/LinearGenomeView/components/SearchResultsTable.d.ts +2 -1
  217. package/esm/LinearGenomeView/components/SearchResultsTable.js +0 -1
  218. package/esm/LinearGenomeView/components/SequenceSearchDialog.d.ts +2 -1
  219. package/esm/LinearGenomeView/components/SequenceSearchDialog.js +0 -1
  220. package/esm/LinearGenomeView/components/TrackContainer.d.ts +3 -3
  221. package/esm/LinearGenomeView/components/TrackContainer.js +13 -70
  222. package/esm/LinearGenomeView/components/TrackLabel.js +7 -12
  223. package/esm/LinearGenomeView/components/TrackLabelContainer.d.ts +9 -0
  224. package/esm/LinearGenomeView/components/TrackLabelContainer.js +26 -0
  225. package/esm/LinearGenomeView/components/TrackRenderingContainer.d.ts +10 -0
  226. package/esm/LinearGenomeView/components/TrackRenderingContainer.js +48 -0
  227. package/esm/LinearGenomeView/components/TracksContainer.d.ts +1 -1
  228. package/esm/LinearGenomeView/components/TracksContainer.js +2 -3
  229. package/esm/LinearGenomeView/components/VerticalGuide.d.ts +2 -1
  230. package/esm/LinearGenomeView/components/VerticalGuide.js +0 -1
  231. package/esm/LinearGenomeView/components/ZoomControls.d.ts +2 -1
  232. package/esm/LinearGenomeView/components/ZoomControls.js +0 -1
  233. package/esm/LinearGenomeView/components/hooks.js +0 -1
  234. package/esm/LinearGenomeView/components/util.js +0 -1
  235. package/esm/LinearGenomeView/index.js +0 -1
  236. package/esm/LinearGenomeView/model.d.ts +13 -12
  237. package/esm/LinearGenomeView/model.js +21 -22
  238. package/esm/LinearGenomeView/svgcomponents/SVGBackground.d.ts +2 -1
  239. package/esm/LinearGenomeView/svgcomponents/SVGBackground.js +0 -1
  240. package/esm/LinearGenomeView/svgcomponents/SVGHeader.d.ts +3 -4
  241. package/esm/LinearGenomeView/svgcomponents/SVGHeader.js +7 -3
  242. package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +1 -2
  243. package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +2 -1
  244. package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.js +0 -1
  245. package/esm/LinearGenomeView/svgcomponents/SVGRuler.d.ts +2 -1
  246. package/esm/LinearGenomeView/svgcomponents/SVGRuler.js +0 -1
  247. package/esm/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +2 -1
  248. package/esm/LinearGenomeView/svgcomponents/SVGScalebar.js +0 -1
  249. package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +2 -1
  250. package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.js +0 -1
  251. package/esm/LinearGenomeView/svgcomponents/SVGTracks.d.ts +2 -1
  252. package/esm/LinearGenomeView/svgcomponents/SVGTracks.js +0 -1
  253. package/esm/LinearGenomeView/util.d.ts +2 -2
  254. package/esm/LinearGenomeView/util.js +0 -1
  255. package/esm/index.d.ts +160 -134
  256. package/esm/index.js +1 -2
  257. package/package.json +3 -4
  258. package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js.map +0 -1
  259. package/dist/BaseLinearDisplay/components/Block.js.map +0 -1
  260. package/dist/BaseLinearDisplay/components/BlockMsg.js.map +0 -1
  261. package/dist/BaseLinearDisplay/components/LinearBlocks.js.map +0 -1
  262. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +0 -1
  263. package/dist/BaseLinearDisplay/components/TooLargeMessage.js.map +0 -1
  264. package/dist/BaseLinearDisplay/components/Tooltip.js.map +0 -1
  265. package/dist/BaseLinearDisplay/index.js.map +0 -1
  266. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +0 -1
  267. package/dist/BaseLinearDisplay/models/configSchema.js.map +0 -1
  268. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +0 -1
  269. package/dist/BaseLinearDisplay/models/util.js.map +0 -1
  270. package/dist/BasicTrack/configSchema.js.map +0 -1
  271. package/dist/BasicTrack/index.js.map +0 -1
  272. package/dist/FeatureTrack/configSchema.js.map +0 -1
  273. package/dist/FeatureTrack/index.js.map +0 -1
  274. package/dist/LaunchLinearGenomeView/index.js.map +0 -1
  275. package/dist/LinearBareDisplay/configSchema.js.map +0 -1
  276. package/dist/LinearBareDisplay/index.js.map +0 -1
  277. package/dist/LinearBareDisplay/model.js.map +0 -1
  278. package/dist/LinearBasicDisplay/components/SetMaxHeight.js.map +0 -1
  279. package/dist/LinearBasicDisplay/configSchema.js.map +0 -1
  280. package/dist/LinearBasicDisplay/index.js.map +0 -1
  281. package/dist/LinearBasicDisplay/model.js.map +0 -1
  282. package/dist/LinearGenomeView/components/CenterLine.js.map +0 -1
  283. package/dist/LinearGenomeView/components/Cytobands.js.map +0 -1
  284. package/dist/LinearGenomeView/components/ExportSvgDialog.js.map +0 -1
  285. package/dist/LinearGenomeView/components/GetSequenceDialog.js.map +0 -1
  286. package/dist/LinearGenomeView/components/Gridlines.js.map +0 -1
  287. package/dist/LinearGenomeView/components/Header.js.map +0 -1
  288. package/dist/LinearGenomeView/components/HelpDialog.js.map +0 -1
  289. package/dist/LinearGenomeView/components/ImportForm.js.map +0 -1
  290. package/dist/LinearGenomeView/components/LinearGenomeView.js.map +0 -1
  291. package/dist/LinearGenomeView/components/MiniControls.js.map +0 -1
  292. package/dist/LinearGenomeView/components/OverviewRubberband.js.map +0 -1
  293. package/dist/LinearGenomeView/components/OverviewScalebar.js.map +0 -1
  294. package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +0 -23
  295. package/dist/LinearGenomeView/components/RefNameAutocomplete.js +0 -189
  296. package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +0 -1
  297. package/dist/LinearGenomeView/components/Rubberband.js.map +0 -1
  298. package/dist/LinearGenomeView/components/RubberbandSpan.js.map +0 -1
  299. package/dist/LinearGenomeView/components/Scalebar.js.map +0 -1
  300. package/dist/LinearGenomeView/components/SearchBox.js.map +0 -1
  301. package/dist/LinearGenomeView/components/SearchResultsDialog.js.map +0 -1
  302. package/dist/LinearGenomeView/components/SearchResultsTable.js.map +0 -1
  303. package/dist/LinearGenomeView/components/SequenceSearchDialog.js.map +0 -1
  304. package/dist/LinearGenomeView/components/TrackContainer.js.map +0 -1
  305. package/dist/LinearGenomeView/components/TrackLabel.js.map +0 -1
  306. package/dist/LinearGenomeView/components/TracksContainer.js.map +0 -1
  307. package/dist/LinearGenomeView/components/VerticalGuide.js.map +0 -1
  308. package/dist/LinearGenomeView/components/ZoomControls.js.map +0 -1
  309. package/dist/LinearGenomeView/components/hooks.js.map +0 -1
  310. package/dist/LinearGenomeView/components/util.js.map +0 -1
  311. package/dist/LinearGenomeView/index.js.map +0 -1
  312. package/dist/LinearGenomeView/model.js.map +0 -1
  313. package/dist/LinearGenomeView/svgcomponents/SVGBackground.js.map +0 -1
  314. package/dist/LinearGenomeView/svgcomponents/SVGHeader.js.map +0 -1
  315. package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js.map +0 -1
  316. package/dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.js.map +0 -1
  317. package/dist/LinearGenomeView/svgcomponents/SVGRuler.js.map +0 -1
  318. package/dist/LinearGenomeView/svgcomponents/SVGScalebar.js.map +0 -1
  319. package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.js.map +0 -1
  320. package/dist/LinearGenomeView/svgcomponents/SVGTracks.js.map +0 -1
  321. package/dist/LinearGenomeView/util.js.map +0 -1
  322. package/dist/index.js.map +0 -1
  323. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js.map +0 -1
  324. package/esm/BaseLinearDisplay/components/Block.js.map +0 -1
  325. package/esm/BaseLinearDisplay/components/BlockMsg.js.map +0 -1
  326. package/esm/BaseLinearDisplay/components/LinearBlocks.js.map +0 -1
  327. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +0 -1
  328. package/esm/BaseLinearDisplay/components/TooLargeMessage.js.map +0 -1
  329. package/esm/BaseLinearDisplay/components/Tooltip.js.map +0 -1
  330. package/esm/BaseLinearDisplay/index.js.map +0 -1
  331. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +0 -1
  332. package/esm/BaseLinearDisplay/models/configSchema.js.map +0 -1
  333. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +0 -1
  334. package/esm/BaseLinearDisplay/models/util.js.map +0 -1
  335. package/esm/BasicTrack/configSchema.js.map +0 -1
  336. package/esm/BasicTrack/index.js.map +0 -1
  337. package/esm/FeatureTrack/configSchema.js.map +0 -1
  338. package/esm/FeatureTrack/index.js.map +0 -1
  339. package/esm/LaunchLinearGenomeView/index.js.map +0 -1
  340. package/esm/LinearBareDisplay/configSchema.js.map +0 -1
  341. package/esm/LinearBareDisplay/index.js.map +0 -1
  342. package/esm/LinearBareDisplay/model.js.map +0 -1
  343. package/esm/LinearBasicDisplay/components/SetMaxHeight.js.map +0 -1
  344. package/esm/LinearBasicDisplay/configSchema.js.map +0 -1
  345. package/esm/LinearBasicDisplay/index.js.map +0 -1
  346. package/esm/LinearBasicDisplay/model.js.map +0 -1
  347. package/esm/LinearGenomeView/components/CenterLine.js.map +0 -1
  348. package/esm/LinearGenomeView/components/Cytobands.js.map +0 -1
  349. package/esm/LinearGenomeView/components/ExportSvgDialog.js.map +0 -1
  350. package/esm/LinearGenomeView/components/GetSequenceDialog.js.map +0 -1
  351. package/esm/LinearGenomeView/components/Gridlines.js.map +0 -1
  352. package/esm/LinearGenomeView/components/Header.js.map +0 -1
  353. package/esm/LinearGenomeView/components/HelpDialog.js.map +0 -1
  354. package/esm/LinearGenomeView/components/ImportForm.js.map +0 -1
  355. package/esm/LinearGenomeView/components/LinearGenomeView.js.map +0 -1
  356. package/esm/LinearGenomeView/components/MiniControls.js.map +0 -1
  357. package/esm/LinearGenomeView/components/OverviewRubberband.js.map +0 -1
  358. package/esm/LinearGenomeView/components/OverviewScalebar.js.map +0 -1
  359. package/esm/LinearGenomeView/components/RefNameAutocomplete.d.ts +0 -23
  360. package/esm/LinearGenomeView/components/RefNameAutocomplete.js +0 -161
  361. package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +0 -1
  362. package/esm/LinearGenomeView/components/Rubberband.js.map +0 -1
  363. package/esm/LinearGenomeView/components/RubberbandSpan.js.map +0 -1
  364. package/esm/LinearGenomeView/components/Scalebar.js.map +0 -1
  365. package/esm/LinearGenomeView/components/SearchBox.js.map +0 -1
  366. package/esm/LinearGenomeView/components/SearchResultsDialog.js.map +0 -1
  367. package/esm/LinearGenomeView/components/SearchResultsTable.js.map +0 -1
  368. package/esm/LinearGenomeView/components/SequenceSearchDialog.js.map +0 -1
  369. package/esm/LinearGenomeView/components/TrackContainer.js.map +0 -1
  370. package/esm/LinearGenomeView/components/TrackLabel.js.map +0 -1
  371. package/esm/LinearGenomeView/components/TracksContainer.js.map +0 -1
  372. package/esm/LinearGenomeView/components/VerticalGuide.js.map +0 -1
  373. package/esm/LinearGenomeView/components/ZoomControls.js.map +0 -1
  374. package/esm/LinearGenomeView/components/hooks.js.map +0 -1
  375. package/esm/LinearGenomeView/components/util.js.map +0 -1
  376. package/esm/LinearGenomeView/index.js.map +0 -1
  377. package/esm/LinearGenomeView/model.js.map +0 -1
  378. package/esm/LinearGenomeView/svgcomponents/SVGBackground.js.map +0 -1
  379. package/esm/LinearGenomeView/svgcomponents/SVGHeader.js.map +0 -1
  380. package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js.map +0 -1
  381. package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.js.map +0 -1
  382. package/esm/LinearGenomeView/svgcomponents/SVGRuler.js.map +0 -1
  383. package/esm/LinearGenomeView/svgcomponents/SVGScalebar.js.map +0 -1
  384. package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.js.map +0 -1
  385. package/esm/LinearGenomeView/svgcomponents/SVGTracks.js.map +0 -1
  386. package/esm/LinearGenomeView/util.js.map +0 -1
  387. package/esm/index.js.map +0 -1
  388. package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +0 -117
  389. package/src/BaseLinearDisplay/components/Block.tsx +0 -77
  390. package/src/BaseLinearDisplay/components/BlockMsg.tsx +0 -42
  391. package/src/BaseLinearDisplay/components/LinearBlocks.tsx +0 -119
  392. package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +0 -69
  393. package/src/BaseLinearDisplay/components/TooLargeMessage.tsx +0 -36
  394. package/src/BaseLinearDisplay/components/Tooltip.tsx +0 -107
  395. package/src/BaseLinearDisplay/index.ts +0 -12
  396. package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +0 -768
  397. package/src/BaseLinearDisplay/models/configSchema.ts +0 -59
  398. package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +0 -318
  399. package/src/BaseLinearDisplay/models/util.ts +0 -67
  400. package/src/BasicTrack/configSchema.ts +0 -23
  401. package/src/BasicTrack/index.ts +0 -18
  402. package/src/FeatureTrack/configSchema.ts +0 -27
  403. package/src/FeatureTrack/index.ts +0 -18
  404. package/src/LaunchLinearGenomeView/index.ts +0 -66
  405. package/src/LinearBareDisplay/configSchema.ts +0 -27
  406. package/src/LinearBareDisplay/index.test.js +0 -34
  407. package/src/LinearBareDisplay/index.ts +0 -25
  408. package/src/LinearBareDisplay/model.ts +0 -53
  409. package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +0 -73
  410. package/src/LinearBasicDisplay/configSchema.ts +0 -27
  411. package/src/LinearBasicDisplay/index.ts +0 -25
  412. package/src/LinearBasicDisplay/model.ts +0 -214
  413. package/src/LinearGenomeView/README.md +0 -9
  414. package/src/LinearGenomeView/components/CenterLine.tsx +0 -65
  415. package/src/LinearGenomeView/components/Cytobands.tsx +0 -154
  416. package/src/LinearGenomeView/components/ExportSvgDialog.tsx +0 -149
  417. package/src/LinearGenomeView/components/GetSequenceDialog.tsx +0 -269
  418. package/src/LinearGenomeView/components/Gridlines.tsx +0 -119
  419. package/src/LinearGenomeView/components/Header.tsx +0 -126
  420. package/src/LinearGenomeView/components/HelpDialog.tsx +0 -69
  421. package/src/LinearGenomeView/components/ImportForm.tsx +0 -217
  422. package/src/LinearGenomeView/components/LinearGenomeView.test.tsx +0 -167
  423. package/src/LinearGenomeView/components/LinearGenomeView.tsx +0 -72
  424. package/src/LinearGenomeView/components/MiniControls.tsx +0 -55
  425. package/src/LinearGenomeView/components/OverviewRubberband.tsx +0 -219
  426. package/src/LinearGenomeView/components/OverviewScalebar.tsx +0 -345
  427. package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +0 -321
  428. package/src/LinearGenomeView/components/Rubberband.tsx +0 -89
  429. package/src/LinearGenomeView/components/RubberbandSpan.tsx +0 -99
  430. package/src/LinearGenomeView/components/Scalebar.test.tsx +0 -145
  431. package/src/LinearGenomeView/components/Scalebar.tsx +0 -199
  432. package/src/LinearGenomeView/components/SearchBox.tsx +0 -123
  433. package/src/LinearGenomeView/components/SearchResultsDialog.tsx +0 -57
  434. package/src/LinearGenomeView/components/SearchResultsTable.tsx +0 -121
  435. package/src/LinearGenomeView/components/SequenceSearchDialog.tsx +0 -136
  436. package/src/LinearGenomeView/components/TrackContainer.tsx +0 -180
  437. package/src/LinearGenomeView/components/TrackLabel.tsx +0 -143
  438. package/src/LinearGenomeView/components/TracksContainer.tsx +0 -114
  439. package/src/LinearGenomeView/components/VerticalGuide.tsx +0 -37
  440. package/src/LinearGenomeView/components/ZoomControls.tsx +0 -62
  441. package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.tsx.snap +0 -1520
  442. package/src/LinearGenomeView/components/hooks.ts +0 -306
  443. package/src/LinearGenomeView/components/util.ts +0 -76
  444. package/src/LinearGenomeView/hg38DisplayedRegions.json +0 -3187
  445. package/src/LinearGenomeView/index.test.ts +0 -993
  446. package/src/LinearGenomeView/index.ts +0 -17
  447. package/src/LinearGenomeView/model.ts +0 -1532
  448. package/src/LinearGenomeView/svgcomponents/SVGBackground.tsx +0 -21
  449. package/src/LinearGenomeView/svgcomponents/SVGHeader.tsx +0 -93
  450. package/src/LinearGenomeView/svgcomponents/SVGLinearGenomeView.tsx +0 -114
  451. package/src/LinearGenomeView/svgcomponents/SVGRegionSeparators.tsx +0 -31
  452. package/src/LinearGenomeView/svgcomponents/SVGRuler.tsx +0 -125
  453. package/src/LinearGenomeView/svgcomponents/SVGScalebar.tsx +0 -57
  454. package/src/LinearGenomeView/svgcomponents/SVGTrackLabel.tsx +0 -47
  455. package/src/LinearGenomeView/svgcomponents/SVGTracks.tsx +0 -67
  456. package/src/LinearGenomeView/util.test.ts +0 -33
  457. package/src/LinearGenomeView/util.ts +0 -182
  458. package/src/LinearGenomeView/volvoxDisplayedRegions.json +0 -16
  459. package/src/index.ts +0 -85
@@ -1,1532 +0,0 @@
1
- import React, { lazy } from 'react'
2
- import { getConf, AnyConfigurationModel } from '@jbrowse/core/configuration'
3
- import { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models'
4
- import { Region } from '@jbrowse/core/util/types'
5
- import { ElementId, Region as MUIRegion } from '@jbrowse/core/util/types/mst'
6
- import { MenuItem, ReturnToImportFormDialog } from '@jbrowse/core/ui'
7
- import {
8
- assembleLocString,
9
- clamp,
10
- findLast,
11
- getContainingView,
12
- getSession,
13
- isViewContainer,
14
- isSessionModelWithWidgets,
15
- isSessionWithAddTracks,
16
- localStorageGetItem,
17
- measureText,
18
- springAnimate,
19
- sum,
20
- ParsedLocString,
21
- } from '@jbrowse/core/util'
22
- import BaseResult from '@jbrowse/core/TextSearch/BaseResults'
23
- import { BlockSet, BaseBlock } from '@jbrowse/core/util/blockTypes'
24
- import calculateDynamicBlocks from '@jbrowse/core/util/calculateDynamicBlocks'
25
- import calculateStaticBlocks from '@jbrowse/core/util/calculateStaticBlocks'
26
- import { getParentRenderProps } from '@jbrowse/core/util/tracks'
27
- import { when, transaction, autorun } from 'mobx'
28
- import {
29
- addDisposer,
30
- cast,
31
- getSnapshot,
32
- getRoot,
33
- resolveIdentifier,
34
- types,
35
- Instance,
36
- } from 'mobx-state-tree'
37
-
38
- import Base1DView from '@jbrowse/core/util/Base1DViewModel'
39
- import { moveTo, pxToBp, bpToPx } from '@jbrowse/core/util/Base1DUtils'
40
- import { saveAs } from 'file-saver'
41
- import clone from 'clone'
42
- import PluginManager from '@jbrowse/core/PluginManager'
43
-
44
- // icons
45
- import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
46
- import SyncAltIcon from '@mui/icons-material/SyncAlt'
47
- import VisibilityIcon from '@mui/icons-material/Visibility'
48
- import LabelIcon from '@mui/icons-material/Label'
49
- import FolderOpenIcon from '@mui/icons-material/FolderOpen'
50
- import PhotoCameraIcon from '@mui/icons-material/PhotoCamera'
51
- import ZoomInIcon from '@mui/icons-material/ZoomIn'
52
- import MenuOpenIcon from '@mui/icons-material/MenuOpen'
53
-
54
- // locals
55
- import { renderToSvg } from './svgcomponents/SVGLinearGenomeView'
56
-
57
- import ExportSvgDlg from './components/ExportSvgDialog'
58
- import MiniControls from './components/MiniControls'
59
- import Header from './components/Header'
60
- import { generateLocations, parseLocStrings } from './util'
61
-
62
- // lazies
63
- const SequenceSearchDialog = lazy(
64
- () => import('./components/SequenceSearchDialog'),
65
- )
66
-
67
- const GetSequenceDialog = lazy(() => import('./components/GetSequenceDialog'))
68
-
69
- const SearchResultsDialog = lazy(
70
- () => import('./components/SearchResultsDialog'),
71
- )
72
-
73
- export interface BpOffset {
74
- refName?: string
75
- index: number
76
- offset: number
77
- start?: number
78
- end?: number
79
- coord?: number
80
- reversed?: boolean
81
- assemblyName?: string
82
- oob?: boolean
83
- }
84
- export interface ExportSvgOptions {
85
- rasterizeLayers?: boolean
86
- filename?: string
87
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
- Wrapper?: React.FC<any>
89
- fontSize?: number
90
- rulerHeight?: number
91
- textHeight?: number
92
- paddingHeight?: number
93
- headerHeight?: number
94
- cytobandHeight?: number
95
- trackLabels?: string
96
- themeName?: string
97
- }
98
-
99
- function calculateVisibleLocStrings(contentBlocks: BaseBlock[]) {
100
- if (!contentBlocks.length) {
101
- return ''
102
- }
103
- const isSingleAssemblyName = contentBlocks.every(
104
- b => b.assemblyName === contentBlocks[0].assemblyName,
105
- )
106
- const locs = contentBlocks.map(block =>
107
- assembleLocString({
108
- ...block,
109
- start: Math.round(block.start),
110
- end: Math.round(block.end),
111
- assemblyName: isSingleAssemblyName ? undefined : block.assemblyName,
112
- }),
113
- )
114
- return locs.join(' ')
115
- }
116
-
117
- export interface NavLocation {
118
- refName: string
119
- start?: number
120
- end?: number
121
- assemblyName?: string
122
- }
123
-
124
- export const HEADER_BAR_HEIGHT = 48
125
- export const HEADER_OVERVIEW_HEIGHT = 20
126
- export const SCALE_BAR_HEIGHT = 17
127
- export const RESIZE_HANDLE_HEIGHT = 3
128
- export const INTER_REGION_PADDING_WIDTH = 2
129
- export const SPACING = 7
130
- export const WIDGET_HEIGHT = 32
131
-
132
- /**
133
- * #stateModel LinearGenomeView
134
- */
135
- export function stateModelFactory(pluginManager: PluginManager) {
136
- return types
137
- .compose(
138
- BaseViewModel,
139
- types.model('LinearGenomeView', {
140
- /**
141
- * #property
142
- */
143
- id: ElementId,
144
-
145
- /**
146
- * #property
147
- * this is a string instead of the const literal 'LinearGenomeView' to
148
- * reduce some typescripting strictness, but you should pass the string
149
- * 'LinearGenomeView' to the model explicitly
150
- */
151
- type: types.literal('LinearGenomeView') as unknown as string,
152
-
153
- /**
154
- * #property
155
- * corresponds roughly to the horizontal scroll of the LGV
156
- */
157
- offsetPx: 0,
158
-
159
- /**
160
- * #property
161
- * corresponds roughly to the zoom level, base-pairs per pixel
162
- */
163
- bpPerPx: 1,
164
-
165
- /**
166
- * #property
167
- * currently displayed regions, can be a single chromosome, arbitrary
168
- * subsections, or the entire set of chromosomes in the genome, but it not
169
- * advised to use the entire set of chromosomes if your assembly is very
170
- * fragmented
171
- */
172
- displayedRegions: types.array(MUIRegion),
173
-
174
- /**
175
- * #property
176
- * array of currently displayed tracks state models instances
177
- */
178
- tracks: types.array(
179
- pluginManager.pluggableMstType('track', 'stateModel'),
180
- ),
181
-
182
- /**
183
- * #property
184
- * array of currently displayed tracks state model's
185
- */
186
- hideHeader: false,
187
-
188
- /**
189
- * #property
190
- */
191
- hideHeaderOverview: false,
192
-
193
- /**
194
- * #property
195
- */
196
- hideNoTracksActive: false,
197
-
198
- /**
199
- * #property
200
- */
201
- trackSelectorType: types.optional(
202
- types.enumeration(['hierarchical']),
203
- 'hierarchical',
204
- ),
205
-
206
- /**
207
- * #property
208
- * how to display the track labels, can be "overlapping", "offset", or
209
- * "hidden"
210
- */
211
- trackLabels: types.optional(
212
- types.string,
213
- () => localStorageGetItem('lgv-trackLabels') || 'overlapping',
214
- ),
215
-
216
- /**
217
- * #property
218
- * show the "center line"
219
- */
220
- showCenterLine: types.optional(types.boolean, () =>
221
- Boolean(
222
- JSON.parse(localStorageGetItem('lgv-showCenterLine') || 'false'),
223
- ),
224
- ),
225
-
226
- /**
227
- * #property
228
- * show the "cytobands" in the overview scale bar
229
- */
230
- showCytobandsSetting: types.optional(types.boolean, () =>
231
- Boolean(
232
- JSON.parse(localStorageGetItem('lgv-showCytobands') || 'true'),
233
- ),
234
- ),
235
-
236
- /**
237
- * #property
238
- * show the "gridlines" in the track area
239
- */
240
- showGridlines: true,
241
- }),
242
- )
243
- .volatile(() => ({
244
- volatileWidth: undefined as number | undefined,
245
- minimumBlockWidth: 3,
246
- draggingTrackId: undefined as undefined | string,
247
- volatileError: undefined as undefined | Error,
248
-
249
- // array of callbacks to run after the next set of the displayedRegions,
250
- // which is basically like an onLoad
251
- afterDisplayedRegionsSetCallbacks: [] as Function[],
252
- scaleFactor: 1,
253
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
254
- trackRefs: {} as { [key: string]: any },
255
- coarseDynamicBlocks: [] as BaseBlock[],
256
- coarseTotalBp: 0,
257
- leftOffset: undefined as undefined | BpOffset,
258
- rightOffset: undefined as undefined | BpOffset,
259
- }))
260
- .views(self => ({
261
- /**
262
- * #getter
263
- */
264
- get width(): number {
265
- if (self.volatileWidth === undefined) {
266
- throw new Error(
267
- 'width undefined, make sure to check for model.initialized',
268
- )
269
- }
270
- return self.volatileWidth
271
- },
272
- /**
273
- * #getter
274
- */
275
- get interRegionPaddingWidth() {
276
- return INTER_REGION_PADDING_WIDTH
277
- },
278
-
279
- /**
280
- * #getter
281
- */
282
- get assemblyNames() {
283
- return [
284
- ...new Set(self.displayedRegions.map(region => region.assemblyName)),
285
- ]
286
- },
287
- }))
288
- .views(self => ({
289
- /**
290
- * #method
291
- */
292
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
293
- MiniControlsComponent(): React.FC<any> {
294
- return MiniControls
295
- },
296
-
297
- /**
298
- * #method
299
- */
300
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
301
- HeaderComponent(): React.FC<any> {
302
- return Header
303
- },
304
-
305
- /**
306
- * #getter
307
- */
308
- get assemblyErrors() {
309
- const { assemblyManager } = getSession(self)
310
- const { assemblyNames } = self
311
- return assemblyNames
312
- .map(a => assemblyManager.get(a)?.error)
313
- .filter(f => !!f)
314
- .join(', ')
315
- },
316
-
317
- /**
318
- * #getter
319
- */
320
- get assembliesInitialized() {
321
- const { assemblyManager } = getSession(self)
322
- const { assemblyNames } = self
323
- return assemblyNames.every(a => assemblyManager.get(a)?.initialized)
324
- },
325
-
326
- /**
327
- * #getter
328
- */
329
- get initialized() {
330
- return self.volatileWidth !== undefined && this.assembliesInitialized
331
- },
332
-
333
- /**
334
- * #getter
335
- */
336
- get hasDisplayedRegions() {
337
- return self.displayedRegions.length > 0
338
- },
339
-
340
- /**
341
- * #getter
342
- */
343
- get scaleBarHeight() {
344
- return SCALE_BAR_HEIGHT + RESIZE_HANDLE_HEIGHT
345
- },
346
-
347
- /**
348
- * #getter
349
- */
350
- get headerHeight() {
351
- if (self.hideHeader) {
352
- return 0
353
- }
354
- if (self.hideHeaderOverview) {
355
- return HEADER_BAR_HEIGHT
356
- }
357
- return HEADER_BAR_HEIGHT + HEADER_OVERVIEW_HEIGHT
358
- },
359
-
360
- /**
361
- * #getter
362
- */
363
- get trackHeights() {
364
- return sum(self.tracks.map(t => t.displays[0].height))
365
- },
366
-
367
- /**
368
- * #getter
369
- */
370
- get trackHeightsWithResizeHandles() {
371
- return this.trackHeights + self.tracks.length * RESIZE_HANDLE_HEIGHT
372
- },
373
-
374
- /**
375
- * #getter
376
- */
377
- get height() {
378
- return (
379
- this.trackHeightsWithResizeHandles +
380
- this.headerHeight +
381
- this.scaleBarHeight
382
- )
383
- },
384
-
385
- /**
386
- * #getter
387
- */
388
- get totalBp() {
389
- return self.displayedRegions.reduce((a, b) => a + b.end - b.start, 0)
390
- },
391
-
392
- /**
393
- * #getter
394
- */
395
- get maxBpPerPx() {
396
- return this.totalBp / (self.width * 0.9)
397
- },
398
-
399
- /**
400
- * #getter
401
- */
402
- get minBpPerPx() {
403
- return 1 / 50
404
- },
405
-
406
- /**
407
- * #getter
408
- */
409
- get error() {
410
- return self.volatileError || this.assemblyErrors
411
- },
412
-
413
- /**
414
- * #getter
415
- */
416
- get maxOffset() {
417
- // objectively determined to keep the linear genome on the main screen
418
- const leftPadding = 10
419
- return this.displayedRegionsTotalPx - leftPadding
420
- },
421
-
422
- /**
423
- * #getter
424
- */
425
- get minOffset() {
426
- // objectively determined to keep the linear genome on the main screen
427
- const rightPadding = 30
428
- return -self.width + rightPadding
429
- },
430
-
431
- /**
432
- * #getter
433
- */
434
- get displayedRegionsTotalPx() {
435
- return this.totalBp / self.bpPerPx
436
- },
437
-
438
- /**
439
- * #method
440
- */
441
- renderProps() {
442
- return {
443
- ...getParentRenderProps(self),
444
- bpPerPx: self.bpPerPx,
445
- highResolutionScaling: getConf(
446
- getSession(self),
447
- 'highResolutionScaling',
448
- ),
449
- }
450
- },
451
-
452
- /**
453
- * #method
454
- */
455
- searchScope(assemblyName: string) {
456
- return {
457
- assemblyName,
458
- includeAggregateIndexes: true,
459
- tracks: self.tracks,
460
- }
461
- },
462
-
463
- /**
464
- * #method
465
- */
466
- getTrack(id: string) {
467
- return self.tracks.find(t => t.configuration.trackId === id)
468
- },
469
-
470
- /**
471
- * #method
472
- */
473
- rankSearchResults(results: BaseResult[]) {
474
- // order of rank
475
- const openTrackIds = new Set(
476
- self.tracks.map(track => track.configuration.trackId),
477
- )
478
- for (const result of results) {
479
- if (openTrackIds.has(result.trackId)) {
480
- result.updateScore(result.getScore() + 1)
481
- }
482
- }
483
- return results
484
- },
485
-
486
- /**
487
- * #method
488
- * modifies view menu action onClick to apply to all tracks of same type
489
- */
490
- rewriteOnClicks(trackType: string, viewMenuActions: MenuItem[]) {
491
- viewMenuActions.forEach(action => {
492
- // go to lowest level menu
493
- if ('subMenu' in action) {
494
- this.rewriteOnClicks(trackType, action.subMenu)
495
- }
496
- if ('onClick' in action) {
497
- const holdOnClick = action.onClick
498
- action.onClick = (...args: unknown[]) => {
499
- self.tracks.forEach(track => {
500
- if (track.type === trackType) {
501
- holdOnClick.apply(track, [track, ...args])
502
- }
503
- })
504
- }
505
- }
506
- })
507
- },
508
- /**
509
- * #getter
510
- */
511
- get trackTypeActions() {
512
- const allActions: Map<string, MenuItem[]> = new Map()
513
- self.tracks.forEach(track => {
514
- const trackInMap = allActions.get(track.type)
515
- if (!trackInMap) {
516
- const viewMenuActions = clone(track.viewMenuActions)
517
- this.rewriteOnClicks(track.type, viewMenuActions)
518
- allActions.set(track.type, viewMenuActions)
519
- }
520
- })
521
-
522
- return allActions
523
- },
524
- }))
525
- .actions(self => ({
526
- /**
527
- * #action
528
- */
529
- setShowCytobands(flag: boolean) {
530
- self.showCytobandsSetting = flag
531
- },
532
- /**
533
- * #action
534
- */
535
- setWidth(newWidth: number) {
536
- self.volatileWidth = newWidth
537
- },
538
- /**
539
- * #action
540
- */
541
- setError(error: Error | undefined) {
542
- self.volatileError = error
543
- },
544
- /**
545
- * #action
546
- */
547
- toggleHeader() {
548
- self.hideHeader = !self.hideHeader
549
- },
550
- /**
551
- * #action
552
- */
553
- toggleHeaderOverview() {
554
- self.hideHeaderOverview = !self.hideHeaderOverview
555
- },
556
- /**
557
- * #action
558
- */
559
- toggleNoTracksActive() {
560
- self.hideNoTracksActive = !self.hideNoTracksActive
561
- },
562
- /**
563
- * #action
564
- */
565
- toggleShowGridlines() {
566
- self.showGridlines = !self.showGridlines
567
- },
568
- /**
569
- * #action
570
- */
571
- scrollTo(offsetPx: number) {
572
- const newOffsetPx = clamp(offsetPx, self.minOffset, self.maxOffset)
573
- self.offsetPx = newOffsetPx
574
- return newOffsetPx
575
- },
576
-
577
- /**
578
- * #action
579
- */
580
- zoomTo(bpPerPx: number, offset = self.width / 2, centerAtOffset = false) {
581
- const newBpPerPx = clamp(bpPerPx, self.minBpPerPx, self.maxBpPerPx)
582
- if (newBpPerPx === self.bpPerPx) {
583
- return newBpPerPx
584
- }
585
- const oldBpPerPx = self.bpPerPx
586
-
587
- if (Math.abs(oldBpPerPx - newBpPerPx) < 0.000001) {
588
- console.warn('zoomTo bpPerPx rounding error')
589
- return oldBpPerPx
590
- }
591
- self.bpPerPx = newBpPerPx
592
-
593
- // tweak the offset so that the center of the view remains at the same
594
- // coordinate
595
- this.scrollTo(
596
- Math.round(
597
- ((self.offsetPx + offset) * oldBpPerPx) / newBpPerPx -
598
- (centerAtOffset ? self.width / 2 : offset),
599
- ),
600
- )
601
- return newBpPerPx
602
- },
603
-
604
- /**
605
- * #action
606
- * sets offsets of rubberband, used in the get sequence dialog can call
607
- * view.getSelectedRegions(view.leftOffset,view.rightOffset) to compute
608
- * the selected regions from the offsets
609
- */
610
- setOffsets(left?: BpOffset, right?: BpOffset) {
611
- self.leftOffset = left
612
- self.rightOffset = right
613
- },
614
-
615
- /**
616
- * #action
617
- */
618
- setSearchResults(
619
- searchResults: BaseResult[],
620
- searchQuery: string,
621
- assemblyName?: string,
622
- ) {
623
- getSession(self).queueDialog(handleClose => [
624
- SearchResultsDialog,
625
-
626
- {
627
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
628
- model: self as any,
629
- searchResults,
630
- searchQuery,
631
- handleClose,
632
- assemblyName,
633
- },
634
- ])
635
- },
636
-
637
- /**
638
- * #action
639
- */
640
- setNewView(bpPerPx: number, offsetPx: number) {
641
- this.zoomTo(bpPerPx)
642
- this.scrollTo(offsetPx)
643
- },
644
-
645
- /**
646
- * #action
647
- */
648
- horizontallyFlip() {
649
- self.displayedRegions = cast(
650
- [...self.displayedRegions]
651
- .reverse()
652
- .map(region => ({ ...region, reversed: !region.reversed })),
653
- )
654
- this.scrollTo(self.totalBp / self.bpPerPx - self.offsetPx - self.width)
655
- },
656
-
657
- /**
658
- * #action
659
- */
660
- showTrack(
661
- trackId: string,
662
- initialSnapshot = {},
663
- displayInitialSnapshot = {},
664
- ) {
665
- const schema = pluginManager.pluggableConfigSchemaType('track')
666
- const conf = resolveIdentifier(schema, getRoot(self), trackId)
667
- if (!conf) {
668
- throw new Error(`Could not resolve identifier "${trackId}"`)
669
- }
670
- const trackType = pluginManager.getTrackType(conf?.type)
671
- if (!trackType) {
672
- throw new Error(`Unknown track type ${conf.type}`)
673
- }
674
- const viewType = pluginManager.getViewType(self.type)
675
- const supportedDisplays = new Set(
676
- viewType.displayTypes.map(d => d.name),
677
- )
678
- const displayConf = conf.displays.find((d: AnyConfigurationModel) =>
679
- supportedDisplays.has(d.type),
680
- )
681
- if (!displayConf) {
682
- throw new Error(
683
- `Could not find a compatible display for view type ${self.type}`,
684
- )
685
- }
686
-
687
- const t = self.tracks.filter(t => t.configuration === conf)
688
- if (t.length === 0) {
689
- const track = trackType.stateModel.create({
690
- ...initialSnapshot,
691
- type: conf.type,
692
- configuration: conf,
693
- displays: [
694
- {
695
- type: displayConf.type,
696
- configuration: displayConf,
697
- ...displayInitialSnapshot,
698
- },
699
- ],
700
- })
701
- self.tracks.push(track)
702
- return track
703
- }
704
- return t[0]
705
- },
706
- /**
707
- * #action
708
- */
709
- hideTrack(trackId: string) {
710
- const schema = pluginManager.pluggableConfigSchemaType('track')
711
- const conf = resolveIdentifier(schema, getRoot(self), trackId)
712
- const t = self.tracks.filter(t => t.configuration === conf)
713
- transaction(() => t.forEach(t => self.tracks.remove(t)))
714
- return t.length
715
- },
716
- }))
717
- .actions(self => ({
718
- /**
719
- * #action
720
- */
721
- moveTrack(movingId: string, targetId: string) {
722
- const oldIndex = self.tracks.findIndex(track => track.id === movingId)
723
- if (oldIndex === -1) {
724
- throw new Error(`Track ID ${movingId} not found`)
725
- }
726
- const newIndex = self.tracks.findIndex(track => track.id === targetId)
727
- if (newIndex === -1) {
728
- throw new Error(`Track ID ${targetId} not found`)
729
- }
730
- const track = getSnapshot(self.tracks[oldIndex])
731
- self.tracks.splice(oldIndex, 1)
732
- self.tracks.splice(newIndex, 0, track)
733
- },
734
-
735
- /**
736
- * #action
737
- */
738
- closeView() {
739
- const parent = getContainingView(self)
740
- if (parent) {
741
- // I am embedded in a some other view
742
- if (isViewContainer(parent)) {
743
- parent.removeView(self)
744
- }
745
- } else {
746
- // I am part of a session
747
- getSession(self).removeView(self)
748
- }
749
- },
750
-
751
- /**
752
- * #action
753
- */
754
- toggleTrack(trackId: string) {
755
- // if we have any tracks with that configuration, turn them off
756
- const hiddenCount = self.hideTrack(trackId)
757
- // if none had that configuration, turn one on
758
- if (!hiddenCount) {
759
- self.showTrack(trackId)
760
- }
761
- },
762
-
763
- /**
764
- * #action
765
- */
766
- setTrackLabels(setting: 'overlapping' | 'offset' | 'hidden') {
767
- self.trackLabels = setting
768
- },
769
-
770
- /**
771
- * #action
772
- */
773
- toggleCenterLine() {
774
- self.showCenterLine = !self.showCenterLine
775
- },
776
-
777
- /**
778
- * #action
779
- */
780
- setDisplayedRegions(regions: Region[]) {
781
- self.displayedRegions = cast(regions)
782
- self.zoomTo(self.bpPerPx)
783
- },
784
-
785
- /**
786
- * #action
787
- */
788
- activateTrackSelector() {
789
- if (self.trackSelectorType === 'hierarchical') {
790
- const session = getSession(self)
791
- if (isSessionModelWithWidgets(session)) {
792
- const selector = session.addWidget(
793
- 'HierarchicalTrackSelectorWidget',
794
- 'hierarchicalTrackSelector',
795
- { view: self },
796
- )
797
- session.showWidget(selector)
798
- return selector
799
- }
800
- }
801
- throw new Error(`invalid track selector type ${self.trackSelectorType}`)
802
- },
803
-
804
- /**
805
- * #method
806
- * Helper method for the fetchSequence.
807
- * Retrieves the corresponding regions that were selected by the
808
- * rubberband
809
- *
810
- * @param leftOffset - `object as {start, end, index, offset}`, offset = start
811
- * of user drag
812
- * @param rightOffset - `object as {start, end, index, offset}`,
813
- * offset = end of user drag
814
- * @returns array of Region[]
815
- */
816
- getSelectedRegions(leftOffset?: BpOffset, rightOffset?: BpOffset) {
817
- const snap = getSnapshot(self)
818
- const simView = Base1DView.create({
819
- ...snap,
820
- interRegionPaddingWidth: self.interRegionPaddingWidth,
821
- })
822
-
823
- simView.setVolatileWidth(self.width)
824
- simView.moveTo(leftOffset, rightOffset)
825
-
826
- return simView.dynamicBlocks.contentBlocks.map(region => ({
827
- ...region,
828
- start: Math.floor(region.start),
829
- end: Math.ceil(region.end),
830
- }))
831
- },
832
-
833
- /**
834
- * #action
835
- * schedule something to be run after the next time displayedRegions is
836
- * set
837
- */
838
- afterDisplayedRegionsSet(cb: Function) {
839
- self.afterDisplayedRegionsSetCallbacks.push(cb)
840
- },
841
-
842
- /**
843
- * #action
844
- */
845
- horizontalScroll(distance: number) {
846
- const oldOffsetPx = self.offsetPx
847
- // newOffsetPx is the actual offset after the scroll is clamped
848
- const newOffsetPx = self.scrollTo(self.offsetPx + distance)
849
- return newOffsetPx - oldOffsetPx
850
- },
851
-
852
- /**
853
- * #action
854
- */
855
- center() {
856
- const centerBp = self.totalBp / 2
857
- const centerPx = centerBp / self.bpPerPx
858
- self.scrollTo(Math.round(centerPx - self.width / 2))
859
- },
860
-
861
- /**
862
- * #action
863
- */
864
- showAllRegions() {
865
- self.zoomTo(self.maxBpPerPx)
866
- this.center()
867
- },
868
-
869
- /**
870
- * #action
871
- */
872
- showAllRegionsInAssembly(assemblyName?: string) {
873
- const session = getSession(self)
874
- const { assemblyManager } = session
875
- if (!assemblyName) {
876
- const names = new Set(self.displayedRegions.map(r => r.assemblyName))
877
- if (names.size > 1) {
878
- session.notify(
879
- `Can't perform operation with multiple assemblies currently`,
880
- )
881
- return
882
- }
883
- ;[assemblyName] = [...names]
884
- }
885
- const assembly = assemblyManager.get(assemblyName)
886
- if (assembly) {
887
- const { regions } = assembly
888
- if (regions) {
889
- this.setDisplayedRegions(regions)
890
- self.zoomTo(self.maxBpPerPx)
891
- this.center()
892
- }
893
- }
894
- },
895
-
896
- /**
897
- * #action
898
- */
899
- setDraggingTrackId(idx?: string) {
900
- self.draggingTrackId = idx
901
- },
902
-
903
- /**
904
- * #action
905
- */
906
- setScaleFactor(factor: number) {
907
- self.scaleFactor = factor
908
- },
909
-
910
- /**
911
- * #action
912
- * this "clears the view" and makes the view return to the import form
913
- */
914
- clearView() {
915
- this.setDisplayedRegions([])
916
- self.tracks.clear()
917
- // it is necessary to run these after setting displayed regions empty
918
- // or else model.offsetPx gets set to Infinity and breaks
919
- // mobx-state-tree snapshot
920
- self.scrollTo(0)
921
- self.zoomTo(10)
922
- },
923
-
924
- /**
925
- * #method
926
- * creates an svg export and save using FileSaver
927
- */
928
- async exportSvg(opts: ExportSvgOptions = {}) {
929
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
930
- const html = await renderToSvg(self as any, opts)
931
- const blob = new Blob([html], { type: 'image/svg+xml' })
932
- saveAs(blob, opts.filename || 'image.svg')
933
- },
934
- }))
935
- .actions(self => {
936
- let cancelLastAnimation = () => {}
937
-
938
- /**
939
- * #action
940
- * perform animated slide
941
- */
942
- function slide(viewWidths: number) {
943
- const [animate, cancelAnimation] = springAnimate(
944
- self.offsetPx,
945
- self.offsetPx + self.width * viewWidths,
946
- self.scrollTo,
947
- )
948
- cancelLastAnimation()
949
- cancelLastAnimation = cancelAnimation
950
- animate()
951
- }
952
-
953
- return { slide }
954
- })
955
- .actions(self => {
956
- let cancelLastAnimation = () => {}
957
-
958
- /**
959
- * #action
960
- * perform animated zoom
961
- */
962
- function zoom(targetBpPerPx: number) {
963
- self.zoomTo(self.bpPerPx)
964
- if (
965
- // already zoomed all the way in
966
- (targetBpPerPx < self.bpPerPx && self.bpPerPx === self.minBpPerPx) ||
967
- // already zoomed all the way out
968
- (targetBpPerPx > self.bpPerPx && self.bpPerPx === self.maxBpPerPx)
969
- ) {
970
- return
971
- }
972
- const factor = self.bpPerPx / targetBpPerPx
973
- const [animate, cancelAnimation] = springAnimate(
974
- 1,
975
- factor,
976
- self.setScaleFactor,
977
- () => {
978
- self.zoomTo(targetBpPerPx)
979
- self.setScaleFactor(1)
980
- },
981
- )
982
- cancelLastAnimation()
983
- cancelLastAnimation = cancelAnimation
984
- animate()
985
- }
986
-
987
- return { zoom }
988
- })
989
- .views(self => ({
990
- /**
991
- * #getter
992
- */
993
- get canShowCytobands() {
994
- return self.displayedRegions.length === 1 && this.anyCytobandsExist
995
- },
996
- /**
997
- * #getter
998
- */
999
- get showCytobands() {
1000
- return this.canShowCytobands && self.showCytobandsSetting
1001
- },
1002
- /**
1003
- * #getter
1004
- */
1005
- get anyCytobandsExist() {
1006
- const { assemblyManager } = getSession(self)
1007
- return self.assemblyNames.some(
1008
- a => assemblyManager.get(a)?.cytobands?.length,
1009
- )
1010
- },
1011
- /**
1012
- * #getter
1013
- * the cytoband is displayed to the right of the chromosome name, and
1014
- * that offset is calculated manually with this method
1015
- */
1016
- get cytobandOffset() {
1017
- return this.showCytobands
1018
- ? measureText(self.displayedRegions[0].refName, 12) + 15
1019
- : 0
1020
- },
1021
- }))
1022
- .views(self => ({
1023
- /**
1024
- * #method
1025
- * return the view menu items
1026
- */
1027
- menuItems(): MenuItem[] {
1028
- const { canShowCytobands, showCytobands } = self
1029
- const session = getSession(self)
1030
- const menuItems: MenuItem[] = [
1031
- {
1032
- label: 'Return to import form',
1033
- onClick: () => {
1034
- getSession(self).queueDialog(handleClose => [
1035
- ReturnToImportFormDialog,
1036
- { model: self, handleClose },
1037
- ])
1038
- },
1039
- icon: FolderOpenIcon,
1040
- },
1041
- ...(isSessionWithAddTracks(session)
1042
- ? [
1043
- {
1044
- label: 'Sequence search',
1045
- onClick: () => {
1046
- getSession(self).queueDialog(handleClose => [
1047
- SequenceSearchDialog,
1048
- { model: self, handleClose },
1049
- ])
1050
- },
1051
- },
1052
- ]
1053
- : []),
1054
- {
1055
- label: 'Export SVG',
1056
- icon: PhotoCameraIcon,
1057
- onClick: () => {
1058
- getSession(self).queueDialog(handleClose => [
1059
- ExportSvgDlg,
1060
- { model: self, handleClose },
1061
- ])
1062
- },
1063
- },
1064
- {
1065
- label: 'Open track selector',
1066
- onClick: self.activateTrackSelector,
1067
- icon: TrackSelectorIcon,
1068
- },
1069
- {
1070
- label: 'Horizontally flip',
1071
- icon: SyncAltIcon,
1072
- onClick: self.horizontallyFlip,
1073
- },
1074
- {
1075
- label: 'Show...',
1076
- icon: VisibilityIcon,
1077
- subMenu: [
1078
- {
1079
- label: 'Show all regions in assembly',
1080
- onClick: self.showAllRegionsInAssembly,
1081
- },
1082
- {
1083
- label: 'Show center line',
1084
- type: 'checkbox',
1085
- checked: self.showCenterLine,
1086
- onClick: self.toggleCenterLine,
1087
- },
1088
- {
1089
- label: 'Show header',
1090
- type: 'checkbox',
1091
- checked: !self.hideHeader,
1092
- onClick: self.toggleHeader,
1093
- },
1094
- {
1095
- label: 'Show header overview',
1096
- type: 'checkbox',
1097
- checked: !self.hideHeaderOverview,
1098
- onClick: self.toggleHeaderOverview,
1099
- disabled: self.hideHeader,
1100
- },
1101
- {
1102
- label: 'Show no tracks active button',
1103
- type: 'checkbox',
1104
- checked: !self.hideNoTracksActive,
1105
- onClick: self.toggleNoTracksActive,
1106
- },
1107
- {
1108
- label: 'Show guidelines',
1109
- type: 'checkbox',
1110
- checked: self.showGridlines,
1111
- onClick: self.toggleShowGridlines,
1112
- },
1113
- ...(canShowCytobands
1114
- ? [
1115
- {
1116
- label: 'Show ideogram',
1117
- type: 'checkbox' as const,
1118
- checked: self.showCytobands,
1119
- onClick: () => self.setShowCytobands(!showCytobands),
1120
- },
1121
- ]
1122
- : []),
1123
- ],
1124
- },
1125
- {
1126
- label: 'Track labels',
1127
- icon: LabelIcon,
1128
- subMenu: [
1129
- {
1130
- label: 'Overlapping',
1131
- icon: VisibilityIcon,
1132
- type: 'radio',
1133
- checked: self.trackLabels === 'overlapping',
1134
- onClick: () => self.setTrackLabels('overlapping'),
1135
- },
1136
- {
1137
- label: 'Offset',
1138
- icon: VisibilityIcon,
1139
- type: 'radio',
1140
- checked: self.trackLabels === 'offset',
1141
- onClick: () => self.setTrackLabels('offset'),
1142
- },
1143
- {
1144
- label: 'Hidden',
1145
- icon: VisibilityIcon,
1146
- type: 'radio',
1147
- checked: self.trackLabels === 'hidden',
1148
- onClick: () => self.setTrackLabels('hidden'),
1149
- },
1150
- ],
1151
- },
1152
- ]
1153
-
1154
- // add track's view level menu options
1155
- for (const [key, value] of self.trackTypeActions.entries()) {
1156
- if (value.length) {
1157
- menuItems.push(
1158
- { type: 'divider' },
1159
- { type: 'subHeader', label: key },
1160
- )
1161
- value.forEach(action => menuItems.push(action))
1162
- }
1163
- }
1164
-
1165
- return menuItems
1166
- },
1167
- }))
1168
- .views(self => {
1169
- let currentlyCalculatedStaticBlocks: BlockSet | undefined
1170
- let stringifiedCurrentlyCalculatedStaticBlocks = ''
1171
- return {
1172
- /**
1173
- * #getter
1174
- * static blocks are an important concept jbrowse uses to avoid
1175
- * re-rendering when you scroll to the side. when you horizontally scroll to the
1176
- * right, old blocks to the left may be removed, and new blocks may be
1177
- * instantiated on the right. tracks may use the static blocks to render their
1178
- * data for the region represented by the block
1179
- */
1180
- get staticBlocks() {
1181
- const ret = calculateStaticBlocks(self)
1182
- const sret = JSON.stringify(ret)
1183
- if (stringifiedCurrentlyCalculatedStaticBlocks !== sret) {
1184
- currentlyCalculatedStaticBlocks = ret
1185
- stringifiedCurrentlyCalculatedStaticBlocks = sret
1186
- }
1187
- return currentlyCalculatedStaticBlocks as BlockSet
1188
- },
1189
- /**
1190
- * #getter
1191
- * dynamic blocks represent the exact coordinates of the currently
1192
- * visible genome regions on the screen. they are similar to static blocks, but
1193
- * static blocks can go offscreen while dynamic blocks represent exactly what
1194
- * is on screen
1195
- */
1196
- get dynamicBlocks() {
1197
- return calculateDynamicBlocks(self)
1198
- },
1199
- /**
1200
- * #getter
1201
- * rounded dynamic blocks are dynamic blocks without fractions of bp
1202
- */
1203
- get roundedDynamicBlocks() {
1204
- return this.dynamicBlocks.contentBlocks.map(
1205
- block =>
1206
- ({
1207
- ...block,
1208
- start: Math.floor(block.start),
1209
- end: Math.ceil(block.end),
1210
- } as BaseBlock),
1211
- )
1212
- },
1213
-
1214
- /**
1215
- * #getter
1216
- * a single "combo-locstring" representing all the regions visible
1217
- * on the screen
1218
- */
1219
- get visibleLocStrings() {
1220
- return calculateVisibleLocStrings(this.dynamicBlocks.contentBlocks)
1221
- },
1222
-
1223
- /**
1224
- * #getter
1225
- * same as visibleLocStrings, but only updated every 300ms
1226
- */
1227
- get coarseVisibleLocStrings() {
1228
- return calculateVisibleLocStrings(self.coarseDynamicBlocks)
1229
- },
1230
- }
1231
- })
1232
- .actions(self => ({
1233
- /**
1234
- * #action
1235
- */
1236
- setCoarseDynamicBlocks(blocks: BlockSet) {
1237
- self.coarseDynamicBlocks = blocks.contentBlocks
1238
- self.coarseTotalBp = blocks.totalBp
1239
- },
1240
-
1241
- afterAttach() {
1242
- addDisposer(
1243
- self,
1244
- autorun(
1245
- () => {
1246
- if (self.initialized) {
1247
- this.setCoarseDynamicBlocks(self.dynamicBlocks)
1248
- }
1249
- },
1250
- { delay: 150 },
1251
- ),
1252
- )
1253
-
1254
- addDisposer(
1255
- self,
1256
- autorun(() => {
1257
- const s = (s: unknown) => JSON.stringify(s)
1258
- const { trackLabels, showCytobandsSetting, showCenterLine } = self
1259
- if (typeof localStorage !== 'undefined') {
1260
- localStorage.setItem('lgv-trackLabels', trackLabels)
1261
- localStorage.setItem('lgv-showCytobands', s(showCytobandsSetting))
1262
- localStorage.setItem('lgv-showCenterLine', s(showCenterLine))
1263
- }
1264
- }),
1265
- )
1266
- },
1267
- }))
1268
- .actions(self => ({
1269
- /**
1270
- * #action
1271
- * offset is the base-pair-offset in the displayed region, index is the
1272
- * index of the displayed region in the linear genome view
1273
- *
1274
- * @param start - object as `{start, end, offset, index}`
1275
- * @param end - object as `{start, end, offset, index}`
1276
- */
1277
- moveTo(start?: BpOffset, end?: BpOffset) {
1278
- moveTo(self, start, end)
1279
- },
1280
-
1281
- /**
1282
- * #action
1283
- * Navigate to the given locstring, will change displayed regions if
1284
- * needed, and wait for assemblies to be initialized
1285
- *
1286
- * @param input - e.g. "chr1:1-100", "chr1:1-100 chr2:1-100", "chr 1 100"
1287
- * @param optAssemblyName - (optional) the assembly name to use when
1288
- * navigating to the locstring
1289
- */
1290
- async navToLocString(input: string, optAssemblyName?: string) {
1291
- const { assemblyNames } = self
1292
- const { assemblyManager } = getSession(self)
1293
- const { isValidRefName } = assemblyManager
1294
- const assemblyName = optAssemblyName || assemblyNames[0]
1295
- if (assemblyName) {
1296
- // wait before isValidRefName can be called
1297
- await assemblyManager.waitForAssembly(assemblyName)
1298
- }
1299
-
1300
- return this.navToLocations(
1301
- parseLocStrings(input, assemblyName, isValidRefName),
1302
- assemblyName,
1303
- )
1304
- },
1305
-
1306
- /**
1307
- * #action
1308
- * Similar to `navToLocString`, but accepts parsed location objects
1309
- * instead of strings. Will try to perform `setDisplayedRegions` if
1310
- * changing regions
1311
- */
1312
- async navToLocations(
1313
- parsedLocStrings: ParsedLocString[],
1314
- assemblyName?: string,
1315
- ) {
1316
- const { assemblyManager } = getSession(self)
1317
- await when(() => self.volatileWidth !== undefined)
1318
-
1319
- const locations = await generateLocations(
1320
- parsedLocStrings,
1321
- assemblyManager,
1322
- assemblyName,
1323
- )
1324
-
1325
- if (locations.length === 1) {
1326
- const loc = locations[0]
1327
- const { reversed, parentRegion, start, end } = loc
1328
- self.setDisplayedRegions([{ reversed, ...parentRegion }])
1329
-
1330
- this.navTo({
1331
- ...loc,
1332
- start: clamp(start ?? 0, 0, parentRegion.end),
1333
- end: clamp(end ?? parentRegion.end, 0, parentRegion.end),
1334
- })
1335
- } else {
1336
- self.setDisplayedRegions(
1337
- // @ts-expect-error
1338
- locations.map(r => (r.start === undefined ? r.parentRegion : r)),
1339
- )
1340
- self.showAllRegions()
1341
- }
1342
- },
1343
-
1344
- /**
1345
- * #action
1346
- * Navigate to a location based on its refName and optionally start, end,
1347
- * and assemblyName. Will not try to change displayed regions, use
1348
- * `navToLocations` instead. Only navigates to a location if it is
1349
- * entirely within a displayedRegion. Navigates to the first matching location
1350
- * encountered.
1351
- *
1352
- * Throws an error if navigation was unsuccessful
1353
- *
1354
- * @param query - a proposed location to navigate to
1355
- */
1356
- navTo(query: NavLocation) {
1357
- this.navToMultiple([query])
1358
- },
1359
-
1360
- /**
1361
- * #action
1362
- * Navigate to a location based on its refName and optionally start, end,
1363
- * and assemblyName. Will not try to change displayed regions, use
1364
- * navToLocations instead. Only navigates to a location if it is entirely
1365
- * within a displayedRegion. Navigates to the first matching location
1366
- * encountered.
1367
- *
1368
- * Throws an error if navigation was unsuccessful
1369
- *
1370
- * @param locations - proposed location to navigate to
1371
- */
1372
- navToMultiple(locations: NavLocation[]) {
1373
- if (
1374
- locations.some(
1375
- l =>
1376
- l.start !== undefined && l.end !== undefined && l.start > l.end,
1377
- )
1378
- ) {
1379
- throw new Error('found start greater than end')
1380
- }
1381
- const f1 = locations[0]
1382
- const f2 = locations[locations.length - 1]
1383
- const a = self.assemblyNames[0]
1384
- const { assemblyManager } = getSession(self)
1385
- const assembly1 = assemblyManager.get(f1.assemblyName || a)
1386
- const assembly2 = assemblyManager.get(f2.assemblyName || a)
1387
- const ref1 = assembly1?.getCanonicalRefName(f1.refName) || f1.refName
1388
- const ref2 = assembly2?.getCanonicalRefName(f2.refName) || f2.refName
1389
- const r1 = self.displayedRegions.find(r => r.refName === ref1)
1390
- const r2 = findLast(self.displayedRegions, r => r.refName === ref2)
1391
- if (!r1) {
1392
- throw new Error(`could not find a region with refName "${ref1}"`)
1393
- }
1394
- if (!r2) {
1395
- throw new Error(`could not find a region with refName "${ref2}"`)
1396
- }
1397
-
1398
- const s1 = f1.start === undefined ? r1.start : f1.start
1399
- const e1 = f1.end === undefined ? r1.end : f1.end
1400
- const s2 = f2.start === undefined ? r2.start : f2.start
1401
- const e2 = f2.end === undefined ? r2.end : f2.end
1402
-
1403
- const index = self.displayedRegions.findIndex(
1404
- r =>
1405
- ref1 === r.refName &&
1406
- s1 >= r.start &&
1407
- s1 <= r.end &&
1408
- e1 <= r.end &&
1409
- e1 >= r.start,
1410
- )
1411
-
1412
- const index2 = self.displayedRegions.findIndex(
1413
- r =>
1414
- ref2 === r.refName &&
1415
- s2 >= r.start &&
1416
- s2 <= r.end &&
1417
- e2 <= r.end &&
1418
- e2 >= r.start,
1419
- )
1420
-
1421
- if (index === -1 || index2 === -1) {
1422
- throw new Error(
1423
- `could not find a region that contained "${locations.map(l =>
1424
- assembleLocString(l),
1425
- )}"`,
1426
- )
1427
- }
1428
-
1429
- const sd = self.displayedRegions[index]
1430
- const ed = self.displayedRegions[index2]
1431
-
1432
- this.moveTo(
1433
- {
1434
- index,
1435
- offset: sd.reversed ? sd.end - e1 : s1 - sd.start,
1436
- },
1437
- {
1438
- index: index2,
1439
- offset: ed.reversed ? ed.end - s2 : e2 - ed.start,
1440
- },
1441
- )
1442
- },
1443
- }))
1444
- .views(self => ({
1445
- /**
1446
- * #method
1447
- */
1448
- rubberBandMenuItems(): MenuItem[] {
1449
- return [
1450
- {
1451
- label: 'Zoom to region',
1452
- icon: ZoomInIcon,
1453
- onClick: () => self.moveTo(self.leftOffset, self.rightOffset),
1454
- },
1455
- {
1456
- label: 'Get sequence',
1457
- icon: MenuOpenIcon,
1458
- onClick: () =>
1459
- getSession(self).queueDialog(handleClose => [
1460
- GetSequenceDialog,
1461
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1462
- { model: self as any, handleClose },
1463
- ]),
1464
- },
1465
- ]
1466
- },
1467
-
1468
- /**
1469
- * #method
1470
- */
1471
- bpToPx({
1472
- refName,
1473
- coord,
1474
- regionNumber,
1475
- }: {
1476
- refName: string
1477
- coord: number
1478
- regionNumber?: number
1479
- }) {
1480
- return bpToPx({ refName, coord, regionNumber, self })
1481
- },
1482
-
1483
- /**
1484
- * #method
1485
- * scrolls the view to center on the given bp. if that is not in any
1486
- * of the displayed regions, does nothing
1487
- * @param coord - basepair at which you want to center the view
1488
- * @param refName - refName of the displayedRegion you are centering at
1489
- * @param regionNumber - index of the displayedRegion
1490
- */
1491
- centerAt(coord: number, refName: string, regionNumber: number) {
1492
- const centerPx = this.bpToPx({
1493
- refName,
1494
- coord,
1495
- regionNumber,
1496
- })
1497
- if (centerPx !== undefined) {
1498
- self.scrollTo(Math.round(centerPx.offsetPx - self.width / 2))
1499
- }
1500
- },
1501
-
1502
- /**
1503
- * #method
1504
- */
1505
- pxToBp(px: number) {
1506
- return pxToBp(self, px)
1507
- },
1508
-
1509
- /**
1510
- * #getter
1511
- */
1512
- get centerLineInfo() {
1513
- return self.displayedRegions.length > 0
1514
- ? this.pxToBp(self.width / 2)
1515
- : undefined
1516
- },
1517
- }))
1518
- }
1519
-
1520
- export type LinearGenomeViewStateModel = ReturnType<typeof stateModelFactory>
1521
- export type LinearGenomeViewModel = Instance<LinearGenomeViewStateModel>
1522
-
1523
- export {
1524
- default as ReactComponent,
1525
- default as LinearGenomeView,
1526
- } from './components/LinearGenomeView'
1527
-
1528
- export { default as RefNameAutocomplete } from './components/RefNameAutocomplete'
1529
- export { default as SearchBox } from './components/SearchBox'
1530
- export { default as ZoomControls } from './components/ZoomControls'
1531
-
1532
- export { renderToSvg } from './svgcomponents/SVGLinearGenomeView'