@jbrowse/plugin-linear-comparative-view 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/LICENSE +201 -0
  2. package/dist/LGVSyntenyDisplay/configSchemaF.d.ts +52 -0
  3. package/dist/LGVSyntenyDisplay/configSchemaF.js +18 -0
  4. package/dist/LGVSyntenyDisplay/configSchemaF.js.map +1 -0
  5. package/dist/LGVSyntenyDisplay/index.d.ts +3 -0
  6. package/dist/LGVSyntenyDisplay/index.js +24 -0
  7. package/dist/LGVSyntenyDisplay/index.js.map +1 -0
  8. package/dist/LGVSyntenyDisplay/model.d.ts +380 -0
  9. package/dist/LGVSyntenyDisplay/model.js +154 -0
  10. package/dist/LGVSyntenyDisplay/model.js.map +1 -0
  11. package/dist/LaunchLinearSyntenyView.d.ts +2 -0
  12. package/dist/LaunchLinearSyntenyView.js +58 -0
  13. package/dist/LaunchLinearSyntenyView.js.map +1 -0
  14. package/dist/LinearComparativeDisplay/configSchemaF.d.ts +5 -0
  15. package/dist/LinearComparativeDisplay/configSchemaF.js +18 -0
  16. package/dist/LinearComparativeDisplay/configSchemaF.js.map +1 -0
  17. package/dist/LinearComparativeDisplay/index.d.ts +3 -0
  18. package/dist/LinearComparativeDisplay/index.js +24 -0
  19. package/dist/LinearComparativeDisplay/index.js.map +1 -0
  20. package/dist/LinearComparativeDisplay/stateModelFactory.d.ts +275 -0
  21. package/dist/LinearComparativeDisplay/stateModelFactory.js +172 -0
  22. package/dist/LinearComparativeDisplay/stateModelFactory.js.map +1 -0
  23. package/dist/LinearComparativeView/components/Header.d.ts +7 -0
  24. package/dist/LinearComparativeView/components/Header.js +89 -0
  25. package/dist/LinearComparativeView/components/Header.js.map +1 -0
  26. package/dist/LinearComparativeView/components/LinearComparativeView.d.ts +8 -0
  27. package/dist/LinearComparativeView/components/LinearComparativeView.js +99 -0
  28. package/dist/LinearComparativeView/components/LinearComparativeView.js.map +1 -0
  29. package/dist/LinearComparativeView/components/Rubberband.d.ts +9 -0
  30. package/dist/LinearComparativeView/components/Rubberband.js +225 -0
  31. package/dist/LinearComparativeView/components/Rubberband.js.map +1 -0
  32. package/dist/LinearComparativeView/index.d.ts +3 -0
  33. package/dist/LinearComparativeView/index.js +42 -0
  34. package/dist/LinearComparativeView/index.js.map +1 -0
  35. package/dist/LinearComparativeView/model.d.ts +326 -0
  36. package/dist/LinearComparativeView/model.js +346 -0
  37. package/dist/LinearComparativeView/model.js.map +1 -0
  38. package/dist/LinearReadVsRef/LinearReadVsRef.d.ts +7 -0
  39. package/dist/LinearReadVsRef/LinearReadVsRef.js +284 -0
  40. package/dist/LinearReadVsRef/LinearReadVsRef.js.map +1 -0
  41. package/dist/LinearReadVsRef/index.d.ts +2 -0
  42. package/dist/LinearReadVsRef/index.js +55 -0
  43. package/dist/LinearReadVsRef/index.js.map +1 -0
  44. package/dist/LinearSyntenyDisplay/afterAttach.d.ts +2 -0
  45. package/dist/LinearSyntenyDisplay/afterAttach.js +108 -0
  46. package/dist/LinearSyntenyDisplay/afterAttach.js.map +1 -0
  47. package/dist/LinearSyntenyDisplay/components/Component.d.ts +6 -0
  48. package/dist/LinearSyntenyDisplay/components/Component.js +87 -0
  49. package/dist/LinearSyntenyDisplay/components/Component.js.map +1 -0
  50. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.d.ts +6 -0
  51. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +160 -0
  52. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js.map +1 -0
  53. package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.d.ts +7 -0
  54. package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js +83 -0
  55. package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js.map +1 -0
  56. package/dist/LinearSyntenyDisplay/components/util.d.ts +27 -0
  57. package/dist/LinearSyntenyDisplay/components/util.js +84 -0
  58. package/dist/LinearSyntenyDisplay/components/util.js.map +1 -0
  59. package/dist/LinearSyntenyDisplay/configSchemaF.d.ts +23 -0
  60. package/dist/LinearSyntenyDisplay/configSchemaF.js +36 -0
  61. package/dist/LinearSyntenyDisplay/configSchemaF.js.map +1 -0
  62. package/dist/LinearSyntenyDisplay/drawSynteny.d.ts +5 -0
  63. package/dist/LinearSyntenyDisplay/drawSynteny.js +235 -0
  64. package/dist/LinearSyntenyDisplay/drawSynteny.js.map +1 -0
  65. package/dist/LinearSyntenyDisplay/index.d.ts +3 -0
  66. package/dist/LinearSyntenyDisplay/index.js +47 -0
  67. package/dist/LinearSyntenyDisplay/index.js.map +1 -0
  68. package/dist/LinearSyntenyDisplay/model.d.ts +333 -0
  69. package/dist/LinearSyntenyDisplay/model.js +179 -0
  70. package/dist/LinearSyntenyDisplay/model.js.map +1 -0
  71. package/dist/LinearSyntenyView/components/ExportSvgDialog.d.ts +8 -0
  72. package/dist/LinearSyntenyView/components/ExportSvgDialog.js +86 -0
  73. package/dist/LinearSyntenyView/components/ExportSvgDialog.js.map +1 -0
  74. package/dist/LinearSyntenyView/components/Icons.d.ts +4 -0
  75. package/dist/LinearSyntenyView/components/Icons.js +19 -0
  76. package/dist/LinearSyntenyView/components/Icons.js.map +1 -0
  77. package/dist/LinearSyntenyView/components/ImportCustomTrack.d.ts +11 -0
  78. package/dist/LinearSyntenyView/components/ImportCustomTrack.js +180 -0
  79. package/dist/LinearSyntenyView/components/ImportCustomTrack.js.map +1 -0
  80. package/dist/LinearSyntenyView/components/ImportForm.d.ts +6 -0
  81. package/dist/LinearSyntenyView/components/ImportForm.js +127 -0
  82. package/dist/LinearSyntenyView/components/ImportForm.js.map +1 -0
  83. package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.d.ts +9 -0
  84. package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.js +63 -0
  85. package/dist/LinearSyntenyView/components/ImportSyntenyTrackSelector.js.map +1 -0
  86. package/dist/LinearSyntenyView/components/LinearSyntenyView.d.ts +7 -0
  87. package/dist/LinearSyntenyView/components/LinearSyntenyView.js +38 -0
  88. package/dist/LinearSyntenyView/components/LinearSyntenyView.js.map +1 -0
  89. package/dist/LinearSyntenyView/index.d.ts +3 -0
  90. package/dist/LinearSyntenyView/index.js +42 -0
  91. package/dist/LinearSyntenyView/index.js.map +1 -0
  92. package/dist/LinearSyntenyView/model.d.ts +754 -0
  93. package/dist/LinearSyntenyView/model.js +170 -0
  94. package/dist/LinearSyntenyView/model.js.map +1 -0
  95. package/dist/LinearSyntenyView/svgcomponents/SVGBackground.d.ts +6 -0
  96. package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js +13 -0
  97. package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js.map +1 -0
  98. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +4 -0
  99. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +85 -0
  100. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js.map +1 -0
  101. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +5 -0
  102. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +66 -0
  103. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js.map +1 -0
  104. package/dist/SyntenyFeatureDetail/index.d.ts +3 -0
  105. package/dist/SyntenyFeatureDetail/index.js +58 -0
  106. package/dist/SyntenyFeatureDetail/index.js.map +1 -0
  107. package/dist/SyntenyTrack/configSchema.d.ts +75 -0
  108. package/dist/SyntenyTrack/configSchema.js +16 -0
  109. package/dist/SyntenyTrack/configSchema.js.map +1 -0
  110. package/dist/SyntenyTrack/index.d.ts +3 -0
  111. package/dist/SyntenyTrack/index.js +19 -0
  112. package/dist/SyntenyTrack/index.js.map +1 -0
  113. package/dist/index.d.ts +7 -0
  114. package/dist/index.js +47 -0
  115. package/dist/index.js.map +1 -0
  116. package/dist/util.d.ts +25 -0
  117. package/dist/util.js +77 -0
  118. package/dist/util.js.map +1 -0
  119. package/esm/LGVSyntenyDisplay/configSchemaF.d.ts +52 -0
  120. package/esm/LGVSyntenyDisplay/configSchemaF.js +16 -0
  121. package/esm/LGVSyntenyDisplay/configSchemaF.js.map +1 -0
  122. package/esm/LGVSyntenyDisplay/index.d.ts +3 -0
  123. package/esm/LGVSyntenyDisplay/index.js +19 -0
  124. package/esm/LGVSyntenyDisplay/index.js.map +1 -0
  125. package/esm/LGVSyntenyDisplay/model.d.ts +380 -0
  126. package/esm/LGVSyntenyDisplay/model.js +152 -0
  127. package/esm/LGVSyntenyDisplay/model.js.map +1 -0
  128. package/esm/LaunchLinearSyntenyView.d.ts +2 -0
  129. package/esm/LaunchLinearSyntenyView.js +55 -0
  130. package/esm/LaunchLinearSyntenyView.js.map +1 -0
  131. package/esm/LinearComparativeDisplay/configSchemaF.d.ts +5 -0
  132. package/esm/LinearComparativeDisplay/configSchemaF.js +16 -0
  133. package/esm/LinearComparativeDisplay/configSchemaF.js.map +1 -0
  134. package/esm/LinearComparativeDisplay/index.d.ts +3 -0
  135. package/esm/LinearComparativeDisplay/index.js +19 -0
  136. package/esm/LinearComparativeDisplay/index.js.map +1 -0
  137. package/esm/LinearComparativeDisplay/stateModelFactory.d.ts +275 -0
  138. package/esm/LinearComparativeDisplay/stateModelFactory.js +170 -0
  139. package/esm/LinearComparativeDisplay/stateModelFactory.js.map +1 -0
  140. package/esm/LinearComparativeView/components/Header.d.ts +7 -0
  141. package/esm/LinearComparativeView/components/Header.js +61 -0
  142. package/esm/LinearComparativeView/components/Header.js.map +1 -0
  143. package/esm/LinearComparativeView/components/LinearComparativeView.d.ts +8 -0
  144. package/esm/LinearComparativeView/components/LinearComparativeView.js +94 -0
  145. package/esm/LinearComparativeView/components/LinearComparativeView.js.map +1 -0
  146. package/esm/LinearComparativeView/components/Rubberband.d.ts +9 -0
  147. package/esm/LinearComparativeView/components/Rubberband.js +200 -0
  148. package/esm/LinearComparativeView/components/Rubberband.js.map +1 -0
  149. package/esm/LinearComparativeView/index.d.ts +3 -0
  150. package/esm/LinearComparativeView/index.js +14 -0
  151. package/esm/LinearComparativeView/index.js.map +1 -0
  152. package/esm/LinearComparativeView/model.d.ts +326 -0
  153. package/esm/LinearComparativeView/model.js +318 -0
  154. package/esm/LinearComparativeView/model.js.map +1 -0
  155. package/esm/LinearReadVsRef/LinearReadVsRef.d.ts +7 -0
  156. package/esm/LinearReadVsRef/LinearReadVsRef.js +258 -0
  157. package/esm/LinearReadVsRef/LinearReadVsRef.js.map +1 -0
  158. package/esm/LinearReadVsRef/index.d.ts +2 -0
  159. package/esm/LinearReadVsRef/index.js +49 -0
  160. package/esm/LinearReadVsRef/index.js.map +1 -0
  161. package/esm/LinearSyntenyDisplay/afterAttach.d.ts +2 -0
  162. package/esm/LinearSyntenyDisplay/afterAttach.js +104 -0
  163. package/esm/LinearSyntenyDisplay/afterAttach.js.map +1 -0
  164. package/esm/LinearSyntenyDisplay/components/Component.d.ts +6 -0
  165. package/esm/LinearSyntenyDisplay/components/Component.js +59 -0
  166. package/esm/LinearSyntenyDisplay/components/Component.js.map +1 -0
  167. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.d.ts +6 -0
  168. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +132 -0
  169. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js.map +1 -0
  170. package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.d.ts +7 -0
  171. package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js +58 -0
  172. package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js.map +1 -0
  173. package/esm/LinearSyntenyDisplay/components/util.d.ts +27 -0
  174. package/esm/LinearSyntenyDisplay/components/util.js +77 -0
  175. package/esm/LinearSyntenyDisplay/components/util.js.map +1 -0
  176. package/esm/LinearSyntenyDisplay/configSchemaF.d.ts +23 -0
  177. package/esm/LinearSyntenyDisplay/configSchemaF.js +31 -0
  178. package/esm/LinearSyntenyDisplay/configSchemaF.js.map +1 -0
  179. package/esm/LinearSyntenyDisplay/drawSynteny.d.ts +5 -0
  180. package/esm/LinearSyntenyDisplay/drawSynteny.js +229 -0
  181. package/esm/LinearSyntenyDisplay/drawSynteny.js.map +1 -0
  182. package/esm/LinearSyntenyDisplay/index.d.ts +3 -0
  183. package/esm/LinearSyntenyDisplay/index.js +19 -0
  184. package/esm/LinearSyntenyDisplay/index.js.map +1 -0
  185. package/esm/LinearSyntenyDisplay/model.d.ts +333 -0
  186. package/esm/LinearSyntenyDisplay/model.js +151 -0
  187. package/esm/LinearSyntenyDisplay/model.js.map +1 -0
  188. package/esm/LinearSyntenyView/components/ExportSvgDialog.d.ts +8 -0
  189. package/esm/LinearSyntenyView/components/ExportSvgDialog.js +60 -0
  190. package/esm/LinearSyntenyView/components/ExportSvgDialog.js.map +1 -0
  191. package/esm/LinearSyntenyView/components/Icons.d.ts +4 -0
  192. package/esm/LinearSyntenyView/components/Icons.js +11 -0
  193. package/esm/LinearSyntenyView/components/Icons.js.map +1 -0
  194. package/esm/LinearSyntenyView/components/ImportCustomTrack.d.ts +11 -0
  195. package/esm/LinearSyntenyView/components/ImportCustomTrack.js +152 -0
  196. package/esm/LinearSyntenyView/components/ImportCustomTrack.js.map +1 -0
  197. package/esm/LinearSyntenyView/components/ImportForm.d.ts +6 -0
  198. package/esm/LinearSyntenyView/components/ImportForm.js +99 -0
  199. package/esm/LinearSyntenyView/components/ImportForm.js.map +1 -0
  200. package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.d.ts +9 -0
  201. package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.js +38 -0
  202. package/esm/LinearSyntenyView/components/ImportSyntenyTrackSelector.js.map +1 -0
  203. package/esm/LinearSyntenyView/components/LinearSyntenyView.d.ts +7 -0
  204. package/esm/LinearSyntenyView/components/LinearSyntenyView.js +10 -0
  205. package/esm/LinearSyntenyView/components/LinearSyntenyView.js.map +1 -0
  206. package/esm/LinearSyntenyView/index.d.ts +3 -0
  207. package/esm/LinearSyntenyView/index.js +14 -0
  208. package/esm/LinearSyntenyView/index.js.map +1 -0
  209. package/esm/LinearSyntenyView/model.d.ts +754 -0
  210. package/esm/LinearSyntenyView/model.js +141 -0
  211. package/esm/LinearSyntenyView/model.js.map +1 -0
  212. package/esm/LinearSyntenyView/svgcomponents/SVGBackground.d.ts +6 -0
  213. package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js +7 -0
  214. package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js.map +1 -0
  215. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +4 -0
  216. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +78 -0
  217. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js.map +1 -0
  218. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +5 -0
  219. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +38 -0
  220. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js.map +1 -0
  221. package/esm/SyntenyFeatureDetail/index.d.ts +3 -0
  222. package/esm/SyntenyFeatureDetail/index.js +30 -0
  223. package/esm/SyntenyFeatureDetail/index.js.map +1 -0
  224. package/esm/SyntenyTrack/configSchema.d.ts +75 -0
  225. package/esm/SyntenyTrack/configSchema.js +14 -0
  226. package/esm/SyntenyTrack/configSchema.js.map +1 -0
  227. package/esm/SyntenyTrack/index.d.ts +3 -0
  228. package/esm/SyntenyTrack/index.js +14 -0
  229. package/esm/SyntenyTrack/index.js.map +1 -0
  230. package/esm/index.d.ts +7 -0
  231. package/esm/index.js +41 -0
  232. package/esm/index.js.map +1 -0
  233. package/esm/util.d.ts +25 -0
  234. package/esm/util.js +69 -0
  235. package/esm/util.js.map +1 -0
  236. package/package.json +67 -0
  237. package/src/LGVSyntenyDisplay/configSchemaF.ts +22 -0
  238. package/src/LGVSyntenyDisplay/index.ts +20 -0
  239. package/src/LGVSyntenyDisplay/model.ts +177 -0
  240. package/src/LaunchLinearSyntenyView.ts +86 -0
  241. package/src/LinearComparativeDisplay/configSchemaF.ts +22 -0
  242. package/src/LinearComparativeDisplay/index.ts +21 -0
  243. package/src/LinearComparativeDisplay/stateModelFactory.ts +212 -0
  244. package/src/LinearComparativeView/components/Header.tsx +103 -0
  245. package/src/LinearComparativeView/components/LinearComparativeView.tsx +152 -0
  246. package/src/LinearComparativeView/components/Rubberband.tsx +329 -0
  247. package/src/LinearComparativeView/index.ts +15 -0
  248. package/src/LinearComparativeView/model.ts +395 -0
  249. package/src/LinearReadVsRef/LinearReadVsRef.tsx +360 -0
  250. package/src/LinearReadVsRef/index.ts +58 -0
  251. package/src/LinearSyntenyDisplay/afterAttach.ts +149 -0
  252. package/src/LinearSyntenyDisplay/components/Component.tsx +75 -0
  253. package/src/LinearSyntenyDisplay/components/LinearSyntenyRendering.tsx +200 -0
  254. package/src/LinearSyntenyDisplay/components/SyntenyTooltip.tsx +82 -0
  255. package/src/LinearSyntenyDisplay/components/util.ts +142 -0
  256. package/src/LinearSyntenyDisplay/configSchemaF.ts +38 -0
  257. package/src/LinearSyntenyDisplay/drawSynteny.ts +266 -0
  258. package/src/LinearSyntenyDisplay/index.ts +21 -0
  259. package/src/LinearSyntenyDisplay/model.ts +187 -0
  260. package/src/LinearSyntenyView/components/ExportSvgDialog.tsx +148 -0
  261. package/src/LinearSyntenyView/components/Icons.tsx +24 -0
  262. package/src/LinearSyntenyView/components/ImportCustomTrack.tsx +262 -0
  263. package/src/LinearSyntenyView/components/ImportForm.tsx +221 -0
  264. package/src/LinearSyntenyView/components/ImportSyntenyTrackSelector.tsx +82 -0
  265. package/src/LinearSyntenyView/components/LinearSyntenyView.tsx +20 -0
  266. package/src/LinearSyntenyView/index.ts +15 -0
  267. package/src/LinearSyntenyView/model.test.ts +1605 -0
  268. package/src/LinearSyntenyView/model.ts +169 -0
  269. package/src/LinearSyntenyView/svgcomponents/SVGBackground.tsx +21 -0
  270. package/src/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.tsx +176 -0
  271. package/src/SyntenyFeatureDetail/SyntenyFeatureDetail.tsx +64 -0
  272. package/src/SyntenyFeatureDetail/index.ts +36 -0
  273. package/src/SyntenyTrack/configSchema.ts +23 -0
  274. package/src/SyntenyTrack/index.tsx +15 -0
  275. package/src/index.tsx +42 -0
  276. package/src/util.ts +124 -0
@@ -0,0 +1,395 @@
1
+ import { lazy } from 'react'
2
+ import {
3
+ addDisposer,
4
+ cast,
5
+ getParent,
6
+ getPath,
7
+ getRoot,
8
+ onAction,
9
+ resolveIdentifier,
10
+ types,
11
+ Instance,
12
+ SnapshotIn,
13
+ } from 'mobx-state-tree'
14
+ import { autorun, transaction } from 'mobx'
15
+
16
+ // jbrowse
17
+ import BaseViewModel from '@jbrowse/core/pluggableElementTypes/models/BaseViewModel'
18
+ import { MenuItem } from '@jbrowse/core/ui'
19
+ import { getSession, isSessionModelWithWidgets, avg } from '@jbrowse/core/util'
20
+ import PluginManager from '@jbrowse/core/PluginManager'
21
+ import { AnyConfigurationModel } from '@jbrowse/core/configuration'
22
+ import { ElementId } from '@jbrowse/core/util/types/mst'
23
+ import {
24
+ LinearGenomeViewModel,
25
+ LinearGenomeViewStateModel,
26
+ } from '@jbrowse/plugin-linear-genome-view'
27
+
28
+ // icons
29
+ import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
30
+ import FolderOpenIcon from '@mui/icons-material/FolderOpen'
31
+
32
+ // lazies
33
+ const ReturnToImportFormDialog = lazy(
34
+ () => import('@jbrowse/core/ui/ReturnToImportFormDialog'),
35
+ )
36
+
37
+ /**
38
+ * #stateModel LinearComparativeView
39
+ */
40
+ function stateModelFactory(pluginManager: PluginManager) {
41
+ return types
42
+ .compose(
43
+ 'LinearComparativeView',
44
+ BaseViewModel,
45
+ types.model({
46
+ /**
47
+ * #property
48
+ */
49
+ id: ElementId,
50
+ /**
51
+ * #property
52
+ */
53
+ type: types.literal('LinearComparativeView'),
54
+ /**
55
+ * #property
56
+ */
57
+ trackSelectorType: 'hierarchical',
58
+ /**
59
+ * #property
60
+ */
61
+ showIntraviewLinks: true,
62
+ /**
63
+ * #property
64
+ */
65
+ linkViews: false,
66
+ /**
67
+ * #property
68
+ */
69
+ interactToggled: false,
70
+ /**
71
+ * #property
72
+ */
73
+ middleComparativeHeight: 100,
74
+ /**
75
+ * #property
76
+ */
77
+ tracks: types.array(
78
+ pluginManager.pluggableMstType('track', 'stateModel'),
79
+ ),
80
+ /**
81
+ * #property
82
+ * currently this is limited to an array of two
83
+ */
84
+ views: types.array(
85
+ pluginManager.getViewType('LinearGenomeView')
86
+ .stateModel as LinearGenomeViewStateModel,
87
+ ),
88
+
89
+ /**
90
+ * #property
91
+ * this represents tracks specific to this view specifically used
92
+ * for read vs ref dotplots where this track would not really apply
93
+ * elsewhere
94
+ */
95
+ viewTrackConfigs: types.array(
96
+ pluginManager.pluggableConfigSchemaType('track'),
97
+ ),
98
+ }),
99
+ )
100
+ .volatile(() => ({
101
+ width: undefined as number | undefined,
102
+ }))
103
+ .views(self => ({
104
+ /**
105
+ * #getter
106
+ */
107
+ get highResolutionScaling() {
108
+ return 2
109
+ },
110
+ /**
111
+ * #getter
112
+ */
113
+ get initialized() {
114
+ return (
115
+ self.width !== undefined &&
116
+ self.views.length > 0 &&
117
+ self.views.every(view => view.initialized)
118
+ )
119
+ },
120
+
121
+ /**
122
+ * #getter
123
+ */
124
+ get refNames() {
125
+ return self.views.map(v => [
126
+ ...new Set(v.staticBlocks.map(m => m.refName)),
127
+ ])
128
+ },
129
+
130
+ /**
131
+ * #getter
132
+ */
133
+ get assemblyNames() {
134
+ return [...new Set(self.views.flatMap(v => v.assemblyNames))]
135
+ },
136
+ }))
137
+ .actions(self => ({
138
+ afterAttach() {
139
+ addDisposer(
140
+ self,
141
+ onAction(self, param => {
142
+ if (self.linkViews) {
143
+ const { name, path, args } = param
144
+
145
+ // doesn't link showTrack/hideTrack, doesn't make sense in
146
+ // synteny views most time
147
+ const actions = ['horizontalScroll', 'zoomTo', 'setScaleFactor']
148
+ if (actions.includes(name) && path) {
149
+ this.onSubviewAction(name, path, args)
150
+ }
151
+ }
152
+ }),
153
+ )
154
+ },
155
+
156
+ // automatically removes session assemblies associated with this view
157
+ // e.g. read vs ref
158
+ beforeDestroy() {
159
+ const session = getSession(self)
160
+ self.assemblyNames.forEach(asm => session.removeTemporaryAssembly(asm))
161
+ },
162
+
163
+ onSubviewAction(actionName: string, path: string, args?: unknown[]) {
164
+ self.views.forEach(view => {
165
+ const ret = getPath(view)
166
+ if (ret.lastIndexOf(path) !== ret.length - path.length) {
167
+ // @ts-expect-error
168
+ view[actionName](args?.[0])
169
+ }
170
+ })
171
+ },
172
+
173
+ /**
174
+ * #action
175
+ */
176
+ setWidth(newWidth: number) {
177
+ self.width = newWidth
178
+ },
179
+
180
+ /**
181
+ * #action
182
+ */
183
+ setViews(views: SnapshotIn<LinearGenomeViewModel>[]) {
184
+ self.views = cast(views)
185
+ },
186
+
187
+ /**
188
+ * #action
189
+ */
190
+ removeView(view: LinearGenomeViewModel) {
191
+ self.views.remove(view)
192
+ },
193
+
194
+ /**
195
+ * #action
196
+ * removes the view itself from the state tree entirely by calling the
197
+ * parent removeView
198
+ */
199
+ closeView() {
200
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
201
+ getParent<any>(self, 2).removeView(self)
202
+ },
203
+
204
+ /**
205
+ * #action
206
+ */
207
+ setMiddleComparativeHeight(n: number) {
208
+ self.middleComparativeHeight = n
209
+ return self.middleComparativeHeight
210
+ },
211
+
212
+ /**
213
+ * #action
214
+ */
215
+ toggleLinkViews() {
216
+ self.linkViews = !self.linkViews
217
+ },
218
+
219
+ /**
220
+ * #action
221
+ */
222
+ activateTrackSelector() {
223
+ if (self.trackSelectorType === 'hierarchical') {
224
+ const session = getSession(self)
225
+ if (isSessionModelWithWidgets(session)) {
226
+ const selector = session.addWidget(
227
+ 'HierarchicalTrackSelectorWidget',
228
+ 'hierarchicalTrackSelector',
229
+ { view: self },
230
+ )
231
+ session.showWidget(selector)
232
+ return selector
233
+ }
234
+ return undefined
235
+ }
236
+ throw new Error(`invalid track selector type ${self.trackSelectorType}`)
237
+ },
238
+
239
+ /**
240
+ * #action
241
+ */
242
+ toggleTrack(trackId: string) {
243
+ // if we have any tracks with that configuration, turn them off
244
+ const hiddenCount = this.hideTrack(trackId)
245
+
246
+ // if none had that configuration, turn one on
247
+ if (!hiddenCount) {
248
+ this.showTrack(trackId)
249
+ }
250
+ },
251
+
252
+ /**
253
+ * #action
254
+ */
255
+ showTrack(trackId: string, initialSnapshot = {}) {
256
+ const schema = pluginManager.pluggableConfigSchemaType('track')
257
+ const configuration = resolveIdentifier(schema, getRoot(self), trackId)
258
+ if (!configuration) {
259
+ throw new Error(`track not found ${trackId}`)
260
+ }
261
+ const trackType = pluginManager.getTrackType(configuration.type)
262
+ if (!trackType) {
263
+ throw new Error(`unknown track type ${configuration.type}`)
264
+ }
265
+ const viewType = pluginManager.getViewType(self.type)
266
+ const supportedDisplays = new Set(
267
+ viewType.displayTypes.map(d => d.name),
268
+ )
269
+ const displayConf = configuration.displays.find(
270
+ (d: AnyConfigurationModel) => supportedDisplays.has(d.type),
271
+ )
272
+ if (!displayConf) {
273
+ throw new Error(
274
+ `could not find a compatible display for view type ${self.type}`,
275
+ )
276
+ }
277
+ self.tracks.push(
278
+ trackType.stateModel.create({
279
+ ...initialSnapshot,
280
+ type: configuration.type,
281
+ configuration,
282
+ displays: [{ type: displayConf.type, configuration: displayConf }],
283
+ }),
284
+ )
285
+ },
286
+
287
+ /**
288
+ * #action
289
+ */
290
+ hideTrack(trackId: string) {
291
+ const schema = pluginManager.pluggableConfigSchemaType('track')
292
+ const config = resolveIdentifier(schema, getRoot(self), trackId)
293
+ const shownTracks = self.tracks.filter(t => t.configuration === config)
294
+ transaction(() => shownTracks.forEach(t => self.tracks.remove(t)))
295
+ return shownTracks.length
296
+ },
297
+ /**
298
+ * #action
299
+ */
300
+ squareView() {
301
+ const average = avg(self.views.map(v => v.bpPerPx))
302
+ self.views.forEach(view => {
303
+ const center = view.pxToBp(view.width / 2)
304
+ view.setNewView(average, view.offsetPx)
305
+ if (!center.refName) {
306
+ return
307
+ }
308
+ view.centerAt(center.coord, center.refName, center.index)
309
+ })
310
+ },
311
+ /**
312
+ * #action
313
+ */
314
+ clearView() {
315
+ self.views = cast([])
316
+ self.tracks = cast([])
317
+ },
318
+ }))
319
+ .views(() => ({
320
+ /**
321
+ * #method
322
+ * includes a subset of view menu options because the full list is a
323
+ * little overwhelming. overridden by subclasses
324
+ */
325
+ headerMenuItems(): MenuItem[] {
326
+ return []
327
+ },
328
+ }))
329
+ .views(self => ({
330
+ /**
331
+ * #method
332
+ */
333
+ menuItems(): MenuItem[] {
334
+ return [
335
+ ...self.views
336
+ .map((view, idx) => [idx, view.menuItems?.()] as const)
337
+ .filter(f => !!f[1])
338
+ .map(f => ({ label: `View ${f[0] + 1} Menu`, subMenu: f[1] })),
339
+ {
340
+ label: 'Return to import form',
341
+ onClick: () => {
342
+ getSession(self).queueDialog(handleClose => [
343
+ ReturnToImportFormDialog,
344
+ { model: self, handleClose },
345
+ ])
346
+ },
347
+ icon: FolderOpenIcon,
348
+ },
349
+ {
350
+ label: 'Open track selector',
351
+ onClick: self.activateTrackSelector,
352
+ icon: TrackSelectorIcon,
353
+ },
354
+ ]
355
+ },
356
+ /**
357
+ * #method
358
+ */
359
+ rubberBandMenuItems() {
360
+ return [
361
+ {
362
+ label: 'Zoom to region(s)',
363
+ onClick: () => {
364
+ self.views.forEach(view => {
365
+ const { leftOffset, rightOffset } = view
366
+ if (leftOffset && rightOffset) {
367
+ view.moveTo(leftOffset, rightOffset)
368
+ }
369
+ })
370
+ },
371
+ },
372
+ ]
373
+ },
374
+ }))
375
+ .actions(self => ({
376
+ afterAttach() {
377
+ addDisposer(
378
+ self,
379
+ autorun(() => {
380
+ if (self.width) {
381
+ self.views.forEach(v => v.setWidth(self.width))
382
+ }
383
+ }),
384
+ )
385
+ },
386
+ }))
387
+ }
388
+
389
+ export type LinearComparativeViewStateModel = ReturnType<
390
+ typeof stateModelFactory
391
+ >
392
+ export type LinearComparativeViewModel =
393
+ Instance<LinearComparativeViewStateModel>
394
+
395
+ export default stateModelFactory