@jbrowse/plugin-breakpoint-split-view 2.16.1 → 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/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +5 -1
- package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +4 -3
- package/dist/BreakpointAlignmentsFeatureDetail/index.d.ts +1 -1
- package/dist/BreakpointAlignmentsFeatureDetail/index.js +1 -1
- package/dist/BreakpointSplitView/BreakpointSplitView.d.ts +22 -40
- package/dist/BreakpointSplitView/BreakpointSplitView.js +41 -90
- package/dist/BreakpointSplitView/components/AlignmentConnections.d.ts +1 -1
- package/dist/BreakpointSplitView/components/AlignmentConnections.js +5 -14
- package/dist/BreakpointSplitView/components/Breakends.d.ts +1 -1
- package/dist/BreakpointSplitView/components/Breakends.js +4 -7
- package/dist/BreakpointSplitView/components/BreakpointSplitView.d.ts +1 -1
- package/dist/BreakpointSplitView/components/BreakpointSplitView.js +1 -1
- package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +1 -1
- package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +2 -9
- package/dist/BreakpointSplitView/components/ExportSvgDialog.d.ts +1 -1
- package/dist/BreakpointSplitView/components/ExportSvgDialog.js +2 -4
- package/dist/BreakpointSplitView/components/Overlay.d.ts +1 -1
- package/dist/BreakpointSplitView/components/Overlay.js +1 -3
- package/dist/BreakpointSplitView/components/PairedFeatures.d.ts +1 -1
- package/dist/BreakpointSplitView/components/PairedFeatures.js +2 -5
- package/dist/BreakpointSplitView/components/Translocations.d.ts +1 -1
- package/dist/BreakpointSplitView/components/Translocations.js +5 -12
- package/dist/BreakpointSplitView/components/getOrientationColor.js +0 -8
- package/dist/BreakpointSplitView/components/util.d.ts +1 -1
- package/dist/BreakpointSplitView/components/util.js +14 -17
- package/dist/BreakpointSplitView/index.d.ts +1 -1
- package/dist/BreakpointSplitView/index.js +2 -3
- package/dist/BreakpointSplitView/model.d.ts +8 -64
- package/dist/BreakpointSplitView/model.js +15 -91
- package/dist/BreakpointSplitView/svgcomponents/SVGBackground.js +1 -1
- package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +1 -1
- package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +4 -7
- package/dist/BreakpointSplitView/svgcomponents/util.d.ts +2 -2
- package/dist/BreakpointSplitView/svgcomponents/util.js +0 -1
- package/dist/BreakpointSplitView/util.d.ts +2 -2
- package/dist/BreakpointSplitView/util.js +0 -8
- package/dist/index.d.ts +1 -1
- package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +5 -1
- package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +4 -3
- package/esm/BreakpointAlignmentsFeatureDetail/index.d.ts +1 -1
- package/esm/BreakpointAlignmentsFeatureDetail/index.js +1 -1
- package/esm/BreakpointSplitView/BreakpointSplitView.d.ts +22 -40
- package/esm/BreakpointSplitView/BreakpointSplitView.js +41 -90
- package/esm/BreakpointSplitView/components/AlignmentConnections.d.ts +1 -1
- package/esm/BreakpointSplitView/components/AlignmentConnections.js +6 -15
- package/esm/BreakpointSplitView/components/Breakends.d.ts +1 -1
- package/esm/BreakpointSplitView/components/Breakends.js +6 -9
- package/esm/BreakpointSplitView/components/BreakpointSplitView.d.ts +1 -1
- package/esm/BreakpointSplitView/components/BreakpointSplitView.js +1 -1
- package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +1 -1
- package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +2 -9
- package/esm/BreakpointSplitView/components/ExportSvgDialog.d.ts +1 -1
- package/esm/BreakpointSplitView/components/ExportSvgDialog.js +2 -4
- package/esm/BreakpointSplitView/components/Overlay.d.ts +1 -1
- package/esm/BreakpointSplitView/components/Overlay.js +1 -3
- package/esm/BreakpointSplitView/components/PairedFeatures.d.ts +1 -1
- package/esm/BreakpointSplitView/components/PairedFeatures.js +4 -7
- package/esm/BreakpointSplitView/components/Translocations.d.ts +1 -1
- package/esm/BreakpointSplitView/components/Translocations.js +7 -14
- package/esm/BreakpointSplitView/components/getOrientationColor.js +0 -8
- package/esm/BreakpointSplitView/components/util.d.ts +1 -1
- package/esm/BreakpointSplitView/components/util.js +14 -17
- package/esm/BreakpointSplitView/index.d.ts +1 -1
- package/esm/BreakpointSplitView/index.js +2 -3
- package/esm/BreakpointSplitView/model.d.ts +8 -64
- package/esm/BreakpointSplitView/model.js +14 -91
- package/esm/BreakpointSplitView/svgcomponents/SVGBackground.js +1 -1
- package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +1 -1
- package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +4 -7
- package/esm/BreakpointSplitView/svgcomponents/util.d.ts +2 -2
- package/esm/BreakpointSplitView/svgcomponents/util.js +0 -1
- package/esm/BreakpointSplitView/util.d.ts +2 -2
- package/esm/BreakpointSplitView/util.js +1 -9
- package/esm/index.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { notEmpty } from '@jbrowse/core/util';
|
|
2
1
|
import { parseBreakend } from '@gmod/vcf';
|
|
3
|
-
|
|
4
|
-
// BAM/CRAM files
|
|
2
|
+
import { assembleLocStringFast, notEmpty } from '@jbrowse/core/util';
|
|
5
3
|
export function getBadlyPairedAlignments(features) {
|
|
6
4
|
const candidates = new Map();
|
|
7
5
|
const alreadySeen = new Set();
|
|
8
|
-
|
|
6
|
+
const alreadyPairedWithSamePosition = new Set();
|
|
9
7
|
for (const feature of features.values()) {
|
|
10
8
|
const flags = feature.get('flags');
|
|
11
9
|
const id = feature.id();
|
|
10
|
+
const supp = assembleLocStringFast({
|
|
11
|
+
refName: feature.get('refName'),
|
|
12
|
+
start: feature.get('start'),
|
|
13
|
+
end: feature.get('end'),
|
|
14
|
+
});
|
|
12
15
|
const unmapped = flags & 4;
|
|
13
16
|
const correctlyPaired = flags & 2;
|
|
14
|
-
if (!alreadySeen.has(id) &&
|
|
17
|
+
if (!alreadySeen.has(id) &&
|
|
18
|
+
!alreadyPairedWithSamePosition.has(supp) &&
|
|
19
|
+
!correctlyPaired &&
|
|
20
|
+
!unmapped) {
|
|
15
21
|
const n = feature.get('name');
|
|
16
22
|
let val = candidates.get(n);
|
|
17
23
|
if (!val) {
|
|
@@ -21,23 +27,18 @@ export function getBadlyPairedAlignments(features) {
|
|
|
21
27
|
val.push(feature);
|
|
22
28
|
}
|
|
23
29
|
alreadySeen.add(feature.id());
|
|
30
|
+
alreadyPairedWithSamePosition.add(supp);
|
|
24
31
|
}
|
|
25
32
|
return [...candidates.values()].filter(v => v.length > 1);
|
|
26
33
|
}
|
|
27
|
-
function getTag(f, tag) {
|
|
28
|
-
const tags = f.get('tags');
|
|
29
|
-
return tags ? tags[tag] : f.get(tag);
|
|
30
|
-
}
|
|
31
|
-
// this finds candidate alignment features, aimed at plotting split reads from
|
|
32
|
-
// BAM/CRAM files
|
|
33
34
|
export function getMatchedAlignmentFeatures(features) {
|
|
35
|
+
var _a;
|
|
34
36
|
const candidates = new Map();
|
|
35
37
|
const alreadySeen = new Set();
|
|
36
|
-
// this finds candidate features that share the same name
|
|
37
38
|
for (const feature of features.values()) {
|
|
38
39
|
const id = feature.id();
|
|
39
40
|
const unmapped = feature.get('flags') & 4;
|
|
40
|
-
const hasSA = !!
|
|
41
|
+
const hasSA = !!((_a = feature.get('tags')) === null || _a === void 0 ? void 0 : _a.SA);
|
|
41
42
|
if (!alreadySeen.has(id) && !unmapped && hasSA) {
|
|
42
43
|
const n = feature.get('name');
|
|
43
44
|
let val = candidates.get(n);
|
|
@@ -69,8 +70,6 @@ export function findMatchingAlt(feat1, feat2) {
|
|
|
69
70
|
}
|
|
70
71
|
return undefined;
|
|
71
72
|
}
|
|
72
|
-
// Returns paired BND features across multiple views by inspecting the ALT
|
|
73
|
-
// field to get exact coordinate matches
|
|
74
73
|
export function getMatchedBreakendFeatures(feats) {
|
|
75
74
|
const candidates = new Map();
|
|
76
75
|
const alreadySeen = new Set();
|
|
@@ -95,7 +94,6 @@ export function getMatchedBreakendFeatures(feats) {
|
|
|
95
94
|
}
|
|
96
95
|
return [...candidates.values()].filter(v => v.length > 1);
|
|
97
96
|
}
|
|
98
|
-
// Getting "matched" TRA means just return all TRA
|
|
99
97
|
export function getMatchedTranslocationFeatures(feats) {
|
|
100
98
|
const ret = [];
|
|
101
99
|
const alreadySeen = new Set();
|
|
@@ -107,7 +105,6 @@ export function getMatchedTranslocationFeatures(feats) {
|
|
|
107
105
|
}
|
|
108
106
|
return ret;
|
|
109
107
|
}
|
|
110
|
-
// Getting "matched" TRA means just return all TRA
|
|
111
108
|
export function getMatchedPairedFeatures(feats) {
|
|
112
109
|
const candidates = new Map();
|
|
113
110
|
const alreadySeen = new Set();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function BreakpointSplitViewF(pluginManager: PluginManager): void;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
-
|
|
3
|
-
import BreakpointSplitView from './BreakpointSplitView';
|
|
2
|
+
import { ViewType } from '@jbrowse/core/pluggableElementTypes';
|
|
4
3
|
import stateModelFactory from './model';
|
|
5
4
|
export default function BreakpointSplitViewF(pluginManager) {
|
|
6
5
|
pluginManager.addViewType(() => {
|
|
7
|
-
return new
|
|
6
|
+
return new ViewType({
|
|
8
7
|
name: 'BreakpointSplitView',
|
|
9
8
|
displayName: 'Breakpoint split view',
|
|
10
9
|
stateModel: stateModelFactory(pluginManager),
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
3
|
+
import type { Feature } from '@jbrowse/core/util';
|
|
4
|
+
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
5
|
+
import type { Instance } from 'mobx-state-tree';
|
|
6
|
+
export declare function getClip(cigar: string, strand: number): number;
|
|
6
7
|
export interface ExportSvgOptions {
|
|
7
8
|
rasterizeLayers?: boolean;
|
|
8
9
|
filename?: string;
|
|
@@ -26,11 +27,6 @@ export interface Breakend {
|
|
|
26
27
|
MatePosition: string;
|
|
27
28
|
}
|
|
28
29
|
export type LayoutRecord = [number, number, number, number];
|
|
29
|
-
/**
|
|
30
|
-
* #stateModel BreakpointSplitView
|
|
31
|
-
* extends
|
|
32
|
-
* - [BaseViewModel](../baseviewmodel)
|
|
33
|
-
*/
|
|
34
30
|
export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
35
31
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
36
32
|
displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
@@ -93,6 +89,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
93
89
|
scaleBarDisplayPrefix(): string | undefined;
|
|
94
90
|
MiniControlsComponent(): React.FC<any>;
|
|
95
91
|
HeaderComponent(): React.FC<any>;
|
|
92
|
+
readonly assembliesNotFound: string | undefined;
|
|
96
93
|
readonly assemblyErrors: string;
|
|
97
94
|
readonly assembliesInitialized: boolean;
|
|
98
95
|
readonly initialized: boolean;
|
|
@@ -274,88 +271,35 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
274
271
|
width: number;
|
|
275
272
|
matchedTrackFeatures: Record<string, Feature[][]>;
|
|
276
273
|
} & {
|
|
277
|
-
/**
|
|
278
|
-
* #method
|
|
279
|
-
* creates an svg export and save using FileSaver
|
|
280
|
-
*/
|
|
281
274
|
exportSvg(opts?: ExportSvgOptions): Promise<void>;
|
|
282
275
|
} & {
|
|
283
|
-
/**
|
|
284
|
-
* #getter
|
|
285
|
-
* Find all track ids that match across multiple views, or return just
|
|
286
|
-
* the single view's track if only a single row is used
|
|
287
|
-
*/
|
|
288
276
|
readonly matchedTracks: (import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyType>>) | {
|
|
289
277
|
configuration: {
|
|
290
278
|
trackId: string;
|
|
291
279
|
};
|
|
292
280
|
}[];
|
|
293
|
-
/**
|
|
294
|
-
* #method
|
|
295
|
-
* Get tracks with a given trackId across multiple views
|
|
296
|
-
*/
|
|
297
281
|
getMatchedTracks(trackConfigId: string): any[];
|
|
298
|
-
/**
|
|
299
|
-
* #method
|
|
300
|
-
* Translocation features are handled differently since they do not have
|
|
301
|
-
* a mate e.g. they are one sided
|
|
302
|
-
*/
|
|
303
282
|
hasTranslocations(trackConfigId: string): Feature | undefined;
|
|
304
|
-
/**
|
|
305
|
-
* #method
|
|
306
|
-
* Paired features similar to breakends, but simpler, like BEDPE
|
|
307
|
-
*/
|
|
308
283
|
hasPairedFeatures(trackConfigId: string): Feature | undefined;
|
|
309
|
-
/**
|
|
310
|
-
* #method
|
|
311
|
-
* Get a composite map of featureId-\>feature map for a track across
|
|
312
|
-
* multiple views
|
|
313
|
-
*/
|
|
314
284
|
getTrackFeatures(trackConfigId: string): Map<string, Feature>;
|
|
315
|
-
/**
|
|
316
|
-
* #method
|
|
317
|
-
*/
|
|
318
285
|
getMatchedFeaturesInLayout(trackConfigId: string, features: Feature[][]): {
|
|
319
286
|
feature: Feature;
|
|
320
287
|
layout: LayoutRecord | undefined;
|
|
321
288
|
level: number;
|
|
289
|
+
clipPos: number;
|
|
322
290
|
}[][];
|
|
323
291
|
} & {
|
|
324
292
|
afterAttach(): void;
|
|
325
293
|
onSubviewAction(actionName: string, path: string, args?: unknown[]): void;
|
|
326
|
-
/**
|
|
327
|
-
* #action
|
|
328
|
-
*/
|
|
329
294
|
setWidth(newWidth: number): void;
|
|
330
|
-
/**
|
|
331
|
-
* #action
|
|
332
|
-
*/
|
|
333
295
|
removeView(view: LGV): void;
|
|
334
|
-
/**
|
|
335
|
-
* #action
|
|
336
|
-
*/
|
|
337
296
|
toggleInteract(): void;
|
|
338
|
-
/**
|
|
339
|
-
* #action
|
|
340
|
-
*/
|
|
341
297
|
toggleIntraviewLinks(): void;
|
|
342
|
-
/**
|
|
343
|
-
* #action
|
|
344
|
-
*/
|
|
345
298
|
toggleLinkViews(): void;
|
|
346
|
-
/**
|
|
347
|
-
* #action
|
|
348
|
-
*/
|
|
349
299
|
setMatchedTrackFeatures(obj: Record<string, Feature[][]>): void;
|
|
350
|
-
/**
|
|
351
|
-
* #action
|
|
352
|
-
*/
|
|
353
300
|
reverseViewOrder(): void;
|
|
354
301
|
} & {
|
|
355
302
|
afterAttach(): void;
|
|
356
|
-
/**
|
|
357
|
-
* #method
|
|
358
|
-
*/
|
|
359
303
|
menuItems(): ({
|
|
360
304
|
label: string;
|
|
361
305
|
subMenu: import("@jbrowse/core/ui").MenuItem[];
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { autorun } from 'mobx';
|
|
4
|
-
import { saveAs } from 'file-saver';
|
|
2
|
+
import { getConf } from '@jbrowse/core/configuration';
|
|
5
3
|
import { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
6
4
|
import { getSession, notEmpty } from '@jbrowse/core/util';
|
|
7
|
-
import { getConf } from '@jbrowse/core/configuration';
|
|
8
|
-
// icons
|
|
9
|
-
import PhotoCamera from '@mui/icons-material/PhotoCamera';
|
|
10
5
|
import LinkIcon from '@mui/icons-material/Link';
|
|
11
|
-
|
|
6
|
+
import PhotoCamera from '@mui/icons-material/PhotoCamera';
|
|
7
|
+
import { saveAs } from 'file-saver';
|
|
8
|
+
import { autorun } from 'mobx';
|
|
9
|
+
import { addDisposer, getPath, onAction, types } from 'mobx-state-tree';
|
|
12
10
|
import { intersect } from './util';
|
|
13
|
-
// lazies
|
|
14
11
|
const ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'));
|
|
12
|
+
const startClip = new RegExp(/(\d+)[SH]$/);
|
|
13
|
+
const endClip = new RegExp(/^(\d+)([SH])/);
|
|
14
|
+
export function getClip(cigar, strand) {
|
|
15
|
+
return strand === -1
|
|
16
|
+
? +(startClip.exec(cigar) || [])[1] || 0
|
|
17
|
+
: +(endClip.exec(cigar) || [])[1] || 0;
|
|
18
|
+
}
|
|
15
19
|
function calc(track, f) {
|
|
16
20
|
var _a, _b;
|
|
17
21
|
return (_b = (_a = track.displays[0]).searchFeatureByID) === null || _b === void 0 ? void 0 : _b.call(_a, f.id());
|
|
@@ -26,7 +30,7 @@ async function getBlockFeatures(model, track) {
|
|
|
26
30
|
}
|
|
27
31
|
const assembly = await assemblyManager.waitForAssembly(assemblyName);
|
|
28
32
|
if (!assembly) {
|
|
29
|
-
return undefined;
|
|
33
|
+
return undefined;
|
|
30
34
|
}
|
|
31
35
|
const sessionId = track.configuration.trackId;
|
|
32
36
|
return Promise.all(views.map(async (view) => (await rpcManager.call(sessionId, 'CoreGetFeatures', {
|
|
@@ -35,43 +39,17 @@ async function getBlockFeatures(model, track) {
|
|
|
35
39
|
regions: view.staticBlocks.contentBlocks,
|
|
36
40
|
})).flat()));
|
|
37
41
|
}
|
|
38
|
-
/**
|
|
39
|
-
* #stateModel BreakpointSplitView
|
|
40
|
-
* extends
|
|
41
|
-
* - [BaseViewModel](../baseviewmodel)
|
|
42
|
-
*/
|
|
43
42
|
export default function stateModelFactory(pluginManager) {
|
|
44
43
|
const minHeight = 40;
|
|
45
44
|
const defaultHeight = 400;
|
|
46
45
|
return types
|
|
47
46
|
.compose('BreakpointSplitView', BaseViewModel, types.model({
|
|
48
|
-
/**
|
|
49
|
-
* #property
|
|
50
|
-
*/
|
|
51
47
|
type: types.literal('BreakpointSplitView'),
|
|
52
|
-
/**
|
|
53
|
-
* #property
|
|
54
|
-
*/
|
|
55
48
|
height: types.optional(types.refinement('viewHeight', types.number, (n) => n >= minHeight), defaultHeight),
|
|
56
|
-
/**
|
|
57
|
-
* #property
|
|
58
|
-
*/
|
|
59
49
|
trackSelectorType: 'hierarchical',
|
|
60
|
-
/**
|
|
61
|
-
* #property
|
|
62
|
-
*/
|
|
63
50
|
showIntraviewLinks: true,
|
|
64
|
-
/**
|
|
65
|
-
* #property
|
|
66
|
-
*/
|
|
67
51
|
linkViews: false,
|
|
68
|
-
/**
|
|
69
|
-
* #property
|
|
70
|
-
*/
|
|
71
52
|
interactToggled: false,
|
|
72
|
-
/**
|
|
73
|
-
* #property
|
|
74
|
-
*/
|
|
75
53
|
views: types.array(pluginManager.getViewType('LinearGenomeView')
|
|
76
54
|
.stateModel),
|
|
77
55
|
}))
|
|
@@ -80,10 +58,6 @@ export default function stateModelFactory(pluginManager) {
|
|
|
80
58
|
matchedTrackFeatures: {},
|
|
81
59
|
}))
|
|
82
60
|
.views(self => ({
|
|
83
|
-
/**
|
|
84
|
-
* #method
|
|
85
|
-
* creates an svg export and save using FileSaver
|
|
86
|
-
*/
|
|
87
61
|
async exportSvg(opts = {}) {
|
|
88
62
|
const { renderToSvg } = await import('./svgcomponents/SVGBreakpointSplitView');
|
|
89
63
|
const html = await renderToSvg(self, opts);
|
|
@@ -92,54 +66,27 @@ export default function stateModelFactory(pluginManager) {
|
|
|
92
66
|
},
|
|
93
67
|
}))
|
|
94
68
|
.views(self => ({
|
|
95
|
-
/**
|
|
96
|
-
* #getter
|
|
97
|
-
* Find all track ids that match across multiple views, or return just
|
|
98
|
-
* the single view's track if only a single row is used
|
|
99
|
-
*/
|
|
100
69
|
get matchedTracks() {
|
|
101
70
|
return self.views.length === 1
|
|
102
71
|
? self.views[0].tracks
|
|
103
72
|
: intersect(elt => elt.configuration.trackId, ...self.views.map(view => view.tracks));
|
|
104
73
|
},
|
|
105
|
-
/**
|
|
106
|
-
* #method
|
|
107
|
-
* Get tracks with a given trackId across multiple views
|
|
108
|
-
*/
|
|
109
74
|
getMatchedTracks(trackConfigId) {
|
|
110
75
|
return self.views
|
|
111
76
|
.map(view => view.getTrack(trackConfigId))
|
|
112
77
|
.filter(f => !!f);
|
|
113
78
|
},
|
|
114
|
-
/**
|
|
115
|
-
* #method
|
|
116
|
-
* Translocation features are handled differently since they do not have
|
|
117
|
-
* a mate e.g. they are one sided
|
|
118
|
-
*/
|
|
119
79
|
hasTranslocations(trackConfigId) {
|
|
120
80
|
return [...this.getTrackFeatures(trackConfigId).values()].find(f => f.get('type') === 'translocation');
|
|
121
81
|
},
|
|
122
|
-
/**
|
|
123
|
-
* #method
|
|
124
|
-
* Paired features similar to breakends, but simpler, like BEDPE
|
|
125
|
-
*/
|
|
126
82
|
hasPairedFeatures(trackConfigId) {
|
|
127
83
|
return [...this.getTrackFeatures(trackConfigId).values()].find(f => f.get('type') === 'paired_feature');
|
|
128
84
|
},
|
|
129
|
-
/**
|
|
130
|
-
* #method
|
|
131
|
-
* Get a composite map of featureId-\>feature map for a track across
|
|
132
|
-
* multiple views
|
|
133
|
-
*/
|
|
134
85
|
getTrackFeatures(trackConfigId) {
|
|
135
86
|
var _a;
|
|
136
87
|
return new Map((_a = self.matchedTrackFeatures[trackConfigId]) === null || _a === void 0 ? void 0 : _a.flat().map(f => [f.id(), f]));
|
|
137
88
|
},
|
|
138
|
-
/**
|
|
139
|
-
* #method
|
|
140
|
-
*/
|
|
141
89
|
getMatchedFeaturesInLayout(trackConfigId, features) {
|
|
142
|
-
// use reverse to search the second track first
|
|
143
90
|
const tracks = this.getMatchedTracks(trackConfigId);
|
|
144
91
|
return features.map(c => c
|
|
145
92
|
.map(feature => {
|
|
@@ -149,6 +96,7 @@ export default function stateModelFactory(pluginManager) {
|
|
|
149
96
|
feature,
|
|
150
97
|
layout: calc(tracks[level], feature),
|
|
151
98
|
level,
|
|
99
|
+
clipPos: getClip(feature.get('CIGAR'), feature.get('strand')),
|
|
152
100
|
}
|
|
153
101
|
: undefined;
|
|
154
102
|
})
|
|
@@ -179,53 +127,31 @@ export default function stateModelFactory(pluginManager) {
|
|
|
179
127
|
self.views.forEach(view => {
|
|
180
128
|
const ret = getPath(view);
|
|
181
129
|
if (!ret.endsWith(path)) {
|
|
182
|
-
// @ts-ignore
|
|
183
130
|
view[actionName](args === null || args === void 0 ? void 0 : args[0]);
|
|
184
131
|
}
|
|
185
132
|
});
|
|
186
133
|
},
|
|
187
|
-
/**
|
|
188
|
-
* #action
|
|
189
|
-
*/
|
|
190
134
|
setWidth(newWidth) {
|
|
191
135
|
self.width = newWidth;
|
|
192
136
|
self.views.forEach(v => {
|
|
193
137
|
v.setWidth(newWidth);
|
|
194
138
|
});
|
|
195
139
|
},
|
|
196
|
-
/**
|
|
197
|
-
* #action
|
|
198
|
-
*/
|
|
199
140
|
removeView(view) {
|
|
200
141
|
self.views.remove(view);
|
|
201
142
|
},
|
|
202
|
-
/**
|
|
203
|
-
* #action
|
|
204
|
-
*/
|
|
205
143
|
toggleInteract() {
|
|
206
144
|
self.interactToggled = !self.interactToggled;
|
|
207
145
|
},
|
|
208
|
-
/**
|
|
209
|
-
* #action
|
|
210
|
-
*/
|
|
211
146
|
toggleIntraviewLinks() {
|
|
212
147
|
self.showIntraviewLinks = !self.showIntraviewLinks;
|
|
213
148
|
},
|
|
214
|
-
/**
|
|
215
|
-
* #action
|
|
216
|
-
*/
|
|
217
149
|
toggleLinkViews() {
|
|
218
150
|
self.linkViews = !self.linkViews;
|
|
219
151
|
},
|
|
220
|
-
/**
|
|
221
|
-
* #action
|
|
222
|
-
*/
|
|
223
152
|
setMatchedTrackFeatures(obj) {
|
|
224
153
|
self.matchedTrackFeatures = obj;
|
|
225
154
|
},
|
|
226
|
-
/**
|
|
227
|
-
* #action
|
|
228
|
-
*/
|
|
229
155
|
reverseViewOrder() {
|
|
230
156
|
self.views.reverse();
|
|
231
157
|
},
|
|
@@ -248,9 +174,6 @@ export default function stateModelFactory(pluginManager) {
|
|
|
248
174
|
}
|
|
249
175
|
}));
|
|
250
176
|
},
|
|
251
|
-
/**
|
|
252
|
-
* #method
|
|
253
|
-
*/
|
|
254
177
|
menuItems() {
|
|
255
178
|
return [
|
|
256
179
|
...self.views
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useTheme } from '@mui/material';
|
|
3
2
|
import { stripAlpha } from '@jbrowse/core/util';
|
|
3
|
+
import { useTheme } from '@mui/material';
|
|
4
4
|
export default function SVGBackground({ width, height, shift, }) {
|
|
5
5
|
const theme = useTheme();
|
|
6
6
|
return (React.createElement("rect", { width: width + shift * 2, height: height, fill: stripAlpha(theme.palette.background.default) }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BreakpointViewModel, ExportSvgOptions } from '../model';
|
|
2
2
|
type BSV = BreakpointViewModel;
|
|
3
3
|
export declare function renderToSvg(model: BSV, opts: ExportSvgOptions): Promise<string>;
|
|
4
4
|
export {};
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createJBrowseTheme } from '@jbrowse/core/ui';
|
|
3
3
|
import { getSession, renderToStaticMarkup, sum } from '@jbrowse/core/util';
|
|
4
|
+
import { SVGRuler, SVGTracks, totalHeight, } from '@jbrowse/plugin-linear-genome-view';
|
|
4
5
|
import { ThemeProvider } from '@mui/material';
|
|
5
|
-
import {
|
|
6
|
+
import { when } from 'mobx';
|
|
6
7
|
import { getRoot } from 'mobx-state-tree';
|
|
7
|
-
import { SVGTracks, SVGRuler, totalHeight, } from '@jbrowse/plugin-linear-genome-view';
|
|
8
|
-
// locals
|
|
9
8
|
import SVGBackground from './SVGBackground';
|
|
10
|
-
import Overlay from '../components/Overlay';
|
|
11
9
|
import { getTrackNameMaxLen, getTrackOffsets } from './util';
|
|
12
|
-
|
|
10
|
+
import Overlay from '../components/Overlay';
|
|
13
11
|
export async function renderToSvg(model, opts) {
|
|
14
12
|
var _a;
|
|
15
13
|
const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset', Wrapper = ({ children }) => children, themeName = 'default', } = opts;
|
|
@@ -35,7 +33,6 @@ export async function renderToSvg(model, opts) {
|
|
|
35
33
|
const trackOffsets = views.map((view, idx) => getTrackOffsets(view, textOffset, fontSize + (idx > 0 ? heights[idx - 1] : 0) + offset));
|
|
36
34
|
const w = width + trackLabelOffset;
|
|
37
35
|
const t = createJBrowseTheme(theme);
|
|
38
|
-
// the xlink namespace is used for rendering <image> tag
|
|
39
36
|
return renderToStaticMarkup(React.createElement(ThemeProvider, { theme: t },
|
|
40
37
|
React.createElement(Wrapper, null,
|
|
41
38
|
React.createElement("svg", { width: width, height: totalHeightSvg, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, w + shift * 2, totalHeightSvg].toString() },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractSessionModel } from '@jbrowse/core/util';
|
|
2
|
-
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
1
|
+
import type { AbstractSessionModel } from '@jbrowse/core/util';
|
|
2
|
+
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
3
|
export declare function getTrackNameMaxLen(views: LinearGenomeViewModel[], fontSize: number, session: AbstractSessionModel): number;
|
|
4
4
|
export declare function getTrackOffsets(view: LinearGenomeViewModel, textOffset: number, extra?: number): Record<string, number>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { max, measureText } from '@jbrowse/core/util';
|
|
2
|
-
// locals
|
|
3
2
|
import { getTrackName } from '@jbrowse/core/util/tracks';
|
|
4
3
|
export function getTrackNameMaxLen(views, fontSize, session) {
|
|
5
4
|
return max(views.flatMap(view => view.tracks.map(t => measureText(getTrackName(t.configuration, session), fontSize))), 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { LayoutRecord } from './model';
|
|
2
|
+
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
3
|
type LGV = LinearGenomeViewModel;
|
|
4
4
|
interface Display {
|
|
5
5
|
height: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import { clamp } from '@jbrowse/core/util';
|
|
3
3
|
const [, TOP, , BOTTOM] = [0, 1, 2, 3];
|
|
4
4
|
function cheight(chunk) {
|
|
@@ -14,7 +14,6 @@ export function getPxFromCoordinate(view, refName, coord) {
|
|
|
14
14
|
var _a;
|
|
15
15
|
return (((_a = view.bpToPx({ refName, coord })) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0) - view.offsetPx;
|
|
16
16
|
}
|
|
17
|
-
// get's the yposition of a layout record in a track
|
|
18
17
|
export function yPos(trackId, level, views, tracks, c, getYPosOverride) {
|
|
19
18
|
const display = tracks[level].displays[0];
|
|
20
19
|
const min = 0;
|
|
@@ -29,19 +28,12 @@ export function yPos(trackId, level, views, tracks, c, getYPosOverride) {
|
|
|
29
28
|
heightFromSpecificLevel(views, trackId, level, getYPosOverride) +
|
|
30
29
|
display.scrollTop);
|
|
31
30
|
}
|
|
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
31
|
export const useNextFrame = (variable) => {
|
|
37
32
|
const [, setNextFrameState] = useState();
|
|
38
33
|
useEffect(() => {
|
|
39
34
|
setNextFrameState(variable);
|
|
40
35
|
}, [variable]);
|
|
41
36
|
};
|
|
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
37
|
export function intersect(cb, a1 = [], a2 = [], ...rest) {
|
|
46
38
|
const ids = new Set(a2.map(elt => cb(elt)));
|
|
47
39
|
const a12 = a1.filter(value => ids.has(cb(value)));
|
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.
|
|
3
|
+
"version": "2.18.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": "^
|
|
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": "
|
|
61
|
+
"gitHead": "c344ea60099cb7e460b77f15808946b24a7eee74"
|
|
62
62
|
}
|