@jbrowse/plugin-breakpoint-split-view 3.4.0 → 3.5.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.
@@ -21,7 +21,7 @@ const useStyles = (0, mui_1.makeStyles)()({
21
21
  base: {
22
22
  pointerEvents: 'none',
23
23
  width: '100%',
24
- zIndex: 1001,
24
+ zIndex: 100,
25
25
  },
26
26
  });
27
27
  const BreakpointSplitViewOverlay = (0, mobx_react_1.observer)(function ({ model, }) {
@@ -0,0 +1 @@
1
+ export declare function getClip(cigar: string, strand: number): number;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getClip = getClip;
4
+ const startClip = new RegExp(/(\d+)[SH]$/);
5
+ const endClip = new RegExp(/^(\d+)([SH])/);
6
+ function getClip(cigar, strand) {
7
+ return strand === -1
8
+ ? +(startClip.exec(cigar) || [])[1] || 0
9
+ : +(endClip.exec(cigar) || [])[1] || 0;
10
+ }
@@ -63,7 +63,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
63
63
  readonly width: number;
64
64
  readonly interRegionPaddingWidth: number;
65
65
  readonly assemblyNames: string[];
66
- readonly stickyViewHeaders: boolean;
66
+ readonly assemblyDisplayNames: string[];
67
+ readonly isTopLevelView: import("@jbrowse/core/util").AbstractViewModel | undefined;
68
+ readonly stickyViewHeaders: boolean | undefined;
67
69
  readonly rubberbandTop: number;
68
70
  readonly pinnedTracksTop: number;
69
71
  } & {
@@ -45,15 +45,15 @@ const PhotoCamera_1 = __importDefault(require("@mui/icons-material/PhotoCamera")
45
45
  const file_saver_1 = require("file-saver");
46
46
  const mobx_1 = require("mobx");
47
47
  const mobx_state_tree_1 = require("mobx-state-tree");
48
+ const getClip_1 = require("./getClip");
48
49
  const util_2 = require("./util");
49
50
  const ExportSvgDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/ExportSvgDialog'))));
50
51
  function stateModelFactory(pluginManager) {
51
- const minHeight = 40;
52
52
  const defaultHeight = 400;
53
53
  return mobx_state_tree_1.types
54
54
  .compose('BreakpointSplitView', models_1.BaseViewModel, mobx_state_tree_1.types.model({
55
55
  type: mobx_state_tree_1.types.literal('BreakpointSplitView'),
56
- height: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.refinement('viewHeight', mobx_state_tree_1.types.number, (n) => n >= minHeight), defaultHeight),
56
+ height: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, defaultHeight),
57
57
  trackSelectorType: 'hierarchical',
58
58
  showIntraviewLinks: true,
59
59
  linkViews: false,
@@ -104,7 +104,7 @@ function stateModelFactory(pluginManager) {
104
104
  feature,
105
105
  layout: (0, util_2.calc)(tracks[level], feature),
106
106
  level,
107
- clipPos: (0, util_2.getClip)(feature.get('CIGAR'), feature.get('strand')),
107
+ clipPos: (0, getClip_1.getClip)(feature.get('CIGAR'), feature.get('strand')),
108
108
  }
109
109
  : undefined;
110
110
  })
@@ -168,6 +168,9 @@ function stateModelFactory(pluginManager) {
168
168
  if (!self.views.every(view => view.initialized)) {
169
169
  return;
170
170
  }
171
+ if (self.matchedTracks.some(track => { var _a, _b; return (_b = (_a = track.displays[0]).notReady) === null || _b === void 0 ? void 0 : _b.call(_a); })) {
172
+ return;
173
+ }
171
174
  self.setMatchedTrackFeatures(Object.fromEntries(await Promise.all(self.matchedTracks.map(async (track) => [
172
175
  track.configuration.trackId,
173
176
  await (0, util_2.getBlockFeatures)(self, track),
@@ -9,21 +9,20 @@ interface Display {
9
9
  SNPCoverageDisplay?: {
10
10
  height: number;
11
11
  };
12
+ notReady?: () => boolean;
12
13
  searchFeatureByID?: (str: string) => LayoutRecord;
13
14
  }
14
15
  interface Track {
15
16
  displays: Display[];
17
+ configuration: AnyConfigurationModel;
16
18
  }
17
19
  export declare function heightFromSpecificLevel(views: LGV[], trackId: string, level: number, getYPosOverride?: (trackId: string, level: number) => number): number;
18
20
  export declare function getPxFromCoordinate(view: LGV, refName: string, coord: number): number;
19
21
  export declare function yPos(trackId: string, level: number, views: LGV[], tracks: Track[], c: LayoutRecord, getYPosOverride?: (trackId: string, level: number) => number): number;
20
22
  export declare const useNextFrame: (variable: unknown) => void;
21
23
  export declare function intersect<T>(cb: (l: T) => string, a1?: T[], a2?: T[], ...rest: T[][]): T[];
22
- export declare function getClip(cigar: string, strand: number): number;
23
24
  export declare function calc(track: Track, f: Feature): LayoutRecord | undefined;
24
25
  export declare function getBlockFeatures(model: {
25
26
  views: LinearGenomeViewModel[];
26
- }, track: {
27
- configuration: AnyConfigurationModel;
28
- }): Promise<Feature[][] | undefined>;
27
+ }, track: Track): Promise<Feature[][][]>;
29
28
  export {};
@@ -5,12 +5,12 @@ exports.heightFromSpecificLevel = heightFromSpecificLevel;
5
5
  exports.getPxFromCoordinate = getPxFromCoordinate;
6
6
  exports.yPos = yPos;
7
7
  exports.intersect = intersect;
8
- exports.getClip = getClip;
9
8
  exports.calc = calc;
10
9
  exports.getBlockFeatures = getBlockFeatures;
11
10
  const react_1 = require("react");
12
11
  const configuration_1 = require("@jbrowse/core/configuration");
13
12
  const util_1 = require("@jbrowse/core/util");
13
+ const tracks_1 = require("@jbrowse/core/util/tracks");
14
14
  const [, TOP, , BOTTOM] = [0, 1, 2, 3];
15
15
  function cheight(chunk) {
16
16
  return chunk[BOTTOM] - chunk[TOP];
@@ -51,33 +51,17 @@ function intersect(cb, a1 = [], a2 = [], ...rest) {
51
51
  const a12 = a1.filter(value => ids.has(cb(value)));
52
52
  return rest.length === 0 ? a12 : intersect(cb, a12, ...rest);
53
53
  }
54
- const startClip = new RegExp(/(\d+)[SH]$/);
55
- const endClip = new RegExp(/^(\d+)([SH])/);
56
- function getClip(cigar, strand) {
57
- return strand === -1
58
- ? +(startClip.exec(cigar) || [])[1] || 0
59
- : +(endClip.exec(cigar) || [])[1] || 0;
60
- }
61
54
  function calc(track, f) {
62
55
  var _a, _b;
63
56
  return (_b = (_a = track.displays[0]).searchFeatureByID) === null || _b === void 0 ? void 0 : _b.call(_a, f.id());
64
57
  }
65
58
  async function getBlockFeatures(model, track) {
66
- var _a;
67
59
  const { views } = model;
68
- const { rpcManager, assemblyManager } = (0, util_1.getSession)(model);
69
- const assemblyName = (_a = model.views[0]) === null || _a === void 0 ? void 0 : _a.assemblyNames[0];
70
- if (!assemblyName) {
71
- return undefined;
72
- }
73
- const assembly = await assemblyManager.waitForAssembly(assemblyName);
74
- if (!assembly) {
75
- return undefined;
76
- }
77
- const sessionId = track.configuration.trackId;
78
- return Promise.all(views.map(async (view) => (await rpcManager.call(sessionId, 'CoreGetFeatures', {
60
+ const { rpcManager } = (0, util_1.getSession)(model);
61
+ const sessionId = (0, tracks_1.getRpcSessionId)(track);
62
+ return Promise.all(views.flatMap(async (view) => (await rpcManager.call(sessionId, 'CoreGetFeatures', {
79
63
  adapterConfig: (0, configuration_1.getConf)(track, ['adapter']),
80
64
  sessionId,
81
65
  regions: view.staticBlocks.contentBlocks,
82
- })).flat()));
66
+ }))));
83
67
  }
@@ -16,7 +16,7 @@ const useStyles = makeStyles()({
16
16
  base: {
17
17
  pointerEvents: 'none',
18
18
  width: '100%',
19
- zIndex: 1001,
19
+ zIndex: 100,
20
20
  },
21
21
  });
22
22
  const BreakpointSplitViewOverlay = observer(function ({ model, }) {
@@ -0,0 +1 @@
1
+ export declare function getClip(cigar: string, strand: number): number;
@@ -0,0 +1,7 @@
1
+ const startClip = new RegExp(/(\d+)[SH]$/);
2
+ const endClip = new RegExp(/^(\d+)([SH])/);
3
+ export function getClip(cigar, strand) {
4
+ return strand === -1
5
+ ? +(startClip.exec(cigar) || [])[1] || 0
6
+ : +(endClip.exec(cigar) || [])[1] || 0;
7
+ }
@@ -63,7 +63,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
63
63
  readonly width: number;
64
64
  readonly interRegionPaddingWidth: number;
65
65
  readonly assemblyNames: string[];
66
- readonly stickyViewHeaders: boolean;
66
+ readonly assemblyDisplayNames: string[];
67
+ readonly isTopLevelView: import("@jbrowse/core/util").AbstractViewModel | undefined;
68
+ readonly stickyViewHeaders: boolean | undefined;
67
69
  readonly rubberbandTop: number;
68
70
  readonly pinnedTracksTop: number;
69
71
  } & {
@@ -6,15 +6,15 @@ import PhotoCamera from '@mui/icons-material/PhotoCamera';
6
6
  import { saveAs } from 'file-saver';
7
7
  import { autorun } from 'mobx';
8
8
  import { addDisposer, getPath, onAction, types } from 'mobx-state-tree';
9
- import { calc, getBlockFeatures, getClip, intersect } from './util';
9
+ import { getClip } from './getClip';
10
+ import { calc, getBlockFeatures, intersect } from './util';
10
11
  const ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'));
11
12
  export default function stateModelFactory(pluginManager) {
12
- const minHeight = 40;
13
13
  const defaultHeight = 400;
14
14
  return types
15
15
  .compose('BreakpointSplitView', BaseViewModel, types.model({
16
16
  type: types.literal('BreakpointSplitView'),
17
- height: types.optional(types.refinement('viewHeight', types.number, (n) => n >= minHeight), defaultHeight),
17
+ height: types.optional(types.number, defaultHeight),
18
18
  trackSelectorType: 'hierarchical',
19
19
  showIntraviewLinks: true,
20
20
  linkViews: false,
@@ -129,6 +129,9 @@ export default function stateModelFactory(pluginManager) {
129
129
  if (!self.views.every(view => view.initialized)) {
130
130
  return;
131
131
  }
132
+ if (self.matchedTracks.some(track => { var _a, _b; return (_b = (_a = track.displays[0]).notReady) === null || _b === void 0 ? void 0 : _b.call(_a); })) {
133
+ return;
134
+ }
132
135
  self.setMatchedTrackFeatures(Object.fromEntries(await Promise.all(self.matchedTracks.map(async (track) => [
133
136
  track.configuration.trackId,
134
137
  await getBlockFeatures(self, track),
@@ -9,21 +9,20 @@ interface Display {
9
9
  SNPCoverageDisplay?: {
10
10
  height: number;
11
11
  };
12
+ notReady?: () => boolean;
12
13
  searchFeatureByID?: (str: string) => LayoutRecord;
13
14
  }
14
15
  interface Track {
15
16
  displays: Display[];
17
+ configuration: AnyConfigurationModel;
16
18
  }
17
19
  export declare function heightFromSpecificLevel(views: LGV[], trackId: string, level: number, getYPosOverride?: (trackId: string, level: number) => number): number;
18
20
  export declare function getPxFromCoordinate(view: LGV, refName: string, coord: number): number;
19
21
  export declare function yPos(trackId: string, level: number, views: LGV[], tracks: Track[], c: LayoutRecord, getYPosOverride?: (trackId: string, level: number) => number): number;
20
22
  export declare const useNextFrame: (variable: unknown) => void;
21
23
  export declare function intersect<T>(cb: (l: T) => string, a1?: T[], a2?: T[], ...rest: T[][]): T[];
22
- export declare function getClip(cigar: string, strand: number): number;
23
24
  export declare function calc(track: Track, f: Feature): LayoutRecord | undefined;
24
25
  export declare function getBlockFeatures(model: {
25
26
  views: LinearGenomeViewModel[];
26
- }, track: {
27
- configuration: AnyConfigurationModel;
28
- }): Promise<Feature[][] | undefined>;
27
+ }, track: Track): Promise<Feature[][][]>;
29
28
  export {};
@@ -1,6 +1,7 @@
1
1
  import { useEffect, useState } from 'react';
2
2
  import { getConf } from '@jbrowse/core/configuration';
3
3
  import { clamp, getSession } from '@jbrowse/core/util';
4
+ import { getRpcSessionId } from '@jbrowse/core/util/tracks';
4
5
  const [, TOP, , BOTTOM] = [0, 1, 2, 3];
5
6
  function cheight(chunk) {
6
7
  return chunk[BOTTOM] - chunk[TOP];
@@ -40,33 +41,17 @@ export function intersect(cb, a1 = [], a2 = [], ...rest) {
40
41
  const a12 = a1.filter(value => ids.has(cb(value)));
41
42
  return rest.length === 0 ? a12 : intersect(cb, a12, ...rest);
42
43
  }
43
- const startClip = new RegExp(/(\d+)[SH]$/);
44
- const endClip = new RegExp(/^(\d+)([SH])/);
45
- export function getClip(cigar, strand) {
46
- return strand === -1
47
- ? +(startClip.exec(cigar) || [])[1] || 0
48
- : +(endClip.exec(cigar) || [])[1] || 0;
49
- }
50
44
  export function calc(track, f) {
51
45
  var _a, _b;
52
46
  return (_b = (_a = track.displays[0]).searchFeatureByID) === null || _b === void 0 ? void 0 : _b.call(_a, f.id());
53
47
  }
54
48
  export async function getBlockFeatures(model, track) {
55
- var _a;
56
49
  const { views } = model;
57
- const { rpcManager, assemblyManager } = getSession(model);
58
- const assemblyName = (_a = model.views[0]) === null || _a === void 0 ? void 0 : _a.assemblyNames[0];
59
- if (!assemblyName) {
60
- return undefined;
61
- }
62
- const assembly = await assemblyManager.waitForAssembly(assemblyName);
63
- if (!assembly) {
64
- return undefined;
65
- }
66
- const sessionId = track.configuration.trackId;
67
- return Promise.all(views.map(async (view) => (await rpcManager.call(sessionId, 'CoreGetFeatures', {
50
+ const { rpcManager } = getSession(model);
51
+ const sessionId = getRpcSessionId(track);
52
+ return Promise.all(views.flatMap(async (view) => (await rpcManager.call(sessionId, 'CoreGetFeatures', {
68
53
  adapterConfig: getConf(track, ['adapter']),
69
54
  sessionId,
70
55
  regions: view.staticBlocks.contentBlocks,
71
- })).flat()));
56
+ }))));
72
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-breakpoint-split-view",
3
- "version": "3.4.0",
3
+ "version": "3.5.1",
4
4
  "description": "JBrowse 2 breakpoint detail split view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -37,8 +37,8 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@gmod/vcf": "^6.0.8",
40
- "@jbrowse/core": "^3.4.0",
41
- "@jbrowse/plugin-linear-genome-view": "^3.4.0",
40
+ "@jbrowse/core": "^3.5.1",
41
+ "@jbrowse/plugin-linear-genome-view": "^3.5.1",
42
42
  "@mui/icons-material": "^7.0.0",
43
43
  "@mui/material": "^7.0.0",
44
44
  "@types/file-saver": "^2.0.1",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "a9f1ac35fc2dd810bae92cdaf1fc19995bee4413"
61
+ "gitHead": "cb8859da9d838ad2594964777c5c54f385d98f5e"
62
62
  }