@jbrowse/plugin-variants 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +3 -3
- package/dist/MultiLinearVariantDisplay/index.js +1 -1
- package/dist/MultiLinearVariantDisplay/model.d.ts +39 -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 +39 -2
- package/dist/MultiLinearVariantMatrixDisplay/model.js +1 -0
- 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 +12 -13
- 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 +60 -28
- 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/util.d.ts +1 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid/util.js +14 -0
- 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 +10 -5
- package/dist/VariantRPC/types.d.ts +23 -0
- 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.js +12 -7
- 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 +40 -3
- package/dist/shared/MultiVariantBaseModel.js +69 -3
- 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 +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/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 +39 -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 +39 -2
- package/esm/MultiLinearVariantMatrixDisplay/model.js +1 -0
- 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 +13 -14
- 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 +61 -29
- 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/util.d.ts +1 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid/util.js +11 -0
- 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 +10 -5
- package/esm/VariantRPC/types.d.ts +23 -0
- 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.js +13 -8
- 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 +40 -3
- package/esm/shared/MultiVariantBaseModel.js +71 -5
- 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 +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/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/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/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/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/MultiLinearVariantMatrixRenderer/{LinearVariantMatrixRenderer.js → MultiLinearVariantMatrixRenderer.js} +0 -0
- /package/esm/VariantFeatureWidget/{VariantConsequenceDataGrid.d.ts → VariantConsequence/VariantConsequenceDataGrid.d.ts} +0 -0
- /package/esm/VariantFeatureWidget/{VariantConsequenceDataGrid.js → VariantConsequence/VariantConsequenceDataGrid.js} +0 -0
- /package/esm/VariantFeatureWidget/{VariantConsequenceDataGridWrapper.d.ts → VariantConsequence/VariantConsequenceDataGridWrapper.d.ts} +0 -0
- /package/esm/{shared/components/ClusterDialog → VariantFeatureWidget/VariantSampleGrid}/types.js +0 -0
- /package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialog.d.ts +0 -0
- /package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogAuto.d.ts +0 -0
- /package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogManual.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TabixIndexedFile } from '@gmod/tabix';
|
|
2
2
|
import VcfParser from '@gmod/vcf';
|
|
3
3
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
|
-
import { fetchAndMaybeUnzipText, updateStatus } from '@jbrowse/core/util';
|
|
4
|
+
import { fetchAndMaybeUnzipText, shorten2, updateStatus, } from '@jbrowse/core/util';
|
|
5
5
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
6
6
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
7
7
|
import VcfFeature from '../VcfFeature';
|
|
@@ -85,22 +85,27 @@ export default class VcfTabixAdapter extends BaseFeatureDataAdapter {
|
|
|
85
85
|
const lines = txt.split(/\n|\r\n|\r/);
|
|
86
86
|
const header = lines[0].split('\t');
|
|
87
87
|
const { parser } = await this.configure();
|
|
88
|
-
const
|
|
89
|
-
const ret = lines
|
|
88
|
+
const metadataLines = lines
|
|
90
89
|
.slice(1)
|
|
91
90
|
.filter(f => !!f)
|
|
92
91
|
.map(line => {
|
|
93
92
|
const [name, ...rest] = line.split('\t');
|
|
94
93
|
return {
|
|
95
|
-
...Object.fromEntries(
|
|
94
|
+
...Object.fromEntries(header.slice(1).map((c, idx) => [c, rest[idx] || ''])),
|
|
96
95
|
name: name,
|
|
97
96
|
};
|
|
98
97
|
});
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
const vcfSampleSet = new Set(parser.samples);
|
|
99
|
+
const metadataSet = new Set(metadataLines.map(r => r.name));
|
|
100
|
+
const metadataNotInVcfSamples = [...metadataSet].filter(f => !vcfSampleSet.has(f));
|
|
101
|
+
const vcfSamplesNotInMetadata = [...vcfSampleSet].filter(f => !metadataSet.has(f));
|
|
102
|
+
if (metadataNotInVcfSamples.length) {
|
|
103
|
+
console.warn(`There are ${metadataNotInVcfSamples.length} samples in metadata file (${metadataLines.length} lines) not in VCF (${parser.samples.length} samples):`, shorten2(metadataNotInVcfSamples.join(',')));
|
|
102
104
|
}
|
|
103
|
-
|
|
105
|
+
if (vcfSamplesNotInMetadata.length) {
|
|
106
|
+
console.warn(`There are ${vcfSamplesNotInMetadata.length} samples in VCF file (${parser.samples.length} samples) not in metadata file (${metadataLines.length} lines):`, shorten2(vcfSamplesNotInMetadata.map(m => m).join(',')));
|
|
107
|
+
}
|
|
108
|
+
return metadataLines.filter(f => vcfSampleSet.has(f.name));
|
|
104
109
|
}
|
|
105
110
|
}
|
|
106
111
|
freeResources() { }
|
|
@@ -6,6 +6,7 @@ export declare function getMultiVariantFeaturesAutorun(self: {
|
|
|
6
6
|
adapterConfig: AnyConfigurationModel;
|
|
7
7
|
sources?: Source[];
|
|
8
8
|
minorAlleleFrequencyFilter: number;
|
|
9
|
+
lengthCutoffFilter: number;
|
|
9
10
|
statsReadyAndRegionNotTooLarge: boolean;
|
|
10
11
|
adapterProps: () => Record<string, unknown>;
|
|
11
12
|
setError: (error: unknown) => void;
|
|
@@ -13,4 +14,5 @@ export declare function getMultiVariantFeaturesAutorun(self: {
|
|
|
13
14
|
setMessage: (str: string) => void;
|
|
14
15
|
setHasPhased: (arg: boolean) => void;
|
|
15
16
|
setSampleInfo: (arg: Record<string, SampleInfo>) => void;
|
|
17
|
+
setSimplifiedFeaturesLoading: (arg: string) => void;
|
|
16
18
|
}): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SimpleFeature, getContainingView, getSession, } from '@jbrowse/core/util';
|
|
2
2
|
import { isAbortException } from '@jbrowse/core/util/aborting';
|
|
3
|
+
import { createStopToken } from '@jbrowse/core/util/stopToken';
|
|
3
4
|
import { getRpcSessionId } from '@jbrowse/core/util/tracks';
|
|
4
5
|
import { autorun } from 'mobx';
|
|
5
6
|
import { addDisposer, isAlive } from 'mobx-state-tree';
|
|
@@ -10,16 +11,20 @@ export function getMultiVariantFeaturesAutorun(self) {
|
|
|
10
11
|
if (!view.initialized || !self.statsReadyAndRegionNotTooLarge) {
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
14
|
+
const stopToken = createStopToken();
|
|
15
|
+
self.setSimplifiedFeaturesLoading(stopToken);
|
|
13
16
|
const { rpcManager } = getSession(self);
|
|
14
|
-
const { sources, minorAlleleFrequencyFilter, adapterConfig } = self;
|
|
17
|
+
const { lengthCutoffFilter, sources, minorAlleleFrequencyFilter, adapterConfig, } = self;
|
|
15
18
|
if (sources) {
|
|
16
19
|
const sessionId = getRpcSessionId(self);
|
|
17
20
|
const { sampleInfo, hasPhased, features } = (await rpcManager.call(sessionId, 'MultiVariantGetSimplifiedFeatures', {
|
|
18
21
|
regions: view.dynamicBlocks.contentBlocks,
|
|
19
22
|
sources,
|
|
20
23
|
minorAlleleFrequencyFilter,
|
|
24
|
+
lengthCutoffFilter,
|
|
21
25
|
sessionId,
|
|
22
26
|
adapterConfig,
|
|
27
|
+
stopToken,
|
|
23
28
|
}));
|
|
24
29
|
if (isAlive(self)) {
|
|
25
30
|
self.setHasPhased(hasPhased);
|
|
@@ -34,5 +39,7 @@ export function getMultiVariantFeaturesAutorun(self) {
|
|
|
34
39
|
getSession(self).notifyError(`${e}`, e);
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
|
-
}, {
|
|
42
|
+
}, {
|
|
43
|
+
delay: 1000,
|
|
44
|
+
}));
|
|
38
45
|
}
|
|
@@ -13,12 +13,13 @@ export function getMultiVariantSourcesAutorun(self) {
|
|
|
13
13
|
}
|
|
14
14
|
const { rpcManager } = getSession(self);
|
|
15
15
|
const { adapterConfig } = self;
|
|
16
|
-
const
|
|
17
|
-
self.setSourcesLoading(
|
|
16
|
+
const stopToken = createStopToken();
|
|
17
|
+
self.setSourcesLoading(stopToken);
|
|
18
18
|
const sessionId = getRpcSessionId(self);
|
|
19
19
|
const sources = (await rpcManager.call(sessionId, 'MultiVariantGetSources', {
|
|
20
20
|
sessionId,
|
|
21
21
|
adapterConfig,
|
|
22
|
+
stopToken,
|
|
22
23
|
}));
|
|
23
24
|
if (isAlive(self)) {
|
|
24
25
|
self.setSources(sources);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SampleInfo, Source } from '
|
|
1
|
+
import type { SampleInfo, Source } from './types';
|
|
2
2
|
import type { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
|
|
3
3
|
import type { Feature } from '@jbrowse/core/util';
|
|
4
4
|
import type { Instance } from 'mobx-state-tree';
|
|
@@ -90,6 +90,9 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
|
|
|
90
90
|
renderingMode: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
91
91
|
rowHeightSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
92
92
|
autoHeight: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
93
|
+
lengthCutoffFilter: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
94
|
+
jexlFilters: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IArrayType<import("mobx-state-tree").ISimpleType<string>>>;
|
|
95
|
+
referenceDrawingMode: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
93
96
|
}, {
|
|
94
97
|
rendererTypeName: string;
|
|
95
98
|
error: unknown;
|
|
@@ -233,19 +236,28 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
|
|
|
233
236
|
renderProps(): any;
|
|
234
237
|
} & {
|
|
235
238
|
sourcesLoadingStopToken: string | undefined;
|
|
239
|
+
simplifiedFeaturesStopToken: string | undefined;
|
|
236
240
|
featureUnderMouseVolatile: Feature | undefined;
|
|
237
241
|
sourcesVolatile: Source[] | undefined;
|
|
238
242
|
featuresVolatile: Feature[] | undefined;
|
|
239
243
|
hasPhased: boolean;
|
|
240
244
|
sampleInfo: undefined | Record<string, SampleInfo>;
|
|
241
|
-
hoveredGenotype:
|
|
245
|
+
hoveredGenotype: {
|
|
246
|
+
genotype: string;
|
|
247
|
+
name: string;
|
|
248
|
+
} | undefined;
|
|
242
249
|
} & {
|
|
250
|
+
setJexlFilters(f?: string[]): void;
|
|
243
251
|
setRowHeight(arg: number): void;
|
|
244
|
-
setHoveredGenotype(arg
|
|
252
|
+
setHoveredGenotype(arg?: {
|
|
253
|
+
genotype: string;
|
|
254
|
+
name: string;
|
|
255
|
+
}): void;
|
|
245
256
|
setFeatures(f: Feature[]): void;
|
|
246
257
|
setLayout(layout: Source[]): void;
|
|
247
258
|
clearLayout(): void;
|
|
248
259
|
setSourcesLoading(str: string): void;
|
|
260
|
+
setSimplifiedFeaturesLoading(str: string): void;
|
|
249
261
|
setSources(sources: Source[]): void;
|
|
250
262
|
setMafFilter(arg: number): void;
|
|
251
263
|
setShowSidebarLabels(arg: boolean): void;
|
|
@@ -253,7 +265,9 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
|
|
|
253
265
|
setAutoHeight(arg: boolean): void;
|
|
254
266
|
setHasPhased(arg: boolean): void;
|
|
255
267
|
setSampleInfo(arg: Record<string, SampleInfo>): void;
|
|
268
|
+
setReferenceDrawingMode(arg: string): void;
|
|
256
269
|
} & {
|
|
270
|
+
readonly activeFilters: any;
|
|
257
271
|
readonly preSources: Source[] | undefined;
|
|
258
272
|
readonly sourcesWithoutLayout: {
|
|
259
273
|
label: string;
|
|
@@ -274,6 +288,17 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
|
|
|
274
288
|
HP?: number;
|
|
275
289
|
}[] | undefined;
|
|
276
290
|
} & {
|
|
291
|
+
readonly sourceMap: {
|
|
292
|
+
[k: string]: {
|
|
293
|
+
label: string;
|
|
294
|
+
id: string;
|
|
295
|
+
baseUri?: string;
|
|
296
|
+
name: string;
|
|
297
|
+
color?: string;
|
|
298
|
+
group?: string;
|
|
299
|
+
HP?: number;
|
|
300
|
+
};
|
|
301
|
+
} | undefined;
|
|
277
302
|
readonly rowHeight: number;
|
|
278
303
|
adapterProps(): any;
|
|
279
304
|
trackMenuItems(): (import("@jbrowse/core/ui").MenuDivider | import("@jbrowse/core/ui").MenuSubHeader | import("@jbrowse/core/ui").NormalMenuItem | import("@jbrowse/core/ui").CheckboxMenuItem | import("@jbrowse/core/ui").RadioMenuItem | import("@jbrowse/core/ui").SubMenuItem | {
|
|
@@ -327,6 +352,18 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
|
|
|
327
352
|
type?: undefined;
|
|
328
353
|
checked?: undefined;
|
|
329
354
|
onClick?: undefined;
|
|
355
|
+
} | {
|
|
356
|
+
label: string;
|
|
357
|
+
type: string;
|
|
358
|
+
subMenu: {
|
|
359
|
+
label: string;
|
|
360
|
+
type: string;
|
|
361
|
+
checked: boolean;
|
|
362
|
+
onClick: () => void;
|
|
363
|
+
}[];
|
|
364
|
+
icon?: undefined;
|
|
365
|
+
checked?: undefined;
|
|
366
|
+
onClick?: undefined;
|
|
330
367
|
} | {
|
|
331
368
|
label: string;
|
|
332
369
|
icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
-
import { ConfigurationReference } from '@jbrowse/core/configuration';
|
|
2
|
+
import { ConfigurationReference, getConf } from '@jbrowse/core/configuration';
|
|
3
|
+
import SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain';
|
|
3
4
|
import { getSession } from '@jbrowse/core/util';
|
|
4
5
|
import { stopStopToken } from '@jbrowse/core/util/stopToken';
|
|
5
6
|
import { linearBareDisplayStateModelFactory } from '@jbrowse/plugin-linear-genome-view';
|
|
@@ -9,11 +10,12 @@ import HeightIcon from '@mui/icons-material/Height';
|
|
|
9
10
|
import SplitscreenIcon from '@mui/icons-material/Splitscreen';
|
|
10
11
|
import VisibilityIcon from '@mui/icons-material/Visibility';
|
|
11
12
|
import deepEqual from 'fast-deep-equal';
|
|
12
|
-
import { types } from 'mobx-state-tree';
|
|
13
|
+
import { cast, types } from 'mobx-state-tree';
|
|
13
14
|
import { getSources } from './getSources';
|
|
14
15
|
const SetColorDialog = lazy(() => import('./components/SetColorDialog'));
|
|
15
16
|
const MAFFilterDialog = lazy(() => import('./components/MAFFilterDialog'));
|
|
16
|
-
const
|
|
17
|
+
const AddFiltersDialog = lazy(() => import('./components/AddFiltersDialog'));
|
|
18
|
+
const ClusterDialog = lazy(() => import('./components/MultiVariantClusterDialog/ClusterDialog'));
|
|
17
19
|
const SetRowHeightDialog = lazy(() => import('./components/SetRowHeightDialog'));
|
|
18
20
|
export default function MultiVariantBaseModelF(configSchema) {
|
|
19
21
|
return types
|
|
@@ -21,14 +23,18 @@ export default function MultiVariantBaseModelF(configSchema) {
|
|
|
21
23
|
type: types.literal('LinearVariantMatrixDisplay'),
|
|
22
24
|
layout: types.optional(types.frozen(), []),
|
|
23
25
|
configuration: ConfigurationReference(configSchema),
|
|
24
|
-
minorAlleleFrequencyFilter: types.optional(types.number, 0
|
|
26
|
+
minorAlleleFrequencyFilter: types.optional(types.number, 0),
|
|
25
27
|
showSidebarLabelsSetting: true,
|
|
26
28
|
renderingMode: types.optional(types.string, 'alleleCount'),
|
|
27
29
|
rowHeightSetting: types.optional(types.number, 8),
|
|
28
30
|
autoHeight: true,
|
|
31
|
+
lengthCutoffFilter: Number.MAX_SAFE_INTEGER,
|
|
32
|
+
jexlFilters: types.maybe(types.array(types.string)),
|
|
33
|
+
referenceDrawingMode: 'skip',
|
|
29
34
|
}))
|
|
30
35
|
.volatile(() => ({
|
|
31
36
|
sourcesLoadingStopToken: undefined,
|
|
37
|
+
simplifiedFeaturesStopToken: undefined,
|
|
32
38
|
featureUnderMouseVolatile: undefined,
|
|
33
39
|
sourcesVolatile: undefined,
|
|
34
40
|
featuresVolatile: undefined,
|
|
@@ -37,6 +43,9 @@ export default function MultiVariantBaseModelF(configSchema) {
|
|
|
37
43
|
hoveredGenotype: undefined,
|
|
38
44
|
}))
|
|
39
45
|
.actions(self => ({
|
|
46
|
+
setJexlFilters(f) {
|
|
47
|
+
self.jexlFilters = cast(f);
|
|
48
|
+
},
|
|
40
49
|
setRowHeight(arg) {
|
|
41
50
|
self.rowHeightSetting = arg;
|
|
42
51
|
},
|
|
@@ -58,6 +67,12 @@ export default function MultiVariantBaseModelF(configSchema) {
|
|
|
58
67
|
}
|
|
59
68
|
self.sourcesLoadingStopToken = str;
|
|
60
69
|
},
|
|
70
|
+
setSimplifiedFeaturesLoading(str) {
|
|
71
|
+
if (self.simplifiedFeaturesStopToken) {
|
|
72
|
+
stopStopToken(self.simplifiedFeaturesStopToken);
|
|
73
|
+
}
|
|
74
|
+
self.simplifiedFeaturesStopToken = str;
|
|
75
|
+
},
|
|
61
76
|
setSources(sources) {
|
|
62
77
|
if (!deepEqual(sources, self.sourcesVolatile)) {
|
|
63
78
|
self.sourcesVolatile = sources;
|
|
@@ -83,8 +98,15 @@ export default function MultiVariantBaseModelF(configSchema) {
|
|
|
83
98
|
self.sampleInfo = arg;
|
|
84
99
|
}
|
|
85
100
|
},
|
|
101
|
+
setReferenceDrawingMode(arg) {
|
|
102
|
+
self.referenceDrawingMode = arg;
|
|
103
|
+
},
|
|
86
104
|
}))
|
|
87
105
|
.views(self => ({
|
|
106
|
+
get activeFilters() {
|
|
107
|
+
var _a;
|
|
108
|
+
return ((_a = self.jexlFilters) !== null && _a !== void 0 ? _a : getConf(self, 'jexlFilters').map((r) => `jexl:${r}`));
|
|
109
|
+
},
|
|
88
110
|
get preSources() {
|
|
89
111
|
return self.layout.length ? self.layout : self.sourcesVolatile;
|
|
90
112
|
},
|
|
@@ -113,6 +135,11 @@ export default function MultiVariantBaseModelF(configSchema) {
|
|
|
113
135
|
.views(self => {
|
|
114
136
|
const { trackMenuItems: superTrackMenuItems, renderProps: superRenderProps, } = self;
|
|
115
137
|
return {
|
|
138
|
+
get sourceMap() {
|
|
139
|
+
return self.sources
|
|
140
|
+
? Object.fromEntries(self.sources.map(source => [source.name, source]))
|
|
141
|
+
: undefined;
|
|
142
|
+
},
|
|
116
143
|
get rowHeight() {
|
|
117
144
|
const { sources, autoHeight, rowHeightSetting, height } = self;
|
|
118
145
|
return autoHeight ? height / ((sources === null || sources === void 0 ? void 0 : sources.length) || 1) : rowHeightSetting;
|
|
@@ -190,6 +217,28 @@ export default function MultiVariantBaseModelF(configSchema) {
|
|
|
190
217
|
},
|
|
191
218
|
],
|
|
192
219
|
},
|
|
220
|
+
{
|
|
221
|
+
label: 'Reference mode',
|
|
222
|
+
type: 'subMenu',
|
|
223
|
+
subMenu: [
|
|
224
|
+
{
|
|
225
|
+
label: 'Fill background grey, skip reference allele mouseovers (helps with large overlapping SVs)',
|
|
226
|
+
type: 'radio',
|
|
227
|
+
checked: self.referenceDrawingMode === 'skip',
|
|
228
|
+
onClick: () => {
|
|
229
|
+
self.setReferenceDrawingMode('skip');
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
label: "Don't fill background grey, only draw actual reference alleles as grey",
|
|
234
|
+
type: 'radio',
|
|
235
|
+
checked: self.referenceDrawingMode === 'draw',
|
|
236
|
+
onClick: () => {
|
|
237
|
+
self.setReferenceDrawingMode('draw');
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
},
|
|
193
242
|
{
|
|
194
243
|
label: 'Filter by',
|
|
195
244
|
icon: FilterListIcon,
|
|
@@ -206,6 +255,18 @@ export default function MultiVariantBaseModelF(configSchema) {
|
|
|
206
255
|
]);
|
|
207
256
|
},
|
|
208
257
|
},
|
|
258
|
+
{
|
|
259
|
+
label: 'Edit filters',
|
|
260
|
+
onClick: () => {
|
|
261
|
+
getSession(self).queueDialog(handleClose => [
|
|
262
|
+
AddFiltersDialog,
|
|
263
|
+
{
|
|
264
|
+
model: self,
|
|
265
|
+
handleClose,
|
|
266
|
+
},
|
|
267
|
+
]);
|
|
268
|
+
},
|
|
269
|
+
},
|
|
209
270
|
],
|
|
210
271
|
},
|
|
211
272
|
{
|
|
@@ -239,7 +300,7 @@ export default function MultiVariantBaseModelF(configSchema) {
|
|
|
239
300
|
})
|
|
240
301
|
.views(self => ({
|
|
241
302
|
get canDisplayLabels() {
|
|
242
|
-
return self.rowHeight
|
|
303
|
+
return self.rowHeight >= 8 && self.showSidebarLabelsSetting;
|
|
243
304
|
},
|
|
244
305
|
get totalHeight() {
|
|
245
306
|
var _a;
|
|
@@ -259,9 +320,14 @@ export default function MultiVariantBaseModelF(configSchema) {
|
|
|
259
320
|
totalHeight: self.totalHeight,
|
|
260
321
|
renderingMode: self.renderingMode,
|
|
261
322
|
minorAlleleFrequencyFilter: self.minorAlleleFrequencyFilter,
|
|
323
|
+
lengthCutoffFilter: self.lengthCutoffFilter,
|
|
262
324
|
rowHeight: self.rowHeight,
|
|
263
325
|
sources: self.sources,
|
|
264
326
|
scrollTop: self.scrollTop,
|
|
327
|
+
referenceDrawingMode: self.referenceDrawingMode,
|
|
328
|
+
filters: new SerializableFilterChain({
|
|
329
|
+
filters: self.activeFilters,
|
|
330
|
+
}),
|
|
265
331
|
};
|
|
266
332
|
},
|
|
267
333
|
}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const AddFiltersDialog: ({ model, handleClose, }: {
|
|
2
|
+
model: {
|
|
3
|
+
jexlFilters?: string[];
|
|
4
|
+
activeFilters: string[];
|
|
5
|
+
setJexlFilters: (arg?: string[]) => void;
|
|
6
|
+
};
|
|
7
|
+
handleClose: () => void;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default AddFiltersDialog;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Dialog } from '@jbrowse/core/ui';
|
|
4
|
+
import { stringToJexlExpression } from '@jbrowse/core/util/jexlStrings';
|
|
5
|
+
import { Button, DialogActions, DialogContent, TextField } from '@mui/material';
|
|
6
|
+
import { observer } from 'mobx-react';
|
|
7
|
+
import { makeStyles } from 'tss-react/mui';
|
|
8
|
+
const useStyles = makeStyles()({
|
|
9
|
+
dialogContent: {
|
|
10
|
+
width: '80em',
|
|
11
|
+
},
|
|
12
|
+
textAreaFont: {
|
|
13
|
+
fontFamily: 'Courier New',
|
|
14
|
+
},
|
|
15
|
+
error: {
|
|
16
|
+
color: 'red',
|
|
17
|
+
fontSize: '0.8em',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
function checkJexl(code) {
|
|
21
|
+
stringToJexlExpression(code);
|
|
22
|
+
}
|
|
23
|
+
const AddFiltersDialog = observer(function ({ model, handleClose, }) {
|
|
24
|
+
const { classes } = useStyles();
|
|
25
|
+
const { activeFilters } = model;
|
|
26
|
+
const [data, setData] = useState(activeFilters.join('\n'));
|
|
27
|
+
const [error, setError] = useState();
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
try {
|
|
30
|
+
data
|
|
31
|
+
.split('\n')
|
|
32
|
+
.map(line => line.trim())
|
|
33
|
+
.filter(line => !!line)
|
|
34
|
+
.map(line => {
|
|
35
|
+
checkJexl(line.trim());
|
|
36
|
+
});
|
|
37
|
+
setError(undefined);
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
console.error(e);
|
|
41
|
+
setError(e);
|
|
42
|
+
}
|
|
43
|
+
}, [data]);
|
|
44
|
+
return (_jsxs(Dialog, { maxWidth: "xl", open: true, onClose: handleClose, title: "Add track filters", children: [_jsxs(DialogContent, { children: [_jsxs("div", { children: ["Add filters, in jexl format, one per line, starting with the string jexl:. Examples:", ' ', _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("code", { children: "jexl:get(feature,'name')=='BRCA1'" }), " - show only feature where the name attribute is BRCA1"] }), _jsxs("li", { children: [_jsx("code", { children: "jexl:get(feature,'type')=='gene'" }), " - show only gene type features in a GFF that has many other feature types"] }), _jsxs("li", { children: [_jsx("code", { children: "jexl:get(feature,'score') > 400" }), " - show only features that have a score greater than 400"] }), _jsxs("li", { children: [_jsx("code", { children: "jexl:get(feature,'end') - get(feature,'start') < 1000000" }), ' ', "- show only features with length less than 1Mbp"] })] })] }), error ? _jsx("p", { className: classes.error, children: `${error}` }) : null, _jsx(TextField, { variant: "outlined", multiline: true, minRows: 5, maxRows: 10, className: classes.dialogContent, fullWidth: true, value: data, onChange: event => {
|
|
45
|
+
setData(event.target.value);
|
|
46
|
+
}, slotProps: {
|
|
47
|
+
input: {
|
|
48
|
+
classes: {
|
|
49
|
+
input: classes.textAreaFont,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
} })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", color: "primary", type: "submit", autoFocus: true, disabled: !!error, onClick: () => {
|
|
53
|
+
model.setJexlFilters(data.split('\n'));
|
|
54
|
+
handleClose();
|
|
55
|
+
}, children: "Submit" }), _jsx(Button, { variant: "contained", color: "secondary", onClick: () => {
|
|
56
|
+
handleClose();
|
|
57
|
+
}, children: "Cancel" })] })] }));
|
|
58
|
+
});
|
|
59
|
+
export default AddFiltersDialog;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
|
+
import { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
|
|
4
|
+
import { observer } from 'mobx-react';
|
|
5
|
+
import Crosshair from './MultiVariantCrosshairs';
|
|
6
|
+
import LegendBar from './MultiVariantLegendBar';
|
|
7
|
+
const MultiVariantBaseDisplayComponent = observer(function (props) {
|
|
8
|
+
const { model } = props;
|
|
9
|
+
const ref = useRef(null);
|
|
10
|
+
const [mouseY, setMouseY] = useState();
|
|
11
|
+
const [mouseX, setMouseX] = useState();
|
|
12
|
+
return (_jsxs("div", { ref: ref, onMouseMove: event => {
|
|
13
|
+
var _a;
|
|
14
|
+
const rect = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
15
|
+
const top = (rect === null || rect === void 0 ? void 0 : rect.top) || 0;
|
|
16
|
+
const left = (rect === null || rect === void 0 ? void 0 : rect.left) || 0;
|
|
17
|
+
setMouseY(event.clientY - top);
|
|
18
|
+
setMouseX(event.clientX - left);
|
|
19
|
+
}, onMouseLeave: () => {
|
|
20
|
+
setMouseY(undefined);
|
|
21
|
+
setMouseX(undefined);
|
|
22
|
+
}, children: [_jsx(BaseLinearDisplayComponent, { ...props }), _jsx(LegendBar, { model: model }), mouseX && mouseY ? (_jsx(Crosshair, { mouseX: mouseX, mouseY: mouseY, model: model })) : null] }));
|
|
23
|
+
});
|
|
24
|
+
export default MultiVariantBaseDisplayComponent;
|
|
@@ -7,8 +7,8 @@ import ClusterDialogAuto from './ClusterDialogAuto';
|
|
|
7
7
|
import ClusterDialogManual from './ClusterDialogManual';
|
|
8
8
|
function Header({ activeMode, setActiveMode, }) {
|
|
9
9
|
return (_jsxs("div", { children: [_jsx(Typography, { style: { marginBottom: 30 }, children: "This procedure will cluster the visible genotype data using hierarchical clustering" }), _jsx(RadioGroup, { children: Object.entries({
|
|
10
|
-
auto: (_jsx("div", { children: "Run in-app clustering (
|
|
11
|
-
manual: (_jsx("div", { children: "Download R script to run clustering (faster
|
|
10
|
+
auto: (_jsx("div", { children: "Run in-app clustering (slower, particularly for large numbers of samples, uses JS implementation of hclust)" })),
|
|
11
|
+
manual: (_jsx("div", { children: "Download R script to run clustering (faster, uses R implementation of hclust)" })),
|
|
12
12
|
}).map(([key, val]) => (_jsx(FormControlLabel, { control: _jsx(Radio, { checked: activeMode === key, onChange: () => {
|
|
13
13
|
setActiveMode(key);
|
|
14
14
|
} }), label: val }, key))) })] }));
|
package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogAuto.js
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { ErrorMessage } from '@jbrowse/core/ui';
|
|
4
4
|
import { getContainingView, getSession, isAbortException, } from '@jbrowse/core/util';
|
|
@@ -9,19 +9,22 @@ import { observer } from 'mobx-react';
|
|
|
9
9
|
import { isAlive } from 'mobx-state-tree';
|
|
10
10
|
const ClusterDialogAuto = observer(function ({ model, children, handleClose, }) {
|
|
11
11
|
const [progress, setProgress] = useState('');
|
|
12
|
+
const [loading, setLoading] = useState(false);
|
|
12
13
|
const [error, setError] = useState();
|
|
13
14
|
const [stopToken, setStopToken] = useState('');
|
|
14
|
-
return (_jsxs(_Fragment, { children: [_jsxs(DialogContent, { children: [children, _jsxs("div", { children: [
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DialogContent, { children: [children, _jsxs("div", { children: [loading ? (_jsxs("div", { style: { padding: 50 }, children: [_jsx("span", { children: progress || 'Loading...' }), _jsx(Button, { onClick: () => {
|
|
15
16
|
stopStopToken(stopToken);
|
|
16
|
-
}, children: "Stop" })] })) : null, error ? _jsx(ErrorMessage, { error: error }) : null] })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", onClick: async () => {
|
|
17
|
+
}, children: "Stop" })] })) : null, error ? _jsx(ErrorMessage, { error: error }) : null] })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", disabled: loading, onClick: async () => {
|
|
17
18
|
try {
|
|
18
19
|
setError(undefined);
|
|
20
|
+
setProgress('Initializing');
|
|
21
|
+
setLoading(true);
|
|
19
22
|
const view = getContainingView(model);
|
|
20
23
|
if (!view.initialized) {
|
|
21
24
|
return;
|
|
22
25
|
}
|
|
23
26
|
const { rpcManager } = getSession(model);
|
|
24
|
-
const { sourcesWithoutLayout, minorAlleleFrequencyFilter, adapterConfig, } = model;
|
|
27
|
+
const { sourcesWithoutLayout, minorAlleleFrequencyFilter, lengthCutoffFilter, adapterConfig, } = model;
|
|
25
28
|
if (sourcesWithoutLayout) {
|
|
26
29
|
const sessionId = getRpcSessionId(model);
|
|
27
30
|
const stopToken = createStopToken();
|
|
@@ -30,6 +33,7 @@ const ClusterDialogAuto = observer(function ({ model, children, handleClose, })
|
|
|
30
33
|
regions: view.dynamicBlocks.contentBlocks,
|
|
31
34
|
sources: sourcesWithoutLayout,
|
|
32
35
|
minorAlleleFrequencyFilter,
|
|
36
|
+
lengthCutoffFilter,
|
|
33
37
|
sessionId,
|
|
34
38
|
adapterConfig,
|
|
35
39
|
stopToken,
|
|
@@ -54,6 +58,7 @@ const ClusterDialogAuto = observer(function ({ model, children, handleClose, })
|
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
finally {
|
|
61
|
+
setLoading(false);
|
|
57
62
|
setProgress('');
|
|
58
63
|
setStopToken('');
|
|
59
64
|
}
|
package/esm/shared/components/{ClusterDialog → MultiVariantClusterDialog}/ClusterDialogManual.js
RENAMED
|
@@ -25,8 +25,8 @@ const ClusterDialogManuals = observer(function ({ model, handleClose, children,
|
|
|
25
25
|
const [ret, setRet] = useState();
|
|
26
26
|
const [error, setError] = useState();
|
|
27
27
|
const [loading, setLoading] = useState(false);
|
|
28
|
-
const [showAdvanced, setShowAdvanced] =
|
|
29
|
-
const [clusterMethod, setClusterMethod] =
|
|
28
|
+
const [showAdvanced, setShowAdvanced] = useLocalStorage('cluster-showAdvanced', false);
|
|
29
|
+
const [clusterMethod, setClusterMethod] = useState('single');
|
|
30
30
|
useEffect(() => {
|
|
31
31
|
;
|
|
32
32
|
(async () => {
|
|
@@ -39,12 +39,13 @@ const ClusterDialogManuals = observer(function ({ model, handleClose, children,
|
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
const { rpcManager } = getSession(model);
|
|
42
|
-
const { sourcesWithoutLayout, minorAlleleFrequencyFilter, adapterConfig, } = model;
|
|
42
|
+
const { sourcesWithoutLayout, minorAlleleFrequencyFilter, lengthCutoffFilter, adapterConfig, } = model;
|
|
43
43
|
const sessionId = getRpcSessionId(model);
|
|
44
44
|
const ret = (await rpcManager.call(sessionId, 'MultiVariantGetGenotypeMatrix', {
|
|
45
45
|
regions: view.dynamicBlocks.contentBlocks,
|
|
46
46
|
sources: sourcesWithoutLayout,
|
|
47
47
|
minorAlleleFrequencyFilter,
|
|
48
|
+
lengthCutoffFilter,
|
|
48
49
|
sessionId,
|
|
49
50
|
adapterConfig,
|
|
50
51
|
}));
|
|
@@ -77,31 +78,31 @@ cat(resultClusters$order,sep='\\n')`
|
|
|
77
78
|
.map(([key, val]) => [key, ...val].join('\t'))
|
|
78
79
|
.join('\n')
|
|
79
80
|
: undefined;
|
|
80
|
-
return (_jsxs(_Fragment, { children: [_jsxs(DialogContent, { children: [children, _jsxs(Paper, { style: { padding: 16 }, children: [_jsxs("div", { style: {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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 => {
|
|
105
106
|
setPaste(event.target.value);
|
|
106
107
|
}, slotProps: {
|
|
107
108
|
input: {
|
|
@@ -3,6 +3,7 @@ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
|
3
3
|
export interface ReducedModel {
|
|
4
4
|
sourcesWithoutLayout?: Source[];
|
|
5
5
|
minorAlleleFrequencyFilter?: number;
|
|
6
|
+
lengthCutoffFilter: number;
|
|
6
7
|
adapterConfig: AnyConfigurationModel;
|
|
7
8
|
setLayout: (arg: Source[]) => void;
|
|
8
9
|
clearLayout: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|