@jbrowse/plugin-variants 2.17.0 → 2.18.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/index.d.ts +1 -1
- package/dist/ChordVariantDisplay/index.js +1 -2
- package/dist/ChordVariantDisplay/models/configSchema.d.ts +1 -4
- package/dist/ChordVariantDisplay/models/configSchema.js +1 -10
- package/dist/ChordVariantDisplay/models/stateModelFactory.d.ts +9 -27
- package/dist/ChordVariantDisplay/models/stateModelFactory.js +2 -23
- package/dist/LinearVariantDisplay/configSchema.d.ts +2 -2
- package/dist/LinearVariantDisplay/configSchema.js +1 -10
- package/dist/LinearVariantDisplay/index.d.ts +1 -1
- package/dist/LinearVariantDisplay/index.js +2 -2
- package/dist/LinearVariantDisplay/model.d.ts +8 -38
- package/dist/LinearVariantDisplay/model.js +1 -17
- package/dist/MultiLinearVariantDisplay/components/VariantDisplayComponent.d.ts +6 -0
- package/dist/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +73 -0
- package/dist/MultiLinearVariantDisplay/configSchema.d.ts +80 -0
- package/dist/MultiLinearVariantDisplay/configSchema.js +30 -0
- package/dist/MultiLinearVariantDisplay/index.d.ts +2 -0
- package/dist/MultiLinearVariantDisplay/index.js +47 -0
- package/dist/MultiLinearVariantDisplay/model.d.ts +278 -0
- package/dist/MultiLinearVariantDisplay/model.js +235 -0
- package/dist/MultiLinearVariantDisplay/renderSvg.d.ts +4 -0
- package/dist/MultiLinearVariantDisplay/renderSvg.js +18 -0
- package/dist/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.d.ts +7 -0
- package/dist/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +42 -0
- package/dist/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.d.ts +6 -0
- package/dist/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +81 -0
- package/dist/MultiLinearVariantMatrixDisplay/configSchema.d.ts +37 -0
- package/dist/MultiLinearVariantMatrixDisplay/configSchema.js +22 -0
- package/dist/MultiLinearVariantMatrixDisplay/index.d.ts +2 -0
- package/dist/MultiLinearVariantMatrixDisplay/index.js +24 -0
- package/dist/MultiLinearVariantMatrixDisplay/model.d.ts +274 -0
- package/dist/MultiLinearVariantMatrixDisplay/model.js +218 -0
- package/dist/MultiLinearVariantMatrixDisplay/renderSvg.d.ts +4 -0
- package/dist/MultiLinearVariantMatrixDisplay/renderSvg.js +21 -0
- package/dist/MultiLinearVariantMatrixRenderer/LinearVariantMatrixRenderer.d.ts +62 -0
- package/dist/MultiLinearVariantMatrixRenderer/LinearVariantMatrixRenderer.js +106 -0
- package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +6 -0
- package/dist/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +12 -0
- package/dist/MultiLinearVariantMatrixRenderer/configSchema.d.ts +2 -0
- package/dist/MultiLinearVariantMatrixRenderer/configSchema.js +6 -0
- package/dist/MultiLinearVariantMatrixRenderer/index.d.ts +2 -0
- package/dist/MultiLinearVariantMatrixRenderer/index.js +20 -0
- package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +48 -0
- package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.js +60 -0
- package/dist/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +18 -0
- package/dist/MultiLinearVariantRenderer/MultiVariantRendering.js +43 -0
- package/dist/MultiLinearVariantRenderer/configSchema.d.ts +34 -0
- package/dist/MultiLinearVariantRenderer/configSchema.js +13 -0
- package/dist/MultiLinearVariantRenderer/index.d.ts +2 -0
- package/dist/MultiLinearVariantRenderer/index.js +19 -0
- package/dist/MultiVariantBaseRenderer.d.ts +46 -0
- package/dist/MultiVariantBaseRenderer.js +39 -0
- package/dist/StructuralVariantChordRenderer/Chord.d.ts +2 -2
- package/dist/StructuralVariantChordRenderer/Chord.js +5 -9
- package/dist/StructuralVariantChordRenderer/ReactComponent.d.ts +3 -3
- package/dist/StructuralVariantChordRenderer/ReactComponent.js +0 -1
- package/dist/StructuralVariantChordRenderer/configSchema.d.ts +0 -9
- package/dist/StructuralVariantChordRenderer/configSchema.js +1 -13
- package/dist/StructuralVariantChordRenderer/index.d.ts +1 -1
- package/dist/StructuralVariantChordRenderer/index.js +1 -1
- package/dist/Tooltip.d.ts +19 -0
- package/dist/Tooltip.js +58 -0
- package/dist/VariantFeatureWidget/AnnotGrid.d.ts +1 -1
- package/dist/VariantFeatureWidget/AnnotGrid.js +2 -2
- package/dist/VariantFeatureWidget/BreakendMultiLevelOptionDialog.js +0 -1
- package/dist/VariantFeatureWidget/BreakendSingleLevelOptionDialog.js +0 -1
- package/dist/VariantFeatureWidget/LaunchBreakendPanel.d.ts +2 -2
- package/dist/VariantFeatureWidget/LaunchBreakendPanel.js +15 -19
- package/dist/VariantFeatureWidget/VariantAnnotationTable.js +1 -1
- package/dist/VariantFeatureWidget/VariantFeatureWidget.d.ts +1 -1
- package/dist/VariantFeatureWidget/VariantFeatureWidget.js +4 -6
- package/dist/VariantFeatureWidget/VariantSampleGrid.d.ts +1 -1
- package/dist/VariantFeatureWidget/VariantSampleGrid.js +9 -13
- package/dist/VariantFeatureWidget/index.d.ts +1 -1
- package/dist/VariantFeatureWidget/index.js +1 -1
- package/dist/VariantFeatureWidget/stateModelFactory.d.ts +2 -2
- package/dist/VariantFeatureWidget/stateModelFactory.js +1 -1
- package/dist/VariantRPC/MultiVariantGetGenotypeMatrix.d.ts +17 -0
- package/dist/VariantRPC/MultiVariantGetGenotypeMatrix.js +67 -0
- package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +21 -0
- package/dist/VariantRPC/MultiVariantGetSimplifiedFeatures.js +63 -0
- package/dist/VariantRPC/MultiVariantGetSources.d.ts +14 -0
- package/dist/VariantRPC/MultiVariantGetSources.js +22 -0
- package/dist/VariantTrack/configSchema.d.ts +2 -3
- package/dist/VariantTrack/configSchema.js +6 -13
- package/dist/VariantTrack/index.d.ts +1 -1
- package/dist/VcfAdapter/VcfAdapter.d.ts +3 -2
- package/dist/VcfAdapter/VcfAdapter.js +3 -5
- package/dist/VcfAdapter/configSchema.d.ts +0 -3
- package/dist/VcfAdapter/configSchema.js +1 -7
- package/dist/VcfAdapter/index.d.ts +1 -1
- package/dist/VcfFeature/index.d.ts +5 -29
- package/dist/VcfFeature/index.js +35 -26
- package/dist/VcfFeature/util.d.ts +1 -4
- package/dist/VcfFeature/util.js +0 -12
- package/dist/VcfTabixAdapter/VcfTabixAdapter.d.ts +7 -3
- package/dist/VcfTabixAdapter/VcfTabixAdapter.js +10 -5
- package/dist/VcfTabixAdapter/configSchema.d.ts +0 -9
- package/dist/VcfTabixAdapter/configSchema.js +2 -14
- package/dist/VcfTabixAdapter/index.d.ts +1 -1
- package/dist/configSchema.d.ts +34 -0
- package/dist/configSchema.js +44 -0
- package/dist/extensionPoints.d.ts +1 -1
- package/dist/getMultiVariantFeaturesAutorun.d.ts +19 -0
- package/dist/getMultiVariantFeaturesAutorun.js +40 -0
- package/dist/getMultiVariantSourcesAutorun.d.ts +16 -0
- package/dist/getMultiVariantSourcesAutorun.js +37 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -4
- package/dist/shared/BulkEditPanel.d.ts +6 -0
- package/dist/shared/BulkEditPanel.js +103 -0
- package/dist/shared/ClusterDialog.d.ts +12 -0
- package/dist/shared/ClusterDialog.js +150 -0
- package/dist/shared/ColorLegend.d.ts +11 -0
- package/dist/shared/ColorLegend.js +24 -0
- package/dist/shared/DraggableDialog.d.ts +6 -0
- package/dist/shared/DraggableDialog.js +62 -0
- package/dist/shared/LegendBar.d.ts +18 -0
- package/dist/shared/LegendBar.js +38 -0
- package/dist/shared/MAFFilterDialog.d.ts +9 -0
- package/dist/shared/MAFFilterDialog.js +56 -0
- package/dist/shared/RectBg.d.ts +9 -0
- package/dist/shared/RectBg.js +12 -0
- package/dist/shared/RowPalettizer.d.ts +6 -0
- package/dist/shared/RowPalettizer.js +38 -0
- package/dist/shared/SetColorDialog.d.ts +12 -0
- package/dist/shared/SetColorDialog.js +94 -0
- package/dist/shared/SetMinMaxDialog.d.ts +11 -0
- package/dist/shared/SetMinMaxDialog.js +56 -0
- package/dist/shared/SharedVariantConfigSchema.d.ts +66 -0
- package/dist/shared/SharedVariantConfigSchema.js +56 -0
- package/dist/shared/SharedVariantMixin.d.ts +309 -0
- package/dist/shared/SharedVariantMixin.js +58 -0
- package/dist/shared/SourcesGrid.d.ts +8 -0
- package/dist/shared/SourcesGrid.js +143 -0
- package/dist/shared/Tooltip.d.ts +18 -0
- package/dist/shared/Tooltip.js +38 -0
- package/dist/shared/util.d.ts +10 -0
- package/dist/shared/util.js +32 -0
- package/dist/util.d.ts +11 -0
- package/dist/util.js +53 -0
- package/esm/ChordVariantDisplay/index.d.ts +1 -1
- package/esm/ChordVariantDisplay/index.js +1 -2
- package/esm/ChordVariantDisplay/models/configSchema.d.ts +1 -4
- package/esm/ChordVariantDisplay/models/configSchema.js +1 -10
- package/esm/ChordVariantDisplay/models/stateModelFactory.d.ts +9 -27
- package/esm/ChordVariantDisplay/models/stateModelFactory.js +3 -24
- package/esm/LinearVariantDisplay/configSchema.d.ts +2 -2
- package/esm/LinearVariantDisplay/configSchema.js +1 -10
- package/esm/LinearVariantDisplay/index.d.ts +1 -1
- package/esm/LinearVariantDisplay/index.js +2 -2
- package/esm/LinearVariantDisplay/model.d.ts +8 -38
- package/esm/LinearVariantDisplay/model.js +2 -18
- package/esm/MultiLinearVariantDisplay/components/VariantDisplayComponent.d.ts +6 -0
- package/esm/MultiLinearVariantDisplay/components/VariantDisplayComponent.js +45 -0
- package/esm/MultiLinearVariantDisplay/configSchema.d.ts +80 -0
- package/esm/MultiLinearVariantDisplay/configSchema.js +24 -0
- package/esm/MultiLinearVariantDisplay/index.d.ts +2 -0
- package/esm/MultiLinearVariantDisplay/index.js +18 -0
- package/esm/MultiLinearVariantDisplay/model.d.ts +278 -0
- package/esm/MultiLinearVariantDisplay/model.js +206 -0
- package/esm/MultiLinearVariantDisplay/renderSvg.d.ts +4 -0
- package/esm/MultiLinearVariantDisplay/renderSvg.js +12 -0
- package/esm/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.d.ts +7 -0
- package/esm/MultiLinearVariantMatrixDisplay/components/LinesConnectingMatrixToGenomicPosition.js +37 -0
- package/esm/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.d.ts +6 -0
- package/esm/MultiLinearVariantMatrixDisplay/components/VariantDisplayComponent.js +53 -0
- package/esm/MultiLinearVariantMatrixDisplay/configSchema.d.ts +37 -0
- package/esm/MultiLinearVariantMatrixDisplay/configSchema.js +16 -0
- package/esm/MultiLinearVariantMatrixDisplay/index.d.ts +2 -0
- package/esm/MultiLinearVariantMatrixDisplay/index.js +18 -0
- package/esm/MultiLinearVariantMatrixDisplay/model.d.ts +274 -0
- package/esm/MultiLinearVariantMatrixDisplay/model.js +189 -0
- package/esm/MultiLinearVariantMatrixDisplay/renderSvg.d.ts +4 -0
- package/esm/MultiLinearVariantMatrixDisplay/renderSvg.js +15 -0
- package/esm/MultiLinearVariantMatrixRenderer/LinearVariantMatrixRenderer.d.ts +62 -0
- package/esm/MultiLinearVariantMatrixRenderer/LinearVariantMatrixRenderer.js +100 -0
- package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.d.ts +6 -0
- package/esm/MultiLinearVariantMatrixRenderer/components/LinearVariantMatrixRendering.js +7 -0
- package/esm/MultiLinearVariantMatrixRenderer/configSchema.d.ts +2 -0
- package/esm/MultiLinearVariantMatrixRenderer/configSchema.js +4 -0
- package/esm/MultiLinearVariantMatrixRenderer/index.d.ts +2 -0
- package/esm/MultiLinearVariantMatrixRenderer/index.js +14 -0
- package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +48 -0
- package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.js +54 -0
- package/esm/MultiLinearVariantRenderer/MultiVariantRendering.d.ts +18 -0
- package/esm/MultiLinearVariantRenderer/MultiVariantRendering.js +18 -0
- package/esm/MultiLinearVariantRenderer/configSchema.d.ts +34 -0
- package/esm/MultiLinearVariantRenderer/configSchema.js +8 -0
- package/esm/MultiLinearVariantRenderer/index.d.ts +2 -0
- package/esm/MultiLinearVariantRenderer/index.js +13 -0
- package/esm/MultiVariantBaseRenderer.d.ts +46 -0
- package/esm/MultiVariantBaseRenderer.js +33 -0
- package/esm/StructuralVariantChordRenderer/Chord.d.ts +2 -2
- package/esm/StructuralVariantChordRenderer/Chord.js +5 -9
- package/esm/StructuralVariantChordRenderer/ReactComponent.d.ts +3 -3
- package/esm/StructuralVariantChordRenderer/ReactComponent.js +0 -1
- package/esm/StructuralVariantChordRenderer/configSchema.d.ts +0 -9
- package/esm/StructuralVariantChordRenderer/configSchema.js +1 -13
- package/esm/StructuralVariantChordRenderer/index.d.ts +1 -1
- package/esm/StructuralVariantChordRenderer/index.js +1 -1
- package/esm/Tooltip.d.ts +19 -0
- package/esm/Tooltip.js +30 -0
- package/esm/VariantFeatureWidget/AnnotGrid.d.ts +1 -1
- package/esm/VariantFeatureWidget/AnnotGrid.js +2 -2
- package/esm/VariantFeatureWidget/BreakendMultiLevelOptionDialog.js +0 -1
- package/esm/VariantFeatureWidget/BreakendSingleLevelOptionDialog.js +0 -1
- package/esm/VariantFeatureWidget/LaunchBreakendPanel.d.ts +2 -2
- package/esm/VariantFeatureWidget/LaunchBreakendPanel.js +15 -19
- package/esm/VariantFeatureWidget/VariantAnnotationTable.js +1 -1
- package/esm/VariantFeatureWidget/VariantFeatureWidget.d.ts +1 -1
- package/esm/VariantFeatureWidget/VariantFeatureWidget.js +5 -7
- package/esm/VariantFeatureWidget/VariantSampleGrid.d.ts +1 -1
- package/esm/VariantFeatureWidget/VariantSampleGrid.js +10 -14
- package/esm/VariantFeatureWidget/index.d.ts +1 -1
- package/esm/VariantFeatureWidget/index.js +1 -1
- package/esm/VariantFeatureWidget/stateModelFactory.d.ts +2 -2
- package/esm/VariantFeatureWidget/stateModelFactory.js +1 -1
- package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.d.ts +17 -0
- package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.js +60 -0
- package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.d.ts +21 -0
- package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.js +56 -0
- package/esm/VariantRPC/MultiVariantGetSources.d.ts +14 -0
- package/esm/VariantRPC/MultiVariantGetSources.js +15 -0
- package/esm/VariantTrack/configSchema.d.ts +2 -3
- package/esm/VariantTrack/configSchema.js +5 -13
- package/esm/VariantTrack/index.d.ts +1 -1
- package/esm/VcfAdapter/VcfAdapter.d.ts +3 -2
- package/esm/VcfAdapter/VcfAdapter.js +4 -6
- package/esm/VcfAdapter/configSchema.d.ts +0 -3
- package/esm/VcfAdapter/configSchema.js +1 -7
- package/esm/VcfAdapter/index.d.ts +1 -1
- package/esm/VcfFeature/index.d.ts +5 -29
- package/esm/VcfFeature/index.js +35 -26
- package/esm/VcfFeature/util.d.ts +1 -4
- package/esm/VcfFeature/util.js +0 -12
- package/esm/VcfTabixAdapter/VcfTabixAdapter.d.ts +7 -3
- package/esm/VcfTabixAdapter/VcfTabixAdapter.js +11 -6
- package/esm/VcfTabixAdapter/configSchema.d.ts +0 -9
- package/esm/VcfTabixAdapter/configSchema.js +2 -14
- package/esm/VcfTabixAdapter/index.d.ts +1 -1
- package/esm/configSchema.d.ts +34 -0
- package/esm/configSchema.js +42 -0
- package/esm/extensionPoints.d.ts +1 -1
- package/esm/extensionPoints.js +1 -1
- package/esm/getMultiVariantFeaturesAutorun.d.ts +19 -0
- package/esm/getMultiVariantFeaturesAutorun.js +37 -0
- package/esm/getMultiVariantSourcesAutorun.d.ts +16 -0
- package/esm/getMultiVariantSourcesAutorun.js +34 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +18 -4
- package/esm/shared/BulkEditPanel.d.ts +6 -0
- package/esm/shared/BulkEditPanel.js +77 -0
- package/esm/shared/ClusterDialog.d.ts +12 -0
- package/esm/shared/ClusterDialog.js +121 -0
- package/esm/shared/ColorLegend.d.ts +11 -0
- package/esm/shared/ColorLegend.js +19 -0
- package/esm/shared/DraggableDialog.d.ts +6 -0
- package/esm/shared/DraggableDialog.js +34 -0
- package/esm/shared/LegendBar.d.ts +18 -0
- package/esm/shared/LegendBar.js +32 -0
- package/esm/shared/MAFFilterDialog.d.ts +9 -0
- package/esm/shared/MAFFilterDialog.js +31 -0
- package/esm/shared/RectBg.d.ts +9 -0
- package/esm/shared/RectBg.js +7 -0
- package/esm/shared/RowPalettizer.d.ts +6 -0
- package/esm/shared/RowPalettizer.js +32 -0
- package/esm/shared/SetColorDialog.d.ts +12 -0
- package/esm/shared/SetColorDialog.js +65 -0
- package/esm/shared/SetMinMaxDialog.d.ts +11 -0
- package/esm/shared/SetMinMaxDialog.js +30 -0
- package/esm/shared/SharedVariantConfigSchema.d.ts +66 -0
- package/esm/shared/SharedVariantConfigSchema.js +53 -0
- package/esm/shared/SharedVariantMixin.d.ts +309 -0
- package/esm/shared/SharedVariantMixin.js +55 -0
- package/esm/shared/SourcesGrid.d.ts +8 -0
- package/esm/shared/SourcesGrid.js +115 -0
- package/esm/shared/Tooltip.d.ts +18 -0
- package/esm/shared/Tooltip.js +33 -0
- package/esm/shared/util.d.ts +10 -0
- package/esm/shared/util.js +28 -0
- package/esm/util.d.ts +11 -0
- package/esm/util.js +47 -0
- package/package.json +4 -4
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { observer } from 'mobx-react';
|
|
3
|
-
import { Paper } from '@mui/material';
|
|
4
|
-
import FeatureDetails from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails';
|
|
1
|
+
import React, { Suspense, lazy } from 'react';
|
|
5
2
|
import { parseBreakend } from '@gmod/vcf';
|
|
6
|
-
|
|
7
|
-
import
|
|
3
|
+
import FeatureDetails from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails';
|
|
4
|
+
import { Paper } from '@mui/material';
|
|
5
|
+
import { observer } from 'mobx-react';
|
|
8
6
|
import VariantAnnotationTable from './VariantAnnotationTable';
|
|
7
|
+
import VariantSampleGrid from './VariantSampleGrid';
|
|
9
8
|
import { variantFieldDescriptions } from './variantFieldDescriptions';
|
|
10
|
-
// lazies
|
|
11
9
|
const LaunchBreakendPanel = lazy(() => import('./LaunchBreakendPanel'));
|
|
12
10
|
function AnnPanel({ descriptions, feature, }) {
|
|
13
11
|
var _a, _b, _c, _d, _e;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { FormControlLabel, Checkbox, TextField, Typography, } from '@mui/material';
|
|
3
|
-
import { DataGrid, GridToolbar } from '@mui/x-data-grid';
|
|
4
|
-
import { measureGridWidth } from '@jbrowse/core/util';
|
|
5
2
|
import BaseCard from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard';
|
|
3
|
+
import { measureGridWidth } from '@jbrowse/core/util';
|
|
4
|
+
import { Checkbox, FormControlLabel, TextField, Typography, } from '@mui/material';
|
|
5
|
+
import { DataGrid, GridToolbar } from '@mui/x-data-grid';
|
|
6
6
|
function SampleFilters({ columns, filter, setFilter, }) {
|
|
7
7
|
return (React.createElement(React.Fragment, null,
|
|
8
8
|
React.createElement(Typography, null, "These filters can use a plain text search or regex style query, e.g. in the genotype field, entering 1 will query for all genotypes that include the first alternate allele e.g. 0|1 or 1|1, entering [1-9]\\d* will find any non-zero allele e.g. 0|2 or 2/33"),
|
|
@@ -19,9 +19,6 @@ export default function VariantSamples(props) {
|
|
|
19
19
|
let error;
|
|
20
20
|
let rows = [];
|
|
21
21
|
const filters = Object.keys(filter);
|
|
22
|
-
// catch some error thrown from regex
|
|
23
|
-
// note: maps all values into a string, if this is not done rows are not
|
|
24
|
-
// sortable by the data-grid
|
|
25
22
|
try {
|
|
26
23
|
rows = preFilteredRows
|
|
27
24
|
.map(row => {
|
|
@@ -54,19 +51,18 @@ export default function VariantSamples(props) {
|
|
|
54
51
|
width: widths[index],
|
|
55
52
|
});
|
|
56
53
|
});
|
|
57
|
-
// disableRowSelectionOnClick helps avoid
|
|
58
|
-
// https://github.com/mui-org/material-ui-x/issues/1197
|
|
59
54
|
return !preFilteredRows.length ? null : (React.createElement(BaseCard, { ...props, title: "Samples" },
|
|
60
55
|
error ? React.createElement(Typography, { color: "error" }, `${error}`) : null,
|
|
61
56
|
React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: checked, onChange: event => {
|
|
62
57
|
setChecked(event.target.checked);
|
|
63
58
|
} }), label: React.createElement(Typography, { variant: "body2" }, "Show options") }),
|
|
64
59
|
checked ? (React.createElement(SampleFilters, { setFilter: setFilter, columns: columns, filter: filter })) : null,
|
|
65
|
-
React.createElement(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
React.createElement("div", { style: { display: 'flex', flexDirection: 'column' } },
|
|
61
|
+
React.createElement(DataGrid, { rows: rows, hideFooter: rows.length < 100, columns: columns, disableRowSelectionOnClick: true, rowHeight: 25, columnHeaderHeight: 35, disableColumnMenu: true, slots: { toolbar: checked ? GridToolbar : null }, slotProps: {
|
|
62
|
+
toolbar: {
|
|
63
|
+
printOptions: {
|
|
64
|
+
disableToolbarButton: true,
|
|
65
|
+
},
|
|
69
66
|
},
|
|
70
|
-
}
|
|
71
|
-
} })));
|
|
67
|
+
} }))));
|
|
72
68
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function VariantFeatureWidgetF(pluginManager: PluginManager): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
2
|
import WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType';
|
|
3
|
-
import { stateModelFactory } from './stateModelFactory';
|
|
4
3
|
import { configSchema } from './configSchema';
|
|
4
|
+
import { stateModelFactory } from './stateModelFactory';
|
|
5
5
|
export default function VariantFeatureWidgetF(pluginManager) {
|
|
6
6
|
pluginManager.addWidgetType(() => new WidgetType({
|
|
7
7
|
name: 'VariantFeatureWidget',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
-
import { Instance } from 'mobx-state-tree';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import type { Instance } from 'mobx-state-tree';
|
|
3
3
|
export declare function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
4
4
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
5
5
|
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { types } from 'mobx-state-tree';
|
|
2
1
|
import { stateModelFactory as baseModelFactory } from '@jbrowse/core/BaseFeatureWidget';
|
|
2
|
+
import { types } from 'mobx-state-tree';
|
|
3
3
|
export function stateModelFactory(pluginManager) {
|
|
4
4
|
const baseModel = baseModelFactory(pluginManager);
|
|
5
5
|
return types.compose(baseModel, types.model('VariantFeatureWidget', {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
|
|
2
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
import type { Region } from '@jbrowse/core/util';
|
|
4
|
+
export declare class MultiVariantGetGenotypeMatrix extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
5
|
+
name: string;
|
|
6
|
+
execute(args: {
|
|
7
|
+
adapterConfig: AnyConfigurationModel;
|
|
8
|
+
stopToken?: string;
|
|
9
|
+
sessionId: string;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
regions: Region[];
|
|
12
|
+
bpPerPx: number;
|
|
13
|
+
}, rpcDriverClassName: string): Promise<Record<string, {
|
|
14
|
+
name: string;
|
|
15
|
+
genotypes: number[];
|
|
16
|
+
}>>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
2
|
+
import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
|
|
3
|
+
import { firstValueFrom, toArray } from 'rxjs';
|
|
4
|
+
export class MultiVariantGetGenotypeMatrix extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.name = 'MultiVariantGetGenotypeMatrix';
|
|
8
|
+
}
|
|
9
|
+
async execute(args, rpcDriverClassName) {
|
|
10
|
+
const pm = this.pluginManager;
|
|
11
|
+
const deserializedArgs = await this.deserializeArguments(args, rpcDriverClassName);
|
|
12
|
+
const { sources, mafFilter, regions, adapterConfig, sessionId } = deserializedArgs;
|
|
13
|
+
const adapter = await getAdapter(pm, sessionId, adapterConfig);
|
|
14
|
+
const dataAdapter = adapter.dataAdapter;
|
|
15
|
+
const region = regions[0];
|
|
16
|
+
const feats = await firstValueFrom(dataAdapter.getFeatures(region, deserializedArgs).pipe(toArray()));
|
|
17
|
+
const genotypeFactor = new Set();
|
|
18
|
+
const mafs = [];
|
|
19
|
+
for (const feat of feats) {
|
|
20
|
+
let c = 0;
|
|
21
|
+
let c2 = 0;
|
|
22
|
+
const samp = feat.get('genotypes');
|
|
23
|
+
if (feat.get('end') - feat.get('start') <= 10) {
|
|
24
|
+
for (const { name } of sources) {
|
|
25
|
+
const s = samp[name];
|
|
26
|
+
genotypeFactor.add(s);
|
|
27
|
+
if (s === '0|0' || s === './.') {
|
|
28
|
+
c2++;
|
|
29
|
+
}
|
|
30
|
+
else if (s === '1|0' || s === '0|1') {
|
|
31
|
+
c++;
|
|
32
|
+
}
|
|
33
|
+
else if (s === '1|1') {
|
|
34
|
+
c++;
|
|
35
|
+
c2++;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
c++;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (c / sources.length > mafFilter &&
|
|
42
|
+
c2 / sources.length < 1 - mafFilter) {
|
|
43
|
+
mafs.push(feat);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const genotypeFactorMap = Object.fromEntries([...genotypeFactor].map((type, idx) => [type, idx]));
|
|
48
|
+
const rows = {};
|
|
49
|
+
for (const feat of mafs) {
|
|
50
|
+
const samp = feat.get('genotypes');
|
|
51
|
+
for (const { name } of sources) {
|
|
52
|
+
if (!rows[name]) {
|
|
53
|
+
rows[name] = { name, genotypes: [] };
|
|
54
|
+
}
|
|
55
|
+
rows[name].genotypes.push(genotypeFactorMap[samp[name]]);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return rows;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
|
|
2
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
import type { Region } from '@jbrowse/core/util';
|
|
4
|
+
export declare class MultiVariantGetSimplifiedFeatures extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
5
|
+
name: string;
|
|
6
|
+
execute(args: {
|
|
7
|
+
adapterConfig: AnyConfigurationModel;
|
|
8
|
+
stopToken?: string;
|
|
9
|
+
sessionId: string;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
regions: Region[];
|
|
12
|
+
bpPerPx: number;
|
|
13
|
+
}, rpcDriverClassName: string): Promise<{
|
|
14
|
+
id: string;
|
|
15
|
+
data: {
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
refName: string;
|
|
19
|
+
};
|
|
20
|
+
}[]>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
2
|
+
import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
|
|
3
|
+
import { firstValueFrom, toArray } from 'rxjs';
|
|
4
|
+
export class MultiVariantGetSimplifiedFeatures extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.name = 'MultiVariantGetSimplifiedFeatures';
|
|
8
|
+
}
|
|
9
|
+
async execute(args, rpcDriverClassName) {
|
|
10
|
+
const pm = this.pluginManager;
|
|
11
|
+
const deserializedArgs = await this.deserializeArguments(args, rpcDriverClassName);
|
|
12
|
+
const { mafFilter, sources, regions, adapterConfig, sessionId } = deserializedArgs;
|
|
13
|
+
const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig);
|
|
14
|
+
const feats = await firstValueFrom(dataAdapter
|
|
15
|
+
.getFeaturesInMultipleRegions(regions, deserializedArgs)
|
|
16
|
+
.pipe(toArray()));
|
|
17
|
+
const genotypeFactor = new Set();
|
|
18
|
+
const mafs = [];
|
|
19
|
+
for (const feat of feats) {
|
|
20
|
+
let c = 0;
|
|
21
|
+
let c2 = 0;
|
|
22
|
+
const samp = feat.get('genotypes');
|
|
23
|
+
if (feat.get('end') - feat.get('start') <= 10) {
|
|
24
|
+
for (const { name } of sources) {
|
|
25
|
+
const s = samp[name];
|
|
26
|
+
genotypeFactor.add(s);
|
|
27
|
+
if (s === '0|0' || s === './.') {
|
|
28
|
+
c2++;
|
|
29
|
+
}
|
|
30
|
+
else if (s === '1|0' || s === '0|1') {
|
|
31
|
+
c++;
|
|
32
|
+
}
|
|
33
|
+
else if (s === '1|1') {
|
|
34
|
+
c++;
|
|
35
|
+
c2++;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
c++;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (c / sources.length > mafFilter &&
|
|
42
|
+
c2 / sources.length < 1 - mafFilter) {
|
|
43
|
+
mafs.push(feat);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return mafs.map(f => ({
|
|
48
|
+
id: f.id(),
|
|
49
|
+
data: {
|
|
50
|
+
start: f.get('start'),
|
|
51
|
+
end: f.get('end'),
|
|
52
|
+
refName: f.get('refName'),
|
|
53
|
+
},
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
|
|
2
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
import type { Region } from '@jbrowse/core/util';
|
|
4
|
+
export declare class MultiVariantGetSources extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
5
|
+
name: string;
|
|
6
|
+
execute(args: {
|
|
7
|
+
adapterConfig: AnyConfigurationModel;
|
|
8
|
+
stopToken?: string;
|
|
9
|
+
sessionId: string;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
regions: Region[];
|
|
12
|
+
bpPerPx: number;
|
|
13
|
+
}, rpcDriverClassName: string): Promise<any>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
2
|
+
import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
|
|
3
|
+
export class MultiVariantGetSources extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.name = 'MultiVariantGetSources';
|
|
7
|
+
}
|
|
8
|
+
async execute(args, rpcDriverClassName) {
|
|
9
|
+
const pm = this.pluginManager;
|
|
10
|
+
const deserializedArgs = await this.deserializeArguments(args, rpcDriverClassName);
|
|
11
|
+
const { regions, adapterConfig, sessionId } = deserializedArgs;
|
|
12
|
+
const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig);
|
|
13
|
+
return dataAdapter.getSources(regions, deserializedArgs);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
-
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
export default function VariantTrackF(pluginManager: PluginManager): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
3
3
|
name: {
|
|
4
4
|
description: string;
|
|
5
5
|
type: string;
|
|
@@ -77,4 +77,3 @@ declare const configSchema: (pluginManager: PluginManager) => import("@jbrowse/c
|
|
|
77
77
|
};
|
|
78
78
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
79
79
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "trackId">>, undefined>>;
|
|
80
|
-
export default configSchema;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
2
|
import { createBaseTrackConfig } from '@jbrowse/core/pluggableElementTypes';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
9
|
-
const configSchema = (pluginManager) => ConfigurationSchema('VariantTrack', {}, {
|
|
10
|
-
/**
|
|
11
|
-
* #baseConfiguration
|
|
12
|
-
*/
|
|
13
|
-
baseConfiguration: createBaseTrackConfig(pluginManager),
|
|
14
|
-
});
|
|
15
|
-
export default configSchema;
|
|
3
|
+
export default function VariantTrackF(pluginManager) {
|
|
4
|
+
return ConfigurationSchema('VariantTrack', {}, {
|
|
5
|
+
baseConfiguration: createBaseTrackConfig(pluginManager),
|
|
6
|
+
});
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function VariantTrackF(pm: PluginManager): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import { Region, Feature } from '@jbrowse/core/util';
|
|
3
1
|
import IntervalTree from '@flatten-js/interval-tree';
|
|
2
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
|
+
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
|
+
import type { Feature, Region } from '@jbrowse/core/util';
|
|
4
5
|
type StatusCallback = (arg: string) => void;
|
|
5
6
|
export default class VcfAdapter extends BaseFeatureDataAdapter {
|
|
6
7
|
calculatedIntervalTreeMap: Record<string, IntervalTree>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import IntervalTree from '@flatten-js/interval-tree';
|
|
2
|
+
import VCF from '@gmod/vcf';
|
|
3
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
4
|
import { fetchAndMaybeUnzip } from '@jbrowse/core/util';
|
|
3
5
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
4
6
|
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
5
|
-
import IntervalTree from '@flatten-js/interval-tree';
|
|
6
|
-
import VCF from '@gmod/vcf';
|
|
7
|
-
// local
|
|
8
7
|
import VcfFeature from '../VcfFeature';
|
|
9
8
|
class VcfAdapter extends BaseFeatureDataAdapter {
|
|
10
9
|
constructor() {
|
|
@@ -31,7 +30,6 @@ class VcfAdapter extends BaseFeatureDataAdapter {
|
|
|
31
30
|
let i = 0;
|
|
32
31
|
while (blockStart < buffer.length) {
|
|
33
32
|
const n = buffer.indexOf('\n', blockStart);
|
|
34
|
-
// could be a non-newline ended file, so slice to end of file if n===-1
|
|
35
33
|
const b = n === -1 ? buffer.subarray(blockStart) : buffer.subarray(blockStart, n);
|
|
36
34
|
const line = decoder.decode(b).trim();
|
|
37
35
|
if (line) {
|
|
@@ -106,7 +104,7 @@ class VcfAdapter extends BaseFeatureDataAdapter {
|
|
|
106
104
|
catch (e) {
|
|
107
105
|
observer.error(e);
|
|
108
106
|
}
|
|
109
|
-
}, opts.
|
|
107
|
+
}, opts.stopToken);
|
|
110
108
|
}
|
|
111
109
|
freeResources() { }
|
|
112
110
|
}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
|
-
|
|
3
|
-
* #config VcfAdapter
|
|
4
|
-
*/
|
|
5
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
2
|
+
function x() { }
|
|
6
3
|
const VcfAdapter = ConfigurationSchema('VcfAdapter', {
|
|
7
|
-
/**
|
|
8
|
-
* #slot
|
|
9
|
-
*/
|
|
10
4
|
vcfLocation: {
|
|
11
5
|
type: 'fileLocation',
|
|
12
6
|
defaultValue: { uri: '/path/to/my.vcf', locationType: 'UriLocation' },
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function VcfAdapterF(pluginManager: PluginManager): void;
|
|
@@ -1,43 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
type
|
|
4
|
-
values: string[] | number[] | null;
|
|
5
|
-
}>>;
|
|
6
|
-
interface FeatureData {
|
|
7
|
-
[key: string]: unknown;
|
|
8
|
-
refName: string;
|
|
9
|
-
start: number;
|
|
10
|
-
end: number;
|
|
11
|
-
description?: string;
|
|
12
|
-
type?: string;
|
|
13
|
-
name?: string;
|
|
14
|
-
aliases?: string[];
|
|
15
|
-
samples?: Samples;
|
|
16
|
-
}
|
|
1
|
+
import type VCFParser from '@gmod/vcf';
|
|
2
|
+
import type { Variant } from '@gmod/vcf';
|
|
3
|
+
import type { Feature } from '@jbrowse/core/util';
|
|
17
4
|
export default class VCFFeature implements Feature {
|
|
18
5
|
private variant;
|
|
19
6
|
private parser;
|
|
20
7
|
private data;
|
|
21
8
|
private _id;
|
|
22
9
|
constructor(args: {
|
|
23
|
-
variant:
|
|
24
|
-
parser:
|
|
10
|
+
variant: Variant;
|
|
11
|
+
parser: VCFParser;
|
|
25
12
|
id: string;
|
|
26
13
|
});
|
|
27
14
|
get(field: string): any;
|
|
28
|
-
set(): void;
|
|
29
15
|
parent(): undefined;
|
|
30
16
|
children(): undefined;
|
|
31
|
-
tags(): string[];
|
|
32
17
|
id(): string;
|
|
33
|
-
dataFromVariant(variant: {
|
|
34
|
-
REF: string;
|
|
35
|
-
POS: number;
|
|
36
|
-
ALT?: string[];
|
|
37
|
-
CHROM: string;
|
|
38
|
-
INFO: any;
|
|
39
|
-
ID?: string[];
|
|
40
|
-
}): FeatureData;
|
|
41
18
|
toJSON(): any;
|
|
42
19
|
}
|
|
43
|
-
export {};
|
package/esm/VcfFeature/index.js
CHANGED
|
@@ -1,53 +1,62 @@
|
|
|
1
|
-
// locals
|
|
2
1
|
import { getSOTermAndDescription } from './util';
|
|
2
|
+
function dataFromVariant(variant, parser) {
|
|
3
|
+
const { REF = '', ALT, POS, CHROM, ID } = variant;
|
|
4
|
+
const start = POS - 1;
|
|
5
|
+
const [type, description] = getSOTermAndDescription(REF, ALT, parser);
|
|
6
|
+
return {
|
|
7
|
+
refName: CHROM,
|
|
8
|
+
start,
|
|
9
|
+
end: getEnd(variant),
|
|
10
|
+
description,
|
|
11
|
+
type,
|
|
12
|
+
name: ID === null || ID === void 0 ? void 0 : ID.join(','),
|
|
13
|
+
aliases: ID && ID.length > 1 ? ID.slice(1) : undefined,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function getEnd(variant) {
|
|
17
|
+
const { POS, REF = '', ALT } = variant;
|
|
18
|
+
const isTRA = ALT === null || ALT === void 0 ? void 0 : ALT.includes('<TRA>');
|
|
19
|
+
const start = POS - 1;
|
|
20
|
+
const isSymbolic = ALT === null || ALT === void 0 ? void 0 : ALT.some(f => f.includes('<'));
|
|
21
|
+
if (isSymbolic) {
|
|
22
|
+
const info = variant.INFO;
|
|
23
|
+
if (info.END && !isTRA) {
|
|
24
|
+
return +info.END[0];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return start + REF.length;
|
|
28
|
+
}
|
|
3
29
|
export default class VCFFeature {
|
|
4
30
|
constructor(args) {
|
|
5
31
|
this.variant = args.variant;
|
|
6
32
|
this.parser = args.parser;
|
|
7
|
-
this.data =
|
|
33
|
+
this.data = dataFromVariant(this.variant, this.parser);
|
|
8
34
|
this._id = args.id;
|
|
9
35
|
}
|
|
10
36
|
get(field) {
|
|
11
37
|
var _a;
|
|
12
38
|
return field === 'samples'
|
|
13
|
-
? this.variant.SAMPLES
|
|
14
|
-
:
|
|
39
|
+
? this.variant.SAMPLES()
|
|
40
|
+
: field === 'genotypes'
|
|
41
|
+
? this.variant.GENOTYPES()
|
|
42
|
+
: ((_a = this.data[field]) !== null && _a !== void 0 ? _a : this.variant[field]);
|
|
15
43
|
}
|
|
16
|
-
set() { }
|
|
17
44
|
parent() {
|
|
18
45
|
return undefined;
|
|
19
46
|
}
|
|
20
47
|
children() {
|
|
21
48
|
return undefined;
|
|
22
49
|
}
|
|
23
|
-
tags() {
|
|
24
|
-
return [...Object.keys(this.data), ...Object.keys(this.variant), 'samples'];
|
|
25
|
-
}
|
|
26
50
|
id() {
|
|
27
51
|
return this._id;
|
|
28
52
|
}
|
|
29
|
-
dataFromVariant(variant) {
|
|
30
|
-
const { REF, ALT, POS, CHROM, INFO, ID } = variant;
|
|
31
|
-
const start = POS - 1;
|
|
32
|
-
const [type, description] = getSOTermAndDescription(REF, ALT, this.parser);
|
|
33
|
-
const isTRA = ALT === null || ALT === void 0 ? void 0 : ALT.includes('<TRA>');
|
|
34
|
-
const isSymbolic = ALT === null || ALT === void 0 ? void 0 : ALT.some(f => f.includes('<'));
|
|
35
|
-
return {
|
|
36
|
-
refName: CHROM,
|
|
37
|
-
start,
|
|
38
|
-
end: isSymbolic && INFO.END && !isTRA ? +INFO.END[0] : start + REF.length,
|
|
39
|
-
description,
|
|
40
|
-
type,
|
|
41
|
-
name: ID === null || ID === void 0 ? void 0 : ID.join(','),
|
|
42
|
-
aliases: ID && ID.length > 1 ? ID.slice(1) : undefined,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
53
|
toJSON() {
|
|
54
|
+
const { SAMPLES, GENOTYPES, ...rest } = this.variant;
|
|
46
55
|
return {
|
|
47
56
|
uniqueId: this._id,
|
|
48
|
-
...
|
|
57
|
+
...rest,
|
|
49
58
|
...this.data,
|
|
50
|
-
samples: this.variant.SAMPLES,
|
|
59
|
+
samples: this.variant.SAMPLES(),
|
|
51
60
|
};
|
|
52
61
|
}
|
|
53
62
|
}
|
package/esm/VcfFeature/util.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import VCF from '@gmod/vcf';
|
|
2
|
-
/**
|
|
3
|
-
* Get a sequence ontology (SO) term that describes the variant type
|
|
4
|
-
*/
|
|
1
|
+
import type VCF from '@gmod/vcf';
|
|
5
2
|
export declare function getSOTermAndDescription(ref: string, alt: string[] | undefined, parser: VCF): string[];
|
|
6
3
|
export declare function getSOAndDescFromAltDefs(alt: string, parser: VCF): string[];
|
|
7
4
|
export declare function getSOAndDescByExamination(ref: string, alt: string): string[];
|
package/esm/VcfFeature/util.js
CHANGED
|
@@ -11,11 +11,7 @@ const altTypeToSO = {
|
|
|
11
11
|
NON_REF: 'sequence_variant',
|
|
12
12
|
'*': 'sequence_variant',
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
15
|
-
* Get a sequence ontology (SO) term that describes the variant type
|
|
16
|
-
*/
|
|
17
14
|
export function getSOTermAndDescription(ref, alt, parser) {
|
|
18
|
-
// it's just a remark if there are no alternate alleles
|
|
19
15
|
if (!alt || alt.length === 0) {
|
|
20
16
|
return ['remark', 'no alternative alleles'];
|
|
21
17
|
}
|
|
@@ -32,7 +28,6 @@ export function getSOTermAndDescription(ref, alt, parser) {
|
|
|
32
28
|
descriptions.add(description);
|
|
33
29
|
}
|
|
34
30
|
});
|
|
35
|
-
// Combine descriptions like ["SNV G -> A", "SNV G -> T"] to ["SNV G -> A,T"]
|
|
36
31
|
if (descriptions.size > 1) {
|
|
37
32
|
const descs = [...descriptions];
|
|
38
33
|
const prefixes = new Set(descs
|
|
@@ -60,26 +55,19 @@ export function getSOAndDescFromAltDefs(alt, parser) {
|
|
|
60
55
|
if (typeof alt === 'string' && !alt.startsWith('<')) {
|
|
61
56
|
return [];
|
|
62
57
|
}
|
|
63
|
-
// look for a definition with an SO type for this
|
|
64
58
|
let soTerm = altTypeToSO[alt];
|
|
65
|
-
// if no SO term but ALT is in metadata, assume sequence_variant
|
|
66
59
|
if (!soTerm && parser.getMetadata('ALT', alt)) {
|
|
67
60
|
soTerm = 'sequence_variant';
|
|
68
61
|
}
|
|
69
62
|
if (soTerm) {
|
|
70
63
|
return [soTerm, alt];
|
|
71
64
|
}
|
|
72
|
-
// try to look for a definition for a parent term if we can
|
|
73
65
|
const modAlt = alt.split(':');
|
|
74
66
|
if (modAlt.length > 1) {
|
|
75
67
|
return getSOAndDescFromAltDefs(`<${modAlt.slice(0, -1).join(':')}>`, parser);
|
|
76
68
|
}
|
|
77
|
-
// no parent
|
|
78
69
|
return [];
|
|
79
70
|
}
|
|
80
|
-
// note: term SNV is used instead of SNP because SO definition of SNP says
|
|
81
|
-
// abundance must be at least 1% in population, and can't be sure we meet
|
|
82
|
-
// that
|
|
83
71
|
export function getSOAndDescByExamination(ref, alt) {
|
|
84
72
|
const bnd = parseBreakend(alt);
|
|
85
73
|
if (bnd) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import { NoAssemblyRegion } from '@jbrowse/core/util/types';
|
|
3
|
-
import { Feature } from '@jbrowse/core/util';
|
|
4
1
|
import { TabixIndexedFile } from '@gmod/tabix';
|
|
5
2
|
import VcfParser from '@gmod/vcf';
|
|
3
|
+
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
|
+
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
5
|
+
import type { Feature } from '@jbrowse/core/util';
|
|
6
|
+
import type { NoAssemblyRegion } from '@jbrowse/core/util/types';
|
|
6
7
|
export default class VcfTabixAdapter extends BaseFeatureDataAdapter {
|
|
7
8
|
private configured?;
|
|
8
9
|
private configurePre;
|
|
@@ -14,5 +15,8 @@ export default class VcfTabixAdapter extends BaseFeatureDataAdapter {
|
|
|
14
15
|
getHeader(): Promise<string>;
|
|
15
16
|
getMetadata(): Promise<any>;
|
|
16
17
|
getFeatures(query: NoAssemblyRegion, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
18
|
+
getSources(): Promise<{
|
|
19
|
+
name: string;
|
|
20
|
+
}[]>;
|
|
17
21
|
freeResources(): void;
|
|
18
22
|
}
|