@jbrowse/plugin-wiggle 2.6.2 → 2.6.3
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/LinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +0 -1
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.js +0 -3
- package/dist/MultiDensityRenderer/MultiDensityRenderer.js +1 -1
- package/dist/MultiLinearWiggleDisplay/components/ColorLegend.d.ts +9 -0
- package/dist/MultiLinearWiggleDisplay/components/ColorLegend.js +28 -0
- package/dist/MultiLinearWiggleDisplay/components/RectBg.d.ts +9 -0
- package/dist/MultiLinearWiggleDisplay/components/RectBg.js +11 -0
- package/dist/MultiLinearWiggleDisplay/components/ScoreLegend.d.ts +6 -0
- package/dist/MultiLinearWiggleDisplay/components/ScoreLegend.js +22 -0
- package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +0 -5
- package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js +5 -91
- package/dist/MultiLinearWiggleDisplay/components/YScaleBars.d.ts +8 -0
- package/dist/MultiLinearWiggleDisplay/components/YScaleBars.js +53 -0
- package/dist/MultiLinearWiggleDisplay/components/util.d.ts +2 -0
- package/dist/MultiLinearWiggleDisplay/components/util.js +14 -1
- package/dist/MultiLinearWiggleDisplay/models/renderSvg.js +2 -2
- package/dist/MultiRowLineRenderer/MultiRowLineRenderer.js +1 -1
- package/dist/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +1 -1
- package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +0 -1
- package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.js +0 -1
- package/esm/MultiDensityRenderer/MultiDensityRenderer.js +1 -1
- package/esm/MultiLinearWiggleDisplay/components/ColorLegend.d.ts +9 -0
- package/esm/MultiLinearWiggleDisplay/components/ColorLegend.js +23 -0
- package/esm/MultiLinearWiggleDisplay/components/RectBg.d.ts +9 -0
- package/esm/MultiLinearWiggleDisplay/components/RectBg.js +6 -0
- package/esm/MultiLinearWiggleDisplay/components/ScoreLegend.d.ts +6 -0
- package/esm/MultiLinearWiggleDisplay/components/ScoreLegend.js +17 -0
- package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +0 -5
- package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js +3 -89
- package/esm/MultiLinearWiggleDisplay/components/YScaleBars.d.ts +8 -0
- package/esm/MultiLinearWiggleDisplay/components/YScaleBars.js +47 -0
- package/esm/MultiLinearWiggleDisplay/components/util.d.ts +2 -0
- package/esm/MultiLinearWiggleDisplay/components/util.js +12 -0
- package/esm/MultiLinearWiggleDisplay/models/renderSvg.js +2 -2
- package/esm/MultiRowLineRenderer/MultiRowLineRenderer.js +1 -1
- package/esm/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +1 -1
- package/package.json +2 -2
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.YScaleBar = void 0;
|
|
7
6
|
const react_1 = __importDefault(require("react"));
|
|
8
7
|
const mobx_react_1 = require("mobx-react");
|
|
9
8
|
const util_1 = require("@jbrowse/core/util");
|
|
@@ -31,5 +30,3 @@ const LinearWiggleDisplay = (0, mobx_react_1.observer)((props) => {
|
|
|
31
30
|
react_1.default.createElement(YScaleBar_1.default, { model: model }))) : null));
|
|
32
31
|
});
|
|
33
32
|
exports.default = LinearWiggleDisplay;
|
|
34
|
-
var YScaleBar_2 = require("../../shared/YScaleBar");
|
|
35
|
-
Object.defineProperty(exports, "YScaleBar", { enumerable: true, get: function () { return __importDefault(YScaleBar_2).default; } });
|
|
@@ -12,7 +12,7 @@ class MultiXYPlotRenderer extends WiggleBaseRenderer_1.default {
|
|
|
12
12
|
const { bpPerPx, sources, regions, features } = props;
|
|
13
13
|
const [region] = regions;
|
|
14
14
|
const groups = (0, util_1.groupBy)([...features.values()], f => f.get('source'));
|
|
15
|
-
const height = props.height /
|
|
15
|
+
const height = props.height / sources.length;
|
|
16
16
|
const width = (region.end - region.start) / bpPerPx;
|
|
17
17
|
let feats = [];
|
|
18
18
|
ctx.save();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WiggleDisplayModel } from '../models/model';
|
|
3
|
+
declare const ColorLegend: ({ model, rowHeight, labelWidth, exportSVG, }: {
|
|
4
|
+
model: WiggleDisplayModel;
|
|
5
|
+
rowHeight: number;
|
|
6
|
+
labelWidth: number;
|
|
7
|
+
exportSVG?: boolean | undefined;
|
|
8
|
+
}) => React.JSX.Element | null;
|
|
9
|
+
export default ColorLegend;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 react_1 = __importDefault(require("react"));
|
|
7
|
+
const mobx_react_1 = require("mobx-react");
|
|
8
|
+
const RectBg_1 = __importDefault(require("./RectBg"));
|
|
9
|
+
const ColorLegend = (0, mobx_react_1.observer)(function ({ model, rowHeight, labelWidth, exportSVG, }) {
|
|
10
|
+
const { needsCustomLegend, needsScalebar, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, sources, } = model;
|
|
11
|
+
const svgFontSize = Math.min(rowHeight, 12);
|
|
12
|
+
const canDisplayLabel = rowHeight > 11;
|
|
13
|
+
const colorBoxWidth = renderColorBoxes ? 15 : 0;
|
|
14
|
+
const legendWidth = labelWidth + colorBoxWidth + 5;
|
|
15
|
+
const svgOffset = exportSVG ? 10 : 0;
|
|
16
|
+
const extraOffset = svgOffset || (needsScalebar && !rowHeightTooSmallForScalebar ? 50 : 0);
|
|
17
|
+
return sources ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
18
|
+
/* 0.25 for hanging letters like g */
|
|
19
|
+
needsFullHeightScalebar ? (react_1.default.createElement(RectBg_1.default, { y: 0, x: extraOffset, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null,
|
|
20
|
+
sources.map((source, idx) => {
|
|
21
|
+
const boxHeight = Math.min(20, rowHeight);
|
|
22
|
+
return (react_1.default.createElement(react_1.default.Fragment, { key: `${source.name}-${idx}` },
|
|
23
|
+
needsFullHeightScalebar ? null : (react_1.default.createElement(RectBg_1.default, { y: idx * rowHeight + 1, x: extraOffset, width: legendWidth, height: boxHeight })),
|
|
24
|
+
source.color ? (react_1.default.createElement(RectBg_1.default, { y: idx * rowHeight + 1, x: extraOffset, width: colorBoxWidth, height: needsCustomLegend ? rowHeight : boxHeight, color: source.color })) : null,
|
|
25
|
+
canDisplayLabel ? (react_1.default.createElement("text", { y: idx * rowHeight + 13, x: extraOffset + colorBoxWidth + 2, fontSize: svgFontSize }, source.name)) : null));
|
|
26
|
+
}))) : null;
|
|
27
|
+
});
|
|
28
|
+
exports.default = ColorLegend;
|
|
@@ -0,0 +1,11 @@
|
|
|
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 react_1 = __importDefault(require("react"));
|
|
7
|
+
const RectBg = (props) => {
|
|
8
|
+
const { color = 'rgb(255,255,255,0.8)' } = props;
|
|
9
|
+
return react_1.default.createElement("rect", { ...props, fill: color });
|
|
10
|
+
};
|
|
11
|
+
exports.default = RectBg;
|
|
@@ -0,0 +1,22 @@
|
|
|
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 react_1 = __importDefault(require("react"));
|
|
7
|
+
const util_1 = require("@jbrowse/core/util");
|
|
8
|
+
const mobx_react_1 = require("mobx-react");
|
|
9
|
+
const RectBg_1 = __importDefault(require("./RectBg"));
|
|
10
|
+
const ScoreLegend = (0, mobx_react_1.observer)(({ model }) => {
|
|
11
|
+
const { ticks, scaleType } = model;
|
|
12
|
+
const { width } = (0, util_1.getContainingView)(model);
|
|
13
|
+
const legend = `[${ticks === null || ticks === void 0 ? void 0 : ticks.values[0]}-${ticks === null || ticks === void 0 ? void 0 : ticks.values[1]}]` +
|
|
14
|
+
(scaleType === 'log' ? ' (log scale)' : '');
|
|
15
|
+
const len = (0, util_1.measureText)(legend, 14);
|
|
16
|
+
const padding = 25;
|
|
17
|
+
const xpos = width - len - padding;
|
|
18
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
19
|
+
react_1.default.createElement(RectBg_1.default, { y: 0, x: xpos, width: len + 6, height: 16 }),
|
|
20
|
+
react_1.default.createElement("text", { y: 13, x: xpos }, legend)));
|
|
21
|
+
});
|
|
22
|
+
exports.default = ScoreLegend;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WiggleDisplayModel } from '../models/model';
|
|
3
|
-
export declare const StatBars: (props: {
|
|
4
|
-
model: WiggleDisplayModel;
|
|
5
|
-
orientation?: string;
|
|
6
|
-
exportSVG?: boolean;
|
|
7
|
-
}) => React.JSX.Element | null;
|
|
8
3
|
declare const _default: (props: {
|
|
9
4
|
model: WiggleDisplayModel;
|
|
10
5
|
}) => React.JSX.Element;
|
|
@@ -3,102 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.YScaleBar =
|
|
6
|
+
exports.YScaleBar = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const util_1 = require("@jbrowse/core/util");
|
|
9
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
10
8
|
const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
|
|
11
9
|
const mobx_react_1 = require("mobx-react");
|
|
12
|
-
const
|
|
13
|
-
const trackLabelFontSize = 12.8;
|
|
14
|
-
function getOffset(model) {
|
|
15
|
-
const { prefersOffset } = model;
|
|
16
|
-
const { trackLabels } = (0, util_1.getContainingView)(model);
|
|
17
|
-
const track = (0, util_1.getContainingTrack)(model);
|
|
18
|
-
const trackName = (0, configuration_1.getConf)(track, 'name');
|
|
19
|
-
return trackLabels === 'overlapping' && !prefersOffset
|
|
20
|
-
? (0, util_1.measureText)(trackName, trackLabelFontSize) + 100
|
|
21
|
-
: 10;
|
|
22
|
-
}
|
|
23
|
-
const Wrapper = (0, mobx_react_1.observer)(function ({ children, model, exportSVG, }) {
|
|
24
|
-
if (exportSVG) {
|
|
25
|
-
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
const { height } = model;
|
|
29
|
-
return (react_1.default.createElement("svg", { style: {
|
|
30
|
-
position: 'absolute',
|
|
31
|
-
top: 0,
|
|
32
|
-
left: 0,
|
|
33
|
-
pointerEvents: 'none',
|
|
34
|
-
height,
|
|
35
|
-
width: (0, util_1.getContainingView)(model).width,
|
|
36
|
-
} }, children));
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
const RectBg = (props) => {
|
|
40
|
-
const { color = 'rgb(255,255,255,0.8)' } = props;
|
|
41
|
-
return react_1.default.createElement("rect", { ...props, fill: color });
|
|
42
|
-
};
|
|
43
|
-
const ScoreLegend = (0, mobx_react_1.observer)(({ model }) => {
|
|
44
|
-
const { ticks, scaleType } = model;
|
|
45
|
-
const { width } = (0, util_1.getContainingView)(model);
|
|
46
|
-
const legend = `[${ticks === null || ticks === void 0 ? void 0 : ticks.values[0]}-${ticks === null || ticks === void 0 ? void 0 : ticks.values[1]}]` +
|
|
47
|
-
(scaleType === 'log' ? ' (log scale)' : '');
|
|
48
|
-
const len = (0, util_1.measureText)(legend, 14);
|
|
49
|
-
const padding = 25;
|
|
50
|
-
const xpos = width - len - padding;
|
|
51
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
52
|
-
react_1.default.createElement(RectBg, { y: 0, x: xpos, width: len + 6, height: 16 }),
|
|
53
|
-
react_1.default.createElement("text", { y: 13, x: xpos }, legend)));
|
|
54
|
-
});
|
|
55
|
-
const ColorLegend = (0, mobx_react_1.observer)(function ({ model, rowHeight, labelWidth, exportSVG, }) {
|
|
56
|
-
const { needsCustomLegend, needsScalebar, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, sources, } = model;
|
|
57
|
-
const svgFontSize = Math.min(rowHeight, 12);
|
|
58
|
-
const canDisplayLabel = rowHeight > 11;
|
|
59
|
-
const colorBoxWidth = renderColorBoxes ? 15 : 0;
|
|
60
|
-
const legendWidth = labelWidth + colorBoxWidth + 5;
|
|
61
|
-
const svgOffset = exportSVG ? 10 : 0;
|
|
62
|
-
const extraOffset = svgOffset || (needsScalebar && !rowHeightTooSmallForScalebar ? 50 : 0);
|
|
63
|
-
return sources ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
64
|
-
/* 0.25 for hanging letters like g */
|
|
65
|
-
needsFullHeightScalebar ? (react_1.default.createElement(RectBg, { y: 0, x: extraOffset, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null,
|
|
66
|
-
sources.map((source, idx) => {
|
|
67
|
-
const boxHeight = Math.min(20, rowHeight);
|
|
68
|
-
return (react_1.default.createElement(react_1.default.Fragment, { key: `${source.name}-${idx}` },
|
|
69
|
-
needsFullHeightScalebar ? null : (react_1.default.createElement(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: legendWidth, height: boxHeight })),
|
|
70
|
-
source.color ? (react_1.default.createElement(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: colorBoxWidth, height: needsCustomLegend ? rowHeight : boxHeight, color: source.color })) : null,
|
|
71
|
-
canDisplayLabel ? (react_1.default.createElement("text", { y: idx * rowHeight + 13, x: extraOffset + colorBoxWidth + 2, fontSize: svgFontSize }, source.name)) : null));
|
|
72
|
-
}))) : null;
|
|
73
|
-
});
|
|
74
|
-
exports.StatBars = (0, mobx_react_1.observer)(function (props) {
|
|
75
|
-
const { model, orientation, exportSVG } = props;
|
|
76
|
-
const { stats, needsCustomLegend, needsFullHeightScalebar, rowHeightTooSmallForScalebar, rowHeight, sources, ticks, } = model;
|
|
77
|
-
const svgFontSize = Math.min(rowHeight, 12);
|
|
78
|
-
const canDisplayLabel = rowHeight > 11;
|
|
79
|
-
const { width: viewWidth } = (0, util_1.getContainingView)(model);
|
|
80
|
-
const minWidth = 20;
|
|
81
|
-
const ready = stats && sources;
|
|
82
|
-
if (!ready) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
const labelWidth = Math.max(...(sources
|
|
86
|
-
.map(s => (0, util_1.measureText)(s.name, svgFontSize))
|
|
87
|
-
.map(width => (canDisplayLabel ? width : minWidth)) || [0]));
|
|
88
|
-
return (react_1.default.createElement(Wrapper, { ...props }, needsFullHeightScalebar ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
89
|
-
react_1.default.createElement("g", { transform: `translate(${!exportSVG ? getOffset(model) : 0},0)` },
|
|
90
|
-
react_1.default.createElement(YScaleBar_1.default, { model: model, orientation: orientation })),
|
|
91
|
-
react_1.default.createElement("g", { transform: `translate(${viewWidth - labelWidth - 100},0)` },
|
|
92
|
-
react_1.default.createElement(ColorLegend, { exportSVG: exportSVG, model: model, rowHeight: 12, labelWidth: labelWidth })))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
93
|
-
react_1.default.createElement(ColorLegend, { exportSVG: exportSVG, model: model, rowHeight: model.rowHeight, labelWidth: labelWidth }),
|
|
94
|
-
rowHeightTooSmallForScalebar || needsCustomLegend ? (react_1.default.createElement(ScoreLegend, { ...props })) : (sources.map((_source, idx) => (react_1.default.createElement("g", { transform: `translate(0 ${rowHeight * idx})`, key: `${JSON.stringify(ticks)}-${idx}` },
|
|
95
|
-
react_1.default.createElement(YScaleBar_1.default, { model: model, orientation: orientation })))))))));
|
|
96
|
-
});
|
|
10
|
+
const YScaleBars_1 = __importDefault(require("./YScaleBars"));
|
|
97
11
|
exports.default = (0, mobx_react_1.observer)((props) => {
|
|
98
12
|
const { model } = props;
|
|
99
13
|
return (react_1.default.createElement("div", null,
|
|
100
14
|
react_1.default.createElement(plugin_linear_genome_view_1.BaseLinearDisplayComponent, { ...props }),
|
|
101
|
-
react_1.default.createElement(
|
|
15
|
+
react_1.default.createElement(YScaleBars_1.default, { model: model })));
|
|
102
16
|
});
|
|
103
|
-
var
|
|
104
|
-
Object.defineProperty(exports, "YScaleBar", { enumerable: true, get: function () { return __importDefault(
|
|
17
|
+
var YScaleBar_1 = require("../../shared/YScaleBar");
|
|
18
|
+
Object.defineProperty(exports, "YScaleBar", { enumerable: true, get: function () { return __importDefault(YScaleBar_1).default; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WiggleDisplayModel } from '../models/model';
|
|
3
|
+
export declare const YScaleBars: (props: {
|
|
4
|
+
model: WiggleDisplayModel;
|
|
5
|
+
orientation?: string;
|
|
6
|
+
exportSVG?: boolean;
|
|
7
|
+
}) => React.JSX.Element | null;
|
|
8
|
+
export default YScaleBars;
|
|
@@ -0,0 +1,53 @@
|
|
|
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.YScaleBars = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const util_1 = require("@jbrowse/core/util");
|
|
9
|
+
const mobx_react_1 = require("mobx-react");
|
|
10
|
+
const YScaleBar_1 = __importDefault(require("../../shared/YScaleBar"));
|
|
11
|
+
const ColorLegend_1 = __importDefault(require("./ColorLegend"));
|
|
12
|
+
const ScoreLegend_1 = __importDefault(require("./ScoreLegend"));
|
|
13
|
+
const util_2 = require("./util");
|
|
14
|
+
const Wrapper = (0, mobx_react_1.observer)(function ({ children, model, exportSVG, }) {
|
|
15
|
+
if (exportSVG) {
|
|
16
|
+
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const { height } = model;
|
|
20
|
+
return (react_1.default.createElement("svg", { style: {
|
|
21
|
+
position: 'absolute',
|
|
22
|
+
top: 0,
|
|
23
|
+
left: 0,
|
|
24
|
+
pointerEvents: 'none',
|
|
25
|
+
height,
|
|
26
|
+
width: (0, util_1.getContainingView)(model).width,
|
|
27
|
+
} }, children));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
exports.YScaleBars = (0, mobx_react_1.observer)(function (props) {
|
|
31
|
+
const { model, orientation, exportSVG } = props;
|
|
32
|
+
const { stats, needsCustomLegend, needsFullHeightScalebar, rowHeightTooSmallForScalebar, rowHeight, sources, ticks, } = model;
|
|
33
|
+
const svgFontSize = Math.min(rowHeight, 12);
|
|
34
|
+
const canDisplayLabel = rowHeight > 11;
|
|
35
|
+
const { width: viewWidth } = (0, util_1.getContainingView)(model);
|
|
36
|
+
const minWidth = 20;
|
|
37
|
+
const ready = stats && sources;
|
|
38
|
+
if (!ready) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const labelWidth = Math.max(...(sources
|
|
42
|
+
.map(s => (0, util_1.measureText)(s.name, svgFontSize))
|
|
43
|
+
.map(width => (canDisplayLabel ? width : minWidth)) || [0]));
|
|
44
|
+
return (react_1.default.createElement(Wrapper, { ...props }, needsFullHeightScalebar ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
45
|
+
react_1.default.createElement("g", { transform: `translate(${!exportSVG ? (0, util_2.getOffset)(model) : 0},0)` },
|
|
46
|
+
react_1.default.createElement(YScaleBar_1.default, { model: model, orientation: orientation })),
|
|
47
|
+
react_1.default.createElement("g", { transform: `translate(${viewWidth - labelWidth - 100},0)` },
|
|
48
|
+
react_1.default.createElement(ColorLegend_1.default, { exportSVG: exportSVG, model: model, rowHeight: 12, labelWidth: labelWidth })))) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
49
|
+
react_1.default.createElement(ColorLegend_1.default, { exportSVG: exportSVG, model: model, rowHeight: model.rowHeight, labelWidth: labelWidth }),
|
|
50
|
+
rowHeightTooSmallForScalebar || needsCustomLegend ? (react_1.default.createElement(ScoreLegend_1.default, { ...props })) : (sources.map((_source, idx) => (react_1.default.createElement("g", { transform: `translate(0 ${rowHeight * idx})`, key: `${JSON.stringify(ticks)}-${idx}` },
|
|
51
|
+
react_1.default.createElement(YScaleBar_1.default, { model: model, orientation: orientation })))))))));
|
|
52
|
+
});
|
|
53
|
+
exports.default = exports.YScaleBars;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WiggleDisplayModel } from '../models/model';
|
|
1
2
|
export declare function moveUp(arr: {
|
|
2
3
|
name: string;
|
|
3
4
|
}[], sel: string[], by?: number): {
|
|
@@ -8,3 +9,4 @@ export declare function moveDown(arr: {
|
|
|
8
9
|
}[], sel: string[], by?: number): {
|
|
9
10
|
name: string;
|
|
10
11
|
}[];
|
|
12
|
+
export declare function getOffset(model: WiggleDisplayModel): number;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.moveDown = exports.moveUp = void 0;
|
|
3
|
+
exports.getOffset = exports.moveDown = exports.moveUp = void 0;
|
|
4
|
+
const util_1 = require("@jbrowse/core/util");
|
|
5
|
+
const configuration_1 = require("@jbrowse/core/configuration");
|
|
4
6
|
function moveUp(arr, sel, by = 1) {
|
|
5
7
|
const idxs = sel
|
|
6
8
|
.map(l => arr.findIndex(v => v.name === l))
|
|
@@ -33,3 +35,14 @@ function moveDown(arr, sel, by = 1) {
|
|
|
33
35
|
return arr;
|
|
34
36
|
}
|
|
35
37
|
exports.moveDown = moveDown;
|
|
38
|
+
const trackLabelFontSize = 12.8;
|
|
39
|
+
function getOffset(model) {
|
|
40
|
+
const { prefersOffset } = model;
|
|
41
|
+
const { trackLabels } = (0, util_1.getContainingView)(model);
|
|
42
|
+
const track = (0, util_1.getContainingTrack)(model);
|
|
43
|
+
const trackName = (0, configuration_1.getConf)(track, 'name');
|
|
44
|
+
return trackLabels === 'overlapping' && !prefersOffset
|
|
45
|
+
? (0, util_1.measureText)(trackName, trackLabelFontSize) + 100
|
|
46
|
+
: 10;
|
|
47
|
+
}
|
|
48
|
+
exports.getOffset = getOffset;
|
|
@@ -7,13 +7,13 @@ exports.renderSvg = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const util_1 = require("@jbrowse/core/util");
|
|
9
9
|
const mobx_1 = require("mobx");
|
|
10
|
-
const
|
|
10
|
+
const YScaleBars_1 = __importDefault(require("../components/YScaleBars"));
|
|
11
11
|
async function renderSvg(self, opts, superRenderSvg) {
|
|
12
12
|
await (0, mobx_1.when)(() => !!self.stats && !!self.regionCannotBeRenderedText);
|
|
13
13
|
const { offsetPx } = (0, util_1.getContainingView)(self);
|
|
14
14
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
15
15
|
react_1.default.createElement("g", { id: "snpcov" }, await superRenderSvg(opts)),
|
|
16
16
|
react_1.default.createElement("g", { transform: `translate(${Math.max(-offsetPx, 0)})` },
|
|
17
|
-
react_1.default.createElement(
|
|
17
|
+
react_1.default.createElement(YScaleBars_1.default, { model: self, orientation: "left", exportSVG: true }))));
|
|
18
18
|
}
|
|
19
19
|
exports.renderSvg = renderSvg;
|
|
@@ -12,7 +12,7 @@ class MultiRowLineRenderer extends WiggleBaseRenderer_1.default {
|
|
|
12
12
|
const { bpPerPx, sources, regions, features } = props;
|
|
13
13
|
const [region] = regions;
|
|
14
14
|
const groups = (0, util_1.groupBy)([...features.values()], f => f.get('source'));
|
|
15
|
-
const height = props.height /
|
|
15
|
+
const height = props.height / sources.length;
|
|
16
16
|
const width = (region.end - region.start) / bpPerPx;
|
|
17
17
|
let feats = [];
|
|
18
18
|
ctx.save();
|
|
@@ -35,7 +35,7 @@ class MultiXYPlotRenderer extends WiggleBaseRenderer_1.default {
|
|
|
35
35
|
const { bpPerPx, sources, regions, features } = props;
|
|
36
36
|
const [region] = regions;
|
|
37
37
|
const groups = (0, util_1.groupBy)([...features.values()], f => f.get('source'));
|
|
38
|
-
const height = props.height /
|
|
38
|
+
const height = props.height / sources.length;
|
|
39
39
|
const width = (region.end - region.start) / bpPerPx;
|
|
40
40
|
const Color = await Promise.resolve().then(() => __importStar(require('color'))).then(f => f.default);
|
|
41
41
|
let feats = [];
|
|
@@ -7,7 +7,7 @@ export default class MultiXYPlotRenderer extends WiggleBaseRenderer {
|
|
|
7
7
|
const { bpPerPx, sources, regions, features } = props;
|
|
8
8
|
const [region] = regions;
|
|
9
9
|
const groups = groupBy([...features.values()], f => f.get('source'));
|
|
10
|
-
const height = props.height /
|
|
10
|
+
const height = props.height / sources.length;
|
|
11
11
|
const width = (region.end - region.start) / bpPerPx;
|
|
12
12
|
let feats = [];
|
|
13
13
|
ctx.save();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WiggleDisplayModel } from '../models/model';
|
|
3
|
+
declare const ColorLegend: ({ model, rowHeight, labelWidth, exportSVG, }: {
|
|
4
|
+
model: WiggleDisplayModel;
|
|
5
|
+
rowHeight: number;
|
|
6
|
+
labelWidth: number;
|
|
7
|
+
exportSVG?: boolean | undefined;
|
|
8
|
+
}) => React.JSX.Element | null;
|
|
9
|
+
export default ColorLegend;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { observer } from 'mobx-react';
|
|
3
|
+
import RectBg from './RectBg';
|
|
4
|
+
const ColorLegend = observer(function ({ model, rowHeight, labelWidth, exportSVG, }) {
|
|
5
|
+
const { needsCustomLegend, needsScalebar, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, sources, } = model;
|
|
6
|
+
const svgFontSize = Math.min(rowHeight, 12);
|
|
7
|
+
const canDisplayLabel = rowHeight > 11;
|
|
8
|
+
const colorBoxWidth = renderColorBoxes ? 15 : 0;
|
|
9
|
+
const legendWidth = labelWidth + colorBoxWidth + 5;
|
|
10
|
+
const svgOffset = exportSVG ? 10 : 0;
|
|
11
|
+
const extraOffset = svgOffset || (needsScalebar && !rowHeightTooSmallForScalebar ? 50 : 0);
|
|
12
|
+
return sources ? (React.createElement(React.Fragment, null,
|
|
13
|
+
/* 0.25 for hanging letters like g */
|
|
14
|
+
needsFullHeightScalebar ? (React.createElement(RectBg, { y: 0, x: extraOffset, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null,
|
|
15
|
+
sources.map((source, idx) => {
|
|
16
|
+
const boxHeight = Math.min(20, rowHeight);
|
|
17
|
+
return (React.createElement(React.Fragment, { key: `${source.name}-${idx}` },
|
|
18
|
+
needsFullHeightScalebar ? null : (React.createElement(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: legendWidth, height: boxHeight })),
|
|
19
|
+
source.color ? (React.createElement(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: colorBoxWidth, height: needsCustomLegend ? rowHeight : boxHeight, color: source.color })) : null,
|
|
20
|
+
canDisplayLabel ? (React.createElement("text", { y: idx * rowHeight + 13, x: extraOffset + colorBoxWidth + 2, fontSize: svgFontSize }, source.name)) : null));
|
|
21
|
+
}))) : null;
|
|
22
|
+
});
|
|
23
|
+
export default ColorLegend;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { measureText, getContainingView } from '@jbrowse/core/util';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
|
+
import RectBg from './RectBg';
|
|
5
|
+
const ScoreLegend = observer(({ model }) => {
|
|
6
|
+
const { ticks, scaleType } = model;
|
|
7
|
+
const { width } = getContainingView(model);
|
|
8
|
+
const legend = `[${ticks === null || ticks === void 0 ? void 0 : ticks.values[0]}-${ticks === null || ticks === void 0 ? void 0 : ticks.values[1]}]` +
|
|
9
|
+
(scaleType === 'log' ? ' (log scale)' : '');
|
|
10
|
+
const len = measureText(legend, 14);
|
|
11
|
+
const padding = 25;
|
|
12
|
+
const xpos = width - len - padding;
|
|
13
|
+
return (React.createElement(React.Fragment, null,
|
|
14
|
+
React.createElement(RectBg, { y: 0, x: xpos, width: len + 6, height: 16 }),
|
|
15
|
+
React.createElement("text", { y: 13, x: xpos }, legend)));
|
|
16
|
+
});
|
|
17
|
+
export default ScoreLegend;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WiggleDisplayModel } from '../models/model';
|
|
3
|
-
export declare const StatBars: (props: {
|
|
4
|
-
model: WiggleDisplayModel;
|
|
5
|
-
orientation?: string;
|
|
6
|
-
exportSVG?: boolean;
|
|
7
|
-
}) => React.JSX.Element | null;
|
|
8
3
|
declare const _default: (props: {
|
|
9
4
|
model: WiggleDisplayModel;
|
|
10
5
|
}) => React.JSX.Element;
|
|
@@ -1,97 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { getConf } from '@jbrowse/core/configuration';
|
|
4
|
-
import { BaseLinearDisplayComponent, } from '@jbrowse/plugin-linear-genome-view';
|
|
2
|
+
import { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
|
|
5
3
|
import { observer } from 'mobx-react';
|
|
6
|
-
import
|
|
7
|
-
const trackLabelFontSize = 12.8;
|
|
8
|
-
function getOffset(model) {
|
|
9
|
-
const { prefersOffset } = model;
|
|
10
|
-
const { trackLabels } = getContainingView(model);
|
|
11
|
-
const track = getContainingTrack(model);
|
|
12
|
-
const trackName = getConf(track, 'name');
|
|
13
|
-
return trackLabels === 'overlapping' && !prefersOffset
|
|
14
|
-
? measureText(trackName, trackLabelFontSize) + 100
|
|
15
|
-
: 10;
|
|
16
|
-
}
|
|
17
|
-
const Wrapper = observer(function ({ children, model, exportSVG, }) {
|
|
18
|
-
if (exportSVG) {
|
|
19
|
-
return React.createElement(React.Fragment, null, children);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
const { height } = model;
|
|
23
|
-
return (React.createElement("svg", { style: {
|
|
24
|
-
position: 'absolute',
|
|
25
|
-
top: 0,
|
|
26
|
-
left: 0,
|
|
27
|
-
pointerEvents: 'none',
|
|
28
|
-
height,
|
|
29
|
-
width: getContainingView(model).width,
|
|
30
|
-
} }, children));
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
const RectBg = (props) => {
|
|
34
|
-
const { color = 'rgb(255,255,255,0.8)' } = props;
|
|
35
|
-
return React.createElement("rect", { ...props, fill: color });
|
|
36
|
-
};
|
|
37
|
-
const ScoreLegend = observer(({ model }) => {
|
|
38
|
-
const { ticks, scaleType } = model;
|
|
39
|
-
const { width } = getContainingView(model);
|
|
40
|
-
const legend = `[${ticks === null || ticks === void 0 ? void 0 : ticks.values[0]}-${ticks === null || ticks === void 0 ? void 0 : ticks.values[1]}]` +
|
|
41
|
-
(scaleType === 'log' ? ' (log scale)' : '');
|
|
42
|
-
const len = measureText(legend, 14);
|
|
43
|
-
const padding = 25;
|
|
44
|
-
const xpos = width - len - padding;
|
|
45
|
-
return (React.createElement(React.Fragment, null,
|
|
46
|
-
React.createElement(RectBg, { y: 0, x: xpos, width: len + 6, height: 16 }),
|
|
47
|
-
React.createElement("text", { y: 13, x: xpos }, legend)));
|
|
48
|
-
});
|
|
49
|
-
const ColorLegend = observer(function ({ model, rowHeight, labelWidth, exportSVG, }) {
|
|
50
|
-
const { needsCustomLegend, needsScalebar, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, sources, } = model;
|
|
51
|
-
const svgFontSize = Math.min(rowHeight, 12);
|
|
52
|
-
const canDisplayLabel = rowHeight > 11;
|
|
53
|
-
const colorBoxWidth = renderColorBoxes ? 15 : 0;
|
|
54
|
-
const legendWidth = labelWidth + colorBoxWidth + 5;
|
|
55
|
-
const svgOffset = exportSVG ? 10 : 0;
|
|
56
|
-
const extraOffset = svgOffset || (needsScalebar && !rowHeightTooSmallForScalebar ? 50 : 0);
|
|
57
|
-
return sources ? (React.createElement(React.Fragment, null,
|
|
58
|
-
/* 0.25 for hanging letters like g */
|
|
59
|
-
needsFullHeightScalebar ? (React.createElement(RectBg, { y: 0, x: extraOffset, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null,
|
|
60
|
-
sources.map((source, idx) => {
|
|
61
|
-
const boxHeight = Math.min(20, rowHeight);
|
|
62
|
-
return (React.createElement(React.Fragment, { key: `${source.name}-${idx}` },
|
|
63
|
-
needsFullHeightScalebar ? null : (React.createElement(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: legendWidth, height: boxHeight })),
|
|
64
|
-
source.color ? (React.createElement(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: colorBoxWidth, height: needsCustomLegend ? rowHeight : boxHeight, color: source.color })) : null,
|
|
65
|
-
canDisplayLabel ? (React.createElement("text", { y: idx * rowHeight + 13, x: extraOffset + colorBoxWidth + 2, fontSize: svgFontSize }, source.name)) : null));
|
|
66
|
-
}))) : null;
|
|
67
|
-
});
|
|
68
|
-
export const StatBars = observer(function (props) {
|
|
69
|
-
const { model, orientation, exportSVG } = props;
|
|
70
|
-
const { stats, needsCustomLegend, needsFullHeightScalebar, rowHeightTooSmallForScalebar, rowHeight, sources, ticks, } = model;
|
|
71
|
-
const svgFontSize = Math.min(rowHeight, 12);
|
|
72
|
-
const canDisplayLabel = rowHeight > 11;
|
|
73
|
-
const { width: viewWidth } = getContainingView(model);
|
|
74
|
-
const minWidth = 20;
|
|
75
|
-
const ready = stats && sources;
|
|
76
|
-
if (!ready) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
const labelWidth = Math.max(...(sources
|
|
80
|
-
.map(s => measureText(s.name, svgFontSize))
|
|
81
|
-
.map(width => (canDisplayLabel ? width : minWidth)) || [0]));
|
|
82
|
-
return (React.createElement(Wrapper, { ...props }, needsFullHeightScalebar ? (React.createElement(React.Fragment, null,
|
|
83
|
-
React.createElement("g", { transform: `translate(${!exportSVG ? getOffset(model) : 0},0)` },
|
|
84
|
-
React.createElement(YScaleBar, { model: model, orientation: orientation })),
|
|
85
|
-
React.createElement("g", { transform: `translate(${viewWidth - labelWidth - 100},0)` },
|
|
86
|
-
React.createElement(ColorLegend, { exportSVG: exportSVG, model: model, rowHeight: 12, labelWidth: labelWidth })))) : (React.createElement(React.Fragment, null,
|
|
87
|
-
React.createElement(ColorLegend, { exportSVG: exportSVG, model: model, rowHeight: model.rowHeight, labelWidth: labelWidth }),
|
|
88
|
-
rowHeightTooSmallForScalebar || needsCustomLegend ? (React.createElement(ScoreLegend, { ...props })) : (sources.map((_source, idx) => (React.createElement("g", { transform: `translate(0 ${rowHeight * idx})`, key: `${JSON.stringify(ticks)}-${idx}` },
|
|
89
|
-
React.createElement(YScaleBar, { model: model, orientation: orientation })))))))));
|
|
90
|
-
});
|
|
4
|
+
import YScaleBars from './YScaleBars';
|
|
91
5
|
export default observer((props) => {
|
|
92
6
|
const { model } = props;
|
|
93
7
|
return (React.createElement("div", null,
|
|
94
8
|
React.createElement(BaseLinearDisplayComponent, { ...props }),
|
|
95
|
-
React.createElement(
|
|
9
|
+
React.createElement(YScaleBars, { model: model })));
|
|
96
10
|
});
|
|
97
11
|
export { default as YScaleBar } from '../../shared/YScaleBar';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WiggleDisplayModel } from '../models/model';
|
|
3
|
+
export declare const YScaleBars: (props: {
|
|
4
|
+
model: WiggleDisplayModel;
|
|
5
|
+
orientation?: string;
|
|
6
|
+
exportSVG?: boolean;
|
|
7
|
+
}) => React.JSX.Element | null;
|
|
8
|
+
export default YScaleBars;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { measureText, getContainingView } from '@jbrowse/core/util';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
|
+
import YScaleBar from '../../shared/YScaleBar';
|
|
5
|
+
import ColorLegend from './ColorLegend';
|
|
6
|
+
import ScoreLegend from './ScoreLegend';
|
|
7
|
+
import { getOffset } from './util';
|
|
8
|
+
const Wrapper = observer(function ({ children, model, exportSVG, }) {
|
|
9
|
+
if (exportSVG) {
|
|
10
|
+
return React.createElement(React.Fragment, null, children);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
const { height } = model;
|
|
14
|
+
return (React.createElement("svg", { style: {
|
|
15
|
+
position: 'absolute',
|
|
16
|
+
top: 0,
|
|
17
|
+
left: 0,
|
|
18
|
+
pointerEvents: 'none',
|
|
19
|
+
height,
|
|
20
|
+
width: getContainingView(model).width,
|
|
21
|
+
} }, children));
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export const YScaleBars = observer(function (props) {
|
|
25
|
+
const { model, orientation, exportSVG } = props;
|
|
26
|
+
const { stats, needsCustomLegend, needsFullHeightScalebar, rowHeightTooSmallForScalebar, rowHeight, sources, ticks, } = model;
|
|
27
|
+
const svgFontSize = Math.min(rowHeight, 12);
|
|
28
|
+
const canDisplayLabel = rowHeight > 11;
|
|
29
|
+
const { width: viewWidth } = getContainingView(model);
|
|
30
|
+
const minWidth = 20;
|
|
31
|
+
const ready = stats && sources;
|
|
32
|
+
if (!ready) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const labelWidth = Math.max(...(sources
|
|
36
|
+
.map(s => measureText(s.name, svgFontSize))
|
|
37
|
+
.map(width => (canDisplayLabel ? width : minWidth)) || [0]));
|
|
38
|
+
return (React.createElement(Wrapper, { ...props }, needsFullHeightScalebar ? (React.createElement(React.Fragment, null,
|
|
39
|
+
React.createElement("g", { transform: `translate(${!exportSVG ? getOffset(model) : 0},0)` },
|
|
40
|
+
React.createElement(YScaleBar, { model: model, orientation: orientation })),
|
|
41
|
+
React.createElement("g", { transform: `translate(${viewWidth - labelWidth - 100},0)` },
|
|
42
|
+
React.createElement(ColorLegend, { exportSVG: exportSVG, model: model, rowHeight: 12, labelWidth: labelWidth })))) : (React.createElement(React.Fragment, null,
|
|
43
|
+
React.createElement(ColorLegend, { exportSVG: exportSVG, model: model, rowHeight: model.rowHeight, labelWidth: labelWidth }),
|
|
44
|
+
rowHeightTooSmallForScalebar || needsCustomLegend ? (React.createElement(ScoreLegend, { ...props })) : (sources.map((_source, idx) => (React.createElement("g", { transform: `translate(0 ${rowHeight * idx})`, key: `${JSON.stringify(ticks)}-${idx}` },
|
|
45
|
+
React.createElement(YScaleBar, { model: model, orientation: orientation })))))))));
|
|
46
|
+
});
|
|
47
|
+
export default YScaleBars;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WiggleDisplayModel } from '../models/model';
|
|
1
2
|
export declare function moveUp(arr: {
|
|
2
3
|
name: string;
|
|
3
4
|
}[], sel: string[], by?: number): {
|
|
@@ -8,3 +9,4 @@ export declare function moveDown(arr: {
|
|
|
8
9
|
}[], sel: string[], by?: number): {
|
|
9
10
|
name: string;
|
|
10
11
|
}[];
|
|
12
|
+
export declare function getOffset(model: WiggleDisplayModel): number;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getContainingTrack, getContainingView, measureText, } from '@jbrowse/core/util';
|
|
2
|
+
import { getConf } from '@jbrowse/core/configuration';
|
|
1
3
|
export function moveUp(arr, sel, by = 1) {
|
|
2
4
|
const idxs = sel
|
|
3
5
|
.map(l => arr.findIndex(v => v.name === l))
|
|
@@ -28,3 +30,13 @@ export function moveDown(arr, sel, by = 1) {
|
|
|
28
30
|
}
|
|
29
31
|
return arr;
|
|
30
32
|
}
|
|
33
|
+
const trackLabelFontSize = 12.8;
|
|
34
|
+
export function getOffset(model) {
|
|
35
|
+
const { prefersOffset } = model;
|
|
36
|
+
const { trackLabels } = getContainingView(model);
|
|
37
|
+
const track = getContainingTrack(model);
|
|
38
|
+
const trackName = getConf(track, 'name');
|
|
39
|
+
return trackLabels === 'overlapping' && !prefersOffset
|
|
40
|
+
? measureText(trackName, trackLabelFontSize) + 100
|
|
41
|
+
: 10;
|
|
42
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { getContainingView } from '@jbrowse/core/util';
|
|
3
3
|
import { when } from 'mobx';
|
|
4
|
-
import
|
|
4
|
+
import YScaleBars from '../components/YScaleBars';
|
|
5
5
|
export async function renderSvg(self, opts, superRenderSvg) {
|
|
6
6
|
await when(() => !!self.stats && !!self.regionCannotBeRenderedText);
|
|
7
7
|
const { offsetPx } = getContainingView(self);
|
|
8
8
|
return (React.createElement(React.Fragment, null,
|
|
9
9
|
React.createElement("g", { id: "snpcov" }, await superRenderSvg(opts)),
|
|
10
10
|
React.createElement("g", { transform: `translate(${Math.max(-offsetPx, 0)})` },
|
|
11
|
-
React.createElement(
|
|
11
|
+
React.createElement(YScaleBars, { model: self, orientation: "left", exportSVG: true }))));
|
|
12
12
|
}
|
|
@@ -7,7 +7,7 @@ export default class MultiRowLineRenderer extends WiggleBaseRenderer {
|
|
|
7
7
|
const { bpPerPx, sources, regions, features } = props;
|
|
8
8
|
const [region] = regions;
|
|
9
9
|
const groups = groupBy([...features.values()], f => f.get('source'));
|
|
10
|
-
const height = props.height /
|
|
10
|
+
const height = props.height / sources.length;
|
|
11
11
|
const width = (region.end - region.start) / bpPerPx;
|
|
12
12
|
let feats = [];
|
|
13
13
|
ctx.save();
|
|
@@ -7,7 +7,7 @@ export default class MultiXYPlotRenderer extends WiggleBaseRenderer {
|
|
|
7
7
|
const { bpPerPx, sources, regions, features } = props;
|
|
8
8
|
const [region] = regions;
|
|
9
9
|
const groups = groupBy([...features.values()], f => f.get('source'));
|
|
10
|
-
const height = props.height /
|
|
10
|
+
const height = props.height / sources.length;
|
|
11
11
|
const width = (region.end - region.start) / bpPerPx;
|
|
12
12
|
const Color = await import('color').then(f => f.default);
|
|
13
13
|
let feats = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-wiggle",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.3",
|
|
4
4
|
"description": "JBrowse 2 wiggle adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"distModule": "esm/index.js",
|
|
69
69
|
"srcModule": "src/index.ts",
|
|
70
70
|
"module": "esm/index.js",
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "ed402c87efb0904858d602c363bd1757d5742129"
|
|
72
72
|
}
|