@jbrowse/plugin-lollipop 3.6.5 → 4.0.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/esm/LinearLollipopDisplay/configSchema.d.ts +4 -4
- package/esm/LinearLollipopDisplay/index.js +2 -2
- package/esm/LinearLollipopDisplay/model.d.ts +955 -78
- 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 -299
- 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,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
9
|
-
const util_1 = require("@jbrowse/core/util");
|
|
10
|
-
const mobx_react_1 = require("mobx-react");
|
|
11
|
-
const Lollipop_1 = __importDefault(require("./Lollipop"));
|
|
12
|
-
const Stick_1 = __importDefault(require("./Stick"));
|
|
13
|
-
function layoutFeat(args) {
|
|
14
|
-
const { feature, bpPerPx, config, region, layout } = args;
|
|
15
|
-
const centerBp = Math.abs(feature.get('end') + feature.get('start')) / 2;
|
|
16
|
-
const centerPx = (0, util_1.bpToPx)(centerBp, region, bpPerPx);
|
|
17
|
-
const radiusPx = (0, configuration_1.readConfObject)(config, 'radius', { feature });
|
|
18
|
-
if (!radiusPx) {
|
|
19
|
-
console.error(new Error(`lollipop radius ${radiusPx} configured for feature ${feature.id()}`));
|
|
20
|
-
}
|
|
21
|
-
layout.add(feature.id(), centerPx, radiusPx * 2, radiusPx * 2, {
|
|
22
|
-
featureId: feature.id(),
|
|
23
|
-
anchorX: centerPx,
|
|
24
|
-
radiusPx,
|
|
25
|
-
score: (0, configuration_1.readConfObject)(args.config, 'score', { feature }),
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
const LollipopRendering = (0, mobx_react_1.observer)(function (props) {
|
|
29
|
-
const onMouseDown = (event) => {
|
|
30
|
-
const { onMouseDown: handler } = props;
|
|
31
|
-
return handler === null || handler === void 0 ? void 0 : handler(event);
|
|
32
|
-
};
|
|
33
|
-
const onMouseUp = (event) => {
|
|
34
|
-
const { onMouseUp: handler } = props;
|
|
35
|
-
return handler === null || handler === void 0 ? void 0 : handler(event);
|
|
36
|
-
};
|
|
37
|
-
const onMouseEnter = (event) => {
|
|
38
|
-
const { onMouseEnter: handler } = props;
|
|
39
|
-
return handler === null || handler === void 0 ? void 0 : handler(event);
|
|
40
|
-
};
|
|
41
|
-
const onMouseLeave = (event) => {
|
|
42
|
-
const { onMouseLeave: handler } = props;
|
|
43
|
-
return handler === null || handler === void 0 ? void 0 : handler(event);
|
|
44
|
-
};
|
|
45
|
-
const onMouseOver = (event) => {
|
|
46
|
-
const { onMouseOver: handler } = props;
|
|
47
|
-
return handler === null || handler === void 0 ? void 0 : handler(event);
|
|
48
|
-
};
|
|
49
|
-
const onMouseOut = (event) => {
|
|
50
|
-
const { onMouseOut: handler } = props;
|
|
51
|
-
return handler === null || handler === void 0 ? void 0 : handler(event);
|
|
52
|
-
};
|
|
53
|
-
const onClick = (event) => {
|
|
54
|
-
const { onClick: handler } = props;
|
|
55
|
-
return handler === null || handler === void 0 ? void 0 : handler(event);
|
|
56
|
-
};
|
|
57
|
-
const [client, setClient] = (0, react_1.useState)(false);
|
|
58
|
-
(0, react_1.useEffect)(() => {
|
|
59
|
-
setClient(true);
|
|
60
|
-
}, []);
|
|
61
|
-
const { regions, bpPerPx, layout, config, features = new Map(), displayModel = {}, } = props;
|
|
62
|
-
const { selectedFeatureId } = displayModel;
|
|
63
|
-
const region = regions[0];
|
|
64
|
-
for (const feature of features.values()) {
|
|
65
|
-
layoutFeat({
|
|
66
|
-
feature,
|
|
67
|
-
bpPerPx,
|
|
68
|
-
region,
|
|
69
|
-
config,
|
|
70
|
-
layout,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
const width = (region.end - region.start) / bpPerPx;
|
|
74
|
-
const records = [...layout.getLayout(config).values()];
|
|
75
|
-
const height = layout.getTotalHeight();
|
|
76
|
-
return ((0, jsx_runtime_1.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: client ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: records.map(layoutRecord => {
|
|
77
|
-
const feature = features.get(layoutRecord.data.featureId);
|
|
78
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Stick_1.default, { ...props, config: config, layoutRecord: layoutRecord, feature: feature }, `stick-${feature.id()}`), (0, jsx_runtime_1.jsx)(Lollipop_1.default, { ...props, layoutRecord: layoutRecord, feature: feature, selectedFeatureId: selectedFeatureId }, `body-${feature.id()}`)] }, feature.id()));
|
|
79
|
-
}) })) : null }));
|
|
80
|
-
});
|
|
81
|
-
exports.default = LollipopRendering;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
|
-
import type { Feature } from '@jbrowse/core/util';
|
|
3
|
-
export default function ScoreText({ feature, config, layoutRecord: { y, data: { anchorX, radiusPx, score }, }, }: {
|
|
4
|
-
feature: Feature;
|
|
5
|
-
config: AnyConfigurationModel;
|
|
6
|
-
layoutRecord: {
|
|
7
|
-
y: number;
|
|
8
|
-
data: {
|
|
9
|
-
anchorX: number;
|
|
10
|
-
radiusPx: number;
|
|
11
|
-
score: number;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = ScoreText;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
6
|
-
const color_1 = require("@jbrowse/core/util/color");
|
|
7
|
-
function ScoreText({ feature, config, layoutRecord: { y, data: { anchorX, radiusPx, score }, }, }) {
|
|
8
|
-
const innerColor = (0, configuration_1.readConfObject)(config, 'innerColor', { feature });
|
|
9
|
-
const scoreString = String(score);
|
|
10
|
-
const fontWidth = (radiusPx * 2) / scoreString.length;
|
|
11
|
-
const fontHeight = fontWidth * 1.1;
|
|
12
|
-
if (fontHeight < 12) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return ((0, jsx_runtime_1.jsx)("text", { style: {
|
|
16
|
-
pointerEvents: 'none',
|
|
17
|
-
fontSize: fontHeight,
|
|
18
|
-
fill: (0, color_1.contrastingTextColor)(innerColor),
|
|
19
|
-
}, x: anchorX, y: y + radiusPx - fontHeight / 2.4, textAnchor: "middle", dominantBaseline: "hanging", children: scoreString }));
|
|
20
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
|
-
import type { Feature } from '@jbrowse/core/util';
|
|
3
|
-
declare const Stick: ({ feature, config, layoutRecord: { anchorLocation, y, data: { radiusPx }, }, }: {
|
|
4
|
-
feature: Feature;
|
|
5
|
-
config: AnyConfigurationModel;
|
|
6
|
-
layoutRecord: {
|
|
7
|
-
anchorLocation: number;
|
|
8
|
-
y: number;
|
|
9
|
-
data: {
|
|
10
|
-
radiusPx: number;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export default Stick;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
5
|
-
const mobx_react_1 = require("mobx-react");
|
|
6
|
-
const Stick = (0, mobx_react_1.observer)(function Stick({ feature, config, layoutRecord: { anchorLocation, y, data: { radiusPx }, }, }) {
|
|
7
|
-
return ((0, jsx_runtime_1.jsx)("line", { x1: anchorLocation, y1: 0, x2: anchorLocation, y2: y + 2 * radiusPx, stroke: (0, configuration_1.readConfObject)(config, 'stickColor', { feature }), strokeWidth: (0, configuration_1.readConfObject)(config, 'stickWidth', { feature }) }));
|
|
8
|
-
});
|
|
9
|
-
exports.default = Stick;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
declare const _default: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
|
-
strokeColor: {
|
|
3
|
-
type: string;
|
|
4
|
-
description: string;
|
|
5
|
-
defaultValue: string;
|
|
6
|
-
contextVariable: string[];
|
|
7
|
-
};
|
|
8
|
-
innerColor: {
|
|
9
|
-
type: string;
|
|
10
|
-
description: string;
|
|
11
|
-
defaultValue: string;
|
|
12
|
-
contextVariable: string[];
|
|
13
|
-
};
|
|
14
|
-
strokeWidth: {
|
|
15
|
-
type: string;
|
|
16
|
-
description: string;
|
|
17
|
-
defaultValue: number;
|
|
18
|
-
contextVariable: string[];
|
|
19
|
-
};
|
|
20
|
-
radius: {
|
|
21
|
-
type: string;
|
|
22
|
-
description: string;
|
|
23
|
-
defaultValue: string;
|
|
24
|
-
contextVariable: string[];
|
|
25
|
-
};
|
|
26
|
-
caption: {
|
|
27
|
-
type: string;
|
|
28
|
-
description: string;
|
|
29
|
-
defaultValue: string;
|
|
30
|
-
contextVariable: string[];
|
|
31
|
-
};
|
|
32
|
-
minStickLength: {
|
|
33
|
-
type: string;
|
|
34
|
-
description: string;
|
|
35
|
-
defaultValue: number;
|
|
36
|
-
};
|
|
37
|
-
stickColor: {
|
|
38
|
-
type: string;
|
|
39
|
-
description: string;
|
|
40
|
-
defaultValue: string;
|
|
41
|
-
contextVariable: string[];
|
|
42
|
-
};
|
|
43
|
-
stickWidth: {
|
|
44
|
-
type: string;
|
|
45
|
-
description: string;
|
|
46
|
-
defaultValue: number;
|
|
47
|
-
contextVariable: string[];
|
|
48
|
-
};
|
|
49
|
-
score: {
|
|
50
|
-
type: string;
|
|
51
|
-
description: string;
|
|
52
|
-
defaultValue: string;
|
|
53
|
-
contextVariable: string[];
|
|
54
|
-
};
|
|
55
|
-
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
56
|
-
export default _default;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
|
-
exports.default = (0, configuration_1.ConfigurationSchema)('LollipopRenderer', {
|
|
5
|
-
strokeColor: {
|
|
6
|
-
type: 'color',
|
|
7
|
-
description: 'the outer color of each lollipop',
|
|
8
|
-
defaultValue: 'green',
|
|
9
|
-
contextVariable: ['feature'],
|
|
10
|
-
},
|
|
11
|
-
innerColor: {
|
|
12
|
-
type: 'color',
|
|
13
|
-
description: 'the inner color of each lollipop',
|
|
14
|
-
defaultValue: '#7fc75f',
|
|
15
|
-
contextVariable: ['feature'],
|
|
16
|
-
},
|
|
17
|
-
strokeWidth: {
|
|
18
|
-
type: 'number',
|
|
19
|
-
description: 'width of the stroked border',
|
|
20
|
-
defaultValue: 4,
|
|
21
|
-
contextVariable: ['feature'],
|
|
22
|
-
},
|
|
23
|
-
radius: {
|
|
24
|
-
type: 'number',
|
|
25
|
-
description: 'radius in pixels of each lollipop body',
|
|
26
|
-
defaultValue: `jexl:sqrt(max(3, (get(feature,'score')*10)/3.14))`,
|
|
27
|
-
contextVariable: ['feature'],
|
|
28
|
-
},
|
|
29
|
-
caption: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
description: 'the tooltip caption displayed when the mouse hovers over a lollipop',
|
|
32
|
-
defaultValue: `jexl:get(feature,'name')`,
|
|
33
|
-
contextVariable: ['feature'],
|
|
34
|
-
},
|
|
35
|
-
minStickLength: {
|
|
36
|
-
type: 'number',
|
|
37
|
-
description: 'minimum lollipop "stick" length, in pixels',
|
|
38
|
-
defaultValue: 5,
|
|
39
|
-
},
|
|
40
|
-
stickColor: {
|
|
41
|
-
type: 'color',
|
|
42
|
-
description: 'color of the lollipop stick',
|
|
43
|
-
defaultValue: 'black',
|
|
44
|
-
contextVariable: ['feature'],
|
|
45
|
-
},
|
|
46
|
-
stickWidth: {
|
|
47
|
-
type: 'number',
|
|
48
|
-
description: 'width in pixels of the lollipop stick',
|
|
49
|
-
defaultValue: 2,
|
|
50
|
-
contextVariable: ['feature'],
|
|
51
|
-
},
|
|
52
|
-
score: {
|
|
53
|
-
type: 'number',
|
|
54
|
-
description: 'the "score" of each lollipop, displayed as a number in the center of the circle',
|
|
55
|
-
defaultValue: `jexl:get(feature,'score')`,
|
|
56
|
-
contextVariable: ['feature'],
|
|
57
|
-
},
|
|
58
|
-
}, { explicitlyTyped: true });
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = LollipopRendererF;
|
|
7
|
-
const LollipopRenderer_1 = __importDefault(require("./LollipopRenderer"));
|
|
8
|
-
const LollipopRendering_1 = __importDefault(require("./components/LollipopRendering"));
|
|
9
|
-
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
10
|
-
function LollipopRendererF(pluginManager) {
|
|
11
|
-
pluginManager.addRendererType(() => new LollipopRenderer_1.default({
|
|
12
|
-
name: 'LollipopRenderer',
|
|
13
|
-
ReactComponent: LollipopRendering_1.default,
|
|
14
|
-
configSchema: configSchema_1.default,
|
|
15
|
-
pluginManager,
|
|
16
|
-
}));
|
|
17
|
-
}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
|
|
7
|
-
const LinearLollipopDisplay_1 = __importDefault(require("./LinearLollipopDisplay"));
|
|
8
|
-
const LollipopRenderer_1 = __importDefault(require("./LollipopRenderer"));
|
|
9
|
-
class LollipopPlugin extends Plugin_1.default {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this.name = 'LollipopPlugin';
|
|
13
|
-
}
|
|
14
|
-
install(pluginManager) {
|
|
15
|
-
(0, LollipopRenderer_1.default)(pluginManager);
|
|
16
|
-
(0, LinearLollipopDisplay_1.default)(pluginManager);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.default = LollipopPlugin;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { LayoutSession } from '@jbrowse/core/pluggableElementTypes/renderers/LayoutSession';
|
|
2
|
-
import { MultiLayout } from '@jbrowse/core/util/layouts';
|
|
3
|
-
export declare class FloatingLayoutSession extends LayoutSession {
|
|
4
|
-
makeLayout(): MultiLayout<import("@jbrowse/core/util/layouts").BaseLayout<unknown>, unknown>;
|
|
5
|
-
layoutIsValid(): boolean;
|
|
6
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { LayoutSession } from '@jbrowse/core/pluggableElementTypes/renderers/LayoutSession';
|
|
2
|
-
import { MultiLayout } from '@jbrowse/core/util/layouts';
|
|
3
|
-
import { FloatingLayout } from './Layout';
|
|
4
|
-
export class FloatingLayoutSession extends LayoutSession {
|
|
5
|
-
makeLayout() {
|
|
6
|
-
const { end, start } = this.props.regions[0];
|
|
7
|
-
const widthPx = (end - start) / this.props.bpPerPx;
|
|
8
|
-
return new MultiLayout(FloatingLayout, { width: widthPx });
|
|
9
|
-
}
|
|
10
|
-
layoutIsValid() {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
}
|