@jbrowse/plugin-variants 3.1.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.
- package/dist/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +3 -3
- package/dist/MultiLinearVariantDisplay/index.js +1 -1
- package/dist/MultiLinearVariantDisplay/model.d.ts +58 -3
- package/dist/MultiLinearVariantDisplay/model.js +0 -1
- package/dist/MultiLinearVariantDisplay/renderSvg.js +2 -2
- package/dist/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +15 -5
- package/dist/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +3 -3
- package/dist/MultiLinearVariantMatrixDisplay/index.js +1 -1
- package/dist/MultiLinearVariantMatrixDisplay/model.d.ts +59 -2
- package/dist/MultiLinearVariantMatrixDisplay/model.js +5 -1
- package/dist/MultiLinearVariantMatrixDisplay/renderSvg.js +2 -2
- package/dist/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.d.ts → MultiLinearVariantMatrixRenderer.d.ts} +7 -3
- package/dist/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.d.ts +8 -0
- package/dist/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.js +41 -0
- package/dist/MultiLinearVariantMatrixRenderer/index.js +4 -4
- package/dist/MultiLinearVariantMatrixRenderer/makeImageData.d.ts +2 -2
- package/dist/MultiLinearVariantMatrixRenderer/makeImageData.js +15 -8
- package/dist/MultiLinearVariantMatrixRenderer/types.d.ts +2 -4
- package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +30 -1
- package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.js +11 -5
- package/dist/MultiLinearVariantRenderer/components/{MultiVariantRendering.d.ts → MultiLinearVariantRendering.d.ts} +10 -4
- package/dist/MultiLinearVariantRenderer/{MultiVariantRendering.js → components/MultiLinearVariantRendering.js} +25 -7
- package/dist/MultiLinearVariantRenderer/components/util.d.ts +1 -0
- package/dist/MultiLinearVariantRenderer/components/util.js +15 -0
- package/dist/MultiLinearVariantRenderer/index.js +2 -2
- package/dist/MultiLinearVariantRenderer/makeImageData.d.ts +9 -0
- package/dist/MultiLinearVariantRenderer/makeImageData.js +63 -23
- package/dist/MultiLinearVariantRenderer/types.d.ts +1 -0
- package/dist/SplitVcfTabixAdapter/configSchema.js +4 -2
- package/dist/VariantFeatureWidget/AltFormatter.d.ts +4 -0
- package/dist/VariantFeatureWidget/AltFormatter.js +13 -0
- package/dist/VariantFeatureWidget/Checkbox2.js +1 -8
- package/dist/VariantFeatureWidget/Formatter.d.ts +3 -0
- package/dist/VariantFeatureWidget/Formatter.js +23 -0
- package/dist/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.js → VariantConsequence/VariantConsequenceDataGridWrapper.js} +3 -5
- package/dist/VariantFeatureWidget/VariantFeatureWidget.js +7 -2
- package/dist/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.d.ts +4 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.js +80 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.d.ts +3 -9
- package/dist/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.js +41 -20
- package/dist/VariantFeatureWidget/VariantSampleGrid/types.d.ts +21 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid/types.js +2 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid/util.d.ts +1 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid/util.js +14 -0
- package/dist/VariantRPC/MultiVariantClusterGenotypeMatrix.d.ts +14 -0
- package/dist/VariantRPC/MultiVariantClusterGenotypeMatrix.js +30 -0
- package/dist/VariantRPC/MultiVariantGetGenotypeMatrix.d.ts +2 -13
- package/dist/VariantRPC/MultiVariantGetGenotypeMatrix.js +5 -57
- package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +3 -10
- package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.js +15 -10
- package/dist/VariantRPC/getGenotypeMatrix.d.ts +6 -0
- package/dist/VariantRPC/getGenotypeMatrix.js +60 -0
- package/dist/VariantRPC/types.d.ts +36 -0
- package/dist/VariantRPC/types.js +2 -0
- package/dist/VcfAdapter/VcfAdapter.js +6 -3
- package/dist/VcfFeature/index.js +0 -1
- package/dist/VcfFeature/util.d.ts +2 -0
- package/dist/VcfFeature/util.js +125 -27
- package/dist/VcfTabixAdapter/VcfTabixAdapter.js +17 -7
- package/dist/getMultiVariantFeaturesAutorun.d.ts +2 -0
- package/dist/getMultiVariantFeaturesAutorun.js +9 -2
- package/dist/getMultiVariantSourcesAutorun.js +3 -2
- package/dist/index.js +2 -0
- package/dist/shared/MultiVariantBaseModel.d.ts +59 -3
- package/dist/shared/MultiVariantBaseModel.js +95 -37
- package/dist/shared/components/AddFiltersDialog.d.ts +9 -0
- package/dist/shared/components/AddFiltersDialog.js +61 -0
- package/dist/shared/components/MultiVariantBaseDisplayComponent.d.ts +5 -0
- package/dist/shared/components/MultiVariantBaseDisplayComponent.js +29 -0
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialog.d.ts +6 -0
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialog.js +29 -0
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.d.ts +7 -0
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.js +74 -0
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogManual.d.ts +7 -0
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogManual.js +145 -0
- package/dist/shared/components/MultiVariantClusterDialog/types.d.ts +10 -0
- package/dist/shared/components/MultiVariantClusterDialog/types.js +2 -0
- package/{esm/shared/components/ColorLegend.d.ts → dist/shared/components/MultiVariantColorLegend.d.ts} +2 -2
- package/dist/shared/components/{ColorLegend.js → MultiVariantColorLegend.js} +5 -3
- package/dist/shared/components/MultiVariantCrosshairs.d.ts +7 -0
- package/dist/shared/components/MultiVariantCrosshairs.js +40 -0
- package/dist/shared/components/MultiVariantLegendBar.d.ts +7 -0
- package/dist/shared/components/{LegendBar.js → MultiVariantLegendBar.js} +2 -2
- package/dist/shared/components/MultiVariantTooltip.d.ts +4 -0
- package/dist/shared/components/MultiVariantTooltip.js +3 -2
- package/dist/shared/components/RectBg.js +4 -2
- package/dist/shared/components/SetColorDialog.js +1 -1
- package/dist/shared/components/SourcesDataGrid.d.ts +2 -1
- package/dist/shared/components/SourcesDataGrid.js +2 -2
- package/dist/shared/components/SourcesGrid.js +1 -1
- package/dist/shared/components/SourcesGridHeader.d.ts +2 -1
- package/dist/shared/components/SourcesGridHeader.js +2 -2
- package/dist/shared/drawAlleleCount.d.ts +1 -1
- package/dist/shared/drawAlleleCount.js +29 -5
- package/dist/shared/drawPhased.d.ts +1 -1
- package/dist/shared/drawPhased.js +14 -10
- package/dist/shared/getSources.d.ts +15 -0
- package/dist/shared/getSources.js +34 -0
- package/dist/shared/minorAlleleFrequencyUtils.d.ts +6 -1
- package/dist/shared/minorAlleleFrequencyUtils.js +4 -5
- package/dist/shared/sourcesGridUtils.d.ts +3 -2
- package/esm/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +2 -2
- package/esm/MultiLinearVariantDisplay/index.js +1 -1
- package/esm/MultiLinearVariantDisplay/model.d.ts +58 -3
- package/esm/MultiLinearVariantDisplay/model.js +0 -1
- package/esm/MultiLinearVariantDisplay/renderSvg.js +1 -1
- package/esm/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +15 -8
- package/esm/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +2 -2
- package/esm/MultiLinearVariantMatrixDisplay/index.js +1 -1
- package/esm/MultiLinearVariantMatrixDisplay/model.d.ts +59 -2
- package/esm/MultiLinearVariantMatrixDisplay/model.js +5 -1
- package/esm/MultiLinearVariantMatrixDisplay/renderSvg.js +1 -1
- package/esm/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.d.ts → MultiLinearVariantMatrixRenderer.d.ts} +7 -3
- package/esm/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.d.ts +8 -0
- package/esm/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.js +39 -0
- package/esm/MultiLinearVariantMatrixRenderer/index.js +4 -4
- package/esm/MultiLinearVariantMatrixRenderer/makeImageData.d.ts +2 -2
- package/esm/MultiLinearVariantMatrixRenderer/makeImageData.js +16 -9
- package/esm/MultiLinearVariantMatrixRenderer/types.d.ts +2 -4
- package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +30 -1
- package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.js +11 -5
- package/esm/MultiLinearVariantRenderer/components/{MultiVariantRendering.d.ts → MultiLinearVariantRendering.d.ts} +10 -4
- package/esm/MultiLinearVariantRenderer/components/{MultiVariantRendering.js → MultiLinearVariantRendering.js} +25 -7
- package/esm/MultiLinearVariantRenderer/components/util.d.ts +1 -0
- package/esm/MultiLinearVariantRenderer/components/util.js +12 -0
- package/esm/MultiLinearVariantRenderer/index.js +1 -1
- package/esm/MultiLinearVariantRenderer/makeImageData.d.ts +9 -0
- package/esm/MultiLinearVariantRenderer/makeImageData.js +64 -24
- package/esm/MultiLinearVariantRenderer/types.d.ts +1 -0
- package/esm/SplitVcfTabixAdapter/configSchema.js +4 -2
- package/esm/VariantFeatureWidget/AltFormatter.d.ts +4 -0
- package/esm/VariantFeatureWidget/AltFormatter.js +10 -0
- package/esm/VariantFeatureWidget/Checkbox2.js +2 -9
- package/esm/VariantFeatureWidget/Formatter.d.ts +3 -0
- package/esm/VariantFeatureWidget/Formatter.js +17 -0
- package/esm/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.js → VariantConsequence/VariantConsequenceDataGridWrapper.js} +4 -6
- package/esm/VariantFeatureWidget/VariantFeatureWidget.js +7 -2
- package/esm/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.d.ts +4 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.js +74 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.d.ts +3 -9
- package/esm/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.js +43 -22
- package/esm/VariantFeatureWidget/VariantSampleGrid/types.d.ts +21 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid/types.js +1 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid/util.d.ts +1 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid/util.js +11 -0
- package/esm/VariantRPC/MultiVariantClusterGenotypeMatrix.d.ts +14 -0
- package/esm/VariantRPC/MultiVariantClusterGenotypeMatrix.js +23 -0
- package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.d.ts +2 -13
- package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.js +5 -57
- package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +3 -10
- package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.js +15 -10
- package/esm/VariantRPC/getGenotypeMatrix.d.ts +6 -0
- package/esm/VariantRPC/getGenotypeMatrix.js +57 -0
- package/esm/VariantRPC/types.d.ts +36 -0
- package/esm/VariantRPC/types.js +1 -0
- package/esm/VcfAdapter/VcfAdapter.js +7 -4
- package/esm/VcfFeature/index.js +0 -1
- package/esm/VcfFeature/util.d.ts +2 -0
- package/esm/VcfFeature/util.js +123 -27
- package/esm/VcfTabixAdapter/VcfTabixAdapter.js +18 -8
- package/esm/getMultiVariantFeaturesAutorun.d.ts +2 -0
- package/esm/getMultiVariantFeaturesAutorun.js +9 -2
- package/esm/getMultiVariantSourcesAutorun.js +3 -2
- package/esm/index.js +2 -0
- package/esm/shared/MultiVariantBaseModel.d.ts +59 -3
- package/esm/shared/MultiVariantBaseModel.js +97 -39
- package/esm/shared/components/AddFiltersDialog.d.ts +9 -0
- package/esm/shared/components/AddFiltersDialog.js +59 -0
- package/esm/shared/components/MultiVariantBaseDisplayComponent.d.ts +5 -0
- package/esm/shared/components/MultiVariantBaseDisplayComponent.js +24 -0
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialog.d.ts +6 -0
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialog.js +24 -0
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.d.ts +7 -0
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.js +72 -0
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogManual.d.ts +7 -0
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogManual.js +140 -0
- package/esm/shared/components/MultiVariantClusterDialog/types.d.ts +10 -0
- package/esm/shared/components/MultiVariantClusterDialog/types.js +1 -0
- package/{dist/shared/components/ColorLegend.d.ts → esm/shared/components/MultiVariantColorLegend.d.ts} +2 -2
- package/esm/shared/components/{ColorLegend.js → MultiVariantColorLegend.js} +6 -4
- package/esm/shared/components/MultiVariantCrosshairs.d.ts +7 -0
- package/esm/shared/components/MultiVariantCrosshairs.js +35 -0
- package/esm/shared/components/MultiVariantLegendBar.d.ts +7 -0
- package/esm/shared/components/{LegendBar.js → MultiVariantLegendBar.js} +1 -1
- package/esm/shared/components/MultiVariantTooltip.d.ts +4 -0
- package/esm/shared/components/MultiVariantTooltip.js +3 -2
- package/esm/shared/components/RectBg.js +4 -2
- package/esm/shared/components/SetColorDialog.js +1 -1
- package/esm/shared/components/SourcesDataGrid.d.ts +2 -1
- package/esm/shared/components/SourcesDataGrid.js +2 -2
- package/esm/shared/components/SourcesGrid.js +1 -1
- package/esm/shared/components/SourcesGridHeader.d.ts +2 -1
- package/esm/shared/components/SourcesGridHeader.js +2 -2
- package/esm/shared/drawAlleleCount.d.ts +1 -1
- package/esm/shared/drawAlleleCount.js +29 -5
- package/esm/shared/drawPhased.d.ts +1 -1
- package/esm/shared/drawPhased.js +14 -10
- package/esm/shared/getSources.d.ts +15 -0
- package/esm/shared/getSources.js +31 -0
- package/esm/shared/minorAlleleFrequencyUtils.d.ts +6 -1
- package/esm/shared/minorAlleleFrequencyUtils.js +5 -6
- package/esm/shared/sourcesGridUtils.d.ts +3 -2
- package/package.json +10 -9
- package/dist/MultiLinearVariantDisplay/components/Crosshair.d.ts +0 -7
- package/dist/MultiLinearVariantDisplay/components/Crosshair.js +0 -35
- package/dist/MultiLinearVariantMatrixDisplay/components/Crosshair.d.ts +0 -7
- package/dist/MultiLinearVariantMatrixDisplay/components/Crosshair.js +0 -28
- package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +0 -7
- package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +0 -38
- package/dist/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +0 -22
- package/dist/MultiLinearVariantRenderer/components/MultiVariantRendering.js +0 -52
- package/dist/VariantFeatureWidget/VariantConsequencePanel.d.ts +0 -5
- package/dist/VariantFeatureWidget/VariantConsequencePanel.js +0 -15
- package/dist/shared/components/ClusterDialog.d.ts +0 -11
- package/dist/shared/components/ClusterDialog.js +0 -113
- package/dist/shared/components/LegendBar.d.ts +0 -18
- package/esm/MultiLinearVariantDisplay/components/Crosshair.d.ts +0 -7
- package/esm/MultiLinearVariantDisplay/components/Crosshair.js +0 -30
- package/esm/MultiLinearVariantMatrixDisplay/components/Crosshair.d.ts +0 -7
- package/esm/MultiLinearVariantMatrixDisplay/components/Crosshair.js +0 -23
- package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +0 -7
- package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +0 -36
- package/esm/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +0 -22
- package/esm/MultiLinearVariantRenderer/MultiVariantRendering.js +0 -47
- package/esm/VariantFeatureWidget/VariantConsequencePanel.d.ts +0 -5
- package/esm/VariantFeatureWidget/VariantConsequencePanel.js +0 -9
- package/esm/shared/components/ClusterDialog.d.ts +0 -11
- package/esm/shared/components/ClusterDialog.js +0 -107
- package/esm/shared/components/LegendBar.d.ts +0 -18
- /package/dist/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.js → MultiLinearVariantMatrixRenderer.js} +0 -0
- /package/dist/VariantFeatureWidget/{VariantConsequenceDataGrid.d.ts → VariantConsequence/VariantConsequenceDataGrid.d.ts} +0 -0
- /package/dist/VariantFeatureWidget/{VariantConsequenceDataGrid.js → VariantConsequence/VariantConsequenceDataGrid.js} +0 -0
- /package/dist/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.d.ts → VariantConsequence/VariantConsequenceDataGridWrapper.d.ts} +0 -0
- /package/esm/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.js → MultiLinearVariantMatrixRenderer.js} +0 -0
- /package/esm/VariantFeatureWidget/{VariantConsequenceDataGrid.d.ts → VariantConsequence/VariantConsequenceDataGrid.d.ts} +0 -0
- /package/esm/VariantFeatureWidget/{VariantConsequenceDataGrid.js → VariantConsequence/VariantConsequenceDataGrid.js} +0 -0
- /package/esm/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.d.ts → VariantConsequence/VariantConsequenceDataGridWrapper.d.ts} +0 -0
package/esm/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { ResizeHandle } from '@jbrowse/core/ui';
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, isValidElement, useState } from 'react';
|
|
3
|
+
import { ResizeHandle, SanitizedHTML } from '@jbrowse/core/ui';
|
|
4
|
+
import BaseTooltip from '@jbrowse/core/ui/BaseTooltip';
|
|
4
5
|
import { getContainingView, getSession } from '@jbrowse/core/util';
|
|
5
6
|
import { observer } from 'mobx-react';
|
|
6
7
|
import { makeStyles } from 'tss-react/mui';
|
|
@@ -35,15 +36,21 @@ const LinesConnectingMatrixToGenomicPosition = observer(function ({ model, expor
|
|
|
35
36
|
const assembly = assemblyManager.get(assemblyNames[0]);
|
|
36
37
|
const b0 = ((_a = dynamicBlocks.contentBlocks[0]) === null || _a === void 0 ? void 0 : _a.widthPx) || 0;
|
|
37
38
|
const w = b0 / ((featuresVolatile === null || featuresVolatile === void 0 ? void 0 : featuresVolatile.length) || 1);
|
|
38
|
-
return assembly && featuresVolatile ? (_jsxs(_Fragment, { children: [_jsxs(Wrapper, { exportSVG: exportSVG, model: model, children: [_jsx(AllLines, { model: model, setMouseOverLine: setMouseOverLine }), mouseOverLine ? (_jsx("line", { stroke: "#f00c", strokeWidth: 2, style: {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
return assembly && featuresVolatile ? (_jsxs(_Fragment, { children: [_jsxs(Wrapper, { exportSVG: exportSVG, model: model, children: [_jsx(AllLines, { model: model, setMouseOverLine: setMouseOverLine }), mouseOverLine ? (_jsxs(_Fragment, { children: [_jsx("line", { stroke: "#f00c", strokeWidth: 2, style: {
|
|
40
|
+
pointerEvents: 'none',
|
|
41
|
+
}, x1: mouseOverLine.idx * w + w / 2, x2: mouseOverLine.c, y1: lineZoneHeight, y2: 0, onMouseLeave: () => {
|
|
42
|
+
setMouseOverLine(undefined);
|
|
43
|
+
} }), _jsx(LineTooltip, { contents: mouseOverLine.f.get('name') })] })) : null] }), !exportSVG ? (_jsx(ResizeHandle, { style: {
|
|
43
44
|
position: 'absolute',
|
|
44
45
|
top: lineZoneHeight - 4,
|
|
45
46
|
}, onDrag: n => model.setLineZoneHeight(lineZoneHeight + n), className: classes.resizeHandle })) : null] })) : null;
|
|
46
47
|
});
|
|
48
|
+
const TooltipContents = forwardRef(function TooltipContents2({ message }, ref) {
|
|
49
|
+
return (_jsx("div", { ref: ref, children: isValidElement(message) ? (message) : message ? (_jsx(SanitizedHTML, { html: String(message) })) : null }));
|
|
50
|
+
});
|
|
51
|
+
const LineTooltip = observer(function ({ contents }) {
|
|
52
|
+
return contents ? (_jsx(BaseTooltip, { children: _jsx(TooltipContents, { message: contents }) })) : null;
|
|
53
|
+
});
|
|
47
54
|
const AllLines = observer(function ({ model, setMouseOverLine, }) {
|
|
48
55
|
var _a;
|
|
49
56
|
const { assemblyManager } = getSession(model);
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRef, useState } from 'react';
|
|
3
3
|
import { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
|
-
import Crosshair from './Crosshair';
|
|
6
5
|
import LinesConnectingMatrixToGenomicPosition from './LinesConnectingMatrixToGenomicPosition';
|
|
7
|
-
import
|
|
6
|
+
import Crosshair from '../../shared/components/MultiVariantCrosshairs';
|
|
7
|
+
import LegendBar from '../../shared/components/MultiVariantLegendBar';
|
|
8
8
|
const MultiLinearVariantMatrixDisplayComponent = observer(function (props) {
|
|
9
9
|
const { model } = props;
|
|
10
10
|
const { lineZoneHeight } = model;
|
|
@@ -7,7 +7,7 @@ export default function LinearVariantMatrixDisplayF(pluginManager) {
|
|
|
7
7
|
const configSchema = configSchemaF(pluginManager);
|
|
8
8
|
return new DisplayType({
|
|
9
9
|
name: 'LinearVariantMatrixDisplay',
|
|
10
|
-
displayName: 'Multi-variant display (matrix)',
|
|
10
|
+
displayName: 'Multi-sample variant display (matrix)',
|
|
11
11
|
configSchema,
|
|
12
12
|
stateModel: stateModelFactory(configSchema),
|
|
13
13
|
trackType: 'VariantTrack',
|
|
@@ -89,6 +89,9 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
89
89
|
renderingMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
90
90
|
rowHeightSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
91
91
|
autoHeight: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
92
|
+
lengthCutoffFilter: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
93
|
+
jexlFilters: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IArrayType<import("mobx-state-tree").ISimpleType<string>>>;
|
|
94
|
+
referenceDrawingMode: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
92
95
|
} & {
|
|
93
96
|
type: import("mobx-state-tree").ISimpleType<"LinearVariantMatrixDisplay">;
|
|
94
97
|
rowHeightSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
@@ -236,19 +239,28 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
236
239
|
renderProps(): any;
|
|
237
240
|
} & {
|
|
238
241
|
sourcesLoadingStopToken: string | undefined;
|
|
242
|
+
simplifiedFeaturesStopToken: string | undefined;
|
|
239
243
|
featureUnderMouseVolatile: import("@jbrowse/core/util").Feature | undefined;
|
|
240
244
|
sourcesVolatile: import("../shared/types").Source[] | undefined;
|
|
241
245
|
featuresVolatile: import("@jbrowse/core/util").Feature[] | undefined;
|
|
242
246
|
hasPhased: boolean;
|
|
243
247
|
sampleInfo: undefined | Record<string, import("../shared/types").SampleInfo>;
|
|
244
|
-
hoveredGenotype:
|
|
248
|
+
hoveredGenotype: {
|
|
249
|
+
genotype: string;
|
|
250
|
+
name: string;
|
|
251
|
+
} | undefined;
|
|
245
252
|
} & {
|
|
253
|
+
setJexlFilters(f?: string[]): void;
|
|
246
254
|
setRowHeight(arg: number): void;
|
|
247
|
-
setHoveredGenotype(arg
|
|
255
|
+
setHoveredGenotype(arg?: {
|
|
256
|
+
genotype: string;
|
|
257
|
+
name: string;
|
|
258
|
+
}): void;
|
|
248
259
|
setFeatures(f: import("@jbrowse/core/util").Feature[]): void;
|
|
249
260
|
setLayout(layout: import("../shared/types").Source[]): void;
|
|
250
261
|
clearLayout(): void;
|
|
251
262
|
setSourcesLoading(str: string): void;
|
|
263
|
+
setSimplifiedFeaturesLoading(str: string): void;
|
|
252
264
|
setSources(sources: import("../shared/types").Source[]): void;
|
|
253
265
|
setMafFilter(arg: number): void;
|
|
254
266
|
setShowSidebarLabels(arg: boolean): void;
|
|
@@ -256,8 +268,19 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
256
268
|
setAutoHeight(arg: boolean): void;
|
|
257
269
|
setHasPhased(arg: boolean): void;
|
|
258
270
|
setSampleInfo(arg: Record<string, import("../shared/types").SampleInfo>): void;
|
|
271
|
+
setReferenceDrawingMode(arg: string): void;
|
|
259
272
|
} & {
|
|
273
|
+
readonly activeFilters: any;
|
|
260
274
|
readonly preSources: import("../shared/types").Source[] | undefined;
|
|
275
|
+
readonly sourcesWithoutLayout: {
|
|
276
|
+
label: string;
|
|
277
|
+
id: string;
|
|
278
|
+
baseUri?: string;
|
|
279
|
+
name: string;
|
|
280
|
+
color?: string;
|
|
281
|
+
group?: string;
|
|
282
|
+
HP?: number;
|
|
283
|
+
}[] | undefined;
|
|
261
284
|
readonly sources: {
|
|
262
285
|
label: string;
|
|
263
286
|
id: string;
|
|
@@ -268,6 +291,17 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
268
291
|
HP?: number;
|
|
269
292
|
}[] | undefined;
|
|
270
293
|
} & {
|
|
294
|
+
readonly sourceMap: {
|
|
295
|
+
[k: string]: {
|
|
296
|
+
label: string;
|
|
297
|
+
id: string;
|
|
298
|
+
baseUri?: string;
|
|
299
|
+
name: string;
|
|
300
|
+
color?: string;
|
|
301
|
+
group?: string;
|
|
302
|
+
HP?: number;
|
|
303
|
+
};
|
|
304
|
+
} | undefined;
|
|
271
305
|
readonly rowHeight: number;
|
|
272
306
|
adapterProps(): any;
|
|
273
307
|
trackMenuItems(): (import("@jbrowse/core/ui").MenuDivider | import("@jbrowse/core/ui").MenuSubHeader | import("@jbrowse/core/ui").NormalMenuItem | import("@jbrowse/core/ui").CheckboxMenuItem | import("@jbrowse/core/ui").RadioMenuItem | import("@jbrowse/core/ui").SubMenuItem | {
|
|
@@ -321,6 +355,18 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
321
355
|
type?: undefined;
|
|
322
356
|
checked?: undefined;
|
|
323
357
|
onClick?: undefined;
|
|
358
|
+
} | {
|
|
359
|
+
label: string;
|
|
360
|
+
type: string;
|
|
361
|
+
subMenu: {
|
|
362
|
+
label: string;
|
|
363
|
+
type: string;
|
|
364
|
+
checked: boolean;
|
|
365
|
+
onClick: () => void;
|
|
366
|
+
}[];
|
|
367
|
+
icon?: undefined;
|
|
368
|
+
checked?: undefined;
|
|
369
|
+
onClick?: undefined;
|
|
324
370
|
} | {
|
|
325
371
|
label: string;
|
|
326
372
|
icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
@@ -333,10 +379,20 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
333
379
|
type?: undefined;
|
|
334
380
|
checked?: undefined;
|
|
335
381
|
onClick?: undefined;
|
|
382
|
+
} | {
|
|
383
|
+
label: string;
|
|
384
|
+
icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
385
|
+
muiName: string;
|
|
386
|
+
};
|
|
387
|
+
onClick: () => void;
|
|
388
|
+
type?: undefined;
|
|
389
|
+
checked?: undefined;
|
|
390
|
+
subMenu?: undefined;
|
|
336
391
|
})[];
|
|
337
392
|
} & {
|
|
338
393
|
readonly canDisplayLabels: boolean;
|
|
339
394
|
readonly totalHeight: number;
|
|
395
|
+
readonly featuresReady: boolean;
|
|
340
396
|
} & {
|
|
341
397
|
renderProps(): any;
|
|
342
398
|
} & {
|
|
@@ -344,6 +400,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
344
400
|
readonly blockType: string;
|
|
345
401
|
readonly totalHeight: number;
|
|
346
402
|
readonly rowHeight: number;
|
|
403
|
+
readonly featuresReady: boolean;
|
|
347
404
|
} & {
|
|
348
405
|
renderProps(): any;
|
|
349
406
|
readonly canDisplayLabels: boolean;
|
|
@@ -26,15 +26,19 @@ export default function stateModelFactory(configSchema) {
|
|
|
26
26
|
? self.totalHeight / this.nrow
|
|
27
27
|
: self.rowHeightSetting;
|
|
28
28
|
},
|
|
29
|
+
get featuresReady() {
|
|
30
|
+
return !!self.featuresVolatile;
|
|
31
|
+
},
|
|
29
32
|
}))
|
|
30
33
|
.views(self => ({
|
|
31
34
|
renderProps() {
|
|
32
35
|
const superProps = self.adapterProps();
|
|
33
36
|
return {
|
|
34
37
|
...superProps,
|
|
35
|
-
notReady: superProps.notReady || !self.sources || !self.
|
|
38
|
+
notReady: superProps.notReady || !self.sources || !self.featuresReady,
|
|
36
39
|
renderingMode: self.renderingMode,
|
|
37
40
|
minorAlleleFrequencyFilter: self.minorAlleleFrequencyFilter,
|
|
41
|
+
lengthCutoffFilter: self.lengthCutoffFilter,
|
|
38
42
|
height: self.totalHeight,
|
|
39
43
|
sources: self.sources,
|
|
40
44
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { getContainingView } from '@jbrowse/core/util';
|
|
3
3
|
import { when } from 'mobx';
|
|
4
4
|
import LinesConnectingMatrixToGenomicPosition from './components/LinesConnectingMatrixToGenomicPosition';
|
|
5
|
-
import LegendBar from '../shared/components/
|
|
5
|
+
import LegendBar from '../shared/components/MultiVariantLegendBar';
|
|
6
6
|
export async function renderSvg(model, opts, superRenderSvg) {
|
|
7
7
|
await when(() => !!model.regionCannotBeRenderedText);
|
|
8
8
|
const { offsetPx } = getContainingView(model);
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
import BoxRendererType from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType';
|
|
2
|
+
import { SimpleFeature } from '@jbrowse/core/util';
|
|
2
3
|
import type { RenderArgsDeserialized } from './types';
|
|
3
4
|
import type { Feature } from '@jbrowse/core/util';
|
|
4
5
|
export default class LinearVariantMatrixRenderer extends BoxRendererType {
|
|
5
6
|
supportsSVG: boolean;
|
|
6
7
|
render(renderProps: RenderArgsDeserialized): Promise<{
|
|
7
8
|
features: Map<any, any>;
|
|
8
|
-
simplifiedFeatures:
|
|
9
|
+
simplifiedFeatures: SimpleFeature[];
|
|
9
10
|
height: number;
|
|
10
11
|
width: number;
|
|
12
|
+
arr: string[][];
|
|
11
13
|
canvasRecordedData: any;
|
|
12
14
|
layout: import("@jbrowse/core/util/layouts").BaseLayout<Feature>;
|
|
13
15
|
reactElement?: React.ReactElement;
|
|
14
16
|
html?: string;
|
|
15
17
|
} | {
|
|
16
18
|
features: Map<any, any>;
|
|
17
|
-
simplifiedFeatures:
|
|
19
|
+
simplifiedFeatures: SimpleFeature[];
|
|
18
20
|
height: number;
|
|
19
21
|
width: number;
|
|
22
|
+
arr: string[][];
|
|
20
23
|
reactElement: import("react/jsx-runtime").JSX.Element;
|
|
21
24
|
layout: import("@jbrowse/core/util/layouts").BaseLayout<Feature>;
|
|
22
25
|
html?: string;
|
|
23
26
|
} | {
|
|
24
27
|
features: Map<any, any>;
|
|
25
|
-
simplifiedFeatures:
|
|
28
|
+
simplifiedFeatures: SimpleFeature[];
|
|
26
29
|
height: number;
|
|
27
30
|
width: number;
|
|
31
|
+
arr: string[][];
|
|
28
32
|
imageData: any;
|
|
29
33
|
layout: import("@jbrowse/core/util/layouts").BaseLayout<Feature>;
|
|
30
34
|
reactElement?: React.ReactElement;
|
package/esm/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MultiVariantBaseModel } from '../../shared/MultiVariantBaseModel';
|
|
2
|
+
declare const MultiLinearVariantMatrixRendering: (props: {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
displayModel: MultiVariantBaseModel;
|
|
6
|
+
arr: string[][];
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default MultiLinearVariantMatrixRendering;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { PrerenderedCanvas } from '@jbrowse/core/ui';
|
|
4
|
+
import { observer } from 'mobx-react';
|
|
5
|
+
const MultiLinearVariantMatrixRendering = observer(function (props) {
|
|
6
|
+
const { arr, width, height, displayModel } = props;
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
function getFeatureUnderMouse(eventClientX, eventClientY) {
|
|
9
|
+
var _a, _b, _c;
|
|
10
|
+
if (!ref.current) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const r = ref.current.getBoundingClientRect();
|
|
14
|
+
const offsetX = eventClientX - r.left;
|
|
15
|
+
const offsetY = eventClientY - r.top;
|
|
16
|
+
const dimY = arr.length;
|
|
17
|
+
const dimX = ((_a = arr[0]) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
18
|
+
const name = (_b = displayModel.sources[Math.floor((offsetY / height) * dimX)]) === null || _b === void 0 ? void 0 : _b.name;
|
|
19
|
+
const genotype = (_c = arr[Math.floor((offsetX / width) * dimY)]) === null || _c === void 0 ? void 0 : _c[Math.floor((offsetY / height) * dimX)];
|
|
20
|
+
return genotype && name
|
|
21
|
+
? {
|
|
22
|
+
name,
|
|
23
|
+
genotype,
|
|
24
|
+
}
|
|
25
|
+
: undefined;
|
|
26
|
+
}
|
|
27
|
+
return (_jsx("div", { ref: ref, onMouseMove: e => {
|
|
28
|
+
displayModel.setHoveredGenotype(getFeatureUnderMouse(e.clientX, e.clientY));
|
|
29
|
+
}, onMouseLeave: () => {
|
|
30
|
+
displayModel.setHoveredGenotype(undefined);
|
|
31
|
+
}, onMouseOut: () => {
|
|
32
|
+
displayModel.setHoveredGenotype(undefined);
|
|
33
|
+
}, style: {
|
|
34
|
+
overflow: 'visible',
|
|
35
|
+
position: 'relative',
|
|
36
|
+
height,
|
|
37
|
+
}, children: _jsx(PrerenderedCanvas, { ...props }) }));
|
|
38
|
+
});
|
|
39
|
+
export default MultiLinearVariantMatrixRendering;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import MultiLinearVariantMatrixRenderer from './MultiLinearVariantMatrixRenderer';
|
|
2
|
+
import ReactComponent from './components/MultiLinearVariantMatrixRendering';
|
|
3
3
|
import configSchema from './configSchema';
|
|
4
4
|
export default function LinearVariantMatrixRendererF(pluginManager) {
|
|
5
5
|
pluginManager.addRendererType(() => {
|
|
6
|
-
return new
|
|
6
|
+
return new MultiLinearVariantMatrixRenderer({
|
|
7
7
|
name: 'LinearVariantMatrixRenderer',
|
|
8
8
|
displayName: 'Linear variant matrix renderer',
|
|
9
|
-
ReactComponent
|
|
9
|
+
ReactComponent,
|
|
10
10
|
configSchema,
|
|
11
11
|
pluginManager,
|
|
12
12
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RenderArgsDeserialized } from './types';
|
|
2
2
|
export declare function makeImageData({ ctx, canvasWidth, canvasHeight, renderArgs, }: {
|
|
3
3
|
ctx: CanvasRenderingContext2D;
|
|
4
4
|
canvasWidth: number;
|
|
5
5
|
canvasHeight: number;
|
|
6
|
-
renderArgs:
|
|
6
|
+
renderArgs: RenderArgsDeserialized;
|
|
7
7
|
}): Promise<{
|
|
8
8
|
mafs: {
|
|
9
9
|
feature: import("@jbrowse/core/util").Feature;
|
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
import { updateStatus } from '@jbrowse/core/util';
|
|
1
|
+
import { forEachWithStopTokenCheck, updateStatus } from '@jbrowse/core/util';
|
|
2
|
+
import { checkStopToken } from '@jbrowse/core/util/stopToken';
|
|
2
3
|
import { f2 } from '../shared/constants';
|
|
3
4
|
import { drawColorAlleleCount } from '../shared/drawAlleleCount';
|
|
4
5
|
import { drawPhased } from '../shared/drawPhased';
|
|
5
6
|
import { getFeaturesThatPassMinorAlleleFrequencyFilter } from '../shared/minorAlleleFrequencyUtils';
|
|
6
7
|
export async function makeImageData({ ctx, canvasWidth, canvasHeight, renderArgs, }) {
|
|
7
|
-
const { renderingMode
|
|
8
|
+
const { renderingMode, minorAlleleFrequencyFilter, sources, features, stopToken, lengthCutoffFilter, } = renderArgs;
|
|
8
9
|
const { statusCallback = () => { } } = renderArgs;
|
|
9
10
|
const h = canvasHeight / sources.length;
|
|
10
|
-
|
|
11
|
+
checkStopToken(stopToken);
|
|
12
|
+
const mafs = getFeaturesThatPassMinorAlleleFrequencyFilter({
|
|
13
|
+
stopToken,
|
|
14
|
+
features: features.values(),
|
|
15
|
+
minorAlleleFrequencyFilter,
|
|
16
|
+
lengthCutoffFilter,
|
|
17
|
+
});
|
|
18
|
+
checkStopToken(stopToken);
|
|
11
19
|
const arr = [];
|
|
12
20
|
const m = mafs.length;
|
|
13
21
|
const w = canvasWidth / m;
|
|
14
22
|
await updateStatus('Drawing variant matrix', statusCallback, () => {
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
forEachWithStopTokenCheck(mafs, stopToken, ({ feature, mostFrequentAlt }, idx) => {
|
|
24
|
+
var _a, _b, _c;
|
|
17
25
|
const arr2 = [];
|
|
18
|
-
const { feature, mostFrequentAlt } = mafs[i];
|
|
19
26
|
const hasPhaseSet = (_a = feature.get('FORMAT')) === null || _a === void 0 ? void 0 : _a.includes('PS');
|
|
20
27
|
if (hasPhaseSet) {
|
|
21
28
|
const samp = feature.get('samples');
|
|
22
|
-
const x = (
|
|
29
|
+
const x = (idx / mafs.length) * canvasWidth;
|
|
23
30
|
const sln = sources.length;
|
|
24
31
|
for (let j = 0; j < sln; j++) {
|
|
25
32
|
const y = (j / sln) * canvasHeight;
|
|
@@ -51,7 +58,7 @@ export async function makeImageData({ ctx, canvasWidth, canvasHeight, renderArgs
|
|
|
51
58
|
}
|
|
52
59
|
else {
|
|
53
60
|
const samp = feature.get('genotypes');
|
|
54
|
-
const x = (
|
|
61
|
+
const x = (idx / mafs.length) * canvasWidth;
|
|
55
62
|
const sln = sources.length;
|
|
56
63
|
for (let j = 0; j < sln; j++) {
|
|
57
64
|
const y = (j / sln) * canvasHeight;
|
|
@@ -78,7 +85,7 @@ export async function makeImageData({ ctx, canvasWidth, canvasHeight, renderArgs
|
|
|
78
85
|
}
|
|
79
86
|
}
|
|
80
87
|
arr.push(arr2);
|
|
81
|
-
}
|
|
88
|
+
});
|
|
82
89
|
});
|
|
83
90
|
return {
|
|
84
91
|
mafs,
|
|
@@ -6,11 +6,9 @@ export interface RenderArgsDeserialized extends BoxRenderArgsDeserialized {
|
|
|
6
6
|
minorAlleleFrequencyFilter: number;
|
|
7
7
|
highResolutionScaling: number;
|
|
8
8
|
height: number;
|
|
9
|
-
renderingMode: string;
|
|
10
|
-
}
|
|
11
|
-
export interface RenderArgsDeserializedWithFeaturesAndLayout extends RenderArgsDeserialized {
|
|
12
|
-
sources: Source[];
|
|
13
9
|
features: Map<string, Feature>;
|
|
14
10
|
renderingMode: string;
|
|
15
11
|
statusCallback?: (arg: string) => void;
|
|
12
|
+
lengthCutoffFilter: number;
|
|
13
|
+
stopToken: string;
|
|
16
14
|
}
|
|
@@ -8,6 +8,16 @@ export default class MultiVariantBaseRenderer extends FeatureRendererType {
|
|
|
8
8
|
height: number;
|
|
9
9
|
width: number;
|
|
10
10
|
containsNoTransferables: boolean;
|
|
11
|
+
rbush: any;
|
|
12
|
+
featureGenotypeMap: {
|
|
13
|
+
[k: string]: {
|
|
14
|
+
alt: any;
|
|
15
|
+
ref: any;
|
|
16
|
+
name: any;
|
|
17
|
+
description: any;
|
|
18
|
+
length: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
11
21
|
canvasRecordedData: any;
|
|
12
22
|
reactElement?: React.ReactElement;
|
|
13
23
|
html?: string;
|
|
@@ -16,6 +26,16 @@ export default class MultiVariantBaseRenderer extends FeatureRendererType {
|
|
|
16
26
|
height: number;
|
|
17
27
|
width: number;
|
|
18
28
|
containsNoTransferables: boolean;
|
|
29
|
+
rbush: any;
|
|
30
|
+
featureGenotypeMap: {
|
|
31
|
+
[k: string]: {
|
|
32
|
+
alt: any;
|
|
33
|
+
ref: any;
|
|
34
|
+
name: any;
|
|
35
|
+
description: any;
|
|
36
|
+
length: number;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
19
39
|
reactElement: import("react/jsx-runtime").JSX.Element;
|
|
20
40
|
html?: string;
|
|
21
41
|
} | {
|
|
@@ -23,9 +43,18 @@ export default class MultiVariantBaseRenderer extends FeatureRendererType {
|
|
|
23
43
|
height: number;
|
|
24
44
|
width: number;
|
|
25
45
|
containsNoTransferables: boolean;
|
|
46
|
+
rbush: any;
|
|
47
|
+
featureGenotypeMap: {
|
|
48
|
+
[k: string]: {
|
|
49
|
+
alt: any;
|
|
50
|
+
ref: any;
|
|
51
|
+
name: any;
|
|
52
|
+
description: any;
|
|
53
|
+
length: number;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
26
56
|
imageData: any;
|
|
27
57
|
reactElement?: React.ReactElement;
|
|
28
58
|
html?: string;
|
|
29
59
|
}>;
|
|
30
60
|
}
|
|
31
|
-
export type { RenderArgsSerialized, RenderResults, ResultsDeserialized, ResultsSerialized, } from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType';
|
|
@@ -7,14 +7,20 @@ export default class MultiVariantBaseRenderer extends FeatureRendererType {
|
|
|
7
7
|
}
|
|
8
8
|
async render(renderProps) {
|
|
9
9
|
const features = await this.getFeatures(renderProps);
|
|
10
|
-
const { height, regions, bpPerPx } = renderProps;
|
|
10
|
+
const { height, referenceDrawingMode, regions, bpPerPx } = renderProps;
|
|
11
11
|
const region = regions[0];
|
|
12
12
|
const width = (region.end - region.start) / bpPerPx;
|
|
13
13
|
const { makeImageData } = await import('./makeImageData');
|
|
14
|
-
const rest = await renderToAbstractCanvas(width, height, renderProps, ctx =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const rest = await renderToAbstractCanvas(width, height, renderProps, ctx => {
|
|
15
|
+
if (referenceDrawingMode === 'skip') {
|
|
16
|
+
ctx.fillStyle = '#ccc';
|
|
17
|
+
ctx.fillRect(0, 0, width, height);
|
|
18
|
+
}
|
|
19
|
+
return makeImageData(ctx, {
|
|
20
|
+
...renderProps,
|
|
21
|
+
features,
|
|
22
|
+
});
|
|
23
|
+
});
|
|
18
24
|
const results = await super.render({
|
|
19
25
|
...renderProps,
|
|
20
26
|
...rest,
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import RBush from 'rbush';
|
|
2
1
|
import type { Source } from '../../shared/types';
|
|
3
2
|
import type { Feature } from '@jbrowse/core/util';
|
|
4
3
|
import type { Region } from '@jbrowse/core/util/types';
|
|
4
|
+
type SerializedRBush = any;
|
|
5
|
+
interface MinimizedVariantRecord {
|
|
6
|
+
alt: string[];
|
|
7
|
+
ref: string;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
length: number;
|
|
11
|
+
}
|
|
5
12
|
declare const MultiVariantRendering: (props: {
|
|
6
13
|
regions: Region[];
|
|
7
14
|
features: Map<string, Feature>;
|
|
@@ -10,10 +17,9 @@ declare const MultiVariantRendering: (props: {
|
|
|
10
17
|
height: number;
|
|
11
18
|
sources: Source[];
|
|
12
19
|
scrollTop: number;
|
|
20
|
+
featureGenotypeMap: Record<string, MinimizedVariantRecord>;
|
|
13
21
|
totalHeight: number;
|
|
14
|
-
rbush:
|
|
15
|
-
genotype: string;
|
|
16
|
-
}>;
|
|
22
|
+
rbush: SerializedRBush;
|
|
17
23
|
displayModel: any;
|
|
18
24
|
onMouseLeave?: (event: React.MouseEvent) => void;
|
|
19
25
|
onMouseMove?: (event: React.MouseEvent, arg?: Feature) => void;
|
|
@@ -1,29 +1,47 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useRef } from 'react';
|
|
3
3
|
import { PrerenderedCanvas } from '@jbrowse/core/ui';
|
|
4
|
+
import { getBpDisplayStr } from '@jbrowse/core/util';
|
|
4
5
|
import { observer } from 'mobx-react';
|
|
5
6
|
import RBush from 'rbush';
|
|
7
|
+
import { minElt } from './util';
|
|
8
|
+
import { makeSimpleAltString } from '../../VcfFeature/util';
|
|
6
9
|
const MultiVariantRendering = observer(function (props) {
|
|
7
|
-
const { totalHeight, scrollTop } = props;
|
|
10
|
+
const { featureGenotypeMap, totalHeight, scrollTop } = props;
|
|
8
11
|
const { rbush, displayModel } = props;
|
|
9
12
|
const ref = useRef(null);
|
|
10
13
|
const rbush2 = useMemo(() => new RBush().fromJSON(rbush), [rbush]);
|
|
11
14
|
function getFeatureUnderMouse(eventClientX, eventClientY) {
|
|
12
|
-
var _a;
|
|
13
15
|
let offsetX = 0;
|
|
14
16
|
let offsetY = 0;
|
|
15
17
|
if (ref.current) {
|
|
16
18
|
const r = ref.current.getBoundingClientRect();
|
|
17
19
|
offsetX = eventClientX - r.left;
|
|
18
|
-
offsetY = eventClientY - r.top;
|
|
20
|
+
offsetY = eventClientY - r.top - ((displayModel === null || displayModel === void 0 ? void 0 : displayModel.scrollTop) || 0);
|
|
19
21
|
}
|
|
20
|
-
const
|
|
22
|
+
const x = rbush2.search({
|
|
21
23
|
minX: offsetX,
|
|
22
|
-
maxX: offsetX +
|
|
24
|
+
maxX: offsetX + 1,
|
|
23
25
|
minY: offsetY,
|
|
24
|
-
maxY: offsetY +
|
|
26
|
+
maxY: offsetY + 1,
|
|
25
27
|
});
|
|
26
|
-
|
|
28
|
+
if (x.length) {
|
|
29
|
+
const { minX, minY, maxX, maxY, genotype, featureId, ...rest } = minElt(x, elt => elt.maxX - elt.minX);
|
|
30
|
+
const ret = featureGenotypeMap[featureId];
|
|
31
|
+
if (ret) {
|
|
32
|
+
const { ref, alt, name, description, length } = ret;
|
|
33
|
+
const alleles = makeSimpleAltString(genotype, ref, alt);
|
|
34
|
+
return {
|
|
35
|
+
...rest,
|
|
36
|
+
genotype,
|
|
37
|
+
alleles,
|
|
38
|
+
featureName: name,
|
|
39
|
+
description: alt.length >= 3 ? 'multiple ALT alleles' : description,
|
|
40
|
+
length: getBpDisplayStr(length),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
27
45
|
}
|
|
28
46
|
return (_jsx("div", { ref: ref, onMouseMove: e => {
|
|
29
47
|
var _a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function minElt<T>(arr: Iterable<T>, cb: (arg: T) => number): T | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MultiVariantRenderer from './MultiVariantRenderer';
|
|
2
|
-
import ReactComponent from './components/
|
|
2
|
+
import ReactComponent from './components/MultiLinearVariantRendering';
|
|
3
3
|
import configSchema from './configSchema';
|
|
4
4
|
export default function MultiVariantRendererF(pluginManager) {
|
|
5
5
|
pluginManager.addRendererType(() => {
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { MultiRenderArgsDeserialized } from './types';
|
|
2
2
|
export declare function makeImageData(ctx: CanvasRenderingContext2D, props: MultiRenderArgsDeserialized): Promise<{
|
|
3
3
|
rbush: any;
|
|
4
|
+
featureGenotypeMap: {
|
|
5
|
+
[k: string]: {
|
|
6
|
+
alt: any;
|
|
7
|
+
ref: any;
|
|
8
|
+
name: any;
|
|
9
|
+
description: any;
|
|
10
|
+
length: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
4
13
|
}>;
|