@jbrowse/plugin-variants 2.18.0 → 3.0.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/ChordVariantDisplay/models/stateModelFactory.d.ts +1 -1
- package/dist/LinearVariantDisplay/model.d.ts +5 -5
- package/dist/MultiLinearVariantDisplay/components/Crosshair.d.ts +7 -0
- package/dist/MultiLinearVariantDisplay/components/Crosshair.js +35 -0
- package/dist/MultiLinearVariantDisplay/components/VariantDisplayComponent.d.ts +1 -2
- package/dist/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +5 -49
- package/dist/MultiLinearVariantDisplay/index.js +18 -8
- package/dist/MultiLinearVariantDisplay/model.d.ts +113 -40
- package/dist/MultiLinearVariantDisplay/model.js +24 -176
- package/dist/MultiLinearVariantDisplay/renderSvg.d.ts +1 -2
- package/dist/MultiLinearVariantDisplay/renderSvg.js +2 -5
- package/dist/MultiLinearVariantMatrixDisplay/components/Crosshair.d.ts +7 -0
- package/dist/MultiLinearVariantMatrixDisplay/components/Crosshair.js +28 -0
- package/dist/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.d.ts +1 -2
- package/dist/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +13 -16
- package/dist/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.d.ts +1 -2
- package/dist/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +6 -56
- package/dist/MultiLinearVariantMatrixDisplay/model.d.ts +109 -27
- package/dist/MultiLinearVariantMatrixDisplay/model.js +31 -136
- package/dist/MultiLinearVariantMatrixDisplay/renderSvg.d.ts +1 -2
- package/dist/MultiLinearVariantMatrixDisplay/renderSvg.js +3 -7
- package/dist/MultiLinearVariantMatrixRenderer/LinearVariantMatrixRenderer.d.ts +4 -32
- package/dist/MultiLinearVariantMatrixRenderer/LinearVariantMatrixRenderer.js +44 -63
- package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +3 -2
- package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +31 -5
- package/dist/MultiLinearVariantMatrixRenderer/index.js +2 -2
- package/dist/MultiLinearVariantMatrixRenderer/makeImageData.d.ts +10 -0
- package/dist/MultiLinearVariantMatrixRenderer/makeImageData.js +100 -0
- package/dist/MultiLinearVariantMatrixRenderer/types.d.ts +15 -0
- package/dist/MultiLinearVariantMatrixRenderer/types.js +2 -0
- package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +4 -21
- package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.js +38 -25
- package/dist/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +7 -3
- package/dist/MultiLinearVariantRenderer/MultiVariantRendering.js +36 -27
- package/dist/MultiLinearVariantRenderer/configSchema.d.ts +1 -33
- package/dist/MultiLinearVariantRenderer/configSchema.js +0 -5
- package/dist/MultiLinearVariantRenderer/makeImageData.d.ts +4 -0
- package/dist/MultiLinearVariantRenderer/makeImageData.js +67 -0
- package/dist/MultiLinearVariantRenderer/types.d.ts +19 -0
- package/dist/MultiLinearVariantRenderer/types.js +2 -0
- package/dist/MultiVariantBaseRenderer.d.ts +4 -4
- package/dist/StructuralVariantChordRenderer/Chord.d.ts +2 -19
- package/dist/StructuralVariantChordRenderer/Chord.js +3 -25
- package/dist/StructuralVariantChordRenderer/ReactComponent.d.ts +2 -3
- package/dist/StructuralVariantChordRenderer/ReactComponent.js +7 -29
- package/dist/StructuralVariantChordRenderer/types.d.ts +17 -0
- package/dist/StructuralVariantChordRenderer/types.js +2 -0
- package/dist/Tooltip.d.ts +2 -2
- package/dist/Tooltip.js +6 -32
- package/dist/VariantFeatureWidget/Checkbox2.d.ts +1 -2
- package/dist/VariantFeatureWidget/Checkbox2.js +2 -5
- package/dist/VariantFeatureWidget/LaunchBreakendPanel.d.ts +2 -3
- package/dist/VariantFeatureWidget/LaunchBreakendPanel.js +66 -69
- package/dist/VariantFeatureWidget/LaunchBreakendWidgetArea.d.ts +4 -0
- package/dist/VariantFeatureWidget/LaunchBreakendWidgetArea.js +60 -0
- package/dist/VariantFeatureWidget/VariantConsequenceDataGrid.d.ts +5 -0
- package/dist/VariantFeatureWidget/VariantConsequenceDataGrid.js +15 -0
- package/dist/VariantFeatureWidget/VariantConsequenceDataGridWrapper.d.ts +5 -0
- package/dist/VariantFeatureWidget/VariantConsequenceDataGridWrapper.js +20 -0
- package/dist/VariantFeatureWidget/VariantConsequencePanel.d.ts +5 -0
- package/dist/VariantFeatureWidget/VariantConsequencePanel.js +15 -0
- package/dist/VariantFeatureWidget/VariantFeatureWidget.d.ts +1 -2
- package/dist/VariantFeatureWidget/VariantFeatureWidget.js +47 -36
- package/dist/VariantFeatureWidget/VariantSampleFilters.d.ts +9 -0
- package/dist/VariantFeatureWidget/VariantSampleFilters.js +10 -0
- package/dist/VariantFeatureWidget/VariantSampleGrid.d.ts +9 -7
- package/dist/VariantFeatureWidget/VariantSampleGrid.js +14 -44
- package/dist/VariantFeatureWidget/index.js +17 -7
- package/dist/VariantFeatureWidget/types.d.ts +16 -0
- package/dist/VariantFeatureWidget/types.js +2 -0
- package/dist/VariantRPC/MultiVariantGetGenotypeMatrix.js +10 -27
- package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +12 -7
- package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.js +27 -37
- package/dist/VcfAdapter/VcfAdapter.d.ts +7 -0
- package/dist/VcfAdapter/VcfAdapter.js +29 -3
- package/dist/VcfAdapter/configSchema.d.ts +8 -0
- package/dist/VcfAdapter/configSchema.js +12 -1
- package/dist/VcfAdapter/index.js +17 -7
- package/dist/VcfFeature/index.js +2 -1
- package/dist/VcfFeature/util.js +3 -4
- package/dist/VcfTabixAdapter/VcfTabixAdapter.js +38 -12
- package/dist/VcfTabixAdapter/configSchema.d.ts +8 -0
- package/dist/VcfTabixAdapter/configSchema.js +8 -0
- package/dist/VcfTabixAdapter/index.js +17 -7
- package/dist/extensionPoints.js +21 -33
- package/dist/getMultiVariantFeaturesAutorun.d.ts +4 -7
- package/dist/getMultiVariantFeaturesAutorun.js +16 -15
- package/dist/getMultiVariantSourcesAutorun.d.ts +1 -6
- package/dist/shared/BulkEditPanel.d.ts +4 -5
- package/dist/shared/BulkEditPanel.js +69 -88
- package/dist/shared/ClusterDialog.d.ts +4 -5
- package/dist/shared/ClusterDialog.js +45 -86
- package/dist/shared/ColorLegend.d.ts +2 -3
- package/dist/shared/ColorLegend.js +8 -10
- package/dist/shared/HelpfulTips.d.ts +1 -0
- package/dist/shared/HelpfulTips.js +7 -0
- package/dist/shared/LegendBar.d.ts +3 -3
- package/dist/shared/LegendBar.js +6 -12
- package/dist/shared/MAFFilterDialog.d.ts +2 -3
- package/dist/shared/MAFFilterDialog.js +14 -42
- package/dist/shared/MultiVariantBaseModel.d.ts +341 -0
- package/dist/shared/MultiVariantBaseModel.js +316 -0
- package/dist/shared/MultiVariantTooltip.d.ts +6 -0
- package/dist/shared/MultiVariantTooltip.js +23 -0
- package/dist/shared/RectBg.d.ts +2 -3
- package/dist/shared/RectBg.js +3 -7
- package/dist/shared/RowPalettizer.d.ts +2 -3
- package/dist/shared/RowPalettizer.js +30 -28
- package/dist/shared/SetColorDialog.d.ts +2 -3
- package/dist/shared/SetColorDialog.js +26 -65
- package/dist/shared/SetMinMaxDialog.d.ts +1 -2
- package/dist/shared/SetMinMaxDialog.js +11 -41
- package/dist/shared/SetRowHeightDialog.d.ts +8 -0
- package/dist/shared/SetRowHeightDialog.js +18 -0
- package/dist/shared/SharedVariantMixin.d.ts +7 -7
- package/dist/shared/SourcesDataGrid.d.ts +6 -0
- package/dist/shared/SourcesDataGrid.js +68 -0
- package/dist/shared/SourcesGrid.d.ts +2 -3
- package/dist/shared/SourcesGrid.js +5 -134
- package/dist/shared/SourcesGridHeader.d.ts +7 -0
- package/dist/shared/SourcesGridHeader.js +41 -0
- package/dist/shared/multiVariantColor.d.ts +3 -0
- package/dist/shared/multiVariantColor.js +50 -0
- package/dist/types.d.ts +14 -0
- package/dist/types.js +2 -0
- package/dist/util.d.ts +6 -9
- package/dist/util.js +47 -14
- package/esm/ChordVariantDisplay/models/stateModelFactory.d.ts +1 -1
- package/esm/LinearVariantDisplay/model.d.ts +5 -5
- package/esm/MultiLinearVariantDisplay/components/Crosshair.d.ts +7 -0
- package/esm/MultiLinearVariantDisplay/components/Crosshair.js +30 -0
- package/esm/MultiLinearVariantDisplay/components/VariantDisplayComponent.d.ts +1 -2
- package/esm/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +5 -26
- package/esm/MultiLinearVariantDisplay/index.js +1 -1
- package/esm/MultiLinearVariantDisplay/model.d.ts +113 -40
- package/esm/MultiLinearVariantDisplay/model.js +7 -169
- package/esm/MultiLinearVariantDisplay/renderSvg.d.ts +1 -2
- package/esm/MultiLinearVariantDisplay/renderSvg.js +2 -5
- package/esm/MultiLinearVariantMatrixDisplay/components/Crosshair.d.ts +7 -0
- package/esm/MultiLinearVariantMatrixDisplay/components/Crosshair.js +23 -0
- package/esm/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.d.ts +1 -2
- package/esm/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +13 -13
- package/esm/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.d.ts +1 -2
- package/esm/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +6 -33
- package/esm/MultiLinearVariantMatrixDisplay/model.d.ts +109 -27
- package/esm/MultiLinearVariantMatrixDisplay/model.js +14 -129
- package/esm/MultiLinearVariantMatrixDisplay/renderSvg.d.ts +1 -2
- package/esm/MultiLinearVariantMatrixDisplay/renderSvg.js +3 -7
- package/esm/MultiLinearVariantMatrixRenderer/LinearVariantMatrixRenderer.d.ts +4 -32
- package/esm/MultiLinearVariantMatrixRenderer/LinearVariantMatrixRenderer.js +11 -63
- package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +3 -2
- package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +31 -2
- package/esm/MultiLinearVariantMatrixRenderer/index.js +1 -1
- package/esm/MultiLinearVariantMatrixRenderer/makeImageData.d.ts +10 -0
- package/esm/MultiLinearVariantMatrixRenderer/makeImageData.js +97 -0
- package/esm/MultiLinearVariantMatrixRenderer/types.d.ts +15 -0
- package/esm/MultiLinearVariantMatrixRenderer/types.js +1 -0
- package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +4 -21
- package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.js +6 -26
- package/esm/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +7 -3
- package/esm/MultiLinearVariantRenderer/MultiVariantRendering.js +34 -5
- package/esm/MultiLinearVariantRenderer/configSchema.d.ts +1 -33
- package/esm/MultiLinearVariantRenderer/configSchema.js +0 -2
- package/esm/MultiLinearVariantRenderer/makeImageData.d.ts +4 -0
- package/esm/MultiLinearVariantRenderer/makeImageData.js +61 -0
- package/esm/MultiLinearVariantRenderer/types.d.ts +19 -0
- package/esm/MultiLinearVariantRenderer/types.js +1 -0
- package/esm/MultiVariantBaseRenderer.d.ts +4 -4
- package/esm/StructuralVariantChordRenderer/Chord.d.ts +2 -19
- package/esm/StructuralVariantChordRenderer/Chord.js +3 -2
- package/esm/StructuralVariantChordRenderer/ReactComponent.d.ts +2 -3
- package/esm/StructuralVariantChordRenderer/ReactComponent.js +7 -6
- package/esm/StructuralVariantChordRenderer/types.d.ts +17 -0
- package/esm/StructuralVariantChordRenderer/types.js +1 -0
- package/esm/Tooltip.d.ts +2 -2
- package/esm/Tooltip.js +6 -9
- package/esm/VariantFeatureWidget/Checkbox2.d.ts +1 -2
- package/esm/VariantFeatureWidget/Checkbox2.js +2 -2
- package/esm/VariantFeatureWidget/LaunchBreakendPanel.d.ts +2 -3
- package/esm/VariantFeatureWidget/LaunchBreakendPanel.js +48 -61
- package/esm/VariantFeatureWidget/LaunchBreakendWidgetArea.d.ts +4 -0
- package/esm/VariantFeatureWidget/LaunchBreakendWidgetArea.js +24 -0
- package/esm/VariantFeatureWidget/VariantConsequenceDataGrid.d.ts +5 -0
- package/esm/VariantFeatureWidget/VariantConsequenceDataGrid.js +9 -0
- package/esm/VariantFeatureWidget/VariantConsequenceDataGridWrapper.d.ts +5 -0
- package/esm/VariantFeatureWidget/VariantConsequenceDataGridWrapper.js +17 -0
- package/esm/VariantFeatureWidget/VariantConsequencePanel.d.ts +5 -0
- package/esm/VariantFeatureWidget/VariantConsequencePanel.js +9 -0
- package/esm/VariantFeatureWidget/VariantFeatureWidget.d.ts +1 -2
- package/esm/VariantFeatureWidget/VariantFeatureWidget.js +30 -29
- package/esm/VariantFeatureWidget/VariantSampleFilters.d.ts +9 -0
- package/esm/VariantFeatureWidget/VariantSampleFilters.js +7 -0
- package/esm/VariantFeatureWidget/VariantSampleGrid.d.ts +9 -7
- package/esm/VariantFeatureWidget/VariantSampleGrid.js +15 -22
- package/esm/VariantFeatureWidget/types.d.ts +16 -0
- package/esm/VariantFeatureWidget/types.js +1 -0
- package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.js +10 -27
- package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +12 -7
- package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.js +27 -37
- package/esm/VcfAdapter/VcfAdapter.d.ts +7 -0
- package/esm/VcfAdapter/VcfAdapter.js +31 -5
- package/esm/VcfAdapter/configSchema.d.ts +8 -0
- package/esm/VcfAdapter/configSchema.js +12 -1
- package/esm/VcfFeature/index.js +2 -1
- package/esm/VcfFeature/util.js +3 -4
- package/esm/VcfTabixAdapter/VcfTabixAdapter.js +38 -12
- package/esm/VcfTabixAdapter/configSchema.d.ts +8 -0
- package/esm/VcfTabixAdapter/configSchema.js +8 -0
- package/esm/extensionPoints.js +21 -33
- package/esm/getMultiVariantFeaturesAutorun.d.ts +4 -7
- package/esm/getMultiVariantFeaturesAutorun.js +16 -15
- package/esm/getMultiVariantSourcesAutorun.d.ts +1 -6
- package/esm/shared/BulkEditPanel.d.ts +4 -5
- package/esm/shared/BulkEditPanel.js +70 -66
- package/esm/shared/ClusterDialog.d.ts +4 -5
- package/esm/shared/ClusterDialog.js +44 -62
- package/esm/shared/ColorLegend.d.ts +2 -3
- package/esm/shared/ColorLegend.js +8 -10
- package/esm/shared/HelpfulTips.d.ts +1 -0
- package/esm/shared/HelpfulTips.js +4 -0
- package/esm/shared/LegendBar.d.ts +3 -3
- package/esm/shared/LegendBar.js +7 -13
- package/esm/shared/MAFFilterDialog.d.ts +2 -3
- package/esm/shared/MAFFilterDialog.js +14 -19
- package/esm/shared/MultiVariantBaseModel.d.ts +341 -0
- package/esm/shared/MultiVariantBaseModel.js +277 -0
- package/esm/shared/MultiVariantTooltip.d.ts +6 -0
- package/esm/shared/MultiVariantTooltip.js +17 -0
- package/esm/shared/RectBg.d.ts +2 -3
- package/esm/shared/RectBg.js +3 -4
- package/esm/shared/RowPalettizer.d.ts +2 -3
- package/esm/shared/RowPalettizer.js +30 -25
- package/esm/shared/SetColorDialog.d.ts +2 -3
- package/esm/shared/SetColorDialog.js +26 -42
- package/esm/shared/SetMinMaxDialog.d.ts +1 -2
- package/esm/shared/SetMinMaxDialog.js +11 -18
- package/esm/shared/SetRowHeightDialog.d.ts +8 -0
- package/esm/shared/SetRowHeightDialog.js +15 -0
- package/esm/shared/SharedVariantMixin.d.ts +7 -7
- package/esm/shared/SourcesDataGrid.d.ts +6 -0
- package/esm/shared/SourcesDataGrid.js +62 -0
- package/esm/shared/SourcesGrid.d.ts +2 -3
- package/esm/shared/SourcesGrid.js +5 -111
- package/esm/shared/SourcesGridHeader.d.ts +7 -0
- package/esm/shared/SourcesGridHeader.js +35 -0
- package/esm/shared/multiVariantColor.d.ts +3 -0
- package/esm/shared/multiVariantColor.js +45 -0
- package/esm/types.d.ts +14 -0
- package/esm/types.js +1 -0
- package/esm/util.d.ts +6 -9
- package/esm/util.js +43 -13
- package/package.json +6 -7
- package/dist/VariantFeatureWidget/AnnotGrid.d.ts +0 -6
- package/dist/VariantFeatureWidget/AnnotGrid.js +0 -39
- package/dist/VariantFeatureWidget/VariantAnnotationTable.d.ts +0 -6
- package/dist/VariantFeatureWidget/VariantAnnotationTable.js +0 -16
- package/dist/configSchema.d.ts +0 -34
- package/dist/configSchema.js +0 -44
- package/dist/shared/DraggableDialog.d.ts +0 -6
- package/dist/shared/DraggableDialog.js +0 -62
- package/dist/shared/Tooltip.d.ts +0 -18
- package/dist/shared/Tooltip.js +0 -38
- package/esm/VariantFeatureWidget/AnnotGrid.d.ts +0 -6
- package/esm/VariantFeatureWidget/AnnotGrid.js +0 -13
- package/esm/VariantFeatureWidget/VariantAnnotationTable.d.ts +0 -6
- package/esm/VariantFeatureWidget/VariantAnnotationTable.js +0 -10
- package/esm/configSchema.d.ts +0 -34
- package/esm/configSchema.js +0 -42
- package/esm/shared/DraggableDialog.d.ts +0 -6
- package/esm/shared/DraggableDialog.js +0 -34
- package/esm/shared/Tooltip.d.ts +0 -18
- package/esm/shared/Tooltip.js +0 -33
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import IntervalTree from '@flatten-js/interval-tree';
|
|
2
|
+
import VcfParser from '@gmod/vcf';
|
|
2
3
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
4
|
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
5
|
import type { Feature, Region } from '@jbrowse/core/util';
|
|
@@ -7,6 +8,7 @@ export default class VcfAdapter extends BaseFeatureDataAdapter {
|
|
|
7
8
|
calculatedIntervalTreeMap: Record<string, IntervalTree>;
|
|
8
9
|
vcfFeatures?: Promise<{
|
|
9
10
|
header: string;
|
|
11
|
+
parser: VcfParser;
|
|
10
12
|
intervalTreeMap: Record<string, (sc?: StatusCallback) => IntervalTree>;
|
|
11
13
|
}>;
|
|
12
14
|
static capabilities: string[];
|
|
@@ -14,16 +16,21 @@ export default class VcfAdapter extends BaseFeatureDataAdapter {
|
|
|
14
16
|
getMetadata(): Promise<any>;
|
|
15
17
|
setupP(opts?: BaseOptions): Promise<{
|
|
16
18
|
header: string;
|
|
19
|
+
parser: VcfParser;
|
|
17
20
|
intervalTreeMap: {
|
|
18
21
|
[k: string]: (sc?: (arg: string) => void) => IntervalTree<any>;
|
|
19
22
|
};
|
|
20
23
|
}>;
|
|
21
24
|
setup(): Promise<{
|
|
22
25
|
header: string;
|
|
26
|
+
parser: VcfParser;
|
|
23
27
|
intervalTreeMap: Record<string, (sc?: StatusCallback) => IntervalTree>;
|
|
24
28
|
}>;
|
|
25
29
|
getRefNames(_?: BaseOptions): Promise<string[]>;
|
|
26
30
|
getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
31
|
+
getSources(): Promise<{
|
|
32
|
+
name: string;
|
|
33
|
+
}[]>;
|
|
27
34
|
freeResources(): void;
|
|
28
35
|
}
|
|
29
36
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import IntervalTree from '@flatten-js/interval-tree';
|
|
2
|
-
import
|
|
2
|
+
import VcfParser from '@gmod/vcf';
|
|
3
3
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
4
|
import { fetchAndMaybeUnzip } from '@jbrowse/core/util';
|
|
5
5
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
@@ -15,8 +15,7 @@ class VcfAdapter extends BaseFeatureDataAdapter {
|
|
|
15
15
|
return header;
|
|
16
16
|
}
|
|
17
17
|
async getMetadata() {
|
|
18
|
-
const {
|
|
19
|
-
const parser = new VCF({ header });
|
|
18
|
+
const { parser } = await this.setup();
|
|
20
19
|
return parser.getMetadata();
|
|
21
20
|
}
|
|
22
21
|
async setupP(opts) {
|
|
@@ -29,7 +28,7 @@ class VcfAdapter extends BaseFeatureDataAdapter {
|
|
|
29
28
|
const decoder = new TextDecoder('utf8');
|
|
30
29
|
let i = 0;
|
|
31
30
|
while (blockStart < buffer.length) {
|
|
32
|
-
const n = buffer.indexOf(
|
|
31
|
+
const n = buffer.indexOf(10, blockStart);
|
|
33
32
|
const b = n === -1 ? buffer.subarray(blockStart) : buffer.subarray(blockStart, n);
|
|
34
33
|
const line = decoder.decode(b).trim();
|
|
35
34
|
if (line) {
|
|
@@ -51,7 +50,7 @@ class VcfAdapter extends BaseFeatureDataAdapter {
|
|
|
51
50
|
blockStart = n + 1;
|
|
52
51
|
}
|
|
53
52
|
const header = headerLines.join('\n');
|
|
54
|
-
const parser = new
|
|
53
|
+
const parser = new VcfParser({ header });
|
|
55
54
|
const intervalTreeMap = Object.fromEntries(Object.entries(featureMap).map(([refName, lines]) => [
|
|
56
55
|
refName,
|
|
57
56
|
(sc) => {
|
|
@@ -74,6 +73,7 @@ class VcfAdapter extends BaseFeatureDataAdapter {
|
|
|
74
73
|
]));
|
|
75
74
|
return {
|
|
76
75
|
header,
|
|
76
|
+
parser,
|
|
77
77
|
intervalTreeMap,
|
|
78
78
|
};
|
|
79
79
|
}
|
|
@@ -106,6 +106,32 @@ class VcfAdapter extends BaseFeatureDataAdapter {
|
|
|
106
106
|
}
|
|
107
107
|
}, opts.stopToken);
|
|
108
108
|
}
|
|
109
|
+
async getSources() {
|
|
110
|
+
const conf = this.getConf('samplesTsvLocation');
|
|
111
|
+
if (conf.uri === '' || conf.uri === '/path/to/samples.tsv') {
|
|
112
|
+
const { parser } = await this.setup();
|
|
113
|
+
return parser.samples.map(name => ({
|
|
114
|
+
name,
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
const txt = await openLocation(conf).readFile('utf8');
|
|
119
|
+
const lines = txt.split(/\n|\r\n|\r/);
|
|
120
|
+
const header = lines[0].split('\t');
|
|
121
|
+
const { parser } = await this.setup();
|
|
122
|
+
const s = new Set(parser.samples);
|
|
123
|
+
return lines
|
|
124
|
+
.slice(1)
|
|
125
|
+
.map(line => {
|
|
126
|
+
const cols = line.split('\t');
|
|
127
|
+
return {
|
|
128
|
+
name: cols[0],
|
|
129
|
+
...Object.fromEntries(cols.slice(1).map((c, idx) => [header[idx + 1], c])),
|
|
130
|
+
};
|
|
131
|
+
})
|
|
132
|
+
.filter(f => s.has(f.name));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
109
135
|
freeResources() { }
|
|
110
136
|
}
|
|
111
137
|
VcfAdapter.capabilities = ['getFeatures', 'getRefNames'];
|
|
@@ -6,5 +6,13 @@ declare const VcfAdapter: import("@jbrowse/core/configuration/configurationSchem
|
|
|
6
6
|
locationType: string;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
+
samplesTsvLocation: {
|
|
10
|
+
type: string;
|
|
11
|
+
defaultValue: {
|
|
12
|
+
uri: string;
|
|
13
|
+
description: string;
|
|
14
|
+
locationType: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
9
17
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
10
18
|
export default VcfAdapter;
|
|
@@ -3,7 +3,18 @@ function x() { }
|
|
|
3
3
|
const VcfAdapter = ConfigurationSchema('VcfAdapter', {
|
|
4
4
|
vcfLocation: {
|
|
5
5
|
type: 'fileLocation',
|
|
6
|
-
defaultValue: {
|
|
6
|
+
defaultValue: {
|
|
7
|
+
uri: '/path/to/my.vcf',
|
|
8
|
+
locationType: 'UriLocation',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
samplesTsvLocation: {
|
|
12
|
+
type: 'fileLocation',
|
|
13
|
+
defaultValue: {
|
|
14
|
+
uri: '/path/to/samples.tsv',
|
|
15
|
+
description: 'tsv with header like name\tpopulation\tetc. where the first column is required, and is the sample names',
|
|
16
|
+
locationType: 'UriLocation',
|
|
17
|
+
},
|
|
7
18
|
},
|
|
8
19
|
}, { explicitlyTyped: true });
|
|
9
20
|
export default VcfAdapter;
|
package/esm/VcfFeature/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSOTermAndDescription } from './util';
|
|
2
2
|
function dataFromVariant(variant, parser) {
|
|
3
|
-
const { REF = '', ALT, POS, CHROM, ID } = variant;
|
|
3
|
+
const { FORMAT, REF = '', ALT, POS, CHROM, ID } = variant;
|
|
4
4
|
const start = POS - 1;
|
|
5
5
|
const [type, description] = getSOTermAndDescription(REF, ALT, parser);
|
|
6
6
|
return {
|
|
@@ -11,6 +11,7 @@ function dataFromVariant(variant, parser) {
|
|
|
11
11
|
type,
|
|
12
12
|
name: ID === null || ID === void 0 ? void 0 : ID.join(','),
|
|
13
13
|
aliases: ID && ID.length > 1 ? ID.slice(1) : undefined,
|
|
14
|
+
format: FORMAT,
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
function getEnd(variant) {
|
package/esm/VcfFeature/util.js
CHANGED
|
@@ -46,10 +46,9 @@ export function getSOTermAndDescription(ref, alt, parser) {
|
|
|
46
46
|
return suffixes.length ? `${prefix} -> ${suffixes.join(',')}` : prefix;
|
|
47
47
|
}));
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return [];
|
|
49
|
+
return soTerms.size
|
|
50
|
+
? [[...soTerms].join(','), [...descriptions].join(',')]
|
|
51
|
+
: [];
|
|
53
52
|
}
|
|
54
53
|
export function getSOAndDescFromAltDefs(alt, parser) {
|
|
55
54
|
if (typeof alt === 'string' && !alt.startsWith('<')) {
|
|
@@ -1,24 +1,29 @@
|
|
|
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
5
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
5
6
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
6
7
|
import VcfFeature from '../VcfFeature';
|
|
7
8
|
export default class VcfTabixAdapter extends BaseFeatureDataAdapter {
|
|
8
|
-
async configurePre() {
|
|
9
|
-
const
|
|
9
|
+
async configurePre(opts) {
|
|
10
|
+
const { statusCallback = () => { } } = opts || {};
|
|
10
11
|
const vcfGzLocation = this.getConf('vcfGzLocation');
|
|
11
12
|
const location = this.getConf(['index', 'location']);
|
|
12
13
|
const indexType = this.getConf(['index', 'indexType']);
|
|
13
|
-
const filehandle = openLocation(vcfGzLocation,
|
|
14
|
+
const filehandle = openLocation(vcfGzLocation, this.pluginManager);
|
|
14
15
|
const isCSI = indexType === 'CSI';
|
|
15
16
|
const vcf = new TabixIndexedFile({
|
|
16
17
|
filehandle,
|
|
17
|
-
csiFilehandle: isCSI
|
|
18
|
-
|
|
18
|
+
csiFilehandle: isCSI
|
|
19
|
+
? openLocation(location, this.pluginManager)
|
|
20
|
+
: undefined,
|
|
21
|
+
tbiFilehandle: !isCSI
|
|
22
|
+
? openLocation(location, this.pluginManager)
|
|
23
|
+
: undefined,
|
|
19
24
|
chunkCacheSize: 50 * 2 ** 20,
|
|
20
25
|
});
|
|
21
|
-
const header = await vcf.getHeader();
|
|
26
|
+
const header = await updateStatus('Downloading index', statusCallback, () => vcf.getHeader());
|
|
22
27
|
return {
|
|
23
28
|
vcf,
|
|
24
29
|
parser: new VcfParser({ header }),
|
|
@@ -48,8 +53,9 @@ export default class VcfTabixAdapter extends BaseFeatureDataAdapter {
|
|
|
48
53
|
getFeatures(query, opts = {}) {
|
|
49
54
|
return ObservableCreate(async (observer) => {
|
|
50
55
|
const { refName, start, end } = query;
|
|
56
|
+
const { statusCallback = () => { } } = opts;
|
|
51
57
|
const { vcf, parser } = await this.configure();
|
|
52
|
-
await vcf.getLines(refName, start, end, {
|
|
58
|
+
await updateStatus('Downloading variants', statusCallback, () => vcf.getLines(refName, start, end, {
|
|
53
59
|
lineCallback: (line, fileOffset) => {
|
|
54
60
|
observer.next(new VcfFeature({
|
|
55
61
|
variant: parser.parseLine(line),
|
|
@@ -58,15 +64,35 @@ export default class VcfTabixAdapter extends BaseFeatureDataAdapter {
|
|
|
58
64
|
}));
|
|
59
65
|
},
|
|
60
66
|
...opts,
|
|
61
|
-
});
|
|
67
|
+
}));
|
|
62
68
|
observer.complete();
|
|
63
69
|
}, opts.stopToken);
|
|
64
70
|
}
|
|
65
71
|
async getSources() {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
const conf = this.getConf('samplesTsvLocation');
|
|
73
|
+
if (conf.uri === '' || conf.uri === '/path/to/samples.tsv') {
|
|
74
|
+
const { parser } = await this.configure();
|
|
75
|
+
return parser.samples.map(name => ({
|
|
76
|
+
name,
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const txt = await fetchAndMaybeUnzipText(openLocation(conf, this.pluginManager));
|
|
81
|
+
const lines = txt.split(/\n|\r\n|\r/);
|
|
82
|
+
const header = lines[0].split('\t');
|
|
83
|
+
const { parser } = await this.configure();
|
|
84
|
+
const s = new Set(parser.samples);
|
|
85
|
+
return lines
|
|
86
|
+
.slice(1)
|
|
87
|
+
.map(line => {
|
|
88
|
+
const cols = line.split('\t');
|
|
89
|
+
return {
|
|
90
|
+
name: cols[0],
|
|
91
|
+
...Object.fromEntries(cols.slice(1).map((c, idx) => [header[idx + 1], c])),
|
|
92
|
+
};
|
|
93
|
+
})
|
|
94
|
+
.filter(f => s.has(f.name));
|
|
95
|
+
}
|
|
70
96
|
}
|
|
71
97
|
freeResources() { }
|
|
72
98
|
}
|
|
@@ -20,5 +20,13 @@ declare const VcfTabixAdapter: import("@jbrowse/core/configuration/configuration
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
23
|
+
samplesTsvLocation: {
|
|
24
|
+
type: string;
|
|
25
|
+
defaultValue: {
|
|
26
|
+
uri: string;
|
|
27
|
+
description: string;
|
|
28
|
+
locationType: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
23
31
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
24
32
|
export default VcfTabixAdapter;
|
|
@@ -20,5 +20,13 @@ const VcfTabixAdapter = ConfigurationSchema('VcfTabixAdapter', {
|
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
}),
|
|
23
|
+
samplesTsvLocation: {
|
|
24
|
+
type: 'fileLocation',
|
|
25
|
+
defaultValue: {
|
|
26
|
+
uri: '/path/to/samples.tsv',
|
|
27
|
+
description: 'tsv with header like name\tpopulation\tetc. where the first column is required, and is the sample names',
|
|
28
|
+
locationType: 'UriLocation',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
23
31
|
}, { explicitlyTyped: true });
|
|
24
32
|
export default VcfTabixAdapter;
|
package/esm/extensionPoints.js
CHANGED
|
@@ -1,48 +1,36 @@
|
|
|
1
|
+
import { testAdapter } from '@jbrowse/core/util';
|
|
1
2
|
import { getFileName, makeIndex, makeIndexType, } from '@jbrowse/core/util/tracks';
|
|
2
3
|
export default function ExtensionPointsF(pluginManager) {
|
|
3
4
|
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
|
|
4
5
|
return (file, index, adapterHint) => {
|
|
5
|
-
const regexGuess = /\.vcf\.b?gz$/i;
|
|
6
|
-
const adapterName = 'VcfTabixAdapter';
|
|
7
6
|
const fileName = getFileName(file);
|
|
8
7
|
const indexName = index && getFileName(index);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
if (testAdapter(fileName, /\.vcf\.b?gz$/i, adapterHint, 'VcfTabixAdapter')) {
|
|
9
|
+
return {
|
|
10
|
+
type: 'VcfTabixAdapter',
|
|
11
|
+
vcfGzLocation: file,
|
|
12
|
+
index: {
|
|
13
|
+
location: index || makeIndex(file, '.tbi'),
|
|
14
|
+
indexType: makeIndexType(indexName, 'CSI', 'TBI'),
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
else if (testAdapter(fileName, /\.vcf(\.gz)?$/i, adapterHint, 'VcfAdapter')) {
|
|
19
|
+
return {
|
|
20
|
+
type: 'VcfAdapter',
|
|
21
|
+
vcfLocation: file,
|
|
22
|
+
};
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
return
|
|
24
|
+
else {
|
|
25
|
+
return adapterGuesser(file, index, adapterHint);
|
|
22
26
|
}
|
|
23
|
-
return adapterGuesser(file, index, adapterHint);
|
|
24
27
|
};
|
|
25
28
|
});
|
|
26
29
|
pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', (trackTypeGuesser) => {
|
|
27
30
|
return (adapterName) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return trackTypeGuesser(adapterName);
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', (adapterGuesser) => {
|
|
35
|
-
return (file, index, adapterHint) => {
|
|
36
|
-
const regexGuess = /\.vcf$/i;
|
|
37
|
-
const adapterName = 'VcfAdapter';
|
|
38
|
-
const fileName = getFileName(file);
|
|
39
|
-
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
40
|
-
return {
|
|
41
|
-
type: adapterName,
|
|
42
|
-
vcfLocation: file,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
return adapterGuesser(file, index, adapterHint);
|
|
31
|
+
return ['VcfTabixAdapter', 'VcfAdapter'].includes(adapterName)
|
|
32
|
+
? 'VariantTrack'
|
|
33
|
+
: trackTypeGuesser(adapterName);
|
|
46
34
|
};
|
|
47
35
|
});
|
|
48
36
|
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
+
import type { SampleInfo, Source } from './types';
|
|
1
2
|
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
3
|
import type { Feature } from '@jbrowse/core/util';
|
|
3
|
-
export interface Source {
|
|
4
|
-
name: string;
|
|
5
|
-
color?: string;
|
|
6
|
-
group?: string;
|
|
7
|
-
[key: string]: string | undefined;
|
|
8
|
-
}
|
|
9
4
|
export declare function getMultiVariantFeaturesAutorun(self: {
|
|
10
5
|
configuration: AnyConfigurationModel;
|
|
11
6
|
adapterConfig: AnyConfigurationModel;
|
|
12
7
|
sources?: Source[];
|
|
13
|
-
|
|
8
|
+
minorAlleleFrequencyFilter: number;
|
|
14
9
|
statsReadyAndRegionNotTooLarge: boolean;
|
|
15
10
|
adapterProps: () => Record<string, unknown>;
|
|
16
11
|
setError: (error: unknown) => void;
|
|
17
12
|
setFeatures: (f: Feature[]) => void;
|
|
18
13
|
setMessage: (str: string) => void;
|
|
14
|
+
setHasPhased: (arg: boolean) => void;
|
|
15
|
+
setSampleInfo: (arg: Record<string, SampleInfo>) => void;
|
|
19
16
|
}): void;
|
|
@@ -11,25 +11,26 @@ export function getMultiVariantFeaturesAutorun(self) {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
const { rpcManager } = getSession(self);
|
|
14
|
-
const { sources,
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
const { sources, minorAlleleFrequencyFilter, adapterConfig } = self;
|
|
15
|
+
if (sources) {
|
|
16
|
+
const sessionId = getRpcSessionId(self);
|
|
17
|
+
const { sampleInfo, hasPhased, features } = (await rpcManager.call(sessionId, 'MultiVariantGetSimplifiedFeatures', {
|
|
18
|
+
regions: view.dynamicBlocks.contentBlocks,
|
|
19
|
+
sources,
|
|
20
|
+
minorAlleleFrequencyFilter,
|
|
21
|
+
sessionId,
|
|
22
|
+
adapterConfig,
|
|
23
|
+
}));
|
|
24
|
+
if (isAlive(self)) {
|
|
25
|
+
self.setHasPhased(hasPhased);
|
|
26
|
+
self.setSampleInfo(sampleInfo);
|
|
27
|
+
self.setFeatures(features.map(f => new SimpleFeature(f)));
|
|
28
|
+
}
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
catch (e) {
|
|
32
|
+
console.error(e);
|
|
31
33
|
if (!isAbortException(e) && isAlive(self)) {
|
|
32
|
-
console.error(e);
|
|
33
34
|
getSession(self).notifyError(`${e}`, e);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
+
import type { Source } from './types';
|
|
1
2
|
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
|
-
export interface Source {
|
|
3
|
-
name: string;
|
|
4
|
-
color?: string;
|
|
5
|
-
group?: string;
|
|
6
|
-
[key: string]: string | undefined;
|
|
7
|
-
}
|
|
8
3
|
export declare function getMultiVariantSourcesAutorun(self: {
|
|
9
4
|
configuration: AnyConfigurationModel;
|
|
10
5
|
adapterConfig: AnyConfigurationModel;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export default function BulkEditPanel({ setCurrLayout, currLayout, }: {
|
|
1
|
+
import type { Source } from '../types';
|
|
2
|
+
export default function BulkEditPanel({ onClose, currLayout, }: {
|
|
4
3
|
currLayout: Source[];
|
|
5
|
-
|
|
6
|
-
}):
|
|
4
|
+
onClose: (arg?: Source[]) => void;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,77 +1,81 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { ErrorMessage } from '@jbrowse/core/ui';
|
|
3
|
-
import { Button, TextField, Typography } from '@mui/material';
|
|
4
|
+
import { Button, DialogActions, DialogContent, TextField, Typography, } from '@mui/material';
|
|
4
5
|
import { makeStyles } from 'tss-react/mui';
|
|
5
6
|
const useStyles = makeStyles()({
|
|
6
7
|
textAreaFont: {
|
|
7
8
|
fontFamily: 'Courier New',
|
|
8
9
|
},
|
|
9
10
|
});
|
|
10
|
-
export default function BulkEditPanel({
|
|
11
|
+
export default function BulkEditPanel({ onClose, currLayout, }) {
|
|
11
12
|
const { classes } = useStyles();
|
|
12
13
|
const [val, setVal] = useState('');
|
|
13
14
|
const [error, setError] = useState();
|
|
14
|
-
return (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DialogContent, { children: [_jsx(Typography, { children: "Paste CSV or TSV. If a header column is present. First line is a header. If a column called \"name\" is present, it uses that to connect to IDs in the table, otherwise it uses the first column no." }), error ? _jsx(ErrorMessage, { error: error }) : null, _jsx(TextField, { variant: "outlined", multiline: true, minRows: 5, placeholder: 'name,population\nHG00098,GBR\nHG00101,GBR\nHG00459,CHS\n...', maxRows: 10, fullWidth: true, value: val, onChange: event => {
|
|
16
|
+
setVal(event.target.value);
|
|
17
|
+
}, slotProps: {
|
|
18
|
+
input: {
|
|
19
|
+
classes: {
|
|
20
|
+
input: classes.textAreaFont,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
} })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", color: "secondary", onClick: () => {
|
|
24
|
+
const lines = val
|
|
25
|
+
.split('\n')
|
|
26
|
+
.map(f => f.trim())
|
|
27
|
+
.filter(f => !!f);
|
|
28
|
+
const fields = lines[0].split(/[,\t]/gm);
|
|
29
|
+
if (fields.includes('name')) {
|
|
30
|
+
setError('');
|
|
31
|
+
const oldLayout = Object.fromEntries(currLayout.map(record => [record.name, record]));
|
|
32
|
+
const newData = Object.fromEntries(lines.slice(1).map(line => {
|
|
33
|
+
const cols = line.split(/[,\t]/gm);
|
|
34
|
+
const newRecord = Object.fromEntries(cols.map((col, idx) => [fields[idx], col]));
|
|
35
|
+
return [
|
|
36
|
+
newRecord.name,
|
|
37
|
+
{
|
|
38
|
+
...newRecord,
|
|
39
|
+
...oldLayout[newRecord.name],
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}));
|
|
43
|
+
onClose(currLayout.map(record => ({
|
|
44
|
+
...record,
|
|
45
|
+
...newData[record.name],
|
|
46
|
+
})));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
setError(new Error('No "name" column found on line 1'));
|
|
50
|
+
}
|
|
51
|
+
}, children: "Update rows" }), _jsx(Button, { variant: "contained", color: "primary", onClick: () => {
|
|
52
|
+
const lines = val
|
|
53
|
+
.split('\n')
|
|
54
|
+
.map(f => f.trim())
|
|
55
|
+
.filter(f => !!f);
|
|
56
|
+
const fields = lines[0].split(/[,\t]/gm);
|
|
57
|
+
if (fields.includes('name')) {
|
|
58
|
+
setError('');
|
|
59
|
+
const oldLayout = Object.fromEntries(currLayout.map(record => [record.name, record]));
|
|
60
|
+
const newData = Object.fromEntries(lines.slice(1).map(line => {
|
|
61
|
+
const cols = line.split(/[,\t]/gm);
|
|
62
|
+
const newRecord = Object.fromEntries(cols.map((col, idx) => [fields[idx], col]));
|
|
63
|
+
return [
|
|
64
|
+
newRecord.name,
|
|
65
|
+
{
|
|
66
|
+
...newRecord,
|
|
67
|
+
...oldLayout[newRecord.name],
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
}));
|
|
71
|
+
onClose(currLayout.map(record => ({
|
|
72
|
+
...newData[record.name],
|
|
73
|
+
})));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
setError(new Error('No "name" column found on line 1'));
|
|
77
|
+
}
|
|
78
|
+
}, children: "Replace rows" }), _jsx(Button, { variant: "contained", color: "inherit", onClick: () => {
|
|
79
|
+
onClose();
|
|
80
|
+
}, children: "Cancel" })] })] }));
|
|
77
81
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { Source } from '../util';
|
|
1
|
+
import type { Source } from '../types';
|
|
3
2
|
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
4
|
-
export default function
|
|
3
|
+
export default function ClusterDialog({ model, handleClose, }: {
|
|
5
4
|
model: {
|
|
6
5
|
sources?: Source[];
|
|
7
|
-
|
|
6
|
+
minorAlleleFrequencyFilter?: number;
|
|
8
7
|
adapterConfig: AnyConfigurationModel;
|
|
9
8
|
setLayout: (arg: Source[]) => void;
|
|
10
9
|
};
|
|
11
10
|
handleClose: () => void;
|
|
12
|
-
}):
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|