@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,40 @@
1
+ import React from 'react';
2
+ import { renderToStaticMarkup } from 'react-dom/server';
3
+ import { when } from 'mobx';
4
+ import { getSession } from '@jbrowse/core/util';
5
+ import { ThemeProvider } from '@mui/material';
6
+ import { createJBrowseTheme } from '@jbrowse/core/ui';
7
+ import { GridRaw } from '../components/Grid';
8
+ import { HorizontalAxisRaw, VerticalAxisRaw } from '../components/Axes';
9
+ import SVGBackground from './SVGBackground';
10
+ // render LGV to SVG
11
+ export async function renderToSvg(model, opts) {
12
+ var _a;
13
+ await when(() => model.initialized);
14
+ const { themeName = 'default', Wrapper = ({ children }) => React.createElement(React.Fragment, null, children) } = opts;
15
+ const session = getSession(model);
16
+ const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
17
+ const { width, borderX, viewWidth, viewHeight, tracks, height } = model;
18
+ const shift = 50;
19
+ const displayResults = await Promise.all(tracks.map(async (track) => {
20
+ const display = track.displays[0];
21
+ await when(() => (display.ready !== undefined ? display.ready : true));
22
+ return { track, result: await display.renderSvg({ ...opts, theme }) };
23
+ }));
24
+ const w = width + shift * 2;
25
+ // the xlink namespace is used for rendering <image> tag
26
+ return renderToStaticMarkup(React.createElement(ThemeProvider, { theme: createJBrowseTheme(theme) },
27
+ React.createElement(Wrapper, null,
28
+ React.createElement("svg", { width: width, height: height, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, w, height].toString() },
29
+ React.createElement(SVGBackground, { width: w, height: height }),
30
+ React.createElement(VerticalAxisRaw, { model: model }),
31
+ React.createElement("g", { transform: `translate(${borderX} 0)` },
32
+ React.createElement(GridRaw, { model: model }),
33
+ React.createElement("defs", null,
34
+ React.createElement("clipPath", { id: "clip-ruler" },
35
+ React.createElement("rect", { x: 0, y: 0, width: viewWidth, height: viewHeight }))),
36
+ React.createElement("g", { clipPath: "url(#clip-ruler)" }, displayResults.map(({ result }, i) => (React.createElement("g", { key: i }, result))))),
37
+ React.createElement("g", { transform: `translate(${borderX} ${viewHeight})` },
38
+ React.createElement(HorizontalAxisRaw, { model: model }))))));
39
+ }
40
+ //# sourceMappingURL=SVGDotplotView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SVGDotplotView.js","sourceRoot":"","sources":["../../../src/DotplotView/svgcomponents/SVGDotplotView.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ import PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function LaunchDotplotView(pluginManager: PluginManager): void;
@@ -0,0 +1,42 @@
1
+ import { transaction } from 'mobx';
2
+ export default function LaunchDotplotView(pluginManager) {
3
+ pluginManager.addToExtensionPoint('LaunchView-DotplotView',
4
+ // @ts-expect-error
5
+ async ({ session, views, tracks = [], }) => {
6
+ try {
7
+ const model = session.addView('DotplotView', {});
8
+ const assemblyNames = views.map(view => view.assembly);
9
+ transaction(() => {
10
+ model.setViews([
11
+ { bpPerPx: 0.1, offsetPx: 0 },
12
+ { bpPerPx: 0.1, offsetPx: 0 },
13
+ ]);
14
+ model.setAssemblyNames(assemblyNames[0], assemblyNames[1]);
15
+ });
16
+ // http://localhost:3000/?config=test_data%2Fvolvox%2Fconfig.json&session=spec-{"views":[{"type":"DotplotView","views":[{"assembly":"volvox"},{"assembly":"volvox"}],"tracks":["volvox_fake_synteny"]}]}
17
+ const idsNotFound = [];
18
+ tracks.forEach(track => tryTrack(model, track, idsNotFound));
19
+ if (idsNotFound.length) {
20
+ throw new Error(`Could not resolve identifiers: ${idsNotFound.join(',')}`);
21
+ }
22
+ }
23
+ catch (e) {
24
+ session.notify(`${e}`, 'error');
25
+ throw e;
26
+ }
27
+ });
28
+ }
29
+ function tryTrack(model, trackId, idsNotFound) {
30
+ try {
31
+ model.showTrack(trackId);
32
+ }
33
+ catch (e) {
34
+ if (`${e}`.match('Could not resolve identifier')) {
35
+ idsNotFound.push(trackId);
36
+ }
37
+ else {
38
+ throw e;
39
+ }
40
+ }
41
+ }
42
+ //# sourceMappingURL=LaunchDotplotView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LaunchDotplotView.js","sourceRoot":"","sources":["../src/LaunchDotplotView.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAElC,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,aAA4B;IACpE,aAAa,CAAC,mBAAmB,CAC/B,wBAAwB;IACxB,mBAAmB;IACnB,KAAK,EAAE,EACL,OAAO,EACP,KAAK,EACL,MAAM,GAAG,EAAE,GAKZ,EAAE,EAAE;QACH,IAAI;YACF,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAqB,CAAA;YACpE,MAAM,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAEtD,WAAW,CAAC,GAAG,EAAE;gBACf,KAAK,CAAC,QAAQ,CAAC;oBACb,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE;oBAC7B,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE;iBAC9B,CAAC,CAAA;gBACF,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;YAC5D,CAAC,CAAC,CAAA;YAEF,wMAAwM;YAExM,MAAM,WAAW,GAAG,EAAc,CAAA;YAClC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAA;YAE5D,IAAI,WAAW,CAAC,MAAM,EAAE;gBACtB,MAAM,IAAI,KAAK,CACb,kCAAkC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC1D,CAAA;aACF;SACF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;YAC/B,MAAM,CAAC,CAAA;SACR;IACH,CAAC,CACF,CAAA;AACH,CAAC;AAED,SAAS,QAAQ,CACf,KAA2C,EAC3C,OAAe,EACf,WAAqB;IAErB,IAAI;QACF,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;KACzB;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;YAChD,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;SAC1B;aAAM;YACL,MAAM,CAAC,CAAA;SACR;KACF;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import React, { CSSProperties } from 'react';
2
+ declare const _default: ({ model, style, }: {
3
+ model: {
4
+ error?: unknown;
5
+ message?: string;
6
+ filled?: boolean;
7
+ shouldDisplay?: boolean;
8
+ reactElement?: React.ReactElement;
9
+ };
10
+ style: CSSProperties;
11
+ }) => React.JSX.Element | null;
12
+ export default _default;
@@ -0,0 +1,62 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { makeStyles } from 'tss-react/mui';
3
+ import { Typography } from '@mui/material';
4
+ import { LoadingEllipses } from '@jbrowse/core/ui';
5
+ import { observer } from 'mobx-react';
6
+ const useStyles = makeStyles()(theme => {
7
+ const bg = theme.palette.action.disabledBackground;
8
+ return {
9
+ loading: {
10
+ paddingLeft: '0.6em',
11
+ backgroundColor: theme.palette.background.default,
12
+ backgroundImage: `repeating-linear-gradient(45deg, transparent, transparent 5px, ${bg} 5px, ${bg} 10px)`,
13
+ textAlign: 'center',
14
+ },
15
+ blockMessage: {
16
+ backgroundColor: bg,
17
+ padding: '10px',
18
+ },
19
+ blockError: {
20
+ backgroundColor: bg,
21
+ padding: '10px',
22
+ color: 'red',
23
+ },
24
+ };
25
+ });
26
+ function LoadingMessage() {
27
+ // only show the loading message after 300ms to prevent excessive flickering
28
+ const [shown, setShown] = useState(false);
29
+ const { classes } = useStyles();
30
+ useEffect(() => {
31
+ const timeout = setTimeout(() => setShown(true), 300);
32
+ return () => clearTimeout(timeout);
33
+ }, []);
34
+ return shown ? (React.createElement("div", { className: classes.loading },
35
+ React.createElement(LoadingEllipses, null))) : null;
36
+ }
37
+ function BlockMessage({ messageText }) {
38
+ const { classes } = useStyles();
39
+ return (React.createElement("div", { className: classes.blockMessage },
40
+ React.createElement(Typography, null, `${messageText}`)));
41
+ }
42
+ function BlockError({ error }) {
43
+ const { classes } = useStyles();
44
+ return (React.createElement("div", { className: classes.blockError },
45
+ React.createElement(Typography, null, `${error}`)));
46
+ }
47
+ export default observer(function ({ model, style, }) {
48
+ if (model.error) {
49
+ return React.createElement(BlockError, { error: model.error, "data-testid": "reload_button" });
50
+ }
51
+ else if (model.message) {
52
+ return React.createElement(BlockMessage, { messageText: model.message });
53
+ }
54
+ else if (!model.filled) {
55
+ return React.createElement(LoadingMessage, null);
56
+ }
57
+ else if (model.shouldDisplay) {
58
+ return React.createElement("div", { style: style }, model.reactElement);
59
+ }
60
+ return null;
61
+ });
62
+ //# sourceMappingURL=ServerSideRenderedBlockContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerSideRenderedBlockContent.js","sourceRoot":"","sources":["../src/ServerSideRenderedBlockContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAiB,MAAM,OAAO,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE;IACrC,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAA;IAClD,OAAO;QACL,OAAO,EAAE;YACP,WAAW,EAAE,OAAO;YACpB,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO;YACjD,eAAe,EAAE,kEAAkE,EAAE,SAAS,EAAE,QAAQ;YACxG,SAAS,EAAE,QAAQ;SACpB;QAED,YAAY,EAAE;YACZ,eAAe,EAAE,EAAE;YACnB,OAAO,EAAE,MAAM;SAChB;QACD,UAAU,EAAE;YACV,eAAe,EAAE,EAAE;YACnB,OAAO,EAAE,MAAM;YACf,KAAK,EAAE,KAAK;SACb;KACF,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,SAAS,cAAc;IACrB,4EAA4E;IAC5E,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACzC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAA;IAC/B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAA;QACrD,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,6BAAK,SAAS,EAAE,OAAO,CAAC,OAAO;QAC7B,oBAAC,eAAe,OAAG,CACf,CACP,CAAC,CAAC,CAAC,IAAI,CAAA;AACV,CAAC;AAED,SAAS,YAAY,CAAC,EAAE,WAAW,EAA2B;IAC5D,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAA;IAC/B,OAAO,CACL,6BAAK,SAAS,EAAE,OAAO,CAAC,YAAY;QAClC,oBAAC,UAAU,QAAE,GAAG,WAAW,EAAE,CAAc,CACvC,CACP,CAAA;AACH,CAAC;AAED,SAAS,UAAU,CAAC,EAAE,KAAK,EAAsB;IAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAA;IAC/B,OAAO,CACL,6BAAK,SAAS,EAAE,OAAO,CAAC,UAAU;QAChC,oBAAC,UAAU,QAAE,GAAG,KAAK,EAAE,CAAc,CACjC,CACP,CAAA;AACH,CAAC;AAED,eAAe,QAAQ,CAAC,UAAU,EAChC,KAAK,EACL,KAAK,GAUN;IACC,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,OAAO,oBAAC,UAAU,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,iBAAc,eAAe,GAAG,CAAA;KACtE;SAAM,IAAI,KAAK,CAAC,OAAO,EAAE;QACxB,OAAO,oBAAC,YAAY,IAAC,WAAW,EAAE,KAAK,CAAC,OAAO,GAAI,CAAA;KACpD;SAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;QACxB,OAAO,oBAAC,cAAc,OAAG,CAAA;KAC1B;SAAM,IAAI,KAAK,CAAC,aAAa,EAAE;QAC9B,OAAO,6BAAK,KAAK,EAAE,KAAK,IAAG,KAAK,CAAC,YAAY,CAAO,CAAA;KACrD;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAC,CAAA"}
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ /**
3
+ * A block whose content is rendered outside of the main thread and hydrated by this
4
+ * component.
5
+ */
6
+ declare function ServerSideSyntenyRendering({ model, }: {
7
+ model: {
8
+ imageData: string;
9
+ style: Record<string, string>;
10
+ renderProps: {
11
+ width: number;
12
+ height: number;
13
+ highResolutionScaling?: number;
14
+ };
15
+ };
16
+ }): React.JSX.Element;
17
+ declare namespace ServerSideSyntenyRendering {
18
+ var propTypes: {
19
+ model: import("prop-types").Validator<any>;
20
+ };
21
+ }
22
+ declare const _default: typeof ServerSideSyntenyRendering;
23
+ export default _default;
@@ -0,0 +1,29 @@
1
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
+ import React, { useRef, useState, useEffect } from 'react';
3
+ import { observer, PropTypes } from 'mobx-react';
4
+ import { drawImageOntoCanvasContext } from '@jbrowse/core/util/offscreenCanvasPonyfill';
5
+ /**
6
+ * A block whose content is rendered outside of the main thread and hydrated by this
7
+ * component.
8
+ */
9
+ function ServerSideSyntenyRendering({ model, }) {
10
+ const { imageData, style, renderProps } = model;
11
+ const { width, height, highResolutionScaling = 1 } = renderProps;
12
+ const featureCanvas = useRef(null);
13
+ const [done, setDone] = useState(false);
14
+ useEffect(() => {
15
+ if (!imageData) {
16
+ return;
17
+ }
18
+ const canvas = featureCanvas.current;
19
+ const context = canvas.getContext('2d');
20
+ drawImageOntoCanvasContext(imageData, context);
21
+ setDone(true);
22
+ }, [height, imageData, width]);
23
+ return (React.createElement("canvas", { "data-testid": `prerendered_canvas${done ? '_done' : ''}`, ref: featureCanvas, width: width * highResolutionScaling, height: height * highResolutionScaling, style: { width, height, ...style } }));
24
+ }
25
+ ServerSideSyntenyRendering.propTypes = {
26
+ model: PropTypes.observableObject.isRequired,
27
+ };
28
+ export default observer(ServerSideSyntenyRendering);
29
+ //# sourceMappingURL=ServerSideSyntenyRendering.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerSideSyntenyRendering.js","sourceRoot":"","sources":["../src/ServerSideSyntenyRendering.tsx"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAA;AAEvF;;;GAGG;AACH,SAAS,0BAA0B,CAAC,EAClC,KAAK,GAWN;IACC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,KAAK,CAAA;IAC/C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,qBAAqB,GAAG,CAAC,EAAE,GAAG,WAAW,CAAA;IAEhE,MAAM,aAAa,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAA;IACrD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEvC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,SAAS,EAAE;YACd,OAAM;SACP;QACD,MAAM,MAAM,GAAG,aAAa,CAAC,OAAQ,CAAA;QACrC,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAE,CAAA;QACxC,0BAA0B,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAA;IACf,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;IAE9B,OAAO,CACL,+CACe,qBAAqB,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EACvD,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,KAAK,GAAG,qBAAqB,EACpC,MAAM,EAAE,MAAM,GAAG,qBAAqB,EACtC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAClC,CACH,CAAA;AACH,CAAC;AAED,0BAA0B,CAAC,SAAS,GAAG;IACrC,KAAK,EAAE,SAAS,CAAC,gBAAgB,CAAC,UAAU;CAC7C,CAAA;AAED,eAAe,QAAQ,CAAC,0BAA0B,CAAC,CAAA"}
package/esm/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import Plugin from '@jbrowse/core/Plugin';
2
+ import PluginManager from '@jbrowse/core/PluginManager';
3
+ export default class DotplotPlugin extends Plugin {
4
+ name: string;
5
+ install(pluginManager: PluginManager): void;
6
+ configure(pluginManager: PluginManager): void;
7
+ }
package/esm/index.js ADDED
@@ -0,0 +1,38 @@
1
+ import Plugin from '@jbrowse/core/Plugin';
2
+ import { isAbstractMenuManager } from '@jbrowse/core/util';
3
+ // icons
4
+ import TimelineIcon from '@mui/icons-material/Timeline';
5
+ // locals
6
+ import DotplotViewF from './DotplotView';
7
+ import DotplotDisplayF from './DotplotDisplay';
8
+ import DotplotRendererF from './DotplotRenderer';
9
+ import LaunchDotplotViewF from './LaunchDotplotView';
10
+ import ComparativeRenderer from './ComparativeRenderer';
11
+ import DotplotReadVsRefMenuItem from './DotplotReadVsRef';
12
+ export default class DotplotPlugin extends Plugin {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.name = 'DotplotPlugin';
16
+ }
17
+ install(pluginManager) {
18
+ DotplotViewF(pluginManager);
19
+ DotplotDisplayF(pluginManager);
20
+ DotplotRendererF(pluginManager);
21
+ LaunchDotplotViewF(pluginManager);
22
+ DotplotReadVsRefMenuItem(pluginManager);
23
+ // install our comparative rendering rpc callback
24
+ pluginManager.addRpcMethod(() => new ComparativeRenderer(pluginManager));
25
+ }
26
+ configure(pluginManager) {
27
+ if (isAbstractMenuManager(pluginManager.rootModel)) {
28
+ pluginManager.rootModel.appendToSubMenu(['Add'], {
29
+ label: 'Dotplot view',
30
+ icon: TimelineIcon,
31
+ onClick: (session) => {
32
+ session.addView('DotplotView', {});
33
+ },
34
+ });
35
+ }
36
+ }
37
+ }
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,sBAAsB,CAAA;AAEzC,OAAO,EAAwB,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAEhF,QAAQ;AACR,OAAO,YAAY,MAAM,8BAA8B,CAAA;AAEvD,SAAS;AACT,OAAO,YAAY,MAAM,eAAe,CAAA;AACxC,OAAO,eAAe,MAAM,kBAAkB,CAAA;AAC9C,OAAO,gBAAgB,MAAM,mBAAmB,CAAA;AAChD,OAAO,kBAAkB,MAAM,qBAAqB,CAAA;AACpD,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,wBAAwB,MAAM,oBAAoB,CAAA;AAEzD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,MAAM;IAAjD;;QACE,SAAI,GAAG,eAAe,CAAA;IAwBxB,CAAC;IAtBC,OAAO,CAAC,aAA4B;QAClC,YAAY,CAAC,aAAa,CAAC,CAAA;QAC3B,eAAe,CAAC,aAAa,CAAC,CAAA;QAC9B,gBAAgB,CAAC,aAAa,CAAC,CAAA;QAC/B,kBAAkB,CAAC,aAAa,CAAC,CAAA;QACjC,wBAAwB,CAAC,aAAa,CAAC,CAAA;QAEvC,iDAAiD;QACjD,aAAa,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,IAAI,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAA;IAC1E,CAAC;IAED,SAAS,CAAC,aAA4B;QACpC,IAAI,qBAAqB,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YAClD,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,EAAE;gBAC/C,KAAK,EAAE,cAAc;gBACrB,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAE,CAAC,OAA6B,EAAE,EAAE;oBACzC,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;gBACpC,CAAC;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF"}
package/esm/util.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { Feature } from '@jbrowse/core/util';
2
+ export interface ReducedFeature {
3
+ refName: string;
4
+ start: number;
5
+ clipPos: number;
6
+ end: number;
7
+ seqLength: number;
8
+ }
9
+ export declare function getTag(f: Feature, tag: string): any;
package/esm/util.js ADDED
@@ -0,0 +1,5 @@
1
+ export function getTag(f, tag) {
2
+ const tags = f.get('tags');
3
+ return tags ? tags[tag] : f.get(tag);
4
+ }
5
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,MAAM,CAAC,CAAU,EAAE,GAAW;IAC5C,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAC1B,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AACtC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@jbrowse/plugin-dotplot-view",
3
+ "version": "2.6.1",
4
+ "description": "JBrowse 2 dotplot view",
5
+ "keywords": [
6
+ "jbrowse",
7
+ "jbrowse2"
8
+ ],
9
+ "license": "Apache-2.0",
10
+ "homepage": "https://jbrowse.org",
11
+ "bugs": "https://github.com/GMOD/jbrowse-components/issues",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/GMOD/jbrowse-components.git",
15
+ "directory": "plugins/dotplot-view"
16
+ },
17
+ "author": "JBrowse Team",
18
+ "distMain": "dist/index.js",
19
+ "srcMain": "src/index.ts",
20
+ "main": "dist/index.js",
21
+ "files": [
22
+ "dist",
23
+ "src",
24
+ "esm"
25
+ ],
26
+ "scripts": {
27
+ "build": "npm-run-all build:*",
28
+ "test": "cd ../..; jest plugins/dotplot-view",
29
+ "prepublishOnly": "yarn test",
30
+ "prepack": "yarn build && yarn useDist",
31
+ "postpack": "yarn useSrc",
32
+ "useDist": "node ../../scripts/useDist.js",
33
+ "useSrc": "node ../../scripts/useSrc.js",
34
+ "prebuild": "npm run clean",
35
+ "build:esm": "tsc --build tsconfig.build.esm.json",
36
+ "build:es5": "tsc --build tsconfig.build.es5.json",
37
+ "clean": "rimraf dist esm *.tsbuildinfo"
38
+ },
39
+ "dependencies": {
40
+ "@mui/icons-material": "^5.0.1",
41
+ "@mui/x-data-grid": "^6.0.1",
42
+ "@popperjs/core": "^2.11.0",
43
+ "@types/file-saver": "^2.0.1",
44
+ "@types/normalize-wheel": "^1.0.0",
45
+ "clone": "^2.1.2",
46
+ "file-saver": "^2.0.0",
47
+ "normalize-wheel": "^1.0.1",
48
+ "react-popper": "^2.0.0"
49
+ },
50
+ "peerDependencies": {
51
+ "@jbrowse/core": "^2.0.0",
52
+ "@jbrowse/plugin-alignments": "^2.0.0",
53
+ "@mui/material": "^5.0.0",
54
+ "mobx": "^6.0.0",
55
+ "mobx-react": "^7.0.0",
56
+ "mobx-state-tree": "^5.0.0",
57
+ "react": ">=16.8.0",
58
+ "react-dom": ">=16.8.0",
59
+ "rxjs": "^7.0.0",
60
+ "tss-react": "^4.0.0"
61
+ },
62
+ "distModule": "esm/index.js",
63
+ "srcModule": "src/index.ts",
64
+ "module": "esm/index.js",
65
+ "publishConfig": {
66
+ "access": "public"
67
+ },
68
+ "gitHead": "1cbe7ba097fb2d2763c776e5e429e4670cdd583c"
69
+ }
@@ -0,0 +1,87 @@
1
+ import { checkAbortSignal } from '@jbrowse/core/util'
2
+ import RpcMethodType from '@jbrowse/core/pluggableElementTypes/RpcMethodType'
3
+ import ComparativeRenderer, {
4
+ RenderArgs as ComparativeRenderArgs,
5
+ RenderArgsSerialized as ComparativeRenderArgsSerialized,
6
+ RenderResults,
7
+ ResultsSerialized,
8
+ } from '@jbrowse/core/pluggableElementTypes/renderers/ComparativeServerSideRendererType'
9
+ import { RemoteAbortSignal } from '@jbrowse/core/rpc/remoteAbortSignals'
10
+
11
+ interface RenderArgs extends ComparativeRenderArgs {
12
+ adapterConfig: {}
13
+ rendererType: string
14
+ }
15
+
16
+ interface RenderArgsSerialized extends ComparativeRenderArgsSerialized {
17
+ adapterConfig: {}
18
+ rendererType: string
19
+ }
20
+
21
+ /**
22
+ * call a synteny renderer with the given args
23
+ * param views: a set of views that each contain a set of regions
24
+ * used instead of passing regions directly as in render()
25
+ */
26
+ export default class ComparativeRender extends RpcMethodType {
27
+ name = 'ComparativeRender'
28
+
29
+ async renameRegionsIfNeeded(args: RenderArgs, rend: ComparativeRenderer) {
30
+ return rend.renameRegionsIfNeeded(args)
31
+ }
32
+
33
+ getRenderer(rendererType: string) {
34
+ const pm = this.pluginManager
35
+ return pm.getRendererType(rendererType) as ComparativeRenderer
36
+ }
37
+
38
+ async serializeArguments(args: RenderArgs, rpcDriver: string) {
39
+ const { rendererType } = args
40
+ const renderer = this.getRenderer(rendererType)
41
+ const n = (await super.serializeArguments(args, rpcDriver)) as RenderArgs
42
+ const result = await this.renameRegionsIfNeeded(n, renderer)
43
+
44
+ return rpcDriver === 'MainThreadRpcDriver'
45
+ ? result
46
+ : renderer.serializeArgsInClient(result)
47
+ }
48
+
49
+ async execute(
50
+ args: RenderArgsSerialized & { signal?: RemoteAbortSignal },
51
+ rpcDriver: string,
52
+ ) {
53
+ let deserializedArgs = args
54
+ if (rpcDriver !== 'MainThreadRpcDriver') {
55
+ deserializedArgs = await this.deserializeArguments(args, rpcDriver)
56
+ }
57
+ const { sessionId, rendererType, signal } = deserializedArgs
58
+ if (!sessionId) {
59
+ throw new Error('must pass a unique session id')
60
+ }
61
+
62
+ checkAbortSignal(signal)
63
+
64
+ const renderer = this.getRenderer(rendererType)
65
+ return rpcDriver === 'MainThreadRpcDriver'
66
+ ? renderer.render(deserializedArgs)
67
+ : renderer.renderInWorker(deserializedArgs)
68
+ }
69
+
70
+ async deserializeReturn(
71
+ val: RenderResults | ResultsSerialized,
72
+ args: RenderArgs,
73
+ rpcDriver: string,
74
+ ): Promise<unknown> {
75
+ const ret = (await super.deserializeReturn(
76
+ val,
77
+ args,
78
+ rpcDriver,
79
+ )) as ResultsSerialized
80
+ if (rpcDriver === 'MainThreadRpcDriver') {
81
+ return ret
82
+ }
83
+
84
+ const renderer = this.getRenderer(args.rendererType)
85
+ return renderer.deserializeResultsInClient(ret, args)
86
+ }
87
+ }
@@ -0,0 +1,34 @@
1
+ import React from 'react'
2
+ import { observer } from 'mobx-react'
3
+ import { getContainingView } from '@jbrowse/core/util'
4
+
5
+ // locals
6
+ import { DotplotDisplayModel } from '../stateModelFactory'
7
+ import { DotplotViewModel } from '../../DotplotView/model'
8
+
9
+ function DotplotDisplay(props: {
10
+ model: DotplotDisplayModel
11
+ children?: React.ReactNode
12
+ }) {
13
+ const { model, children } = props
14
+ const { offsetX = 0, offsetY = 0 } = model.data || {}
15
+ const view = getContainingView(model) as DotplotViewModel
16
+
17
+ const top = view.vview.offsetPx - offsetY
18
+ const left = -(view.hview.offsetPx - offsetX)
19
+ return (
20
+ <div style={{ position: 'relative' }}>
21
+ <model.ReactComponent2
22
+ {...props}
23
+ style={{
24
+ position: 'absolute',
25
+ top,
26
+ left,
27
+ }}
28
+ />
29
+ {children}
30
+ </div>
31
+ )
32
+ }
33
+
34
+ export default observer(DotplotDisplay)
@@ -0,0 +1,48 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { ConfigurationSchema } from '@jbrowse/core/configuration'
3
+ import { types } from 'mobx-state-tree'
4
+ import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
5
+ import PluginManager from '@jbrowse/core/PluginManager'
6
+
7
+ // locals
8
+ import { stateModelFactory } from './stateModelFactory'
9
+ import ReactComponent from './components/DotplotDisplay'
10
+
11
+ export default (pm: PluginManager) => {
12
+ pm.addDisplayType(() => {
13
+ const configSchema = configSchemaFactory(pm)
14
+ return new DisplayType({
15
+ name: 'DotplotDisplay',
16
+ displayName: 'Dotplot display',
17
+ configSchema,
18
+ stateModel: stateModelFactory(configSchema),
19
+ trackType: 'SyntenyTrack',
20
+ viewType: 'DotplotView',
21
+ ReactComponent,
22
+ })
23
+ })
24
+ }
25
+
26
+ /**
27
+ * #config DotplotDisplay
28
+ */
29
+ export function configSchemaFactory(pm: any) {
30
+ return ConfigurationSchema(
31
+ 'DotplotDisplay',
32
+ {
33
+ /**
34
+ * #slot
35
+ */
36
+ renderer: types.optional(pm.pluggableConfigSchemaType('renderer'), {
37
+ type: 'DotplotRenderer',
38
+ }),
39
+ },
40
+ {
41
+ /**
42
+ * #identifier
43
+ */
44
+ explicitIdentifier: 'displayId',
45
+ explicitlyTyped: true,
46
+ },
47
+ )
48
+ }
@@ -0,0 +1,60 @@
1
+ import clone from 'clone'
2
+ import { readConfObject } from '@jbrowse/core/configuration'
3
+ import { getRpcSessionId } from '@jbrowse/core/util/tracks'
4
+ import { getSnapshot, IAnyStateTreeNode } from 'mobx-state-tree'
5
+ import { getContainingView, getSession } from '@jbrowse/core/util'
6
+
7
+ import { DotplotViewModel } from '../DotplotView/model'
8
+
9
+ export function renderBlockData(self: IAnyStateTreeNode) {
10
+ const { rpcManager } = getSession(self)
11
+ const { rendererType } = self
12
+ const { adapterConfig } = self
13
+ const parent = getContainingView(self) as DotplotViewModel
14
+
15
+ // Alternative to readConfObject(config) is below used because renderProps is
16
+ // something under our control. Compare to serverSideRenderedBlock
17
+ readConfObject(self.configuration)
18
+ getSnapshot(parent)
19
+
20
+ if (parent.initialized) {
21
+ const { viewWidth, viewHeight, borderSize, borderX, borderY } = parent
22
+ return {
23
+ rendererType,
24
+ rpcManager,
25
+ renderProps: {
26
+ ...self.renderProps(),
27
+ view: clone(getSnapshot(parent)),
28
+ width: viewWidth,
29
+ height: viewHeight,
30
+ borderSize,
31
+ borderX,
32
+ borderY,
33
+ adapterConfig,
34
+ rendererType: rendererType.name,
35
+ sessionId: getRpcSessionId(self),
36
+ timeout: 1000000, // 10000,
37
+ },
38
+ }
39
+ }
40
+ return undefined
41
+ }
42
+
43
+ export async function renderBlockEffect(
44
+ props?: ReturnType<typeof renderBlockData>,
45
+ ) {
46
+ if (!props) {
47
+ return
48
+ }
49
+
50
+ const { rendererType, rpcManager, renderProps } = props
51
+ const { reactElement, ...data } = await rendererType.renderInClient(
52
+ rpcManager,
53
+ renderProps,
54
+ )
55
+ return {
56
+ reactElement,
57
+ data,
58
+ renderingComponent: rendererType.ReactComponent,
59
+ }
60
+ }