@jbrowse/plugin-variants 3.2.0 → 3.3.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 (221) hide show
  1. package/dist/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +3 -3
  2. package/dist/MultiLinearVariantDisplay/index.js +1 -1
  3. package/dist/MultiLinearVariantDisplay/model.d.ts +39 -3
  4. package/dist/MultiLinearVariantDisplay/model.js +0 -1
  5. package/dist/MultiLinearVariantDisplay/renderSvg.js +2 -2
  6. package/dist/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +15 -5
  7. package/dist/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +3 -3
  8. package/dist/MultiLinearVariantMatrixDisplay/index.js +1 -1
  9. package/dist/MultiLinearVariantMatrixDisplay/model.d.ts +39 -2
  10. package/dist/MultiLinearVariantMatrixDisplay/model.js +1 -0
  11. package/dist/MultiLinearVariantMatrixDisplay/renderSvg.js +2 -2
  12. package/dist/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.d.ts → MultiLinearVariantMatrixRenderer.d.ts} +7 -3
  13. package/dist/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.d.ts +8 -0
  14. package/dist/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.js +41 -0
  15. package/dist/MultiLinearVariantMatrixRenderer/index.js +4 -4
  16. package/dist/MultiLinearVariantMatrixRenderer/makeImageData.d.ts +2 -2
  17. package/dist/MultiLinearVariantMatrixRenderer/makeImageData.js +12 -13
  18. package/dist/MultiLinearVariantMatrixRenderer/types.d.ts +2 -4
  19. package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +30 -1
  20. package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.js +11 -5
  21. package/dist/MultiLinearVariantRenderer/components/{MultiVariantRendering.d.ts → MultiLinearVariantRendering.d.ts} +10 -4
  22. package/dist/MultiLinearVariantRenderer/{MultiVariantRendering.js → components/MultiLinearVariantRendering.js} +25 -7
  23. package/dist/MultiLinearVariantRenderer/components/util.d.ts +1 -0
  24. package/dist/MultiLinearVariantRenderer/components/util.js +15 -0
  25. package/dist/MultiLinearVariantRenderer/index.js +2 -2
  26. package/dist/MultiLinearVariantRenderer/makeImageData.d.ts +9 -0
  27. package/dist/MultiLinearVariantRenderer/makeImageData.js +60 -28
  28. package/dist/MultiLinearVariantRenderer/types.d.ts +1 -0
  29. package/dist/SplitVcfTabixAdapter/configSchema.js +4 -2
  30. package/dist/VariantFeatureWidget/AltFormatter.d.ts +4 -0
  31. package/dist/VariantFeatureWidget/AltFormatter.js +13 -0
  32. package/dist/VariantFeatureWidget/Checkbox2.js +1 -8
  33. package/dist/VariantFeatureWidget/Formatter.d.ts +3 -0
  34. package/dist/VariantFeatureWidget/Formatter.js +23 -0
  35. package/dist/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.js → VariantConsequence/VariantConsequenceDataGridWrapper.js} +3 -5
  36. package/dist/VariantFeatureWidget/VariantFeatureWidget.js +7 -2
  37. package/dist/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.d.ts +4 -0
  38. package/dist/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.js +80 -0
  39. package/dist/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.d.ts +3 -9
  40. package/dist/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.js +41 -20
  41. package/dist/VariantFeatureWidget/VariantSampleGrid/types.d.ts +21 -0
  42. package/dist/VariantFeatureWidget/VariantSampleGrid/util.d.ts +1 -0
  43. package/dist/VariantFeatureWidget/VariantSampleGrid/util.js +14 -0
  44. package/dist/VariantRPC/MultiVariantClusterGenotypeMatrix.d.ts +2 -16
  45. package/dist/VariantRPC/MultiVariantClusterGenotypeMatrix.js +4 -7
  46. package/dist/VariantRPC/MultiVariantGetGenotypeMatrix.d.ts +2 -15
  47. package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +3 -13
  48. package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.js +14 -8
  49. package/dist/VariantRPC/getGenotypeMatrix.js +10 -5
  50. package/dist/VariantRPC/types.d.ts +23 -0
  51. package/dist/VcfFeature/index.js +0 -1
  52. package/dist/VcfFeature/util.d.ts +2 -0
  53. package/dist/VcfFeature/util.js +123 -25
  54. package/dist/VcfTabixAdapter/VcfTabixAdapter.js +12 -7
  55. package/dist/getMultiVariantFeaturesAutorun.d.ts +2 -0
  56. package/dist/getMultiVariantFeaturesAutorun.js +9 -2
  57. package/dist/getMultiVariantSourcesAutorun.js +3 -2
  58. package/dist/shared/MultiVariantBaseModel.d.ts +40 -3
  59. package/dist/shared/MultiVariantBaseModel.js +69 -3
  60. package/dist/shared/components/AddFiltersDialog.d.ts +9 -0
  61. package/dist/shared/components/AddFiltersDialog.js +61 -0
  62. package/dist/shared/components/MultiVariantBaseDisplayComponent.d.ts +5 -0
  63. package/dist/shared/components/MultiVariantBaseDisplayComponent.js +29 -0
  64. package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialog.js +2 -2
  65. package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogAuto.js +8 -3
  66. package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogManual.js +29 -28
  67. package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/types.d.ts +1 -0
  68. package/dist/shared/components/MultiVariantClusterDialog/types.js +2 -0
  69. package/{esm/shared/components/ColorLegend.d.ts → dist/shared/components/MultiVariantColorLegend.d.ts} +2 -2
  70. package/dist/shared/components/{ColorLegend.js → MultiVariantColorLegend.js} +5 -3
  71. package/dist/shared/components/MultiVariantCrosshairs.d.ts +7 -0
  72. package/dist/shared/components/MultiVariantCrosshairs.js +40 -0
  73. package/dist/shared/components/MultiVariantLegendBar.d.ts +7 -0
  74. package/dist/shared/components/{LegendBar.js → MultiVariantLegendBar.js} +2 -2
  75. package/dist/shared/components/MultiVariantTooltip.d.ts +4 -0
  76. package/dist/shared/components/MultiVariantTooltip.js +3 -2
  77. package/dist/shared/components/RectBg.js +4 -2
  78. package/dist/shared/components/SetColorDialog.js +1 -1
  79. package/dist/shared/components/SourcesDataGrid.d.ts +2 -1
  80. package/dist/shared/components/SourcesDataGrid.js +40 -47
  81. package/dist/shared/components/SourcesGrid.js +1 -1
  82. package/dist/shared/components/SourcesGridHeader.d.ts +2 -1
  83. package/dist/shared/drawAlleleCount.d.ts +1 -1
  84. package/dist/shared/drawAlleleCount.js +29 -5
  85. package/dist/shared/drawPhased.d.ts +1 -1
  86. package/dist/shared/drawPhased.js +14 -10
  87. package/dist/shared/minorAlleleFrequencyUtils.d.ts +6 -1
  88. package/dist/shared/minorAlleleFrequencyUtils.js +4 -5
  89. package/dist/shared/sourcesGridUtils.d.ts +3 -2
  90. package/esm/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +2 -2
  91. package/esm/MultiLinearVariantDisplay/index.js +1 -1
  92. package/esm/MultiLinearVariantDisplay/model.d.ts +39 -3
  93. package/esm/MultiLinearVariantDisplay/model.js +0 -1
  94. package/esm/MultiLinearVariantDisplay/renderSvg.js +1 -1
  95. package/esm/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +15 -8
  96. package/esm/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +2 -2
  97. package/esm/MultiLinearVariantMatrixDisplay/index.js +1 -1
  98. package/esm/MultiLinearVariantMatrixDisplay/model.d.ts +39 -2
  99. package/esm/MultiLinearVariantMatrixDisplay/model.js +1 -0
  100. package/esm/MultiLinearVariantMatrixDisplay/renderSvg.js +1 -1
  101. package/esm/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.d.ts → MultiLinearVariantMatrixRenderer.d.ts} +7 -3
  102. package/esm/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.d.ts +8 -0
  103. package/esm/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.js +39 -0
  104. package/esm/MultiLinearVariantMatrixRenderer/index.js +4 -4
  105. package/esm/MultiLinearVariantMatrixRenderer/makeImageData.d.ts +2 -2
  106. package/esm/MultiLinearVariantMatrixRenderer/makeImageData.js +13 -14
  107. package/esm/MultiLinearVariantMatrixRenderer/types.d.ts +2 -4
  108. package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +30 -1
  109. package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.js +11 -5
  110. package/esm/MultiLinearVariantRenderer/components/{MultiVariantRendering.d.ts → MultiLinearVariantRendering.d.ts} +10 -4
  111. package/esm/MultiLinearVariantRenderer/components/{MultiVariantRendering.js → MultiLinearVariantRendering.js} +25 -7
  112. package/esm/MultiLinearVariantRenderer/components/util.d.ts +1 -0
  113. package/esm/MultiLinearVariantRenderer/components/util.js +12 -0
  114. package/esm/MultiLinearVariantRenderer/index.js +1 -1
  115. package/esm/MultiLinearVariantRenderer/makeImageData.d.ts +9 -0
  116. package/esm/MultiLinearVariantRenderer/makeImageData.js +61 -29
  117. package/esm/MultiLinearVariantRenderer/types.d.ts +1 -0
  118. package/esm/SplitVcfTabixAdapter/configSchema.js +4 -2
  119. package/esm/VariantFeatureWidget/AltFormatter.d.ts +4 -0
  120. package/esm/VariantFeatureWidget/AltFormatter.js +10 -0
  121. package/esm/VariantFeatureWidget/Checkbox2.js +2 -9
  122. package/esm/VariantFeatureWidget/Formatter.d.ts +3 -0
  123. package/esm/VariantFeatureWidget/Formatter.js +17 -0
  124. package/esm/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.js → VariantConsequence/VariantConsequenceDataGridWrapper.js} +4 -6
  125. package/esm/VariantFeatureWidget/VariantFeatureWidget.js +7 -2
  126. package/esm/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.d.ts +4 -0
  127. package/esm/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.js +74 -0
  128. package/esm/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.d.ts +3 -9
  129. package/esm/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.js +43 -22
  130. package/esm/VariantFeatureWidget/VariantSampleGrid/types.d.ts +21 -0
  131. package/esm/VariantFeatureWidget/VariantSampleGrid/util.d.ts +1 -0
  132. package/esm/VariantFeatureWidget/VariantSampleGrid/util.js +11 -0
  133. package/esm/VariantRPC/MultiVariantClusterGenotypeMatrix.d.ts +2 -16
  134. package/esm/VariantRPC/MultiVariantClusterGenotypeMatrix.js +4 -7
  135. package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.d.ts +2 -15
  136. package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +3 -13
  137. package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.js +14 -8
  138. package/esm/VariantRPC/getGenotypeMatrix.js +10 -5
  139. package/esm/VariantRPC/types.d.ts +23 -0
  140. package/esm/VcfFeature/index.js +0 -1
  141. package/esm/VcfFeature/util.d.ts +2 -0
  142. package/esm/VcfFeature/util.js +121 -25
  143. package/esm/VcfTabixAdapter/VcfTabixAdapter.js +13 -8
  144. package/esm/getMultiVariantFeaturesAutorun.d.ts +2 -0
  145. package/esm/getMultiVariantFeaturesAutorun.js +9 -2
  146. package/esm/getMultiVariantSourcesAutorun.js +3 -2
  147. package/esm/shared/MultiVariantBaseModel.d.ts +40 -3
  148. package/esm/shared/MultiVariantBaseModel.js +71 -5
  149. package/esm/shared/components/AddFiltersDialog.d.ts +9 -0
  150. package/esm/shared/components/AddFiltersDialog.js +59 -0
  151. package/esm/shared/components/MultiVariantBaseDisplayComponent.d.ts +5 -0
  152. package/esm/shared/components/MultiVariantBaseDisplayComponent.js +24 -0
  153. package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialog.js +2 -2
  154. package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogAuto.js +9 -4
  155. package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogManual.js +29 -28
  156. package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/types.d.ts +1 -0
  157. package/esm/shared/components/MultiVariantClusterDialog/types.js +1 -0
  158. package/{dist/shared/components/ColorLegend.d.ts → esm/shared/components/MultiVariantColorLegend.d.ts} +2 -2
  159. package/esm/shared/components/{ColorLegend.js → MultiVariantColorLegend.js} +6 -4
  160. package/esm/shared/components/MultiVariantCrosshairs.d.ts +7 -0
  161. package/esm/shared/components/MultiVariantCrosshairs.js +35 -0
  162. package/esm/shared/components/MultiVariantLegendBar.d.ts +7 -0
  163. package/esm/shared/components/{LegendBar.js → MultiVariantLegendBar.js} +1 -1
  164. package/esm/shared/components/MultiVariantTooltip.d.ts +4 -0
  165. package/esm/shared/components/MultiVariantTooltip.js +3 -2
  166. package/esm/shared/components/RectBg.js +4 -2
  167. package/esm/shared/components/SetColorDialog.js +1 -1
  168. package/esm/shared/components/SourcesDataGrid.d.ts +2 -1
  169. package/esm/shared/components/SourcesDataGrid.js +40 -47
  170. package/esm/shared/components/SourcesGrid.js +1 -1
  171. package/esm/shared/components/SourcesGridHeader.d.ts +2 -1
  172. package/esm/shared/drawAlleleCount.d.ts +1 -1
  173. package/esm/shared/drawAlleleCount.js +29 -5
  174. package/esm/shared/drawPhased.d.ts +1 -1
  175. package/esm/shared/drawPhased.js +14 -10
  176. package/esm/shared/minorAlleleFrequencyUtils.d.ts +6 -1
  177. package/esm/shared/minorAlleleFrequencyUtils.js +5 -6
  178. package/esm/shared/sourcesGridUtils.d.ts +3 -2
  179. package/package.json +10 -9
  180. package/dist/MultiLinearVariantDisplay/components/Crosshair.d.ts +0 -7
  181. package/dist/MultiLinearVariantDisplay/components/Crosshair.js +0 -35
  182. package/dist/MultiLinearVariantMatrixDisplay/components/Crosshair.d.ts +0 -7
  183. package/dist/MultiLinearVariantMatrixDisplay/components/Crosshair.js +0 -28
  184. package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +0 -7
  185. package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +0 -38
  186. package/dist/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +0 -22
  187. package/dist/MultiLinearVariantRenderer/components/MultiVariantRendering.js +0 -52
  188. package/dist/VariantFeatureWidget/VariantConsequencePanel.d.ts +0 -5
  189. package/dist/VariantFeatureWidget/VariantConsequencePanel.js +0 -15
  190. package/dist/VariantRPC/cluster.d.ts +0 -17
  191. package/dist/VariantRPC/cluster.js +0 -84
  192. package/dist/shared/components/LegendBar.d.ts +0 -18
  193. package/esm/MultiLinearVariantDisplay/components/Crosshair.d.ts +0 -7
  194. package/esm/MultiLinearVariantDisplay/components/Crosshair.js +0 -30
  195. package/esm/MultiLinearVariantMatrixDisplay/components/Crosshair.d.ts +0 -7
  196. package/esm/MultiLinearVariantMatrixDisplay/components/Crosshair.js +0 -23
  197. package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +0 -7
  198. package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +0 -36
  199. package/esm/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +0 -22
  200. package/esm/MultiLinearVariantRenderer/MultiVariantRendering.js +0 -47
  201. package/esm/VariantFeatureWidget/VariantConsequencePanel.d.ts +0 -5
  202. package/esm/VariantFeatureWidget/VariantConsequencePanel.js +0 -9
  203. package/esm/VariantRPC/cluster.d.ts +0 -17
  204. package/esm/VariantRPC/cluster.js +0 -79
  205. package/esm/shared/components/LegendBar.d.ts +0 -18
  206. /package/dist/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.js → MultiLinearVariantMatrixRenderer.js} +0 -0
  207. /package/dist/VariantFeatureWidget/{VariantConsequenceDataGrid.d.ts → VariantConsequence/VariantConsequenceDataGrid.d.ts} +0 -0
  208. /package/dist/VariantFeatureWidget/{VariantConsequenceDataGrid.js → VariantConsequence/VariantConsequenceDataGrid.js} +0 -0
  209. /package/dist/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.d.ts → VariantConsequence/VariantConsequenceDataGridWrapper.d.ts} +0 -0
  210. /package/dist/{shared/components/ClusterDialog → VariantFeatureWidget/VariantSampleGrid}/types.js +0 -0
  211. /package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialog.d.ts +0 -0
  212. /package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogAuto.d.ts +0 -0
  213. /package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogManual.d.ts +0 -0
  214. /package/esm/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.js → MultiLinearVariantMatrixRenderer.js} +0 -0
  215. /package/esm/VariantFeatureWidget/{VariantConsequenceDataGrid.d.ts → VariantConsequence/VariantConsequenceDataGrid.d.ts} +0 -0
  216. /package/esm/VariantFeatureWidget/{VariantConsequenceDataGrid.js → VariantConsequence/VariantConsequenceDataGrid.js} +0 -0
  217. /package/esm/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.d.ts → VariantConsequence/VariantConsequenceDataGridWrapper.d.ts} +0 -0
  218. /package/esm/{shared/components/ClusterDialog → VariantFeatureWidget/VariantSampleGrid}/types.js +0 -0
  219. /package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialog.d.ts +0 -0
  220. /package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogAuto.d.ts +0 -0
  221. /package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogManual.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import type { Source } from '../types';
2
- declare const ColorLegend: ({ model, labelWidth, }: {
2
+ declare const MultiVariantColorLegend: ({ model, labelWidth, }: {
3
3
  model: {
4
4
  canDisplayLabels: boolean;
5
5
  rowHeight: number;
@@ -7,4 +7,4 @@ declare const ColorLegend: ({ model, labelWidth, }: {
7
7
  };
8
8
  labelWidth: number;
9
9
  }) => import("react/jsx-runtime").JSX.Element | null;
10
- export default ColorLegend;
10
+ export default MultiVariantColorLegend;
@@ -1,17 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Fragment } from 'react';
3
- import { clamp } from '@jbrowse/core/util';
3
+ import { clamp, getFillProps } from '@jbrowse/core/util';
4
+ import { useTheme } from '@mui/material';
4
5
  import { observer } from 'mobx-react';
5
6
  import RectBg from './RectBg';
6
- const ColorLegend = observer(function ({ model, labelWidth, }) {
7
+ const MultiVariantColorLegend = observer(function ({ model, labelWidth, }) {
7
8
  const { canDisplayLabels, rowHeight, sources } = model;
8
9
  const svgFontSize = clamp(rowHeight, 8, 12);
9
10
  const colorBoxWidth = 15;
10
11
  const hasColors = sources === null || sources === void 0 ? void 0 : sources.some(s => s.color);
11
12
  const legendWidth = labelWidth + (hasColors ? colorBoxWidth + 5 : 0);
13
+ const theme = useTheme();
12
14
  return sources ? (_jsxs(_Fragment, { children: [canDisplayLabels ? (_jsx(RectBg, { y: 0, x: 0, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null, sources.map((source, idx) => {
13
15
  const { color, name, label } = source;
14
- return (_jsxs(Fragment, { children: [color ? (_jsx(RectBg, { y: idx * rowHeight, x: 0, width: colorBoxWidth + 0.5, height: rowHeight + 0.5, color: color })) : null, canDisplayLabels ? (_jsx("text", { y: idx * rowHeight + svgFontSize, x: color ? colorBoxWidth + 2 : 0, fontSize: svgFontSize, children: label || name })) : null] }, `${label}-${idx}`));
16
+ return (_jsxs(Fragment, { children: [color ? (_jsx(RectBg, { y: idx * rowHeight, x: 0, width: colorBoxWidth + 0.5, height: rowHeight + 0.5, color: color })) : null, canDisplayLabels ? (_jsx("text", { y: idx * rowHeight + svgFontSize, x: color ? colorBoxWidth + 2 : 0, fontSize: svgFontSize, ...getFillProps(theme.palette.text.primary), children: label || name })) : null] }, `${label}-${idx}`));
15
17
  })] })) : null;
16
18
  });
17
- export default ColorLegend;
19
+ export default MultiVariantColorLegend;
@@ -0,0 +1,7 @@
1
+ import type { MultiVariantBaseModel } from '../MultiVariantBaseModel';
2
+ declare const MultiVariantCrosshairs: ({ mouseX, mouseY, model, }: {
3
+ mouseX: number;
4
+ mouseY: number;
5
+ model: MultiVariantBaseModel;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export default MultiVariantCrosshairs;
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getContainingView } from '@jbrowse/core/util';
3
+ import { useTheme } from '@mui/material';
4
+ import { observer } from 'mobx-react';
5
+ import { makeStyles } from 'tss-react/mui';
6
+ import MultiVariantTooltip from './MultiVariantTooltip';
7
+ const useStyles = makeStyles()({
8
+ rel: {
9
+ position: 'relative',
10
+ },
11
+ cursor: {
12
+ pointerEvents: 'none',
13
+ zIndex: 800,
14
+ position: 'absolute',
15
+ },
16
+ color: {
17
+ width: 10,
18
+ height: 10,
19
+ },
20
+ });
21
+ const MultiVariantCrosshairs = observer(function ({ mouseX, mouseY, model, }) {
22
+ const { classes } = useStyles();
23
+ const theme = useTheme();
24
+ const { hoveredGenotype, height, scrollTop, sourceMap } = model;
25
+ const { width } = getContainingView(model);
26
+ const source = hoveredGenotype ? sourceMap === null || sourceMap === void 0 ? void 0 : sourceMap[hoveredGenotype.name] : undefined;
27
+ const y = mouseY - scrollTop;
28
+ return (_jsxs("div", { className: classes.rel, children: [_jsxs("svg", { className: classes.cursor, width: width, height: height, style: {
29
+ top: scrollTop,
30
+ }, children: [_jsx("line", { x1: 0, x2: width, y1: y, y2: y, stroke: theme.palette.text.primary }), _jsx("line", { x1: mouseX, x2: mouseX, y1: 0, y2: height, stroke: theme.palette.text.primary })] }), source ? (_jsx(MultiVariantTooltip, { source: {
31
+ ...source,
32
+ ...hoveredGenotype,
33
+ } })) : null] }));
34
+ });
35
+ export default MultiVariantCrosshairs;
@@ -0,0 +1,7 @@
1
+ import type { MultiVariantBaseModel } from '../MultiVariantBaseModel';
2
+ export declare const LegendBar: (props: {
3
+ model: MultiVariantBaseModel;
4
+ orientation?: string;
5
+ exportSVG?: boolean;
6
+ }) => import("react/jsx-runtime").JSX.Element | null;
7
+ export default LegendBar;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { clamp, getContainingView, max, measureText } from '@jbrowse/core/util';
3
3
  import { observer } from 'mobx-react';
4
- import ColorLegend from './ColorLegend';
4
+ import ColorLegend from './MultiVariantColorLegend';
5
5
  const Wrapper = observer(function ({ children, model, exportSVG, }) {
6
6
  const { id, scrollTop, height } = model;
7
7
  const clipid = `legend-${id}`;
@@ -1,6 +1,10 @@
1
1
  export default function MultiVariantTooltip({ source, }: {
2
2
  source: {
3
3
  color?: string;
4
+ hoveredGenotype?: {
5
+ genotype: string;
6
+ name: string;
7
+ };
4
8
  [key: string]: unknown;
5
9
  };
6
10
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { SanitizedHTML } from '@jbrowse/core/ui';
3
3
  import BaseTooltip from '@jbrowse/core/ui/BaseTooltip';
4
+ import escapeHTML from 'escape-html';
4
5
  export default function MultiVariantTooltip({ source, }) {
5
6
  return (_jsxs(BaseTooltip, { children: [source.color ? (_jsx("div", { style: {
6
7
  width: 10,
@@ -8,10 +9,10 @@ export default function MultiVariantTooltip({ source, }) {
8
9
  backgroundColor: source.color,
9
10
  } })) : null, _jsx(SanitizedHTML, { html: Object.entries(source)
10
11
  .filter(([key, val]) => key !== 'color' &&
11
- key !== 'name' &&
12
12
  key !== 'HP' &&
13
+ key !== 'name' &&
13
14
  key !== 'id' &&
14
15
  val !== undefined)
15
- .map(([key, value]) => `${key}:${value}`)
16
+ .map(([key, value]) => `${key}:${escapeHTML(`${value}`)}`)
16
17
  .join('<br/>') })] }));
17
18
  }
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { getFillProps } from '@jbrowse/core/util';
3
- const RectBg = ({ x, y, width, height, color = 'rgba(255,255,255,0.5)', }) => {
4
- return (_jsx("rect", { pointerEvents: "auto", x: x, y: y, width: width, height: height, ...getFillProps(color) }));
3
+ import { alpha, useTheme } from '@mui/material';
4
+ const RectBg = ({ x, y, width, height, color, }) => {
5
+ const theme = useTheme();
6
+ return (_jsx("rect", { pointerEvents: "auto", x: x, y: y, width: width, height: height, ...getFillProps(color || alpha(theme.palette.background.paper, 0.3)) }));
5
7
  };
6
8
  export default RectBg;
@@ -27,7 +27,7 @@ export default function SetColorDialog({ model, handleClose, }) {
27
27
  const [showBulkEditor, setShowBulkEditor] = useState(false);
28
28
  const [currLayout, setCurrLayout] = useState(sources || []);
29
29
  const [showTips, setShowTips] = useLocalStorage('multivariant-showTips', false);
30
- return (_jsx(DraggableDialog, { open: true, onClose: handleClose, maxWidth: "xl", title: "Multi-variant color/arrangement editor", children: showBulkEditor ? (_jsx(BulkEditPanel, { currLayout: currLayout, onClose: arg => {
30
+ return (_jsx(DraggableDialog, { open: true, onClose: handleClose, maxWidth: "xl", title: "Multi-sample variant display - Color/arrangement editor", children: showBulkEditor ? (_jsx(BulkEditPanel, { currLayout: currLayout, onClose: arg => {
31
31
  if (arg) {
32
32
  setCurrLayout(arg);
33
33
  }
@@ -1,6 +1,7 @@
1
1
  import type { Source } from '../types';
2
+ import type { GridRowId } from '@mui/x-data-grid';
2
3
  export default function SourcesDataGrid({ rows, onChange, setSelected, }: {
3
4
  rows: Source[];
4
5
  onChange: (arg: Source[]) => void;
5
- setSelected: (arg: string[]) => void;
6
+ setSelected: (arg: GridRowId[]) => void;
6
7
  }): import("react/jsx-runtime").JSX.Element;
@@ -14,56 +14,49 @@ const useStyles = makeStyles()({
14
14
  });
15
15
  export default function SourcesDataGrid({ rows, onChange, setSelected, }) {
16
16
  const { classes } = useStyles();
17
+ const { id: _id, name: _name, label: _label, color: _color, baseUri: _baseUri, HP: _HP, ...rest } = rows[0];
17
18
  const [currSort, setCurrSort] = useState({
18
19
  idx: 0,
19
20
  field: null,
20
21
  });
21
- if (rows.length) {
22
- const { id: _id, name: _name, label: _label, color: _color, baseUri: _baseUri, HP: _HP, ...rest } = rows[0];
23
- return (_jsx("div", { style: { height: 400, width: '100%' }, children: _jsx(DataGrid, { checkboxSelection: true, disableRowSelectionOnClick: true, onRowSelectionModelChange: arg => {
24
- setSelected(arg);
25
- }, rows: rows, rowHeight: 25, columnHeaderHeight: 33, columns: [
26
- {
27
- field: 'color',
28
- headerName: 'Color',
29
- renderCell: params => {
30
- const { value, id } = params;
31
- return (_jsx(ColorPicker, { color: value || 'blue', onChange: c => {
32
- const elt = rows.find(f => f.name === id);
33
- if (elt) {
34
- elt.color = c;
35
- }
36
- onChange([...rows]);
37
- } }));
38
- },
22
+ return (_jsx("div", { style: { height: 400, width: '100%' }, children: _jsx(DataGrid, { checkboxSelection: true, onRowSelectionModelChange: arg => {
23
+ setSelected([...arg.ids]);
24
+ }, rows: rows, rowHeight: 25, columnHeaderHeight: 33, columns: [
25
+ {
26
+ field: 'color',
27
+ headerName: 'Color',
28
+ renderCell: params => {
29
+ const { value, id } = params;
30
+ return (_jsx(ColorPicker, { color: value || 'blue', onChange: c => {
31
+ const elt = rows.find(f => f.name === id);
32
+ if (elt) {
33
+ elt.color = c;
34
+ }
35
+ onChange([...rows]);
36
+ } }));
39
37
  },
40
- {
41
- field: 'label',
42
- headerName: 'Name',
43
- width: measureGridWidth(rows.map(r => r.label)),
44
- },
45
- ...Object.keys(rest).map(val => ({
46
- field: val,
47
- renderCell: ({ value }) => (_jsx("div", { className: classes.cell, children: _jsx(SanitizedHTML, { html: getStr(value) }) })),
48
- width: measureGridWidth(rows.map(r => `${r[val]}`)),
49
- })),
50
- ], sortModel: [], onSortModelChange: args => {
51
- const sort = args[0];
52
- const idx = (currSort.idx + 1) % 2;
53
- const field = sort.field || currSort.field;
54
- setCurrSort({ idx, field });
55
- onChange(field
56
- ? [...rows].sort((a, b) => {
57
- const aa = getStr(a[field]);
58
- const bb = getStr(b[field]);
59
- return idx === 1
60
- ? aa.localeCompare(bb)
61
- : bb.localeCompare(aa);
62
- })
63
- : rows);
64
- } }) }));
65
- }
66
- else {
67
- return _jsx("div", { children: "No rows, check sample metadata configuration" });
68
- }
38
+ },
39
+ {
40
+ field: 'label',
41
+ headerName: 'Name',
42
+ width: measureGridWidth(rows.map(r => r.label)),
43
+ },
44
+ ...Object.keys(rest).map(val => ({
45
+ field: val,
46
+ renderCell: ({ value }) => (_jsx("div", { className: classes.cell, children: _jsx(SanitizedHTML, { html: getStr(value) }) })),
47
+ width: measureGridWidth(rows.map(r => `${r[val]}`)),
48
+ })),
49
+ ], sortModel: [], onSortModelChange: args => {
50
+ const sort = args[0];
51
+ const idx = (currSort.idx + 1) % 2;
52
+ const field = sort.field || currSort.field;
53
+ setCurrSort({ idx, field });
54
+ onChange(field
55
+ ? [...rows].sort((a, b) => {
56
+ const aa = getStr(a[field]);
57
+ const bb = getStr(b[field]);
58
+ return idx === 1 ? aa.localeCompare(bb) : bb.localeCompare(aa);
59
+ })
60
+ : rows);
61
+ } }) }));
69
62
  }
@@ -4,6 +4,6 @@ import SourcesDataGrid from './SourcesDataGrid';
4
4
  import SourcesGridHeader from './SourcesGridHeader';
5
5
  function SourcesGrid({ rows, onChange, showTips, }) {
6
6
  const [selected, setSelected] = useState([]);
7
- return (_jsxs("div", { children: [_jsx(SourcesGridHeader, { selected: selected, rows: rows, showTips: showTips, onChange: onChange }), _jsx(SourcesDataGrid, { rows: rows, onChange: onChange, setSelected: setSelected })] }));
7
+ return (_jsxs("div", { children: [_jsx(SourcesGridHeader, { selected: selected, rows: rows, showTips: showTips, onChange: onChange }), rows.length ? (_jsx(SourcesDataGrid, { rows: rows, onChange: onChange, setSelected: setSelected })) : (_jsx("div", { children: "No rows" }))] }));
8
8
  }
9
9
  export default SourcesGrid;
@@ -1,7 +1,8 @@
1
1
  import type { Source } from '../types';
2
+ import type { GridRowId } from '@mui/x-data-grid';
2
3
  export default function SourcesGridHeader({ selected, onChange, rows, showTips, }: {
3
4
  onChange: (arg: Source[]) => void;
4
5
  rows: Source[];
5
- selected: string[];
6
+ selected: GridRowId[];
6
7
  showTips: boolean;
7
8
  }): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- export declare function drawColorAlleleCount(alleles: string[], ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, mostFrequentAlt: string): void;
1
+ export declare function drawColorAlleleCount(alleles: string[], ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, mostFrequentAlt: string, drawReference?: boolean, featureType?: string, featureStrand?: number, alpha?: number): any;
@@ -1,6 +1,6 @@
1
1
  import { colord } from '@jbrowse/core/util/colord';
2
2
  import { f2 } from './constants';
3
- function getColorAlleleCount(alleles, mostFrequentAlt) {
3
+ function getColorAlleleCount(alleles, mostFrequentAlt, drawReference = true) {
4
4
  const total = alleles.length;
5
5
  let alt = 0;
6
6
  let uncalled = 0;
@@ -21,7 +21,7 @@ function getColorAlleleCount(alleles, mostFrequentAlt) {
21
21
  }
22
22
  }
23
23
  if (ref === total) {
24
- return `#ccc`;
24
+ return drawReference ? '#ccc' : undefined;
25
25
  }
26
26
  else {
27
27
  let a1;
@@ -39,7 +39,31 @@ function getColorAlleleCount(alleles, mostFrequentAlt) {
39
39
  return (a1 === null || a1 === void 0 ? void 0 : a1.toHex()) || 'black';
40
40
  }
41
41
  }
42
- export function drawColorAlleleCount(alleles, ctx, x, y, w, h, mostFrequentAlt) {
43
- ctx.fillStyle = getColorAlleleCount(alleles, mostFrequentAlt);
44
- ctx.fillRect(x - f2, y - f2, w + f2, h + f2);
42
+ export function drawColorAlleleCount(alleles, ctx, x, y, w, h, mostFrequentAlt, drawReference = true, featureType = '', featureStrand, alpha = 1) {
43
+ const c = getColorAlleleCount(alleles, mostFrequentAlt, drawReference);
44
+ if (c) {
45
+ ctx.fillStyle = alpha !== 1 ? colord(c).alpha(alpha).toHex() : c;
46
+ if (featureType === 'inversion') {
47
+ if (featureStrand === 1) {
48
+ ctx.beginPath();
49
+ ctx.moveTo(x - f2, y - f2);
50
+ ctx.lineTo(x - f2, y + h + f2);
51
+ ctx.lineTo(x + w + f2, y + h / 2);
52
+ ctx.closePath();
53
+ ctx.fill();
54
+ }
55
+ else {
56
+ ctx.beginPath();
57
+ ctx.moveTo(x + w + f2, y - f2);
58
+ ctx.lineTo(x + w + f2, y + h + f2);
59
+ ctx.lineTo(x - f2, y + h / 2);
60
+ ctx.closePath();
61
+ ctx.fill();
62
+ }
63
+ }
64
+ else {
65
+ ctx.fillRect(x - f2, y - f2, w + f2, h + f2);
66
+ }
67
+ }
68
+ return c;
45
69
  }
@@ -1 +1 @@
1
- export declare function drawPhased(alleles: string[], ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, HP: number, PS?: string): void;
1
+ export declare function drawPhased(alleles: string[], ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, HP: number, PS?: string, drawReference?: boolean, alpha?: number): string | undefined;
@@ -1,18 +1,22 @@
1
1
  import { set1 } from '@jbrowse/core/ui/colors';
2
+ import { colord } from '@jbrowse/core/util/colord';
2
3
  import { f2 } from './constants';
3
4
  import { colorify } from './util';
4
- function getColorPhased(alleles, HP) {
5
+ function getColorPhased(alleles, HP, drawReference = true) {
5
6
  const c = +alleles[HP];
6
- return c ? set1[c - 1] || 'black' : '#ccc';
7
+ return c ? set1[c - 1] || 'black' : drawReference ? '#ccc' : undefined;
7
8
  }
8
- function getColorPhasedWithPhaseSet(alleles, HP, PS) {
9
+ function getColorPhasedWithPhaseSet(alleles, HP, PS, drawReference = true) {
9
10
  const c = +alleles[HP];
10
- return c ? colorify(+PS) || 'black' : '#ccc';
11
+ return c ? colorify(+PS) || 'black' : drawReference ? '#ccc' : undefined;
11
12
  }
12
- export function drawPhased(alleles, ctx, x, y, w, h, HP, PS) {
13
- ctx.fillStyle =
14
- PS !== undefined
15
- ? getColorPhasedWithPhaseSet(alleles, HP, PS)
16
- : getColorPhased(alleles, HP);
17
- ctx.fillRect(x - f2, y - f2, w + f2, h + f2);
13
+ export function drawPhased(alleles, ctx, x, y, w, h, HP, PS, drawReference = true, alpha = 1) {
14
+ const c = PS !== undefined
15
+ ? getColorPhasedWithPhaseSet(alleles, HP, PS, drawReference)
16
+ : getColorPhased(alleles, HP, drawReference);
17
+ if (c) {
18
+ ctx.fillStyle = alpha !== 1 ? colord(c).alpha(alpha).toHex() : c;
19
+ ctx.fillRect(x - f2, y - f2, w + f2, h + f2);
20
+ }
21
+ return c;
18
22
  }
@@ -2,7 +2,12 @@ import type { Feature } from '@jbrowse/core/util';
2
2
  export declare function findSecondLargestNumber(arr: Iterable<number>): number;
3
3
  export declare function calculateAlleleCounts(feat: Feature): Map<any, any>;
4
4
  export declare function calculateMinorAlleleFrequency(alleleCounts: Map<string, number>): number;
5
- export declare function getFeaturesThatPassMinorAlleleFrequencyFilter(feats: Iterable<Feature>, minorAlleleFrequencyFilter: number, lengthCutoffFilter?: number): {
5
+ export declare function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter, stopToken, }: {
6
+ features: Iterable<Feature>;
7
+ minorAlleleFrequencyFilter: number;
8
+ lengthCutoffFilter: number;
9
+ stopToken?: string;
10
+ }): {
6
11
  feature: Feature;
7
12
  mostFrequentAlt: string;
8
13
  alleleCounts: Map<string, number>;
@@ -1,4 +1,4 @@
1
- import { sum } from '@jbrowse/core/util';
1
+ import { forEachWithStopTokenCheck, sum } from '@jbrowse/core/util';
2
2
  export function findSecondLargestNumber(arr) {
3
3
  let firstMax = 0;
4
4
  let secondMax = 0;
@@ -41,21 +41,20 @@ function getMostFrequentAlt(alleleCounts) {
41
41
  }
42
42
  return mostFrequentAlt;
43
43
  }
44
- export function getFeaturesThatPassMinorAlleleFrequencyFilter(feats, minorAlleleFrequencyFilter, lengthCutoffFilter = 10) {
44
+ export function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter, stopToken, }) {
45
45
  const results = [];
46
- for (const feature of feats) {
46
+ forEachWithStopTokenCheck(features, stopToken, feature => {
47
47
  if (feature.get('end') - feature.get('start') <= lengthCutoffFilter) {
48
48
  const alleleCounts = calculateAlleleCounts(feature);
49
49
  if (calculateMinorAlleleFrequency(alleleCounts) >=
50
50
  minorAlleleFrequencyFilter) {
51
- const mostFrequentAlt = getMostFrequentAlt(alleleCounts);
52
51
  results.push({
53
52
  feature,
54
- mostFrequentAlt,
53
+ mostFrequentAlt: getMostFrequentAlt(alleleCounts),
55
54
  alleleCounts,
56
55
  });
57
56
  }
58
57
  }
59
- }
58
+ });
60
59
  return results;
61
60
  }
@@ -1,10 +1,11 @@
1
+ import type { GridRowId } from '@mui/x-data-grid';
1
2
  export declare function moveUp(arr: {
2
3
  name: string;
3
- }[], sel: string[], by?: number): {
4
+ }[], sel: GridRowId[], by?: number): {
4
5
  name: string;
5
6
  }[];
6
7
  export declare function moveDown(arr: {
7
8
  name: string;
8
- }[], sel: string[], by?: number): {
9
+ }[], sel: GridRowId[], by?: number): {
9
10
  name: string;
10
11
  }[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-variants",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "JBrowse 2 variant adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -40,13 +40,14 @@
40
40
  "@gmod/bgzf-filehandle": "^2.0.1",
41
41
  "@gmod/tabix": "^2.0.0",
42
42
  "@gmod/vcf": "^6.0.8",
43
- "@jbrowse/core": "^3.2.0",
44
- "@jbrowse/plugin-circular-view": "^3.2.0",
45
- "@jbrowse/plugin-linear-genome-view": "^3.2.0",
46
- "@jbrowse/sv-core": "^3.2.0",
47
- "@mui/icons-material": "^6.0.0",
48
- "@mui/material": "^6.0.0",
49
- "@mui/x-data-grid": "^7.0.0",
43
+ "@jbrowse/core": "^3.3.0",
44
+ "@jbrowse/plugin-circular-view": "^3.3.0",
45
+ "@jbrowse/plugin-linear-genome-view": "^3.3.0",
46
+ "@jbrowse/sv-core": "^3.3.0",
47
+ "@mui/icons-material": "^7.0.0",
48
+ "@mui/material": "^7.0.0",
49
+ "@mui/x-data-grid": "^8.0.0",
50
+ "escape-html": "^1.0.3",
50
51
  "mobx": "^6.0.0",
51
52
  "mobx-react": "^9.0.0",
52
53
  "mobx-state-tree": "^5.0.0",
@@ -62,5 +63,5 @@
62
63
  "distModule": "esm/index.js",
63
64
  "srcModule": "src/index.ts",
64
65
  "module": "esm/index.js",
65
- "gitHead": "c750e3f56706a490c19ba75abd807fec5e38aebf"
66
+ "gitHead": "0bb64d8cc7ecdd167515308b31eec3d9acbc59e4"
66
67
  }
@@ -1,7 +0,0 @@
1
- import type { MultiLinearVariantDisplayModel } from '../model';
2
- declare const Crosshair: ({ mouseX, mouseY, model, }: {
3
- mouseX: number;
4
- mouseY: number;
5
- model: MultiLinearVariantDisplayModel;
6
- }) => import("react/jsx-runtime").JSX.Element | null;
7
- export default Crosshair;
@@ -1,35 +0,0 @@
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 jsx_runtime_1 = require("react/jsx-runtime");
7
- const util_1 = require("@jbrowse/core/util");
8
- const mobx_react_1 = require("mobx-react");
9
- const mui_1 = require("tss-react/mui");
10
- const MultiVariantTooltip_1 = __importDefault(require("../../shared/components/MultiVariantTooltip"));
11
- const useStyles = (0, mui_1.makeStyles)()({
12
- rel: {
13
- position: 'relative',
14
- },
15
- cursor: {
16
- pointerEvents: 'none',
17
- zIndex: 800,
18
- position: 'absolute',
19
- },
20
- color: {
21
- width: 10,
22
- height: 10,
23
- },
24
- });
25
- const Crosshair = (0, mobx_react_1.observer)(function ({ mouseX, mouseY, model, }) {
26
- const { classes } = useStyles();
27
- const { hoveredGenotype, height, scrollTop, rowHeight, sources } = model;
28
- const { width } = (0, util_1.getContainingView)(model);
29
- const source = sources === null || sources === void 0 ? void 0 : sources[Math.floor(mouseY / rowHeight)];
30
- const y = mouseY - scrollTop;
31
- return source ? ((0, jsx_runtime_1.jsxs)("div", { className: classes.rel, children: [(0, jsx_runtime_1.jsxs)("svg", { className: classes.cursor, width: width, height: height, style: {
32
- top: scrollTop,
33
- }, children: [(0, jsx_runtime_1.jsx)("line", { x1: 0, x2: width, y1: y, y2: y, stroke: "black" }), (0, jsx_runtime_1.jsx)("line", { x1: mouseX, x2: mouseX, y1: 0, y2: height, stroke: "black" })] }), (0, jsx_runtime_1.jsx)(MultiVariantTooltip_1.default, { source: { ...source, hoveredGenotype } })] })) : null;
34
- });
35
- exports.default = Crosshair;
@@ -1,7 +0,0 @@
1
- import type { MultiLinearVariantMatrixDisplayModel } from '../model';
2
- declare const Crosshair: ({ mouseX, mouseY, model, }: {
3
- mouseX: number;
4
- mouseY: number;
5
- model: MultiLinearVariantMatrixDisplayModel;
6
- }) => import("react/jsx-runtime").JSX.Element | null;
7
- export default Crosshair;
@@ -1,28 +0,0 @@
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 jsx_runtime_1 = require("react/jsx-runtime");
7
- const util_1 = require("@jbrowse/core/util");
8
- const mobx_react_1 = require("mobx-react");
9
- const mui_1 = require("tss-react/mui");
10
- const MultiVariantTooltip_1 = __importDefault(require("../../shared/components/MultiVariantTooltip"));
11
- const useStyles = (0, mui_1.makeStyles)()({
12
- cursor: {
13
- pointerEvents: 'none',
14
- zIndex: 800,
15
- position: 'relative',
16
- },
17
- });
18
- const Crosshair = (0, mobx_react_1.observer)(function ({ mouseX, mouseY, model, }) {
19
- const { classes } = useStyles();
20
- const { hoveredGenotype, lineZoneHeight, totalHeight, rowHeight, sources } = model;
21
- const { width } = (0, util_1.getContainingView)(model);
22
- const source = sources === null || sources === void 0 ? void 0 : sources[Math.floor((mouseY - lineZoneHeight) / rowHeight)];
23
- const yoff = mouseY - lineZoneHeight;
24
- return source ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("svg", { className: classes.cursor, width: width, height: totalHeight, style: {
25
- top: lineZoneHeight,
26
- }, children: [(0, jsx_runtime_1.jsx)("line", { x1: 0, x2: width, y1: yoff, y2: yoff, stroke: "black" }), (0, jsx_runtime_1.jsx)("line", { x1: mouseX, x2: mouseX, y1: 0, y2: totalHeight, stroke: "black" })] }), (0, jsx_runtime_1.jsx)(MultiVariantTooltip_1.default, { source: { ...source, hoveredGenotype } })] })) : null;
27
- });
28
- exports.default = Crosshair;
@@ -1,7 +0,0 @@
1
- declare const LinearVariantMatrixRendering: (props: {
2
- width: number;
3
- height: number;
4
- displayModel: any;
5
- arr: string[];
6
- }) => import("react/jsx-runtime").JSX.Element;
7
- export default LinearVariantMatrixRendering;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const react_1 = require("react");
5
- const ui_1 = require("@jbrowse/core/ui");
6
- const mobx_react_1 = require("mobx-react");
7
- const LinearVariantMatrixRendering = (0, mobx_react_1.observer)(function (props) {
8
- const { arr, width, height, displayModel } = props;
9
- const ref = (0, react_1.useRef)(null);
10
- function getFeatureUnderMouse(eventClientX, eventClientY) {
11
- var _a, _b;
12
- let offsetX = 0;
13
- let offsetY = 0;
14
- if (ref.current) {
15
- const r = ref.current.getBoundingClientRect();
16
- offsetX = eventClientX - r.left;
17
- offsetY = eventClientY - r.top;
18
- }
19
- const dimY = arr.length;
20
- const dimX = ((_a = arr[0]) === null || _a === void 0 ? void 0 : _a.length) || 0;
21
- return (_b = arr[Math.floor((offsetX / width) * dimY)]) === null || _b === void 0 ? void 0 : _b[Math.floor((offsetY / height) * dimX)];
22
- }
23
- return ((0, jsx_runtime_1.jsx)("div", { ref: ref, onMouseMove: e => {
24
- var _a;
25
- return (_a = displayModel.setHoveredGenotype) === null || _a === void 0 ? void 0 : _a.call(displayModel, getFeatureUnderMouse(e.clientX, e.clientY));
26
- }, onMouseLeave: () => {
27
- var _a;
28
- (_a = displayModel.setHoveredGenotype) === null || _a === void 0 ? void 0 : _a.call(displayModel, undefined);
29
- }, onMouseOut: () => {
30
- var _a;
31
- (_a = displayModel.setHoveredGenotype) === null || _a === void 0 ? void 0 : _a.call(displayModel, undefined);
32
- }, style: {
33
- overflow: 'visible',
34
- position: 'relative',
35
- height,
36
- }, children: (0, jsx_runtime_1.jsx)(ui_1.PrerenderedCanvas, { ...props }) }));
37
- });
38
- exports.default = LinearVariantMatrixRendering;