@jbrowse/plugin-variants 3.2.0 → 3.4.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/LinearVariantDisplay/model.d.ts +1 -1
- package/dist/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +3 -3
- package/dist/MultiLinearVariantDisplay/index.js +1 -1
- package/dist/MultiLinearVariantDisplay/model.d.ts +40 -4
- 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 +40 -3
- package/dist/MultiLinearVariantMatrixDisplay/model.js +1 -0
- package/dist/MultiLinearVariantMatrixDisplay/renderSvg.js +2 -2
- package/dist/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.d.ts → MultiLinearVariantMatrixRenderer.d.ts} +14 -11
- package/dist/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.js → MultiLinearVariantMatrixRenderer.js} +3 -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 +3 -3
- package/dist/MultiLinearVariantMatrixRenderer/makeImageData.js +71 -17
- package/dist/MultiLinearVariantMatrixRenderer/types.d.ts +2 -4
- package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +34 -5
- package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.js +13 -7
- 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 +104 -41
- package/dist/MultiLinearVariantRenderer/types.d.ts +2 -0
- package/dist/MultiVariantBaseRenderer.d.ts +4 -4
- package/dist/SplitVcfTabixAdapter/SplitVcfTabixAdapter.d.ts +0 -1
- package/dist/SplitVcfTabixAdapter/SplitVcfTabixAdapter.js +0 -1
- 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 +16 -6
- 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/util.d.ts +1 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid/util.js +14 -0
- package/dist/VariantFeatureWidget/stateModelFactory.d.ts +9 -6
- package/dist/VariantRPC/MultiVariantClusterGenotypeMatrix.d.ts +2 -16
- package/dist/VariantRPC/MultiVariantClusterGenotypeMatrix.js +4 -7
- package/dist/VariantRPC/MultiVariantGetGenotypeMatrix.d.ts +2 -15
- package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +3 -13
- package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.js +14 -8
- package/dist/VariantRPC/getGenotypeMatrix.js +20 -7
- package/dist/VariantRPC/types.d.ts +23 -0
- package/dist/VcfAdapter/VcfAdapter.d.ts +0 -1
- package/dist/VcfAdapter/VcfAdapter.js +0 -1
- package/dist/VcfFeature/index.js +0 -1
- package/dist/VcfFeature/util.d.ts +2 -0
- package/dist/VcfFeature/util.js +123 -25
- package/dist/VcfTabixAdapter/VcfTabixAdapter.d.ts +0 -1
- package/dist/VcfTabixAdapter/VcfTabixAdapter.js +12 -8
- package/dist/getMultiVariantFeaturesAutorun.d.ts +2 -0
- package/dist/getMultiVariantFeaturesAutorun.js +9 -2
- package/dist/getMultiVariantSourcesAutorun.js +3 -2
- package/dist/shared/MultiVariantBaseModel.d.ts +41 -4
- package/dist/shared/MultiVariantBaseModel.js +69 -3
- package/dist/shared/SharedVariantMixin.d.ts +1 -1
- 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/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialog.js +2 -2
- package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogAuto.js +8 -3
- package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogManual.js +29 -28
- package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/types.d.ts +1 -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 +40 -47
- package/dist/shared/components/SourcesGrid.js +1 -1
- package/dist/shared/components/SourcesGridHeader.d.ts +2 -1
- package/dist/shared/drawAlleleCount.d.ts +2 -1
- package/dist/shared/drawAlleleCount.js +26 -24
- package/dist/shared/drawPhased.d.ts +1 -1
- package/dist/shared/drawPhased.js +14 -10
- package/dist/shared/minorAlleleFrequencyUtils.d.ts +9 -4
- package/dist/shared/minorAlleleFrequencyUtils.js +19 -14
- package/dist/shared/sourcesGridUtils.d.ts +3 -2
- package/esm/LinearVariantDisplay/model.d.ts +1 -1
- package/esm/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +2 -2
- package/esm/MultiLinearVariantDisplay/index.js +1 -1
- package/esm/MultiLinearVariantDisplay/model.d.ts +40 -4
- 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 +40 -3
- package/esm/MultiLinearVariantMatrixDisplay/model.js +1 -0
- package/esm/MultiLinearVariantMatrixDisplay/renderSvg.js +1 -1
- package/esm/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.d.ts → MultiLinearVariantMatrixRenderer.d.ts} +14 -11
- package/esm/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.js → MultiLinearVariantMatrixRenderer.js} +3 -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 +3 -3
- package/esm/MultiLinearVariantMatrixRenderer/makeImageData.js +73 -19
- package/esm/MultiLinearVariantMatrixRenderer/types.d.ts +2 -4
- package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +34 -5
- package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.js +13 -7
- 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 +106 -43
- package/esm/MultiLinearVariantRenderer/types.d.ts +2 -0
- package/esm/MultiVariantBaseRenderer.d.ts +4 -4
- package/esm/SplitVcfTabixAdapter/SplitVcfTabixAdapter.d.ts +0 -1
- package/esm/SplitVcfTabixAdapter/SplitVcfTabixAdapter.js +0 -1
- 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 +16 -6
- 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/util.d.ts +1 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid/util.js +11 -0
- package/esm/VariantFeatureWidget/stateModelFactory.d.ts +9 -6
- package/esm/VariantRPC/MultiVariantClusterGenotypeMatrix.d.ts +2 -16
- package/esm/VariantRPC/MultiVariantClusterGenotypeMatrix.js +4 -7
- package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.d.ts +2 -15
- package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +3 -13
- package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.js +14 -8
- package/esm/VariantRPC/getGenotypeMatrix.js +20 -7
- package/esm/VariantRPC/types.d.ts +23 -0
- package/esm/VcfAdapter/VcfAdapter.d.ts +0 -1
- package/esm/VcfAdapter/VcfAdapter.js +0 -1
- package/esm/VcfFeature/index.js +0 -1
- package/esm/VcfFeature/util.d.ts +2 -0
- package/esm/VcfFeature/util.js +121 -25
- package/esm/VcfTabixAdapter/VcfTabixAdapter.d.ts +0 -1
- package/esm/VcfTabixAdapter/VcfTabixAdapter.js +13 -9
- package/esm/getMultiVariantFeaturesAutorun.d.ts +2 -0
- package/esm/getMultiVariantFeaturesAutorun.js +9 -2
- package/esm/getMultiVariantSourcesAutorun.js +3 -2
- package/esm/shared/MultiVariantBaseModel.d.ts +41 -4
- package/esm/shared/MultiVariantBaseModel.js +71 -5
- package/esm/shared/SharedVariantMixin.d.ts +1 -1
- 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/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialog.js +2 -2
- package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogAuto.js +9 -4
- package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogManual.js +29 -28
- package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/types.d.ts +1 -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 +40 -47
- package/esm/shared/components/SourcesGrid.js +1 -1
- package/esm/shared/components/SourcesGridHeader.d.ts +2 -1
- package/esm/shared/drawAlleleCount.d.ts +2 -1
- package/esm/shared/drawAlleleCount.js +25 -24
- package/esm/shared/drawPhased.d.ts +1 -1
- package/esm/shared/drawPhased.js +14 -10
- package/esm/shared/minorAlleleFrequencyUtils.d.ts +9 -4
- package/esm/shared/minorAlleleFrequencyUtils.js +20 -15
- package/esm/shared/sourcesGridUtils.d.ts +3 -2
- package/package.json +12 -11
- 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/VariantRPC/cluster.d.ts +0 -17
- package/dist/VariantRPC/cluster.js +0 -84
- 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/VariantRPC/cluster.d.ts +0 -17
- package/esm/VariantRPC/cluster.js +0 -79
- package/esm/shared/components/LegendBar.d.ts +0 -18
- /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/dist/{shared/components/ClusterDialog → VariantFeatureWidget/VariantSampleGrid}/types.js +0 -0
- /package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialog.d.ts +0 -0
- /package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogAuto.d.ts +0 -0
- /package/dist/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogManual.d.ts +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/{shared/components/ClusterDialog → VariantFeatureWidget/VariantSampleGrid}/types.js +0 -0
- /package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialog.d.ts +0 -0
- /package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogAuto.d.ts +0 -0
- /package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogManual.d.ts +0 -0
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getColorAlleleCount = getColorAlleleCount;
|
|
3
4
|
exports.drawColorAlleleCount = drawColorAlleleCount;
|
|
4
5
|
const colord_1 = require("@jbrowse/core/util/colord");
|
|
5
6
|
const constants_1 = require("./constants");
|
|
6
|
-
function getColorAlleleCount(
|
|
7
|
-
const total = alleles.length;
|
|
8
|
-
let alt = 0;
|
|
9
|
-
let uncalled = 0;
|
|
10
|
-
let alt2 = 0;
|
|
11
|
-
let ref = 0;
|
|
12
|
-
for (const allele of alleles) {
|
|
13
|
-
if (allele === mostFrequentAlt) {
|
|
14
|
-
alt++;
|
|
15
|
-
}
|
|
16
|
-
else if (allele === '0') {
|
|
17
|
-
ref++;
|
|
18
|
-
}
|
|
19
|
-
else if (allele === '.') {
|
|
20
|
-
uncalled++;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
alt2++;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
7
|
+
function getColorAlleleCount(ref, alt, alt2, uncalled, total, drawReference = true) {
|
|
26
8
|
if (ref === total) {
|
|
27
|
-
return
|
|
9
|
+
return drawReference ? '#ccc' : '';
|
|
28
10
|
}
|
|
29
11
|
else {
|
|
30
12
|
let a1;
|
|
@@ -42,7 +24,27 @@ function getColorAlleleCount(alleles, mostFrequentAlt) {
|
|
|
42
24
|
return (a1 === null || a1 === void 0 ? void 0 : a1.toHex()) || 'black';
|
|
43
25
|
}
|
|
44
26
|
}
|
|
45
|
-
function drawColorAlleleCount(
|
|
46
|
-
ctx.fillStyle =
|
|
47
|
-
|
|
27
|
+
function drawColorAlleleCount(c, ctx, x, y, w, h, featureType = '', featureStrand, alpha = 1) {
|
|
28
|
+
ctx.fillStyle = alpha !== 1 ? (0, colord_1.colord)(c).alpha(alpha).toHex() : c;
|
|
29
|
+
if (featureType === 'inversion') {
|
|
30
|
+
if (featureStrand === 1) {
|
|
31
|
+
ctx.beginPath();
|
|
32
|
+
ctx.moveTo(x - constants_1.f2, y - constants_1.f2);
|
|
33
|
+
ctx.lineTo(x - constants_1.f2, y + h + constants_1.f2);
|
|
34
|
+
ctx.lineTo(x + w + constants_1.f2, y + h / 2);
|
|
35
|
+
ctx.closePath();
|
|
36
|
+
ctx.fill();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
ctx.beginPath();
|
|
40
|
+
ctx.moveTo(x + w + constants_1.f2, y - constants_1.f2);
|
|
41
|
+
ctx.lineTo(x + w + constants_1.f2, y + h + constants_1.f2);
|
|
42
|
+
ctx.lineTo(x - constants_1.f2, y + h / 2);
|
|
43
|
+
ctx.closePath();
|
|
44
|
+
ctx.fill();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
ctx.fillRect(x - constants_1.f2, y - constants_1.f2, w + constants_1.f2, h + constants_1.f2);
|
|
49
|
+
}
|
|
48
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function drawPhased(alleles: string[], ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, HP: number, PS?: string):
|
|
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;
|
|
@@ -2,20 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.drawPhased = drawPhased;
|
|
4
4
|
const colors_1 = require("@jbrowse/core/ui/colors");
|
|
5
|
+
const colord_1 = require("@jbrowse/core/util/colord");
|
|
5
6
|
const constants_1 = require("./constants");
|
|
6
7
|
const util_1 = require("./util");
|
|
7
|
-
function getColorPhased(alleles, HP) {
|
|
8
|
+
function getColorPhased(alleles, HP, drawReference = true) {
|
|
8
9
|
const c = +alleles[HP];
|
|
9
|
-
return c ? colors_1.set1[c - 1] || 'black' : '#ccc';
|
|
10
|
+
return c ? colors_1.set1[c - 1] || 'black' : drawReference ? '#ccc' : undefined;
|
|
10
11
|
}
|
|
11
|
-
function getColorPhasedWithPhaseSet(alleles, HP, PS) {
|
|
12
|
+
function getColorPhasedWithPhaseSet(alleles, HP, PS, drawReference = true) {
|
|
12
13
|
const c = +alleles[HP];
|
|
13
|
-
return c ? (0, util_1.colorify)(+PS) || 'black' : '#ccc';
|
|
14
|
+
return c ? (0, util_1.colorify)(+PS) || 'black' : drawReference ? '#ccc' : undefined;
|
|
14
15
|
}
|
|
15
|
-
function drawPhased(alleles, ctx, x, y, w, h, HP, PS) {
|
|
16
|
-
|
|
17
|
-
PS
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
function drawPhased(alleles, ctx, x, y, w, h, HP, PS, drawReference = true, alpha = 1) {
|
|
17
|
+
const c = PS !== undefined
|
|
18
|
+
? getColorPhasedWithPhaseSet(alleles, HP, PS, drawReference)
|
|
19
|
+
: getColorPhased(alleles, HP, drawReference);
|
|
20
|
+
if (c) {
|
|
21
|
+
ctx.fillStyle = alpha !== 1 ? (0, colord_1.colord)(c).alpha(alpha).toHex() : c;
|
|
22
|
+
ctx.fillRect(x - constants_1.f2, y - constants_1.f2, w + constants_1.f2, h + constants_1.f2);
|
|
23
|
+
}
|
|
24
|
+
return c;
|
|
21
25
|
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { Feature } from '@jbrowse/core/util';
|
|
2
2
|
export declare function findSecondLargestNumber(arr: Iterable<number>): number;
|
|
3
|
-
export declare function calculateAlleleCounts(feat: Feature):
|
|
4
|
-
export declare function calculateMinorAlleleFrequency(alleleCounts:
|
|
5
|
-
export declare function getFeaturesThatPassMinorAlleleFrequencyFilter(
|
|
3
|
+
export declare function calculateAlleleCounts(feat: Feature): Record<string, number>;
|
|
4
|
+
export declare function calculateMinorAlleleFrequency(alleleCounts: Record<string, number>): 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
|
-
alleleCounts:
|
|
13
|
+
alleleCounts: Record<string, number>;
|
|
9
14
|
}[];
|
|
@@ -20,24 +20,30 @@ function findSecondLargestNumber(arr) {
|
|
|
20
20
|
return secondMax;
|
|
21
21
|
}
|
|
22
22
|
function calculateAlleleCounts(feat) {
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
var _a;
|
|
24
|
+
const genotypes = feat.get('genotypes');
|
|
25
|
+
const alleleCounts = { 0: 0, 1: 0, '.': 0 };
|
|
26
|
+
const cacheSplit = {};
|
|
27
|
+
const vals = Object.values(genotypes);
|
|
28
|
+
const len = vals.length;
|
|
29
|
+
for (let i = 0; i < len; i++) {
|
|
30
|
+
const genotype = vals[i];
|
|
31
|
+
const alleles = cacheSplit[genotype] || (cacheSplit[genotype] = genotype.split(/[/|]/));
|
|
32
|
+
for (let i = 0, len = alleles.length; i < len; i++) {
|
|
33
|
+
const a = alleles[i];
|
|
34
|
+
alleleCounts[a] = ((_a = alleleCounts[a]) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
29
35
|
}
|
|
30
36
|
}
|
|
31
37
|
return alleleCounts;
|
|
32
38
|
}
|
|
33
39
|
function calculateMinorAlleleFrequency(alleleCounts) {
|
|
34
|
-
return (findSecondLargestNumber(
|
|
35
|
-
((0, util_1.sum)(
|
|
40
|
+
return (findSecondLargestNumber(Object.values(alleleCounts)) /
|
|
41
|
+
((0, util_1.sum)(Object.values(alleleCounts)) || 1));
|
|
36
42
|
}
|
|
37
43
|
function getMostFrequentAlt(alleleCounts) {
|
|
38
44
|
let mostFrequentAlt;
|
|
39
45
|
let max = 0;
|
|
40
|
-
for (const [alt, altCount] of
|
|
46
|
+
for (const [alt, altCount] of Object.entries(alleleCounts)) {
|
|
41
47
|
if (alt !== '.' && alt !== '0') {
|
|
42
48
|
if (altCount > max) {
|
|
43
49
|
mostFrequentAlt = alt;
|
|
@@ -47,21 +53,20 @@ function getMostFrequentAlt(alleleCounts) {
|
|
|
47
53
|
}
|
|
48
54
|
return mostFrequentAlt;
|
|
49
55
|
}
|
|
50
|
-
function getFeaturesThatPassMinorAlleleFrequencyFilter(
|
|
56
|
+
function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter, stopToken, }) {
|
|
51
57
|
const results = [];
|
|
52
|
-
|
|
58
|
+
(0, util_1.forEachWithStopTokenCheck)(features, stopToken, feature => {
|
|
53
59
|
if (feature.get('end') - feature.get('start') <= lengthCutoffFilter) {
|
|
54
60
|
const alleleCounts = calculateAlleleCounts(feature);
|
|
55
61
|
if (calculateMinorAlleleFrequency(alleleCounts) >=
|
|
56
62
|
minorAlleleFrequencyFilter) {
|
|
57
|
-
const mostFrequentAlt = getMostFrequentAlt(alleleCounts);
|
|
58
63
|
results.push({
|
|
59
64
|
feature,
|
|
60
|
-
mostFrequentAlt,
|
|
65
|
+
mostFrequentAlt: getMostFrequentAlt(alleleCounts),
|
|
61
66
|
alleleCounts,
|
|
62
67
|
});
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
|
-
}
|
|
70
|
+
});
|
|
66
71
|
return results;
|
|
67
72
|
}
|
|
@@ -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:
|
|
4
|
+
}[], sel: GridRowId[], by?: number): {
|
|
4
5
|
name: string;
|
|
5
6
|
}[];
|
|
6
7
|
export declare function moveDown(arr: {
|
|
7
8
|
name: string;
|
|
8
|
-
}[], sel:
|
|
9
|
+
}[], sel: GridRowId[], by?: number): {
|
|
9
10
|
name: string;
|
|
10
11
|
}[];
|
|
@@ -200,7 +200,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
200
200
|
} & {
|
|
201
201
|
addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
|
|
202
202
|
deleteBlock(key: string): void;
|
|
203
|
-
selectFeature(feature: Feature): void
|
|
203
|
+
selectFeature(feature: Feature): Promise<void>;
|
|
204
204
|
navToFeature(feature: Feature): void;
|
|
205
205
|
clearFeatureSelection(): void;
|
|
206
206
|
setFeatureIdUnderMouse(feature?: string): void;
|
|
@@ -2,8 +2,8 @@ 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 '
|
|
6
|
-
import LegendBar from '../../shared/components/
|
|
5
|
+
import Crosshair from '../../shared/components/MultiVariantCrosshairs';
|
|
6
|
+
import LegendBar from '../../shared/components/MultiVariantLegendBar';
|
|
7
7
|
const MultiLinearVariantDisplayComponent = observer(function (props) {
|
|
8
8
|
const { model } = props;
|
|
9
9
|
const ref = useRef(null);
|
|
@@ -7,7 +7,7 @@ export default function MultiLinearVariantDisplayF(pluginManager) {
|
|
|
7
7
|
const configSchema = configSchemaFactory(pluginManager);
|
|
8
8
|
return new DisplayType({
|
|
9
9
|
name: 'MultiLinearVariantDisplay',
|
|
10
|
-
displayName: 'Multi-variant display (regular)',
|
|
10
|
+
displayName: 'Multi-sample variant display (regular)',
|
|
11
11
|
configSchema,
|
|
12
12
|
stateModel: modelFactory(configSchema),
|
|
13
13
|
trackType: 'VariantTrack',
|
|
@@ -89,11 +89,13 @@ export declare 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<"MultiLinearVariantDisplay">;
|
|
94
97
|
rowHeightSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
95
98
|
minorAlleleFrequencyFilter: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
96
|
-
autoHeight: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
97
99
|
}, {
|
|
98
100
|
rendererTypeName: string;
|
|
99
101
|
error: unknown;
|
|
@@ -206,7 +208,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
206
208
|
} & {
|
|
207
209
|
addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
|
|
208
210
|
deleteBlock(key: string): void;
|
|
209
|
-
selectFeature(feature: import("@jbrowse/core/util").Feature): void
|
|
211
|
+
selectFeature(feature: import("@jbrowse/core/util").Feature): Promise<void>;
|
|
210
212
|
navToFeature(feature: import("@jbrowse/core/util").Feature): void;
|
|
211
213
|
clearFeatureSelection(): void;
|
|
212
214
|
setFeatureIdUnderMouse(feature?: string): void;
|
|
@@ -237,19 +239,28 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
237
239
|
renderProps(): any;
|
|
238
240
|
} & {
|
|
239
241
|
sourcesLoadingStopToken: string | undefined;
|
|
242
|
+
simplifiedFeaturesStopToken: string | undefined;
|
|
240
243
|
featureUnderMouseVolatile: import("@jbrowse/core/util").Feature | undefined;
|
|
241
244
|
sourcesVolatile: import("../shared/types").Source[] | undefined;
|
|
242
245
|
featuresVolatile: import("@jbrowse/core/util").Feature[] | undefined;
|
|
243
246
|
hasPhased: boolean;
|
|
244
247
|
sampleInfo: undefined | Record<string, import("../shared/types").SampleInfo>;
|
|
245
|
-
hoveredGenotype:
|
|
248
|
+
hoveredGenotype: {
|
|
249
|
+
genotype: string;
|
|
250
|
+
name: string;
|
|
251
|
+
} | undefined;
|
|
246
252
|
} & {
|
|
253
|
+
setJexlFilters(f?: string[]): void;
|
|
247
254
|
setRowHeight(arg: number): void;
|
|
248
|
-
setHoveredGenotype(arg
|
|
255
|
+
setHoveredGenotype(arg?: {
|
|
256
|
+
genotype: string;
|
|
257
|
+
name: string;
|
|
258
|
+
}): void;
|
|
249
259
|
setFeatures(f: import("@jbrowse/core/util").Feature[]): void;
|
|
250
260
|
setLayout(layout: import("../shared/types").Source[]): void;
|
|
251
261
|
clearLayout(): void;
|
|
252
262
|
setSourcesLoading(str: string): void;
|
|
263
|
+
setSimplifiedFeaturesLoading(str: string): void;
|
|
253
264
|
setSources(sources: import("../shared/types").Source[]): void;
|
|
254
265
|
setMafFilter(arg: number): void;
|
|
255
266
|
setShowSidebarLabels(arg: boolean): void;
|
|
@@ -257,7 +268,9 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
257
268
|
setAutoHeight(arg: boolean): void;
|
|
258
269
|
setHasPhased(arg: boolean): void;
|
|
259
270
|
setSampleInfo(arg: Record<string, import("../shared/types").SampleInfo>): void;
|
|
271
|
+
setReferenceDrawingMode(arg: string): void;
|
|
260
272
|
} & {
|
|
273
|
+
readonly activeFilters: any;
|
|
261
274
|
readonly preSources: import("../shared/types").Source[] | undefined;
|
|
262
275
|
readonly sourcesWithoutLayout: {
|
|
263
276
|
label: string;
|
|
@@ -278,6 +291,17 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
278
291
|
HP?: number;
|
|
279
292
|
}[] | undefined;
|
|
280
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;
|
|
281
305
|
readonly rowHeight: number;
|
|
282
306
|
adapterProps(): any;
|
|
283
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 | {
|
|
@@ -331,6 +355,18 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
331
355
|
type?: undefined;
|
|
332
356
|
checked?: undefined;
|
|
333
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;
|
|
334
370
|
} | {
|
|
335
371
|
label: string;
|
|
336
372
|
icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
@@ -7,7 +7,6 @@ export function stateModelFactory(configSchema) {
|
|
|
7
7
|
type: types.literal('MultiLinearVariantDisplay'),
|
|
8
8
|
rowHeightSetting: types.optional(types.number, 11),
|
|
9
9
|
minorAlleleFrequencyFilter: types.optional(types.number, 0),
|
|
10
|
-
autoHeight: false,
|
|
11
10
|
}))
|
|
12
11
|
.views(() => ({
|
|
13
12
|
get rendererTypeName() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getContainingView } from '@jbrowse/core/util';
|
|
3
3
|
import { when } from 'mobx';
|
|
4
|
-
import LegendBar from '../shared/components/
|
|
4
|
+
import LegendBar from '../shared/components/MultiVariantLegendBar';
|
|
5
5
|
export async function renderSvg(self, opts, superRenderSvg) {
|
|
6
6
|
await when(() => !!self.regionCannotBeRenderedText);
|
|
7
7
|
const { offsetPx } = getContainingView(self);
|
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]>;
|
|
@@ -205,7 +208,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
205
208
|
} & {
|
|
206
209
|
addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
|
|
207
210
|
deleteBlock(key: string): void;
|
|
208
|
-
selectFeature(feature: import("@jbrowse/core/util").Feature): void
|
|
211
|
+
selectFeature(feature: import("@jbrowse/core/util").Feature): Promise<void>;
|
|
209
212
|
navToFeature(feature: import("@jbrowse/core/util").Feature): void;
|
|
210
213
|
clearFeatureSelection(): void;
|
|
211
214
|
setFeatureIdUnderMouse(feature?: string): void;
|
|
@@ -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,7 +268,9 @@ 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;
|
|
261
275
|
readonly sourcesWithoutLayout: {
|
|
262
276
|
label: string;
|
|
@@ -277,6 +291,17 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
277
291
|
HP?: number;
|
|
278
292
|
}[] | undefined;
|
|
279
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;
|
|
280
305
|
readonly rowHeight: number;
|
|
281
306
|
adapterProps(): any;
|
|
282
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 | {
|
|
@@ -330,6 +355,18 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
330
355
|
type?: undefined;
|
|
331
356
|
checked?: undefined;
|
|
332
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;
|
|
333
370
|
} | {
|
|
334
371
|
label: string;
|
|
335
372
|
icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
@@ -38,6 +38,7 @@ export default function stateModelFactory(configSchema) {
|
|
|
38
38
|
notReady: superProps.notReady || !self.sources || !self.featuresReady,
|
|
39
39
|
renderingMode: self.renderingMode,
|
|
40
40
|
minorAlleleFrequencyFilter: self.minorAlleleFrequencyFilter,
|
|
41
|
+
lengthCutoffFilter: self.lengthCutoffFilter,
|
|
41
42
|
height: self.totalHeight,
|
|
42
43
|
sources: self.sources,
|
|
43
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,33 +1,36 @@
|
|
|
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
|
-
import type { Feature } from '@jbrowse/core/util';
|
|
4
4
|
export default class LinearVariantMatrixRenderer extends BoxRendererType {
|
|
5
5
|
supportsSVG: boolean;
|
|
6
6
|
render(renderProps: RenderArgsDeserialized): Promise<{
|
|
7
7
|
features: Map<any, any>;
|
|
8
|
-
simplifiedFeatures:
|
|
8
|
+
simplifiedFeatures: SimpleFeature[];
|
|
9
9
|
height: number;
|
|
10
10
|
width: number;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
arr: string[][];
|
|
12
|
+
canvasRecordedData: Record<string, unknown>;
|
|
13
|
+
layout: import("@jbrowse/core/util/layouts/BaseLayout").BaseLayout<import("@jbrowse/core/util").Feature>;
|
|
13
14
|
reactElement?: React.ReactElement;
|
|
14
15
|
html?: string;
|
|
15
16
|
} | {
|
|
16
17
|
features: Map<any, any>;
|
|
17
|
-
simplifiedFeatures:
|
|
18
|
+
simplifiedFeatures: SimpleFeature[];
|
|
18
19
|
height: number;
|
|
19
20
|
width: number;
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
arr: string[][];
|
|
22
|
+
imageData: any;
|
|
23
|
+
layout: import("@jbrowse/core/util/layouts/BaseLayout").BaseLayout<import("@jbrowse/core/util").Feature>;
|
|
24
|
+
reactElement?: React.ReactElement;
|
|
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;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
arr: string[][];
|
|
32
|
+
reactElement: React.ReactElement;
|
|
33
|
+
layout: import("@jbrowse/core/util/layouts/BaseLayout").BaseLayout<import("@jbrowse/core/util").Feature>;
|
|
31
34
|
html?: string;
|
|
32
35
|
}>;
|
|
33
36
|
}
|
|
@@ -12,7 +12,7 @@ export default class LinearVariantMatrixRenderer extends BoxRendererType {
|
|
|
12
12
|
const { end, start } = region;
|
|
13
13
|
const width = (end - start) / bpPerPx;
|
|
14
14
|
const { makeImageData } = await import('./makeImageData');
|
|
15
|
-
const { mafs, ...
|
|
15
|
+
const { mafs, ...rest } = await renderToAbstractCanvas(width, height, renderProps, ctx => makeImageData({
|
|
16
16
|
ctx,
|
|
17
17
|
canvasWidth: width,
|
|
18
18
|
canvasHeight: height,
|
|
@@ -24,14 +24,14 @@ export default class LinearVariantMatrixRenderer extends BoxRendererType {
|
|
|
24
24
|
}));
|
|
25
25
|
const results = await super.render({
|
|
26
26
|
...renderProps,
|
|
27
|
-
...
|
|
27
|
+
...rest,
|
|
28
28
|
features,
|
|
29
29
|
height,
|
|
30
30
|
width,
|
|
31
31
|
});
|
|
32
32
|
return {
|
|
33
33
|
...results,
|
|
34
|
-
...
|
|
34
|
+
...rest,
|
|
35
35
|
features: new Map(),
|
|
36
36
|
simplifiedFeatures: mafs.map(({ feature }) => new SimpleFeature({
|
|
37
37
|
id: feature.id(),
|
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;
|