@jbrowse/plugin-linear-comparative-view 2.7.1 → 2.8.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/LinearComparativeView/model.d.ts +2 -1
- package/dist/LinearSyntenyView/components/{ImportCustomTrack.js → ImportForm/ImportCustomTrack.js} +5 -21
- package/dist/LinearSyntenyView/components/{ImportSyntenyTrackSelector.d.ts → ImportForm/ImportSyntenyTrackSelector.d.ts} +1 -1
- package/{esm/LinearSyntenyView/components/ImportForm.d.ts → dist/LinearSyntenyView/components/ImportForm/index.d.ts} +1 -1
- package/dist/LinearSyntenyView/components/ImportForm/util.d.ts +10 -0
- package/dist/LinearSyntenyView/components/ImportForm/util.js +27 -0
- package/dist/LinearSyntenyView/model.d.ts +7 -4
- package/dist/LinearSyntenyView/model.js +1 -1
- 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/LinearComparativeView/model.d.ts +2 -1
- package/esm/LinearSyntenyView/components/{ImportCustomTrack.js → ImportForm/ImportCustomTrack.js} +4 -17
- package/esm/LinearSyntenyView/components/{ImportSyntenyTrackSelector.d.ts → ImportForm/ImportSyntenyTrackSelector.d.ts} +1 -1
- package/{dist/LinearSyntenyView/components/ImportForm.d.ts → esm/LinearSyntenyView/components/ImportForm/index.d.ts} +1 -1
- package/esm/LinearSyntenyView/components/ImportForm/util.d.ts +10 -0
- package/esm/LinearSyntenyView/components/ImportForm/util.js +20 -0
- package/esm/LinearSyntenyView/model.d.ts +7 -4
- package/esm/LinearSyntenyView/model.js +1 -1
- package/package.json +2 -2
- /package/dist/LinearSyntenyView/components/{ImportCustomTrack.d.ts → ImportForm/ImportCustomTrack.d.ts} +0 -0
- /package/dist/LinearSyntenyView/components/{ImportSyntenyTrackSelector.js → ImportForm/ImportSyntenyTrackSelector.js} +0 -0
- /package/dist/LinearSyntenyView/components/{ImportForm.js → ImportForm/index.js} +0 -0
- /package/esm/LinearSyntenyView/components/{ImportCustomTrack.d.ts → ImportForm/ImportCustomTrack.d.ts} +0 -0
- /package/esm/LinearSyntenyView/components/{ImportSyntenyTrackSelector.js → ImportForm/ImportSyntenyTrackSelector.js} +0 -0
- /package/esm/LinearSyntenyView/components/{ImportForm.js → ImportForm/index.js} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Dialog } from '@jbrowse/core/ui';
|
|
3
|
+
import { getSession } from '@jbrowse/core/util';
|
|
4
|
+
import { Button, Checkbox, DialogActions, DialogContent, FormControlLabel, TextField, } from '@mui/material';
|
|
5
|
+
import { navToSynteny } from './util';
|
|
6
|
+
import { makeStyles } from 'tss-react/mui';
|
|
7
|
+
const useStyles = makeStyles()({
|
|
8
|
+
padding: {
|
|
9
|
+
margin: 10,
|
|
10
|
+
border: '1px solid #ccc',
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
export default function LaunchSyntenyViewDialog({ model, feature, handleClose, }) {
|
|
14
|
+
const { classes } = useStyles();
|
|
15
|
+
const inverted = feature.get('strand') === -1;
|
|
16
|
+
const [horizontallyFlip, setHorizontallyFlip] = useState(inverted);
|
|
17
|
+
const [windowSize, setWindowSize] = useState('1000');
|
|
18
|
+
return (React.createElement(Dialog, { open: true, title: "Launch synteny view", onClose: handleClose },
|
|
19
|
+
React.createElement(DialogContent, null,
|
|
20
|
+
inverted ? (React.createElement(FormControlLabel, { className: classes.padding, control: React.createElement(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,
|
|
21
|
+
React.createElement(TextField, { label: "Add window size in bp", value: windowSize, onChange: event => setWindowSize(event.target.value) })),
|
|
22
|
+
React.createElement(DialogActions, null,
|
|
23
|
+
React.createElement(Button, { variant: "contained", onClick: () => {
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
25
|
+
;
|
|
26
|
+
(async () => {
|
|
27
|
+
try {
|
|
28
|
+
await navToSynteny({
|
|
29
|
+
feature,
|
|
30
|
+
windowSize: +windowSize,
|
|
31
|
+
horizontallyFlip,
|
|
32
|
+
model,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
getSession(model).notify(`${e}`, 'error');
|
|
37
|
+
}
|
|
38
|
+
})();
|
|
39
|
+
handleClose();
|
|
40
|
+
} }, "Submit"),
|
|
41
|
+
React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel"))));
|
|
42
|
+
}
|
|
@@ -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,107 @@
|
|
|
1
|
+
import { getSession, getContainingTrack, getContainingView, } from '@jbrowse/core/util';
|
|
2
|
+
import { MismatchParser } from '@jbrowse/plugin-alignments';
|
|
3
|
+
import { when } from 'mobx';
|
|
4
|
+
const { parseCigar } = MismatchParser;
|
|
5
|
+
function f(n) {
|
|
6
|
+
return Math.floor(n);
|
|
7
|
+
}
|
|
8
|
+
function findPosInCigar(cigar, startX) {
|
|
9
|
+
let featX = 0;
|
|
10
|
+
let mateX = 0;
|
|
11
|
+
for (let i = 0; i < cigar.length; i++) {
|
|
12
|
+
const len = +cigar[i];
|
|
13
|
+
const op = cigar[i + 1];
|
|
14
|
+
const min = Math.min(len, startX - featX);
|
|
15
|
+
if (featX >= startX) {
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
else if (op === 'I') {
|
|
19
|
+
mateX += len;
|
|
20
|
+
}
|
|
21
|
+
else if (op === 'D') {
|
|
22
|
+
featX += min;
|
|
23
|
+
}
|
|
24
|
+
else if (op === 'M') {
|
|
25
|
+
mateX += min;
|
|
26
|
+
featX += min;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return [featX, mateX];
|
|
30
|
+
}
|
|
31
|
+
export async function navToSynteny({ feature, windowSize: ws, model, horizontallyFlip, }) {
|
|
32
|
+
const session = getSession(model);
|
|
33
|
+
const track = getContainingTrack(model);
|
|
34
|
+
const view = getContainingView(model);
|
|
35
|
+
const reg = view.dynamicBlocks.contentBlocks[0];
|
|
36
|
+
const cigar = feature.get('CIGAR');
|
|
37
|
+
const strand = feature.get('strand');
|
|
38
|
+
const regStart = reg.start;
|
|
39
|
+
const regEnd = reg.end;
|
|
40
|
+
const featStart = feature.get('start');
|
|
41
|
+
const featEnd = feature.get('end');
|
|
42
|
+
const mate = feature.get('mate');
|
|
43
|
+
const mateStart = mate.start;
|
|
44
|
+
const mateEnd = mate.end;
|
|
45
|
+
const mateAsm = mate.assemblyName;
|
|
46
|
+
const mateRef = mate.refName;
|
|
47
|
+
const featAsm = reg.assemblyName;
|
|
48
|
+
const featRef = reg.refName;
|
|
49
|
+
let rMateStart;
|
|
50
|
+
let rMateEnd;
|
|
51
|
+
let rFeatStart;
|
|
52
|
+
let rFeatEnd;
|
|
53
|
+
if (cigar) {
|
|
54
|
+
const p = parseCigar(cigar);
|
|
55
|
+
const [fStartX, mStartX] = findPosInCigar(p, regStart - featStart);
|
|
56
|
+
const [fEndX, mEndX] = findPosInCigar(p, regEnd - featStart);
|
|
57
|
+
// avoid multiply by 0 with strand undefined
|
|
58
|
+
const flipper = strand === -1 ? -1 : 1;
|
|
59
|
+
rFeatStart = featStart + fStartX;
|
|
60
|
+
rFeatEnd = featStart + fEndX;
|
|
61
|
+
rMateStart = (strand === -1 ? mateEnd : mateStart) + mStartX * flipper;
|
|
62
|
+
rMateEnd = (strand === -1 ? mateEnd : mateStart) + mEndX * flipper;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
rFeatStart = featStart;
|
|
66
|
+
rFeatEnd = featEnd;
|
|
67
|
+
rMateStart = mateStart;
|
|
68
|
+
rMateEnd = mateEnd;
|
|
69
|
+
}
|
|
70
|
+
const trackId = track.configuration.trackId;
|
|
71
|
+
const view2 = session.addView('LinearSyntenyView', {
|
|
72
|
+
type: 'LinearSyntenyView',
|
|
73
|
+
views: [
|
|
74
|
+
{
|
|
75
|
+
id: `${Math.random()}`,
|
|
76
|
+
type: 'LinearGenomeView',
|
|
77
|
+
hideHeader: true,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: `${Math.random()}`,
|
|
81
|
+
type: 'LinearGenomeView',
|
|
82
|
+
hideHeader: true,
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
tracks: [
|
|
86
|
+
{
|
|
87
|
+
configuration: trackId,
|
|
88
|
+
type: 'SyntenyTrack',
|
|
89
|
+
displays: [
|
|
90
|
+
{
|
|
91
|
+
type: 'LinearSyntenyDisplay',
|
|
92
|
+
configuration: `${trackId}-LinearSyntenyDisplay`,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
});
|
|
98
|
+
const l1 = `${featRef}:${f(rFeatStart - ws)}-${f(rFeatEnd + ws)}`;
|
|
99
|
+
const m1 = Math.min(rMateStart, rMateEnd);
|
|
100
|
+
const m2 = Math.max(rMateStart, rMateEnd);
|
|
101
|
+
const l2 = `${mateRef}:${f(m1 - ws)}-${f(m2 + ws)}${horizontallyFlip ? '[rev]' : ''}`;
|
|
102
|
+
await when(() => view2.width !== undefined);
|
|
103
|
+
await Promise.all([
|
|
104
|
+
view2.views[0].navToLocString(l1, featAsm),
|
|
105
|
+
view2.views[1].navToLocString(l2, mateAsm),
|
|
106
|
+
]);
|
|
107
|
+
}
|
|
@@ -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,110 +1,9 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
1
2
|
import { ConfigurationReference, } from '@jbrowse/core/configuration';
|
|
2
|
-
import { getSession
|
|
3
|
-
import {
|
|
3
|
+
import { getSession } from '@jbrowse/core/util';
|
|
4
|
+
import { SharedLinearPileupDisplayMixin } from '@jbrowse/plugin-alignments';
|
|
4
5
|
import { types } from 'mobx-state-tree';
|
|
5
|
-
|
|
6
|
-
const { parseCigar } = MismatchParser;
|
|
7
|
-
function findPosInCigar(cigar, startX) {
|
|
8
|
-
let featX = 0;
|
|
9
|
-
let mateX = 0;
|
|
10
|
-
for (let i = 0; i < cigar.length; i++) {
|
|
11
|
-
const len = +cigar[i];
|
|
12
|
-
const op = cigar[i + 1];
|
|
13
|
-
const min = Math.min(len, startX - featX);
|
|
14
|
-
if (featX >= startX) {
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
else if (op === 'I') {
|
|
18
|
-
mateX += len;
|
|
19
|
-
}
|
|
20
|
-
else if (op === 'D') {
|
|
21
|
-
featX += min;
|
|
22
|
-
}
|
|
23
|
-
else if (op === 'M') {
|
|
24
|
-
mateX += min;
|
|
25
|
-
featX += min;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return [featX, mateX];
|
|
29
|
-
}
|
|
30
|
-
async function navToSynteny(feature, self) {
|
|
31
|
-
const session = getSession(self);
|
|
32
|
-
const track = getContainingTrack(self);
|
|
33
|
-
const view = getContainingView(self);
|
|
34
|
-
const reg = view.dynamicBlocks.contentBlocks[0];
|
|
35
|
-
const cigar = feature.get('CIGAR');
|
|
36
|
-
const strand = feature.get('strand');
|
|
37
|
-
const regStart = reg.start;
|
|
38
|
-
const regEnd = reg.end;
|
|
39
|
-
const featStart = feature.get('start');
|
|
40
|
-
const featEnd = feature.get('end');
|
|
41
|
-
const mate = feature.get('mate');
|
|
42
|
-
const mateStart = mate.start;
|
|
43
|
-
const mateEnd = mate.end;
|
|
44
|
-
const mateAsm = mate.assemblyName;
|
|
45
|
-
const mateRef = mate.refName;
|
|
46
|
-
const featAsm = reg.assemblyName;
|
|
47
|
-
const featRef = reg.refName;
|
|
48
|
-
let rMateStart;
|
|
49
|
-
let rMateEnd;
|
|
50
|
-
let rFeatStart;
|
|
51
|
-
let rFeatEnd;
|
|
52
|
-
if (cigar) {
|
|
53
|
-
const p = parseCigar(cigar);
|
|
54
|
-
const [fStartX, mStartX] = findPosInCigar(p, regStart - featStart);
|
|
55
|
-
const [fEndX, mEndX] = findPosInCigar(p, regEnd - featStart);
|
|
56
|
-
// avoid multiply by 0 with strand undefined
|
|
57
|
-
const flipper = strand === -1 ? -1 : 1;
|
|
58
|
-
rFeatStart = featStart + fStartX;
|
|
59
|
-
rFeatEnd = featStart + fEndX;
|
|
60
|
-
rMateStart = (strand === -1 ? mateEnd : mateStart) + mStartX * flipper;
|
|
61
|
-
rMateEnd = (strand === -1 ? mateEnd : mateStart) + mEndX * flipper;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
rFeatStart = featStart;
|
|
65
|
-
rFeatEnd = featEnd;
|
|
66
|
-
rMateStart = mateStart;
|
|
67
|
-
rMateEnd = mateEnd;
|
|
68
|
-
}
|
|
69
|
-
const trackId = track.configuration.trackId;
|
|
70
|
-
const view2 = session.addView('LinearSyntenyView', {
|
|
71
|
-
type: 'LinearSyntenyView',
|
|
72
|
-
views: [
|
|
73
|
-
{
|
|
74
|
-
id: `${Math.random()}`,
|
|
75
|
-
type: 'LinearGenomeView',
|
|
76
|
-
hideHeader: true,
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: `${Math.random()}`,
|
|
80
|
-
type: 'LinearGenomeView',
|
|
81
|
-
hideHeader: true,
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
tracks: [
|
|
85
|
-
{
|
|
86
|
-
configuration: trackId,
|
|
87
|
-
type: 'SyntenyTrack',
|
|
88
|
-
displays: [
|
|
89
|
-
{
|
|
90
|
-
type: 'LinearSyntenyDisplay',
|
|
91
|
-
configuration: `${trackId}-LinearSyntenyDisplay`,
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
});
|
|
97
|
-
const f = (n) => Math.floor(n);
|
|
98
|
-
const l1 = `${featRef}:${f(rFeatStart)}-${f(rFeatEnd)}`;
|
|
99
|
-
const m1 = Math.min(rMateStart, rMateEnd);
|
|
100
|
-
const m2 = Math.max(rMateStart, rMateEnd);
|
|
101
|
-
const l2 = `${mateRef}:${f(m1)}-${f(m2)}${strand === -1 ? '[rev]' : ''}`;
|
|
102
|
-
await when(() => view2.width !== undefined);
|
|
103
|
-
await Promise.all([
|
|
104
|
-
view2.views[0].navToLocString(l1, featAsm),
|
|
105
|
-
view2.views[1].navToLocString(l2, mateAsm),
|
|
106
|
-
]);
|
|
107
|
-
}
|
|
6
|
+
const LaunchSyntenyViewDialog = lazy(() => import('./components/LaunchSyntenyViewDialog'));
|
|
108
7
|
/**
|
|
109
8
|
* #stateModel LGVSyntenyDisplay
|
|
110
9
|
* extends `LinearPileupDisplay`, displays location of "synteny" feature in a
|
|
@@ -133,7 +32,16 @@ function stateModelFactory(schema) {
|
|
|
133
32
|
? [
|
|
134
33
|
{
|
|
135
34
|
label: 'Open synteny view for this position',
|
|
136
|
-
onClick: () =>
|
|
35
|
+
onClick: () => {
|
|
36
|
+
getSession(self).queueDialog(handleClose => [
|
|
37
|
+
LaunchSyntenyViewDialog,
|
|
38
|
+
{
|
|
39
|
+
model: self,
|
|
40
|
+
handleClose,
|
|
41
|
+
feature,
|
|
42
|
+
},
|
|
43
|
+
]);
|
|
44
|
+
},
|
|
137
45
|
},
|
|
138
46
|
]
|
|
139
47
|
: []),
|
|
@@ -46,9 +46,9 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
|
|
|
46
46
|
hideHeaderOverview: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
47
47
|
hideNoTracksActive: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
48
48
|
trackSelectorType: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
49
|
-
trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
50
49
|
showCenterLine: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
51
50
|
showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
51
|
+
trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
52
52
|
showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
53
53
|
}, {
|
|
54
54
|
width: number;
|
|
@@ -71,6 +71,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
|
|
|
71
71
|
leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
|
|
72
72
|
rightOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
|
|
73
73
|
} & {
|
|
74
|
+
readonly trackLabelsSetting: any;
|
|
74
75
|
readonly width: number;
|
|
75
76
|
readonly interRegionPaddingWidth: number;
|
|
76
77
|
readonly assemblyNames: string[];
|
package/esm/LinearSyntenyView/components/{ImportCustomTrack.js → ImportForm/ImportCustomTrack.js}
RENAMED
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import path from 'path';
|
|
3
2
|
import { FormControlLabel, Grid, Paper, Radio, RadioGroup, Typography, } from '@mui/material';
|
|
4
3
|
import { ErrorMessage, FileSelector } from '@jbrowse/core/ui';
|
|
5
4
|
import { observer } from 'mobx-react';
|
|
6
|
-
|
|
7
|
-
return sessionTrackData
|
|
8
|
-
? // @ts-expect-error
|
|
9
|
-
sessionTrackData.uri ||
|
|
10
|
-
// @ts-expect-error
|
|
11
|
-
sessionTrackData.localPath ||
|
|
12
|
-
// @ts-expect-error
|
|
13
|
-
sessionTrackData.name
|
|
14
|
-
: undefined;
|
|
15
|
-
}
|
|
16
|
-
function stripGz(fileName) {
|
|
17
|
-
return fileName.endsWith('.gz') ? fileName.slice(0, -3) : fileName;
|
|
18
|
-
}
|
|
5
|
+
import { extName, getName, stripGz, basename } from './util';
|
|
19
6
|
function getAdapter({ radioOption, assembly1, assembly2, fileLocation, bed1Location, bed2Location, }) {
|
|
20
7
|
if (radioOption === '.paf') {
|
|
21
8
|
return {
|
|
@@ -68,7 +55,7 @@ function getAdapter({ radioOption, assembly1, assembly2, fileLocation, bed1Locat
|
|
|
68
55
|
};
|
|
69
56
|
}
|
|
70
57
|
else {
|
|
71
|
-
throw new Error(
|
|
58
|
+
throw new Error(`Unknown to detect type ${radioOption} from filename (select radio button to clarify)`);
|
|
72
59
|
}
|
|
73
60
|
}
|
|
74
61
|
const OpenTrack = observer(({ assembly1, assembly2, setSessionTrackData, }) => {
|
|
@@ -78,11 +65,11 @@ const OpenTrack = observer(({ assembly1, assembly2, setSessionTrackData, }) => {
|
|
|
78
65
|
const [value, setValue] = useState('');
|
|
79
66
|
const [error, setError] = useState();
|
|
80
67
|
const fileName = getName(fileLocation);
|
|
81
|
-
const radioOption = value || (fileName ?
|
|
68
|
+
const radioOption = value || (fileName ? extName(stripGz(fileName)) : '');
|
|
82
69
|
useEffect(() => {
|
|
83
70
|
try {
|
|
84
71
|
if (fileLocation) {
|
|
85
|
-
const fn = fileName ?
|
|
72
|
+
const fn = fileName ? basename(fileName) : 'MyTrack';
|
|
86
73
|
const trackId = `${fn}-${Date.now()}`;
|
|
87
74
|
setError(undefined);
|
|
88
75
|
setSessionTrackData({
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function getName(sessionTrackData?: {
|
|
2
|
+
uri: string;
|
|
3
|
+
} | {
|
|
4
|
+
localPath: string;
|
|
5
|
+
} | {
|
|
6
|
+
name: string;
|
|
7
|
+
}): any;
|
|
8
|
+
export declare function stripGz(fileName: string): string;
|
|
9
|
+
export declare function basename(str: string): string | undefined;
|
|
10
|
+
export declare function extName(str: string): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function getName(sessionTrackData) {
|
|
2
|
+
return sessionTrackData
|
|
3
|
+
? // @ts-expect-error
|
|
4
|
+
sessionTrackData.uri ||
|
|
5
|
+
// @ts-expect-error
|
|
6
|
+
sessionTrackData.localPath ||
|
|
7
|
+
// @ts-expect-error
|
|
8
|
+
sessionTrackData.name
|
|
9
|
+
: undefined;
|
|
10
|
+
}
|
|
11
|
+
export function stripGz(fileName) {
|
|
12
|
+
return fileName.endsWith('.gz') ? fileName.slice(0, -3) : fileName;
|
|
13
|
+
}
|
|
14
|
+
export function basename(str) {
|
|
15
|
+
return str.split('#')[0].split('?')[0].split('/').pop();
|
|
16
|
+
}
|
|
17
|
+
export function extName(str) {
|
|
18
|
+
const r = str.split('.').pop();
|
|
19
|
+
return r ? `.${r}` : '';
|
|
20
|
+
}
|
|
@@ -57,9 +57,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
57
57
|
hideHeaderOverview: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
58
58
|
hideNoTracksActive: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
59
59
|
trackSelectorType: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
60
|
-
trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
61
60
|
showCenterLine: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
62
61
|
showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
62
|
+
trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
63
63
|
showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
64
64
|
}, {
|
|
65
65
|
width: number;
|
|
@@ -82,6 +82,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
82
82
|
leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
|
|
83
83
|
rightOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
|
|
84
84
|
} & {
|
|
85
|
+
readonly trackLabelsSetting: any;
|
|
85
86
|
readonly width: number;
|
|
86
87
|
readonly interRegionPaddingWidth: number;
|
|
87
88
|
readonly assemblyNames: string[];
|
|
@@ -271,9 +272,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
271
272
|
hideHeaderOverview: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
272
273
|
hideNoTracksActive: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
273
274
|
trackSelectorType: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
274
|
-
trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
275
275
|
showCenterLine: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
276
276
|
showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
277
|
+
trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
277
278
|
showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
278
279
|
}>>[]): void;
|
|
279
280
|
removeView(view: {
|
|
@@ -307,9 +308,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
307
308
|
hideHeaderOverview: boolean;
|
|
308
309
|
hideNoTracksActive: boolean;
|
|
309
310
|
trackSelectorType: string;
|
|
310
|
-
trackLabels: string;
|
|
311
311
|
showCenterLine: boolean;
|
|
312
312
|
showCytobandsSetting: boolean;
|
|
313
|
+
trackLabels: string;
|
|
313
314
|
showGridlines: boolean;
|
|
314
315
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
315
316
|
width: number;
|
|
@@ -332,6 +333,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
332
333
|
leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
|
|
333
334
|
rightOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
|
|
334
335
|
} & {
|
|
336
|
+
readonly trackLabelsSetting: any;
|
|
335
337
|
readonly width: number;
|
|
336
338
|
readonly interRegionPaddingWidth: number;
|
|
337
339
|
readonly assemblyNames: string[];
|
|
@@ -495,9 +497,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
495
497
|
hideHeaderOverview: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
496
498
|
hideNoTracksActive: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
497
499
|
trackSelectorType: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
498
|
-
trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
499
500
|
showCenterLine: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
500
501
|
showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
502
|
+
trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
501
503
|
showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
502
504
|
}, {
|
|
503
505
|
width: number;
|
|
@@ -520,6 +522,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
520
522
|
leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
|
|
521
523
|
rightOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
|
|
522
524
|
} & {
|
|
525
|
+
readonly trackLabelsSetting: any;
|
|
523
526
|
readonly width: number;
|
|
524
527
|
readonly interRegionPaddingWidth: number;
|
|
525
528
|
readonly assemblyNames: string[];
|
|
@@ -19,7 +19,7 @@ const ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'));
|
|
|
19
19
|
*/
|
|
20
20
|
export default function stateModelFactory(pluginManager) {
|
|
21
21
|
return types
|
|
22
|
-
.compose(baseModel(pluginManager), types.model(
|
|
22
|
+
.compose('LinearSyntenyView', baseModel(pluginManager), types.model({
|
|
23
23
|
/**
|
|
24
24
|
* #property
|
|
25
25
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-linear-comparative-view",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "JBrowse 2 linear comparative view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "ee8c2bdc8bd4f1a70b1eefda984f04a2830d9ca0"
|
|
66
66
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|