@jbrowse/plugin-breakpoint-split-view 2.17.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +6 -3
  2. package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +5 -11
  3. package/dist/BreakpointAlignmentsFeatureDetail/index.d.ts +1 -1
  4. package/dist/BreakpointAlignmentsFeatureDetail/index.js +18 -8
  5. package/dist/BreakpointSplitView/BreakpointSplitView.d.ts +22 -40
  6. package/dist/BreakpointSplitView/BreakpointSplitView.js +41 -90
  7. package/dist/BreakpointSplitView/components/AlignmentConnections.d.ts +3 -4
  8. package/dist/BreakpointSplitView/components/AlignmentConnections.js +93 -124
  9. package/dist/BreakpointSplitView/components/Breakends.d.ts +3 -4
  10. package/dist/BreakpointSplitView/components/Breakends.js +67 -92
  11. package/dist/BreakpointSplitView/components/BreakpointSplitView.d.ts +2 -3
  12. package/dist/BreakpointSplitView/components/BreakpointSplitView.js +13 -17
  13. package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +2 -3
  14. package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +10 -39
  15. package/dist/BreakpointSplitView/components/ExportSvgDialog.d.ts +2 -3
  16. package/dist/BreakpointSplitView/components/ExportSvgDialog.js +35 -76
  17. package/dist/BreakpointSplitView/components/Overlay.d.ts +3 -4
  18. package/dist/BreakpointSplitView/components/Overlay.js +8 -9
  19. package/dist/BreakpointSplitView/components/PairedFeatures.d.ts +3 -4
  20. package/dist/BreakpointSplitView/components/PairedFeatures.js +47 -72
  21. package/dist/BreakpointSplitView/components/Translocations.d.ts +3 -4
  22. package/dist/BreakpointSplitView/components/Translocations.js +57 -86
  23. package/dist/BreakpointSplitView/components/getOrientationColor.js +0 -8
  24. package/dist/BreakpointSplitView/components/util.d.ts +1 -1
  25. package/dist/BreakpointSplitView/components/util.js +12 -12
  26. package/dist/BreakpointSplitView/index.d.ts +1 -1
  27. package/dist/BreakpointSplitView/index.js +19 -10
  28. package/dist/BreakpointSplitView/model.d.ts +23 -108
  29. package/dist/BreakpointSplitView/model.js +50 -153
  30. package/dist/BreakpointSplitView/svgcomponents/SVGBackground.d.ts +1 -2
  31. package/dist/BreakpointSplitView/svgcomponents/SVGBackground.js +3 -6
  32. package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +2 -1
  33. package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +6 -30
  34. package/dist/BreakpointSplitView/svgcomponents/util.d.ts +2 -2
  35. package/dist/BreakpointSplitView/svgcomponents/util.js +0 -1
  36. package/dist/BreakpointSplitView/types.d.ts +22 -0
  37. package/dist/BreakpointSplitView/types.js +2 -0
  38. package/dist/BreakpointSplitView/util.d.ts +12 -2
  39. package/dist/BreakpointSplitView/util.js +34 -8
  40. package/dist/index.d.ts +1 -1
  41. package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +6 -3
  42. package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +5 -8
  43. package/esm/BreakpointAlignmentsFeatureDetail/index.d.ts +1 -1
  44. package/esm/BreakpointAlignmentsFeatureDetail/index.js +1 -1
  45. package/esm/BreakpointSplitView/BreakpointSplitView.d.ts +22 -40
  46. package/esm/BreakpointSplitView/BreakpointSplitView.js +41 -90
  47. package/esm/BreakpointSplitView/components/AlignmentConnections.d.ts +3 -4
  48. package/esm/BreakpointSplitView/components/AlignmentConnections.js +94 -102
  49. package/esm/BreakpointSplitView/components/Breakends.d.ts +3 -4
  50. package/esm/BreakpointSplitView/components/Breakends.js +68 -70
  51. package/esm/BreakpointSplitView/components/BreakpointSplitView.d.ts +2 -3
  52. package/esm/BreakpointSplitView/components/BreakpointSplitView.js +13 -17
  53. package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +2 -3
  54. package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +10 -16
  55. package/esm/BreakpointSplitView/components/ExportSvgDialog.d.ts +2 -3
  56. package/esm/BreakpointSplitView/components/ExportSvgDialog.js +35 -53
  57. package/esm/BreakpointSplitView/components/Overlay.d.ts +3 -4
  58. package/esm/BreakpointSplitView/components/Overlay.js +8 -9
  59. package/esm/BreakpointSplitView/components/PairedFeatures.d.ts +3 -4
  60. package/esm/BreakpointSplitView/components/PairedFeatures.js +48 -50
  61. package/esm/BreakpointSplitView/components/Translocations.d.ts +3 -4
  62. package/esm/BreakpointSplitView/components/Translocations.js +58 -64
  63. package/esm/BreakpointSplitView/components/getOrientationColor.js +0 -8
  64. package/esm/BreakpointSplitView/components/util.d.ts +1 -1
  65. package/esm/BreakpointSplitView/components/util.js +12 -12
  66. package/esm/BreakpointSplitView/index.d.ts +1 -1
  67. package/esm/BreakpointSplitView/index.js +2 -3
  68. package/esm/BreakpointSplitView/model.d.ts +23 -108
  69. package/esm/BreakpointSplitView/model.js +30 -142
  70. package/esm/BreakpointSplitView/svgcomponents/SVGBackground.d.ts +1 -2
  71. package/esm/BreakpointSplitView/svgcomponents/SVGBackground.js +3 -3
  72. package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +2 -1
  73. package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +6 -30
  74. package/esm/BreakpointSplitView/svgcomponents/util.d.ts +2 -2
  75. package/esm/BreakpointSplitView/svgcomponents/util.js +0 -1
  76. package/esm/BreakpointSplitView/types.d.ts +22 -0
  77. package/esm/BreakpointSplitView/types.js +1 -0
  78. package/esm/BreakpointSplitView/util.d.ts +12 -2
  79. package/esm/BreakpointSplitView/util.js +33 -10
  80. package/esm/index.d.ts +1 -1
  81. package/package.json +3 -3
@@ -1,5 +1,7 @@
1
- import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
2
- import { LayoutRecord } from './model';
1
+ import type { LayoutRecord } from './types';
2
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
+ import type { Feature } from '@jbrowse/core/util';
4
+ import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
3
5
  type LGV = LinearGenomeViewModel;
4
6
  interface Display {
5
7
  height: number;
@@ -7,6 +9,7 @@ interface Display {
7
9
  SNPCoverageDisplay?: {
8
10
  height: number;
9
11
  };
12
+ searchFeatureByID?: (str: string) => LayoutRecord;
10
13
  }
11
14
  interface Track {
12
15
  displays: Display[];
@@ -16,4 +19,11 @@ export declare function getPxFromCoordinate(view: LGV, refName: string, coord: n
16
19
  export declare function yPos(trackId: string, level: number, views: LGV[], tracks: Track[], c: LayoutRecord, getYPosOverride?: (trackId: string, level: number) => number): number;
17
20
  export declare const useNextFrame: (variable: unknown) => void;
18
21
  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
+ export declare function calc(track: Track, f: Feature): LayoutRecord | undefined;
24
+ export declare function getBlockFeatures(model: {
25
+ views: LinearGenomeViewModel[];
26
+ }, track: {
27
+ configuration: AnyConfigurationModel;
28
+ }): Promise<Feature[][] | undefined>;
19
29
  export {};
@@ -1,5 +1,6 @@
1
- import { useState, useEffect } from 'react';
2
- import { clamp } from '@jbrowse/core/util';
1
+ import { useEffect, useState } from 'react';
2
+ import { getConf } from '@jbrowse/core/configuration';
3
+ import { clamp, getSession } from '@jbrowse/core/util';
3
4
  const [, TOP, , BOTTOM] = [0, 1, 2, 3];
4
5
  function cheight(chunk) {
5
6
  return chunk[BOTTOM] - chunk[TOP];
@@ -14,7 +15,6 @@ export function getPxFromCoordinate(view, refName, coord) {
14
15
  var _a;
15
16
  return (((_a = view.bpToPx({ refName, coord })) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0) - view.offsetPx;
16
17
  }
17
- // get's the yposition of a layout record in a track
18
18
  export function yPos(trackId, level, views, tracks, c, getYPosOverride) {
19
19
  const display = tracks[level].displays[0];
20
20
  const min = 0;
@@ -29,21 +29,44 @@ export function yPos(trackId, level, views, tracks, c, getYPosOverride) {
29
29
  heightFromSpecificLevel(views, trackId, level, getYPosOverride) +
30
30
  display.scrollTop);
31
31
  }
32
- // we combo a useEffect and useState combo to force rerender on snap changing.
33
- // the setup of this being a useEffect+useState makes it re-render once the
34
- // useEffect is called, which is generally the "next frame". If we removed the
35
- // below use
36
32
  export const useNextFrame = (variable) => {
37
33
  const [, setNextFrameState] = useState();
38
34
  useEffect(() => {
39
35
  setNextFrameState(variable);
40
36
  }, [variable]);
41
37
  };
42
- // https://stackoverflow.com/a/49186706/2129219 the array-intersection package
43
- // on npm has a large kb size, and we are just intersecting open track ids so
44
- // simple is better
45
38
  export function intersect(cb, a1 = [], a2 = [], ...rest) {
46
39
  const ids = new Set(a2.map(elt => cb(elt)));
47
40
  const a12 = a1.filter(value => ids.has(cb(value)));
48
41
  return rest.length === 0 ? a12 : intersect(cb, a12, ...rest);
49
42
  }
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
+ export function calc(track, f) {
51
+ var _a, _b;
52
+ return (_b = (_a = track.displays[0]).searchFeatureByID) === null || _b === void 0 ? void 0 : _b.call(_a, f.id());
53
+ }
54
+ export async function getBlockFeatures(model, track) {
55
+ var _a;
56
+ 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', {
68
+ adapterConfig: getConf(track, ['adapter']),
69
+ sessionId,
70
+ regions: view.staticBlocks.contentBlocks,
71
+ })).flat()));
72
+ }
package/esm/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
2
1
  import Plugin from '@jbrowse/core/Plugin';
2
+ import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  export default class BreakpointSplitViewPlugin extends Plugin {
4
4
  name: string;
5
5
  install(pluginManager: PluginManager): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-breakpoint-split-view",
3
- "version": "2.17.0",
3
+ "version": "3.0.0",
4
4
  "description": "JBrowse 2 breakpoint detail split view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -36,7 +36,7 @@
36
36
  "clean": "rimraf dist esm *.tsbuildinfo"
37
37
  },
38
38
  "dependencies": {
39
- "@gmod/vcf": "^5.0.9",
39
+ "@gmod/vcf": "^6.0.0",
40
40
  "@mui/icons-material": "^6.0.0",
41
41
  "@types/file-saver": "^2.0.1",
42
42
  "file-saver": "^2.0.0"
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "eed30b5e671f8f7823652d7cecc51aa89226de46"
61
+ "gitHead": "2c6897f1fa732b1db5b094d1dca197e333e95319"
62
62
  }