@jbrowse/plugin-linear-comparative-view 2.7.2 → 2.9.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/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +7 -0
- package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +68 -0
- package/dist/LGVSyntenyDisplay/components/util.d.ts +8 -0
- package/dist/LGVSyntenyDisplay/components/util.js +111 -0
- package/dist/LGVSyntenyDisplay/model.d.ts +15 -14
- package/dist/LGVSyntenyDisplay/model.js +35 -104
- package/dist/LaunchLinearSyntenyView.js +6 -2
- package/dist/LinearComparativeView/model.d.ts +122 -2
- package/dist/LinearComparativeView/model.js +2 -2
- package/dist/LinearReadVsRef/LinearReadVsRef.js +1 -1
- package/dist/LinearSyntenyView/components/ImportForm/index.js +1 -1
- package/dist/LinearSyntenyView/model.d.ts +364 -4
- package/dist/SyntenyTrack/configSchema.d.ts +5 -0
- package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +7 -0
- package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +42 -0
- package/esm/LGVSyntenyDisplay/components/util.d.ts +8 -0
- package/esm/LGVSyntenyDisplay/components/util.js +107 -0
- package/esm/LGVSyntenyDisplay/model.d.ts +15 -14
- package/esm/LGVSyntenyDisplay/model.js +14 -106
- package/esm/LaunchLinearSyntenyView.js +6 -2
- package/esm/LinearComparativeView/model.d.ts +122 -2
- package/esm/LinearComparativeView/model.js +2 -2
- package/esm/LinearReadVsRef/LinearReadVsRef.js +1 -1
- package/esm/LinearSyntenyView/components/ImportForm/index.js +1 -1
- package/esm/LinearSyntenyView/model.d.ts +364 -4
- package/esm/SyntenyTrack/configSchema.d.ts +5 -0
- package/package.json +2 -2
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const react_1 = __importStar(require("react"));
|
|
27
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
28
|
+
const util_1 = require("@jbrowse/core/util");
|
|
29
|
+
const material_1 = require("@mui/material");
|
|
30
|
+
const util_2 = require("./util");
|
|
31
|
+
const mui_1 = require("tss-react/mui");
|
|
32
|
+
const useStyles = (0, mui_1.makeStyles)()({
|
|
33
|
+
padding: {
|
|
34
|
+
margin: 10,
|
|
35
|
+
border: '1px solid #ccc',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
function LaunchSyntenyViewDialog({ model, feature, handleClose, }) {
|
|
39
|
+
const { classes } = useStyles();
|
|
40
|
+
const inverted = feature.get('strand') === -1;
|
|
41
|
+
const [horizontallyFlip, setHorizontallyFlip] = (0, react_1.useState)(inverted);
|
|
42
|
+
const [windowSize, setWindowSize] = (0, react_1.useState)('1000');
|
|
43
|
+
return (react_1.default.createElement(ui_1.Dialog, { open: true, title: "Launch synteny view", onClose: handleClose },
|
|
44
|
+
react_1.default.createElement(material_1.DialogContent, null,
|
|
45
|
+
inverted ? (react_1.default.createElement(material_1.FormControlLabel, { className: classes.padding, control: react_1.default.createElement(material_1.Checkbox, { checked: horizontallyFlip, onChange: event => setHorizontallyFlip(event.target.checked) }), label: "Note: The feature is inverted in orientation on the target\n sequence. This will result in the lower panel having genomic\n coordinates decreasing left to right. Horizontally flip?" })) : null,
|
|
46
|
+
react_1.default.createElement(material_1.TextField, { label: "Add window size in bp", value: windowSize, onChange: event => setWindowSize(event.target.value) })),
|
|
47
|
+
react_1.default.createElement(material_1.DialogActions, null,
|
|
48
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => {
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
50
|
+
;
|
|
51
|
+
(async () => {
|
|
52
|
+
try {
|
|
53
|
+
await (0, util_2.navToSynteny)({
|
|
54
|
+
feature,
|
|
55
|
+
windowSize: +windowSize,
|
|
56
|
+
horizontallyFlip,
|
|
57
|
+
model,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
(0, util_1.getSession)(model).notify(`${e}`, 'error');
|
|
62
|
+
}
|
|
63
|
+
})();
|
|
64
|
+
handleClose();
|
|
65
|
+
} }, "Submit"),
|
|
66
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel"))));
|
|
67
|
+
}
|
|
68
|
+
exports.default = LaunchSyntenyViewDialog;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Feature } from '@jbrowse/core/util';
|
|
2
|
+
import { IAnyStateTreeNode } from 'mobx-state-tree';
|
|
3
|
+
export declare function navToSynteny({ feature, windowSize: ws, model, horizontallyFlip, }: {
|
|
4
|
+
windowSize: number;
|
|
5
|
+
horizontallyFlip: boolean;
|
|
6
|
+
feature: Feature;
|
|
7
|
+
model: IAnyStateTreeNode;
|
|
8
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.navToSynteny = void 0;
|
|
4
|
+
const util_1 = require("@jbrowse/core/util");
|
|
5
|
+
const plugin_alignments_1 = require("@jbrowse/plugin-alignments");
|
|
6
|
+
const mobx_1 = require("mobx");
|
|
7
|
+
const { parseCigar } = plugin_alignments_1.MismatchParser;
|
|
8
|
+
function f(n) {
|
|
9
|
+
return Math.floor(n);
|
|
10
|
+
}
|
|
11
|
+
function findPosInCigar(cigar, startX) {
|
|
12
|
+
let featX = 0;
|
|
13
|
+
let mateX = 0;
|
|
14
|
+
for (let i = 0; i < cigar.length; i++) {
|
|
15
|
+
const len = +cigar[i];
|
|
16
|
+
const op = cigar[i + 1];
|
|
17
|
+
const min = Math.min(len, startX - featX);
|
|
18
|
+
if (featX >= startX) {
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
else if (op === 'I') {
|
|
22
|
+
mateX += len;
|
|
23
|
+
}
|
|
24
|
+
else if (op === 'D') {
|
|
25
|
+
featX += min;
|
|
26
|
+
}
|
|
27
|
+
else if (op === 'M') {
|
|
28
|
+
mateX += min;
|
|
29
|
+
featX += min;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return [featX, mateX];
|
|
33
|
+
}
|
|
34
|
+
async function navToSynteny({ feature, windowSize: ws, model, horizontallyFlip, }) {
|
|
35
|
+
const session = (0, util_1.getSession)(model);
|
|
36
|
+
const track = (0, util_1.getContainingTrack)(model);
|
|
37
|
+
const view = (0, util_1.getContainingView)(model);
|
|
38
|
+
const reg = view.dynamicBlocks.contentBlocks[0];
|
|
39
|
+
const cigar = feature.get('CIGAR');
|
|
40
|
+
const strand = feature.get('strand');
|
|
41
|
+
const regStart = reg.start;
|
|
42
|
+
const regEnd = reg.end;
|
|
43
|
+
const featStart = feature.get('start');
|
|
44
|
+
const featEnd = feature.get('end');
|
|
45
|
+
const mate = feature.get('mate');
|
|
46
|
+
const mateStart = mate.start;
|
|
47
|
+
const mateEnd = mate.end;
|
|
48
|
+
const mateAsm = mate.assemblyName;
|
|
49
|
+
const mateRef = mate.refName;
|
|
50
|
+
const featAsm = reg.assemblyName;
|
|
51
|
+
const featRef = reg.refName;
|
|
52
|
+
let rMateStart;
|
|
53
|
+
let rMateEnd;
|
|
54
|
+
let rFeatStart;
|
|
55
|
+
let rFeatEnd;
|
|
56
|
+
if (cigar) {
|
|
57
|
+
const p = parseCigar(cigar);
|
|
58
|
+
const [fStartX, mStartX] = findPosInCigar(p, regStart - featStart);
|
|
59
|
+
const [fEndX, mEndX] = findPosInCigar(p, regEnd - featStart);
|
|
60
|
+
// avoid multiply by 0 with strand undefined
|
|
61
|
+
const flipper = strand === -1 ? -1 : 1;
|
|
62
|
+
rFeatStart = featStart + fStartX;
|
|
63
|
+
rFeatEnd = featStart + fEndX;
|
|
64
|
+
rMateStart = (strand === -1 ? mateEnd : mateStart) + mStartX * flipper;
|
|
65
|
+
rMateEnd = (strand === -1 ? mateEnd : mateStart) + mEndX * flipper;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
rFeatStart = featStart;
|
|
69
|
+
rFeatEnd = featEnd;
|
|
70
|
+
rMateStart = mateStart;
|
|
71
|
+
rMateEnd = mateEnd;
|
|
72
|
+
}
|
|
73
|
+
const trackId = track.configuration.trackId;
|
|
74
|
+
const view2 = session.addView('LinearSyntenyView', {
|
|
75
|
+
type: 'LinearSyntenyView',
|
|
76
|
+
views: [
|
|
77
|
+
{
|
|
78
|
+
id: `${Math.random()}`,
|
|
79
|
+
type: 'LinearGenomeView',
|
|
80
|
+
hideHeader: true,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: `${Math.random()}`,
|
|
84
|
+
type: 'LinearGenomeView',
|
|
85
|
+
hideHeader: true,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
tracks: [
|
|
89
|
+
{
|
|
90
|
+
configuration: trackId,
|
|
91
|
+
type: 'SyntenyTrack',
|
|
92
|
+
displays: [
|
|
93
|
+
{
|
|
94
|
+
type: 'LinearSyntenyDisplay',
|
|
95
|
+
configuration: `${trackId}-LinearSyntenyDisplay`,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
});
|
|
101
|
+
const l1 = `${featRef}:${f(rFeatStart - ws)}-${f(rFeatEnd + ws)}`;
|
|
102
|
+
const m1 = Math.min(rMateStart, rMateEnd);
|
|
103
|
+
const m2 = Math.max(rMateStart, rMateEnd);
|
|
104
|
+
const l2 = `${mateRef}:${f(m1 - ws)}-${f(m2 + ws)}${horizontallyFlip ? '[rev]' : ''}`;
|
|
105
|
+
await (0, mobx_1.when)(() => view2.width !== undefined);
|
|
106
|
+
await Promise.all([
|
|
107
|
+
view2.views[0].navToLocString(l1, featAsm),
|
|
108
|
+
view2.views[1].navToLocString(l2, mateAsm),
|
|
109
|
+
]);
|
|
110
|
+
}
|
|
111
|
+
exports.navToSynteny = navToSynteny;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
|
|
3
|
-
import { Feature } from '@jbrowse/core/util';
|
|
4
3
|
/**
|
|
5
4
|
* #stateModel LGVSyntenyDisplay
|
|
6
5
|
* extends `LinearPileupDisplay`, displays location of "synteny" feature in a
|
|
@@ -35,7 +34,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
|
|
|
35
34
|
renderInProgress: AbortController | undefined;
|
|
36
35
|
filled: boolean;
|
|
37
36
|
reactElement: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
38
|
-
features: Map<string, Feature> | undefined;
|
|
37
|
+
features: Map<string, import("@jbrowse/core/util").Feature> | undefined;
|
|
39
38
|
layout: any;
|
|
40
39
|
status: string;
|
|
41
40
|
error: unknown;
|
|
@@ -53,7 +52,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
|
|
|
53
52
|
setMessage(messageText: string): void;
|
|
54
53
|
setRendered(props: {
|
|
55
54
|
reactElement: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
56
|
-
features: Map<string, Feature>;
|
|
55
|
+
features: Map<string, import("@jbrowse/core/util").Feature>;
|
|
57
56
|
layout: any;
|
|
58
57
|
maxHeightReached: boolean;
|
|
59
58
|
renderProps: any;
|
|
@@ -70,7 +69,9 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
|
|
|
70
69
|
};
|
|
71
70
|
fetchSizeLimit: {
|
|
72
71
|
type: string;
|
|
73
|
-
defaultValue: number;
|
|
72
|
+
defaultValue: number; /**
|
|
73
|
+
* #property
|
|
74
|
+
*/
|
|
74
75
|
description: string;
|
|
75
76
|
};
|
|
76
77
|
height: {
|
|
@@ -208,7 +209,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
|
|
|
208
209
|
regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react").JSX.Element | null;
|
|
209
210
|
} & {
|
|
210
211
|
featureIdUnderMouse: string | undefined;
|
|
211
|
-
contextMenuFeature: Feature | undefined;
|
|
212
|
+
contextMenuFeature: import("@jbrowse/core/util").Feature | undefined;
|
|
212
213
|
} & {
|
|
213
214
|
readonly blockType: "dynamicBlocks" | "staticBlocks";
|
|
214
215
|
readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
@@ -218,18 +219,18 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
|
|
|
218
219
|
readonly selectedFeatureId: string | undefined;
|
|
219
220
|
readonly DisplayMessageComponent: import("react").FC<any> | undefined;
|
|
220
221
|
} & {
|
|
221
|
-
readonly features: import("@jbrowse/core/util/compositeMap").default<string, Feature>;
|
|
222
|
-
readonly featureUnderMouse: Feature | undefined;
|
|
222
|
+
readonly features: import("@jbrowse/core/util/compositeMap").default<string, import("@jbrowse/core/util").Feature>;
|
|
223
|
+
readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
|
|
223
224
|
getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
|
|
224
225
|
getFeatureByID(blockKey: string, id: string): [number, number, number, number] | undefined;
|
|
225
226
|
searchFeatureByID(id: string): [number, number, number, number] | undefined;
|
|
226
227
|
} & {
|
|
227
228
|
addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
|
|
228
229
|
deleteBlock(key: string): void;
|
|
229
|
-
selectFeature(feature: Feature): void;
|
|
230
|
+
selectFeature(feature: import("@jbrowse/core/util").Feature): void;
|
|
230
231
|
clearFeatureSelection(): void;
|
|
231
232
|
setFeatureIdUnderMouse(feature?: string | undefined): void;
|
|
232
|
-
setContextMenuFeature(feature?: Feature | undefined): void;
|
|
233
|
+
setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature | undefined): void;
|
|
233
234
|
} & {
|
|
234
235
|
reload(): Promise<void>;
|
|
235
236
|
} & {
|
|
@@ -241,7 +242,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
|
|
|
241
242
|
afterAttach(): void;
|
|
242
243
|
} & {
|
|
243
244
|
colorTagMap: import("mobx").ObservableMap<string, string>;
|
|
244
|
-
featureUnderMouseVolatile: Feature | undefined;
|
|
245
|
+
featureUnderMouseVolatile: import("@jbrowse/core/util").Feature | undefined;
|
|
245
246
|
tagsReady: boolean;
|
|
246
247
|
} & {
|
|
247
248
|
readonly autorunReady: boolean;
|
|
@@ -256,9 +257,9 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
|
|
|
256
257
|
extra?: import("@jbrowse/plugin-alignments/src/shared/color").ExtraColorBy | undefined;
|
|
257
258
|
}): void;
|
|
258
259
|
updateColorTagMap(uniqueTag: string[]): void;
|
|
259
|
-
setFeatureUnderMouse(feat?: Feature | undefined): void;
|
|
260
|
-
selectFeature(feature: Feature): void;
|
|
261
|
-
copyFeatureToClipboard(feature: Feature): void;
|
|
260
|
+
setFeatureUnderMouse(feat?: import("@jbrowse/core/util").Feature | undefined): void;
|
|
261
|
+
selectFeature(feature: import("@jbrowse/core/util").Feature): void;
|
|
262
|
+
copyFeatureToClipboard(feature: import("@jbrowse/core/util").Feature): void;
|
|
262
263
|
setConfig(conf: {
|
|
263
264
|
[x: string]: any;
|
|
264
265
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
@@ -275,7 +276,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
|
|
|
275
276
|
} & {
|
|
276
277
|
readonly maxHeight: any;
|
|
277
278
|
readonly featureHeightSetting: any;
|
|
278
|
-
readonly featureUnderMouse: Feature | undefined;
|
|
279
|
+
readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
|
|
279
280
|
renderReady(): boolean;
|
|
280
281
|
readonly filters: import("@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain").default;
|
|
281
282
|
} & {
|
|
@@ -1,112 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const react_1 = require("react");
|
|
3
27
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
28
|
const util_1 = require("@jbrowse/core/util");
|
|
5
29
|
const plugin_alignments_1 = require("@jbrowse/plugin-alignments");
|
|
6
30
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
7
|
-
const
|
|
8
|
-
const { parseCigar } = plugin_alignments_1.MismatchParser;
|
|
9
|
-
function findPosInCigar(cigar, startX) {
|
|
10
|
-
let featX = 0;
|
|
11
|
-
let mateX = 0;
|
|
12
|
-
for (let i = 0; i < cigar.length; i++) {
|
|
13
|
-
const len = +cigar[i];
|
|
14
|
-
const op = cigar[i + 1];
|
|
15
|
-
const min = Math.min(len, startX - featX);
|
|
16
|
-
if (featX >= startX) {
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
else if (op === 'I') {
|
|
20
|
-
mateX += len;
|
|
21
|
-
}
|
|
22
|
-
else if (op === 'D') {
|
|
23
|
-
featX += min;
|
|
24
|
-
}
|
|
25
|
-
else if (op === 'M') {
|
|
26
|
-
mateX += min;
|
|
27
|
-
featX += min;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return [featX, mateX];
|
|
31
|
-
}
|
|
32
|
-
async function navToSynteny(feature, self) {
|
|
33
|
-
const session = (0, util_1.getSession)(self);
|
|
34
|
-
const track = (0, util_1.getContainingTrack)(self);
|
|
35
|
-
const view = (0, util_1.getContainingView)(self);
|
|
36
|
-
const reg = view.dynamicBlocks.contentBlocks[0];
|
|
37
|
-
const cigar = feature.get('CIGAR');
|
|
38
|
-
const strand = feature.get('strand');
|
|
39
|
-
const regStart = reg.start;
|
|
40
|
-
const regEnd = reg.end;
|
|
41
|
-
const featStart = feature.get('start');
|
|
42
|
-
const featEnd = feature.get('end');
|
|
43
|
-
const mate = feature.get('mate');
|
|
44
|
-
const mateStart = mate.start;
|
|
45
|
-
const mateEnd = mate.end;
|
|
46
|
-
const mateAsm = mate.assemblyName;
|
|
47
|
-
const mateRef = mate.refName;
|
|
48
|
-
const featAsm = reg.assemblyName;
|
|
49
|
-
const featRef = reg.refName;
|
|
50
|
-
let rMateStart;
|
|
51
|
-
let rMateEnd;
|
|
52
|
-
let rFeatStart;
|
|
53
|
-
let rFeatEnd;
|
|
54
|
-
if (cigar) {
|
|
55
|
-
const p = parseCigar(cigar);
|
|
56
|
-
const [fStartX, mStartX] = findPosInCigar(p, regStart - featStart);
|
|
57
|
-
const [fEndX, mEndX] = findPosInCigar(p, regEnd - featStart);
|
|
58
|
-
// avoid multiply by 0 with strand undefined
|
|
59
|
-
const flipper = strand === -1 ? -1 : 1;
|
|
60
|
-
rFeatStart = featStart + fStartX;
|
|
61
|
-
rFeatEnd = featStart + fEndX;
|
|
62
|
-
rMateStart = (strand === -1 ? mateEnd : mateStart) + mStartX * flipper;
|
|
63
|
-
rMateEnd = (strand === -1 ? mateEnd : mateStart) + mEndX * flipper;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
rFeatStart = featStart;
|
|
67
|
-
rFeatEnd = featEnd;
|
|
68
|
-
rMateStart = mateStart;
|
|
69
|
-
rMateEnd = mateEnd;
|
|
70
|
-
}
|
|
71
|
-
const trackId = track.configuration.trackId;
|
|
72
|
-
const view2 = session.addView('LinearSyntenyView', {
|
|
73
|
-
type: 'LinearSyntenyView',
|
|
74
|
-
views: [
|
|
75
|
-
{
|
|
76
|
-
id: `${Math.random()}`,
|
|
77
|
-
type: 'LinearGenomeView',
|
|
78
|
-
hideHeader: true,
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: `${Math.random()}`,
|
|
82
|
-
type: 'LinearGenomeView',
|
|
83
|
-
hideHeader: true,
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
tracks: [
|
|
87
|
-
{
|
|
88
|
-
configuration: trackId,
|
|
89
|
-
type: 'SyntenyTrack',
|
|
90
|
-
displays: [
|
|
91
|
-
{
|
|
92
|
-
type: 'LinearSyntenyDisplay',
|
|
93
|
-
configuration: `${trackId}-LinearSyntenyDisplay`,
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
});
|
|
99
|
-
const f = (n) => Math.floor(n);
|
|
100
|
-
const l1 = `${featRef}:${f(rFeatStart)}-${f(rFeatEnd)}`;
|
|
101
|
-
const m1 = Math.min(rMateStart, rMateEnd);
|
|
102
|
-
const m2 = Math.max(rMateStart, rMateEnd);
|
|
103
|
-
const l2 = `${mateRef}:${f(m1)}-${f(m2)}${strand === -1 ? '[rev]' : ''}`;
|
|
104
|
-
await (0, mobx_1.when)(() => view2.width !== undefined);
|
|
105
|
-
await Promise.all([
|
|
106
|
-
view2.views[0].navToLocString(l1, featAsm),
|
|
107
|
-
view2.views[1].navToLocString(l2, mateAsm),
|
|
108
|
-
]);
|
|
109
|
-
}
|
|
31
|
+
const LaunchSyntenyViewDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/LaunchSyntenyViewDialog'))));
|
|
110
32
|
/**
|
|
111
33
|
* #stateModel LGVSyntenyDisplay
|
|
112
34
|
* extends `LinearPileupDisplay`, displays location of "synteny" feature in a
|
|
@@ -135,7 +57,16 @@ function stateModelFactory(schema) {
|
|
|
135
57
|
? [
|
|
136
58
|
{
|
|
137
59
|
label: 'Open synteny view for this position',
|
|
138
|
-
onClick: () =>
|
|
60
|
+
onClick: () => {
|
|
61
|
+
(0, util_1.getSession)(self).queueDialog(handleClose => [
|
|
62
|
+
LaunchSyntenyViewDialog,
|
|
63
|
+
{
|
|
64
|
+
model: self,
|
|
65
|
+
handleClose,
|
|
66
|
+
feature,
|
|
67
|
+
},
|
|
68
|
+
]);
|
|
69
|
+
},
|
|
139
70
|
},
|
|
140
71
|
]
|
|
141
72
|
: []),
|
|
@@ -26,8 +26,12 @@ function LaunchLinearSyntenyView(pluginManager) {
|
|
|
26
26
|
const idsNotFound = [];
|
|
27
27
|
await Promise.all(views.map(async (data, idx) => {
|
|
28
28
|
const view = model.views[idx];
|
|
29
|
-
const { loc, tracks = [] } = data;
|
|
30
|
-
await
|
|
29
|
+
const { assembly, loc, tracks = [] } = data;
|
|
30
|
+
const asm = await assemblyManager.waitForAssembly(assembly);
|
|
31
|
+
if (!asm) {
|
|
32
|
+
throw new Error(`Assembly ${data.assembly} failed to load`);
|
|
33
|
+
}
|
|
34
|
+
await view.navToSearchString({ input: loc, assembly: asm });
|
|
31
35
|
tracks.forEach(track => tryTrack(view, track, idsNotFound));
|
|
32
36
|
}));
|
|
33
37
|
tracks.forEach(track => tryTrack(model, track, idsNotFound));
|
|
@@ -123,7 +123,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
|
|
|
123
123
|
} & {
|
|
124
124
|
moveTrack(movingId: string, targetId: string): void;
|
|
125
125
|
closeView(): void;
|
|
126
|
-
toggleTrack(trackId: string):
|
|
126
|
+
toggleTrack(trackId: string): boolean;
|
|
127
127
|
setTrackLabels(setting: "offset" | "hidden" | "overlapping"): void;
|
|
128
128
|
toggleCenterLine(): void;
|
|
129
129
|
setDisplayedRegions(regions: import("@jbrowse/core/util").Region[]): void;
|
|
@@ -173,6 +173,126 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
|
|
|
173
173
|
} & {
|
|
174
174
|
moveTo(start?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined, end?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined): void;
|
|
175
175
|
navToLocString(input: string, optAssemblyName?: string | undefined): Promise<void>;
|
|
176
|
+
navToSearchString({ input, assembly, }: {
|
|
177
|
+
input: string;
|
|
178
|
+
assembly: {
|
|
179
|
+
configuration: any;
|
|
180
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
181
|
+
error: unknown;
|
|
182
|
+
loaded: boolean;
|
|
183
|
+
loadingP: Promise<void> | undefined;
|
|
184
|
+
volatileRegions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
|
|
185
|
+
refNameAliases: {
|
|
186
|
+
[x: string]: string | undefined;
|
|
187
|
+
} | undefined;
|
|
188
|
+
lowerCaseRefNameAliases: {
|
|
189
|
+
[x: string]: string | undefined;
|
|
190
|
+
} | undefined;
|
|
191
|
+
cytobands: import("@jbrowse/core/util").Feature[] | undefined;
|
|
192
|
+
} & {
|
|
193
|
+
getConf(arg: string): any;
|
|
194
|
+
} & {
|
|
195
|
+
readonly initialized: boolean; /**
|
|
196
|
+
* #property
|
|
197
|
+
*/
|
|
198
|
+
readonly name: string;
|
|
199
|
+
readonly regions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
|
|
200
|
+
readonly aliases: string[];
|
|
201
|
+
readonly displayName: string | undefined;
|
|
202
|
+
hasName(name: string): boolean;
|
|
203
|
+
readonly allAliases: string[];
|
|
204
|
+
readonly allRefNames: string[] | undefined;
|
|
205
|
+
readonly lowerCaseRefNames: string[] | undefined;
|
|
206
|
+
readonly allRefNamesWithLowerCase: string[] | undefined;
|
|
207
|
+
readonly rpcManager: import("@jbrowse/core/rpc/RpcManager").default;
|
|
208
|
+
readonly refNameColors: string[];
|
|
209
|
+
} & {
|
|
210
|
+
readonly refNames: string[] | undefined;
|
|
211
|
+
} & {
|
|
212
|
+
getCanonicalRefName(refName: string): string | undefined;
|
|
213
|
+
getRefNameColor(refName: string): string | undefined;
|
|
214
|
+
isValidRefName(refName: string): boolean;
|
|
215
|
+
} & {
|
|
216
|
+
setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: import("@jbrowse/core/assemblyManager/assembly").Loading): void;
|
|
217
|
+
setError(e: unknown): void;
|
|
218
|
+
setRegions(regions: import("@jbrowse/core/util").Region[]): void;
|
|
219
|
+
setRefNameAliases(aliases: {
|
|
220
|
+
[x: string]: string | undefined;
|
|
221
|
+
}, lcAliases: {
|
|
222
|
+
[x: string]: string | undefined;
|
|
223
|
+
}): void;
|
|
224
|
+
setCytobands(cytobands: import("@jbrowse/core/util").Feature[]): void;
|
|
225
|
+
setLoadingP(p?: Promise<void> | undefined): void;
|
|
226
|
+
load(): Promise<void>;
|
|
227
|
+
loadPre(): Promise<void>;
|
|
228
|
+
} & {
|
|
229
|
+
getAdapterMapEntry(adapterConf: unknown, options: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<import("@jbrowse/core/assemblyManager/assembly").RefNameMap>;
|
|
230
|
+
getRefNameMapForAdapter(adapterConf: unknown, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
|
|
231
|
+
[x: string]: string | undefined;
|
|
232
|
+
}>;
|
|
233
|
+
getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
|
|
234
|
+
[x: string]: string | undefined;
|
|
235
|
+
}>;
|
|
236
|
+
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
237
|
+
configuration: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
238
|
+
}, {
|
|
239
|
+
error: unknown;
|
|
240
|
+
loaded: boolean;
|
|
241
|
+
loadingP: Promise<void> | undefined;
|
|
242
|
+
volatileRegions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
|
|
243
|
+
refNameAliases: {
|
|
244
|
+
[x: string]: string | undefined;
|
|
245
|
+
} | undefined;
|
|
246
|
+
lowerCaseRefNameAliases: {
|
|
247
|
+
[x: string]: string | undefined;
|
|
248
|
+
} | undefined;
|
|
249
|
+
cytobands: import("@jbrowse/core/util").Feature[] | undefined;
|
|
250
|
+
} & {
|
|
251
|
+
getConf(arg: string): any;
|
|
252
|
+
} & {
|
|
253
|
+
readonly initialized: boolean; /**
|
|
254
|
+
* #property
|
|
255
|
+
*/
|
|
256
|
+
readonly name: string;
|
|
257
|
+
readonly regions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
|
|
258
|
+
readonly aliases: string[];
|
|
259
|
+
readonly displayName: string | undefined;
|
|
260
|
+
hasName(name: string): boolean;
|
|
261
|
+
readonly allAliases: string[];
|
|
262
|
+
readonly allRefNames: string[] | undefined;
|
|
263
|
+
readonly lowerCaseRefNames: string[] | undefined;
|
|
264
|
+
readonly allRefNamesWithLowerCase: string[] | undefined;
|
|
265
|
+
readonly rpcManager: import("@jbrowse/core/rpc/RpcManager").default;
|
|
266
|
+
readonly refNameColors: string[];
|
|
267
|
+
} & {
|
|
268
|
+
readonly refNames: string[] | undefined;
|
|
269
|
+
} & {
|
|
270
|
+
getCanonicalRefName(refName: string): string | undefined;
|
|
271
|
+
getRefNameColor(refName: string): string | undefined;
|
|
272
|
+
isValidRefName(refName: string): boolean;
|
|
273
|
+
} & {
|
|
274
|
+
setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: import("@jbrowse/core/assemblyManager/assembly").Loading): void;
|
|
275
|
+
setError(e: unknown): void;
|
|
276
|
+
setRegions(regions: import("@jbrowse/core/util").Region[]): void;
|
|
277
|
+
setRefNameAliases(aliases: {
|
|
278
|
+
[x: string]: string | undefined;
|
|
279
|
+
}, lcAliases: {
|
|
280
|
+
[x: string]: string | undefined;
|
|
281
|
+
}): void;
|
|
282
|
+
setCytobands(cytobands: import("@jbrowse/core/util").Feature[]): void;
|
|
283
|
+
setLoadingP(p?: Promise<void> | undefined): void;
|
|
284
|
+
load(): Promise<void>;
|
|
285
|
+
loadPre(): Promise<void>;
|
|
286
|
+
} & {
|
|
287
|
+
getAdapterMapEntry(adapterConf: unknown, options: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<import("@jbrowse/core/assemblyManager/assembly").RefNameMap>;
|
|
288
|
+
getRefNameMapForAdapter(adapterConf: unknown, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
|
|
289
|
+
[x: string]: string | undefined;
|
|
290
|
+
}>;
|
|
291
|
+
getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
|
|
292
|
+
[x: string]: string | undefined;
|
|
293
|
+
}>;
|
|
294
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
295
|
+
}): Promise<void>;
|
|
176
296
|
navToLocations(parsedLocStrings: import("@jbrowse/core/util").ParsedLocString[], assemblyName?: string | undefined): Promise<void>;
|
|
177
297
|
navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation): void;
|
|
178
298
|
navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation[]): void;
|
|
@@ -277,7 +397,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
|
|
|
277
397
|
/**
|
|
278
398
|
* #action
|
|
279
399
|
*/
|
|
280
|
-
toggleTrack(trackId: string):
|
|
400
|
+
toggleTrack(trackId: string): boolean;
|
|
281
401
|
/**
|
|
282
402
|
* #action
|
|
283
403
|
*/
|
|
@@ -214,12 +214,12 @@ function stateModelFactory(pluginManager) {
|
|
|
214
214
|
* #action
|
|
215
215
|
*/
|
|
216
216
|
toggleTrack(trackId) {
|
|
217
|
-
// if we have any tracks with that configuration, turn them off
|
|
218
217
|
const hiddenCount = this.hideTrack(trackId);
|
|
219
|
-
// if none had that configuration, turn one on
|
|
220
218
|
if (!hiddenCount) {
|
|
221
219
|
this.showTrack(trackId);
|
|
220
|
+
return true;
|
|
222
221
|
}
|
|
222
|
+
return false;
|
|
223
223
|
},
|
|
224
224
|
/**
|
|
225
225
|
* #action
|
|
@@ -169,7 +169,7 @@ function ReadVsRefDialog({ track, feature: preFeature, handleClose, }) {
|
|
|
169
169
|
{
|
|
170
170
|
start: 0,
|
|
171
171
|
end: totalLength,
|
|
172
|
-
seq: featSeq || '',
|
|
172
|
+
seq: featSeq || '', // can be empty if user clicks secondary read
|
|
173
173
|
refName: readName,
|
|
174
174
|
uniqueId: `${Math.random()}`,
|
|
175
175
|
},
|
|
@@ -45,7 +45,7 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
|
45
45
|
},
|
|
46
46
|
}));
|
|
47
47
|
function TrackSelector({ setSessionTrackData, setShowTrackId, sessionTrackData, assembly1, assembly2, model, }) {
|
|
48
|
-
const [choice, setChoice] = (0, react_1.useState)('
|
|
48
|
+
const [choice, setChoice] = (0, react_1.useState)('tracklist');
|
|
49
49
|
(0, react_1.useEffect)(() => {
|
|
50
50
|
if (choice === 'none') {
|
|
51
51
|
setSessionTrackData(undefined);
|