@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,274 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const configuration_1 = require("@jbrowse/core/configuration");
7
+ const util_1 = require("@jbrowse/core/util");
8
+ const Base1DUtils_1 = require("@jbrowse/core/util/Base1DUtils");
9
+ const mobx_state_tree_1 = require("mobx-state-tree");
10
+ const ComparativeServerSideRendererType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/renderers/ComparativeServerSideRendererType"));
11
+ const plugin_alignments_1 = require("@jbrowse/plugin-alignments");
12
+ // locals
13
+ const model_1 = require("../DotplotView/model");
14
+ const ui_1 = require("@jbrowse/core/ui");
15
+ const { parseCigar } = plugin_alignments_1.MismatchParser;
16
+ const r = 'fell outside of range due to CIGAR string';
17
+ const lt = '(less than min coordinate of feature)';
18
+ const gt = '(greater than max coordinate of feature)';
19
+ const fudgeFactor = 1; // allow 1px fuzzyness before warn
20
+ function drawCir(ctx, x, y, r = 1) {
21
+ ctx.beginPath();
22
+ ctx.arc(x, y, r / 2, 0, 2 * Math.PI);
23
+ ctx.fill();
24
+ }
25
+ class DotplotRenderer extends ComparativeServerSideRendererType_1.default {
26
+ constructor() {
27
+ super(...arguments);
28
+ this.supportsSVG = true;
29
+ }
30
+ async renameRegionsIfNeeded(args) {
31
+ var _a, _b;
32
+ const pm = this.pluginManager;
33
+ const assemblyManager = (_b = (_a = pm.rootModel) === null || _a === void 0 ? void 0 : _a.session) === null || _b === void 0 ? void 0 : _b.assemblyManager;
34
+ const { view, sessionId, adapterConfig } = args;
35
+ async function process(regions) {
36
+ if (!assemblyManager) {
37
+ throw new Error('No assembly manager provided');
38
+ }
39
+ const result = await (0, util_1.renameRegionsIfNeeded)(assemblyManager, {
40
+ sessionId,
41
+ adapterConfig,
42
+ regions,
43
+ });
44
+ return result.regions;
45
+ }
46
+ view.hview.displayedRegions = await process(view.hview.displayedRegions);
47
+ view.vview.displayedRegions = await process(view.vview.displayedRegions);
48
+ return args;
49
+ }
50
+ async drawDotplot(ctx, props) {
51
+ var _a, _b, _c;
52
+ const { config, views, height, drawCigar, theme } = props;
53
+ const color = (0, configuration_1.readConfObject)(config, 'color');
54
+ const posColor = (0, configuration_1.readConfObject)(config, 'posColor');
55
+ const negColor = (0, configuration_1.readConfObject)(config, 'negColor');
56
+ const colorBy = (0, configuration_1.readConfObject)(config, 'colorBy');
57
+ const lineWidth = (0, configuration_1.readConfObject)(config, 'lineWidth');
58
+ const thresholds = (0, configuration_1.readConfObject)(config, 'thresholds');
59
+ const palette = (0, configuration_1.readConfObject)(config, 'thresholdsPalette');
60
+ const isCallback = config.color.isCallback;
61
+ const [hview, vview] = views;
62
+ const db1 = (_a = hview.dynamicBlocks.contentBlocks[0]) === null || _a === void 0 ? void 0 : _a.offsetPx;
63
+ const db2 = (_b = vview.dynamicBlocks.contentBlocks[0]) === null || _b === void 0 ? void 0 : _b.offsetPx;
64
+ const warnings = [];
65
+ ctx.lineWidth = lineWidth;
66
+ // we operate on snapshots of these attributes of the hview/vview because
67
+ // it is significantly faster than accessing the mobx objects
68
+ const { bpPerPx: hBpPerPx } = hview;
69
+ const { bpPerPx: vBpPerPx } = vview;
70
+ function clampWithWarnX(num, min, max, feature) {
71
+ const strand = feature.get('strand') || 1;
72
+ if (strand === -1) {
73
+ ;
74
+ [max, min] = [min, max];
75
+ }
76
+ if (num < min - fudgeFactor) {
77
+ let start = feature.get('start');
78
+ let end = feature.get('end');
79
+ const refName = feature.get('refName');
80
+ if (strand === -1) {
81
+ ;
82
+ [end, start] = [start, end];
83
+ }
84
+ warnings.push({
85
+ message: `feature at (X ${refName}:${start}-${end}) ${r} ${lt}`,
86
+ effect: 'clipped the feature',
87
+ });
88
+ return min;
89
+ }
90
+ if (num > max + fudgeFactor) {
91
+ const strand = feature.get('strand') || 1;
92
+ const start = strand === 1 ? feature.get('start') : feature.get('end');
93
+ const end = strand === 1 ? feature.get('end') : feature.get('start');
94
+ const refName = feature.get('refName');
95
+ warnings.push({
96
+ message: `feature at (X ${refName}:${start}-${end}) ${r} ${gt}`,
97
+ effect: 'clipped the feature',
98
+ });
99
+ return max;
100
+ }
101
+ return num;
102
+ }
103
+ function clampWithWarnY(num, min, max, feature) {
104
+ if (num < min - fudgeFactor) {
105
+ const mate = feature.get('mate');
106
+ const { refName, start, end } = mate;
107
+ warnings.push({
108
+ message: `feature at (Y ${refName}:${start}-${end}) ${r} ${lt}`,
109
+ effect: 'clipped the feature',
110
+ });
111
+ return min;
112
+ }
113
+ if (num > max + fudgeFactor) {
114
+ const mate = feature.get('mate');
115
+ const { refName, start, end } = mate;
116
+ warnings.push({
117
+ message: `feature at (Y ${refName}:${start}-${end}) ${r} ${gt}`,
118
+ effect: 'clipped the feature',
119
+ });
120
+ return max;
121
+ }
122
+ return num;
123
+ }
124
+ const hsnap = {
125
+ ...(0, mobx_state_tree_1.getSnapshot)(hview),
126
+ staticBlocks: hview.staticBlocks,
127
+ width: hview.width,
128
+ };
129
+ const vsnap = {
130
+ ...(0, mobx_state_tree_1.getSnapshot)(vview),
131
+ staticBlocks: vview.staticBlocks,
132
+ width: vview.width,
133
+ };
134
+ const t = (0, ui_1.createJBrowseTheme)(theme);
135
+ (_c = hview.features) === null || _c === void 0 ? void 0 : _c.forEach(feature => {
136
+ const strand = feature.get('strand') || 1;
137
+ const start = strand === 1 ? feature.get('start') : feature.get('end');
138
+ const end = strand === 1 ? feature.get('end') : feature.get('start');
139
+ const refName = feature.get('refName');
140
+ const mate = feature.get('mate');
141
+ const mateRef = mate.refName;
142
+ let r;
143
+ if (colorBy === 'identity') {
144
+ const identity = feature.get('identity');
145
+ for (let i = 0; i < thresholds.length; i++) {
146
+ if (identity > +thresholds[i]) {
147
+ r = palette[i];
148
+ break;
149
+ }
150
+ }
151
+ }
152
+ else if (colorBy === 'meanQueryIdentity') {
153
+ r = `hsl(${feature.get('meanScore') * 200},100%,40%)`;
154
+ }
155
+ else if (colorBy === 'mappingQuality') {
156
+ r = `hsl(${feature.get('mappingQual')},100%,40%)`;
157
+ }
158
+ else if (colorBy === 'strand') {
159
+ r = strand === -1 ? negColor : posColor;
160
+ }
161
+ else if (colorBy === 'default') {
162
+ r = isCallback
163
+ ? (0, configuration_1.readConfObject)(config, 'color', { feature })
164
+ : color === '#f0f'
165
+ ? t.palette.text.primary
166
+ : color;
167
+ }
168
+ ctx.fillStyle = r;
169
+ ctx.strokeStyle = r;
170
+ const b10 = (0, Base1DUtils_1.bpToPx)({ self: hsnap, refName, coord: start });
171
+ const b20 = (0, Base1DUtils_1.bpToPx)({ self: hsnap, refName, coord: end });
172
+ const e10 = (0, Base1DUtils_1.bpToPx)({ self: vsnap, refName: mateRef, coord: mate.start });
173
+ const e20 = (0, Base1DUtils_1.bpToPx)({ self: vsnap, refName: mateRef, coord: mate.end });
174
+ if (b10 !== undefined &&
175
+ b20 !== undefined &&
176
+ e10 !== undefined &&
177
+ e20 !== undefined) {
178
+ const b1 = b10.offsetPx - db1;
179
+ const b2 = b20.offsetPx - db1;
180
+ const e1 = e10.offsetPx - db2;
181
+ const e2 = e20.offsetPx - db2;
182
+ if (Math.abs(b1 - b2) <= 4 && Math.abs(e1 - e2) <= 4) {
183
+ drawCir(ctx, b1, height - e1, lineWidth);
184
+ }
185
+ else {
186
+ let currX = b1;
187
+ let currY = e1;
188
+ const cigar = feature.get('CIGAR');
189
+ if (drawCigar && cigar) {
190
+ const cigarOps = parseCigar(cigar);
191
+ ctx.beginPath();
192
+ ctx.moveTo(currX, height - currY);
193
+ for (let i = 0; i < cigarOps.length; i += 2) {
194
+ const val = +cigarOps[i];
195
+ const op = cigarOps[i + 1];
196
+ if (op === 'M' || op === '=' || op === 'X') {
197
+ currX += (val / hBpPerPx) * strand;
198
+ currY += val / vBpPerPx;
199
+ }
200
+ else if (op === 'D' || op === 'N') {
201
+ currX += (val / hBpPerPx) * strand;
202
+ }
203
+ else if (op === 'I') {
204
+ currY += val / vBpPerPx;
205
+ }
206
+ currX = clampWithWarnX(currX, b1, b2, feature);
207
+ currY = clampWithWarnY(currY, e1, e2, feature);
208
+ ctx.lineTo(currX, height - currY);
209
+ }
210
+ ctx.stroke();
211
+ }
212
+ else {
213
+ ctx.beginPath();
214
+ ctx.moveTo(b1, height - e1);
215
+ ctx.lineTo(b2, height - e2);
216
+ ctx.stroke();
217
+ }
218
+ }
219
+ }
220
+ else {
221
+ if (warnings.length <= 5) {
222
+ if (b10 === undefined || b20 === undefined) {
223
+ warnings.push({
224
+ message: `feature at (X ${refName}:${start}-${end}) not plotted, fell outside of range`,
225
+ effect: 'feature not rendered',
226
+ });
227
+ }
228
+ else {
229
+ warnings.push({
230
+ message: `feature at (Y ${mateRef}:${mate.start}-${mate.end}) not plotted, fell outside of range`,
231
+ effect: 'feature not rendered',
232
+ });
233
+ }
234
+ }
235
+ }
236
+ });
237
+ return { warnings };
238
+ }
239
+ async render(renderProps) {
240
+ var _a, _b;
241
+ const { width, height, view: { hview, vview }, } = renderProps;
242
+ const dimensions = [width, height];
243
+ const views = [hview, vview].map((snap, idx) => {
244
+ const view = model_1.Dotplot1DView.create(snap);
245
+ view.setVolatileWidth(dimensions[idx]);
246
+ return view;
247
+ });
248
+ const target = views[0];
249
+ const feats = await this.getFeatures({
250
+ ...renderProps,
251
+ regions: target.dynamicBlocks.contentBlocks,
252
+ });
253
+ target.setFeatures(feats);
254
+ const ret = await (0, util_1.renderToAbstractCanvas)(width, height, renderProps, ctx => this.drawDotplot(ctx, { ...renderProps, views }));
255
+ const results = await super.render({
256
+ ...renderProps,
257
+ ...ret,
258
+ height,
259
+ width,
260
+ });
261
+ return {
262
+ ...results,
263
+ ...ret,
264
+ height,
265
+ width,
266
+ offsetX: ((_a = views[0].dynamicBlocks.blocks[0]) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0,
267
+ offsetY: ((_b = views[1].dynamicBlocks.blocks[0]) === null || _b === void 0 ? void 0 : _b.offsetPx) || 0,
268
+ bpPerPxX: views[0].bpPerPx,
269
+ bpPerPxY: views[1].bpPerPx,
270
+ };
271
+ }
272
+ }
273
+ exports.default = DotplotRenderer;
274
+ //# sourceMappingURL=DotplotRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DotplotRenderer.js","sourceRoot":"","sources":["../../src/DotplotRenderer/DotplotRenderer.ts"],"names":[],"mappings":";;;;;AAAA,+DAGoC;AACpC,6CAK2B;AAC3B,gEAAuD;AACvD,qDAA6C;AAC7C,wJAGwF;AACxF,kEAA2D;AAE3D,SAAS;AACT,gDAAwE;AACxE,yCAAqD;AAErD,MAAM,EAAE,UAAU,EAAE,GAAG,kCAAc,CAAA;AAqBrC,MAAM,CAAC,GAAG,2CAA2C,CAAA;AACrD,MAAM,EAAE,GAAG,uCAAuC,CAAA;AAClD,MAAM,EAAE,GAAG,0CAA0C,CAAA;AACrD,MAAM,WAAW,GAAG,CAAC,CAAA,CAAC,kCAAkC;AAExD,SAAS,OAAO,CAAC,GAA6B,EAAE,CAAS,EAAE,CAAS,EAAE,CAAC,GAAG,CAAC;IACzE,GAAG,CAAC,SAAS,EAAE,CAAA;IACf,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAA;IACpC,GAAG,CAAC,IAAI,EAAE,CAAA;AACZ,CAAC;AAED,MAAqB,eAAgB,SAAQ,2CAAmB;IAAhE;;QACE,gBAAW,GAAG,IAAI,CAAA;IAgRpB,CAAC;IA9QC,KAAK,CAAC,qBAAqB,CAAC,IAAuB;;QACjD,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,CAAA;QAC7B,MAAM,eAAe,GAAG,MAAA,MAAA,EAAE,CAAC,SAAS,0CAAE,OAAO,0CAAE,eAAe,CAAA;QAE9D,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,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C,OAAO;YAC1B,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO;SAC3B,CAAA;IACH,CAAC;CACF;AAjRD,kCAiRC"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { DotplotRenderArgsDeserialized } from '../DotplotRenderer';
3
+ declare function DotplotRendering(props: DotplotRenderArgsDeserialized): React.JSX.Element;
4
+ declare const _default: typeof DotplotRendering;
5
+ export default _default;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const ui_1 = require("@jbrowse/core/ui");
8
+ const mobx_react_1 = require("mobx-react");
9
+ function DotplotRendering(props) {
10
+ return react_1.default.createElement(ui_1.PrerenderedCanvas, { ...props });
11
+ }
12
+ exports.default = (0, mobx_react_1.observer)(DotplotRendering);
13
+ //# sourceMappingURL=DotplotRendering.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DotplotRendering.js","sourceRoot":"","sources":["../../../src/DotplotRenderer/components/DotplotRendering.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,yCAAoD;AACpD,2CAAqC;AAKrC,SAAS,gBAAgB,CAAC,KAAoC;IAC5D,OAAO,8BAAC,sBAAiB,OAAK,KAAK,GAAI,CAAA;AACzC,CAAC;AAED,kBAAe,IAAA,qBAAQ,EAAC,gBAAgB,CAAC,CAAA"}
@@ -0,0 +1,61 @@
1
+ declare const _default: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
+ /**
3
+ * #slot
4
+ */
5
+ color: {
6
+ type: string;
7
+ description: string;
8
+ defaultValue: string;
9
+ contextVariable: string[];
10
+ };
11
+ /**
12
+ * #slot
13
+ */
14
+ posColor: {
15
+ type: string;
16
+ description: string;
17
+ defaultValue: string;
18
+ };
19
+ /**
20
+ * #slot
21
+ */
22
+ negColor: {
23
+ type: string;
24
+ description: string;
25
+ defaultValue: string;
26
+ };
27
+ /**
28
+ * #slot
29
+ */
30
+ lineWidth: {
31
+ type: string;
32
+ description: string;
33
+ defaultValue: number;
34
+ };
35
+ /**
36
+ * #slot
37
+ */
38
+ colorBy: {
39
+ type: string;
40
+ model: import("mobx-state-tree").ISimpleType<string>;
41
+ description: string;
42
+ defaultValue: string;
43
+ };
44
+ /**
45
+ * #slot
46
+ */
47
+ thresholdsPalette: {
48
+ type: string;
49
+ defaultValue: string[];
50
+ description: string;
51
+ };
52
+ /**
53
+ * #slot
54
+ */
55
+ thresholds: {
56
+ type: string;
57
+ defaultValue: string[];
58
+ description: string;
59
+ };
60
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
61
+ export default _default;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const configuration_1 = require("@jbrowse/core/configuration");
4
+ const mobx_state_tree_1 = require("mobx-state-tree");
5
+ /**
6
+ * #config DotplotRenderer
7
+ * #category renderer
8
+ */
9
+ function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
10
+ exports.default = (0, configuration_1.ConfigurationSchema)('DotplotRenderer', {
11
+ /**
12
+ * #slot
13
+ */
14
+ color: {
15
+ type: 'color',
16
+ description: 'the color of each feature in a synteny, used with colorBy:default',
17
+ defaultValue: '#f0f',
18
+ contextVariable: ['feature'],
19
+ },
20
+ /**
21
+ * #slot
22
+ */
23
+ posColor: {
24
+ type: 'color',
25
+ description: 'the color for forward alignments, used with colorBy:strand',
26
+ defaultValue: 'blue',
27
+ },
28
+ /**
29
+ * #slot
30
+ */
31
+ negColor: {
32
+ type: 'color',
33
+ description: 'the color for reverse alignments, used with colorBy:strand',
34
+ defaultValue: 'red',
35
+ },
36
+ /**
37
+ * #slot
38
+ */
39
+ lineWidth: {
40
+ type: 'number',
41
+ description: 'width of the lines to be drawn',
42
+ defaultValue: 2.5, // 2.5 is similar to D-GENIES
43
+ },
44
+ /**
45
+ * #slot
46
+ */
47
+ colorBy: {
48
+ type: 'stringEnum',
49
+ model: mobx_state_tree_1.types.enumeration('colorBy', [
50
+ 'identity',
51
+ 'meanQueryIdentity',
52
+ 'mappingQuality',
53
+ 'strand',
54
+ 'default',
55
+ ]),
56
+ description: `Color by options:<br/>
57
+ <ul>
58
+ <li>"identity" - the identity of the particular hit, similar to D-GENIES, use the other config slots 'thresholds' and 'thresholdsPalette' to define colors for this setting</li>
59
+ <li>"meanQueryIdentity" - calculates the weighted mean identity (weighted by alignment length) of all the hits that the query maps to (e.g. if the query is split aligned to many target, uses their weighted mean. can help show patterns of more related and distant synteny after WGD)</li>
60
+ <li>"mappingQuality" - uses mapping quality from PAF, some adapters don't have this setting</li>
61
+ <li>"strand" - colors negative alignments with negColor and positive alignments with posColor</li>
62
+ <li>"default" - uses the 'color' config slot</li>
63
+ </ul>`,
64
+ defaultValue: 'default',
65
+ },
66
+ /**
67
+ * #slot
68
+ */
69
+ thresholdsPalette: {
70
+ type: 'stringArray',
71
+ defaultValue: ['#094b09', '#2ebd40', '#d5670b', '#ffd84b'],
72
+ description: 'threshold colors, used with colorBy:identity',
73
+ },
74
+ /**
75
+ * #slot
76
+ */
77
+ thresholds: {
78
+ type: 'stringArray',
79
+ defaultValue: ['0.75', '0.5', '0.25', '0'],
80
+ description: 'threshold breakpoints, used with colorBy:identity',
81
+ },
82
+ }, { explicitlyTyped: true });
83
+ //# sourceMappingURL=configSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configSchema.js","sourceRoot":"","sources":["../../src/DotplotRenderer/configSchema.ts"],"names":[],"mappings":";;AAAA,+DAAiE;AACjE,qDAAuC;AAEvC;;;GAGG;AACH,SAAS,CAAC,KAAI,CAAC,CAAC,wDAAwD;AAExE,kBAAe,IAAA,mCAAmB,EAChC,iBAAiB,EACjB;IACE;;OAEG;IACH,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,WAAW,EACT,mEAAmE;QACrE,YAAY,EAAE,MAAM;QACpB,eAAe,EAAE,CAAC,SAAS,CAAC;KAC7B;IAED;;OAEG;IACH,QAAQ,EAAE;QACR,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,4DAA4D;QACzE,YAAY,EAAE,MAAM;KACrB;IACD;;OAEG;IACH,QAAQ,EAAE;QACR,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,4DAA4D;QACzE,YAAY,EAAE,KAAK;KACpB;IAED;;OAEG;IACH,SAAS,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,gCAAgC;QAC7C,YAAY,EAAE,GAAG,EAAE,6BAA6B;KACjD;IAED;;OAEG;IACH,OAAO,EAAE;QACP,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,uBAAK,CAAC,WAAW,CAAC,SAAS,EAAE;YAClC,UAAU;YACV,mBAAmB;YACnB,gBAAgB;YAChB,QAAQ;YACR,SAAS;SACV,CAAC;QACF,WAAW,EAAE;;;;;;;MAOb;QACA,YAAY,EAAE,SAAS;KACxB;IAED;;OAEG;IACH,iBAAiB,EAAE;QACjB,IAAI,EAAE,aAAa;QACnB,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;QAC1D,WAAW,EAAE,8CAA8C;KAC5D;IAED;;OAEG;IACH,UAAU,EAAE;QACV,IAAI,EAAE,aAAa;QACnB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC;QAC1C,WAAW,EAAE,mDAAmD;KACjE;CACF,EACD,EAAE,eAAe,EAAE,IAAI,EAAE,CAC1B,CAAA"}
@@ -0,0 +1,3 @@
1
+ import PluginManager from '@jbrowse/core/PluginManager';
2
+ declare const _default: (pluginManager: PluginManager) => void;
3
+ export default _default;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const DotplotRendering_1 = __importDefault(require("./components/DotplotRendering"));
7
+ const DotplotRenderer_1 = __importDefault(require("./DotplotRenderer"));
8
+ const configSchema_1 = __importDefault(require("./configSchema"));
9
+ exports.default = (pluginManager) => {
10
+ pluginManager.addRendererType(() => new DotplotRenderer_1.default({
11
+ name: 'DotplotRenderer',
12
+ configSchema: configSchema_1.default,
13
+ ReactComponent: DotplotRendering_1.default,
14
+ pluginManager,
15
+ }));
16
+ };
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/DotplotRenderer/index.ts"],"names":[],"mappings":";;;;;AACA,qFAA0D;AAC1D,wEAA+C;AAC/C,kEAAyC;AAEzC,kBAAe,CAAC,aAA4B,EAAE,EAAE;IAC9C,aAAa,CAAC,eAAe,CAC3B,GAAG,EAAE,CACH,IAAI,yBAAe,CAAC;QAClB,IAAI,EAAE,iBAAiB;QACvB,YAAY,EAAE,sBAAY;QAC1B,cAAc,EAAd,0BAAc;QACd,aAAa;KACd,CAAC,CACL,CAAA;AACH,CAAC,CAAA"}