@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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = Formatter;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
|
|
10
|
+
function Formatter({ value }) {
|
|
11
|
+
const [show, setShow] = (0, react_1.useState)(false);
|
|
12
|
+
const [copied, setCopied] = (0, react_1.useState)(false);
|
|
13
|
+
const display = String(value);
|
|
14
|
+
return display.length > 100 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => {
|
|
15
|
+
(0, copy_to_clipboard_1.default)(display);
|
|
16
|
+
setCopied(true);
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
setCopied(false);
|
|
19
|
+
}, 700);
|
|
20
|
+
}, children: copied ? 'Copied to clipboard' : 'Copy' }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => {
|
|
21
|
+
setShow(val => !val);
|
|
22
|
+
}, children: show ? 'Show less' : 'Show more' }), (0, jsx_runtime_1.jsx)("div", { children: show ? display : `${display.slice(0, 100)}...` })] })) : ((0, jsx_runtime_1.jsx)("div", { children: display }));
|
|
23
|
+
}
|
|
@@ -9,12 +9,10 @@ const x_data_grid_1 = require("@mui/x-data-grid");
|
|
|
9
9
|
function VariantConsequenceDataGridWrapper({ rows, columns, }) {
|
|
10
10
|
const [checked, setChecked] = (0, react_1.useState)(false);
|
|
11
11
|
const widths = columns.map(e => (0, util_1.measureGridWidth)(rows.map(r => r[e.field])));
|
|
12
|
-
return rows.length ? ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: checked, onChange: event => {
|
|
12
|
+
return rows.length ? ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { label: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: "Show options" }), control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: checked, onChange: event => {
|
|
13
13
|
setChecked(event.target.checked);
|
|
14
|
-
} }),
|
|
14
|
+
} }) }), (0, jsx_runtime_1.jsx)(x_data_grid_1.DataGrid, { rowHeight: 25, hideFooter: rows.length < 100, rows: rows, showToolbar: checked, columns: columns.map((c, i) => ({
|
|
15
15
|
...c,
|
|
16
16
|
width: widths[i],
|
|
17
|
-
}))
|
|
18
|
-
toolbar: checked ? x_data_grid_1.GridToolbar : null,
|
|
19
|
-
} })] })) : null;
|
|
17
|
+
})) })] })) : null;
|
|
20
18
|
}
|
|
@@ -42,10 +42,12 @@ const vcf_1 = require("@gmod/vcf");
|
|
|
42
42
|
const FeatureDetails_1 = __importDefault(require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails"));
|
|
43
43
|
const material_1 = require("@mui/material");
|
|
44
44
|
const mobx_react_1 = require("mobx-react");
|
|
45
|
+
const AltFormatter_1 = __importDefault(require("./AltFormatter"));
|
|
46
|
+
const Formatter_1 = __importDefault(require("./Formatter"));
|
|
45
47
|
const VariantSampleGrid_1 = __importDefault(require("./VariantSampleGrid/VariantSampleGrid"));
|
|
46
48
|
const variantFieldDescriptions_1 = require("./variantFieldDescriptions");
|
|
47
49
|
const LaunchBreakendPanel = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./LaunchBreakendPanel/LaunchBreakendPanel'))));
|
|
48
|
-
const VariantConsequenceDataGrid = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./VariantConsequenceDataGrid'))));
|
|
50
|
+
const VariantConsequenceDataGrid = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./VariantConsequence/VariantConsequenceDataGrid'))));
|
|
49
51
|
function AnnPanel({ descriptions, feature, }) {
|
|
50
52
|
var _a, _b, _c, _d, _e;
|
|
51
53
|
const annDesc = (_b = (_a = descriptions === null || descriptions === void 0 ? void 0 : descriptions.INFO) === null || _a === void 0 ? void 0 : _a.ANN) === null || _b === void 0 ? void 0 : _b.Description;
|
|
@@ -80,14 +82,22 @@ function LaunchBreakendWidgetArea({ model, }) {
|
|
|
80
82
|
},
|
|
81
83
|
}, model: model, locStrings: [`${feat.refName}:${feat.end}`] })) : null;
|
|
82
84
|
}
|
|
83
|
-
const
|
|
84
|
-
const { model } = props;
|
|
85
|
-
const {
|
|
86
|
-
const
|
|
87
|
-
const {
|
|
85
|
+
const FeatDefined = (0, mobx_react_1.observer)(function (props) {
|
|
86
|
+
const { feat, model } = props;
|
|
87
|
+
const { descriptions } = model;
|
|
88
|
+
const { samples, ...rest } = feat;
|
|
89
|
+
const { REF } = rest;
|
|
88
90
|
return ((0, jsx_runtime_1.jsxs)(material_1.Paper, { "data-testid": "variant-side-drawer", children: [(0, jsx_runtime_1.jsx)(FeatureDetails_1.default, { feature: rest, descriptions: {
|
|
89
91
|
...variantFieldDescriptions_1.variantFieldDescriptions,
|
|
90
92
|
...descriptions,
|
|
93
|
+
}, formatter: (value, key) => {
|
|
94
|
+
return key === 'ALT' ? ((0, jsx_runtime_1.jsx)(AltFormatter_1.default, { value: `${value}`, ref: REF })) : ((0, jsx_runtime_1.jsx)(Formatter_1.default, { value: value }));
|
|
91
95
|
}, ...props }), (0, jsx_runtime_1.jsxs)(react_1.Suspense, { fallback: null, children: [(0, jsx_runtime_1.jsx)(CsqPanel, { feature: rest, descriptions: descriptions }), (0, jsx_runtime_1.jsx)(AnnPanel, { feature: rest, descriptions: descriptions }), (0, jsx_runtime_1.jsx)(LaunchBreakendWidgetArea, { model: model })] }), (0, jsx_runtime_1.jsx)(VariantSampleGrid_1.default, { feature: feat, ...props, descriptions: descriptions })] }));
|
|
92
96
|
});
|
|
97
|
+
const VariantFeatureWidget = (0, mobx_react_1.observer)(function (props) {
|
|
98
|
+
const { model } = props;
|
|
99
|
+
const { featureData } = model;
|
|
100
|
+
const feat = structuredClone(featureData);
|
|
101
|
+
return feat ? ((0, jsx_runtime_1.jsx)(FeatDefined, { feat: feat, ...props })) : ((0, jsx_runtime_1.jsx)("div", { children: "No feature loaded, may not be available after page refresh because it was too large for localStorage" }));
|
|
102
|
+
});
|
|
93
103
|
exports.default = VariantFeatureWidget;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = VariantGenotypeFrequencyTable;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const DataGridFlexContainer_1 = __importDefault(require("@jbrowse/core/ui/DataGridFlexContainer"));
|
|
10
|
+
const util_1 = require("@jbrowse/core/util");
|
|
11
|
+
const material_1 = require("@mui/material");
|
|
12
|
+
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
13
|
+
function toP(n) {
|
|
14
|
+
return n.toPrecision(3);
|
|
15
|
+
}
|
|
16
|
+
function VariantGenotypeFrequencyTable({ rows, }) {
|
|
17
|
+
const [useCounts, setUseCounts] = (0, react_1.useState)(false);
|
|
18
|
+
const summary = {};
|
|
19
|
+
if (!useCounts) {
|
|
20
|
+
for (const row of rows) {
|
|
21
|
+
const gt = row.GT;
|
|
22
|
+
if (!summary[gt]) {
|
|
23
|
+
summary[gt] = {
|
|
24
|
+
count: 0,
|
|
25
|
+
GT: row.GT,
|
|
26
|
+
genotype: row.genotype,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
summary[gt].count++;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
for (const row of rows) {
|
|
34
|
+
const alleleCounts = {};
|
|
35
|
+
const alleles = row.GT.split(/[/|]/);
|
|
36
|
+
for (const allele of alleles) {
|
|
37
|
+
alleleCounts[allele] = (alleleCounts[allele] || 0) + 1;
|
|
38
|
+
}
|
|
39
|
+
const key = Object.entries(alleleCounts)
|
|
40
|
+
.map(([key, val]) => `${key}:${val}`)
|
|
41
|
+
.join(';');
|
|
42
|
+
if (!summary[key]) {
|
|
43
|
+
summary[key] = {
|
|
44
|
+
count: 0,
|
|
45
|
+
GT: key,
|
|
46
|
+
genotype: row.genotype,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
summary[key].count++;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const gridRows = Object.entries(summary).map(([key, val]) => ({
|
|
53
|
+
id: key,
|
|
54
|
+
...val,
|
|
55
|
+
count: `${val.count} / ${rows.length}`,
|
|
56
|
+
frequency: `${toP((val.count / rows.length) * 100)}%`,
|
|
57
|
+
}));
|
|
58
|
+
const keys = gridRows[0] ? Object.keys(gridRows[0]) : [];
|
|
59
|
+
const widths = keys.map(e => (0, util_1.measureGridWidth)(gridRows.map(r => `${r[e]}`)));
|
|
60
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: useCounts }), label: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: "Use allele counts instead of exact GT" }), onChange: (_, checked) => {
|
|
61
|
+
setUseCounts(checked);
|
|
62
|
+
} }), (0, jsx_runtime_1.jsx)(DataGridFlexContainer_1.default, { children: (0, jsx_runtime_1.jsx)(x_data_grid_1.DataGrid, { rows: gridRows, hideFooter: true, rowHeight: 25, columnHeaderHeight: 35, columns: [
|
|
63
|
+
{
|
|
64
|
+
field: 'GT',
|
|
65
|
+
width: widths[0],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
field: 'count',
|
|
69
|
+
width: widths[1],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
field: 'frequency',
|
|
73
|
+
width: widths[2],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
field: 'genotype',
|
|
77
|
+
width: widths[3],
|
|
78
|
+
},
|
|
79
|
+
] }) })] }));
|
|
80
|
+
}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
+
import type { VariantFieldDescriptions } from './types';
|
|
1
2
|
import type { SimpleFeatureSerialized } from '@jbrowse/core/util';
|
|
2
|
-
|
|
3
|
-
Description?: string;
|
|
4
|
-
}
|
|
5
|
-
interface Descriptions {
|
|
6
|
-
FORMAT?: Record<string, FormatRecord>;
|
|
7
|
-
}
|
|
8
|
-
export default function VariantSamples(props: {
|
|
3
|
+
export default function VariantSampleGrid(props: {
|
|
9
4
|
feature: SimpleFeatureSerialized;
|
|
10
|
-
descriptions?:
|
|
5
|
+
descriptions?: VariantFieldDescriptions | null;
|
|
11
6
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
-
export {};
|
|
@@ -3,30 +3,54 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = VariantSampleGrid;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const BaseCard_1 = __importDefault(require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard"));
|
|
10
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
11
|
+
const DataGridFlexContainer_1 = __importDefault(require("@jbrowse/core/ui/DataGridFlexContainer"));
|
|
12
|
+
const ErrorBoundary_1 = require("@jbrowse/core/ui/ErrorBoundary");
|
|
10
13
|
const util_1 = require("@jbrowse/core/util");
|
|
11
14
|
const material_1 = require("@mui/material");
|
|
12
15
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
16
|
+
const Checkbox2_1 = __importDefault(require("../Checkbox2"));
|
|
17
|
+
const VariantGenotypeFrequencyTable_1 = __importDefault(require("./VariantGenotypeFrequencyTable"));
|
|
13
18
|
const VariantSampleFilters_1 = __importDefault(require("./VariantSampleFilters"));
|
|
14
|
-
|
|
19
|
+
const util_2 = require("./util");
|
|
20
|
+
const util_3 = require("../../VcfFeature/util");
|
|
21
|
+
function VariantSampleGrid(props) {
|
|
15
22
|
var _a;
|
|
16
23
|
const { feature, descriptions = {} } = props;
|
|
17
24
|
const [filter, setFilter] = (0, react_1.useState)({});
|
|
25
|
+
const [showOnlyGenotypeColumns, setShowOnlyGenotypeColumns] = (0, react_1.useState)(true);
|
|
26
|
+
const [showFilters, setShowFilters] = (0, react_1.useState)(false);
|
|
18
27
|
const samples = (feature.samples || {});
|
|
19
|
-
const
|
|
28
|
+
const ALT = feature.ALT;
|
|
29
|
+
const REF = feature.REF;
|
|
30
|
+
const preFilteredRows = Object.entries(samples).map(([key, val]) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
return [
|
|
33
|
+
key,
|
|
34
|
+
{
|
|
35
|
+
...val,
|
|
36
|
+
GT: `${(_a = val.GT) === null || _a === void 0 ? void 0 : _a[0]}`,
|
|
37
|
+
genotype: (0, util_3.makeSimpleAltString)(`${(_b = val.GT) === null || _b === void 0 ? void 0 : _b[0]}`, REF, ALT),
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
});
|
|
20
41
|
let error;
|
|
21
42
|
let rows = [];
|
|
22
43
|
const filters = Object.keys(filter);
|
|
23
44
|
try {
|
|
24
45
|
rows = preFilteredRows
|
|
25
|
-
.map(
|
|
46
|
+
.map(([key, val]) => {
|
|
26
47
|
return {
|
|
27
|
-
...Object.fromEntries(Object.entries(
|
|
28
|
-
|
|
29
|
-
|
|
48
|
+
...Object.fromEntries(Object.entries(val).map(([formatField, formatValue]) => [
|
|
49
|
+
formatField,
|
|
50
|
+
formatValue,
|
|
51
|
+
])),
|
|
52
|
+
sample: key,
|
|
53
|
+
id: key,
|
|
30
54
|
};
|
|
31
55
|
})
|
|
32
56
|
.filter(row => filters.length
|
|
@@ -39,9 +63,9 @@ function VariantSamples(props) {
|
|
|
39
63
|
: true);
|
|
40
64
|
}
|
|
41
65
|
catch (e) {
|
|
66
|
+
console.error(e);
|
|
42
67
|
error = e;
|
|
43
68
|
}
|
|
44
|
-
const [checked, setChecked] = (0, react_1.useState)(false);
|
|
45
69
|
const keys = ['sample', ...Object.keys(((_a = preFilteredRows[0]) === null || _a === void 0 ? void 0 : _a[1]) || {})];
|
|
46
70
|
const widths = keys.map(e => (0, util_1.measureGridWidth)(rows.map(r => r[e])));
|
|
47
71
|
const columns = keys.map((field, index) => {
|
|
@@ -52,16 +76,13 @@ function VariantSamples(props) {
|
|
|
52
76
|
width: widths[index],
|
|
53
77
|
});
|
|
54
78
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
} }) })] }));
|
|
79
|
+
const s1 = new Set(['sample', 'GT', 'genotype']);
|
|
80
|
+
const s2 = new Set(keys);
|
|
81
|
+
return !preFilteredRows.length ? null : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(BaseCard_1.default, { ...props, title: "Genotype frequencies", children: (0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { FallbackComponent: ui_1.ErrorMessage, children: (0, jsx_runtime_1.jsx)(VariantGenotypeFrequencyTable_1.default, { rows: rows }) }) }), (0, jsx_runtime_1.jsxs)(BaseCard_1.default, { ...props, title: "Samples", children: [error ? (0, jsx_runtime_1.jsx)(material_1.Typography, { color: "error", children: `${error}` }) : null, (0, jsx_runtime_1.jsx)(Checkbox2_1.default, { label: "Show filters", checked: showFilters, onChange: event => {
|
|
82
|
+
setShowFilters(event.target.checked);
|
|
83
|
+
} }), (0, util_2.areSetsEqual)(s1, s2) ? null : ((0, jsx_runtime_1.jsx)(Checkbox2_1.default, { label: "Show only genotype columns", checked: showOnlyGenotypeColumns, onChange: event => {
|
|
84
|
+
setShowOnlyGenotypeColumns(event.target.checked);
|
|
85
|
+
} })), showFilters ? ((0, jsx_runtime_1.jsx)(VariantSampleFilters_1.default, { setFilter: setFilter, columns: columns, filter: filter })) : null, (0, jsx_runtime_1.jsx)(DataGridFlexContainer_1.default, { children: (0, jsx_runtime_1.jsx)(x_data_grid_1.DataGrid, { rows: rows, hideFooter: rows.length < 100, columns: showOnlyGenotypeColumns
|
|
86
|
+
? columns.filter(f => s1.has(f.field))
|
|
87
|
+
: columns, rowHeight: 25, columnHeaderHeight: 35, showToolbar: true }) })] })] }));
|
|
67
88
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface FrequencyTableEntry {
|
|
2
|
+
count: number;
|
|
3
|
+
GT: string;
|
|
4
|
+
genotype: string | undefined;
|
|
5
|
+
}
|
|
6
|
+
export type FrequencyTable = Record<string, FrequencyTableEntry>;
|
|
7
|
+
export interface VariantSampleGridRow {
|
|
8
|
+
sample: string;
|
|
9
|
+
id: string;
|
|
10
|
+
GT: string;
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
}
|
|
13
|
+
export type InfoFields = Record<string, unknown[]>;
|
|
14
|
+
export type Filters = Record<string, string>;
|
|
15
|
+
interface FormatRecord {
|
|
16
|
+
Description?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface VariantFieldDescriptions {
|
|
19
|
+
FORMAT?: Record<string, FormatRecord>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function areSetsEqual<T>(set1: Set<T>, set2: Set<T>): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.areSetsEqual = areSetsEqual;
|
|
4
|
+
function areSetsEqual(set1, set2) {
|
|
5
|
+
if (set1.size !== set2.size) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
for (const item of set1) {
|
|
9
|
+
if (!set2.has(item)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
@@ -3,9 +3,9 @@ import type { Instance } from 'mobx-state-tree';
|
|
|
3
3
|
export declare function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
4
4
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
5
5
|
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
6
|
-
featureData: import("mobx-state-tree").IType<
|
|
6
|
+
featureData: import("mobx-state-tree").IType<import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat>;
|
|
7
7
|
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
8
|
-
unformattedFeatureData: import("mobx-state-tree").IType<
|
|
8
|
+
unformattedFeatureData: import("mobx-state-tree").IType<import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat>;
|
|
9
9
|
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
10
10
|
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
11
11
|
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
@@ -35,15 +35,16 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
35
35
|
} & {
|
|
36
36
|
afterAttach(): void;
|
|
37
37
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
38
|
+
descriptions: import("mobx-state-tree").IType<Record<string, unknown> | undefined, Record<string, unknown> | undefined, Record<string, unknown> | undefined>;
|
|
38
39
|
} & {
|
|
39
40
|
type: import("mobx-state-tree").ISimpleType<"VariantFeatureWidget">;
|
|
40
41
|
descriptions: import("mobx-state-tree").IType<any, any, any>;
|
|
41
42
|
}, {
|
|
42
43
|
error: unknown;
|
|
43
44
|
} & {
|
|
44
|
-
setFeatureData(featureData:
|
|
45
|
+
setFeatureData(featureData: import("@jbrowse/core/util").SimpleFeatureSerialized): void;
|
|
45
46
|
clearFeatureData(): void;
|
|
46
|
-
setFormattedData(feat:
|
|
47
|
+
setFormattedData(feat: import("@jbrowse/core/util").SimpleFeatureSerialized): void;
|
|
47
48
|
setExtra(type?: string, trackId?: string, maxDepth?: number): void;
|
|
48
49
|
setError(e: unknown): void;
|
|
49
50
|
} & {
|
|
@@ -53,9 +54,9 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
53
54
|
} & Partial<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
|
|
54
55
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
55
56
|
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
56
|
-
featureData: import("mobx-state-tree").IType<
|
|
57
|
+
featureData: import("mobx-state-tree").IType<import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat>;
|
|
57
58
|
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
58
|
-
unformattedFeatureData: import("mobx-state-tree").IType<
|
|
59
|
+
unformattedFeatureData: import("mobx-state-tree").IType<import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat, import("@jbrowse/core/BaseFeatureWidget/types").MaybeSerializedFeat>;
|
|
59
60
|
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
60
61
|
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
61
62
|
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
@@ -85,6 +86,7 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
85
86
|
} & {
|
|
86
87
|
afterAttach(): void;
|
|
87
88
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
89
|
+
descriptions: import("mobx-state-tree").IType<Record<string, unknown> | undefined, Record<string, unknown> | undefined, Record<string, unknown> | undefined>;
|
|
88
90
|
}>> & import("mobx-state-tree/dist/internal").NonEmptyObject & import("mobx-state-tree")._NotCustomized, {
|
|
89
91
|
type: "BaseFeatureWidget";
|
|
90
92
|
id: string;
|
|
@@ -95,6 +97,7 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
95
97
|
maxDepth: number | undefined;
|
|
96
98
|
sequenceFeatureDetails: import("mobx-state-tree").ModelSnapshotType<{}>;
|
|
97
99
|
formattedFields: any;
|
|
100
|
+
descriptions: Record<string, unknown> | undefined;
|
|
98
101
|
finalizedFeatureData: any;
|
|
99
102
|
} & import("mobx-state-tree")._NotCustomized>;
|
|
100
103
|
export type VariantFeatureWidgetStateModel = ReturnType<typeof stateModelFactory>;
|
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
|
|
2
|
-
import type {
|
|
3
|
-
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
4
|
-
import type { Region } from '@jbrowse/core/util';
|
|
5
|
-
interface Args {
|
|
6
|
-
adapterConfig: AnyConfigurationModel;
|
|
7
|
-
stopToken?: string;
|
|
8
|
-
statusCallback: (arg: string) => void;
|
|
9
|
-
sessionId: string;
|
|
10
|
-
headers?: Record<string, string>;
|
|
11
|
-
regions: Region[];
|
|
12
|
-
bpPerPx: number;
|
|
13
|
-
sources: Source[];
|
|
14
|
-
minorAlleleFrequencyFilter: number;
|
|
15
|
-
}
|
|
2
|
+
import type { ClusterGenotypeMatrixArgs } from './types';
|
|
16
3
|
export declare class MultiVariantClusterGenotypeMatrix extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
17
4
|
name: string;
|
|
18
|
-
execute(args:
|
|
5
|
+
execute(args: ClusterGenotypeMatrixArgs, rpcDriverClassName: string): Promise<{
|
|
19
6
|
clusters: {
|
|
20
7
|
height: number;
|
|
21
8
|
indexes: number[];
|
|
@@ -25,4 +12,3 @@ export declare class MultiVariantClusterGenotypeMatrix extends RpcMethodTypeWith
|
|
|
25
12
|
clustersGivenK: number[][][];
|
|
26
13
|
}>;
|
|
27
14
|
}
|
|
28
|
-
export {};
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MultiVariantClusterGenotypeMatrix = void 0;
|
|
7
7
|
const RpcMethodTypeWithFiltersAndRenameRegions_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions"));
|
|
8
|
-
const cluster_1 = require("
|
|
8
|
+
const cluster_1 = require("@jbrowse/core/util/cluster");
|
|
9
9
|
const getGenotypeMatrix_1 = require("./getGenotypeMatrix");
|
|
10
10
|
class MultiVariantClusterGenotypeMatrix extends RpcMethodTypeWithFiltersAndRenameRegions_1.default {
|
|
11
11
|
constructor() {
|
|
@@ -20,14 +20,11 @@ class MultiVariantClusterGenotypeMatrix extends RpcMethodTypeWithFiltersAndRenam
|
|
|
20
20
|
});
|
|
21
21
|
return (0, cluster_1.clusterData)({
|
|
22
22
|
data: Object.values(matrix),
|
|
23
|
-
onProgress: a => {
|
|
24
|
-
deserializedArgs.statusCallback(`${toP(a * 100)}%`);
|
|
25
|
-
},
|
|
26
23
|
stopToken: deserializedArgs.stopToken,
|
|
24
|
+
onProgress: progress => {
|
|
25
|
+
deserializedArgs.statusCallback(progress);
|
|
26
|
+
},
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
exports.MultiVariantClusterGenotypeMatrix = MultiVariantClusterGenotypeMatrix;
|
|
31
|
-
function toP(n) {
|
|
32
|
-
return Number.parseFloat(n.toPrecision(3));
|
|
33
|
-
}
|
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
|
|
2
|
-
import type {
|
|
3
|
-
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
4
|
-
import type { Region } from '@jbrowse/core/util';
|
|
5
|
-
interface Args {
|
|
6
|
-
adapterConfig: AnyConfigurationModel;
|
|
7
|
-
stopToken?: string;
|
|
8
|
-
sessionId: string;
|
|
9
|
-
headers?: Record<string, string>;
|
|
10
|
-
regions: Region[];
|
|
11
|
-
bpPerPx: number;
|
|
12
|
-
sources: Source[];
|
|
13
|
-
minorAlleleFrequencyFilter: number;
|
|
14
|
-
}
|
|
2
|
+
import type { GetGenotypeMatrixArgs } from './types';
|
|
15
3
|
export declare class MultiVariantGetGenotypeMatrix extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
16
4
|
name: string;
|
|
17
|
-
execute(args:
|
|
5
|
+
execute(args: GetGenotypeMatrixArgs, rpcDriverClassName: string): Promise<Record<string, number[]>>;
|
|
18
6
|
}
|
|
19
|
-
export {};
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
|
|
2
|
+
import type { GetSimplifiedFeaturesArgs } from './types';
|
|
2
3
|
import type { SampleInfo } from '../shared/types';
|
|
3
|
-
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
4
|
-
import type { Region } from '@jbrowse/core/util';
|
|
5
|
-
interface Args {
|
|
6
|
-
adapterConfig: AnyConfigurationModel;
|
|
7
|
-
stopToken?: string;
|
|
8
|
-
sessionId: string;
|
|
9
|
-
headers?: Record<string, string>;
|
|
10
|
-
regions: Region[];
|
|
11
|
-
bpPerPx: number;
|
|
12
|
-
minorAlleleFrequencyFilter: number;
|
|
13
|
-
}
|
|
14
4
|
export declare class MultiVariantGetSimplifiedFeatures extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
15
5
|
name: string;
|
|
16
|
-
execute(args:
|
|
6
|
+
execute(args: GetSimplifiedFeaturesArgs, rpcDriverClassName: string): Promise<{
|
|
17
7
|
hasPhased: boolean;
|
|
18
8
|
sampleInfo: Record<string, SampleInfo>;
|
|
19
9
|
features: {
|
|
@@ -22,8 +12,8 @@ export declare class MultiVariantGetSimplifiedFeatures extends RpcMethodTypeWith
|
|
|
22
12
|
start: number;
|
|
23
13
|
end: number;
|
|
24
14
|
refName: string;
|
|
15
|
+
name: any;
|
|
25
16
|
};
|
|
26
17
|
}[];
|
|
27
18
|
}>;
|
|
28
19
|
}
|
|
29
|
-
export {};
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.MultiVariantGetSimplifiedFeatures = void 0;
|
|
7
7
|
const dataAdapterCache_1 = require("@jbrowse/core/data_adapters/dataAdapterCache");
|
|
8
8
|
const RpcMethodTypeWithFiltersAndRenameRegions_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions"));
|
|
9
|
+
const util_1 = require("@jbrowse/core/util");
|
|
9
10
|
const rxjs_1 = require("rxjs");
|
|
10
11
|
const minorAlleleFrequencyUtils_1 = require("../shared/minorAlleleFrequencyUtils");
|
|
11
12
|
class MultiVariantGetSimplifiedFeatures extends RpcMethodTypeWithFiltersAndRenameRegions_1.default {
|
|
@@ -14,17 +15,21 @@ class MultiVariantGetSimplifiedFeatures extends RpcMethodTypeWithFiltersAndRenam
|
|
|
14
15
|
this.name = 'MultiVariantGetSimplifiedFeatures';
|
|
15
16
|
}
|
|
16
17
|
async execute(args, rpcDriverClassName) {
|
|
17
|
-
var _a, _b;
|
|
18
18
|
const deserializedArgs = await this.deserializeArguments(args, rpcDriverClassName);
|
|
19
|
-
const { minorAlleleFrequencyFilter, regions, adapterConfig, sessionId } = deserializedArgs;
|
|
19
|
+
const { lengthCutoffFilter, minorAlleleFrequencyFilter, regions, adapterConfig, stopToken, sessionId, } = deserializedArgs;
|
|
20
20
|
const { dataAdapter } = await (0, dataAdapterCache_1.getAdapter)(this.pluginManager, sessionId, adapterConfig);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const features = (0, minorAlleleFrequencyUtils_1.getFeaturesThatPassMinorAlleleFrequencyFilter)({
|
|
22
|
+
minorAlleleFrequencyFilter,
|
|
23
|
+
lengthCutoffFilter,
|
|
24
|
+
stopToken,
|
|
25
|
+
features: await (0, rxjs_1.firstValueFrom)(dataAdapter
|
|
26
|
+
.getFeaturesInMultipleRegions(regions, deserializedArgs)
|
|
27
|
+
.pipe((0, rxjs_1.toArray)())),
|
|
28
|
+
});
|
|
25
29
|
const sampleInfo = {};
|
|
26
30
|
let hasPhased = false;
|
|
27
|
-
|
|
31
|
+
(0, util_1.forEachWithStopTokenCheck)(features, stopToken, ({ feature }) => {
|
|
32
|
+
var _a, _b;
|
|
28
33
|
const samp = feature.get('genotypes');
|
|
29
34
|
for (const [key, val] of Object.entries(samp)) {
|
|
30
35
|
const isPhased = val.includes('|');
|
|
@@ -34,7 +39,7 @@ class MultiVariantGetSimplifiedFeatures extends RpcMethodTypeWithFiltersAndRenam
|
|
|
34
39
|
isPhased: ((_b = sampleInfo[key]) === null || _b === void 0 ? void 0 : _b.isPhased) || isPhased,
|
|
35
40
|
};
|
|
36
41
|
}
|
|
37
|
-
}
|
|
42
|
+
});
|
|
38
43
|
return {
|
|
39
44
|
hasPhased,
|
|
40
45
|
sampleInfo,
|
|
@@ -44,6 +49,7 @@ class MultiVariantGetSimplifiedFeatures extends RpcMethodTypeWithFiltersAndRenam
|
|
|
44
49
|
start: feature.get('start'),
|
|
45
50
|
end: feature.get('end'),
|
|
46
51
|
refName: feature.get('refName'),
|
|
52
|
+
name: feature.get('name'),
|
|
47
53
|
},
|
|
48
54
|
})),
|
|
49
55
|
};
|
|
@@ -2,29 +2,42 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getGenotypeMatrix = getGenotypeMatrix;
|
|
4
4
|
const dataAdapterCache_1 = require("@jbrowse/core/data_adapters/dataAdapterCache");
|
|
5
|
+
const util_1 = require("@jbrowse/core/util");
|
|
5
6
|
const rxjs_1 = require("rxjs");
|
|
6
7
|
const minorAlleleFrequencyUtils_1 = require("../shared/minorAlleleFrequencyUtils");
|
|
7
8
|
async function getGenotypeMatrix({ pluginManager, args, }) {
|
|
8
|
-
const { sources, minorAlleleFrequencyFilter, regions, adapterConfig, sessionId, } = args;
|
|
9
|
+
const { sources, minorAlleleFrequencyFilter, regions, adapterConfig, sessionId, lengthCutoffFilter, stopToken, } = args;
|
|
9
10
|
const adapter = await (0, dataAdapterCache_1.getAdapter)(pluginManager, sessionId, adapterConfig);
|
|
10
11
|
const dataAdapter = adapter.dataAdapter;
|
|
11
|
-
const feats = await (0, rxjs_1.firstValueFrom)(dataAdapter.getFeaturesInMultipleRegions(regions, args).pipe((0, rxjs_1.toArray)()));
|
|
12
12
|
const genotypeFactor = new Set();
|
|
13
|
-
const mafs = (0, minorAlleleFrequencyUtils_1.getFeaturesThatPassMinorAlleleFrequencyFilter)(
|
|
13
|
+
const mafs = (0, minorAlleleFrequencyUtils_1.getFeaturesThatPassMinorAlleleFrequencyFilter)({
|
|
14
|
+
minorAlleleFrequencyFilter,
|
|
15
|
+
lengthCutoffFilter,
|
|
16
|
+
stopToken,
|
|
17
|
+
features: await (0, rxjs_1.firstValueFrom)(dataAdapter.getFeaturesInMultipleRegions(regions, args).pipe((0, rxjs_1.toArray)())),
|
|
18
|
+
});
|
|
14
19
|
for (const { alleleCounts } of mafs) {
|
|
15
|
-
for (const alt of
|
|
20
|
+
for (const alt of Object.keys(alleleCounts)) {
|
|
16
21
|
genotypeFactor.add(alt);
|
|
17
22
|
}
|
|
18
23
|
}
|
|
19
24
|
const rows = {};
|
|
20
|
-
|
|
25
|
+
const cacheSplit = {};
|
|
26
|
+
(0, util_1.forEachWithStopTokenCheck)(mafs, stopToken, ({ feature }) => {
|
|
21
27
|
const genotypes = feature.get('genotypes');
|
|
22
28
|
for (const { name } of sources) {
|
|
23
29
|
if (!rows[name]) {
|
|
24
30
|
rows[name] = [];
|
|
25
31
|
}
|
|
26
32
|
const val = genotypes[name];
|
|
27
|
-
|
|
33
|
+
let alleles;
|
|
34
|
+
if (cacheSplit[val]) {
|
|
35
|
+
alleles = cacheSplit[val];
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
alleles = val.split(/[/|]/);
|
|
39
|
+
cacheSplit[val] = alleles;
|
|
40
|
+
}
|
|
28
41
|
let genotypeStatus = 0;
|
|
29
42
|
let nonRefCount = 0;
|
|
30
43
|
let uncalledCount = 0;
|
|
@@ -50,6 +63,6 @@ async function getGenotypeMatrix({ pluginManager, args, }) {
|
|
|
50
63
|
}
|
|
51
64
|
rows[name].push(genotypeStatus);
|
|
52
65
|
}
|
|
53
|
-
}
|
|
66
|
+
});
|
|
54
67
|
return rows;
|
|
55
68
|
}
|