@jbrowse/plugin-lollipop 3.7.0 → 4.0.1
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/esm/LinearLollipopDisplay/configSchema.d.ts +4 -4
- package/esm/LinearLollipopDisplay/index.js +2 -2
- package/esm/LinearLollipopDisplay/model.d.ts +953 -91
- package/esm/LinearLollipopDisplay/model.js +1 -2
- package/esm/LollipopRenderer/Layout.d.ts +8 -32
- package/esm/LollipopRenderer/Layout.js +4 -43
- package/esm/LollipopRenderer/LollipopRenderer.d.ts +2 -7
- package/esm/LollipopRenderer/LollipopRenderer.js +2 -10
- package/esm/LollipopRenderer/components/Lollipop.d.ts +17 -1
- package/esm/LollipopRenderer/components/Lollipop.js +27 -75
- package/esm/LollipopRenderer/components/LollipopRendering.js +29 -33
- package/esm/LollipopRenderer/components/Stick.d.ts +2 -7
- package/esm/LollipopRenderer/configSchema.d.ts +2 -2
- package/esm/LollipopRenderer/index.js +4 -4
- package/esm/index.js +3 -6
- package/package.json +23 -29
- package/dist/LinearLollipopDisplay/configSchema.d.ts +0 -31
- package/dist/LinearLollipopDisplay/configSchema.js +0 -13
- package/dist/LinearLollipopDisplay/index.d.ts +0 -2
- package/dist/LinearLollipopDisplay/index.js +0 -20
- package/dist/LinearLollipopDisplay/model.d.ts +0 -314
- package/dist/LinearLollipopDisplay/model.js +0 -34
- package/dist/LollipopRenderer/FloatingLayoutSession.d.ts +0 -6
- package/dist/LollipopRenderer/FloatingLayoutSession.js +0 -17
- package/dist/LollipopRenderer/Layout.d.ts +0 -54
- package/dist/LollipopRenderer/Layout.js +0 -113
- package/dist/LollipopRenderer/LollipopRenderer.d.ts +0 -8
- package/dist/LollipopRenderer/LollipopRenderer.js +0 -17
- package/dist/LollipopRenderer/components/Lollipop.d.ts +0 -2
- package/dist/LollipopRenderer/components/Lollipop.js +0 -87
- package/dist/LollipopRenderer/components/LollipopRendering.d.ts +0 -2
- package/dist/LollipopRenderer/components/LollipopRendering.js +0 -81
- package/dist/LollipopRenderer/components/ScoreText.d.ts +0 -14
- package/dist/LollipopRenderer/components/ScoreText.js +0 -20
- package/dist/LollipopRenderer/components/Stick.d.ts +0 -14
- package/dist/LollipopRenderer/components/Stick.js +0 -9
- package/dist/LollipopRenderer/configSchema.d.ts +0 -56
- package/dist/LollipopRenderer/configSchema.js +0 -58
- package/dist/LollipopRenderer/index.d.ts +0 -2
- package/dist/LollipopRenderer/index.js +0 -17
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -19
- package/esm/LollipopRenderer/FloatingLayoutSession.d.ts +0 -6
- package/esm/LollipopRenderer/FloatingLayoutSession.js +0 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfigurationReference } from '@jbrowse/core/configuration';
|
|
2
|
+
import { types } from '@jbrowse/mobx-state-tree';
|
|
2
3
|
import { BaseLinearDisplay } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
-
import { types } from 'mobx-state-tree';
|
|
4
4
|
export function stateModelFactory(configSchema) {
|
|
5
5
|
return types
|
|
6
6
|
.compose('LinearLollipopDisplay', BaseLinearDisplay, types.model({
|
|
@@ -19,7 +19,6 @@ export function stateModelFactory(configSchema) {
|
|
|
19
19
|
renderProps() {
|
|
20
20
|
return {
|
|
21
21
|
...superRenderProps(),
|
|
22
|
-
rpcDriverName: self.rpcDriverName,
|
|
23
22
|
config: self.configuration.renderer,
|
|
24
23
|
};
|
|
25
24
|
},
|
|
@@ -6,49 +6,25 @@ interface LayoutItem {
|
|
|
6
6
|
height: number;
|
|
7
7
|
data: {
|
|
8
8
|
score: number;
|
|
9
|
+
featureId: string;
|
|
10
|
+
anchorX: number;
|
|
11
|
+
radiusPx: number;
|
|
9
12
|
};
|
|
10
13
|
}
|
|
11
|
-
type LayoutEntry = LayoutItem & {
|
|
14
|
+
export type LayoutEntry = LayoutItem & {
|
|
12
15
|
x: number;
|
|
13
16
|
y: number;
|
|
14
17
|
};
|
|
15
|
-
type LayoutMap = Map<string, LayoutEntry>;
|
|
16
18
|
export declare class FloatingLayout {
|
|
17
19
|
width: number;
|
|
18
20
|
totalHeight: number;
|
|
19
|
-
|
|
21
|
+
items: LayoutItem[];
|
|
22
|
+
layout: Map<string, LayoutEntry>;
|
|
20
23
|
constructor({ width }: {
|
|
21
24
|
width: number;
|
|
22
25
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
layout: LayoutMap;
|
|
26
|
-
add(uniqueId: string, anchorLocation: number, width: number, height: number, data: {
|
|
27
|
-
score: number;
|
|
28
|
-
}): void;
|
|
29
|
-
getLayout(configuration?: AnyConfigurationModel): LayoutMap;
|
|
30
|
-
getTotalHeight(): number;
|
|
31
|
-
serializeRegion(): {
|
|
32
|
-
pairs: [string, LayoutEntry][];
|
|
33
|
-
totalHeight: number;
|
|
34
|
-
};
|
|
35
|
-
toJSON(): {
|
|
36
|
-
pairs: [string, LayoutEntry][];
|
|
37
|
-
totalHeight: number;
|
|
38
|
-
};
|
|
39
|
-
static fromJSON(): void;
|
|
40
|
-
}
|
|
41
|
-
export declare class PrecomputedFloatingLayout {
|
|
42
|
-
layout: LayoutMap;
|
|
43
|
-
totalHeight: number;
|
|
44
|
-
constructor({ pairs, totalHeight, }: {
|
|
45
|
-
pairs: [string, LayoutEntry][];
|
|
46
|
-
totalHeight: number;
|
|
47
|
-
});
|
|
48
|
-
add(uniqueId: string): void;
|
|
49
|
-
getLayout(): LayoutMap;
|
|
26
|
+
add(uniqueId: string, anchorLocation: number, width: number, height: number, data: LayoutItem['data']): void;
|
|
27
|
+
getLayout(configuration?: AnyConfigurationModel): Map<string, LayoutEntry>;
|
|
50
28
|
getTotalHeight(): number;
|
|
51
|
-
discardRange(): void;
|
|
52
|
-
static fromJSON(json: ConstructorParameters<typeof PrecomputedFloatingLayout>[0]): PrecomputedFloatingLayout;
|
|
53
29
|
}
|
|
54
30
|
export {};
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import { readConfObject } from '@jbrowse/core/configuration';
|
|
2
2
|
import { doesIntersect2 } from '@jbrowse/core/util/range';
|
|
3
3
|
export class FloatingLayout {
|
|
4
|
+
width;
|
|
5
|
+
totalHeight = 0;
|
|
6
|
+
items = [];
|
|
7
|
+
layout = new Map();
|
|
4
8
|
constructor({ width }) {
|
|
5
|
-
this.totalHeight = 0;
|
|
6
|
-
this.rectangles = new Map();
|
|
7
|
-
this.items = [];
|
|
8
|
-
this.layout = new Map();
|
|
9
9
|
if (!width) {
|
|
10
10
|
throw new Error('width required to make a new FloatingLayout');
|
|
11
11
|
}
|
|
12
12
|
this.width = width;
|
|
13
13
|
}
|
|
14
|
-
discardRange() {
|
|
15
|
-
this.items = [];
|
|
16
|
-
this.layout = new Map();
|
|
17
|
-
this.totalHeight = 0;
|
|
18
|
-
}
|
|
19
14
|
add(uniqueId, anchorLocation, width, height, data) {
|
|
20
15
|
this.items.push({
|
|
21
16
|
uniqueId,
|
|
@@ -71,38 +66,4 @@ export class FloatingLayout {
|
|
|
71
66
|
getTotalHeight() {
|
|
72
67
|
return this.totalHeight;
|
|
73
68
|
}
|
|
74
|
-
serializeRegion() {
|
|
75
|
-
return this.toJSON();
|
|
76
|
-
}
|
|
77
|
-
toJSON() {
|
|
78
|
-
return {
|
|
79
|
-
pairs: [...this.getLayout()],
|
|
80
|
-
totalHeight: this.getTotalHeight(),
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
static fromJSON() {
|
|
84
|
-
throw new Error('not supported');
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
export class PrecomputedFloatingLayout {
|
|
88
|
-
constructor({ pairs, totalHeight, }) {
|
|
89
|
-
this.layout = new Map(pairs);
|
|
90
|
-
this.totalHeight = totalHeight;
|
|
91
|
-
}
|
|
92
|
-
add(uniqueId) {
|
|
93
|
-
if (!this.layout.has(uniqueId)) {
|
|
94
|
-
throw new Error(`layout error, precomputed layout is missing ${uniqueId}`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
getLayout() {
|
|
98
|
-
return this.layout;
|
|
99
|
-
}
|
|
100
|
-
getTotalHeight() {
|
|
101
|
-
return this.totalHeight;
|
|
102
|
-
}
|
|
103
|
-
discardRange() {
|
|
104
|
-
}
|
|
105
|
-
static fromJSON(json) {
|
|
106
|
-
return new PrecomputedFloatingLayout(json);
|
|
107
|
-
}
|
|
108
69
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { PrecomputedFloatingLayout } from './Layout';
|
|
4
|
-
import type { LayoutSessionProps } from '@jbrowse/core/pluggableElementTypes/renderers/LayoutSession';
|
|
5
|
-
export default class LollipopRenderer extends BoxRendererType {
|
|
6
|
-
createLayoutSession(props: LayoutSessionProps): FloatingLayoutSession;
|
|
7
|
-
deserializeLayoutInClient(json: any): PrecomputedFloatingLayout;
|
|
1
|
+
import FeatureRendererType from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType';
|
|
2
|
+
export default class LollipopRenderer extends FeatureRendererType {
|
|
8
3
|
}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { PrecomputedFloatingLayout } from './Layout';
|
|
4
|
-
export default class LollipopRenderer extends BoxRendererType {
|
|
5
|
-
createLayoutSession(props) {
|
|
6
|
-
return new FloatingLayoutSession(props);
|
|
7
|
-
}
|
|
8
|
-
deserializeLayoutInClient(json) {
|
|
9
|
-
return new PrecomputedFloatingLayout(json);
|
|
10
|
-
}
|
|
1
|
+
import FeatureRendererType from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType';
|
|
2
|
+
export default class LollipopRenderer extends FeatureRendererType {
|
|
11
3
|
}
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import type { LayoutEntry } from '../Layout.ts';
|
|
2
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
import type { Feature } from '@jbrowse/core/util';
|
|
4
|
+
declare const Lollipop: ({ feature, config, layoutRecord, selectedFeatureId, onFeatureMouseDown, onFeatureMouseEnter, onFeatureMouseOut, onFeatureMouseOver, onFeatureMouseUp, onFeatureMouseLeave, onFeatureMouseMove, onFeatureClick, }: {
|
|
5
|
+
feature: Feature;
|
|
6
|
+
config: AnyConfigurationModel;
|
|
7
|
+
layoutRecord: LayoutEntry;
|
|
8
|
+
selectedFeatureId?: string;
|
|
9
|
+
onFeatureMouseDown?: (event: React.MouseEvent, id: string) => void;
|
|
10
|
+
onFeatureMouseEnter?: (event: React.MouseEvent, id: string) => void;
|
|
11
|
+
onFeatureMouseOut?: (event: React.MouseEvent | React.FocusEvent, id: string) => void;
|
|
12
|
+
onFeatureMouseOver?: (event: React.MouseEvent | React.FocusEvent, id: string) => void;
|
|
13
|
+
onFeatureMouseUp?: (event: React.MouseEvent, id: string) => void;
|
|
14
|
+
onFeatureMouseLeave?: (event: React.MouseEvent, id: string) => void;
|
|
15
|
+
onFeatureMouseMove?: (event: React.MouseEvent, id: string) => void;
|
|
16
|
+
onFeatureClick?: (event: React.MouseEvent, id: string) => void;
|
|
17
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
2
18
|
export default Lollipop;
|
|
@@ -1,82 +1,34 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { readConfObject } from '@jbrowse/core/configuration';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
|
-
import ScoreText from
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import ScoreText from "./ScoreText.js";
|
|
5
|
+
function Circle({ cx, cy, r, style, featureId, onFeatureMouseDown, onFeatureMouseEnter, onFeatureMouseOut, onFeatureMouseOver, onFeatureMouseUp, onFeatureMouseLeave, onFeatureMouseMove, onFeatureClick, }) {
|
|
6
|
+
return (_jsx("circle", { cx: cx, cy: cy, r: r, style: style, onMouseDown: e => onFeatureMouseDown?.(e, featureId), onMouseEnter: e => onFeatureMouseEnter?.(e, featureId), onMouseOut: e => onFeatureMouseOut?.(e, featureId), onMouseOver: e => onFeatureMouseOver?.(e, featureId), onMouseUp: e => onFeatureMouseUp?.(e, featureId), onMouseLeave: e => onFeatureMouseLeave?.(e, featureId), onMouseMove: e => onFeatureMouseMove?.(e, featureId), onClick: e => {
|
|
7
|
+
e.stopPropagation();
|
|
8
|
+
onFeatureClick?.(e, featureId);
|
|
9
|
+
}, onFocus: e => onFeatureMouseOver?.(e, featureId), onBlur: e => onFeatureMouseOut?.(e, featureId) }));
|
|
10
|
+
}
|
|
11
|
+
const Lollipop = observer(function Lollipop({ feature, config, layoutRecord, selectedFeatureId, onFeatureMouseDown, onFeatureMouseEnter, onFeatureMouseOut, onFeatureMouseOver, onFeatureMouseUp, onFeatureMouseLeave, onFeatureMouseMove, onFeatureClick, }) {
|
|
7
12
|
const { anchorLocation, y, data: { radiusPx }, } = layoutRecord;
|
|
8
|
-
const
|
|
9
|
-
fill: readConfObject(config, 'strokeColor', { feature }),
|
|
10
|
-
};
|
|
11
|
-
if (String(selectedFeatureId) === String(feature.id())) {
|
|
12
|
-
styleOuter.fill = 'red';
|
|
13
|
-
}
|
|
14
|
-
const styleInner = {
|
|
15
|
-
fill: readConfObject(config, 'innerColor', { feature }),
|
|
16
|
-
};
|
|
13
|
+
const featureId = feature.id();
|
|
17
14
|
const strokeWidth = readConfObject(config, 'strokeWidth', { feature });
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, onMouseMove: (event) => {
|
|
37
|
-
const { onFeatureMouseMove: handler, feature } = props;
|
|
38
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
39
|
-
}, onClick: (event) => {
|
|
40
|
-
const { onFeatureClick: handler, feature } = props;
|
|
41
|
-
event.stopPropagation();
|
|
42
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
43
|
-
}, onFocus: (event) => {
|
|
44
|
-
const { onFeatureMouseOver: handler, feature } = props;
|
|
45
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
46
|
-
}, onBlur: (event) => {
|
|
47
|
-
const { onFeatureMouseOut: handler, feature } = props;
|
|
48
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
49
|
-
} }), radiusPx - strokeWidth <= 2 ? null : (_jsx("circle", { cx: anchorLocation, cy: y + radiusPx, r: radiusPx - strokeWidth, style: styleInner, onMouseDown: (event) => {
|
|
50
|
-
const { onFeatureMouseDown: handler, feature } = props;
|
|
51
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
52
|
-
}, onMouseEnter: (event) => {
|
|
53
|
-
const { onFeatureMouseEnter: handler, feature } = props;
|
|
54
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
55
|
-
}, onMouseOut: (event) => {
|
|
56
|
-
const { onFeatureMouseOut: handler, feature } = props;
|
|
57
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
58
|
-
}, onMouseOver: (event) => {
|
|
59
|
-
const { onFeatureMouseOver: handler, feature } = props;
|
|
60
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
61
|
-
}, onMouseUp: (event) => {
|
|
62
|
-
const { onFeatureMouseUp: handler, feature } = props;
|
|
63
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
64
|
-
}, onMouseLeave: (event) => {
|
|
65
|
-
const { onFeatureMouseLeave: handler, feature } = props;
|
|
66
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
67
|
-
}, onMouseMove: (event) => {
|
|
68
|
-
const { onFeatureMouseMove: handler, feature } = props;
|
|
69
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
70
|
-
}, onClick: (event) => {
|
|
71
|
-
const { onFeatureClick: handler, feature } = props;
|
|
72
|
-
event.stopPropagation();
|
|
73
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
74
|
-
}, onFocus: (event) => {
|
|
75
|
-
const { onFeatureMouseOver: handler, feature } = props;
|
|
76
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
77
|
-
}, onBlur: (event) => {
|
|
78
|
-
const { onFeatureMouseOut: handler, feature } = props;
|
|
79
|
-
return handler === null || handler === void 0 ? void 0 : handler(event, feature.id());
|
|
80
|
-
} })), _jsx(ScoreText, { feature: feature, config: config, layoutRecord: layoutRecord })] }));
|
|
15
|
+
const cx = anchorLocation;
|
|
16
|
+
const cy = y + radiusPx;
|
|
17
|
+
const handlers = {
|
|
18
|
+
featureId,
|
|
19
|
+
onFeatureMouseDown,
|
|
20
|
+
onFeatureMouseEnter,
|
|
21
|
+
onFeatureMouseOut,
|
|
22
|
+
onFeatureMouseOver,
|
|
23
|
+
onFeatureMouseUp,
|
|
24
|
+
onFeatureMouseLeave,
|
|
25
|
+
onFeatureMouseMove,
|
|
26
|
+
onFeatureClick,
|
|
27
|
+
};
|
|
28
|
+
return (_jsxs("g", { "data-testid": featureId, children: [_jsx("title", { children: readConfObject(config, 'caption', { feature }) }), _jsx(Circle, { cx: cx, cy: cy, r: radiusPx, style: {
|
|
29
|
+
fill: String(selectedFeatureId) === String(featureId)
|
|
30
|
+
? 'red'
|
|
31
|
+
: readConfObject(config, 'strokeColor', { feature }),
|
|
32
|
+
}, ...handlers }), radiusPx - strokeWidth > 2 ? (_jsx(Circle, { cx: cx, cy: cy, r: radiusPx - strokeWidth, style: { fill: readConfObject(config, 'innerColor', { feature }) }, ...handlers })) : null, _jsx(ScoreText, { feature: feature, config: config, layoutRecord: layoutRecord })] }));
|
|
81
33
|
});
|
|
82
34
|
export default Lollipop;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import { Fragment,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, useMemo } from 'react';
|
|
3
3
|
import { readConfObject } from '@jbrowse/core/configuration';
|
|
4
4
|
import { bpToPx } from '@jbrowse/core/util';
|
|
5
5
|
import { observer } from 'mobx-react';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import { FloatingLayout } from "../Layout.js";
|
|
7
|
+
import Lollipop from "./Lollipop.js";
|
|
8
|
+
import Stick from "./Stick.js";
|
|
8
9
|
function layoutFeat(args) {
|
|
9
10
|
const { feature, bpPerPx, config, region, layout } = args;
|
|
10
11
|
const centerBp = Math.abs(feature.get('end') + feature.get('start')) / 2;
|
|
@@ -17,60 +18,55 @@ function layoutFeat(args) {
|
|
|
17
18
|
featureId: feature.id(),
|
|
18
19
|
anchorX: centerPx,
|
|
19
20
|
radiusPx,
|
|
20
|
-
score: readConfObject(
|
|
21
|
+
score: readConfObject(config, 'score', { feature }),
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
|
-
const LollipopRendering = observer(function (props) {
|
|
24
|
+
const LollipopRendering = observer(function LollipopRendering(props) {
|
|
24
25
|
const onMouseDown = (event) => {
|
|
25
26
|
const { onMouseDown: handler } = props;
|
|
26
|
-
return handler
|
|
27
|
+
return handler?.(event);
|
|
27
28
|
};
|
|
28
29
|
const onMouseUp = (event) => {
|
|
29
30
|
const { onMouseUp: handler } = props;
|
|
30
|
-
return handler
|
|
31
|
+
return handler?.(event);
|
|
31
32
|
};
|
|
32
33
|
const onMouseEnter = (event) => {
|
|
33
34
|
const { onMouseEnter: handler } = props;
|
|
34
|
-
return handler
|
|
35
|
+
return handler?.(event);
|
|
35
36
|
};
|
|
36
37
|
const onMouseLeave = (event) => {
|
|
37
38
|
const { onMouseLeave: handler } = props;
|
|
38
|
-
return handler
|
|
39
|
+
return handler?.(event);
|
|
39
40
|
};
|
|
40
41
|
const onMouseOver = (event) => {
|
|
41
42
|
const { onMouseOver: handler } = props;
|
|
42
|
-
return handler
|
|
43
|
+
return handler?.(event);
|
|
43
44
|
};
|
|
44
45
|
const onMouseOut = (event) => {
|
|
45
46
|
const { onMouseOut: handler } = props;
|
|
46
|
-
return handler
|
|
47
|
+
return handler?.(event);
|
|
47
48
|
};
|
|
48
49
|
const onClick = (event) => {
|
|
49
50
|
const { onClick: handler } = props;
|
|
50
|
-
return handler
|
|
51
|
+
return handler?.(event);
|
|
51
52
|
};
|
|
52
|
-
const
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
setClient(true);
|
|
55
|
-
}, []);
|
|
56
|
-
const { regions, bpPerPx, layout, config, features = new Map(), displayModel = {}, } = props;
|
|
53
|
+
const { regions, bpPerPx, config, features = new Map(), displayModel = {}, } = props;
|
|
57
54
|
const { selectedFeatureId } = displayModel;
|
|
58
55
|
const region = regions[0];
|
|
59
|
-
for (const feature of features.values()) {
|
|
60
|
-
layoutFeat({
|
|
61
|
-
feature,
|
|
62
|
-
bpPerPx,
|
|
63
|
-
region,
|
|
64
|
-
config,
|
|
65
|
-
layout,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
56
|
const width = (region.end - region.start) / bpPerPx;
|
|
69
|
-
const records =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
57
|
+
const { records, height } = useMemo(() => {
|
|
58
|
+
const layout = new FloatingLayout({ width });
|
|
59
|
+
for (const feature of features.values()) {
|
|
60
|
+
layoutFeat({ feature, bpPerPx, region, config, layout });
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
records: [...layout.getLayout(config).values()],
|
|
64
|
+
height: layout.getTotalHeight(),
|
|
65
|
+
};
|
|
66
|
+
}, [features, bpPerPx, region, config, width]);
|
|
67
|
+
return (_jsx("svg", { width: width, height: height, style: { position: 'relative' }, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseOver: onMouseOver, onMouseOut: onMouseOut, onFocus: onMouseEnter, onBlur: onMouseLeave, onClick: onClick, children: records.map(layoutRecord => {
|
|
68
|
+
const feature = features.get(layoutRecord.data.featureId);
|
|
69
|
+
return (_jsxs(Fragment, { children: [_jsx(Stick, { config: config, layoutRecord: layoutRecord, feature: feature }), _jsx(Lollipop, { config: config, layoutRecord: layoutRecord, feature: feature, selectedFeatureId: selectedFeatureId, onFeatureMouseDown: props.onFeatureMouseDown, onFeatureMouseEnter: props.onFeatureMouseEnter, onFeatureMouseOut: props.onFeatureMouseOut, onFeatureMouseOver: props.onFeatureMouseOver, onFeatureMouseUp: props.onFeatureMouseUp, onFeatureMouseLeave: props.onFeatureMouseLeave, onFeatureMouseMove: props.onFeatureMouseMove, onFeatureClick: props.onFeatureClick })] }, feature.id()));
|
|
70
|
+
}) }));
|
|
75
71
|
});
|
|
76
72
|
export default LollipopRendering;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
+
import type { LayoutEntry } from '../Layout.ts';
|
|
1
2
|
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
3
|
import type { Feature } from '@jbrowse/core/util';
|
|
3
4
|
declare const Stick: ({ feature, config, layoutRecord: { anchorLocation, y, data: { radiusPx }, }, }: {
|
|
4
5
|
feature: Feature;
|
|
5
6
|
config: AnyConfigurationModel;
|
|
6
|
-
layoutRecord:
|
|
7
|
-
anchorLocation: number;
|
|
8
|
-
y: number;
|
|
9
|
-
data: {
|
|
10
|
-
radiusPx: number;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
7
|
+
layoutRecord: LayoutEntry;
|
|
13
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
9
|
export default Stick;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
strokeColor: {
|
|
3
3
|
type: string;
|
|
4
4
|
description: string;
|
|
@@ -52,5 +52,5 @@ declare const _default: import("@jbrowse/core/configuration/configurationSchema"
|
|
|
52
52
|
defaultValue: string;
|
|
53
53
|
contextVariable: string[];
|
|
54
54
|
};
|
|
55
|
-
}, import("
|
|
55
|
+
}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
56
56
|
export default _default;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import configSchema from
|
|
1
|
+
import { lazy } from 'react';
|
|
2
|
+
import LollipopRenderer from "./LollipopRenderer.js";
|
|
3
|
+
import configSchema from "./configSchema.js";
|
|
4
4
|
export default function LollipopRendererF(pluginManager) {
|
|
5
5
|
pluginManager.addRendererType(() => new LollipopRenderer({
|
|
6
6
|
name: 'LollipopRenderer',
|
|
7
|
-
ReactComponent,
|
|
7
|
+
ReactComponent: lazy(() => import("./components/LollipopRendering.js")),
|
|
8
8
|
configSchema,
|
|
9
9
|
pluginManager,
|
|
10
10
|
}));
|
package/esm/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import LinearLollipopDisplayF from
|
|
3
|
-
import LollipopRendererF from
|
|
2
|
+
import LinearLollipopDisplayF from "./LinearLollipopDisplay/index.js";
|
|
3
|
+
import LollipopRendererF from "./LollipopRenderer/index.js";
|
|
4
4
|
export default class LollipopPlugin extends Plugin {
|
|
5
|
-
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.name = 'LollipopPlugin';
|
|
8
|
-
}
|
|
5
|
+
name = 'LollipopPlugin';
|
|
9
6
|
install(pluginManager) {
|
|
10
7
|
LollipopRendererF(pluginManager);
|
|
11
8
|
LinearLollipopDisplayF(pluginManager);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-lollipop",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "JBrowse 2 plugin for lollipops",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -15,42 +15,36 @@
|
|
|
15
15
|
"directory": "plugins/lollipop"
|
|
16
16
|
},
|
|
17
17
|
"author": "JBrowse Team",
|
|
18
|
-
"
|
|
19
|
-
"srcMain": "src/index.ts",
|
|
20
|
-
"main": "dist/index.js",
|
|
18
|
+
"main": "esm/index.js",
|
|
21
19
|
"files": [
|
|
22
|
-
"dist",
|
|
23
20
|
"esm"
|
|
24
21
|
],
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "npm-run-all build:*",
|
|
27
|
-
"test": "cd ../..; jest --passWithNoTests plugins/lollipop",
|
|
28
|
-
"prepublishOnly": "yarn test",
|
|
29
|
-
"prepack": "yarn build && yarn useDist",
|
|
30
|
-
"postpack": "yarn useSrc",
|
|
31
|
-
"useDist": "node ../../scripts/useDist.js",
|
|
32
|
-
"useSrc": "node ../../scripts/useSrc.js",
|
|
33
|
-
"prebuild": "npm run clean",
|
|
34
|
-
"build:esm": "tsc --build tsconfig.build.esm.json",
|
|
35
|
-
"build:commonjs": "tsc --build tsconfig.build.commonjs.json",
|
|
36
|
-
"clean": "rimraf dist esm *.tsbuildinfo"
|
|
37
|
-
},
|
|
38
22
|
"dependencies": {
|
|
39
|
-
"@jbrowse/
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"mobx-state-tree": "^5.0.0"
|
|
23
|
+
"@jbrowse/mobx-state-tree": "^5.5.0",
|
|
24
|
+
"mobx": "^6.15.0",
|
|
25
|
+
"mobx-react": "^9.2.1",
|
|
26
|
+
"@jbrowse/core": "^4.0.1",
|
|
27
|
+
"@jbrowse/plugin-linear-genome-view": "^4.0.1"
|
|
45
28
|
},
|
|
46
29
|
"peerDependencies": {
|
|
47
30
|
"react": ">=18.0.0"
|
|
48
31
|
},
|
|
49
|
-
"distModule": "esm/index.js",
|
|
50
|
-
"srcModule": "src/index.ts",
|
|
51
|
-
"module": "esm/index.js",
|
|
52
32
|
"publishConfig": {
|
|
53
33
|
"access": "public"
|
|
54
34
|
},
|
|
55
|
-
"
|
|
56
|
-
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "pnpm run /^build:/",
|
|
38
|
+
"test": "cd ../..; jest --passWithNoTests plugins/lollipop",
|
|
39
|
+
"prebuild": "pnpm clean",
|
|
40
|
+
"build:esm": "tsc -p tsconfig.build.esm.json",
|
|
41
|
+
"clean": "rimraf esm *.tsbuildinfo"
|
|
42
|
+
},
|
|
43
|
+
"types": "esm/index.d.ts",
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"types": "./esm/index.d.ts",
|
|
47
|
+
"import": "./esm/index.js"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
-
export declare function configSchemaFactory(pluginManager: PluginManager): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
3
|
-
renderer: import("mobx-state-tree").IAnyModelType;
|
|
4
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
5
|
-
maxFeatureScreenDensity: {
|
|
6
|
-
type: string;
|
|
7
|
-
description: string;
|
|
8
|
-
defaultValue: number;
|
|
9
|
-
};
|
|
10
|
-
fetchSizeLimit: {
|
|
11
|
-
type: string;
|
|
12
|
-
defaultValue: number;
|
|
13
|
-
description: string;
|
|
14
|
-
};
|
|
15
|
-
height: {
|
|
16
|
-
type: string;
|
|
17
|
-
defaultValue: number;
|
|
18
|
-
description: string;
|
|
19
|
-
};
|
|
20
|
-
mouseover: {
|
|
21
|
-
type: string;
|
|
22
|
-
description: string;
|
|
23
|
-
defaultValue: string;
|
|
24
|
-
contextVariable: string[];
|
|
25
|
-
};
|
|
26
|
-
jexlFilters: {
|
|
27
|
-
type: string;
|
|
28
|
-
description: string;
|
|
29
|
-
defaultValue: never[];
|
|
30
|
-
};
|
|
31
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>, undefined>>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configSchemaFactory = configSchemaFactory;
|
|
4
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
5
|
-
const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
|
|
6
|
-
function configSchemaFactory(pluginManager) {
|
|
7
|
-
return (0, configuration_1.ConfigurationSchema)('LinearLollipopDisplay', {
|
|
8
|
-
renderer: pluginManager.pluggableConfigSchemaType('renderer'),
|
|
9
|
-
}, {
|
|
10
|
-
baseConfiguration: plugin_linear_genome_view_1.baseLinearDisplayConfigSchema,
|
|
11
|
-
explicitlyTyped: true,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = LinearLollipopDisplayF;
|
|
4
|
-
const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
|
|
5
|
-
const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
|
|
6
|
-
const configSchema_1 = require("./configSchema");
|
|
7
|
-
const model_1 = require("./model");
|
|
8
|
-
function LinearLollipopDisplayF(pluginManager) {
|
|
9
|
-
pluginManager.addDisplayType(() => {
|
|
10
|
-
const configSchema = (0, configSchema_1.configSchemaFactory)(pluginManager);
|
|
11
|
-
return new pluggableElementTypes_1.DisplayType({
|
|
12
|
-
name: 'LinearLollipopDisplay',
|
|
13
|
-
configSchema,
|
|
14
|
-
stateModel: (0, model_1.stateModelFactory)(configSchema),
|
|
15
|
-
trackType: 'LollipopTrack',
|
|
16
|
-
viewType: 'LinearGenomeView',
|
|
17
|
-
ReactComponent: plugin_linear_genome_view_1.BaseLinearDisplayComponent,
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
}
|