@jbrowse/plugin-breakpoint-split-view 2.10.1 → 2.10.3

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.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ExportSvgOptions } from '../model';
3
- export default function ExportSvgDlg({ model, handleClose, }: {
3
+ export default function ExportSvgDialog({ model, handleClose, }: {
4
4
  model: {
5
5
  exportSvg(opts: ExportSvgOptions): Promise<void>;
6
6
  };
@@ -35,7 +35,7 @@ function LoadingMessage() {
35
35
  function useSvgLocal(key, val) {
36
36
  return (0, util_1.useLocalStorage)('svg-' + key, val);
37
37
  }
38
- function ExportSvgDlg({ model, handleClose, }) {
38
+ function ExportSvgDialog({ model, handleClose, }) {
39
39
  const session = (0, util_1.getSession)(model);
40
40
  const offscreenCanvas = typeof OffscreenCanvas !== 'undefined';
41
41
  const [rasterizeLayers, setRasterizeLayers] = (0, react_1.useState)(offscreenCanvas);
@@ -80,4 +80,4 @@ function ExportSvgDlg({ model, handleClose, }) {
80
80
  }
81
81
  } }, "Submit"))));
82
82
  }
83
- exports.default = ExportSvgDlg;
83
+ exports.default = ExportSvgDialog;
@@ -31,6 +31,17 @@ const mobx_state_tree_1 = require("mobx-state-tree");
31
31
  const util_2 = require("./util");
32
32
  const util_3 = require("../util");
33
33
  const [LEFT] = [0, 1, 2, 3];
34
+ function str(s) {
35
+ if (s === '+') {
36
+ return 1;
37
+ }
38
+ else if (s === '-') {
39
+ return -1;
40
+ }
41
+ else {
42
+ return 0;
43
+ }
44
+ }
34
45
  const Translocations = (0, mobx_react_1.observer)(function ({ model, trackId, parentRef: ref, getTrackYPosOverride, }) {
35
46
  const { views } = model;
36
47
  const session = (0, util_1.getSession)(model);
@@ -57,6 +68,7 @@ const Translocations = (0, mobx_react_1.observer)(function ({ model, trackId, pa
57
68
  return null;
58
69
  }
59
70
  return (react_1.default.createElement("g", { fill: "none", stroke: "green", strokeWidth: 5, "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId }, layoutMatches.map(chunk => {
71
+ var _a, _b;
60
72
  // we follow a path in the list of chunks, not from top to bottom,
61
73
  // just in series following x1,y1 -> x2,y2
62
74
  const ret = [];
@@ -69,7 +81,8 @@ const Translocations = (0, mobx_react_1.observer)(function ({ model, trackId, pa
69
81
  const info = f1.get('INFO');
70
82
  const chr2 = info.CHR2[0];
71
83
  const end2 = info.END[0];
72
- const [myDirection, mateDirection] = info.STRANDS[0].split('');
84
+ const res = (_b = (_a = info.STRANDS) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.split(''); // not all files have STRANDS
85
+ const [myDirection, mateDirection] = res !== null && res !== void 0 ? res : ['.', '.'];
73
86
  const r = (0, util_3.getPxFromCoordinate)(views[level2], chr2, end2);
74
87
  if (r) {
75
88
  const c2 = [r, 0, r + 1, 0];
@@ -84,7 +97,7 @@ const Translocations = (0, mobx_react_1.observer)(function ({ model, trackId, pa
84
97
  yOffset;
85
98
  const path = [
86
99
  'M', // move to
87
- x1 - 20 * (myDirection === '+' ? 1 : -1) * (reversed1 ? -1 : 1),
100
+ x1 - 20 * str(myDirection) * (reversed1 ? -1 : 1),
88
101
  y1,
89
102
  'L', // line to
90
103
  x1,
@@ -93,7 +106,7 @@ const Translocations = (0, mobx_react_1.observer)(function ({ model, trackId, pa
93
106
  x2,
94
107
  y2,
95
108
  'L', // line to
96
- x2 - 20 * (mateDirection === '+' ? 1 : -1) * (reversed2 ? -1 : 1),
109
+ x2 - 20 * str(mateDirection) * (reversed2 ? -1 : 1),
97
110
  y2,
98
111
  ].join(' ');
99
112
  ret.push(react_1.default.createElement("path", { d: path, key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
@@ -70,6 +70,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
70
70
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
71
71
  trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
72
72
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
73
+ highlight: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<Required<import("@jbrowse/core/util").ParsedLocString>, Required<import("@jbrowse/core/util").ParsedLocString>, Required<import("@jbrowse/core/util").ParsedLocString>>>;
73
74
  }, {
74
75
  width: number;
75
76
  } & {
@@ -81,16 +82,21 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
81
82
  } & {
82
83
  volatileWidth: number | undefined;
83
84
  minimumBlockWidth: number;
85
+ /**
86
+ * #action
87
+ */
84
88
  draggingTrackId: string | undefined;
85
89
  volatileError: unknown;
86
90
  afterDisplayedRegionsSetCallbacks: Function[];
87
- scaleFactor: number;
91
+ scaleFactor: number; /**
92
+ * #action
93
+ */
88
94
  trackRefs: Record<string, HTMLDivElement>;
89
95
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
90
- coarseTotalBp: number;
91
- leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined; /**
96
+ coarseTotalBp: number; /**
92
97
  * #action
93
98
  */
99
+ leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
94
100
  rightOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
95
101
  } & {
96
102
  readonly trackLabelsSetting: any;
@@ -130,10 +136,11 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
130
136
  setShowCytobands(flag: boolean): void;
131
137
  setWidth(newWidth: number): void;
132
138
  setError(error: unknown): void;
133
- toggleHeader(): void;
134
- toggleHeaderOverview(): void;
135
- toggleNoTracksActive(): void;
136
- toggleShowGridlines(): void;
139
+ setHideHeader(b: boolean): void;
140
+ setHideHeaderOverview(b: boolean): void;
141
+ setHideNoTracksActive(b: boolean): void;
142
+ setShowGridlines(b: boolean): void;
143
+ setHighlight(highlight: Required<import("@jbrowse/core/util").ParsedLocString> | undefined): void;
137
144
  scrollTo(offsetPx: number): number;
138
145
  zoomTo(bpPerPx: number, offset?: number, centerAtOffset?: boolean): number;
139
146
  setOffsets(left?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined, right?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined): void;
@@ -147,7 +154,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
147
154
  closeView(): void;
148
155
  toggleTrack(trackId: string): boolean;
149
156
  setTrackLabels(setting: "hidden" | "offset" | "overlapping"): void;
150
- toggleCenterLine(): void;
157
+ setShowCenterLine(b: boolean): void;
151
158
  setDisplayedRegions(regions: import("@jbrowse/core/util").Region[]): void;
152
159
  activateTrackSelector(): import("@jbrowse/core/util").Widget;
153
160
  getSelectedRegions(leftOffset?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined, rightOffset?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined): {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ExportSvgOptions } from '../model';
3
- export default function ExportSvgDlg({ model, handleClose, }: {
3
+ export default function ExportSvgDialog({ model, handleClose, }: {
4
4
  model: {
5
5
  exportSvg(opts: ExportSvgOptions): Promise<void>;
6
6
  };
@@ -10,7 +10,7 @@ function LoadingMessage() {
10
10
  function useSvgLocal(key, val) {
11
11
  return useLocalStorage('svg-' + key, val);
12
12
  }
13
- export default function ExportSvgDlg({ model, handleClose, }) {
13
+ export default function ExportSvgDialog({ model, handleClose, }) {
14
14
  const session = getSession(model);
15
15
  const offscreenCanvas = typeof OffscreenCanvas !== 'undefined';
16
16
  const [rasterizeLayers, setRasterizeLayers] = useState(offscreenCanvas);
@@ -6,6 +6,17 @@ import { getSnapshot } from 'mobx-state-tree';
6
6
  import { getMatchedTranslocationFeatures } from './util';
7
7
  import { yPos, getPxFromCoordinate, useNextFrame } from '../util';
8
8
  const [LEFT] = [0, 1, 2, 3];
9
+ function str(s) {
10
+ if (s === '+') {
11
+ return 1;
12
+ }
13
+ else if (s === '-') {
14
+ return -1;
15
+ }
16
+ else {
17
+ return 0;
18
+ }
19
+ }
9
20
  const Translocations = observer(function ({ model, trackId, parentRef: ref, getTrackYPosOverride, }) {
10
21
  const { views } = model;
11
22
  const session = getSession(model);
@@ -32,6 +43,7 @@ const Translocations = observer(function ({ model, trackId, parentRef: ref, getT
32
43
  return null;
33
44
  }
34
45
  return (React.createElement("g", { fill: "none", stroke: "green", strokeWidth: 5, "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId }, layoutMatches.map(chunk => {
46
+ var _a, _b;
35
47
  // we follow a path in the list of chunks, not from top to bottom,
36
48
  // just in series following x1,y1 -> x2,y2
37
49
  const ret = [];
@@ -44,7 +56,8 @@ const Translocations = observer(function ({ model, trackId, parentRef: ref, getT
44
56
  const info = f1.get('INFO');
45
57
  const chr2 = info.CHR2[0];
46
58
  const end2 = info.END[0];
47
- const [myDirection, mateDirection] = info.STRANDS[0].split('');
59
+ const res = (_b = (_a = info.STRANDS) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.split(''); // not all files have STRANDS
60
+ const [myDirection, mateDirection] = res !== null && res !== void 0 ? res : ['.', '.'];
48
61
  const r = getPxFromCoordinate(views[level2], chr2, end2);
49
62
  if (r) {
50
63
  const c2 = [r, 0, r + 1, 0];
@@ -59,7 +72,7 @@ const Translocations = observer(function ({ model, trackId, parentRef: ref, getT
59
72
  yOffset;
60
73
  const path = [
61
74
  'M', // move to
62
- x1 - 20 * (myDirection === '+' ? 1 : -1) * (reversed1 ? -1 : 1),
75
+ x1 - 20 * str(myDirection) * (reversed1 ? -1 : 1),
63
76
  y1,
64
77
  'L', // line to
65
78
  x1,
@@ -68,7 +81,7 @@ const Translocations = observer(function ({ model, trackId, parentRef: ref, getT
68
81
  x2,
69
82
  y2,
70
83
  'L', // line to
71
- x2 - 20 * (mateDirection === '+' ? 1 : -1) * (reversed2 ? -1 : 1),
84
+ x2 - 20 * str(mateDirection) * (reversed2 ? -1 : 1),
72
85
  y2,
73
86
  ].join(' ');
74
87
  ret.push(React.createElement("path", { d: path, key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
@@ -70,6 +70,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
70
70
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
71
71
  trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
72
72
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
73
+ highlight: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<Required<import("@jbrowse/core/util").ParsedLocString>, Required<import("@jbrowse/core/util").ParsedLocString>, Required<import("@jbrowse/core/util").ParsedLocString>>>;
73
74
  }, {
74
75
  width: number;
75
76
  } & {
@@ -81,16 +82,21 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
81
82
  } & {
82
83
  volatileWidth: number | undefined;
83
84
  minimumBlockWidth: number;
85
+ /**
86
+ * #action
87
+ */
84
88
  draggingTrackId: string | undefined;
85
89
  volatileError: unknown;
86
90
  afterDisplayedRegionsSetCallbacks: Function[];
87
- scaleFactor: number;
91
+ scaleFactor: number; /**
92
+ * #action
93
+ */
88
94
  trackRefs: Record<string, HTMLDivElement>;
89
95
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
90
- coarseTotalBp: number;
91
- leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined; /**
96
+ coarseTotalBp: number; /**
92
97
  * #action
93
98
  */
99
+ leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
94
100
  rightOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
95
101
  } & {
96
102
  readonly trackLabelsSetting: any;
@@ -130,10 +136,11 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
130
136
  setShowCytobands(flag: boolean): void;
131
137
  setWidth(newWidth: number): void;
132
138
  setError(error: unknown): void;
133
- toggleHeader(): void;
134
- toggleHeaderOverview(): void;
135
- toggleNoTracksActive(): void;
136
- toggleShowGridlines(): void;
139
+ setHideHeader(b: boolean): void;
140
+ setHideHeaderOverview(b: boolean): void;
141
+ setHideNoTracksActive(b: boolean): void;
142
+ setShowGridlines(b: boolean): void;
143
+ setHighlight(highlight: Required<import("@jbrowse/core/util").ParsedLocString> | undefined): void;
137
144
  scrollTo(offsetPx: number): number;
138
145
  zoomTo(bpPerPx: number, offset?: number, centerAtOffset?: boolean): number;
139
146
  setOffsets(left?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined, right?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined): void;
@@ -147,7 +154,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
147
154
  closeView(): void;
148
155
  toggleTrack(trackId: string): boolean;
149
156
  setTrackLabels(setting: "hidden" | "offset" | "overlapping"): void;
150
- toggleCenterLine(): void;
157
+ setShowCenterLine(b: boolean): void;
151
158
  setDisplayedRegions(regions: import("@jbrowse/core/util").Region[]): void;
152
159
  activateTrackSelector(): import("@jbrowse/core/util").Widget;
153
160
  getSelectedRegions(leftOffset?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined, rightOffset?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-breakpoint-split-view",
3
- "version": "2.10.1",
3
+ "version": "2.10.3",
4
4
  "description": "JBrowse 2 breakpoint detail split view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "442b5f87efddfdf4ccf520b4d9dd01ddd370cb07"
61
+ "gitHead": "c8fc800cd17decd72b2e971c7a6add3b95214e72"
62
62
  }