@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
@@ -1,91 +1,49 @@
1
1
  import { readConfObject } from '@jbrowse/core/configuration';
2
2
  import { createJBrowseTheme } from '@jbrowse/core/ui';
3
+ import { category10 } from '@jbrowse/core/ui/colors';
3
4
  import { bpToPx } from '@jbrowse/core/util/Base1DUtils';
5
+ import { colord } from '@jbrowse/core/util/colord';
6
+ import { getSnapshot } from '@jbrowse/mobx-state-tree';
4
7
  import { MismatchParser } from '@jbrowse/plugin-alignments';
5
- import { getSnapshot } from 'mobx-state-tree';
8
+ import { clampWithWarnX, clampWithWarnY } from "./clamp.js";
6
9
  const { parseCigar } = MismatchParser;
7
- const r = 'fell outside of range due to CIGAR string';
8
- const lt = '(less than min coordinate of feature)';
9
- const gt = '(greater than max coordinate of feature)';
10
- const fudgeFactor = 1;
11
- function drawCir(ctx, x, y, r = 1) {
12
- ctx.beginPath();
13
- ctx.arc(x, y, r / 2, 0, 2 * Math.PI);
14
- ctx.fill();
10
+ function hashString(str) {
11
+ let hash = 0;
12
+ for (let i = 0; i < str.length; i++) {
13
+ const char = str.charCodeAt(i);
14
+ hash = (hash << 5) - hash + char;
15
+ hash = hash & hash;
16
+ }
17
+ return Math.abs(hash);
18
+ }
19
+ function getQueryColor(queryName) {
20
+ const hash = hashString(queryName);
21
+ return category10[hash % category10.length];
22
+ }
23
+ function applyAlpha(color, alpha) {
24
+ if (alpha === 1) {
25
+ return color;
26
+ }
27
+ return colord(color).alpha(alpha).toRgbString();
15
28
  }
16
29
  export async function drawDotplot(ctx, props) {
17
- var _a, _b;
18
- const { config, views, height, drawCigar, theme } = props;
30
+ const { config, views, height, drawCigar, theme, alpha = 1, minAlignmentLength = 0, colorBy: colorByOverride, } = props;
19
31
  const color = readConfObject(config, 'color');
20
32
  const posColor = readConfObject(config, 'posColor');
21
33
  const negColor = readConfObject(config, 'negColor');
22
- const colorBy = readConfObject(config, 'colorBy');
34
+ const colorBy = colorByOverride ?? readConfObject(config, 'colorBy');
23
35
  const lineWidth = readConfObject(config, 'lineWidth');
24
36
  const thresholds = readConfObject(config, 'thresholds');
25
37
  const palette = readConfObject(config, 'thresholdsPalette');
26
38
  const isCallback = config.color.isCallback;
27
39
  const hview = views[0];
28
40
  const vview = views[1];
29
- const db1 = (_a = hview.dynamicBlocks.contentBlocks[0]) === null || _a === void 0 ? void 0 : _a.offsetPx;
30
- const db2 = (_b = vview.dynamicBlocks.contentBlocks[0]) === null || _b === void 0 ? void 0 : _b.offsetPx;
41
+ const db1 = hview.dynamicBlocks.contentBlocks[0]?.offsetPx;
42
+ const db2 = vview.dynamicBlocks.contentBlocks[0]?.offsetPx;
31
43
  const warnings = [];
32
44
  ctx.lineWidth = lineWidth;
33
45
  const { bpPerPx: hBpPerPx } = hview;
34
46
  const { bpPerPx: vBpPerPx } = vview;
35
- function clampWithWarnX(num, min, max, feature) {
36
- const strand = feature.get('strand') || 1;
37
- if (strand === -1) {
38
- ;
39
- [max, min] = [min, max];
40
- }
41
- if (num < min - fudgeFactor) {
42
- let start = feature.get('start');
43
- let end = feature.get('end');
44
- const refName = feature.get('refName');
45
- if (strand === -1) {
46
- ;
47
- [end, start] = [start, end];
48
- }
49
- warnings.push({
50
- message: `feature at (X ${refName}:${start}-${end}) ${r} ${lt}`,
51
- effect: 'clipped the feature',
52
- });
53
- return min;
54
- }
55
- if (num > max + fudgeFactor) {
56
- const strand = feature.get('strand') || 1;
57
- const start = strand === 1 ? feature.get('start') : feature.get('end');
58
- const end = strand === 1 ? feature.get('end') : feature.get('start');
59
- const refName = feature.get('refName');
60
- warnings.push({
61
- message: `feature at (X ${refName}:${start}-${end}) ${r} ${gt}`,
62
- effect: 'clipped the feature',
63
- });
64
- return max;
65
- }
66
- return num;
67
- }
68
- function clampWithWarnY(num, min, max, feature) {
69
- if (num < min - fudgeFactor) {
70
- const mate = feature.get('mate');
71
- const { refName, start, end } = mate;
72
- warnings.push({
73
- message: `feature at (Y ${refName}:${start}-${end}) ${r} ${lt}`,
74
- effect: 'clipped the feature',
75
- });
76
- return min;
77
- }
78
- if (num > max + fudgeFactor) {
79
- const mate = feature.get('mate');
80
- const { refName, start, end } = mate;
81
- warnings.push({
82
- message: `feature at (Y ${refName}:${start}-${end}) ${r} ${gt}`,
83
- effect: 'clipped the feature',
84
- });
85
- return max;
86
- }
87
- return num;
88
- }
89
47
  const hsnap = {
90
48
  ...getSnapshot(hview),
91
49
  staticBlocks: hview.staticBlocks,
@@ -97,41 +55,76 @@ export async function drawDotplot(ctx, props) {
97
55
  width: vview.width,
98
56
  };
99
57
  const t = createJBrowseTheme(theme);
100
- for (const feature of hview.features || []) {
58
+ const features = hview.features || [];
59
+ let posColorWithAlpha;
60
+ let negColorWithAlpha;
61
+ let defaultColorWithAlpha;
62
+ const queryColorCache = new Map();
63
+ const getQueryColorWithAlpha = (queryName) => {
64
+ if (!queryColorCache.has(queryName)) {
65
+ const c = getQueryColor(queryName);
66
+ queryColorCache.set(queryName, applyAlpha(c, alpha));
67
+ }
68
+ return queryColorCache.get(queryName);
69
+ };
70
+ if (colorBy === 'strand') {
71
+ posColorWithAlpha = applyAlpha(posColor, alpha);
72
+ negColorWithAlpha = applyAlpha(negColor, alpha);
73
+ }
74
+ else if (colorBy === 'default' && !isCallback) {
75
+ const c = color === '#f0f' ? t.palette.text.primary : color;
76
+ defaultColorWithAlpha = applyAlpha(c, alpha);
77
+ }
78
+ for (const feature of features) {
101
79
  const strand = feature.get('strand') || 1;
102
- const start = strand === 1 ? feature.get('start') : feature.get('end');
103
- const end = strand === 1 ? feature.get('end') : feature.get('start');
80
+ const fStart = feature.get('start');
81
+ const fEnd = feature.get('end');
82
+ if (minAlignmentLength > 0) {
83
+ const alignmentLength = Math.abs(fEnd - fStart);
84
+ if (alignmentLength < minAlignmentLength) {
85
+ continue;
86
+ }
87
+ }
104
88
  const refName = feature.get('refName');
105
89
  const mate = feature.get('mate');
106
90
  const mateRef = mate.refName;
107
- let r = 'black';
108
- if (colorBy === 'identity') {
109
- const identity = feature.get('identity');
110
- for (let i = 0; i < thresholds.length; i++) {
111
- if (identity > +thresholds[i]) {
112
- r = palette[i] || 'black';
113
- break;
114
- }
115
- }
116
- }
117
- else if (colorBy === 'meanQueryIdentity') {
118
- r = `hsl(${feature.get('meanScore') * 200},100%,40%)`;
91
+ const start = strand === 1 ? fStart : fEnd;
92
+ const end = strand === 1 ? fEnd : fStart;
93
+ let colorWithAlpha;
94
+ if (colorBy === 'strand') {
95
+ colorWithAlpha = strand === -1 ? negColorWithAlpha : posColorWithAlpha;
119
96
  }
120
- else if (colorBy === 'mappingQuality') {
121
- r = `hsl(${feature.get('mappingQual')},100%,40%)`;
97
+ else if (colorBy === 'query') {
98
+ const queryName = refName;
99
+ colorWithAlpha = getQueryColorWithAlpha(queryName);
122
100
  }
123
- else if (colorBy === 'strand') {
124
- r = strand === -1 ? negColor : posColor;
101
+ else if (colorBy === 'default' && !isCallback) {
102
+ colorWithAlpha = defaultColorWithAlpha;
125
103
  }
126
- else if (colorBy === 'default') {
127
- r = isCallback
128
- ? readConfObject(config, 'color', { feature })
129
- : color === '#f0f'
130
- ? t.palette.text.primary
131
- : color;
104
+ else {
105
+ let r = 'black';
106
+ if (colorBy === 'identity') {
107
+ const identity = feature.get('identity');
108
+ for (let i = 0; i < thresholds.length; i++) {
109
+ if (identity > +thresholds[i]) {
110
+ r = palette[i] || 'black';
111
+ break;
112
+ }
113
+ }
114
+ }
115
+ else if (colorBy === 'meanQueryIdentity') {
116
+ r = `hsl(${feature.get('meanScore') * 200},100%,40%)`;
117
+ }
118
+ else if (colorBy === 'mappingQuality') {
119
+ r = `hsl(${feature.get('mappingQual')},100%,40%)`;
120
+ }
121
+ else if (colorBy === 'default' && isCallback) {
122
+ r = readConfObject(config, 'color', { feature });
123
+ }
124
+ colorWithAlpha = applyAlpha(r, alpha);
132
125
  }
133
- ctx.fillStyle = r;
134
- ctx.strokeStyle = r;
126
+ ctx.fillStyle = colorWithAlpha;
127
+ ctx.strokeStyle = colorWithAlpha;
135
128
  const b10 = bpToPx({ self: hsnap, refName, coord: start });
136
129
  const b20 = bpToPx({ self: hsnap, refName, coord: end });
137
130
  const e10 = bpToPx({ self: vsnap, refName: mateRef, coord: mate.start });
@@ -145,7 +138,9 @@ export async function drawDotplot(ctx, props) {
145
138
  const e1 = e10.offsetPx - db2;
146
139
  const e2 = e20.offsetPx - db2;
147
140
  if (Math.abs(b1 - b2) <= 4 && Math.abs(e1 - e2) <= 4) {
148
- drawCir(ctx, b1, height - e1, lineWidth);
141
+ ctx.beginPath();
142
+ ctx.arc(b1, height - e1, lineWidth / 2, 0, 2 * Math.PI);
143
+ ctx.fill();
149
144
  }
150
145
  else {
151
146
  let currX = b1;
@@ -170,8 +165,8 @@ export async function drawDotplot(ctx, props) {
170
165
  else if (op === 'I') {
171
166
  currY += val / vBpPerPx;
172
167
  }
173
- currX = clampWithWarnX(currX, b1, b2, feature);
174
- currY = clampWithWarnY(currY, e1, e2, feature);
168
+ currX = clampWithWarnX(currX, b1, b2, feature, warnings);
169
+ currY = clampWithWarnY(currY, e1, e2, feature, warnings);
175
170
  if (Math.abs(currX - lastDrawnX) > 0.5 ||
176
171
  Math.abs(currY - lastDrawnY) > 0.5) {
177
172
  ctx.lineTo(currX, height - currY);
@@ -193,13 +188,13 @@ export async function drawDotplot(ctx, props) {
193
188
  if (warnings.length <= 5) {
194
189
  if (b10 === undefined || b20 === undefined) {
195
190
  warnings.push({
196
- message: `feature at (X ${refName}:${start}-${end}) not plotted, fell outside of range`,
191
+ message: `feature at (X-coord: ${refName}:${start}-${end}) not plotted, fell outside of range`,
197
192
  effect: 'feature not rendered',
198
193
  });
199
194
  }
200
195
  else {
201
196
  warnings.push({
202
- message: `feature at (Y ${mateRef}:${mate.start}-${mate.end}) not plotted, fell outside of range`,
197
+ message: `feature at (Y-coord: ${mateRef}:${mate.start}-${mate.end}) not plotted, fell outside of range`,
203
198
  effect: 'feature not rendered',
204
199
  });
205
200
  }
@@ -1,11 +1,11 @@
1
- import DotplotRenderer from './DotplotRenderer';
2
- import ReactComponent from './components/DotplotRendering';
3
- import configSchema from './configSchema';
1
+ import { lazy } from 'react';
2
+ import DotplotRenderer from "./DotplotRenderer.js";
3
+ import configSchema from "./configSchema.js";
4
4
  export default function DotplotRendererF(pluginManager) {
5
5
  pluginManager.addRendererType(() => new DotplotRenderer({
6
6
  name: 'DotplotRenderer',
7
7
  configSchema: configSchema,
8
- ReactComponent,
8
+ ReactComponent: lazy(() => import("./components/DotplotRendering.js")),
9
9
  pluginManager,
10
10
  }));
11
11
  }
@@ -1,11 +1,11 @@
1
- import type { Instance } from 'mobx-state-tree';
2
- declare const Dotplot1DView: import("mobx-state-tree").IModelType<{
3
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
4
- displayedRegions: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[]>, [undefined]>;
5
- bpPerPx: import("mobx-state-tree").IType<number | undefined, number, number>;
6
- offsetPx: import("mobx-state-tree").IType<number | undefined, number, number>;
7
- interRegionPaddingWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
8
- minimumBlockWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
1
+ import type { Instance } from '@jbrowse/mobx-state-tree';
2
+ declare const Dotplot1DView: import("@jbrowse/mobx-state-tree").IModelType<{
3
+ id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
4
+ displayedRegions: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IType<import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[]>, [undefined]>;
5
+ bpPerPx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
6
+ offsetPx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
7
+ interRegionPaddingWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
8
+ minimumBlockWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
9
9
  }, {
10
10
  features: undefined | import("@jbrowse/core/util").Feature[];
11
11
  volatileWidth: number;
@@ -62,14 +62,14 @@ declare const Dotplot1DView: import("mobx-state-tree").IModelType<{
62
62
  readonly minBpPerPx: number;
63
63
  readonly maxOffset: number;
64
64
  readonly minOffset: number;
65
- }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
66
- declare const DotplotHView: import("mobx-state-tree").IModelType<{
67
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
68
- displayedRegions: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[]>, [undefined]>;
69
- bpPerPx: import("mobx-state-tree").IType<number | undefined, number, number>;
70
- offsetPx: import("mobx-state-tree").IType<number | undefined, number, number>;
71
- interRegionPaddingWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
72
- minimumBlockWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
65
+ }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
66
+ declare const DotplotHView: import("@jbrowse/mobx-state-tree").IModelType<{
67
+ id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
68
+ displayedRegions: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IType<import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[]>, [undefined]>;
69
+ bpPerPx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
70
+ offsetPx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
71
+ interRegionPaddingWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
72
+ minimumBlockWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
73
73
  }, {
74
74
  features: undefined | import("@jbrowse/core/util").Feature[];
75
75
  volatileWidth: number;
@@ -128,14 +128,14 @@ declare const DotplotHView: import("mobx-state-tree").IModelType<{
128
128
  readonly minOffset: number;
129
129
  } & {
130
130
  readonly width: any;
131
- }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
132
- declare const DotplotVView: import("mobx-state-tree").IModelType<{
133
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
134
- displayedRegions: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[]>, [undefined]>;
135
- bpPerPx: import("mobx-state-tree").IType<number | undefined, number, number>;
136
- offsetPx: import("mobx-state-tree").IType<number | undefined, number, number>;
137
- interRegionPaddingWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
138
- minimumBlockWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
131
+ }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
132
+ declare const DotplotVView: import("@jbrowse/mobx-state-tree").IModelType<{
133
+ id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
134
+ displayedRegions: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IType<import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[]>, [undefined]>;
135
+ bpPerPx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
136
+ offsetPx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
137
+ interRegionPaddingWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
138
+ minimumBlockWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
139
139
  }, {
140
140
  features: undefined | import("@jbrowse/core/util").Feature[];
141
141
  volatileWidth: number;
@@ -194,6 +194,6 @@ declare const DotplotVView: import("mobx-state-tree").IModelType<{
194
194
  readonly minOffset: number;
195
195
  } & {
196
196
  readonly width: any;
197
- }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
197
+ }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
198
198
  export { Dotplot1DView, DotplotHView, DotplotVView };
199
199
  export type Dotplot1DViewModel = Instance<typeof Dotplot1DView>;
@@ -1,7 +1,7 @@
1
1
  import Base1DView from '@jbrowse/core/util/Base1DViewModel';
2
2
  import calculateDynamicBlocks from '@jbrowse/core/util/calculateDynamicBlocks';
3
+ import { getParent } from '@jbrowse/mobx-state-tree';
3
4
  import { observable } from 'mobx';
4
- import { getParent } from 'mobx-state-tree';
5
5
  function x() { }
6
6
  const Dotplot1DView = Base1DView.extend(self => {
7
7
  const scaleFactor = observable.box(1);
@@ -14,16 +14,28 @@ const Dotplot1DView = Base1DView.extend(self => {
14
14
  return scaleFactor.get();
15
15
  },
16
16
  get maxBpPerPx() {
17
- return self.totalBp / (self.width - 50);
17
+ return self.totalBp / (self.width * 0.9);
18
18
  },
19
19
  get minBpPerPx() {
20
20
  return 1 / 50;
21
21
  },
22
22
  get maxOffset() {
23
- return self.displayedRegionsTotalPx - self.width * 0.2;
23
+ const contentPx = self.displayedRegionsTotalPx;
24
+ const viewWidth = self.width;
25
+ if (contentPx <= viewWidth) {
26
+ return (contentPx - viewWidth) / 2;
27
+ }
28
+ const leftPadding = 10;
29
+ return contentPx - leftPadding;
24
30
  },
25
31
  get minOffset() {
26
- return -self.width * 0.8;
32
+ const contentPx = self.displayedRegionsTotalPx;
33
+ const viewWidth = self.width;
34
+ if (contentPx <= viewWidth) {
35
+ return (contentPx - viewWidth) / 2;
36
+ }
37
+ const rightPadding = 30;
38
+ return -viewWidth + rightPadding;
27
39
  },
28
40
  },
29
41
  actions: {
@@ -1,4 +1,4 @@
1
- import type { DotplotViewModel } from '../model';
1
+ import type { DotplotViewModel } from '../model.ts';
2
2
  export declare const HorizontalAxis: ({ model, }: {
3
3
  model: DotplotViewModel;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { getFillProps, getStrokeProps, getTickDisplayStr, } from '@jbrowse/core/util';
3
3
  import { bpToPx } from '@jbrowse/core/util/Base1DUtils';
4
+ import { makeStyles } from '@jbrowse/core/util/tss-react';
5
+ import { getSnapshot } from '@jbrowse/mobx-state-tree';
4
6
  import { useTheme } from '@mui/material';
5
7
  import { observer } from 'mobx-react';
6
- import { getSnapshot } from 'mobx-state-tree';
7
- import { makeStyles } from 'tss-react/mui';
8
- import { getBlockLabelKeysToHide } from './util';
8
+ import { getBlockLabelKeysToHide } from "./util.js";
9
9
  const useStyles = makeStyles()(() => ({
10
10
  vtext: {
11
11
  gridColumn: '1/2',
@@ -20,12 +20,12 @@ const useStyles = makeStyles()(() => ({
20
20
  userSelect: 'none',
21
21
  },
22
22
  }));
23
- export const HorizontalAxis = observer(function ({ model, }) {
23
+ export const HorizontalAxis = observer(function HorizontalAxis({ model, }) {
24
24
  const { viewWidth, borderY } = model;
25
25
  const { classes } = useStyles();
26
26
  return (_jsx("svg", { width: viewWidth, height: borderY, className: classes.htext, children: _jsx(HorizontalAxisRaw, { model: model }) }));
27
27
  });
28
- export const HorizontalAxisRaw = observer(function ({ model, }) {
28
+ export const HorizontalAxisRaw = observer(function HorizontalAxisRaw({ model, }) {
29
29
  const { viewWidth, borderX, borderY, hview, htextRotation, hticks } = model;
30
30
  const { offsetPx, width, dynamicBlocks, bpPerPx } = hview;
31
31
  const dblocks = dynamicBlocks.contentBlocks;
@@ -37,36 +37,31 @@ export const HorizontalAxisRaw = observer(function ({ model, }) {
37
37
  staticBlocks: hview.staticBlocks,
38
38
  };
39
39
  const ticks = hticks
40
- .map(tick => {
41
- var _a;
42
- return [
43
- tick,
44
- (_a = bpToPx({
45
- refName: tick.refName,
46
- coord: tick.base,
47
- self: hviewSnap,
48
- })) === null || _a === void 0 ? void 0 : _a.offsetPx,
49
- ];
50
- })
40
+ .map(tick => [
41
+ tick,
42
+ bpToPx({
43
+ refName: tick.refName,
44
+ coord: tick.base,
45
+ self: hviewSnap,
46
+ })?.offsetPx,
47
+ ])
51
48
  .filter(f => f[1] !== undefined)
52
49
  .map(f => [f[0], f[1] - offsetPx]);
53
50
  return (_jsxs(_Fragment, { children: [dblocks
54
51
  .filter(region => !hide.has(region.key))
55
52
  .map(region => {
56
- const x = region.offsetPx;
57
- const y = 0;
58
- const xoff = Math.floor(x - hview.offsetPx);
59
- return (_jsx("text", { transform: `rotate(${htextRotation},${xoff},${y})`, x: xoff, y: y + 1, fontSize: 11, dominantBaseline: "hanging", textAnchor: "end", ...getFillProps(theme.palette.text.primary), children: region.refName }, JSON.stringify(region)));
60
- }), ticks.map(([tick, x]) => x > 0 && x < width ? (_jsx("line", { x1: x, x2: x, y1: 0, y2: tick.type === 'major' ? 6 : 4, strokeWidth: 1, ...getFillProps(theme.palette.text.primary) }, `line-${JSON.stringify(tick)}`)) : null), ticks
53
+ const xoff = Math.floor(region.offsetPx - hview.offsetPx);
54
+ return (_jsx("text", { transform: `rotate(${htextRotation},${xoff},0)`, x: xoff, y: 1, fontSize: 11, dominantBaseline: "hanging", textAnchor: "end", ...getFillProps(theme.palette.text.primary), children: region.refName }, region.key));
55
+ }), ticks.map(([tick, x], idx) => x > 0 && x < width ? (_jsx("line", { x1: x, x2: x, y1: 0, y2: tick.type === 'major' ? 6 : 4, strokeWidth: 1, ...getStrokeProps(theme.palette.text.primary) }, `line-${tick.refName}-${tick.base}-${idx}`)) : null), ticks
61
56
  .filter(t => t[0].type === 'major')
62
- .map(([tick, x]) => x > 10 && x < width ? (_jsx("text", { x: x - 7, y: 0, transform: `rotate(${htextRotation},${x},0)`, fontSize: 11, dominantBaseline: "middle", textAnchor: "end", ...getFillProps(theme.palette.text.primary), children: getTickDisplayStr(tick.base + 1, bpPerPx) }, `text-${JSON.stringify(tick)}`)) : null), _jsx("text", { y: borderY - 12, x: (viewWidth - borderX) / 2, textAnchor: "middle", fontSize: 11, dominantBaseline: "hanging", ...getFillProps(theme.palette.text.primary), children: hview.assemblyNames.join(',') })] }));
57
+ .map(([tick, x], idx) => x > 10 && x < width ? (_jsx("text", { x: x - 7, y: 0, transform: `rotate(${htextRotation},${x},0)`, fontSize: 11, dominantBaseline: "middle", textAnchor: "end", ...getFillProps(theme.palette.text.primary), children: getTickDisplayStr(tick.base + 1, bpPerPx) }, `text-${tick.refName}-${tick.base}-${idx}`)) : null), _jsx("text", { y: borderY - 12, x: (viewWidth - borderX) / 2, textAnchor: "middle", fontSize: 11, dominantBaseline: "hanging", ...getFillProps(theme.palette.text.primary), children: hview.assemblyNames.join(',') })] }));
63
58
  });
64
- export const VerticalAxis = observer(function ({ model, }) {
59
+ export const VerticalAxis = observer(function VerticalAxis({ model, }) {
65
60
  const { borderX, viewHeight } = model;
66
61
  const { classes } = useStyles();
67
62
  return (_jsx("svg", { className: classes.vtext, width: borderX, height: viewHeight, children: _jsx(VerticalAxisRaw, { model: model }) }));
68
63
  });
69
- export const VerticalAxisRaw = observer(function ({ model, }) {
64
+ export const VerticalAxisRaw = observer(function VerticalAxisRaw({ model, }) {
70
65
  const { viewHeight, borderX, borderY, vview, vtextRotation, vticks } = model;
71
66
  const { offsetPx, width, dynamicBlocks, bpPerPx } = vview;
72
67
  const dblocks = dynamicBlocks.contentBlocks;
@@ -78,27 +73,22 @@ export const VerticalAxisRaw = observer(function ({ model, }) {
78
73
  staticBlocks: vview.staticBlocks,
79
74
  };
80
75
  const ticks = vticks
81
- .map(tick => {
82
- var _a;
83
- return [
84
- tick,
85
- (_a = bpToPx({
86
- refName: tick.refName,
87
- coord: tick.base,
88
- self: vviewSnap,
89
- })) === null || _a === void 0 ? void 0 : _a.offsetPx,
90
- ];
91
- })
76
+ .map(tick => [
77
+ tick,
78
+ bpToPx({
79
+ refName: tick.refName,
80
+ coord: tick.base,
81
+ self: vviewSnap,
82
+ })?.offsetPx,
83
+ ])
92
84
  .filter(f => f[1] !== undefined)
93
85
  .map(f => [f[0], f[1] - offsetPx]);
94
86
  return (_jsxs(_Fragment, { children: [dblocks
95
87
  .filter(region => !hide.has(region.key))
96
88
  .map(region => {
97
- const y = region.offsetPx;
98
- const x = borderX;
99
- const yoff = Math.floor(viewHeight - y + offsetPx);
100
- return (_jsx("text", { transform: `rotate(${vtextRotation},${x},${y})`, x: x, y: yoff, fontSize: 11, textAnchor: "end", ...getFillProps(theme.palette.text.primary), children: region.refName }, JSON.stringify(region)));
101
- }), ticks.map(([tick, y]) => y > 0 ? (_jsx("line", { y1: viewHeight - y, y2: viewHeight - y, x1: borderX, x2: borderX - (tick.type === 'major' ? 6 : 4), strokeWidth: 1, ...getStrokeProps(theme.palette.grey[400]) }, `line-${JSON.stringify(tick)}`)) : null), ticks
89
+ const yoff = Math.floor(viewHeight - region.offsetPx + offsetPx);
90
+ return (_jsx("text", { transform: `rotate(${vtextRotation},${borderX},${region.offsetPx})`, x: borderX, y: yoff, fontSize: 11, textAnchor: "end", ...getFillProps(theme.palette.text.primary), children: region.refName }, region.key));
91
+ }), ticks.map(([tick, y], idx) => y > 0 && y < viewHeight ? (_jsx("line", { y1: viewHeight - y, y2: viewHeight - y, x1: borderX, x2: borderX - (tick.type === 'major' ? 6 : 4), strokeWidth: 1, ...getStrokeProps(theme.palette.text.primary) }, `line-${tick.refName}-${tick.base}-${idx}`)) : null), ticks
102
92
  .filter(t => t[0].type === 'major')
103
- .map(([tick, y]) => y > 10 && y < viewHeight ? (_jsx("text", { y: viewHeight - y - 3, x: borderX - 7, textAnchor: "end", dominantBaseline: "hanging", fontSize: 11, ...getFillProps(theme.palette.text.primary), children: getTickDisplayStr(tick.base + 1, bpPerPx) }, `text-${JSON.stringify(tick)}`)) : null), _jsx("text", { y: (viewHeight - borderY) / 2, x: 12, transform: `rotate(-90,12,${(viewHeight - borderY) / 2})`, textAnchor: "middle", fontSize: 11, ...getFillProps(theme.palette.text.primary), children: vview.assemblyNames.join(',') })] }));
93
+ .map(([tick, y], idx) => y > 10 && y < viewHeight ? (_jsx("text", { y: viewHeight - y - 3, x: borderX - 7, textAnchor: "end", dominantBaseline: "hanging", fontSize: 11, ...getFillProps(theme.palette.text.primary), children: getTickDisplayStr(tick.base + 1, bpPerPx) }, `text-${tick.refName}-${tick.base}-${idx}`)) : null), _jsx("text", { y: (viewHeight - borderY) / 2, x: 12, transform: `rotate(-90,12,${(viewHeight - borderY) / 2})`, textAnchor: "middle", fontSize: 11, ...getFillProps(theme.palette.text.primary), children: vview.assemblyNames.join(',') })] }));
104
94
  });
@@ -0,0 +1,5 @@
1
+ import type { DotplotViewModel } from '../model.ts';
2
+ declare const ColorBySelector: ({ model, }: {
3
+ model: DotplotViewModel;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default ColorBySelector;
@@ -0,0 +1,73 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton';
3
+ import PaletteIcon from '@mui/icons-material/Palette';
4
+ import { observer } from 'mobx-react';
5
+ const ColorBySelector = observer(function ColorBySelector({ model, }) {
6
+ const firstDisplay = model.tracks[0]?.displays[0];
7
+ const colorBy = firstDisplay?.colorBy ?? 'default';
8
+ const setColorBy = (value) => {
9
+ for (const track of model.tracks) {
10
+ for (const display of track.displays) {
11
+ ;
12
+ display.setColorBy(value);
13
+ }
14
+ }
15
+ };
16
+ return (_jsx(CascadingMenuButton, { menuItems: [
17
+ {
18
+ label: 'Default',
19
+ type: 'radio',
20
+ checked: colorBy === 'default',
21
+ onClick: () => {
22
+ setColorBy('default');
23
+ },
24
+ helpText: 'Use the default color scheme specified in the track configuration. This respects the color settings defined in the config file.',
25
+ },
26
+ {
27
+ label: 'Identity',
28
+ type: 'radio',
29
+ checked: colorBy === 'identity',
30
+ onClick: () => {
31
+ setColorBy('identity');
32
+ },
33
+ helpText: 'Color alignments by sequence identity percentage. Higher identity matches appear in warmer colors, while lower identity matches appear cooler. Useful for identifying highly conserved vs. divergent regions.',
34
+ },
35
+ {
36
+ label: 'Mean Query Identity',
37
+ type: 'radio',
38
+ checked: colorBy === 'meanQueryIdentity',
39
+ onClick: () => {
40
+ setColorBy('meanQueryIdentity');
41
+ },
42
+ helpText: 'Color alignments based on the mean identity across the query sequence. This provides a smoothed view of overall alignment quality, reducing noise from local variations. For instance, a single long query of e.g. a contig of an assembly, when aligned to the target, may get split into many smaller "hits". This score aggregates across them, and colors them all the same. Similar code exists in the program dotPlotly',
43
+ },
44
+ {
45
+ label: 'Mapping Quality',
46
+ type: 'radio',
47
+ checked: colorBy === 'mappingQuality',
48
+ onClick: () => {
49
+ setColorBy('mappingQuality');
50
+ },
51
+ helpText: 'Color alignments by mapping quality score (MAPQ). Higher quality mappings (more unique/confident) appear in darker colors. Useful for identifying ambiguous or multi-mapping regions.',
52
+ },
53
+ {
54
+ label: 'Strand',
55
+ type: 'radio',
56
+ checked: colorBy === 'strand',
57
+ onClick: () => {
58
+ setColorBy('strand');
59
+ },
60
+ helpText: 'Color alignments by strand orientation. Forward strand alignments and reverse strand alignments are shown in different colors, making it easy to identify inversions and strand-specific patterns.',
61
+ },
62
+ {
63
+ label: 'Query',
64
+ type: 'radio',
65
+ checked: colorBy === 'query',
66
+ onClick: () => {
67
+ setColorBy('query');
68
+ },
69
+ helpText: 'Color alignments by query sequence name. Each unique query sequence is assigned a consistent color based on its name, making it easy to visually distinguish between different sequences.',
70
+ },
71
+ ], children: _jsx(PaletteIcon, {}) }));
72
+ });
73
+ export default ColorBySelector;
@@ -0,0 +1,6 @@
1
+ import type { DotplotViewModel } from '../model.ts';
2
+ declare const DiagonalizationProgressDialog: ({ handleClose, model, }: {
3
+ handleClose: () => void;
4
+ model: Pick<DotplotViewModel, "tracks" | "hview" | "vview" | "id" | "type" | "displayName">;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default DiagonalizationProgressDialog;