@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,52 +1,34 @@
|
|
|
1
|
-
import { Feature, Region } from '@jbrowse/core/util';
|
|
2
1
|
import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType';
|
|
3
|
-
import {
|
|
4
|
-
import { Assembly } from '@jbrowse/core/assemblyManager/assembly';
|
|
2
|
+
import { type AbstractSessionModel, type Feature } from '@jbrowse/core/util';
|
|
3
|
+
import type { Assembly } from '@jbrowse/core/assemblyManager/assembly';
|
|
5
4
|
export default class BreakpointSplitViewType extends ViewType {
|
|
6
5
|
getBreakendCoveringRegions({ feature, assembly, }: {
|
|
7
6
|
feature: Feature;
|
|
8
7
|
assembly: Assembly;
|
|
9
8
|
}): {
|
|
10
9
|
pos: number;
|
|
11
|
-
refName: string
|
|
12
|
-
mateRefName: string
|
|
13
|
-
matePos:
|
|
10
|
+
refName: string;
|
|
11
|
+
mateRefName: string;
|
|
12
|
+
matePos: any;
|
|
14
13
|
};
|
|
15
|
-
singleLevelSnapshotFromBreakendFeature(feature
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
hideHeader: boolean;
|
|
28
|
-
bpPerPx: number;
|
|
29
|
-
offsetPx: number;
|
|
30
|
-
}[];
|
|
31
|
-
displayName: string;
|
|
32
|
-
featureData: unknown;
|
|
33
|
-
};
|
|
34
|
-
snapshotFromBreakendFeature(feature: Feature, view: {
|
|
35
|
-
displayedRegions: Region[];
|
|
36
|
-
} & IStateTreeNode): {
|
|
37
|
-
type: string;
|
|
38
|
-
views: {
|
|
14
|
+
singleLevelSnapshotFromBreakendFeature({ feature, session, assemblyName, }: {
|
|
15
|
+
feature: Feature;
|
|
16
|
+
session: AbstractSessionModel;
|
|
17
|
+
assemblyName: string;
|
|
18
|
+
}): {
|
|
19
|
+
coverage: {
|
|
20
|
+
pos: number;
|
|
21
|
+
refName: string;
|
|
22
|
+
mateRefName: string;
|
|
23
|
+
matePos: any;
|
|
24
|
+
};
|
|
25
|
+
snap: {
|
|
39
26
|
type: string;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
refName: string;
|
|
44
|
-
assemblyName: string;
|
|
27
|
+
views: {
|
|
28
|
+
type: string;
|
|
29
|
+
displayedRegions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[];
|
|
45
30
|
}[];
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
offsetPx: number;
|
|
49
|
-
}[];
|
|
50
|
-
displayName: string;
|
|
31
|
+
displayName: string;
|
|
32
|
+
};
|
|
51
33
|
};
|
|
52
34
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getSession } from '@jbrowse/core/util';
|
|
2
|
-
import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType';
|
|
3
1
|
import { parseBreakend } from '@gmod/vcf';
|
|
2
|
+
import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType';
|
|
3
|
+
import { gatherOverlaps, } from '@jbrowse/core/util';
|
|
4
4
|
export default class BreakpointSplitViewType extends ViewType {
|
|
5
5
|
getBreakendCoveringRegions({ feature, assembly, }) {
|
|
6
6
|
var _a;
|
|
@@ -8,81 +8,44 @@ export default class BreakpointSplitViewType extends ViewType {
|
|
|
8
8
|
const bnd = alt ? parseBreakend(alt) : undefined;
|
|
9
9
|
const startPos = feature.get('start');
|
|
10
10
|
const refName = feature.get('refName');
|
|
11
|
-
|
|
12
|
-
let mateRefName;
|
|
13
|
-
// a VCF breakend feature
|
|
11
|
+
const f = (ref) => assembly.getCanonicalRefName(ref) || ref;
|
|
14
12
|
if (alt === '<TRA>') {
|
|
15
13
|
const INFO = feature.get('INFO');
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
return {
|
|
15
|
+
pos: startPos,
|
|
16
|
+
refName: f(refName),
|
|
17
|
+
mateRefName: f(INFO.CHR2[0]),
|
|
18
|
+
matePos: INFO.END[0] - 1,
|
|
19
|
+
};
|
|
18
20
|
}
|
|
19
21
|
else if (bnd === null || bnd === void 0 ? void 0 : bnd.MatePosition) {
|
|
20
22
|
const matePosition = bnd.MatePosition.split(':');
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
return {
|
|
24
|
+
pos: startPos,
|
|
25
|
+
refName: f(refName),
|
|
26
|
+
mateRefName: f(matePosition[0]),
|
|
27
|
+
matePos: +matePosition[1] - 1,
|
|
28
|
+
};
|
|
23
29
|
}
|
|
24
30
|
else if (feature.get('mate')) {
|
|
25
|
-
// a generic 'mate' feature
|
|
26
31
|
const mate = feature.get('mate');
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
return {
|
|
33
|
+
pos: startPos,
|
|
34
|
+
refName: f(refName),
|
|
35
|
+
mateRefName: f(mate.refName),
|
|
36
|
+
matePos: mate.start,
|
|
37
|
+
};
|
|
29
38
|
}
|
|
30
39
|
else {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
pos: startPos,
|
|
38
|
-
refName: assembly.getCanonicalRefName(refName),
|
|
39
|
-
mateRefName: assembly.getCanonicalRefName(mateRefName),
|
|
40
|
-
matePos: endPos,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
singleLevelSnapshotFromBreakendFeature(feature, view) {
|
|
44
|
-
const session = getSession(view);
|
|
45
|
-
const bpPerPx = 10;
|
|
46
|
-
const { assemblyName } = view.displayedRegions[0];
|
|
47
|
-
const { assemblyManager } = session;
|
|
48
|
-
const assembly = assemblyManager.get(assemblyName);
|
|
49
|
-
if (!assembly) {
|
|
50
|
-
throw new Error(`assembly ${assemblyName} not found`);
|
|
40
|
+
return {
|
|
41
|
+
pos: startPos,
|
|
42
|
+
refName: f(refName),
|
|
43
|
+
mateRefName: f(refName),
|
|
44
|
+
matePos: feature.get('end'),
|
|
45
|
+
};
|
|
51
46
|
}
|
|
52
|
-
if (!assembly.regions) {
|
|
53
|
-
throw new Error(`assembly ${assemblyName} regions not loaded`);
|
|
54
|
-
}
|
|
55
|
-
const { refName, pos: startPos, mateRefName, matePos: endPos, } = this.getBreakendCoveringRegions({
|
|
56
|
-
feature,
|
|
57
|
-
assembly,
|
|
58
|
-
});
|
|
59
|
-
const topRegion = assembly.regions.find(f => f.refName === refName);
|
|
60
|
-
const bottomRegion = assembly.regions.find(f => f.refName === mateRefName);
|
|
61
|
-
const topMarkedRegion = [{ ...topRegion }, { ...topRegion }];
|
|
62
|
-
const bottomMarkedRegion = [{ ...bottomRegion }, { ...bottomRegion }];
|
|
63
|
-
topMarkedRegion[0].end = startPos;
|
|
64
|
-
topMarkedRegion[1].start = startPos;
|
|
65
|
-
bottomMarkedRegion[0].end = endPos;
|
|
66
|
-
bottomMarkedRegion[1].start = endPos;
|
|
67
|
-
return {
|
|
68
|
-
type: 'BreakpointSplitView',
|
|
69
|
-
views: [
|
|
70
|
-
{
|
|
71
|
-
type: 'LinearGenomeView',
|
|
72
|
-
displayedRegions: topMarkedRegion,
|
|
73
|
-
hideHeader: true,
|
|
74
|
-
bpPerPx,
|
|
75
|
-
offsetPx: (topRegion.start + feature.get('start')) / bpPerPx,
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
displayName: `${feature.get('name') || feature.get('id') || 'breakend'} split detail`,
|
|
79
|
-
featureData: undefined,
|
|
80
|
-
};
|
|
81
47
|
}
|
|
82
|
-
|
|
83
|
-
const session = getSession(view);
|
|
84
|
-
const bpPerPx = 10;
|
|
85
|
-
const { assemblyName } = view.displayedRegions[0];
|
|
48
|
+
singleLevelSnapshotFromBreakendFeature({ feature, session, assemblyName, }) {
|
|
86
49
|
const { assemblyManager } = session;
|
|
87
50
|
const assembly = assemblyManager.get(assemblyName);
|
|
88
51
|
if (!assembly) {
|
|
@@ -91,37 +54,25 @@ export default class BreakpointSplitViewType extends ViewType {
|
|
|
91
54
|
if (!assembly.regions) {
|
|
92
55
|
throw new Error(`assembly ${assemblyName} regions not loaded`);
|
|
93
56
|
}
|
|
94
|
-
const
|
|
57
|
+
const coverage = this.getBreakendCoveringRegions({
|
|
95
58
|
feature,
|
|
96
59
|
assembly,
|
|
97
60
|
});
|
|
61
|
+
const { refName, mateRefName } = coverage;
|
|
98
62
|
const topRegion = assembly.regions.find(f => f.refName === refName);
|
|
99
63
|
const bottomRegion = assembly.regions.find(f => f.refName === mateRefName);
|
|
100
|
-
const topMarkedRegion = [{ ...topRegion }, { ...topRegion }];
|
|
101
|
-
const bottomMarkedRegion = [{ ...bottomRegion }, { ...bottomRegion }];
|
|
102
|
-
topMarkedRegion[0].end = startPos;
|
|
103
|
-
topMarkedRegion[1].start = startPos;
|
|
104
|
-
bottomMarkedRegion[0].end = endPos;
|
|
105
|
-
bottomMarkedRegion[1].start = endPos;
|
|
106
64
|
return {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
{
|
|
117
|
-
|
|
118
|
-
displayedRegions: bottomMarkedRegion,
|
|
119
|
-
hideHeader: true,
|
|
120
|
-
bpPerPx,
|
|
121
|
-
offsetPx: (bottomRegion.start + endPos) / bpPerPx,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
displayName: `${feature.get('name') || feature.get('id') || 'breakend'} split detail`,
|
|
65
|
+
coverage,
|
|
66
|
+
snap: {
|
|
67
|
+
type: 'BreakpointSplitView',
|
|
68
|
+
views: [
|
|
69
|
+
{
|
|
70
|
+
type: 'LinearGenomeView',
|
|
71
|
+
displayedRegions: gatherOverlaps([topRegion, bottomRegion]),
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
displayName: `${feature.get('name') || feature.get('id') || 'breakend'} split detail`,
|
|
75
|
+
},
|
|
125
76
|
};
|
|
126
77
|
}
|
|
127
78
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BreakpointViewModel } from '../model';
|
|
2
|
+
import type { BreakpointViewModel } from '../model';
|
|
3
3
|
declare const AlignmentConnections: ({ model, trackId, parentRef, getTrackYPosOverride, }: {
|
|
4
4
|
model: BreakpointViewModel;
|
|
5
5
|
trackId: string;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { getSession, getStrokeProps } from '@jbrowse/core/util';
|
|
3
|
+
import { useTheme } from '@mui/material';
|
|
2
4
|
import { observer } from 'mobx-react';
|
|
3
5
|
import { getSnapshot } from 'mobx-state-tree';
|
|
4
|
-
import { useTheme } from '@mui/material';
|
|
5
|
-
import { getSession, getStrokeProps } from '@jbrowse/core/util';
|
|
6
|
-
// locals
|
|
7
6
|
import { getBadlyPairedAlignments, getMatchedAlignmentFeatures, hasPairedReads, } from './util';
|
|
8
|
-
import {
|
|
7
|
+
import { getPxFromCoordinate, heightFromSpecificLevel, useNextFrame, yPos, } from '../util';
|
|
9
8
|
import { getLongReadOrientationAbnormal, getLongReadOrientationColorOrDefault, getPairedOrientationColor, isAbnormalOrientation, } from './getOrientationColor';
|
|
10
9
|
const [LEFT, , RIGHT] = [0, 1, 2, 3];
|
|
11
10
|
const AlignmentConnections = observer(function ({ model, trackId, parentRef, getTrackYPosOverride, }) {
|
|
@@ -24,9 +23,9 @@ const AlignmentConnections = observer(function ({ model, trackId, parentRef, get
|
|
|
24
23
|
? getBadlyPairedAlignments(allFeatures)
|
|
25
24
|
: getMatchedAlignmentFeatures(allFeatures));
|
|
26
25
|
if (!hasPaired) {
|
|
27
|
-
|
|
28
|
-
m.sort((a, b) => a.
|
|
29
|
-
}
|
|
26
|
+
for (const m of layoutMatches) {
|
|
27
|
+
m.sort((a, b) => a.clipPos - b.clipPos);
|
|
28
|
+
}
|
|
30
29
|
}
|
|
31
30
|
return layoutMatches;
|
|
32
31
|
}, [allFeatures, trackId, hasPaired, model]);
|
|
@@ -38,8 +37,6 @@ const AlignmentConnections = observer(function ({ model, trackId, parentRef, get
|
|
|
38
37
|
}
|
|
39
38
|
return assembly ? (React.createElement("g", { fill: "none", "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId }, layoutMatches.map(chunk => {
|
|
40
39
|
const ret = [];
|
|
41
|
-
// we follow a path in the list of chunks, not from top to bottom, just in series
|
|
42
|
-
// following x1,y1 -> x2,y2
|
|
43
40
|
for (let i = 0; i < chunk.length - 1; i++) {
|
|
44
41
|
const { layout: c1, feature: f1, level: level1 } = chunk[i];
|
|
45
42
|
const { layout: c2, feature: f2, level: level2 } = chunk[i + 1];
|
|
@@ -47,7 +44,6 @@ const AlignmentConnections = observer(function ({ model, trackId, parentRef, get
|
|
|
47
44
|
console.warn('received null layout for a overlay feature');
|
|
48
45
|
return null;
|
|
49
46
|
}
|
|
50
|
-
// disable rendering connections in a single row
|
|
51
47
|
if (!showIntraviewLinks && level1 === level2) {
|
|
52
48
|
return null;
|
|
53
49
|
}
|
|
@@ -96,24 +92,19 @@ const AlignmentConnections = observer(function ({ model, trackId, parentRef, get
|
|
|
96
92
|
: 0;
|
|
97
93
|
const pf1 = hasPaired ? -1 : 1;
|
|
98
94
|
const y0 = heightFromSpecificLevel(views, trackId, level1, getTrackYPosOverride);
|
|
99
|
-
// possible todo: use totalCurveHeight to possibly make alternative
|
|
100
|
-
// squiggle if the S is too small
|
|
101
95
|
const path = [
|
|
102
96
|
'M',
|
|
103
97
|
x1,
|
|
104
98
|
y1,
|
|
105
99
|
'C',
|
|
106
|
-
// first bezier x,y
|
|
107
100
|
x1 + 200 * f1.get('strand') * rf1,
|
|
108
101
|
abnormalSpecialRenderFlag
|
|
109
102
|
? Math.min(y0 - yOffset + trackHeight, y1 + trackHeight)
|
|
110
103
|
: y1,
|
|
111
|
-
// second bezier x,y
|
|
112
104
|
x2 - 200 * f2.get('strand') * rf2 * pf1,
|
|
113
105
|
abnormalSpecialRenderFlag
|
|
114
106
|
? Math.min(y0 - yOffset + trackHeight, y2 + trackHeight)
|
|
115
107
|
: y2,
|
|
116
|
-
// third bezier x,y
|
|
117
108
|
x2,
|
|
118
109
|
y2,
|
|
119
110
|
].join(' ');
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import { getSession } from '@jbrowse/core/util';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { getSnapshot } from 'mobx-state-tree';
|
|
5
|
-
// locals
|
|
6
5
|
import { findMatchingAlt, getMatchedBreakendFeatures } from './util';
|
|
7
|
-
import {
|
|
6
|
+
import { getPxFromCoordinate, useNextFrame, yPos } from '../util';
|
|
8
7
|
const [LEFT] = [0, 1, 2, 3];
|
|
9
8
|
const Breakends = observer(function ({ model, trackId, parentRef: ref, getTrackYPosOverride, }) {
|
|
10
9
|
const { views } = model;
|
|
@@ -26,8 +25,6 @@ const Breakends = observer(function ({ model, trackId, parentRef: ref, getTrackY
|
|
|
26
25
|
}
|
|
27
26
|
return (React.createElement("g", { stroke: "green", strokeWidth: 5, fill: "none", "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId }, layoutMatches.map(chunk => {
|
|
28
27
|
const ret = [];
|
|
29
|
-
// we follow a path in the list of chunks, not from top to bottom, just
|
|
30
|
-
// in series following x1,y1 -> x2,y2
|
|
31
28
|
for (let i = 0; i < chunk.length - 1; i += 1) {
|
|
32
29
|
const { layout: c1, feature: f1, level: level1 } = chunk[i];
|
|
33
30
|
const { layout: c2, feature: f2, level: level2 } = chunk[i + 1];
|
|
@@ -57,19 +54,19 @@ const Breakends = observer(function ({ model, trackId, parentRef: ref, getTrackY
|
|
|
57
54
|
}
|
|
58
55
|
else {
|
|
59
56
|
const path = [
|
|
60
|
-
'M',
|
|
57
|
+
'M',
|
|
61
58
|
x1 -
|
|
62
59
|
20 *
|
|
63
60
|
(relevantAlt.Join === 'left' ? -1 : 1) *
|
|
64
61
|
(reversed1 ? -1 : 1),
|
|
65
62
|
y1,
|
|
66
|
-
'L',
|
|
63
|
+
'L',
|
|
67
64
|
x1,
|
|
68
65
|
y1,
|
|
69
|
-
'L',
|
|
66
|
+
'L',
|
|
70
67
|
x2,
|
|
71
68
|
y2,
|
|
72
|
-
'L',
|
|
69
|
+
'L',
|
|
73
70
|
x2 -
|
|
74
71
|
20 *
|
|
75
72
|
(relevantAlt.MateDirection === 'left' ? 1 : -1) *
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { observer } from 'mobx-react';
|
|
3
2
|
import { getEnv } from '@jbrowse/core/util';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
4
|
import { makeStyles } from 'tss-react/mui';
|
|
5
5
|
import BreakpointSplitViewOverlay from './BreakpointSplitViewOverlay';
|
|
6
6
|
const useStyles = makeStyles()(theme => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
|
+
import { observer } from 'mobx-react';
|
|
2
3
|
import { makeStyles } from 'tss-react/mui';
|
|
3
4
|
import Overlay from './Overlay';
|
|
4
|
-
import { observer } from 'mobx-react';
|
|
5
5
|
const useStyles = makeStyles()({
|
|
6
6
|
overlay: {
|
|
7
7
|
display: 'flex',
|
|
@@ -22,13 +22,6 @@ const BreakpointSplitViewOverlay = observer(function ({ model, }) {
|
|
|
22
22
|
width: '100%',
|
|
23
23
|
zIndex: 10,
|
|
24
24
|
pointerEvents: interactToggled ? undefined : 'none',
|
|
25
|
-
} }, matchedTracks.map(track => (
|
|
26
|
-
// note: we must pass ref down, because:
|
|
27
|
-
// - the child component needs to getBoundingClientRect on the this
|
|
28
|
-
// components SVG, and...
|
|
29
|
-
// - we cannot rely on using getBoundingClientRect in this component
|
|
30
|
-
// to make sure this works because if it gets shifted around by
|
|
31
|
-
// another element, this will not re-render necessarily
|
|
32
|
-
React.createElement(Overlay, { parentRef: ref, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId }))))));
|
|
25
|
+
} }, matchedTracks.map(track => (React.createElement(Overlay, { parentRef: ref, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId }))))));
|
|
33
26
|
});
|
|
34
27
|
export default BreakpointSplitViewOverlay;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { Button, Checkbox, CircularProgress, DialogActions, DialogContent, FormControlLabel, MenuItem, TextField, Typography, } from '@mui/material';
|
|
3
2
|
import { Dialog, ErrorMessage } from '@jbrowse/core/ui';
|
|
4
3
|
import { getSession, useLocalStorage } from '@jbrowse/core/util';
|
|
4
|
+
import { Button, Checkbox, CircularProgress, DialogActions, DialogContent, FormControlLabel, MenuItem, TextField, Typography, } from '@mui/material';
|
|
5
5
|
function LoadingMessage() {
|
|
6
6
|
return (React.createElement("div", null,
|
|
7
7
|
React.createElement(CircularProgress, { size: 20, style: { marginRight: 20 } }),
|
|
@@ -39,9 +39,7 @@ export default function ExportSvgDialog({ model, handleClose, }) {
|
|
|
39
39
|
React.createElement("br", null),
|
|
40
40
|
session.allThemes ? (React.createElement(TextField2, { select: true, label: "Theme", variant: "outlined", value: themeName, onChange: event => {
|
|
41
41
|
setThemeName(event.target.value);
|
|
42
|
-
} }, Object.entries(session.allThemes()).map(([key, val]) => (React.createElement(MenuItem, { key: key, value: key },
|
|
43
|
-
// @ts-expect-error
|
|
44
|
-
val.name || '(Unknown name)'))))) : null,
|
|
42
|
+
} }, Object.entries(session.allThemes()).map(([key, val]) => (React.createElement(MenuItem, { key: key, value: key }, val.name || '(Unknown name)'))))) : null,
|
|
45
43
|
offscreenCanvas ? (React.createElement(FormControlLabel, { control: React.createElement(Checkbox, { checked: rasterizeLayers, onChange: () => {
|
|
46
44
|
setRasterizeLayers(val => !val);
|
|
47
45
|
} }), label: "Rasterize canvas based tracks? File may be much larger if this is turned off" })) : (React.createElement(Typography, null, "Note: rasterizing layers not yet supported in this browser, so SVG size may be large"))),
|
|
@@ -2,17 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
3
|
import AlignmentConnections from './AlignmentConnections';
|
|
4
4
|
import Breakends from './Breakends';
|
|
5
|
-
import Translocations from './Translocations';
|
|
6
5
|
import PairedFeatures from './PairedFeatures';
|
|
6
|
+
import Translocations from './Translocations';
|
|
7
7
|
const Overlay = observer(function (props) {
|
|
8
8
|
var _a, _b;
|
|
9
9
|
const { model, trackId } = props;
|
|
10
10
|
const tracks = model.getMatchedTracks(trackId);
|
|
11
|
-
// curvy line type arcs
|
|
12
11
|
if (((_a = tracks[0]) === null || _a === void 0 ? void 0 : _a.type) === 'AlignmentsTrack') {
|
|
13
12
|
return React.createElement(AlignmentConnections, { ...props });
|
|
14
13
|
}
|
|
15
|
-
// translocation type arcs
|
|
16
14
|
else if (((_b = tracks[0]) === null || _b === void 0 ? void 0 : _b.type) === 'VariantTrack') {
|
|
17
15
|
return model.hasTranslocations(trackId) ? (React.createElement(Translocations, { ...props })) : model.hasPairedFeatures(trackId) ? (React.createElement(PairedFeatures, { ...props })) : (React.createElement(Breakends, { ...props }));
|
|
18
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BreakpointViewModel } from '../model';
|
|
2
|
+
import type { BreakpointViewModel } from '../model';
|
|
3
3
|
declare const PairedFeatures: ({ model, trackId, parentRef: ref, getTrackYPosOverride, }: {
|
|
4
4
|
model: BreakpointViewModel;
|
|
5
5
|
trackId: string;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import { getSession } from '@jbrowse/core/util';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { getSnapshot } from 'mobx-state-tree';
|
|
5
|
-
// locals
|
|
6
5
|
import { getMatchedPairedFeatures } from './util';
|
|
7
|
-
import {
|
|
6
|
+
import { getPxFromCoordinate, useNextFrame, yPos } from '../util';
|
|
8
7
|
const [LEFT] = [0, 1, 2, 3];
|
|
9
8
|
const PairedFeatures = observer(function ({ model, trackId, parentRef: ref, getTrackYPosOverride, }) {
|
|
10
9
|
const { views } = model;
|
|
@@ -26,8 +25,6 @@ const PairedFeatures = observer(function ({ model, trackId, parentRef: ref, getT
|
|
|
26
25
|
}
|
|
27
26
|
return (React.createElement("g", { stroke: "green", strokeWidth: 5, fill: "none", "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId }, layoutMatches.map(chunk => {
|
|
28
27
|
const ret = [];
|
|
29
|
-
// we follow a path in the list of chunks, not from top to bottom, just
|
|
30
|
-
// in series following x1,y1 -> x2,y2
|
|
31
28
|
for (let i = 0; i < chunk.length - 1; i += 1) {
|
|
32
29
|
const { layout: c1, feature: f1, level: level1 } = chunk[i];
|
|
33
30
|
const { layout: c2, feature: f2, level: level2 } = chunk[i + 1];
|
|
@@ -50,10 +47,10 @@ const PairedFeatures = observer(function ({ model, trackId, parentRef: ref, getT
|
|
|
50
47
|
const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
|
|
51
48
|
yoff;
|
|
52
49
|
const path = [
|
|
53
|
-
'M',
|
|
50
|
+
'M',
|
|
54
51
|
x1,
|
|
55
52
|
y1,
|
|
56
|
-
'L',
|
|
53
|
+
'L',
|
|
57
54
|
x2,
|
|
58
55
|
y2,
|
|
59
56
|
].join(' ');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BreakpointViewModel } from '../model';
|
|
2
|
+
import type { BreakpointViewModel } from '../model';
|
|
3
3
|
declare const Translocations: ({ model, trackId, parentRef: ref, getTrackYPosOverride, }: {
|
|
4
4
|
model: BreakpointViewModel;
|
|
5
5
|
trackId: string;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import { getSession } from '@jbrowse/core/util';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { getSnapshot } from 'mobx-state-tree';
|
|
5
|
-
// locals
|
|
6
5
|
import { getMatchedTranslocationFeatures } from './util';
|
|
7
|
-
import {
|
|
6
|
+
import { getPxFromCoordinate, useNextFrame, yPos } from '../util';
|
|
8
7
|
const [LEFT] = [0, 1, 2, 3];
|
|
9
8
|
function str(s) {
|
|
10
9
|
if (s === '+') {
|
|
@@ -35,17 +34,11 @@ const Translocations = observer(function ({ model, trackId, parentRef: ref, getT
|
|
|
35
34
|
const rect = ref.current.getBoundingClientRect();
|
|
36
35
|
yOffset = rect.top;
|
|
37
36
|
}
|
|
38
|
-
// we hardcode the TRA to go to the "other view" and if there is none, we
|
|
39
|
-
// just return null here note: would need to do processing of the INFO
|
|
40
|
-
// CHR2/END and see which view could contain those coordinates to really do
|
|
41
|
-
// it properly
|
|
42
37
|
if (views.length < 2) {
|
|
43
38
|
return null;
|
|
44
39
|
}
|
|
45
40
|
return (React.createElement("g", { fill: "none", stroke: "green", strokeWidth: 5, "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId }, layoutMatches.map(chunk => {
|
|
46
41
|
var _a, _b;
|
|
47
|
-
// we follow a path in the list of chunks, not from top to bottom,
|
|
48
|
-
// just in series following x1,y1 -> x2,y2
|
|
49
42
|
const ret = [];
|
|
50
43
|
for (const { layout: c1, feature: f1, level: level1 } of chunk) {
|
|
51
44
|
const level2 = level1 === 0 ? 1 : 0;
|
|
@@ -56,7 +49,7 @@ const Translocations = observer(function ({ model, trackId, parentRef: ref, getT
|
|
|
56
49
|
const info = f1.get('INFO');
|
|
57
50
|
const chr2 = info.CHR2[0];
|
|
58
51
|
const end2 = info.END[0];
|
|
59
|
-
const res = (_b = (_a = info.STRANDS) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.split('');
|
|
52
|
+
const res = (_b = (_a = info.STRANDS) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.split('');
|
|
60
53
|
const [myDirection, mateDirection] = res !== null && res !== void 0 ? res : ['.', '.'];
|
|
61
54
|
const r = getPxFromCoordinate(views[level2], chr2, end2);
|
|
62
55
|
if (r) {
|
|
@@ -71,16 +64,16 @@ const Translocations = observer(function ({ model, trackId, parentRef: ref, getT
|
|
|
71
64
|
const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
|
|
72
65
|
yOffset;
|
|
73
66
|
const path = [
|
|
74
|
-
'M',
|
|
67
|
+
'M',
|
|
75
68
|
x1 - 20 * str(myDirection) * (reversed1 ? -1 : 1),
|
|
76
69
|
y1,
|
|
77
|
-
'L',
|
|
70
|
+
'L',
|
|
78
71
|
x1,
|
|
79
72
|
y1,
|
|
80
|
-
'L',
|
|
73
|
+
'L',
|
|
81
74
|
x2,
|
|
82
75
|
y2,
|
|
83
|
-
'L',
|
|
76
|
+
'L',
|
|
84
77
|
x2 - 20 * str(mateDirection) * (reversed2 ? -1 : 1),
|
|
85
78
|
y2,
|
|
86
79
|
].join(' ');
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { alpha } from '@mui/material';
|
|
2
|
-
// orientation definitions from igv.js, see also
|
|
3
|
-
// https://software.broadinstitute.org/software/igv/interpreting_pair_orientations
|
|
4
2
|
export const orientationTypes = {
|
|
5
3
|
fr: {
|
|
6
4
|
F1R2: 'LR',
|
|
@@ -39,12 +37,6 @@ export const pairMap = {
|
|
|
39
37
|
RR: 'color_pair_rr',
|
|
40
38
|
RL: 'color_pair_rl',
|
|
41
39
|
};
|
|
42
|
-
// manually calculated by running
|
|
43
|
-
// const color = require('color')
|
|
44
|
-
// Object.fromEntries(Object.entries(fillColor).map(([key,val])=>{
|
|
45
|
-
// return [key, color(val).darken('0.3').hex()]
|
|
46
|
-
// }))
|
|
47
|
-
// this avoids (expensive) use of Color module at runtime
|
|
48
40
|
export const strokeColor = {
|
|
49
41
|
color_fwd_strand_not_proper: alpha('#CA6767', 0.8),
|
|
50
42
|
color_rev_strand_not_proper: alpha('#7272AA', 0.8),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Feature } from '@jbrowse/core/util';
|
|
1
|
+
import type { Feature } from '@jbrowse/core/util';
|
|
2
2
|
export declare function getBadlyPairedAlignments(features: Map<string, Feature>): Feature[][];
|
|
3
3
|
export declare function getMatchedAlignmentFeatures(features: Map<string, Feature>): Feature[][];
|
|
4
4
|
export declare function hasPairedReads(features: Map<string, Feature>): boolean;
|