@jbrowse/plugin-variants 2.6.3 → 2.7.1

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.
Files changed (30) hide show
  1. package/dist/ChordVariantDisplay/models/stateModelFactory.d.ts +2 -6
  2. package/dist/StructuralVariantChordRenderer/Chord.d.ts +1 -3
  3. package/dist/StructuralVariantChordRenderer/ReactComponent.d.ts +2 -2
  4. package/dist/StructuralVariantChordRenderer/ReactComponent.js +2 -1
  5. package/dist/VariantFeatureWidget/AnnotGrid.js +6 -2
  6. package/dist/VariantFeatureWidget/BreakendOptionDialog.d.ts +2 -2
  7. package/dist/VariantFeatureWidget/BreakendOptionDialog.js +2 -1
  8. package/dist/VariantFeatureWidget/VariantFeatureWidget.d.ts +3 -4
  9. package/dist/VariantFeatureWidget/VariantFeatureWidget.js +17 -17
  10. package/dist/VariantFeatureWidget/VariantSampleGrid.d.ts +3 -5
  11. package/dist/VariantFeatureWidget/VariantSampleGrid.js +6 -2
  12. package/dist/VcfAdapter/VcfAdapter.d.ts +1 -3
  13. package/dist/VcfFeature/index.d.ts +3 -7
  14. package/dist/VcfFeature/util.js +19 -9
  15. package/esm/ChordVariantDisplay/models/stateModelFactory.d.ts +2 -6
  16. package/esm/ChordVariantDisplay/models/stateModelFactory.js +1 -1
  17. package/esm/StructuralVariantChordRenderer/Chord.d.ts +1 -3
  18. package/esm/StructuralVariantChordRenderer/ReactComponent.d.ts +2 -2
  19. package/esm/StructuralVariantChordRenderer/ReactComponent.js +2 -1
  20. package/esm/VariantFeatureWidget/AnnotGrid.js +2 -1
  21. package/esm/VariantFeatureWidget/BreakendOptionDialog.d.ts +2 -2
  22. package/esm/VariantFeatureWidget/BreakendOptionDialog.js +2 -1
  23. package/esm/VariantFeatureWidget/VariantFeatureWidget.d.ts +3 -4
  24. package/esm/VariantFeatureWidget/VariantFeatureWidget.js +17 -17
  25. package/esm/VariantFeatureWidget/VariantSampleGrid.d.ts +3 -5
  26. package/esm/VariantFeatureWidget/VariantSampleGrid.js +2 -1
  27. package/esm/VcfAdapter/VcfAdapter.d.ts +1 -3
  28. package/esm/VcfFeature/index.d.ts +3 -7
  29. package/esm/VcfFeature/util.js +19 -9
  30. package/package.json +3 -3
@@ -31,9 +31,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
31
31
  configuration: AnyConfigurationSchemaType;
32
32
  }, {
33
33
  rendererTypeName: string;
34
- error: unknown; /**
35
- * #property
36
- */
34
+ error: unknown;
37
35
  message: string | undefined;
38
36
  } & {
39
37
  readonly RenderingComponent: import("react").FC<{
@@ -43,9 +41,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
43
41
  rpcDriverName: string | undefined;
44
42
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
45
43
  rendererTypeName: string;
46
- error: unknown; /**
47
- * #method
48
- */
44
+ error: unknown;
49
45
  message: string | undefined;
50
46
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
51
47
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
@@ -20,9 +20,7 @@ export interface Block {
20
20
  }
21
21
  declare const Chord: ({ feature, blocksForRefs, radius, config, bezierRadius, selected, onClick, }: {
22
22
  feature: Feature;
23
- blocksForRefs: {
24
- [key: string]: Block;
25
- };
23
+ blocksForRefs: Record<string, Block>;
26
24
  radius: number;
27
25
  config: AnyConfigurationModel;
28
26
  bezierRadius: number;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Feature } from '@jbrowse/core/util';
3
3
  import { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
4
  import { Block, AnyRegion } from './Chord';
5
- declare const _default: ({ features, config, displayModel, blockDefinitions, radius, bezierRadius, displayModel: { selectedFeatureId }, onChordClick, }: {
5
+ declare const StructuralVariantChordsReactComponent: ({ features, config, displayModel, blockDefinitions, radius, bezierRadius, displayModel: { selectedFeatureId }, onChordClick, }: {
6
6
  features: Map<string, Feature>;
7
7
  radius: number;
8
8
  config: AnyConfigurationModel;
@@ -14,4 +14,4 @@ declare const _default: ({ features, config, displayModel, blockDefinitions, rad
14
14
  bezierRadius: number;
15
15
  onChordClick: (feature: Feature, reg: AnyRegion, endBlock: AnyRegion, evt: unknown) => void;
16
16
  }) => React.JSX.Element;
17
- export default _default;
17
+ export default StructuralVariantChordsReactComponent;
@@ -30,7 +30,7 @@ const react_1 = __importStar(require("react"));
30
30
  const mobx_react_1 = require("mobx-react");
31
31
  // locals
32
32
  const Chord_1 = __importDefault(require("./Chord"));
33
- exports.default = (0, mobx_react_1.observer)(function StructuralVariantChords({ features, config, displayModel, blockDefinitions, radius, bezierRadius, displayModel: { selectedFeatureId }, onChordClick, }) {
33
+ const StructuralVariantChordsReactComponent = (0, mobx_react_1.observer)(function ({ features, config, displayModel, blockDefinitions, radius, bezierRadius, displayModel: { selectedFeatureId }, onChordClick, }) {
34
34
  // make a map of refName -> blockDefinition
35
35
  const blocksForRefsMemo = (0, react_1.useMemo)(() => {
36
36
  const blocksForRefs = {};
@@ -60,3 +60,4 @@ exports.default = (0, mobx_react_1.observer)(function StructuralVariantChords({
60
60
  } }),
61
61
  chords));
62
62
  });
63
+ exports.default = StructuralVariantChordsReactComponent;
@@ -22,14 +22,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  const react_1 = __importStar(require("react"));
27
30
  const x_data_grid_1 = require("@mui/x-data-grid");
28
31
  const material_1 = require("@mui/material");
29
- const ResizeBar_1 = __importStar(require("@jbrowse/core/ui/ResizeBar"));
32
+ const ResizeBar_1 = __importDefault(require("@jbrowse/core/ui/ResizeBar"));
30
33
  const util_1 = require("@jbrowse/core/util");
34
+ const useResizeBar_1 = require("@jbrowse/core/ui/useResizeBar");
31
35
  function VariantAnnotPanel({ rows, columns, }) {
32
- const { ref, scrollLeft } = (0, ResizeBar_1.useResizeBar)();
36
+ const { ref, scrollLeft } = (0, useResizeBar_1.useResizeBar)();
33
37
  const [checked, setChecked] = (0, react_1.useState)(false);
34
38
  const [widths, setWidths] = (0, react_1.useState)(columns.map(e => (0, util_1.measureGridWidth)(rows.map(r => r[e.field]))));
35
39
  return rows.length ? (react_1.default.createElement("div", { ref: ref },
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { Feature } from '@jbrowse/core/util';
3
- declare const _default: ({ model, handleClose, feature, viewType, }: {
3
+ declare const BreakendOptionDialog: ({ model, handleClose, feature, viewType, }: {
4
4
  model: any;
5
5
  handleClose: () => void;
6
6
  feature: Feature;
7
7
  viewType: any;
8
8
  }) => React.JSX.Element;
9
- export default _default;
9
+ export default BreakendOptionDialog;
@@ -37,7 +37,7 @@ const useStyles = (0, mui_1.makeStyles)()({
37
37
  display: 'block',
38
38
  },
39
39
  });
40
- exports.default = (0, mobx_react_1.observer)(function BreakendOptionDialog({ model, handleClose, feature, viewType, }) {
40
+ const BreakendOptionDialog = (0, mobx_react_1.observer)(function ({ model, handleClose, feature, viewType, }) {
41
41
  const { classes } = useStyles();
42
42
  const [copyTracks, setCopyTracks] = (0, react_1.useState)(true);
43
43
  const [mirrorTracks, setMirrorTracks] = (0, react_1.useState)(true);
@@ -74,3 +74,4 @@ exports.default = (0, mobx_react_1.observer)(function BreakendOptionDialog({ mod
74
74
  }, variant: "contained", color: "primary", autoFocus: true }, "OK"),
75
75
  react_1.default.createElement(material_1.Button, { onClick: () => handleClose(), color: "secondary", variant: "contained" }, "Cancel"))));
76
76
  });
77
+ exports.default = BreakendOptionDialog;
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
2
  import { SimpleFeatureSerialized } from '@jbrowse/core/util';
3
- declare function VariantFeatureDetails(props: {
3
+ declare const VariantFeatureWidget: (props: {
4
4
  model: {
5
5
  featureData: SimpleFeatureSerialized;
6
6
  descriptions: Record<string, string>;
7
7
  };
8
- }): React.JSX.Element;
9
- declare const _default: typeof VariantFeatureDetails;
10
- export default _default;
8
+ }) => React.JSX.Element;
9
+ export default VariantFeatureWidget;
@@ -21,22 +21,6 @@ const basicDescriptions = {
21
21
  QUAL: 'quality: Phred-scaled quality score for the assertion made in ALT',
22
22
  FILTER: 'filter status: PASS if this position has passed all filters, otherwise a semicolon-separated list of codes for filters that fail',
23
23
  };
24
- function VariantFeatureDetails(props) {
25
- const { model } = props;
26
- const { featureData, descriptions } = model;
27
- const feat = JSON.parse(JSON.stringify(featureData));
28
- const { samples, ...rest } = feat;
29
- return (react_1.default.createElement(material_1.Paper, { "data-testid": "variant-side-drawer" },
30
- react_1.default.createElement(BaseFeatureDetail_1.FeatureDetails, { feature: rest, descriptions: { ...basicDescriptions, ...descriptions }, ...props }),
31
- react_1.default.createElement(material_1.Divider, null),
32
- react_1.default.createElement(CsqPanel, { feature: rest, descriptions: descriptions }),
33
- react_1.default.createElement(material_1.Divider, null),
34
- react_1.default.createElement(AnnPanel, { feature: rest, descriptions: descriptions }),
35
- react_1.default.createElement(material_1.Divider, null),
36
- feat.type === 'breakend' ? (react_1.default.createElement(BreakendPanel_1.default, { feature: feat, locStrings: feat.ALT.map((alt) => { var _a; return ((_a = (0, vcf_1.parseBreakend)(alt)) === null || _a === void 0 ? void 0 : _a.MatePosition) || ''; }), model: model })) : null,
37
- feat.type === 'translocation' ? (react_1.default.createElement(BreakendPanel_1.default, { feature: feat, model: model, locStrings: [`${feat.INFO.CHR2[0]}:${feat.INFO.END}`] })) : null,
38
- react_1.default.createElement(VariantSampleGrid_1.default, { feature: feat, ...props, descriptions: descriptions })));
39
- }
40
24
  function AnnPanel({ descriptions, feature, }) {
41
25
  var _a, _b, _c, _d;
42
26
  const annDesc = (_b = (_a = descriptions === null || descriptions === void 0 ? void 0 : descriptions.INFO) === null || _a === void 0 ? void 0 : _a.ANN) === null || _b === void 0 ? void 0 : _b.Description;
@@ -51,4 +35,20 @@ function CsqPanel({ descriptions, feature, }) {
51
35
  const csq = ((_d = feature.INFO) === null || _d === void 0 ? void 0 : _d.CSQ) || [];
52
36
  return (react_1.default.createElement(VariantAnnotationTable_1.default, { fields: csqFields, data: csq, title: "Variant CSQ field" }));
53
37
  }
54
- exports.default = (0, mobx_react_1.observer)(VariantFeatureDetails);
38
+ const VariantFeatureWidget = (0, mobx_react_1.observer)(function (props) {
39
+ const { model } = props;
40
+ const { featureData, descriptions } = model;
41
+ const feat = JSON.parse(JSON.stringify(featureData));
42
+ const { samples, ...rest } = feat;
43
+ return (react_1.default.createElement(material_1.Paper, { "data-testid": "variant-side-drawer" },
44
+ react_1.default.createElement(BaseFeatureDetail_1.FeatureDetails, { feature: rest, descriptions: { ...basicDescriptions, ...descriptions }, ...props }),
45
+ react_1.default.createElement(material_1.Divider, null),
46
+ react_1.default.createElement(CsqPanel, { feature: rest, descriptions: descriptions }),
47
+ react_1.default.createElement(material_1.Divider, null),
48
+ react_1.default.createElement(AnnPanel, { feature: rest, descriptions: descriptions }),
49
+ react_1.default.createElement(material_1.Divider, null),
50
+ feat.type === 'breakend' ? (react_1.default.createElement(BreakendPanel_1.default, { feature: feat, locStrings: feat.ALT.map((alt) => { var _a; return ((_a = (0, vcf_1.parseBreakend)(alt)) === null || _a === void 0 ? void 0 : _a.MatePosition) || ''; }), model: model })) : null,
51
+ feat.type === 'translocation' ? (react_1.default.createElement(BreakendPanel_1.default, { feature: feat, model: model, locStrings: [`${feat.INFO.CHR2[0]}:${feat.INFO.END}`] })) : null,
52
+ react_1.default.createElement(VariantSampleGrid_1.default, { feature: feat, ...props, descriptions: descriptions })));
53
+ });
54
+ exports.default = VariantFeatureWidget;
@@ -3,10 +3,8 @@ import { SimpleFeatureSerialized } from '@jbrowse/core/util';
3
3
  export default function VariantSamples(props: {
4
4
  feature: SimpleFeatureSerialized;
5
5
  descriptions: {
6
- FORMAT?: {
7
- [key: string]: {
8
- Description?: string;
9
- };
10
- };
6
+ FORMAT?: Record<string, {
7
+ Description?: string;
8
+ }>;
11
9
  };
12
10
  }): React.JSX.Element | null;
@@ -22,13 +22,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  const react_1 = __importStar(require("react"));
27
30
  const material_1 = require("@mui/material");
28
31
  const x_data_grid_1 = require("@mui/x-data-grid");
29
32
  const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
30
33
  const util_1 = require("@jbrowse/core/util");
31
- const ResizeBar_1 = __importStar(require("@jbrowse/core/ui/ResizeBar"));
34
+ const ResizeBar_1 = __importDefault(require("@jbrowse/core/ui/ResizeBar"));
35
+ const useResizeBar_1 = require("@jbrowse/core/ui/useResizeBar");
32
36
  function SampleFilters({ columns, filter, setFilter, }) {
33
37
  return (react_1.default.createElement(react_1.default.Fragment, null,
34
38
  react_1.default.createElement(material_1.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"),
@@ -37,7 +41,7 @@ function SampleFilters({ columns, filter, setFilter, }) {
37
41
  function VariantSamples(props) {
38
42
  var _a;
39
43
  const { feature, descriptions = {} } = props;
40
- const { ref, scrollLeft } = (0, ResizeBar_1.useResizeBar)();
44
+ const { ref, scrollLeft } = (0, useResizeBar_1.useResizeBar)();
41
45
  const [filter, setFilter] = (0, react_1.useState)({});
42
46
  const samples = (feature.samples || {});
43
47
  const preFilteredRows = Object.entries(samples);
@@ -11,9 +11,7 @@ export default class VcfAdapter extends BaseFeatureDataAdapter {
11
11
  getMetadata(): Promise<any>;
12
12
  setupP(): Promise<{
13
13
  header: string;
14
- intervalTree: {
15
- [key: string]: IntervalTree<any>;
16
- };
14
+ intervalTree: Record<string, IntervalTree<any>>;
17
15
  }>;
18
16
  setup(): Promise<{
19
17
  header: string;
@@ -1,12 +1,8 @@
1
1
  import { Feature } from '@jbrowse/core/util';
2
2
  import VCF from '@gmod/vcf';
3
- interface Samples {
4
- [key: string]: {
5
- [key: string]: {
6
- values: string[] | number[] | null;
7
- };
8
- };
9
- }
3
+ type Samples = Record<string, Record<string, {
4
+ values: string[] | number[] | null;
5
+ }>>;
10
6
  interface FeatureData {
11
7
  [key: string]: unknown;
12
8
  refName: string;
@@ -42,14 +42,14 @@ function getSOTermAndDescription(ref, alt, parser) {
42
42
  const prefix = desc.split('->');
43
43
  return prefix[1] ? prefix[0] : desc;
44
44
  }));
45
- descriptions = new Set([...prefixes].map(prefix => {
45
+ descriptions = new Set([...prefixes]
46
+ .map(r => r.trim())
47
+ .map(prefix => {
46
48
  const suffixes = descs
47
- .map(desc => {
48
- const pref = desc.split('-> ');
49
- return pref[1] && pref[0] === prefix ? pref[1] : '';
50
- })
49
+ .map(desc => desc.split('->').map(r => r.trim()))
50
+ .map(pref => (pref[1] && pref[0] === prefix ? pref[1] : ''))
51
51
  .filter(f => !!f);
52
- return suffixes.length ? prefix + '-> ' + suffixes.join(',') : prefix;
52
+ return suffixes.length ? `${prefix} -> ${suffixes.join(',')}` : prefix;
53
53
  }));
54
54
  }
55
55
  if (soTerms.size) {
@@ -98,7 +98,7 @@ function getSOAndDescByExamination(ref, alt) {
98
98
  return ['deletion', alt];
99
99
  }
100
100
  else if (alt === '<INV>') {
101
- return ['deletion', alt];
101
+ return ['inversion', alt];
102
102
  }
103
103
  else if (alt === '<TRA>') {
104
104
  return ['translocation', alt];
@@ -112,10 +112,20 @@ function getSOAndDescByExamination(ref, alt) {
112
112
  : ['substitution', makeDescriptionString('substitution', ref, alt)];
113
113
  }
114
114
  else if (ref.length <= alt.length) {
115
- return ['insertion', makeDescriptionString('insertion', ref, alt)];
115
+ const len = alt.length - ref.length;
116
+ const lena = len.toLocaleString('en-US');
117
+ return [
118
+ 'insertion',
119
+ len > 5 ? lena + 'bp INS' : makeDescriptionString('insertion', ref, alt),
120
+ ];
116
121
  }
117
122
  else if (ref.length > alt.length) {
118
- return ['deletion', makeDescriptionString('deletion', ref, alt)];
123
+ const len = ref.length - alt.length;
124
+ const lena = len.toLocaleString('en-US');
125
+ return [
126
+ 'deletion',
127
+ len > 5 ? lena + 'bp DEL' : makeDescriptionString('deletion', ref, alt),
128
+ ];
119
129
  }
120
130
  return ['indel', makeDescriptionString('indel', ref, alt)];
121
131
  }
@@ -31,9 +31,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
31
31
  configuration: AnyConfigurationSchemaType;
32
32
  }, {
33
33
  rendererTypeName: string;
34
- error: unknown; /**
35
- * #property
36
- */
34
+ error: unknown;
37
35
  message: string | undefined;
38
36
  } & {
39
37
  readonly RenderingComponent: import("react").FC<{
@@ -43,9 +41,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
43
41
  rpcDriverName: string | undefined;
44
42
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
45
43
  rendererTypeName: string;
46
- error: unknown; /**
47
- * #method
48
- */
44
+ error: unknown;
49
45
  message: string | undefined;
50
46
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
51
47
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
@@ -1,4 +1,4 @@
1
- import { BaseChordDisplayModel } from '@jbrowse/plugin-circular-view';
1
+ import { BaseChordDisplayModel, } from '@jbrowse/plugin-circular-view';
2
2
  import { ConfigurationReference, } from '@jbrowse/core/configuration';
3
3
  import { types } from 'mobx-state-tree';
4
4
  import { getContainingView } from '@jbrowse/core/util';
@@ -20,9 +20,7 @@ export interface Block {
20
20
  }
21
21
  declare const Chord: ({ feature, blocksForRefs, radius, config, bezierRadius, selected, onClick, }: {
22
22
  feature: Feature;
23
- blocksForRefs: {
24
- [key: string]: Block;
25
- };
23
+ blocksForRefs: Record<string, Block>;
26
24
  radius: number;
27
25
  config: AnyConfigurationModel;
28
26
  bezierRadius: number;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Feature } from '@jbrowse/core/util';
3
3
  import { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
4
  import { Block, AnyRegion } from './Chord';
5
- declare const _default: ({ features, config, displayModel, blockDefinitions, radius, bezierRadius, displayModel: { selectedFeatureId }, onChordClick, }: {
5
+ declare const StructuralVariantChordsReactComponent: ({ features, config, displayModel, blockDefinitions, radius, bezierRadius, displayModel: { selectedFeatureId }, onChordClick, }: {
6
6
  features: Map<string, Feature>;
7
7
  radius: number;
8
8
  config: AnyConfigurationModel;
@@ -14,4 +14,4 @@ declare const _default: ({ features, config, displayModel, blockDefinitions, rad
14
14
  bezierRadius: number;
15
15
  onChordClick: (feature: Feature, reg: AnyRegion, endBlock: AnyRegion, evt: unknown) => void;
16
16
  }) => React.JSX.Element;
17
- export default _default;
17
+ export default StructuralVariantChordsReactComponent;
@@ -2,7 +2,7 @@ import React, { useMemo } from 'react';
2
2
  import { observer } from 'mobx-react';
3
3
  // locals
4
4
  import Chord from './Chord';
5
- export default observer(function StructuralVariantChords({ features, config, displayModel, blockDefinitions, radius, bezierRadius, displayModel: { selectedFeatureId }, onChordClick, }) {
5
+ const StructuralVariantChordsReactComponent = observer(function ({ features, config, displayModel, blockDefinitions, radius, bezierRadius, displayModel: { selectedFeatureId }, onChordClick, }) {
6
6
  // make a map of refName -> blockDefinition
7
7
  const blocksForRefsMemo = useMemo(() => {
8
8
  const blocksForRefs = {};
@@ -32,3 +32,4 @@ export default observer(function StructuralVariantChords({ features, config, dis
32
32
  } }),
33
33
  chords));
34
34
  });
35
+ export default StructuralVariantChordsReactComponent;
@@ -1,8 +1,9 @@
1
1
  import React, { useState } from 'react';
2
2
  import { DataGrid, GridToolbar, } from '@mui/x-data-grid';
3
3
  import { Checkbox, FormControlLabel, Typography } from '@mui/material';
4
- import ResizeBar, { useResizeBar } from '@jbrowse/core/ui/ResizeBar';
4
+ import ResizeBar from '@jbrowse/core/ui/ResizeBar';
5
5
  import { measureGridWidth } from '@jbrowse/core/util';
6
+ import { useResizeBar } from '@jbrowse/core/ui/useResizeBar';
6
7
  export default function VariantAnnotPanel({ rows, columns, }) {
7
8
  const { ref, scrollLeft } = useResizeBar();
8
9
  const [checked, setChecked] = useState(false);
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { Feature } from '@jbrowse/core/util';
3
- declare const _default: ({ model, handleClose, feature, viewType, }: {
3
+ declare const BreakendOptionDialog: ({ model, handleClose, feature, viewType, }: {
4
4
  model: any;
5
5
  handleClose: () => void;
6
6
  feature: Feature;
7
7
  viewType: any;
8
8
  }) => React.JSX.Element;
9
- export default _default;
9
+ export default BreakendOptionDialog;
@@ -12,7 +12,7 @@ const useStyles = makeStyles()({
12
12
  display: 'block',
13
13
  },
14
14
  });
15
- export default observer(function BreakendOptionDialog({ model, handleClose, feature, viewType, }) {
15
+ const BreakendOptionDialog = observer(function ({ model, handleClose, feature, viewType, }) {
16
16
  const { classes } = useStyles();
17
17
  const [copyTracks, setCopyTracks] = useState(true);
18
18
  const [mirrorTracks, setMirrorTracks] = useState(true);
@@ -49,3 +49,4 @@ export default observer(function BreakendOptionDialog({ model, handleClose, feat
49
49
  }, variant: "contained", color: "primary", autoFocus: true }, "OK"),
50
50
  React.createElement(Button, { onClick: () => handleClose(), color: "secondary", variant: "contained" }, "Cancel"))));
51
51
  });
52
+ export default BreakendOptionDialog;
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
2
  import { SimpleFeatureSerialized } from '@jbrowse/core/util';
3
- declare function VariantFeatureDetails(props: {
3
+ declare const VariantFeatureWidget: (props: {
4
4
  model: {
5
5
  featureData: SimpleFeatureSerialized;
6
6
  descriptions: Record<string, string>;
7
7
  };
8
- }): React.JSX.Element;
9
- declare const _default: typeof VariantFeatureDetails;
10
- export default _default;
8
+ }) => React.JSX.Element;
9
+ export default VariantFeatureWidget;
@@ -16,22 +16,6 @@ const basicDescriptions = {
16
16
  QUAL: 'quality: Phred-scaled quality score for the assertion made in ALT',
17
17
  FILTER: 'filter status: PASS if this position has passed all filters, otherwise a semicolon-separated list of codes for filters that fail',
18
18
  };
19
- function VariantFeatureDetails(props) {
20
- const { model } = props;
21
- const { featureData, descriptions } = model;
22
- const feat = JSON.parse(JSON.stringify(featureData));
23
- const { samples, ...rest } = feat;
24
- return (React.createElement(Paper, { "data-testid": "variant-side-drawer" },
25
- React.createElement(FeatureDetails, { feature: rest, descriptions: { ...basicDescriptions, ...descriptions }, ...props }),
26
- React.createElement(Divider, null),
27
- React.createElement(CsqPanel, { feature: rest, descriptions: descriptions }),
28
- React.createElement(Divider, null),
29
- React.createElement(AnnPanel, { feature: rest, descriptions: descriptions }),
30
- React.createElement(Divider, null),
31
- feat.type === 'breakend' ? (React.createElement(BreakendPanel, { feature: feat, locStrings: feat.ALT.map((alt) => { var _a; return ((_a = parseBreakend(alt)) === null || _a === void 0 ? void 0 : _a.MatePosition) || ''; }), model: model })) : null,
32
- feat.type === 'translocation' ? (React.createElement(BreakendPanel, { feature: feat, model: model, locStrings: [`${feat.INFO.CHR2[0]}:${feat.INFO.END}`] })) : null,
33
- React.createElement(VariantSampleGrid, { feature: feat, ...props, descriptions: descriptions })));
34
- }
35
19
  function AnnPanel({ descriptions, feature, }) {
36
20
  var _a, _b, _c, _d;
37
21
  const annDesc = (_b = (_a = descriptions === null || descriptions === void 0 ? void 0 : descriptions.INFO) === null || _a === void 0 ? void 0 : _a.ANN) === null || _b === void 0 ? void 0 : _b.Description;
@@ -46,4 +30,20 @@ function CsqPanel({ descriptions, feature, }) {
46
30
  const csq = ((_d = feature.INFO) === null || _d === void 0 ? void 0 : _d.CSQ) || [];
47
31
  return (React.createElement(VariantAnnotationTable, { fields: csqFields, data: csq, title: "Variant CSQ field" }));
48
32
  }
49
- export default observer(VariantFeatureDetails);
33
+ const VariantFeatureWidget = observer(function (props) {
34
+ const { model } = props;
35
+ const { featureData, descriptions } = model;
36
+ const feat = JSON.parse(JSON.stringify(featureData));
37
+ const { samples, ...rest } = feat;
38
+ return (React.createElement(Paper, { "data-testid": "variant-side-drawer" },
39
+ React.createElement(FeatureDetails, { feature: rest, descriptions: { ...basicDescriptions, ...descriptions }, ...props }),
40
+ React.createElement(Divider, null),
41
+ React.createElement(CsqPanel, { feature: rest, descriptions: descriptions }),
42
+ React.createElement(Divider, null),
43
+ React.createElement(AnnPanel, { feature: rest, descriptions: descriptions }),
44
+ React.createElement(Divider, null),
45
+ feat.type === 'breakend' ? (React.createElement(BreakendPanel, { feature: feat, locStrings: feat.ALT.map((alt) => { var _a; return ((_a = parseBreakend(alt)) === null || _a === void 0 ? void 0 : _a.MatePosition) || ''; }), model: model })) : null,
46
+ feat.type === 'translocation' ? (React.createElement(BreakendPanel, { feature: feat, model: model, locStrings: [`${feat.INFO.CHR2[0]}:${feat.INFO.END}`] })) : null,
47
+ React.createElement(VariantSampleGrid, { feature: feat, ...props, descriptions: descriptions })));
48
+ });
49
+ export default VariantFeatureWidget;
@@ -3,10 +3,8 @@ import { SimpleFeatureSerialized } from '@jbrowse/core/util';
3
3
  export default function VariantSamples(props: {
4
4
  feature: SimpleFeatureSerialized;
5
5
  descriptions: {
6
- FORMAT?: {
7
- [key: string]: {
8
- Description?: string;
9
- };
10
- };
6
+ FORMAT?: Record<string, {
7
+ Description?: string;
8
+ }>;
11
9
  };
12
10
  }): React.JSX.Element | null;
@@ -3,7 +3,8 @@ import { FormControlLabel, Checkbox, TextField, Typography, } from '@mui/materia
3
3
  import { DataGrid, GridToolbar } from '@mui/x-data-grid';
4
4
  import { BaseCard } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
5
5
  import { measureGridWidth } from '@jbrowse/core/util';
6
- import ResizeBar, { useResizeBar } from '@jbrowse/core/ui/ResizeBar';
6
+ import ResizeBar from '@jbrowse/core/ui/ResizeBar';
7
+ import { useResizeBar } from '@jbrowse/core/ui/useResizeBar';
7
8
  function SampleFilters({ columns, filter, setFilter, }) {
8
9
  return (React.createElement(React.Fragment, null,
9
10
  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"),
@@ -11,9 +11,7 @@ export default class VcfAdapter extends BaseFeatureDataAdapter {
11
11
  getMetadata(): Promise<any>;
12
12
  setupP(): Promise<{
13
13
  header: string;
14
- intervalTree: {
15
- [key: string]: IntervalTree<any>;
16
- };
14
+ intervalTree: Record<string, IntervalTree<any>>;
17
15
  }>;
18
16
  setup(): Promise<{
19
17
  header: string;
@@ -1,12 +1,8 @@
1
1
  import { Feature } from '@jbrowse/core/util';
2
2
  import VCF from '@gmod/vcf';
3
- interface Samples {
4
- [key: string]: {
5
- [key: string]: {
6
- values: string[] | number[] | null;
7
- };
8
- };
9
- }
3
+ type Samples = Record<string, Record<string, {
4
+ values: string[] | number[] | null;
5
+ }>>;
10
6
  interface FeatureData {
11
7
  [key: string]: unknown;
12
8
  refName: string;
@@ -39,14 +39,14 @@ export function getSOTermAndDescription(ref, alt, parser) {
39
39
  const prefix = desc.split('->');
40
40
  return prefix[1] ? prefix[0] : desc;
41
41
  }));
42
- descriptions = new Set([...prefixes].map(prefix => {
42
+ descriptions = new Set([...prefixes]
43
+ .map(r => r.trim())
44
+ .map(prefix => {
43
45
  const suffixes = descs
44
- .map(desc => {
45
- const pref = desc.split('-> ');
46
- return pref[1] && pref[0] === prefix ? pref[1] : '';
47
- })
46
+ .map(desc => desc.split('->').map(r => r.trim()))
47
+ .map(pref => (pref[1] && pref[0] === prefix ? pref[1] : ''))
48
48
  .filter(f => !!f);
49
- return suffixes.length ? prefix + '-> ' + suffixes.join(',') : prefix;
49
+ return suffixes.length ? `${prefix} -> ${suffixes.join(',')}` : prefix;
50
50
  }));
51
51
  }
52
52
  if (soTerms.size) {
@@ -93,7 +93,7 @@ export function getSOAndDescByExamination(ref, alt) {
93
93
  return ['deletion', alt];
94
94
  }
95
95
  else if (alt === '<INV>') {
96
- return ['deletion', alt];
96
+ return ['inversion', alt];
97
97
  }
98
98
  else if (alt === '<TRA>') {
99
99
  return ['translocation', alt];
@@ -107,10 +107,20 @@ export function getSOAndDescByExamination(ref, alt) {
107
107
  : ['substitution', makeDescriptionString('substitution', ref, alt)];
108
108
  }
109
109
  else if (ref.length <= alt.length) {
110
- return ['insertion', makeDescriptionString('insertion', ref, alt)];
110
+ const len = alt.length - ref.length;
111
+ const lena = len.toLocaleString('en-US');
112
+ return [
113
+ 'insertion',
114
+ len > 5 ? lena + 'bp INS' : makeDescriptionString('insertion', ref, alt),
115
+ ];
111
116
  }
112
117
  else if (ref.length > alt.length) {
113
- return ['deletion', makeDescriptionString('deletion', ref, alt)];
118
+ const len = ref.length - alt.length;
119
+ const lena = len.toLocaleString('en-US');
120
+ return [
121
+ 'deletion',
122
+ len > 5 ? lena + 'bp DEL' : makeDescriptionString('deletion', ref, alt),
123
+ ];
114
124
  }
115
125
  return ['indel', makeDescriptionString('indel', ref, alt)];
116
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-variants",
3
- "version": "2.6.3",
3
+ "version": "2.7.1",
4
4
  "description": "JBrowse 2 variant adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -51,7 +51,7 @@
51
51
  "@jbrowse/plugin-linear-genome-view": "^2.0.0",
52
52
  "@mui/material": "^5.0.0",
53
53
  "mobx": "^6.0.0",
54
- "mobx-react": "^7.0.0",
54
+ "mobx-react": "^9.0.0",
55
55
  "mobx-state-tree": "^5.0.0",
56
56
  "react": ">=16.8.0",
57
57
  "rxjs": "^7.0.0",
@@ -63,5 +63,5 @@
63
63
  "distModule": "esm/index.js",
64
64
  "srcModule": "src/index.ts",
65
65
  "module": "esm/index.js",
66
- "gitHead": "ed402c87efb0904858d602c363bd1757d5742129"
66
+ "gitHead": "2cda1611eebd12517f2a3cfc1b612face27005d4"
67
67
  }