@jbrowse/plugin-variants 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +3 -3
- package/dist/MultiLinearVariantDisplay/index.js +1 -1
- package/dist/MultiLinearVariantDisplay/model.d.ts +58 -3
- package/dist/MultiLinearVariantDisplay/model.js +0 -1
- package/dist/MultiLinearVariantDisplay/renderSvg.js +2 -2
- package/dist/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +15 -5
- package/dist/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +3 -3
- package/dist/MultiLinearVariantMatrixDisplay/index.js +1 -1
- package/dist/MultiLinearVariantMatrixDisplay/model.d.ts +59 -2
- package/dist/MultiLinearVariantMatrixDisplay/model.js +5 -1
- package/dist/MultiLinearVariantMatrixDisplay/renderSvg.js +2 -2
- package/dist/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.d.ts → MultiLinearVariantMatrixRenderer.d.ts} +7 -3
- package/dist/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.d.ts +8 -0
- package/dist/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.js +41 -0
- package/dist/MultiLinearVariantMatrixRenderer/index.js +4 -4
- package/dist/MultiLinearVariantMatrixRenderer/makeImageData.d.ts +2 -2
- package/dist/MultiLinearVariantMatrixRenderer/makeImageData.js +15 -8
- package/dist/MultiLinearVariantMatrixRenderer/types.d.ts +2 -4
- package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +30 -1
- package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.js +11 -5
- package/dist/MultiLinearVariantRenderer/components/{MultiVariantRendering.d.ts → MultiLinearVariantRendering.d.ts} +10 -4
- package/dist/MultiLinearVariantRenderer/{MultiVariantRendering.js → components/MultiLinearVariantRendering.js} +25 -7
- package/dist/MultiLinearVariantRenderer/components/util.d.ts +1 -0
- package/dist/MultiLinearVariantRenderer/components/util.js +15 -0
- package/dist/MultiLinearVariantRenderer/index.js +2 -2
- package/dist/MultiLinearVariantRenderer/makeImageData.d.ts +9 -0
- package/dist/MultiLinearVariantRenderer/makeImageData.js +63 -23
- package/dist/MultiLinearVariantRenderer/types.d.ts +1 -0
- package/dist/SplitVcfTabixAdapter/configSchema.js +4 -2
- package/dist/VariantFeatureWidget/AltFormatter.d.ts +4 -0
- package/dist/VariantFeatureWidget/AltFormatter.js +13 -0
- package/dist/VariantFeatureWidget/Checkbox2.js +1 -8
- package/dist/VariantFeatureWidget/Formatter.d.ts +3 -0
- package/dist/VariantFeatureWidget/Formatter.js +23 -0
- package/dist/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.js → VariantConsequence/VariantConsequenceDataGridWrapper.js} +3 -5
- package/dist/VariantFeatureWidget/VariantFeatureWidget.js +7 -2
- package/dist/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.d.ts +4 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.js +80 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.d.ts +3 -9
- package/dist/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.js +41 -20
- package/dist/VariantFeatureWidget/VariantSampleGrid/types.d.ts +21 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid/types.js +2 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid/util.d.ts +1 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid/util.js +14 -0
- package/dist/VariantRPC/MultiVariantClusterGenotypeMatrix.d.ts +14 -0
- package/dist/VariantRPC/MultiVariantClusterGenotypeMatrix.js +30 -0
- package/dist/VariantRPC/MultiVariantGetGenotypeMatrix.d.ts +2 -13
- package/dist/VariantRPC/MultiVariantGetGenotypeMatrix.js +5 -57
- package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +3 -10
- package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.js +15 -10
- package/dist/VariantRPC/getGenotypeMatrix.d.ts +6 -0
- package/dist/VariantRPC/getGenotypeMatrix.js +60 -0
- package/dist/VariantRPC/types.d.ts +36 -0
- package/dist/VariantRPC/types.js +2 -0
- package/dist/VcfAdapter/VcfAdapter.js +6 -3
- package/dist/VcfFeature/index.js +0 -1
- package/dist/VcfFeature/util.d.ts +2 -0
- package/dist/VcfFeature/util.js +125 -27
- package/dist/VcfTabixAdapter/VcfTabixAdapter.js +17 -7
- package/dist/getMultiVariantFeaturesAutorun.d.ts +2 -0
- package/dist/getMultiVariantFeaturesAutorun.js +9 -2
- package/dist/getMultiVariantSourcesAutorun.js +3 -2
- package/dist/index.js +2 -0
- package/dist/shared/MultiVariantBaseModel.d.ts +59 -3
- package/dist/shared/MultiVariantBaseModel.js +95 -37
- package/dist/shared/components/AddFiltersDialog.d.ts +9 -0
- package/dist/shared/components/AddFiltersDialog.js +61 -0
- package/dist/shared/components/MultiVariantBaseDisplayComponent.d.ts +5 -0
- package/dist/shared/components/MultiVariantBaseDisplayComponent.js +29 -0
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialog.d.ts +6 -0
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialog.js +29 -0
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.d.ts +7 -0
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.js +74 -0
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogManual.d.ts +7 -0
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogManual.js +145 -0
- package/dist/shared/components/MultiVariantClusterDialog/types.d.ts +10 -0
- package/dist/shared/components/MultiVariantClusterDialog/types.js +2 -0
- package/{esm/shared/components/ColorLegend.d.ts → dist/shared/components/MultiVariantColorLegend.d.ts} +2 -2
- package/dist/shared/components/{ColorLegend.js → MultiVariantColorLegend.js} +5 -3
- package/dist/shared/components/MultiVariantCrosshairs.d.ts +7 -0
- package/dist/shared/components/MultiVariantCrosshairs.js +40 -0
- package/dist/shared/components/MultiVariantLegendBar.d.ts +7 -0
- package/dist/shared/components/{LegendBar.js → MultiVariantLegendBar.js} +2 -2
- package/dist/shared/components/MultiVariantTooltip.d.ts +4 -0
- package/dist/shared/components/MultiVariantTooltip.js +3 -2
- package/dist/shared/components/RectBg.js +4 -2
- package/dist/shared/components/SetColorDialog.js +1 -1
- package/dist/shared/components/SourcesDataGrid.d.ts +2 -1
- package/dist/shared/components/SourcesDataGrid.js +2 -2
- package/dist/shared/components/SourcesGrid.js +1 -1
- package/dist/shared/components/SourcesGridHeader.d.ts +2 -1
- package/dist/shared/components/SourcesGridHeader.js +2 -2
- package/dist/shared/drawAlleleCount.d.ts +1 -1
- package/dist/shared/drawAlleleCount.js +29 -5
- package/dist/shared/drawPhased.d.ts +1 -1
- package/dist/shared/drawPhased.js +14 -10
- package/dist/shared/getSources.d.ts +15 -0
- package/dist/shared/getSources.js +34 -0
- package/dist/shared/minorAlleleFrequencyUtils.d.ts +6 -1
- package/dist/shared/minorAlleleFrequencyUtils.js +4 -5
- package/dist/shared/sourcesGridUtils.d.ts +3 -2
- package/esm/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +2 -2
- package/esm/MultiLinearVariantDisplay/index.js +1 -1
- package/esm/MultiLinearVariantDisplay/model.d.ts +58 -3
- package/esm/MultiLinearVariantDisplay/model.js +0 -1
- package/esm/MultiLinearVariantDisplay/renderSvg.js +1 -1
- package/esm/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +15 -8
- package/esm/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +2 -2
- package/esm/MultiLinearVariantMatrixDisplay/index.js +1 -1
- package/esm/MultiLinearVariantMatrixDisplay/model.d.ts +59 -2
- package/esm/MultiLinearVariantMatrixDisplay/model.js +5 -1
- package/esm/MultiLinearVariantMatrixDisplay/renderSvg.js +1 -1
- package/esm/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.d.ts → MultiLinearVariantMatrixRenderer.d.ts} +7 -3
- package/esm/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.d.ts +8 -0
- package/esm/MultiLinearVariantMatrixRenderer/components/MultiLinearVariantMatrixRendering.js +39 -0
- package/esm/MultiLinearVariantMatrixRenderer/index.js +4 -4
- package/esm/MultiLinearVariantMatrixRenderer/makeImageData.d.ts +2 -2
- package/esm/MultiLinearVariantMatrixRenderer/makeImageData.js +16 -9
- package/esm/MultiLinearVariantMatrixRenderer/types.d.ts +2 -4
- package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +30 -1
- package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.js +11 -5
- package/esm/MultiLinearVariantRenderer/components/{MultiVariantRendering.d.ts → MultiLinearVariantRendering.d.ts} +10 -4
- package/esm/MultiLinearVariantRenderer/components/{MultiVariantRendering.js → MultiLinearVariantRendering.js} +25 -7
- package/esm/MultiLinearVariantRenderer/components/util.d.ts +1 -0
- package/esm/MultiLinearVariantRenderer/components/util.js +12 -0
- package/esm/MultiLinearVariantRenderer/index.js +1 -1
- package/esm/MultiLinearVariantRenderer/makeImageData.d.ts +9 -0
- package/esm/MultiLinearVariantRenderer/makeImageData.js +64 -24
- package/esm/MultiLinearVariantRenderer/types.d.ts +1 -0
- package/esm/SplitVcfTabixAdapter/configSchema.js +4 -2
- package/esm/VariantFeatureWidget/AltFormatter.d.ts +4 -0
- package/esm/VariantFeatureWidget/AltFormatter.js +10 -0
- package/esm/VariantFeatureWidget/Checkbox2.js +2 -9
- package/esm/VariantFeatureWidget/Formatter.d.ts +3 -0
- package/esm/VariantFeatureWidget/Formatter.js +17 -0
- package/esm/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.js → VariantConsequence/VariantConsequenceDataGridWrapper.js} +4 -6
- package/esm/VariantFeatureWidget/VariantFeatureWidget.js +7 -2
- package/esm/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.d.ts +4 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid/VariantGenotypeFrequencyTable.js +74 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.d.ts +3 -9
- package/esm/VariantFeatureWidget/VariantSampleGrid/VariantSampleGrid.js +43 -22
- package/esm/VariantFeatureWidget/VariantSampleGrid/types.d.ts +21 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid/types.js +1 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid/util.d.ts +1 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid/util.js +11 -0
- package/esm/VariantRPC/MultiVariantClusterGenotypeMatrix.d.ts +14 -0
- package/esm/VariantRPC/MultiVariantClusterGenotypeMatrix.js +23 -0
- package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.d.ts +2 -13
- package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.js +5 -57
- package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +3 -10
- package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.js +15 -10
- package/esm/VariantRPC/getGenotypeMatrix.d.ts +6 -0
- package/esm/VariantRPC/getGenotypeMatrix.js +57 -0
- package/esm/VariantRPC/types.d.ts +36 -0
- package/esm/VariantRPC/types.js +1 -0
- package/esm/VcfAdapter/VcfAdapter.js +7 -4
- package/esm/VcfFeature/index.js +0 -1
- package/esm/VcfFeature/util.d.ts +2 -0
- package/esm/VcfFeature/util.js +123 -27
- package/esm/VcfTabixAdapter/VcfTabixAdapter.js +18 -8
- package/esm/getMultiVariantFeaturesAutorun.d.ts +2 -0
- package/esm/getMultiVariantFeaturesAutorun.js +9 -2
- package/esm/getMultiVariantSourcesAutorun.js +3 -2
- package/esm/index.js +2 -0
- package/esm/shared/MultiVariantBaseModel.d.ts +59 -3
- package/esm/shared/MultiVariantBaseModel.js +97 -39
- package/esm/shared/components/AddFiltersDialog.d.ts +9 -0
- package/esm/shared/components/AddFiltersDialog.js +59 -0
- package/esm/shared/components/MultiVariantBaseDisplayComponent.d.ts +5 -0
- package/esm/shared/components/MultiVariantBaseDisplayComponent.js +24 -0
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialog.d.ts +6 -0
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialog.js +24 -0
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.d.ts +7 -0
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogAuto.js +72 -0
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogManual.d.ts +7 -0
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogManual.js +140 -0
- package/esm/shared/components/MultiVariantClusterDialog/types.d.ts +10 -0
- package/esm/shared/components/MultiVariantClusterDialog/types.js +1 -0
- package/{dist/shared/components/ColorLegend.d.ts → esm/shared/components/MultiVariantColorLegend.d.ts} +2 -2
- package/esm/shared/components/{ColorLegend.js → MultiVariantColorLegend.js} +6 -4
- package/esm/shared/components/MultiVariantCrosshairs.d.ts +7 -0
- package/esm/shared/components/MultiVariantCrosshairs.js +35 -0
- package/esm/shared/components/MultiVariantLegendBar.d.ts +7 -0
- package/esm/shared/components/{LegendBar.js → MultiVariantLegendBar.js} +1 -1
- package/esm/shared/components/MultiVariantTooltip.d.ts +4 -0
- package/esm/shared/components/MultiVariantTooltip.js +3 -2
- package/esm/shared/components/RectBg.js +4 -2
- package/esm/shared/components/SetColorDialog.js +1 -1
- package/esm/shared/components/SourcesDataGrid.d.ts +2 -1
- package/esm/shared/components/SourcesDataGrid.js +2 -2
- package/esm/shared/components/SourcesGrid.js +1 -1
- package/esm/shared/components/SourcesGridHeader.d.ts +2 -1
- package/esm/shared/components/SourcesGridHeader.js +2 -2
- package/esm/shared/drawAlleleCount.d.ts +1 -1
- package/esm/shared/drawAlleleCount.js +29 -5
- package/esm/shared/drawPhased.d.ts +1 -1
- package/esm/shared/drawPhased.js +14 -10
- package/esm/shared/getSources.d.ts +15 -0
- package/esm/shared/getSources.js +31 -0
- package/esm/shared/minorAlleleFrequencyUtils.d.ts +6 -1
- package/esm/shared/minorAlleleFrequencyUtils.js +5 -6
- package/esm/shared/sourcesGridUtils.d.ts +3 -2
- package/package.json +10 -9
- package/dist/MultiLinearVariantDisplay/components/Crosshair.d.ts +0 -7
- package/dist/MultiLinearVariantDisplay/components/Crosshair.js +0 -35
- package/dist/MultiLinearVariantMatrixDisplay/components/Crosshair.d.ts +0 -7
- package/dist/MultiLinearVariantMatrixDisplay/components/Crosshair.js +0 -28
- package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +0 -7
- package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +0 -38
- package/dist/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +0 -22
- package/dist/MultiLinearVariantRenderer/components/MultiVariantRendering.js +0 -52
- package/dist/VariantFeatureWidget/VariantConsequencePanel.d.ts +0 -5
- package/dist/VariantFeatureWidget/VariantConsequencePanel.js +0 -15
- package/dist/shared/components/ClusterDialog.d.ts +0 -11
- package/dist/shared/components/ClusterDialog.js +0 -113
- package/dist/shared/components/LegendBar.d.ts +0 -18
- package/esm/MultiLinearVariantDisplay/components/Crosshair.d.ts +0 -7
- package/esm/MultiLinearVariantDisplay/components/Crosshair.js +0 -30
- package/esm/MultiLinearVariantMatrixDisplay/components/Crosshair.d.ts +0 -7
- package/esm/MultiLinearVariantMatrixDisplay/components/Crosshair.js +0 -23
- package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +0 -7
- package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +0 -36
- package/esm/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +0 -22
- package/esm/MultiLinearVariantRenderer/MultiVariantRendering.js +0 -47
- package/esm/VariantFeatureWidget/VariantConsequencePanel.d.ts +0 -5
- package/esm/VariantFeatureWidget/VariantConsequencePanel.js +0 -9
- package/esm/shared/components/ClusterDialog.d.ts +0 -11
- package/esm/shared/components/ClusterDialog.js +0 -107
- package/esm/shared/components/LegendBar.d.ts +0 -18
- /package/dist/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.js → MultiLinearVariantMatrixRenderer.js} +0 -0
- /package/dist/VariantFeatureWidget/{VariantConsequenceDataGrid.d.ts → VariantConsequence/VariantConsequenceDataGrid.d.ts} +0 -0
- /package/dist/VariantFeatureWidget/{VariantConsequenceDataGrid.js → VariantConsequence/VariantConsequenceDataGrid.js} +0 -0
- /package/dist/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.d.ts → VariantConsequence/VariantConsequenceDataGridWrapper.d.ts} +0 -0
- /package/esm/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.js → MultiLinearVariantMatrixRenderer.js} +0 -0
- /package/esm/VariantFeatureWidget/{VariantConsequenceDataGrid.d.ts → VariantConsequence/VariantConsequenceDataGrid.d.ts} +0 -0
- /package/esm/VariantFeatureWidget/{VariantConsequenceDataGrid.js → VariantConsequence/VariantConsequenceDataGrid.js} +0 -0
- /package/esm/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.d.ts → VariantConsequence/VariantConsequenceDataGridWrapper.d.ts} +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui';
|
|
4
|
+
import { getContainingView, getSession, isAbortException, useLocalStorage, } from '@jbrowse/core/util';
|
|
5
|
+
import { getRpcSessionId } from '@jbrowse/core/util/tracks';
|
|
6
|
+
import { Button, DialogActions, DialogContent, FormControlLabel, Paper, Radio, RadioGroup, TextField, Typography, } from '@mui/material';
|
|
7
|
+
import copy from 'copy-to-clipboard';
|
|
8
|
+
import { saveAs } from 'file-saver';
|
|
9
|
+
import { observer } from 'mobx-react';
|
|
10
|
+
import { isAlive } from 'mobx-state-tree';
|
|
11
|
+
import { makeStyles } from 'tss-react/mui';
|
|
12
|
+
const useStyles = makeStyles()(theme => ({
|
|
13
|
+
textAreaFont: {
|
|
14
|
+
fontFamily: 'Courier New',
|
|
15
|
+
},
|
|
16
|
+
mgap: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexDirection: 'column',
|
|
19
|
+
gap: theme.spacing(4),
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
const ClusterDialogManuals = observer(function ({ model, handleClose, children, }) {
|
|
23
|
+
const { classes } = useStyles();
|
|
24
|
+
const [paste, setPaste] = useState('');
|
|
25
|
+
const [ret, setRet] = useState();
|
|
26
|
+
const [error, setError] = useState();
|
|
27
|
+
const [loading, setLoading] = useState(false);
|
|
28
|
+
const [showAdvanced, setShowAdvanced] = useLocalStorage('cluster-showAdvanced', false);
|
|
29
|
+
const [clusterMethod, setClusterMethod] = useState('single');
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
;
|
|
32
|
+
(async () => {
|
|
33
|
+
try {
|
|
34
|
+
setError(undefined);
|
|
35
|
+
setRet(undefined);
|
|
36
|
+
setLoading(true);
|
|
37
|
+
const view = getContainingView(model);
|
|
38
|
+
if (!view.initialized) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const { rpcManager } = getSession(model);
|
|
42
|
+
const { sourcesWithoutLayout, minorAlleleFrequencyFilter, lengthCutoffFilter, adapterConfig, } = model;
|
|
43
|
+
const sessionId = getRpcSessionId(model);
|
|
44
|
+
const ret = (await rpcManager.call(sessionId, 'MultiVariantGetGenotypeMatrix', {
|
|
45
|
+
regions: view.dynamicBlocks.contentBlocks,
|
|
46
|
+
sources: sourcesWithoutLayout,
|
|
47
|
+
minorAlleleFrequencyFilter,
|
|
48
|
+
lengthCutoffFilter,
|
|
49
|
+
sessionId,
|
|
50
|
+
adapterConfig,
|
|
51
|
+
}));
|
|
52
|
+
setRet(ret);
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
if (!isAbortException(e) && isAlive(model)) {
|
|
56
|
+
console.error(e);
|
|
57
|
+
setError(e);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
setLoading(false);
|
|
62
|
+
}
|
|
63
|
+
})();
|
|
64
|
+
}, [model]);
|
|
65
|
+
const results = ret
|
|
66
|
+
? `inputMatrix<-matrix(c(${Object.values(ret)
|
|
67
|
+
.map(val => val.join(','))
|
|
68
|
+
.join(',\n')}
|
|
69
|
+
),nrow=${Object.values(ret).length},byrow=TRUE)
|
|
70
|
+
rownames(inputMatrix)<-c(${Object.keys(ret)
|
|
71
|
+
.map(key => `'${key}'`)
|
|
72
|
+
.join(',')})
|
|
73
|
+
resultClusters<-hclust(dist(inputMatrix), method='${clusterMethod}')
|
|
74
|
+
cat(resultClusters$order,sep='\\n')`
|
|
75
|
+
: undefined;
|
|
76
|
+
const resultsTsv = ret
|
|
77
|
+
? Object.entries(ret)
|
|
78
|
+
.map(([key, val]) => [key, ...val].join('\t'))
|
|
79
|
+
.join('\n')
|
|
80
|
+
: undefined;
|
|
81
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DialogContent, { children: [children, _jsxs(Paper, { style: { padding: 16 }, children: [_jsxs("div", { children: [_jsxs("div", { style: {
|
|
82
|
+
display: 'flex',
|
|
83
|
+
gap: '8px',
|
|
84
|
+
flexWrap: 'wrap',
|
|
85
|
+
marginBottom: '16px',
|
|
86
|
+
}, children: [_jsx(Button, { variant: "contained", onClick: () => {
|
|
87
|
+
saveAs(new Blob([results || ''], {
|
|
88
|
+
type: 'text/plain;charset=utf-8',
|
|
89
|
+
}), 'cluster.R');
|
|
90
|
+
}, children: "Download Rscript" }), ' ', "or", ' ', _jsx(Button, { variant: "contained", onClick: () => {
|
|
91
|
+
copy(results || '');
|
|
92
|
+
}, children: "Copy Rscript to clipboard" }), ' ', "or", ' ', _jsx(Button, { variant: "contained", onClick: () => {
|
|
93
|
+
saveAs(new Blob([resultsTsv || ''], {
|
|
94
|
+
type: 'text/plain;charset=utf-8',
|
|
95
|
+
}), 'genotypes.tsv');
|
|
96
|
+
}, children: "Download TSV" }), _jsx("div", { children: _jsx(Button, { variant: "contained", onClick: () => {
|
|
97
|
+
setShowAdvanced(!showAdvanced);
|
|
98
|
+
}, children: showAdvanced
|
|
99
|
+
? 'Hide advanced options'
|
|
100
|
+
: 'Show advanced options' }) })] }), showAdvanced ? (_jsxs("div", { children: [_jsx(Typography, { variant: "h6", children: "Advanced options" }), _jsx(RadioGroup, { children: Object.entries({
|
|
101
|
+
single: 'Single',
|
|
102
|
+
complete: 'Complete',
|
|
103
|
+
}).map(([key, val]) => (_jsx(FormControlLabel, { control: _jsx(Radio, { checked: clusterMethod === key, onChange: () => {
|
|
104
|
+
setClusterMethod(key);
|
|
105
|
+
} }), label: val }, key))) })] })) : null, results ? (_jsx("div", {})) : loading ? (_jsx(LoadingEllipses, { variant: "h6", title: "Generating genotype matrix" })) : error ? (_jsx(ErrorMessage, { error: error })) : null] }), _jsxs("div", { children: [_jsx(Typography, { variant: "subtitle2", gutterBottom: true, style: { marginTop: '16px' }, children: "Clustering Results:" }), _jsx(TextField, { multiline: true, fullWidth: true, variant: "outlined", placeholder: "Paste results from Rscript here (sequence of numbers, one per line, specifying the new ordering)", rows: 10, value: paste, onChange: event => {
|
|
106
|
+
setPaste(event.target.value);
|
|
107
|
+
}, slotProps: {
|
|
108
|
+
input: {
|
|
109
|
+
classes: {
|
|
110
|
+
input: classes.textAreaFont,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
} })] })] })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", onClick: () => {
|
|
114
|
+
const { sourcesWithoutLayout } = model;
|
|
115
|
+
if (sourcesWithoutLayout) {
|
|
116
|
+
try {
|
|
117
|
+
model.setLayout(paste
|
|
118
|
+
.split('\n')
|
|
119
|
+
.map(t => t.trim())
|
|
120
|
+
.filter(f => !!f)
|
|
121
|
+
.map(r => +r)
|
|
122
|
+
.map(idx => {
|
|
123
|
+
const ret = sourcesWithoutLayout[idx - 1];
|
|
124
|
+
if (!ret) {
|
|
125
|
+
throw new Error(`out of bounds at ${idx}`);
|
|
126
|
+
}
|
|
127
|
+
return ret;
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
console.error(e);
|
|
132
|
+
getSession(model).notifyError(`${e}`, e);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
handleClose();
|
|
136
|
+
}, children: "Apply clustering" }), _jsx(Button, { variant: "contained", color: "secondary", onClick: () => {
|
|
137
|
+
handleClose();
|
|
138
|
+
}, children: "Cancel" })] })] }));
|
|
139
|
+
});
|
|
140
|
+
export default ClusterDialogManuals;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Source } from '../../types';
|
|
2
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
export interface ReducedModel {
|
|
4
|
+
sourcesWithoutLayout?: Source[];
|
|
5
|
+
minorAlleleFrequencyFilter?: number;
|
|
6
|
+
lengthCutoffFilter: number;
|
|
7
|
+
adapterConfig: AnyConfigurationModel;
|
|
8
|
+
setLayout: (arg: Source[]) => void;
|
|
9
|
+
clearLayout: () => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Source } from '../types';
|
|
2
|
-
declare const
|
|
2
|
+
declare const MultiVariantColorLegend: ({ model, labelWidth, }: {
|
|
3
3
|
model: {
|
|
4
4
|
canDisplayLabels: boolean;
|
|
5
5
|
rowHeight: number;
|
|
@@ -7,4 +7,4 @@ declare const ColorLegend: ({ model, labelWidth, }: {
|
|
|
7
7
|
};
|
|
8
8
|
labelWidth: number;
|
|
9
9
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
-
export default
|
|
10
|
+
export default MultiVariantColorLegend;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment } from 'react';
|
|
3
|
-
import { clamp } from '@jbrowse/core/util';
|
|
3
|
+
import { clamp, getFillProps } from '@jbrowse/core/util';
|
|
4
|
+
import { useTheme } from '@mui/material';
|
|
4
5
|
import { observer } from 'mobx-react';
|
|
5
6
|
import RectBg from './RectBg';
|
|
6
|
-
const
|
|
7
|
+
const MultiVariantColorLegend = observer(function ({ model, labelWidth, }) {
|
|
7
8
|
const { canDisplayLabels, rowHeight, sources } = model;
|
|
8
9
|
const svgFontSize = clamp(rowHeight, 8, 12);
|
|
9
10
|
const colorBoxWidth = 15;
|
|
10
11
|
const hasColors = sources === null || sources === void 0 ? void 0 : sources.some(s => s.color);
|
|
11
12
|
const legendWidth = labelWidth + (hasColors ? colorBoxWidth + 5 : 0);
|
|
13
|
+
const theme = useTheme();
|
|
12
14
|
return sources ? (_jsxs(_Fragment, { children: [canDisplayLabels ? (_jsx(RectBg, { y: 0, x: 0, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null, sources.map((source, idx) => {
|
|
13
15
|
const { color, name, label } = source;
|
|
14
|
-
return (_jsxs(Fragment, { children: [color ? (_jsx(RectBg, { y: idx * rowHeight, x: 0, width: colorBoxWidth + 0.5, height: rowHeight + 0.5, color: color })) : null, canDisplayLabels ? (_jsx("text", { y: idx * rowHeight + svgFontSize, x: color ? colorBoxWidth + 2 : 0, fontSize: svgFontSize, children: label || name })) : null] }, `${label}-${idx}`));
|
|
16
|
+
return (_jsxs(Fragment, { children: [color ? (_jsx(RectBg, { y: idx * rowHeight, x: 0, width: colorBoxWidth + 0.5, height: rowHeight + 0.5, color: color })) : null, canDisplayLabels ? (_jsx("text", { y: idx * rowHeight + svgFontSize, x: color ? colorBoxWidth + 2 : 0, fontSize: svgFontSize, ...getFillProps(theme.palette.text.primary), children: label || name })) : null] }, `${label}-${idx}`));
|
|
15
17
|
})] })) : null;
|
|
16
18
|
});
|
|
17
|
-
export default
|
|
19
|
+
export default MultiVariantColorLegend;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MultiVariantBaseModel } from '../MultiVariantBaseModel';
|
|
2
|
+
declare const MultiVariantCrosshairs: ({ mouseX, mouseY, model, }: {
|
|
3
|
+
mouseX: number;
|
|
4
|
+
mouseY: number;
|
|
5
|
+
model: MultiVariantBaseModel;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default MultiVariantCrosshairs;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getContainingView } from '@jbrowse/core/util';
|
|
3
|
+
import { useTheme } from '@mui/material';
|
|
4
|
+
import { observer } from 'mobx-react';
|
|
5
|
+
import { makeStyles } from 'tss-react/mui';
|
|
6
|
+
import MultiVariantTooltip from './MultiVariantTooltip';
|
|
7
|
+
const useStyles = makeStyles()({
|
|
8
|
+
rel: {
|
|
9
|
+
position: 'relative',
|
|
10
|
+
},
|
|
11
|
+
cursor: {
|
|
12
|
+
pointerEvents: 'none',
|
|
13
|
+
zIndex: 800,
|
|
14
|
+
position: 'absolute',
|
|
15
|
+
},
|
|
16
|
+
color: {
|
|
17
|
+
width: 10,
|
|
18
|
+
height: 10,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const MultiVariantCrosshairs = observer(function ({ mouseX, mouseY, model, }) {
|
|
22
|
+
const { classes } = useStyles();
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
const { hoveredGenotype, height, scrollTop, sourceMap } = model;
|
|
25
|
+
const { width } = getContainingView(model);
|
|
26
|
+
const source = hoveredGenotype ? sourceMap === null || sourceMap === void 0 ? void 0 : sourceMap[hoveredGenotype.name] : undefined;
|
|
27
|
+
const y = mouseY - scrollTop;
|
|
28
|
+
return (_jsxs("div", { className: classes.rel, children: [_jsxs("svg", { className: classes.cursor, width: width, height: height, style: {
|
|
29
|
+
top: scrollTop,
|
|
30
|
+
}, children: [_jsx("line", { x1: 0, x2: width, y1: y, y2: y, stroke: theme.palette.text.primary }), _jsx("line", { x1: mouseX, x2: mouseX, y1: 0, y2: height, stroke: theme.palette.text.primary })] }), source ? (_jsx(MultiVariantTooltip, { source: {
|
|
31
|
+
...source,
|
|
32
|
+
...hoveredGenotype,
|
|
33
|
+
} })) : null] }));
|
|
34
|
+
});
|
|
35
|
+
export default MultiVariantCrosshairs;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MultiVariantBaseModel } from '../MultiVariantBaseModel';
|
|
2
|
+
export declare const LegendBar: (props: {
|
|
3
|
+
model: MultiVariantBaseModel;
|
|
4
|
+
orientation?: string;
|
|
5
|
+
exportSVG?: boolean;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export default LegendBar;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { clamp, getContainingView, max, measureText } from '@jbrowse/core/util';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
|
-
import ColorLegend from './
|
|
4
|
+
import ColorLegend from './MultiVariantColorLegend';
|
|
5
5
|
const Wrapper = observer(function ({ children, model, exportSVG, }) {
|
|
6
6
|
const { id, scrollTop, height } = model;
|
|
7
7
|
const clipid = `legend-${id}`;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { SanitizedHTML } from '@jbrowse/core/ui';
|
|
3
3
|
import BaseTooltip from '@jbrowse/core/ui/BaseTooltip';
|
|
4
|
+
import escapeHTML from 'escape-html';
|
|
4
5
|
export default function MultiVariantTooltip({ source, }) {
|
|
5
6
|
return (_jsxs(BaseTooltip, { children: [source.color ? (_jsx("div", { style: {
|
|
6
7
|
width: 10,
|
|
@@ -8,10 +9,10 @@ export default function MultiVariantTooltip({ source, }) {
|
|
|
8
9
|
backgroundColor: source.color,
|
|
9
10
|
} })) : null, _jsx(SanitizedHTML, { html: Object.entries(source)
|
|
10
11
|
.filter(([key, val]) => key !== 'color' &&
|
|
11
|
-
key !== 'name' &&
|
|
12
12
|
key !== 'HP' &&
|
|
13
|
+
key !== 'name' &&
|
|
13
14
|
key !== 'id' &&
|
|
14
15
|
val !== undefined)
|
|
15
|
-
.map(([key, value]) => `${key}:${value}`)
|
|
16
|
+
.map(([key, value]) => `${key}:${escapeHTML(`${value}`)}`)
|
|
16
17
|
.join('<br/>') })] }));
|
|
17
18
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getFillProps } from '@jbrowse/core/util';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { alpha, useTheme } from '@mui/material';
|
|
4
|
+
const RectBg = ({ x, y, width, height, color, }) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
return (_jsx("rect", { pointerEvents: "auto", x: x, y: y, width: width, height: height, ...getFillProps(color || alpha(theme.palette.background.paper, 0.3)) }));
|
|
5
7
|
};
|
|
6
8
|
export default RectBg;
|
|
@@ -27,7 +27,7 @@ export default function SetColorDialog({ model, handleClose, }) {
|
|
|
27
27
|
const [showBulkEditor, setShowBulkEditor] = useState(false);
|
|
28
28
|
const [currLayout, setCurrLayout] = useState(sources || []);
|
|
29
29
|
const [showTips, setShowTips] = useLocalStorage('multivariant-showTips', false);
|
|
30
|
-
return (_jsx(DraggableDialog, { open: true, onClose: handleClose, maxWidth: "xl", title: "Multi-variant
|
|
30
|
+
return (_jsx(DraggableDialog, { open: true, onClose: handleClose, maxWidth: "xl", title: "Multi-sample variant display - Color/arrangement editor", children: showBulkEditor ? (_jsx(BulkEditPanel, { currLayout: currLayout, onClose: arg => {
|
|
31
31
|
if (arg) {
|
|
32
32
|
setCurrLayout(arg);
|
|
33
33
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Source } from '../types';
|
|
2
|
+
import type { GridRowId } from '@mui/x-data-grid';
|
|
2
3
|
export default function SourcesDataGrid({ rows, onChange, setSelected, }: {
|
|
3
4
|
rows: Source[];
|
|
4
5
|
onChange: (arg: Source[]) => void;
|
|
5
|
-
setSelected: (arg:
|
|
6
|
+
setSelected: (arg: GridRowId[]) => void;
|
|
6
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -19,8 +19,8 @@ export default function SourcesDataGrid({ rows, onChange, setSelected, }) {
|
|
|
19
19
|
idx: 0,
|
|
20
20
|
field: null,
|
|
21
21
|
});
|
|
22
|
-
return (_jsx("div", { style: { height: 400, width: '100%' }, children: _jsx(DataGrid, { checkboxSelection: true,
|
|
23
|
-
setSelected(arg);
|
|
22
|
+
return (_jsx("div", { style: { height: 400, width: '100%' }, children: _jsx(DataGrid, { checkboxSelection: true, onRowSelectionModelChange: arg => {
|
|
23
|
+
setSelected([...arg.ids]);
|
|
24
24
|
}, rows: rows, rowHeight: 25, columnHeaderHeight: 33, columns: [
|
|
25
25
|
{
|
|
26
26
|
field: 'color',
|
|
@@ -4,6 +4,6 @@ import SourcesDataGrid from './SourcesDataGrid';
|
|
|
4
4
|
import SourcesGridHeader from './SourcesGridHeader';
|
|
5
5
|
function SourcesGrid({ rows, onChange, showTips, }) {
|
|
6
6
|
const [selected, setSelected] = useState([]);
|
|
7
|
-
return (_jsxs("div", { children: [_jsx(SourcesGridHeader, { selected: selected, rows: rows, showTips: showTips, onChange: onChange }), _jsx(SourcesDataGrid, { rows: rows, onChange: onChange, setSelected: setSelected })] }));
|
|
7
|
+
return (_jsxs("div", { children: [_jsx(SourcesGridHeader, { selected: selected, rows: rows, showTips: showTips, onChange: onChange }), rows.length ? (_jsx(SourcesDataGrid, { rows: rows, onChange: onChange, setSelected: setSelected })) : (_jsx("div", { children: "No rows" }))] }));
|
|
8
8
|
}
|
|
9
9
|
export default SourcesGrid;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Source } from '../types';
|
|
2
|
+
import type { GridRowId } from '@mui/x-data-grid';
|
|
2
3
|
export default function SourcesGridHeader({ selected, onChange, rows, showTips, }: {
|
|
3
4
|
onChange: (arg: Source[]) => void;
|
|
4
5
|
rows: Source[];
|
|
5
|
-
selected:
|
|
6
|
+
selected: GridRowId[];
|
|
6
7
|
showTips: boolean;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -22,12 +22,12 @@ export default function SourcesGridHeader({ selected, onChange, rows, showTips,
|
|
|
22
22
|
onChange(moveDown([...rows], selected, rows.length));
|
|
23
23
|
}, disabled: !selected.length, children: [_jsx(KeyboardDoubleArrowDownIcon, {}), showTips ? 'Move selected items to bottom' : null] }), _jsx(ColorPopover, { anchorEl: anchorEl, color: widgetColor, onChange: c => {
|
|
24
24
|
setWidgetColor(c);
|
|
25
|
-
|
|
25
|
+
for (const id of selected) {
|
|
26
26
|
const elt = rows.find(f => f.name === id);
|
|
27
27
|
if (elt) {
|
|
28
28
|
elt.color = c;
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
onChange([...rows]);
|
|
32
32
|
}, onClose: () => {
|
|
33
33
|
setAnchorEl(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function drawColorAlleleCount(alleles: string[], ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, mostFrequentAlt: string):
|
|
1
|
+
export declare function drawColorAlleleCount(alleles: string[], ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, mostFrequentAlt: string, drawReference?: boolean, featureType?: string, featureStrand?: number, alpha?: number): any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { colord } from '@jbrowse/core/util/colord';
|
|
2
2
|
import { f2 } from './constants';
|
|
3
|
-
function getColorAlleleCount(alleles, mostFrequentAlt) {
|
|
3
|
+
function getColorAlleleCount(alleles, mostFrequentAlt, drawReference = true) {
|
|
4
4
|
const total = alleles.length;
|
|
5
5
|
let alt = 0;
|
|
6
6
|
let uncalled = 0;
|
|
@@ -21,7 +21,7 @@ function getColorAlleleCount(alleles, mostFrequentAlt) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
if (ref === total) {
|
|
24
|
-
return
|
|
24
|
+
return drawReference ? '#ccc' : undefined;
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
27
|
let a1;
|
|
@@ -39,7 +39,31 @@ function getColorAlleleCount(alleles, mostFrequentAlt) {
|
|
|
39
39
|
return (a1 === null || a1 === void 0 ? void 0 : a1.toHex()) || 'black';
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
export function drawColorAlleleCount(alleles, ctx, x, y, w, h, mostFrequentAlt) {
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
export function drawColorAlleleCount(alleles, ctx, x, y, w, h, mostFrequentAlt, drawReference = true, featureType = '', featureStrand, alpha = 1) {
|
|
43
|
+
const c = getColorAlleleCount(alleles, mostFrequentAlt, drawReference);
|
|
44
|
+
if (c) {
|
|
45
|
+
ctx.fillStyle = alpha !== 1 ? colord(c).alpha(alpha).toHex() : c;
|
|
46
|
+
if (featureType === 'inversion') {
|
|
47
|
+
if (featureStrand === 1) {
|
|
48
|
+
ctx.beginPath();
|
|
49
|
+
ctx.moveTo(x - f2, y - f2);
|
|
50
|
+
ctx.lineTo(x - f2, y + h + f2);
|
|
51
|
+
ctx.lineTo(x + w + f2, y + h / 2);
|
|
52
|
+
ctx.closePath();
|
|
53
|
+
ctx.fill();
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
ctx.beginPath();
|
|
57
|
+
ctx.moveTo(x + w + f2, y - f2);
|
|
58
|
+
ctx.lineTo(x + w + f2, y + h + f2);
|
|
59
|
+
ctx.lineTo(x - f2, y + h / 2);
|
|
60
|
+
ctx.closePath();
|
|
61
|
+
ctx.fill();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
ctx.fillRect(x - f2, y - f2, w + f2, h + f2);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return c;
|
|
45
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function drawPhased(alleles: string[], ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, HP: number, PS?: string):
|
|
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;
|
package/esm/shared/drawPhased.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { set1 } from '@jbrowse/core/ui/colors';
|
|
2
|
+
import { colord } from '@jbrowse/core/util/colord';
|
|
2
3
|
import { f2 } from './constants';
|
|
3
4
|
import { colorify } from './util';
|
|
4
|
-
function getColorPhased(alleles, HP) {
|
|
5
|
+
function getColorPhased(alleles, HP, drawReference = true) {
|
|
5
6
|
const c = +alleles[HP];
|
|
6
|
-
return c ? set1[c - 1] || 'black' : '#ccc';
|
|
7
|
+
return c ? set1[c - 1] || 'black' : drawReference ? '#ccc' : undefined;
|
|
7
8
|
}
|
|
8
|
-
function getColorPhasedWithPhaseSet(alleles, HP, PS) {
|
|
9
|
+
function getColorPhasedWithPhaseSet(alleles, HP, PS, drawReference = true) {
|
|
9
10
|
const c = +alleles[HP];
|
|
10
|
-
return c ? colorify(+PS) || 'black' : '#ccc';
|
|
11
|
+
return c ? colorify(+PS) || 'black' : drawReference ? '#ccc' : undefined;
|
|
11
12
|
}
|
|
12
|
-
export function drawPhased(alleles, ctx, x, y, w, h, HP, PS) {
|
|
13
|
-
|
|
14
|
-
PS
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
export function drawPhased(alleles, ctx, x, y, w, h, HP, PS, drawReference = true, alpha = 1) {
|
|
14
|
+
const c = PS !== undefined
|
|
15
|
+
? getColorPhasedWithPhaseSet(alleles, HP, PS, drawReference)
|
|
16
|
+
: getColorPhased(alleles, HP, drawReference);
|
|
17
|
+
if (c) {
|
|
18
|
+
ctx.fillStyle = alpha !== 1 ? colord(c).alpha(alpha).toHex() : c;
|
|
19
|
+
ctx.fillRect(x - f2, y - f2, w + f2, h + f2);
|
|
20
|
+
}
|
|
21
|
+
return c;
|
|
18
22
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SampleInfo, Source } from './types';
|
|
2
|
+
export declare function getSources({ sources, layout, renderingMode, sampleInfo, }: {
|
|
3
|
+
sources: Source[];
|
|
4
|
+
layout?: Source[];
|
|
5
|
+
renderingMode: string;
|
|
6
|
+
sampleInfo?: Record<string, SampleInfo>;
|
|
7
|
+
}): {
|
|
8
|
+
label: string;
|
|
9
|
+
id: string;
|
|
10
|
+
baseUri?: string;
|
|
11
|
+
name: string;
|
|
12
|
+
color?: string;
|
|
13
|
+
group?: string;
|
|
14
|
+
HP?: number;
|
|
15
|
+
}[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function getSources({ sources, layout = sources, renderingMode, sampleInfo, }) {
|
|
2
|
+
const rows = [];
|
|
3
|
+
const sourceMap = Object.fromEntries(sources.map(s => [s.name, s]));
|
|
4
|
+
for (const row of layout) {
|
|
5
|
+
if (renderingMode === 'phased') {
|
|
6
|
+
const info = sampleInfo === null || sampleInfo === void 0 ? void 0 : sampleInfo[row.name];
|
|
7
|
+
if (info === null || info === void 0 ? void 0 : info.isPhased) {
|
|
8
|
+
const ploidy = info.maxPloidy;
|
|
9
|
+
for (let i = 0; i < ploidy; i++) {
|
|
10
|
+
const id = `${row.name} HP${i}`;
|
|
11
|
+
rows.push({
|
|
12
|
+
...sourceMap[row.name],
|
|
13
|
+
...row,
|
|
14
|
+
label: id,
|
|
15
|
+
HP: i,
|
|
16
|
+
id: id,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
rows.push({
|
|
23
|
+
...sourceMap[row.name],
|
|
24
|
+
...row,
|
|
25
|
+
label: row.name,
|
|
26
|
+
id: row.name,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return rows;
|
|
31
|
+
}
|
|
@@ -2,7 +2,12 @@ import type { Feature } from '@jbrowse/core/util';
|
|
|
2
2
|
export declare function findSecondLargestNumber(arr: Iterable<number>): number;
|
|
3
3
|
export declare function calculateAlleleCounts(feat: Feature): Map<any, any>;
|
|
4
4
|
export declare function calculateMinorAlleleFrequency(alleleCounts: Map<string, number>): number;
|
|
5
|
-
export declare function getFeaturesThatPassMinorAlleleFrequencyFilter(
|
|
5
|
+
export declare function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter, stopToken, }: {
|
|
6
|
+
features: Iterable<Feature>;
|
|
7
|
+
minorAlleleFrequencyFilter: number;
|
|
8
|
+
lengthCutoffFilter: number;
|
|
9
|
+
stopToken?: string;
|
|
10
|
+
}): {
|
|
6
11
|
feature: Feature;
|
|
7
12
|
mostFrequentAlt: string;
|
|
8
13
|
alleleCounts: Map<string, number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sum } from '@jbrowse/core/util';
|
|
1
|
+
import { forEachWithStopTokenCheck, sum } from '@jbrowse/core/util';
|
|
2
2
|
export function findSecondLargestNumber(arr) {
|
|
3
3
|
let firstMax = 0;
|
|
4
4
|
let secondMax = 0;
|
|
@@ -41,21 +41,20 @@ function getMostFrequentAlt(alleleCounts) {
|
|
|
41
41
|
}
|
|
42
42
|
return mostFrequentAlt;
|
|
43
43
|
}
|
|
44
|
-
export function getFeaturesThatPassMinorAlleleFrequencyFilter(
|
|
44
|
+
export function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter, stopToken, }) {
|
|
45
45
|
const results = [];
|
|
46
|
-
|
|
46
|
+
forEachWithStopTokenCheck(features, stopToken, feature => {
|
|
47
47
|
if (feature.get('end') - feature.get('start') <= lengthCutoffFilter) {
|
|
48
48
|
const alleleCounts = calculateAlleleCounts(feature);
|
|
49
49
|
if (calculateMinorAlleleFrequency(alleleCounts) >=
|
|
50
50
|
minorAlleleFrequencyFilter) {
|
|
51
|
-
const mostFrequentAlt = getMostFrequentAlt(alleleCounts);
|
|
52
51
|
results.push({
|
|
53
52
|
feature,
|
|
54
|
-
mostFrequentAlt,
|
|
53
|
+
mostFrequentAlt: getMostFrequentAlt(alleleCounts),
|
|
55
54
|
alleleCounts,
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
|
-
}
|
|
58
|
+
});
|
|
60
59
|
return results;
|
|
61
60
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { GridRowId } from '@mui/x-data-grid';
|
|
1
2
|
export declare function moveUp(arr: {
|
|
2
3
|
name: string;
|
|
3
|
-
}[], sel:
|
|
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
|
}[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-variants",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "JBrowse 2 variant adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -40,13 +40,14 @@
|
|
|
40
40
|
"@gmod/bgzf-filehandle": "^2.0.1",
|
|
41
41
|
"@gmod/tabix": "^2.0.0",
|
|
42
42
|
"@gmod/vcf": "^6.0.8",
|
|
43
|
-
"@jbrowse/core": "^3.
|
|
44
|
-
"@jbrowse/plugin-circular-view": "^3.
|
|
45
|
-
"@jbrowse/plugin-linear-genome-view": "^3.
|
|
46
|
-
"@jbrowse/sv-core": "^3.
|
|
47
|
-
"@mui/icons-material": "^
|
|
48
|
-
"@mui/material": "^
|
|
49
|
-
"@mui/x-data-grid": "^
|
|
43
|
+
"@jbrowse/core": "^3.3.0",
|
|
44
|
+
"@jbrowse/plugin-circular-view": "^3.3.0",
|
|
45
|
+
"@jbrowse/plugin-linear-genome-view": "^3.3.0",
|
|
46
|
+
"@jbrowse/sv-core": "^3.3.0",
|
|
47
|
+
"@mui/icons-material": "^7.0.0",
|
|
48
|
+
"@mui/material": "^7.0.0",
|
|
49
|
+
"@mui/x-data-grid": "^8.0.0",
|
|
50
|
+
"escape-html": "^1.0.3",
|
|
50
51
|
"mobx": "^6.0.0",
|
|
51
52
|
"mobx-react": "^9.0.0",
|
|
52
53
|
"mobx-state-tree": "^5.0.0",
|
|
@@ -62,5 +63,5 @@
|
|
|
62
63
|
"distModule": "esm/index.js",
|
|
63
64
|
"srcModule": "src/index.ts",
|
|
64
65
|
"module": "esm/index.js",
|
|
65
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "0bb64d8cc7ecdd167515308b31eec3d9acbc59e4"
|
|
66
67
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { MultiLinearVariantDisplayModel } from '../model';
|
|
2
|
-
declare const Crosshair: ({ mouseX, mouseY, model, }: {
|
|
3
|
-
mouseX: number;
|
|
4
|
-
mouseY: number;
|
|
5
|
-
model: MultiLinearVariantDisplayModel;
|
|
6
|
-
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
-
export default Crosshair;
|