@jbrowse/plugin-dotplot-view 3.6.5 → 4.0.0

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 (210) hide show
  1. package/esm/ComparativeRenderer/index.d.ts +10 -10
  2. package/esm/ComparativeRenderer/index.js +4 -17
  3. package/esm/DiagonalizeDotplotRpc.d.ts +30 -0
  4. package/esm/DiagonalizeDotplotRpc.js +147 -0
  5. package/esm/DotplotDisplay/components/DotplotDisplay.d.ts +1 -1
  6. package/esm/DotplotDisplay/index.d.ts +3 -3
  7. package/esm/DotplotDisplay/index.js +4 -4
  8. package/esm/DotplotDisplay/renderDotplotBlock.d.ts +2 -1
  9. package/esm/DotplotDisplay/renderDotplotBlock.js +9 -4
  10. package/esm/DotplotDisplay/stateModelFactory.d.ts +148 -29
  11. package/esm/DotplotDisplay/stateModelFactory.js +17 -11
  12. package/esm/DotplotReadVsRef/DotplotReadVsRef.js +5 -6
  13. package/esm/DotplotReadVsRef/index.js +1 -1
  14. package/esm/DotplotRenderer/DotplotRenderer.d.ts +30 -48
  15. package/esm/DotplotRenderer/DotplotRenderer.js +55 -22
  16. package/esm/DotplotRenderer/clamp.d.ts +7 -0
  17. package/esm/DotplotRenderer/clamp.js +58 -0
  18. package/esm/DotplotRenderer/components/DotplotRendering.d.ts +1 -1
  19. package/esm/DotplotRenderer/components/DotplotRendering.js +1 -1
  20. package/esm/DotplotRenderer/configSchema.d.ts +3 -3
  21. package/esm/DotplotRenderer/configSchema.js +1 -1
  22. package/esm/DotplotRenderer/drawDotplot.d.ts +7 -6
  23. package/esm/DotplotRenderer/drawDotplot.js +95 -100
  24. package/esm/DotplotRenderer/index.js +4 -4
  25. package/esm/DotplotView/1dview.d.ts +25 -25
  26. package/esm/DotplotView/1dview.js +16 -4
  27. package/esm/DotplotView/components/Axes.d.ts +1 -1
  28. package/esm/DotplotView/components/Axes.js +31 -41
  29. package/esm/DotplotView/components/ColorBySelector.d.ts +5 -0
  30. package/esm/DotplotView/components/ColorBySelector.js +73 -0
  31. package/esm/DotplotView/components/DiagonalizationProgressDialog.d.ts +6 -0
  32. package/esm/DotplotView/components/DiagonalizationProgressDialog.js +123 -0
  33. package/esm/DotplotView/components/DotplotControls.d.ts +1 -1
  34. package/esm/DotplotView/components/DotplotControls.js +53 -15
  35. package/esm/DotplotView/components/DotplotGrid.d.ts +6 -0
  36. package/esm/DotplotView/components/{Grid.js → DotplotGrid.js} +19 -20
  37. package/esm/DotplotView/components/DotplotGridWrapper.d.ts +6 -0
  38. package/esm/DotplotView/components/DotplotGridWrapper.js +8 -0
  39. package/esm/DotplotView/components/DotplotTooltipClick.d.ts +2 -2
  40. package/esm/DotplotView/components/DotplotTooltipClick.js +4 -4
  41. package/esm/DotplotView/components/DotplotTooltipMouseover.d.ts +1 -1
  42. package/esm/DotplotView/components/DotplotTooltipMouseover.js +2 -2
  43. package/esm/DotplotView/components/DotplotTooltips.d.ts +15 -0
  44. package/esm/DotplotView/components/DotplotTooltips.js +7 -0
  45. package/esm/DotplotView/components/DotplotView.d.ts +2 -2
  46. package/esm/DotplotView/components/DotplotView.js +31 -171
  47. package/esm/DotplotView/components/DotplotWarnings.d.ts +1 -1
  48. package/esm/DotplotView/components/DotplotWarnings.js +7 -7
  49. package/esm/DotplotView/components/ExportSvgDialog.d.ts +1 -1
  50. package/esm/DotplotView/components/Header.d.ts +1 -1
  51. package/esm/DotplotView/components/Header.js +5 -5
  52. package/esm/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.d.ts +1 -1
  53. package/esm/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +6 -5
  54. package/esm/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +1 -1
  55. package/esm/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.js +2 -3
  56. package/esm/DotplotView/components/ImportForm/TrackSelector.d.ts +10 -1
  57. package/esm/DotplotView/components/ImportForm/TrackSelector.js +8 -4
  58. package/esm/DotplotView/components/ImportForm/index.d.ts +1 -1
  59. package/esm/DotplotView/components/ImportForm/index.js +4 -10
  60. package/esm/DotplotView/components/ImportForm/selectors/AnchorsFileSelector.d.ts +1 -1
  61. package/esm/DotplotView/components/ImportForm/selectors/AnchorsFileSelector.js +2 -2
  62. package/esm/DotplotView/components/ImportForm/selectors/PifGzSelector.d.ts +1 -1
  63. package/esm/DotplotView/components/ImportForm/selectors/PifGzSelector.js +2 -2
  64. package/esm/DotplotView/components/ImportForm/selectors/SwapAssemblies.js +3 -3
  65. package/esm/DotplotView/components/ImportForm/selectors/SyntenyFileSelector.d.ts +1 -1
  66. package/esm/DotplotView/components/ImportForm/selectors/SyntenyFileSelector.js +3 -3
  67. package/esm/DotplotView/components/ImportForm/selectors/index.d.ts +3 -3
  68. package/esm/DotplotView/components/ImportForm/selectors/index.js +3 -3
  69. package/esm/DotplotView/components/MinLengthSlider.d.ts +5 -0
  70. package/esm/DotplotView/components/MinLengthSlider.js +39 -0
  71. package/esm/DotplotView/components/MouseInteractionLayer.d.ts +17 -0
  72. package/esm/DotplotView/components/MouseInteractionLayer.js +14 -0
  73. package/esm/DotplotView/components/OpacitySlider.d.ts +5 -0
  74. package/esm/DotplotView/components/OpacitySlider.js +37 -0
  75. package/esm/DotplotView/components/PanButtons.d.ts +1 -1
  76. package/esm/DotplotView/components/PanButtons.js +1 -1
  77. package/esm/DotplotView/components/SelectionContextMenu.d.ts +13 -0
  78. package/esm/DotplotView/components/SelectionContextMenu.js +39 -0
  79. package/esm/DotplotView/components/SliderTooltip.d.ts +2 -0
  80. package/esm/DotplotView/components/SliderTooltip.js +6 -0
  81. package/esm/DotplotView/components/WarningDialog.js +1 -1
  82. package/esm/DotplotView/components/hooks/useCtrlKeyTracking.d.ts +1 -0
  83. package/esm/DotplotView/components/hooks/useCtrlKeyTracking.js +21 -0
  84. package/esm/DotplotView/components/hooks/useCursorMode.d.ts +7 -0
  85. package/esm/DotplotView/components/hooks/useCursorMode.js +16 -0
  86. package/esm/DotplotView/components/hooks/useMouseCoordinates.d.ts +29 -0
  87. package/esm/DotplotView/components/hooks/useMouseCoordinates.js +49 -0
  88. package/esm/DotplotView/components/hooks/useMouseMoveHandler.d.ts +6 -0
  89. package/esm/DotplotView/components/hooks/useMouseMoveHandler.js +24 -0
  90. package/esm/DotplotView/components/hooks/useMouseUpHandler.d.ts +3 -0
  91. package/esm/DotplotView/components/hooks/useMouseUpHandler.js +28 -0
  92. package/esm/DotplotView/components/hooks/useWheelHandler.d.ts +8 -0
  93. package/esm/DotplotView/components/hooks/useWheelHandler.js +44 -0
  94. package/esm/DotplotView/components/util.d.ts +1 -1
  95. package/esm/DotplotView/components/util.js +18 -8
  96. package/esm/DotplotView/index.js +2 -2
  97. package/esm/DotplotView/model.d.ts +213 -90
  98. package/esm/DotplotView/model.js +147 -93
  99. package/esm/DotplotView/svgcomponents/SVGDotplotView.d.ts +1 -1
  100. package/esm/DotplotView/svgcomponents/SVGDotplotView.js +5 -6
  101. package/esm/DotplotView/types.d.ts +7 -1
  102. package/esm/LaunchDotplotView.js +6 -36
  103. package/esm/ServerSideRenderedBlockContent.js +6 -27
  104. package/esm/ServerSideSyntenyRendering.d.ts +1 -1
  105. package/esm/ServerSideSyntenyRendering.js +1 -1
  106. package/esm/index.d.ts +1 -0
  107. package/esm/index.js +9 -10
  108. package/esm/util.d.ts +1 -1
  109. package/package.json +28 -35
  110. package/dist/ComparativeRenderer/index.d.ts +0 -22
  111. package/dist/ComparativeRenderer/index.js +0 -53
  112. package/dist/DotplotDisplay/components/DotplotDisplay.d.ts +0 -6
  113. package/dist/DotplotDisplay/components/DotplotDisplay.js +0 -18
  114. package/dist/DotplotDisplay/index.d.ts +0 -5
  115. package/dist/DotplotDisplay/index.js +0 -36
  116. package/dist/DotplotDisplay/renderDotplotBlock.d.ts +0 -11
  117. package/dist/DotplotDisplay/renderDotplotBlock.js +0 -49
  118. package/dist/DotplotDisplay/stateModelFactory.d.ts +0 -102
  119. package/dist/DotplotDisplay/stateModelFactory.js +0 -119
  120. package/dist/DotplotReadVsRef/DotplotReadVsRef.d.ts +0 -3
  121. package/dist/DotplotReadVsRef/DotplotReadVsRef.js +0 -100
  122. package/dist/DotplotReadVsRef/index.d.ts +0 -2
  123. package/dist/DotplotReadVsRef/index.js +0 -41
  124. package/dist/DotplotRenderer/ComparativeRenderRpc.d.ts +0 -22
  125. package/dist/DotplotRenderer/ComparativeRenderRpc.js +0 -53
  126. package/dist/DotplotRenderer/DotplotRenderer.d.ts +0 -74
  127. package/dist/DotplotRenderer/DotplotRenderer.js +0 -102
  128. package/dist/DotplotRenderer/components/DotplotRendering.d.ts +0 -3
  129. package/dist/DotplotRenderer/components/DotplotRendering.js +0 -9
  130. package/dist/DotplotRenderer/configSchema.d.ts +0 -40
  131. package/dist/DotplotRenderer/configSchema.js +0 -57
  132. package/dist/DotplotRenderer/drawDotplot.d.ts +0 -21
  133. package/dist/DotplotRenderer/drawDotplot.js +0 -213
  134. package/dist/DotplotRenderer/index.d.ts +0 -2
  135. package/dist/DotplotRenderer/index.js +0 -17
  136. package/dist/DotplotView/1dview.d.ts +0 -199
  137. package/dist/DotplotView/1dview.js +0 -63
  138. package/dist/DotplotView/components/Axes.d.ts +0 -13
  139. package/dist/DotplotView/components/Axes.js +0 -107
  140. package/dist/DotplotView/components/CursorIcon.d.ts +0 -3
  141. package/dist/DotplotView/components/CursorIcon.js +0 -15
  142. package/dist/DotplotView/components/DotplotControls.d.ts +0 -5
  143. package/dist/DotplotView/components/DotplotControls.js +0 -115
  144. package/dist/DotplotView/components/DotplotTooltipClick.d.ts +0 -10
  145. package/dist/DotplotView/components/DotplotTooltipClick.js +0 -17
  146. package/dist/DotplotView/components/DotplotTooltipMouseover.d.ts +0 -9
  147. package/dist/DotplotView/components/DotplotTooltipMouseover.js +0 -16
  148. package/dist/DotplotView/components/DotplotView.d.ts +0 -5
  149. package/dist/DotplotView/components/DotplotView.js +0 -275
  150. package/dist/DotplotView/components/DotplotWarnings.d.ts +0 -5
  151. package/dist/DotplotView/components/DotplotWarnings.js +0 -53
  152. package/dist/DotplotView/components/ExportSvgDialog.d.ts +0 -7
  153. package/dist/DotplotView/components/ExportSvgDialog.js +0 -53
  154. package/dist/DotplotView/components/Grid.d.ts +0 -9
  155. package/dist/DotplotView/components/Grid.js +0 -47
  156. package/dist/DotplotView/components/Header.d.ts +0 -9
  157. package/dist/DotplotView/components/Header.js +0 -33
  158. package/dist/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.d.ts +0 -7
  159. package/dist/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +0 -78
  160. package/dist/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +0 -7
  161. package/dist/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.js +0 -42
  162. package/dist/DotplotView/components/ImportForm/TrackSelector.d.ts +0 -7
  163. package/dist/DotplotView/components/ImportForm/TrackSelector.js +0 -23
  164. package/dist/DotplotView/components/ImportForm/getAdapter.d.ts +0 -117
  165. package/dist/DotplotView/components/ImportForm/getAdapter.js +0 -68
  166. package/dist/DotplotView/components/ImportForm/index.d.ts +0 -5
  167. package/dist/DotplotView/components/ImportForm/index.js +0 -76
  168. package/dist/DotplotView/components/ImportForm/selectors/AnchorsFileSelector.d.ts +0 -3
  169. package/dist/DotplotView/components/ImportForm/selectors/AnchorsFileSelector.js +0 -23
  170. package/dist/DotplotView/components/ImportForm/selectors/PifGzSelector.d.ts +0 -3
  171. package/dist/DotplotView/components/ImportForm/selectors/PifGzSelector.js +0 -13
  172. package/dist/DotplotView/components/ImportForm/selectors/SelectorTypes.d.ts +0 -23
  173. package/dist/DotplotView/components/ImportForm/selectors/SelectorTypes.js +0 -10
  174. package/dist/DotplotView/components/ImportForm/selectors/SwapAssemblies.d.ts +0 -13
  175. package/dist/DotplotView/components/ImportForm/selectors/SwapAssemblies.js +0 -32
  176. package/dist/DotplotView/components/ImportForm/selectors/SyntenyFileSelector.d.ts +0 -3
  177. package/dist/DotplotView/components/ImportForm/selectors/SyntenyFileSelector.js +0 -24
  178. package/dist/DotplotView/components/ImportForm/selectors/index.d.ts +0 -3
  179. package/dist/DotplotView/components/ImportForm/selectors/index.js +0 -12
  180. package/dist/DotplotView/components/ImportForm/util.d.ts +0 -10
  181. package/dist/DotplotView/components/ImportForm/util.js +0 -24
  182. package/dist/DotplotView/components/PanButtons.d.ts +0 -5
  183. package/dist/DotplotView/components/PanButtons.js +0 -47
  184. package/dist/DotplotView/components/WarningDialog.d.ts +0 -16
  185. package/dist/DotplotView/components/WarningDialog.js +0 -39
  186. package/dist/DotplotView/components/util.d.ts +0 -14
  187. package/dist/DotplotView/components/util.js +0 -82
  188. package/dist/DotplotView/index.d.ts +0 -2
  189. package/dist/DotplotView/index.js +0 -52
  190. package/dist/DotplotView/model.d.ts +0 -435
  191. package/dist/DotplotView/model.js +0 -487
  192. package/dist/DotplotView/svgcomponents/SVGBackground.d.ts +0 -4
  193. package/dist/DotplotView/svgcomponents/SVGBackground.js +0 -10
  194. package/dist/DotplotView/svgcomponents/SVGDotplotView.d.ts +0 -2
  195. package/dist/DotplotView/svgcomponents/SVGDotplotView.js +0 -30
  196. package/dist/DotplotView/types.d.ts +0 -12
  197. package/dist/DotplotView/types.js +0 -2
  198. package/dist/LaunchDotplotView.d.ts +0 -2
  199. package/dist/LaunchDotplotView.js +0 -43
  200. package/dist/ServerSideRenderedBlockContent.d.ts +0 -12
  201. package/dist/ServerSideRenderedBlockContent.js +0 -65
  202. package/dist/ServerSideSyntenyRendering.d.ts +0 -13
  203. package/dist/ServerSideSyntenyRendering.js +0 -23
  204. package/dist/index.d.ts +0 -7
  205. package/dist/index.js +0 -40
  206. package/dist/util.d.ts +0 -9
  207. package/dist/util.js +0 -7
  208. package/esm/DotplotRenderer/ComparativeRenderRpc.d.ts +0 -22
  209. package/esm/DotplotRenderer/ComparativeRenderRpc.js +0 -47
  210. package/esm/DotplotView/components/Grid.d.ts +0 -9
@@ -3,15 +3,16 @@ import { ConfigurationReference, getConf } from '@jbrowse/core/configuration';
3
3
  import { BaseDisplay } from '@jbrowse/core/pluggableElementTypes/models';
4
4
  import { ReactRendering, getContainingView, makeAbortableReaction, } from '@jbrowse/core/util';
5
5
  import { getParentRenderProps } from '@jbrowse/core/util/tracks';
6
- import { types } from 'mobx-state-tree';
7
- import ServerSideRenderedBlockContent from '../ServerSideRenderedBlockContent';
8
- import { renderBlockData, renderBlockEffect } from './renderDotplotBlock';
6
+ import { types } from '@jbrowse/mobx-state-tree';
7
+ import ServerSideRenderedBlockContent from "../ServerSideRenderedBlockContent.js";
8
+ import { renderBlockData, renderBlockEffect } from "./renderDotplotBlock.js";
9
9
  export function stateModelFactory(configSchema) {
10
10
  return types
11
11
  .compose('DotplotDisplay', BaseDisplay, types
12
12
  .model({
13
13
  type: types.literal('DotplotDisplay'),
14
14
  configuration: ConfigurationReference(configSchema),
15
+ colorBy: types.optional(types.string, 'default'),
15
16
  })
16
17
  .volatile(() => ({
17
18
  stopToken: undefined,
@@ -22,6 +23,8 @@ export function stateModelFactory(configSchema) {
22
23
  message: undefined,
23
24
  renderingComponent: undefined,
24
25
  ReactComponent2: ServerSideRenderedBlockContent,
26
+ alpha: 1,
27
+ minAlignmentLength: 0,
25
28
  })))
26
29
  .views(self => ({
27
30
  get shouldDisplay() {
@@ -36,7 +39,6 @@ export function stateModelFactory(configSchema) {
36
39
  return {
37
40
  ...getParentRenderProps(self),
38
41
  rpcDriverName: self.rpcDriverName,
39
- displayModel: self,
40
42
  config: self.configuration.renderer,
41
43
  };
42
44
  },
@@ -47,9 +49,10 @@ export function stateModelFactory(configSchema) {
47
49
  if (!props) {
48
50
  return null;
49
51
  }
50
- const { rendererType, rpcManager, renderProps } = props;
52
+ const { rendererType, rpcManager, renderProps, renderingProps } = props;
51
53
  const rendering = await rendererType.renderInClient(rpcManager, {
52
54
  ...renderProps,
55
+ renderingProps,
53
56
  exportSVG: opts,
54
57
  theme: opts.theme || renderProps.theme,
55
58
  });
@@ -77,13 +80,7 @@ export function stateModelFactory(configSchema) {
77
80
  self.stopToken = stopToken;
78
81
  },
79
82
  setMessage(messageText) {
80
- self.filled = false;
81
83
  self.message = messageText;
82
- self.reactElement = undefined;
83
- self.data = undefined;
84
- self.error = undefined;
85
- self.renderingComponent = undefined;
86
- self.stopToken = undefined;
87
84
  },
88
85
  setRendered(args) {
89
86
  if (args === undefined) {
@@ -109,5 +106,14 @@ export function stateModelFactory(configSchema) {
109
106
  self.renderingComponent = undefined;
110
107
  self.stopToken = undefined;
111
108
  },
109
+ setAlpha(value) {
110
+ self.alpha = value;
111
+ },
112
+ setMinAlignmentLength(value) {
113
+ self.minAlignmentLength = value;
114
+ },
115
+ setColorBy(value) {
116
+ self.colorBy = value;
117
+ },
112
118
  }));
113
119
  }
@@ -3,11 +3,10 @@ import { gatherOverlaps, getSession, sum } from '@jbrowse/core/util';
3
3
  import { MismatchParser } from '@jbrowse/plugin-alignments';
4
4
  const { featurizeSA, getClip, getLength, getLengthSansClipping } = MismatchParser;
5
5
  export function onClick(feature, self) {
6
- var _a;
7
6
  const session = getSession(self);
8
7
  try {
9
8
  const cigar = feature.get('CIGAR');
10
- const clipPos = getClip(cigar, 1);
9
+ const clipLengthAtStartOfRead = getClip(cigar, 1);
11
10
  const flags = feature.get('flags');
12
11
  const strand = feature.get('strand');
13
12
  const readName = feature.get('name');
@@ -17,7 +16,7 @@ export function onClick(feature, self) {
17
16
  const assemblyNames = [trackAssembly, readAssembly];
18
17
  const trackId = `track-${Date.now()}`;
19
18
  const trackName = `${readName}_vs_${trackAssembly}`;
20
- const SA = (_a = feature.get('tags')) === null || _a === void 0 ? void 0 : _a.SA;
19
+ const SA = feature.get('tags')?.SA;
21
20
  const SA2 = featurizeSA(SA, feature.id(), strand, readName, true);
22
21
  const totalLength = getLength(flags & 2048 ? SA2[0].CIGAR : cigar);
23
22
  const features = [
@@ -26,12 +25,12 @@ export function onClick(feature, self) {
26
25
  strand: 1,
27
26
  mate: {
28
27
  refName: readName,
29
- start: clipPos,
30
- end: clipPos + getLengthSansClipping(cigar),
28
+ start: clipLengthAtStartOfRead,
29
+ end: clipLengthAtStartOfRead + getLengthSansClipping(cigar),
31
30
  },
32
31
  },
33
32
  ...SA2,
34
- ].sort((a, b) => a.clipPos - b.clipPos);
33
+ ].sort((a, b) => a.clipLengthAtStartOfRead - b.clipLengthAtStartOfRead);
35
34
  session.addView('DotplotView', {
36
35
  type: 'DotplotView',
37
36
  hview: {
@@ -1,5 +1,5 @@
1
1
  import AddIcon from '@mui/icons-material/Add';
2
- import { onClick } from './DotplotReadVsRef';
2
+ import { onClick } from "./DotplotReadVsRef.js";
3
3
  export default function DotplotReadVsRefMenuItem(pluginManager) {
4
4
  pluginManager.addToExtensionPoint('Core-extendPluggableElement', (pluggableElement) => {
5
5
  if (pluggableElement.name === 'LinearPileupDisplay') {
@@ -1,8 +1,23 @@
1
- import ComparativeRenderer from '@jbrowse/core/pluggableElementTypes/renderers/ComparativeServerSideRendererType';
2
- import type { Dotplot1DViewModel } from '../DotplotView/model';
1
+ import ServerSideRenderer from '@jbrowse/core/pluggableElementTypes/renderers/ServerSideRendererType';
2
+ import type { Dotplot1DViewModel } from '../DotplotView/model.ts';
3
3
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
- import type { RenderArgs, RenderArgsDeserialized } from '@jbrowse/core/pluggableElementTypes/renderers/ComparativeServerSideRendererType';
4
+ import type { RenderArgs as ServerSideRenderArgs, RenderArgsDeserialized as ServerSideRenderArgsDeserialized, RenderArgsSerialized as ServerSideRenderArgsSerialized, ResultsDeserialized as ServerSideResultsDeserialized, ResultsSerialized as ServerSideResultsSerialized } from '@jbrowse/core/pluggableElementTypes/renderers/ServerSideRendererType';
5
+ import type SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain';
6
+ import type RpcManager from '@jbrowse/core/rpc/RpcManager';
5
7
  import type { Region } from '@jbrowse/core/util';
8
+ export interface RenderArgs extends ServerSideRenderArgs {
9
+ blockKey: string;
10
+ }
11
+ export interface RenderArgsSerialized extends ServerSideRenderArgsSerialized {
12
+ blockKey: string;
13
+ }
14
+ export interface RenderArgsDeserialized extends ServerSideRenderArgsDeserialized {
15
+ blockKey: string;
16
+ }
17
+ export type ResultsSerialized = ServerSideResultsSerialized;
18
+ export interface ResultsDeserialized extends ServerSideResultsDeserialized {
19
+ blockKey: string;
20
+ }
6
21
  export interface DotplotRenderArgsDeserialized extends RenderArgsDeserialized {
7
22
  adapterConfig: AnyConfigurationModel;
8
23
  height: number;
@@ -13,7 +28,7 @@ export interface DotplotRenderArgsDeserialized extends RenderArgsDeserialized {
13
28
  vview: Dotplot1DViewModel;
14
29
  };
15
30
  }
16
- interface DotplotRenderArgs extends RenderArgs {
31
+ export interface DotplotRenderArgs extends RenderArgs {
17
32
  adapterConfig: AnyConfigurationModel;
18
33
  sessionId: string;
19
34
  view: {
@@ -25,50 +40,17 @@ interface DotplotRenderArgs extends RenderArgs {
25
40
  };
26
41
  };
27
42
  }
28
- export default class DotplotRenderer extends ComparativeRenderer {
43
+ export default class DotplotRenderer extends ServerSideRenderer {
29
44
  supportsSVG: boolean;
30
45
  renameRegionsIfNeeded(args: DotplotRenderArgs): Promise<DotplotRenderArgs>;
31
- render(renderProps: DotplotRenderArgsDeserialized): Promise<{
32
- height: number;
33
- width: number;
34
- offsetX: number;
35
- offsetY: number;
36
- bpPerPxX: number;
37
- bpPerPxY: number;
38
- warnings: {
39
- message: string;
40
- effect: string;
41
- }[];
42
- canvasRecordedData: Record<string, unknown>;
43
- reactElement?: React.ReactElement;
44
- html?: string;
45
- } | {
46
- height: number;
47
- width: number;
48
- offsetX: number;
49
- offsetY: number;
50
- bpPerPxX: number;
51
- bpPerPxY: number;
52
- warnings: {
53
- message: string;
54
- effect: string;
55
- }[];
56
- imageData: any;
57
- reactElement?: React.ReactElement;
58
- html?: string;
59
- } | {
60
- height: number;
61
- width: number;
62
- offsetX: number;
63
- offsetY: number;
64
- bpPerPxX: number;
65
- bpPerPxY: number;
66
- warnings: {
67
- message: string;
68
- effect: string;
69
- }[];
70
- reactElement: React.ReactElement;
71
- html?: string;
72
- }>;
46
+ serializeArgsInClient(args: RenderArgs): ServerSideRenderArgsSerialized;
47
+ deserializeResultsInClient(result: ResultsSerialized, args: RenderArgs): ResultsDeserialized;
48
+ renderInClient(rpcManager: RpcManager, args: RenderArgs): Promise<ServerSideResultsSerialized>;
49
+ getFeatures(renderArgs: {
50
+ regions: Region[];
51
+ sessionId: string;
52
+ adapterConfig: AnyConfigurationModel;
53
+ filters?: SerializableFilterChain;
54
+ }): Promise<import("@jbrowse/core/util").Feature[]>;
55
+ render(renderProps: DotplotRenderArgsDeserialized): Promise<import("librpc-web-mod").RpcResult>;
73
56
  }
74
- export {};
@@ -1,15 +1,26 @@
1
- import ComparativeRenderer from '@jbrowse/core/pluggableElementTypes/renderers/ComparativeServerSideRendererType';
2
- import { renameRegionsIfNeeded, renderToAbstractCanvas, } from '@jbrowse/core/util';
3
- import { Dotplot1DView } from '../DotplotView/model';
4
- export default class DotplotRenderer extends ComparativeRenderer {
5
- constructor() {
6
- super(...arguments);
7
- this.supportsSVG = true;
8
- }
1
+ import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
2
+ import ServerSideRenderer from '@jbrowse/core/pluggableElementTypes/renderers/ServerSideRendererType';
3
+ import { dedupe, getSerializedSvg, renameRegionsIfNeeded, renderToAbstractCanvas, } from '@jbrowse/core/util';
4
+ import { rpcResult } from '@jbrowse/core/util/librpc';
5
+ import { collectTransferables } from '@jbrowse/core/util/offscreenCanvasPonyfill';
6
+ import { firstValueFrom } from 'rxjs';
7
+ import { filter, toArray } from 'rxjs/operators';
8
+ import { Dotplot1DView } from "../DotplotView/model.js";
9
+ function isCanvasRecordedSvgExport(e) {
10
+ return 'canvasRecordedData' in e;
11
+ }
12
+ function normalizeRegion(r) {
13
+ return {
14
+ ...r,
15
+ start: Math.floor(r.start),
16
+ end: Math.ceil(r.end),
17
+ };
18
+ }
19
+ export default class DotplotRenderer extends ServerSideRenderer {
20
+ supportsSVG = true;
9
21
  async renameRegionsIfNeeded(args) {
10
- var _a, _b;
11
22
  const pm = this.pluginManager;
12
- const assemblyManager = (_b = (_a = pm.rootModel) === null || _a === void 0 ? void 0 : _a.session) === null || _b === void 0 ? void 0 : _b.assemblyManager;
23
+ const assemblyManager = pm.rootModel?.session?.assemblyManager;
13
24
  const { view, sessionId, adapterConfig } = args;
14
25
  async function process(regions) {
15
26
  if (!assemblyManager) {
@@ -26,8 +37,36 @@ export default class DotplotRenderer extends ComparativeRenderer {
26
37
  view.vview.displayedRegions = await process(view.vview.displayedRegions);
27
38
  return args;
28
39
  }
40
+ serializeArgsInClient(args) {
41
+ const { displayModel, ...serializable } = args;
42
+ return super.serializeArgsInClient(serializable);
43
+ }
44
+ deserializeResultsInClient(result, args) {
45
+ return {
46
+ ...super.deserializeResultsInClient(result, args),
47
+ blockKey: args.blockKey,
48
+ };
49
+ }
50
+ async renderInClient(rpcManager, args) {
51
+ const results = (await rpcManager.call(args.sessionId, 'ComparativeRender', args));
52
+ if (isCanvasRecordedSvgExport(results)) {
53
+ const { reactElement: _, ...rest } = results;
54
+ return {
55
+ ...rest,
56
+ html: await getSerializedSvg(results),
57
+ };
58
+ }
59
+ return results;
60
+ }
61
+ async getFeatures(renderArgs) {
62
+ const { regions, sessionId, adapterConfig, filters } = renderArgs;
63
+ const { dataAdapter } = await getAdapter(this.pluginManager, sessionId, adapterConfig);
64
+ const res = await firstValueFrom(dataAdapter
65
+ .getFeaturesInMultipleRegions(regions.map(r => normalizeRegion(r)), renderArgs)
66
+ .pipe(filter(f => (filters ? filters.passes(f, renderArgs) : true)), toArray()));
67
+ return dedupe(res, f => f.id());
68
+ }
29
69
  async render(renderProps) {
30
- var _a, _b;
31
70
  const { width, height, view: { hview, vview }, } = renderProps;
32
71
  const dimensions = [width, height];
33
72
  const views = [hview, vview].map((snap, idx) => {
@@ -41,23 +80,17 @@ export default class DotplotRenderer extends ComparativeRenderer {
41
80
  regions: target.dynamicBlocks.contentBlocks,
42
81
  });
43
82
  target.setFeatures(feats);
44
- const { drawDotplot } = await import('./drawDotplot');
83
+ const { drawDotplot } = await import("./drawDotplot.js");
45
84
  const ret = await renderToAbstractCanvas(width, height, renderProps, ctx => drawDotplot(ctx, { ...renderProps, views }));
46
- const results = await super.render({
47
- ...renderProps,
48
- ...ret,
49
- height,
50
- width,
51
- });
52
- return {
53
- ...results,
85
+ const serialized = {
54
86
  ...ret,
55
87
  height,
56
88
  width,
57
- offsetX: ((_a = views[0].dynamicBlocks.blocks[0]) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0,
58
- offsetY: ((_b = views[1].dynamicBlocks.blocks[0]) === null || _b === void 0 ? void 0 : _b.offsetPx) || 0,
89
+ offsetX: views[0].dynamicBlocks.blocks[0]?.offsetPx || 0,
90
+ offsetY: views[1].dynamicBlocks.blocks[0]?.offsetPx || 0,
59
91
  bpPerPxX: views[0].bpPerPx,
60
92
  bpPerPxY: views[1].bpPerPx,
61
93
  };
94
+ return rpcResult(serialized, collectTransferables(ret));
62
95
  }
63
96
  }
@@ -0,0 +1,7 @@
1
+ import type { Feature } from '@jbrowse/core/util';
2
+ export declare function clampWithWarnX(num: number, min: number, max: number, feature: Feature, warnings: Warning[]): number;
3
+ export declare function clampWithWarnY(num: number, min: number, max: number, feature: Feature, warnings: Warning[]): number;
4
+ export interface Warning {
5
+ message: string;
6
+ effect: string;
7
+ }
@@ -0,0 +1,58 @@
1
+ const r = 'fell outside of range due to CIGAR string';
2
+ const lt = '(less than min coordinate of feature)';
3
+ const gt = '(greater than max coordinate of feature)';
4
+ const fudgeFactor = 1;
5
+ export function clampWithWarnX(num, min, max, feature, warnings) {
6
+ const strand = feature.get('strand') || 1;
7
+ if (strand === -1) {
8
+ ;
9
+ [max, min] = [min, max];
10
+ }
11
+ if (num < min - fudgeFactor) {
12
+ let start = feature.get('start');
13
+ let end = feature.get('end');
14
+ const refName = feature.get('refName');
15
+ if (strand === -1) {
16
+ ;
17
+ [end, start] = [start, end];
18
+ }
19
+ warnings.push({
20
+ message: `feature at (X ${refName}:${start}-${end}) ${r} ${lt}`,
21
+ effect: 'clipped the feature',
22
+ });
23
+ return min;
24
+ }
25
+ if (num > max + fudgeFactor) {
26
+ const strand = feature.get('strand') || 1;
27
+ const start = strand === 1 ? feature.get('start') : feature.get('end');
28
+ const end = strand === 1 ? feature.get('end') : feature.get('start');
29
+ const refName = feature.get('refName');
30
+ warnings.push({
31
+ message: `feature at (X ${refName}:${start}-${end}) ${r} ${gt}`,
32
+ effect: 'clipped the feature',
33
+ });
34
+ return max;
35
+ }
36
+ return num;
37
+ }
38
+ export function clampWithWarnY(num, min, max, feature, warnings) {
39
+ if (num < min - fudgeFactor) {
40
+ const mate = feature.get('mate');
41
+ const { refName, start, end } = mate;
42
+ warnings.push({
43
+ message: `feature at (Y ${refName}:${start}-${end}) ${r} ${lt}`,
44
+ effect: 'clipped the feature',
45
+ });
46
+ return min;
47
+ }
48
+ if (num > max + fudgeFactor) {
49
+ const mate = feature.get('mate');
50
+ const { refName, start, end } = mate;
51
+ warnings.push({
52
+ message: `feature at (Y ${refName}:${start}-${end}) ${r} ${gt}`,
53
+ effect: 'clipped the feature',
54
+ });
55
+ return max;
56
+ }
57
+ return num;
58
+ }
@@ -1,3 +1,3 @@
1
- import type { DotplotRenderArgsDeserialized } from '../DotplotRenderer';
1
+ import type { DotplotRenderArgsDeserialized } from '../DotplotRenderer.ts';
2
2
  declare const DotplotRendering: (props: DotplotRenderArgsDeserialized) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DotplotRendering;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { PrerenderedCanvas } from '@jbrowse/core/ui';
3
3
  import { observer } from 'mobx-react';
4
- const DotplotRendering = observer(function (props) {
4
+ const DotplotRendering = observer(function DotplotRendering(props) {
5
5
  return _jsx(PrerenderedCanvas, { ...props });
6
6
  });
7
7
  export default DotplotRendering;
@@ -1,4 +1,4 @@
1
- declare const _default: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const _default: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  color: {
3
3
  type: string;
4
4
  description: string;
@@ -22,7 +22,7 @@ declare const _default: import("@jbrowse/core/configuration/configurationSchema"
22
22
  };
23
23
  colorBy: {
24
24
  type: string;
25
- model: import("mobx-state-tree").ISimpleType<string>;
25
+ model: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
26
26
  description: string;
27
27
  defaultValue: string;
28
28
  };
@@ -36,5 +36,5 @@ declare const _default: import("@jbrowse/core/configuration/configurationSchema"
36
36
  defaultValue: string[];
37
37
  description: string;
38
38
  };
39
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
39
+ }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
40
40
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
- import { types } from 'mobx-state-tree';
2
+ import { types } from '@jbrowse/mobx-state-tree';
3
3
  function x() { }
4
4
  export default ConfigurationSchema('DotplotRenderer', {
5
5
  color: {
@@ -1,11 +1,15 @@
1
- import type { Dotplot1DViewModel } from '../DotplotView/model';
1
+ import { type Warning } from './clamp.ts';
2
+ import type { RenderArgsDeserialized } from './DotplotRenderer.ts';
3
+ import type { Dotplot1DViewModel } from '../DotplotView/model.ts';
2
4
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
- import type { RenderArgsDeserialized } from '@jbrowse/core/pluggableElementTypes/renderers/ComparativeServerSideRendererType';
4
5
  export interface DotplotRenderArgsDeserialized extends RenderArgsDeserialized {
5
6
  adapterConfig: AnyConfigurationModel;
6
7
  height: number;
7
8
  width: number;
8
9
  highResolutionScaling: number;
10
+ alpha?: number;
11
+ minAlignmentLength?: number;
12
+ colorBy?: string;
9
13
  view: {
10
14
  hview: Dotplot1DViewModel;
11
15
  vview: Dotplot1DViewModel;
@@ -14,8 +18,5 @@ export interface DotplotRenderArgsDeserialized extends RenderArgsDeserialized {
14
18
  export declare function drawDotplot(ctx: CanvasRenderingContext2D, props: DotplotRenderArgsDeserialized & {
15
19
  views: Dotplot1DViewModel[];
16
20
  }): Promise<{
17
- warnings: {
18
- message: string;
19
- effect: string;
20
- }[];
21
+ warnings: Warning[];
21
22
  }>;