@jbrowse/plugin-dotplot-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 (263) hide show
  1. package/LICENSE +201 -0
  2. package/dist/ComparativeRenderer/index.d.ts +27 -0
  3. package/dist/ComparativeRenderer/index.js +59 -0
  4. package/dist/ComparativeRenderer/index.js.map +1 -0
  5. package/dist/DotplotDisplay/components/DotplotDisplay.d.ts +8 -0
  6. package/dist/DotplotDisplay/components/DotplotDisplay.js +24 -0
  7. package/dist/DotplotDisplay/components/DotplotDisplay.js.map +1 -0
  8. package/dist/DotplotDisplay/index.d.ts +12 -0
  9. package/dist/DotplotDisplay/index.js +48 -0
  10. package/dist/DotplotDisplay/index.js.map +1 -0
  11. package/dist/DotplotDisplay/renderDotplotBlock.d.ts +11 -0
  12. package/dist/DotplotDisplay/renderDotplotBlock.js +57 -0
  13. package/dist/DotplotDisplay/renderDotplotBlock.js.map +1 -0
  14. package/dist/DotplotDisplay/stateModelFactory.d.ts +138 -0
  15. package/dist/DotplotDisplay/stateModelFactory.js +165 -0
  16. package/dist/DotplotDisplay/stateModelFactory.js.map +1 -0
  17. package/dist/DotplotReadVsRef/DotplotReadVsRef.d.ts +3 -0
  18. package/dist/DotplotReadVsRef/DotplotReadVsRef.js +102 -0
  19. package/dist/DotplotReadVsRef/DotplotReadVsRef.js.map +1 -0
  20. package/dist/DotplotReadVsRef/index.d.ts +2 -0
  21. package/dist/DotplotReadVsRef/index.js +42 -0
  22. package/dist/DotplotReadVsRef/index.js.map +1 -0
  23. package/dist/DotplotRenderer/ComparativeRenderRpc.d.ts +27 -0
  24. package/dist/DotplotRenderer/ComparativeRenderRpc.js +59 -0
  25. package/dist/DotplotRenderer/ComparativeRenderRpc.js.map +1 -0
  26. package/dist/DotplotRenderer/DotplotRenderer.d.ts +69 -0
  27. package/dist/DotplotRenderer/DotplotRenderer.js +274 -0
  28. package/dist/DotplotRenderer/DotplotRenderer.js.map +1 -0
  29. package/dist/DotplotRenderer/components/DotplotRendering.d.ts +5 -0
  30. package/dist/DotplotRenderer/components/DotplotRendering.js +13 -0
  31. package/dist/DotplotRenderer/components/DotplotRendering.js.map +1 -0
  32. package/dist/DotplotRenderer/configSchema.d.ts +61 -0
  33. package/dist/DotplotRenderer/configSchema.js +83 -0
  34. package/dist/DotplotRenderer/configSchema.js.map +1 -0
  35. package/dist/DotplotRenderer/index.d.ts +3 -0
  36. package/dist/DotplotRenderer/index.js +17 -0
  37. package/dist/DotplotRenderer/index.js.map +1 -0
  38. package/dist/DotplotView/1dview.d.ts +307 -0
  39. package/dist/DotplotView/1dview.js +95 -0
  40. package/dist/DotplotView/1dview.js.map +1 -0
  41. package/dist/DotplotView/blockTypes.d.ts +61 -0
  42. package/dist/DotplotView/blockTypes.js +117 -0
  43. package/dist/DotplotView/blockTypes.js.map +1 -0
  44. package/dist/DotplotView/components/Axes.d.ts +14 -0
  45. package/dist/DotplotView/components/Axes.js +127 -0
  46. package/dist/DotplotView/components/Axes.js.map +1 -0
  47. package/dist/DotplotView/components/CursorIcon.d.ts +4 -0
  48. package/dist/DotplotView/components/CursorIcon.js +19 -0
  49. package/dist/DotplotView/components/CursorIcon.js.map +1 -0
  50. package/dist/DotplotView/components/DotplotTooltip.d.ts +19 -0
  51. package/dist/DotplotView/components/DotplotTooltip.js +128 -0
  52. package/dist/DotplotView/components/DotplotTooltip.js.map +1 -0
  53. package/dist/DotplotView/components/DotplotView.d.ts +6 -0
  54. package/dist/DotplotView/components/DotplotView.js +272 -0
  55. package/dist/DotplotView/components/DotplotView.js.map +1 -0
  56. package/dist/DotplotView/components/DotplotWarnings.d.ts +6 -0
  57. package/dist/DotplotView/components/DotplotWarnings.js +40 -0
  58. package/dist/DotplotView/components/DotplotWarnings.js.map +1 -0
  59. package/dist/DotplotView/components/ExportSvgDialog.d.ts +8 -0
  60. package/dist/DotplotView/components/ExportSvgDialog.js +76 -0
  61. package/dist/DotplotView/components/ExportSvgDialog.js.map +1 -0
  62. package/dist/DotplotView/components/Grid.d.ts +10 -0
  63. package/dist/DotplotView/components/Grid.js +60 -0
  64. package/dist/DotplotView/components/Grid.js.map +1 -0
  65. package/dist/DotplotView/components/Header.d.ts +10 -0
  66. package/dist/DotplotView/components/Header.js +168 -0
  67. package/dist/DotplotView/components/Header.js.map +1 -0
  68. package/dist/DotplotView/components/ImportCustomTrack.d.ts +11 -0
  69. package/dist/DotplotView/components/ImportCustomTrack.js +180 -0
  70. package/dist/DotplotView/components/ImportCustomTrack.js.map +1 -0
  71. package/dist/DotplotView/components/ImportForm.d.ts +6 -0
  72. package/dist/DotplotView/components/ImportForm.js +121 -0
  73. package/dist/DotplotView/components/ImportForm.js.map +1 -0
  74. package/dist/DotplotView/components/ImportSyntenyTrackSelector.d.ts +9 -0
  75. package/dist/DotplotView/components/ImportSyntenyTrackSelector.js +69 -0
  76. package/dist/DotplotView/components/ImportSyntenyTrackSelector.js.map +1 -0
  77. package/dist/DotplotView/components/PanButtons.d.ts +6 -0
  78. package/dist/DotplotView/components/PanButtons.js +60 -0
  79. package/dist/DotplotView/components/PanButtons.js.map +1 -0
  80. package/dist/DotplotView/components/WarningDialog.d.ts +16 -0
  81. package/dist/DotplotView/components/WarningDialog.js +41 -0
  82. package/dist/DotplotView/components/WarningDialog.js.map +1 -0
  83. package/dist/DotplotView/components/util.d.ts +19 -0
  84. package/dist/DotplotView/components/util.js +90 -0
  85. package/dist/DotplotView/components/util.js.map +1 -0
  86. package/dist/DotplotView/index.d.ts +2 -0
  87. package/dist/DotplotView/index.js +44 -0
  88. package/dist/DotplotView/index.js.map +1 -0
  89. package/dist/DotplotView/model.d.ts +616 -0
  90. package/dist/DotplotView/model.js +647 -0
  91. package/dist/DotplotView/model.js.map +1 -0
  92. package/dist/DotplotView/svgcomponents/SVGBackground.d.ts +5 -0
  93. package/dist/DotplotView/svgcomponents/SVGBackground.js +13 -0
  94. package/dist/DotplotView/svgcomponents/SVGBackground.js.map +1 -0
  95. package/dist/DotplotView/svgcomponents/SVGDotplotView.d.ts +2 -0
  96. package/dist/DotplotView/svgcomponents/SVGDotplotView.js +47 -0
  97. package/dist/DotplotView/svgcomponents/SVGDotplotView.js.map +1 -0
  98. package/dist/LaunchDotplotView.d.ts +2 -0
  99. package/dist/LaunchDotplotView.js +45 -0
  100. package/dist/LaunchDotplotView.js.map +1 -0
  101. package/dist/ServerSideRenderedBlockContent.d.ts +12 -0
  102. package/dist/ServerSideRenderedBlockContent.js +87 -0
  103. package/dist/ServerSideRenderedBlockContent.js.map +1 -0
  104. package/dist/ServerSideSyntenyRendering.d.ts +23 -0
  105. package/dist/ServerSideSyntenyRendering.js +54 -0
  106. package/dist/ServerSideSyntenyRendering.js.map +1 -0
  107. package/dist/index.d.ts +7 -0
  108. package/dist/index.js +44 -0
  109. package/dist/index.js.map +1 -0
  110. package/dist/util.d.ts +9 -0
  111. package/dist/util.js +9 -0
  112. package/dist/util.js.map +1 -0
  113. package/esm/ComparativeRenderer/index.d.ts +27 -0
  114. package/esm/ComparativeRenderer/index.js +53 -0
  115. package/esm/ComparativeRenderer/index.js.map +1 -0
  116. package/esm/DotplotDisplay/components/DotplotDisplay.d.ts +8 -0
  117. package/esm/DotplotDisplay/components/DotplotDisplay.js +19 -0
  118. package/esm/DotplotDisplay/components/DotplotDisplay.js.map +1 -0
  119. package/esm/DotplotDisplay/index.d.ts +12 -0
  120. package/esm/DotplotDisplay/index.js +41 -0
  121. package/esm/DotplotDisplay/index.js.map +1 -0
  122. package/esm/DotplotDisplay/renderDotplotBlock.d.ts +11 -0
  123. package/esm/DotplotDisplay/renderDotplotBlock.js +49 -0
  124. package/esm/DotplotDisplay/renderDotplotBlock.js.map +1 -0
  125. package/esm/DotplotDisplay/stateModelFactory.d.ts +138 -0
  126. package/esm/DotplotDisplay/stateModelFactory.js +158 -0
  127. package/esm/DotplotDisplay/stateModelFactory.js.map +1 -0
  128. package/esm/DotplotReadVsRef/DotplotReadVsRef.d.ts +3 -0
  129. package/esm/DotplotReadVsRef/DotplotReadVsRef.js +98 -0
  130. package/esm/DotplotReadVsRef/DotplotReadVsRef.js.map +1 -0
  131. package/esm/DotplotReadVsRef/index.d.ts +2 -0
  132. package/esm/DotplotReadVsRef/index.js +36 -0
  133. package/esm/DotplotReadVsRef/index.js.map +1 -0
  134. package/esm/DotplotRenderer/ComparativeRenderRpc.d.ts +27 -0
  135. package/esm/DotplotRenderer/ComparativeRenderRpc.js +53 -0
  136. package/esm/DotplotRenderer/ComparativeRenderRpc.js.map +1 -0
  137. package/esm/DotplotRenderer/DotplotRenderer.d.ts +69 -0
  138. package/esm/DotplotRenderer/DotplotRenderer.js +268 -0
  139. package/esm/DotplotRenderer/DotplotRenderer.js.map +1 -0
  140. package/esm/DotplotRenderer/components/DotplotRendering.d.ts +5 -0
  141. package/esm/DotplotRenderer/components/DotplotRendering.js +8 -0
  142. package/esm/DotplotRenderer/components/DotplotRendering.js.map +1 -0
  143. package/esm/DotplotRenderer/configSchema.d.ts +61 -0
  144. package/esm/DotplotRenderer/configSchema.js +81 -0
  145. package/esm/DotplotRenderer/configSchema.js.map +1 -0
  146. package/esm/DotplotRenderer/index.d.ts +3 -0
  147. package/esm/DotplotRenderer/index.js +12 -0
  148. package/esm/DotplotRenderer/index.js.map +1 -0
  149. package/esm/DotplotView/1dview.d.ts +307 -0
  150. package/esm/DotplotView/1dview.js +87 -0
  151. package/esm/DotplotView/1dview.js.map +1 -0
  152. package/esm/DotplotView/blockTypes.d.ts +61 -0
  153. package/esm/DotplotView/blockTypes.js +109 -0
  154. package/esm/DotplotView/blockTypes.js.map +1 -0
  155. package/esm/DotplotView/components/Axes.d.ts +14 -0
  156. package/esm/DotplotView/components/Axes.js +121 -0
  157. package/esm/DotplotView/components/Axes.js.map +1 -0
  158. package/esm/DotplotView/components/CursorIcon.d.ts +4 -0
  159. package/esm/DotplotView/components/CursorIcon.js +11 -0
  160. package/esm/DotplotView/components/CursorIcon.js.map +1 -0
  161. package/esm/DotplotView/components/DotplotTooltip.d.ts +19 -0
  162. package/esm/DotplotView/components/DotplotTooltip.js +101 -0
  163. package/esm/DotplotView/components/DotplotTooltip.js.map +1 -0
  164. package/esm/DotplotView/components/DotplotView.d.ts +6 -0
  165. package/esm/DotplotView/components/DotplotView.js +244 -0
  166. package/esm/DotplotView/components/DotplotView.js.map +1 -0
  167. package/esm/DotplotView/components/DotplotWarnings.d.ts +6 -0
  168. package/esm/DotplotView/components/DotplotWarnings.js +15 -0
  169. package/esm/DotplotView/components/DotplotWarnings.js.map +1 -0
  170. package/esm/DotplotView/components/ExportSvgDialog.d.ts +8 -0
  171. package/esm/DotplotView/components/ExportSvgDialog.js +50 -0
  172. package/esm/DotplotView/components/ExportSvgDialog.js.map +1 -0
  173. package/esm/DotplotView/components/Grid.d.ts +10 -0
  174. package/esm/DotplotView/components/Grid.js +53 -0
  175. package/esm/DotplotView/components/Grid.js.map +1 -0
  176. package/esm/DotplotView/components/Header.d.ts +10 -0
  177. package/esm/DotplotView/components/Header.js +140 -0
  178. package/esm/DotplotView/components/Header.js.map +1 -0
  179. package/esm/DotplotView/components/ImportCustomTrack.d.ts +11 -0
  180. package/esm/DotplotView/components/ImportCustomTrack.js +152 -0
  181. package/esm/DotplotView/components/ImportCustomTrack.js.map +1 -0
  182. package/esm/DotplotView/components/ImportForm.d.ts +6 -0
  183. package/esm/DotplotView/components/ImportForm.js +93 -0
  184. package/esm/DotplotView/components/ImportForm.js.map +1 -0
  185. package/esm/DotplotView/components/ImportSyntenyTrackSelector.d.ts +9 -0
  186. package/esm/DotplotView/components/ImportSyntenyTrackSelector.js +44 -0
  187. package/esm/DotplotView/components/ImportSyntenyTrackSelector.js.map +1 -0
  188. package/esm/DotplotView/components/PanButtons.d.ts +6 -0
  189. package/esm/DotplotView/components/PanButtons.js +55 -0
  190. package/esm/DotplotView/components/PanButtons.js.map +1 -0
  191. package/esm/DotplotView/components/WarningDialog.d.ts +16 -0
  192. package/esm/DotplotView/components/WarningDialog.js +36 -0
  193. package/esm/DotplotView/components/WarningDialog.js.map +1 -0
  194. package/esm/DotplotView/components/util.d.ts +19 -0
  195. package/esm/DotplotView/components/util.js +83 -0
  196. package/esm/DotplotView/components/util.js.map +1 -0
  197. package/esm/DotplotView/index.d.ts +2 -0
  198. package/esm/DotplotView/index.js +15 -0
  199. package/esm/DotplotView/index.js.map +1 -0
  200. package/esm/DotplotView/model.d.ts +616 -0
  201. package/esm/DotplotView/model.js +616 -0
  202. package/esm/DotplotView/model.js.map +1 -0
  203. package/esm/DotplotView/svgcomponents/SVGBackground.d.ts +5 -0
  204. package/esm/DotplotView/svgcomponents/SVGBackground.js +7 -0
  205. package/esm/DotplotView/svgcomponents/SVGBackground.js.map +1 -0
  206. package/esm/DotplotView/svgcomponents/SVGDotplotView.d.ts +2 -0
  207. package/esm/DotplotView/svgcomponents/SVGDotplotView.js +40 -0
  208. package/esm/DotplotView/svgcomponents/SVGDotplotView.js.map +1 -0
  209. package/esm/LaunchDotplotView.d.ts +2 -0
  210. package/esm/LaunchDotplotView.js +42 -0
  211. package/esm/LaunchDotplotView.js.map +1 -0
  212. package/esm/ServerSideRenderedBlockContent.d.ts +12 -0
  213. package/esm/ServerSideRenderedBlockContent.js +62 -0
  214. package/esm/ServerSideRenderedBlockContent.js.map +1 -0
  215. package/esm/ServerSideSyntenyRendering.d.ts +23 -0
  216. package/esm/ServerSideSyntenyRendering.js +29 -0
  217. package/esm/ServerSideSyntenyRendering.js.map +1 -0
  218. package/esm/index.d.ts +7 -0
  219. package/esm/index.js +38 -0
  220. package/esm/index.js.map +1 -0
  221. package/esm/util.d.ts +9 -0
  222. package/esm/util.js +5 -0
  223. package/esm/util.js.map +1 -0
  224. package/package.json +69 -0
  225. package/src/ComparativeRenderer/index.ts +87 -0
  226. package/src/DotplotDisplay/components/DotplotDisplay.tsx +34 -0
  227. package/src/DotplotDisplay/index.ts +48 -0
  228. package/src/DotplotDisplay/renderDotplotBlock.ts +60 -0
  229. package/src/DotplotDisplay/stateModelFactory.tsx +196 -0
  230. package/src/DotplotReadVsRef/DotplotReadVsRef.ts +115 -0
  231. package/src/DotplotReadVsRef/index.ts +50 -0
  232. package/src/DotplotRenderer/ComparativeRenderRpc.ts +87 -0
  233. package/src/DotplotRenderer/DotplotRenderer.ts +328 -0
  234. package/src/DotplotRenderer/__image_snapshots__/linear-synteny-renderer-test-ts-test-rendering-a-simple-synteny-from-fake-data-1-snap.png +0 -0
  235. package/src/DotplotRenderer/components/DotplotRendering.tsx +12 -0
  236. package/src/DotplotRenderer/configSchema.ts +92 -0
  237. package/src/DotplotRenderer/index.ts +16 -0
  238. package/src/DotplotView/1dview.ts +98 -0
  239. package/src/DotplotView/blockTypes.ts +140 -0
  240. package/src/DotplotView/components/Axes.tsx +246 -0
  241. package/src/DotplotView/components/CursorIcon.tsx +24 -0
  242. package/src/DotplotView/components/DotplotTooltip.tsx +163 -0
  243. package/src/DotplotView/components/DotplotView.tsx +348 -0
  244. package/src/DotplotView/components/DotplotWarnings.tsx +26 -0
  245. package/src/DotplotView/components/ExportSvgDialog.tsx +129 -0
  246. package/src/DotplotView/components/Grid.tsx +112 -0
  247. package/src/DotplotView/components/Header.tsx +182 -0
  248. package/src/DotplotView/components/ImportCustomTrack.tsx +262 -0
  249. package/src/DotplotView/components/ImportForm.tsx +209 -0
  250. package/src/DotplotView/components/ImportSyntenyTrackSelector.tsx +90 -0
  251. package/src/DotplotView/components/PanButtons.tsx +93 -0
  252. package/src/DotplotView/components/WarningDialog.tsx +74 -0
  253. package/src/DotplotView/components/util.ts +118 -0
  254. package/src/DotplotView/index.ts +16 -0
  255. package/src/DotplotView/model.test.ts +17 -0
  256. package/src/DotplotView/model.ts +719 -0
  257. package/src/DotplotView/svgcomponents/SVGBackground.tsx +21 -0
  258. package/src/DotplotView/svgcomponents/SVGDotplotView.tsx +68 -0
  259. package/src/LaunchDotplotView.ts +63 -0
  260. package/src/ServerSideRenderedBlockContent.tsx +86 -0
  261. package/src/ServerSideSyntenyRendering.tsx +54 -0
  262. package/src/index.ts +41 -0
  263. package/src/util.ts +14 -0
@@ -0,0 +1,50 @@
1
+ import React, { useState } from 'react';
2
+ import { Button, Checkbox, CircularProgress, DialogActions, DialogContent, FormControlLabel, MenuItem, TextField, Typography, } from '@mui/material';
3
+ import { Dialog, ErrorMessage } from '@jbrowse/core/ui';
4
+ import { getSession, useLocalStorage } from '@jbrowse/core/util';
5
+ function LoadingMessage() {
6
+ return (React.createElement("div", null,
7
+ React.createElement(CircularProgress, { size: 20, style: { marginRight: 20 } }),
8
+ React.createElement(Typography, { display: "inline" }, "Creating SVG")));
9
+ }
10
+ function useSvgLocal(key, val) {
11
+ return useLocalStorage('svg-' + key, val);
12
+ }
13
+ export default function ExportSvgDlg({ model, handleClose, }) {
14
+ const session = getSession(model);
15
+ const offscreenCanvas = typeof OffscreenCanvas !== 'undefined';
16
+ const [rasterizeLayers, setRasterizeLayers] = useState(offscreenCanvas);
17
+ const [loading, setLoading] = useState(false);
18
+ const [error, setError] = useState();
19
+ const [filename, setFilename] = useSvgLocal('file', 'jbrowse.svg');
20
+ const [themeName, setThemeName] = useSvgLocal('theme', session.themeName || 'default');
21
+ return (React.createElement(Dialog, { open: true, onClose: handleClose, title: "Export SVG" },
22
+ React.createElement(DialogContent, null,
23
+ error ? (React.createElement(ErrorMessage, { error: error })) : loading ? (React.createElement(LoadingMessage, null)) : null,
24
+ React.createElement(TextField, { helperText: "filename", value: filename, onChange: event => setFilename(event.target.value) }),
25
+ React.createElement("br", null),
26
+ session.allThemes ? (React.createElement(TextField, { select: true, label: "Theme", value: themeName, onChange: event => setThemeName(event.target.value) }, Object.entries(session.allThemes()).map(([key, val]) => (React.createElement(MenuItem, { key: key, value: key },
27
+ // @ts-expect-error
28
+ val.name || '(Unknown name)'))))) : null,
29
+ offscreenCanvas ? (React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: rasterizeLayers, onChange: () => setRasterizeLayers(val => !val) }), label: "Rasterize canvas based tracks? File may be much larger if this is turned off" })) : (React.createElement(Typography, null, "Note: rasterizing layers not yet supported in this browser, so SVG size may be large"))),
30
+ React.createElement(DialogActions, null,
31
+ React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel"),
32
+ React.createElement(Button, { variant: "contained", color: "primary", type: "submit", onClick: async () => {
33
+ setLoading(true);
34
+ setError(undefined);
35
+ try {
36
+ await model.exportSvg({
37
+ rasterizeLayers,
38
+ filename,
39
+ themeName,
40
+ });
41
+ handleClose();
42
+ }
43
+ catch (e) {
44
+ console.error(e);
45
+ setError(e);
46
+ setLoading(false);
47
+ }
48
+ } }, "Submit"))));
49
+ }
50
+ //# sourceMappingURL=ExportSvgDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExportSvgDialog.js","sourceRoot":"","sources":["../../../src/DotplotView/components/ExportSvgDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,EACL,MAAM,EACN,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEvD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEhE,SAAS,cAAc;IACrB,OAAO,CACL;QACE,oBAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,GAAI;QAC1D,oBAAC,UAAU,IAAC,OAAO,EAAC,QAAQ,mBAA0B,CAClD,CACP,CAAA;AACH,CAAC;AAED,SAAS,WAAW,CAAI,GAAW,EAAE,GAAM;IACzC,OAAO,eAAe,CAAC,MAAM,GAAG,GAAG,EAAE,GAAG,CAAC,CAAA;AAC3C,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC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AK,CAAC,CAAA;qBAClB;gBACH,CAAC,aAGM,CACK,CACT,CACV,CAAA;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { DotplotViewModel } from '../model';
3
+ export declare const GridRaw: ({ model, children, }: {
4
+ model: DotplotViewModel;
5
+ children?: React.ReactNode;
6
+ }) => React.JSX.Element | null;
7
+ export default function Grid({ model, children, }: {
8
+ model: DotplotViewModel;
9
+ children?: React.ReactNode;
10
+ }): React.JSX.Element;
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { observer } from 'mobx-react';
3
+ import { useTheme } from '@mui/material';
4
+ export const GridRaw = observer(function ({ model, children, }) {
5
+ const { viewWidth, viewHeight, hview, vview } = model;
6
+ const hblocks = hview.dynamicBlocks.contentBlocks;
7
+ const vblocks = vview.dynamicBlocks.contentBlocks;
8
+ if (!hblocks.length || !vblocks.length) {
9
+ return null;
10
+ }
11
+ const htop = hview.displayedRegionsTotalPx - hview.offsetPx;
12
+ const vtop = vview.displayedRegionsTotalPx - vview.offsetPx;
13
+ const hbottom = hblocks[0].offsetPx - hview.offsetPx;
14
+ const vbottom = vblocks[0].offsetPx - vview.offsetPx;
15
+ const theme = useTheme();
16
+ const stroke = theme.palette.divider;
17
+ // Uses math.max/min avoid making very large SVG rect offscreen element,
18
+ // which can sometimes fail to draw
19
+ const rx = Math.max(hbottom, 0);
20
+ const ry = Math.max(viewHeight - vtop, 0);
21
+ const w = Math.min(htop - hbottom, viewWidth);
22
+ const h = Math.min(viewHeight - vbottom - ry, viewHeight);
23
+ let lastx = Infinity;
24
+ let lasty = Infinity;
25
+ return (React.createElement(React.Fragment, null,
26
+ React.createElement("rect", { x: rx, y: ry, width: w, height: h, fill: theme.palette.background.default }),
27
+ React.createElement("g", null,
28
+ hblocks.map(region => {
29
+ const x = region.offsetPx - hview.offsetPx;
30
+ const render = Math.floor(x) !== Math.floor(lastx);
31
+ if (render) {
32
+ lastx = x;
33
+ }
34
+ return render ? (React.createElement("line", { key: JSON.stringify(region), x1: x, y1: 0, x2: x, y2: viewHeight, stroke: stroke })) : null;
35
+ }),
36
+ vblocks.map(region => {
37
+ const y = viewHeight - (region.offsetPx - vview.offsetPx);
38
+ const render = Math.floor(y) !== Math.floor(lasty);
39
+ if (render) {
40
+ lasty = y;
41
+ }
42
+ return render ? (React.createElement("line", { key: JSON.stringify(region), x1: 0, y1: y, x2: viewWidth, y2: y, stroke: stroke })) : null;
43
+ }),
44
+ React.createElement("line", { x1: htop, y1: 0, x2: htop, y2: viewHeight, stroke: stroke }),
45
+ React.createElement("line", { x1: 0, y1: viewHeight - vtop, x2: viewWidth, y2: viewHeight - vtop, stroke: stroke })),
46
+ children));
47
+ });
48
+ export default function Grid({ model, children, }) {
49
+ const { viewWidth, viewHeight } = model;
50
+ return (React.createElement("svg", { width: viewWidth, height: viewHeight, style: { background: 'rgba(0,0,0,0.12)' } },
51
+ React.createElement(GridRaw, { model: model }, children)));
52
+ }
53
+ //# sourceMappingURL=Grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../../src/DotplotView/components/Grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAKxC,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,EACxC,KAAK,EACL,QAAQ,GAIT;IACC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK,CAAA;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,aAAa,CAAA;IACjD,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,aAAa,CAAA;IACjD,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACtC,OAAO,IAA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AE,EAAE,SAAS,EACb,EAAE,EAAE,UAAU,GAAG,IAAI,EACrB,MAAM,EAAE,MAAM,GACd,CACA;QACH,QAAQ,CACR,CACJ,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,KAAK,EACL,QAAQ,GAIT;IACC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,KAAK,CAAA;IACvC,OAAO,CACL,6BACE,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,EAAE,UAAU,EAAE,kBAAkB,EAAE;QAEzC,oBAAC,OAAO,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAAW,CACvC,CACP,CAAA;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { DotplotViewModel } from '../model';
3
+ declare const _default: ({ model, selection, }: {
4
+ model: DotplotViewModel;
5
+ selection?: {
6
+ width: number;
7
+ height: number;
8
+ } | undefined;
9
+ }) => React.JSX.Element;
10
+ export default _default;
@@ -0,0 +1,140 @@
1
+ import React, { useState } from 'react';
2
+ import { IconButton, Typography } from '@mui/material';
3
+ import { observer } from 'mobx-react';
4
+ import { makeStyles } from 'tss-react/mui';
5
+ import { getBpDisplayStr } from '@jbrowse/core/util';
6
+ import { Menu } from '@jbrowse/core/ui';
7
+ // icons
8
+ import ZoomOut from '@mui/icons-material/ZoomOut';
9
+ import ZoomIn from '@mui/icons-material/ZoomIn';
10
+ import MoreVert from '@mui/icons-material/MoreVert';
11
+ import { CursorMouse, CursorMove } from './CursorIcon';
12
+ import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons';
13
+ import DotplotWarnings from './DotplotWarnings';
14
+ import PanButtons from './PanButtons';
15
+ const useStyles = makeStyles()({
16
+ iconButton: {
17
+ margin: 5,
18
+ },
19
+ bp: {
20
+ display: 'flex',
21
+ alignItems: 'center',
22
+ marginLeft: 10,
23
+ },
24
+ spacer: {
25
+ flexGrow: 1,
26
+ },
27
+ headerBar: {
28
+ display: 'flex',
29
+ position: 'relative',
30
+ },
31
+ });
32
+ const DotplotControls = observer(({ model }) => {
33
+ const { classes } = useStyles();
34
+ const [menuAnchorEl, setMenuAnchorEl] = useState();
35
+ return (React.createElement("div", null,
36
+ React.createElement(IconButton, { onClick: model.zoomOutButton, className: classes.iconButton },
37
+ React.createElement(ZoomOut, null)),
38
+ React.createElement(IconButton, { onClick: model.zoomInButton, className: classes.iconButton },
39
+ React.createElement(ZoomIn, null)),
40
+ React.createElement(IconButton, { onClick: () => model.activateTrackSelector(), className: classes.iconButton, title: "Open track selector", "data-testid": "circular_track_select" },
41
+ React.createElement(TrackSelectorIcon, null)),
42
+ React.createElement(IconButton, { onClick: event => setMenuAnchorEl(event.currentTarget), className: classes.iconButton },
43
+ React.createElement(MoreVert, null)),
44
+ menuAnchorEl ? (React.createElement(Menu, { anchorEl: menuAnchorEl, open: true, onMenuItemClick: (_event, callback) => {
45
+ callback();
46
+ setMenuAnchorEl(undefined);
47
+ }, menuItems: [
48
+ {
49
+ onClick: () => model.squareView(),
50
+ label: 'Square view - same base pairs per pixel',
51
+ },
52
+ {
53
+ onClick: () => model.squareViewProportional(),
54
+ label: 'Rectanglularize view - same total bp',
55
+ },
56
+ {
57
+ onClick: () => model.showAllRegions(),
58
+ label: 'Show all regions',
59
+ },
60
+ {
61
+ onClick: () => model.setDrawCigar(!model.drawCigar),
62
+ type: 'checkbox',
63
+ label: 'Draw CIGAR',
64
+ checked: model.drawCigar,
65
+ },
66
+ {
67
+ onClick: () => model.setShowPanButtons(!model.showPanButtons),
68
+ label: 'Show pan buttons',
69
+ type: 'checkbox',
70
+ checked: model.showPanButtons,
71
+ },
72
+ {
73
+ label: 'Click and drag mode',
74
+ subMenu: [
75
+ {
76
+ onClick: () => model.setCursorMode('move'),
77
+ label: 'Pan by default, select region when ctrl key is held',
78
+ icon: CursorMove,
79
+ type: 'radio',
80
+ checked: model.cursorMode === 'move',
81
+ },
82
+ {
83
+ onClick: () => model.setCursorMode('crosshair'),
84
+ label: 'Select region by default, pan when ctrl key is held',
85
+ icon: CursorMouse,
86
+ type: 'radio',
87
+ checked: model.cursorMode === 'crosshair',
88
+ },
89
+ ],
90
+ },
91
+ {
92
+ label: 'Wheel scroll mode',
93
+ subMenu: [
94
+ {
95
+ onClick: () => model.setWheelMode('pan'),
96
+ label: 'Pans view',
97
+ type: 'radio',
98
+ checked: model.wheelMode === 'pan',
99
+ },
100
+ {
101
+ onClick: () => model.setWheelMode('zoom'),
102
+ label: 'Zooms view',
103
+ type: 'radio',
104
+ checked: model.wheelMode === 'zoom',
105
+ },
106
+ {
107
+ onClick: () => model.setWheelMode('none'),
108
+ label: 'Disable',
109
+ type: 'radio',
110
+ checked: model.wheelMode === 'none',
111
+ },
112
+ ],
113
+ },
114
+ ], onClose: () => setMenuAnchorEl(undefined) })) : null));
115
+ });
116
+ export default observer(function Header({ model, selection, }) {
117
+ const { classes } = useStyles();
118
+ const { hview, vview, showPanButtons } = model;
119
+ return (React.createElement("div", { className: classes.headerBar },
120
+ React.createElement(DotplotControls, { model: model }),
121
+ React.createElement(Typography, { className: classes.bp, variant: "body2", color: "textSecondary" },
122
+ "x: ",
123
+ hview.assemblyNames.join(','),
124
+ " ",
125
+ getBpDisplayStr(hview.currBp),
126
+ React.createElement("br", null),
127
+ "y: ",
128
+ vview.assemblyNames.join(','),
129
+ " ",
130
+ getBpDisplayStr(vview.currBp)),
131
+ selection ? (React.createElement(Typography, { className: classes.bp, variant: "body2", color: "textSecondary" },
132
+ `width:${getBpDisplayStr(hview.bpPerPx * selection.width)}`,
133
+ " ",
134
+ React.createElement("br", null),
135
+ `height:${getBpDisplayStr(vview.bpPerPx * selection.height)}`)) : null,
136
+ React.createElement("div", { className: classes.spacer }),
137
+ React.createElement(DotplotWarnings, { model: model }),
138
+ showPanButtons ? React.createElement(PanButtons, { model: model }) : null));
139
+ });
140
+ //# sourceMappingURL=Header.js.map
@@ -0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KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,EAAE,CACnD,CACd,CAAC,CAAC,CAAC,IAAI;QACR,6BAAK,SAAS,EAAE,OAAO,CAAC,MAAM,GAAI;QAClC,oBAAC,eAAe,IAAC,KAAK,EAAE,KAAK,GAAI;QAChC,cAAc,CAAC,CAAC,CAAC,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,CACjD,CACP,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { SnapshotIn } from 'mobx-state-tree';
3
+ import { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
+ type Conf = SnapshotIn<AnyConfigurationModel>;
5
+ declare const OpenTrack: ({ sessionTrackData, assembly1, assembly2, setSessionTrackData, }: {
6
+ sessionTrackData: Conf;
7
+ assembly1: string;
8
+ assembly2: string;
9
+ setSessionTrackData: (arg: Conf) => void;
10
+ }) => React.JSX.Element;
11
+ export default OpenTrack;
@@ -0,0 +1,152 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import path from 'path';
3
+ import { FormControlLabel, Grid, Paper, Radio, RadioGroup, Typography, } from '@mui/material';
4
+ import { ErrorMessage, FileSelector } from '@jbrowse/core/ui';
5
+ import { observer } from 'mobx-react';
6
+ function getName(sessionTrackData) {
7
+ return sessionTrackData
8
+ ? // @ts-expect-error
9
+ sessionTrackData.uri ||
10
+ // @ts-expect-error
11
+ sessionTrackData.localPath ||
12
+ // @ts-expect-error
13
+ sessionTrackData.name
14
+ : undefined;
15
+ }
16
+ function stripGz(fileName) {
17
+ return fileName.endsWith('.gz') ? fileName.slice(0, -3) : fileName;
18
+ }
19
+ function getAdapter({ radioOption, assembly1, assembly2, fileLocation, bed1Location, bed2Location, }) {
20
+ if (radioOption === '.paf') {
21
+ return {
22
+ type: 'PAFAdapter',
23
+ pafLocation: fileLocation,
24
+ queryAssembly: assembly1,
25
+ targetAssembly: assembly2,
26
+ };
27
+ }
28
+ else if (radioOption === '.out') {
29
+ return {
30
+ type: 'MashMapAdapter',
31
+ outLocation: fileLocation,
32
+ queryAssembly: assembly1,
33
+ targetAssembly: assembly2,
34
+ };
35
+ }
36
+ else if (radioOption === '.delta') {
37
+ return {
38
+ type: 'DeltaAdapter',
39
+ deltaLocation: fileLocation,
40
+ queryAssembly: assembly1,
41
+ targetAssembly: assembly2,
42
+ };
43
+ }
44
+ else if (radioOption === '.chain') {
45
+ return {
46
+ type: 'ChainAdapter',
47
+ chainLocation: fileLocation,
48
+ queryAssembly: assembly1,
49
+ targetAssembly: assembly2,
50
+ };
51
+ }
52
+ else if (radioOption === '.anchors') {
53
+ return {
54
+ type: 'MCScanAnchorsAdapter',
55
+ mcscanAnchorsLocation: fileLocation,
56
+ bed1Location,
57
+ bed2Location,
58
+ assemblyNames: [assembly1, assembly2],
59
+ };
60
+ }
61
+ else if (radioOption === '.anchors.simple') {
62
+ return {
63
+ type: 'MCScanSimpleAnchorsAdapter',
64
+ mcscanSimpleAnchorsLocation: fileLocation,
65
+ bed1Location,
66
+ bed2Location,
67
+ assemblyNames: [assembly1, assembly2],
68
+ };
69
+ }
70
+ else {
71
+ throw new Error('Unknown type');
72
+ }
73
+ }
74
+ const OpenTrack = observer(({ sessionTrackData, assembly1, assembly2, setSessionTrackData, }) => {
75
+ const [bed2Location, setBed2Location] = useState();
76
+ const [bed1Location, setBed1Location] = useState();
77
+ const [fileLocation, setFileLocation] = useState();
78
+ const [value, setValue] = useState('');
79
+ const [error, setError] = useState();
80
+ const fileName = getName(fileLocation);
81
+ const radioOption = value || (fileName ? path.extname(stripGz(fileName)) : '');
82
+ useEffect(() => {
83
+ try {
84
+ if (fileLocation) {
85
+ const fn = fileName ? path.basename(fileName) : 'MyTrack';
86
+ const trackId = `${fn}-${Date.now()}`;
87
+ setError(undefined);
88
+ setSessionTrackData({
89
+ trackId,
90
+ name: fn,
91
+ assemblyNames: [assembly2, assembly1],
92
+ type: 'SyntenyTrack',
93
+ adapter: getAdapter({
94
+ radioOption,
95
+ assembly1,
96
+ assembly2,
97
+ fileLocation,
98
+ bed1Location,
99
+ bed2Location,
100
+ }),
101
+ });
102
+ }
103
+ }
104
+ catch (e) {
105
+ console.error(e);
106
+ setError(e);
107
+ }
108
+ }, [
109
+ fileName,
110
+ assembly1,
111
+ assembly2,
112
+ bed1Location,
113
+ bed2Location,
114
+ fileLocation,
115
+ radioOption,
116
+ setSessionTrackData,
117
+ ]);
118
+ return (React.createElement(Paper, { style: { padding: 12 } },
119
+ error ? React.createElement(ErrorMessage, { error: error }) : null,
120
+ React.createElement(Typography, { style: { textAlign: 'center' } }, "Add a .paf, .out (MashMap), .delta (Mummer), .chain, .anchors or .anchors.simple (MCScan) file to view in the dotplot. These file types can also be gzipped. The first assembly should be the query sequence (e.g. left column of the PAF) and the second assembly should be the target sequence (e.g. right column of the PAF)"),
121
+ React.createElement(RadioGroup, { value: radioOption, onChange: event => setValue(event.target.value) },
122
+ React.createElement(Grid, { container: true, justifyContent: "center" },
123
+ React.createElement(Grid, { item: true },
124
+ React.createElement(FormControlLabel, { value: ".paf", control: React.createElement(Radio, null), label: ".paf" })),
125
+ React.createElement(Grid, { item: true },
126
+ React.createElement(FormControlLabel, { value: ".out", control: React.createElement(Radio, null), label: ".out" })),
127
+ React.createElement(Grid, { item: true },
128
+ React.createElement(FormControlLabel, { value: ".delta", control: React.createElement(Radio, null), label: ".delta" })),
129
+ React.createElement(Grid, { item: true },
130
+ React.createElement(FormControlLabel, { value: ".chain", control: React.createElement(Radio, null), label: ".chain" })),
131
+ React.createElement(Grid, { item: true },
132
+ React.createElement(FormControlLabel, { value: ".anchors", control: React.createElement(Radio, null), label: ".anchors" })),
133
+ React.createElement(Grid, { item: true },
134
+ React.createElement(FormControlLabel, { value: ".anchors.simple", control: React.createElement(Radio, null), label: ".anchors.simple" })))),
135
+ React.createElement(Grid, { container: true, justifyContent: "center" },
136
+ React.createElement(Grid, { item: true }, value === '.anchors' || value === '.anchors.simple' ? (React.createElement("div", null,
137
+ React.createElement("div", { style: { margin: 20 } },
138
+ "Open the ",
139
+ value,
140
+ " and .bed files for both genome assemblies from the MCScan (Python version) pipeline",
141
+ ' ',
142
+ React.createElement("a", { href: "https://github.com/tanghaibao/jcvi/wiki/MCscan-(Python-version)" }, "(more info)")),
143
+ React.createElement("div", { style: { display: 'flex' } },
144
+ React.createElement("div", null,
145
+ React.createElement(FileSelector, { name: ".anchors file", description: "", location: fileLocation, setLocation: loc => setFileLocation(loc) })),
146
+ React.createElement("div", null,
147
+ React.createElement(FileSelector, { name: "genome 1 .bed (left column of anchors file)", description: "", location: bed1Location, setLocation: loc => setBed1Location(loc) })),
148
+ React.createElement("div", null,
149
+ React.createElement(FileSelector, { name: "genome 2 .bed (right column of anchors file)", description: "", location: bed2Location, setLocation: loc => setBed2Location(loc) }))))) : (React.createElement(FileSelector, { name: value ? value + ' location' : '', description: "", location: fileLocation, setLocation: loc => setFileLocation(loc) }))))));
150
+ });
151
+ export default OpenTrack;
152
+ //# sourceMappingURL=ImportCustomTrack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImportCustomTrack.js","sourceRoot":"","sources":["../../../src/DotplotView/components/ImportCustomTrack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAElD,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,gBAAgB,EAChB,IAAI,EACJ,KAAK,EACL,KAAK,EACL,UAAU,EACV,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGrC,SAAS,OAAO,CACd,gBAA6E;IAE7E,OAAO,gBAAgB;QACrB,CAAC,CAAC,mBAAmB;YACnB,gBAAgB,CAAC,GAAG;gBAClB,mBAAmB;g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AAI,EAAC,6CAA6C,EAClD,WAAW,EAAC,EAAE,EACd,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,GACxC,CACE;oBACN;wBACE,oBAAC,YAAY,IACX,IAAI,EAAC,8CAA8C,EACnD,WAAW,EAAC,EAAE,EACd,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,GACxC,CACE,CACF,CACF,CACP,CAAC,CAAC,CAAC,CACF,oBAAC,YAAY,IACX,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EACtC,WAAW,EAAC,EAAE,EACd,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,GACxC,CACH,CACI,CACF,CACD,CACT,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,SAAS,CAAA"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { DotplotViewModel } from '../model';
3
+ declare const DotplotImportForm: ({ model }: {
4
+ model: DotplotViewModel;
5
+ }) => React.JSX.Element;
6
+ export default DotplotImportForm;
@@ -0,0 +1,93 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { Button, Container, FormControl, FormLabel, FormControlLabel, Grid, Paper, Radio, RadioGroup, Typography, } from '@mui/material';
3
+ import { makeStyles } from 'tss-react/mui';
4
+ import { observer } from 'mobx-react';
5
+ import { transaction } from 'mobx';
6
+ import { getSession, isSessionWithAddTracks } from '@jbrowse/core/util';
7
+ import { ErrorMessage, AssemblySelector } from '@jbrowse/core/ui';
8
+ import ImportCustomTrack from './ImportCustomTrack';
9
+ import ImportSyntenyTrackSelector from './ImportSyntenyTrackSelector';
10
+ const useStyles = makeStyles()(theme => ({
11
+ importFormContainer: {
12
+ padding: theme.spacing(4),
13
+ margin: '0 auto',
14
+ },
15
+ assemblySelector: {
16
+ width: '75%',
17
+ margin: '0 auto',
18
+ },
19
+ }));
20
+ function TrackSelector({ setSessionTrackData, setShowTrackId, sessionTrackData, assembly1, assembly2, model, }) {
21
+ const [choice, setChoice] = useState('none');
22
+ useEffect(() => {
23
+ if (choice === 'none') {
24
+ setSessionTrackData(undefined);
25
+ setShowTrackId(undefined);
26
+ }
27
+ }, [choice, setSessionTrackData, setShowTrackId]);
28
+ return (React.createElement(React.Fragment, null,
29
+ React.createElement(FormControl, null,
30
+ React.createElement(FormLabel, { id: "group-label" }, "(Optional) Select or add a synteny track"),
31
+ React.createElement(RadioGroup, { row: true, value: choice, onChange: event => setChoice(event.target.value), "aria-labelledby": "group-label" },
32
+ React.createElement(FormControlLabel, { value: "none", control: React.createElement(Radio, null), label: "None" }),
33
+ React.createElement(FormControlLabel, { value: "tracklist", control: React.createElement(Radio, null), label: "Existing track" }),
34
+ React.createElement(FormControlLabel, { value: "custom", control: React.createElement(Radio, null), label: "New track" }))),
35
+ choice === 'custom' ? (React.createElement(ImportCustomTrack, { setSessionTrackData: setSessionTrackData, sessionTrackData: sessionTrackData, assembly2: assembly2, assembly1: assembly1 })) : null,
36
+ choice === 'tracklist' ? (React.createElement(ImportSyntenyTrackSelector, { model: model, assembly1: assembly1, assembly2: assembly2, setShowTrackId: setShowTrackId })) : null));
37
+ }
38
+ const DotplotImportForm = observer(({ model }) => {
39
+ const { classes } = useStyles();
40
+ const session = getSession(model);
41
+ const { assemblyNames } = session;
42
+ const [assembly2, setAssembly2] = useState(assemblyNames[0] || '');
43
+ const [assembly1, setAssembly1] = useState(assemblyNames[0] || '');
44
+ const [error, setError] = useState();
45
+ const [sessionTrackData, setSessionTrackData] = useState();
46
+ const [showTrackId, setShowTrackId] = useState();
47
+ function onOpenClick() {
48
+ try {
49
+ if (!isSessionWithAddTracks(session)) {
50
+ return;
51
+ }
52
+ setError(undefined);
53
+ model.setError(undefined);
54
+ transaction(() => {
55
+ if (sessionTrackData) {
56
+ session.addTrackConf(sessionTrackData);
57
+ model.toggleTrack(sessionTrackData.trackId);
58
+ }
59
+ else if (showTrackId) {
60
+ model.showTrack(showTrackId);
61
+ }
62
+ model.setViews([
63
+ { bpPerPx: 0.1, offsetPx: 0 },
64
+ { bpPerPx: 0.1, offsetPx: 0 },
65
+ ]);
66
+ model.setAssemblyNames(assembly2, assembly1);
67
+ });
68
+ }
69
+ catch (e) {
70
+ console.error(e);
71
+ setError(e);
72
+ }
73
+ }
74
+ // this is a combination of any displayed error message we have
75
+ const displayError = error || model.error;
76
+ return (React.createElement(Container, { className: classes.importFormContainer },
77
+ displayError ? React.createElement(ErrorMessage, { error: displayError }) : null,
78
+ React.createElement(Grid, { container: true, spacing: 1, justifyContent: "center", alignItems: "center", className: classes.assemblySelector },
79
+ React.createElement(Grid, { item: true },
80
+ React.createElement(Paper, { style: { padding: 12 } },
81
+ React.createElement(Typography, { style: { textAlign: 'center' } }, "Select assemblies for dotplot view"),
82
+ React.createElement(Grid, { container: true, spacing: 1, justifyContent: "center", alignItems: "center" },
83
+ React.createElement(Grid, { item: true },
84
+ React.createElement(AssemblySelector, { selected: assembly1, onChange: val => setAssembly1(val), session: session })),
85
+ React.createElement(Grid, { item: true },
86
+ React.createElement(AssemblySelector, { selected: assembly2, onChange: val => setAssembly2(val), session: session })),
87
+ React.createElement(Grid, { item: true },
88
+ React.createElement(FormControl, null,
89
+ React.createElement(Button, { onClick: onOpenClick, variant: "contained", color: "primary" }, "Launch"))))),
90
+ React.createElement(TrackSelector, { setShowTrackId: setShowTrackId, assembly2: assembly2, assembly1: assembly1, setSessionTrackData: setSessionTrackData, sessionTrackData: sessionTrackData, model: model })))));
91
+ });
92
+ export default DotplotImportForm;
93
+ //# sourceMappingURL=ImportForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImportForm.js","sourceRoot":"","sources":["../../../src/DotplotView/components/ImportForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA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AGR,CACG,CACT,CACF,CACD;gBACR,oBAAC,aAAa,IACZ,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,mBAAmB,EACxC,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,KAAK,GACZ,CACG,CACF,CACG,CACb,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,iBAAiB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { DotplotViewModel } from '../model';
3
+ declare const Selector: ({ model, assembly1, assembly2, setShowTrackId, }: {
4
+ model: DotplotViewModel;
5
+ assembly1: string;
6
+ assembly2: string;
7
+ setShowTrackId: (arg: string) => void;
8
+ }) => React.JSX.Element;
9
+ export default Selector;