@jbrowse/plugin-linear-genome-view 1.6.9 → 1.7.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/BaseLinearDisplay/components/BaseLinearDisplay.js +232 -0
- package/dist/BaseLinearDisplay/components/Block.js +86 -0
- package/dist/BaseLinearDisplay/components/LinearBlocks.js +110 -0
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +192 -0
- package/dist/BaseLinearDisplay/index.js +41 -0
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +763 -0
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +24 -0
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +328 -0
- package/dist/LinearBareDisplay/configSchema.js +19 -0
- package/dist/LinearBareDisplay/index.js +21 -0
- package/dist/LinearBareDisplay/index.test.js +33 -0
- package/dist/LinearBareDisplay/model.js +44 -0
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js +94 -0
- package/dist/LinearBasicDisplay/configSchema.js +25 -0
- package/dist/LinearBasicDisplay/index.js +23 -0
- package/dist/LinearBasicDisplay/model.js +162 -0
- package/dist/LinearGenomeView/components/CenterLine.js +80 -0
- package/dist/LinearGenomeView/components/ExportSvgDialog.js +137 -0
- package/dist/LinearGenomeView/components/Header.js +144 -0
- package/dist/LinearGenomeView/components/HelpDialog.js +48 -0
- package/dist/LinearGenomeView/components/ImportForm.js +330 -0
- package/dist/LinearGenomeView/components/LinearGenomeView.js +129 -0
- package/dist/LinearGenomeView/components/LinearGenomeView.test.js +234 -0
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +349 -0
- package/dist/LinearGenomeView/components/MiniControls.js +83 -0
- package/dist/LinearGenomeView/components/OverviewRubberBand.js +310 -0
- package/dist/LinearGenomeView/components/OverviewScaleBar.js +403 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +331 -0
- package/dist/LinearGenomeView/components/RubberBand.js +309 -0
- package/dist/LinearGenomeView/components/Ruler.js +101 -0
- package/dist/LinearGenomeView/components/ScaleBar.js +184 -0
- package/dist/LinearGenomeView/components/ScaleBar.test.js +180 -0
- package/dist/LinearGenomeView/components/SearchBox.js +201 -0
- package/dist/LinearGenomeView/components/SearchResultsDialog.js +159 -0
- package/dist/LinearGenomeView/components/SequenceDialog.js +304 -0
- package/dist/LinearGenomeView/components/TrackContainer.js +179 -0
- package/dist/LinearGenomeView/components/TrackLabel.js +165 -0
- package/dist/LinearGenomeView/components/TracksContainer.js +214 -0
- package/dist/LinearGenomeView/components/VerticalGuides.js +116 -0
- package/dist/LinearGenomeView/components/ZoomControls.js +92 -0
- package/dist/LinearGenomeView/components/util.js +16 -0
- package/dist/LinearGenomeView/index.js +1418 -0
- package/dist/LinearGenomeView/index.test.js +1170 -0
- package/dist/LinearGenomeView/util.js +93 -0
- package/dist/LinearGenomeView/util.test.js +78 -0
- package/dist/index.js +293 -6
- package/package.json +4 -8
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +2 -0
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +10 -8
- package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +1 -1
- package/src/LinearBasicDisplay/model.ts +17 -18
- package/src/LinearGenomeView/components/Header.tsx +1 -1
- package/src/LinearGenomeView/components/ImportForm.tsx +10 -4
- package/src/LinearGenomeView/components/LinearGenomeView.test.js +1 -0
- package/src/LinearGenomeView/components/OverviewScaleBar.tsx +2 -2
- package/src/LinearGenomeView/components/RubberBand.tsx +14 -24
- package/src/LinearGenomeView/components/ScaleBar.test.tsx +1 -0
- package/src/LinearGenomeView/components/ScaleBar.tsx +3 -6
- package/src/LinearGenomeView/components/SequenceDialog.tsx +1 -1
- package/src/LinearGenomeView/components/TrackLabel.tsx +1 -1
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +0 -4
- package/src/LinearGenomeView/index.tsx +2 -3
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.chooseGridPitch = chooseGridPitch;
|
|
7
|
+
exports.makeTicks = makeTicks;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Given a scale ( bp/px ) and minimum distances (px) between major and minor
|
|
11
|
+
* gridlines, return an object like `{ majorPitch: bp, minorPitch: bp }` giving
|
|
12
|
+
* the gridline pitches to use.
|
|
13
|
+
*/
|
|
14
|
+
function chooseGridPitch(scale, minMajorPitchPx, minMinorPitchPx) {
|
|
15
|
+
scale = Math.abs(scale);
|
|
16
|
+
var minMajorPitchBp = minMajorPitchPx * scale;
|
|
17
|
+
var majorMagnitude = parseInt(Number(minMajorPitchBp).toExponential().split(/e/i)[1], 10);
|
|
18
|
+
var majorPitch = Math.pow(10, majorMagnitude);
|
|
19
|
+
|
|
20
|
+
while (majorPitch < minMajorPitchBp) {
|
|
21
|
+
majorPitch *= 2;
|
|
22
|
+
|
|
23
|
+
if (majorPitch >= minMajorPitchBp) {
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
majorPitch *= 2.5;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
majorPitch = Math.max(majorPitch, 5);
|
|
31
|
+
var majorPitchPx = majorPitch / scale;
|
|
32
|
+
var minorPitch = 0;
|
|
33
|
+
|
|
34
|
+
if (!(majorPitch % 10) && majorPitchPx / 10 >= minMinorPitchPx) {
|
|
35
|
+
minorPitch = majorPitch / 10;
|
|
36
|
+
} else if (!(majorPitch % 5) && majorPitchPx / 5 >= minMinorPitchPx) {
|
|
37
|
+
minorPitch = majorPitch / 5;
|
|
38
|
+
} else if (!(majorPitch % 2) && majorPitchPx / 2 >= minMinorPitchPx) {
|
|
39
|
+
minorPitch = majorPitch / 2;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
majorPitch: majorPitch,
|
|
44
|
+
minorPitch: minorPitch
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function makeTicks(start, end, bpPerPx) {
|
|
49
|
+
var emitMajor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
50
|
+
var emitMinor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
51
|
+
var gridPitch = chooseGridPitch(bpPerPx, 60, 15);
|
|
52
|
+
var minBase = start;
|
|
53
|
+
var maxBase = end;
|
|
54
|
+
|
|
55
|
+
if (minBase === null || maxBase === null) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (bpPerPx < 0) {
|
|
60
|
+
;
|
|
61
|
+
var _ref = [maxBase, minBase];
|
|
62
|
+
minBase = _ref[0];
|
|
63
|
+
maxBase = _ref[1];
|
|
64
|
+
} // add 20px additional on the right and left to allow us to draw the ends
|
|
65
|
+
// of labels that lie a little outside our region
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
minBase -= Math.abs(20 * bpPerPx) - 1;
|
|
69
|
+
maxBase += Math.abs(20 * bpPerPx) + 1;
|
|
70
|
+
var iterPitch = gridPitch.minorPitch || gridPitch.majorPitch;
|
|
71
|
+
var index = 0;
|
|
72
|
+
var ticks = [];
|
|
73
|
+
|
|
74
|
+
for (var base = Math.ceil(minBase / iterPitch) * iterPitch; base < maxBase; base += iterPitch) {
|
|
75
|
+
if (emitMinor && base % (gridPitch.majorPitch * 2)) {
|
|
76
|
+
ticks.push({
|
|
77
|
+
type: 'minor',
|
|
78
|
+
base: base - 1,
|
|
79
|
+
index: index
|
|
80
|
+
});
|
|
81
|
+
index += 1;
|
|
82
|
+
} else if (emitMajor && !(base % (gridPitch.majorPitch * 2))) {
|
|
83
|
+
ticks.push({
|
|
84
|
+
type: 'major',
|
|
85
|
+
base: base - 1,
|
|
86
|
+
index: index
|
|
87
|
+
});
|
|
88
|
+
index += 1;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return ticks;
|
|
93
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _util = require("./util");
|
|
4
|
+
|
|
5
|
+
describe('tick calculation', function () {
|
|
6
|
+
test('one', function () {
|
|
7
|
+
var result = Array.from((0, _util.makeTicks)(0, 10, 0.05));
|
|
8
|
+
expect(result).toEqual([{
|
|
9
|
+
type: 'major',
|
|
10
|
+
base: -1,
|
|
11
|
+
index: 0
|
|
12
|
+
}, {
|
|
13
|
+
type: 'minor',
|
|
14
|
+
base: 0,
|
|
15
|
+
index: 1
|
|
16
|
+
}, {
|
|
17
|
+
type: 'minor',
|
|
18
|
+
base: 1,
|
|
19
|
+
index: 2
|
|
20
|
+
}, {
|
|
21
|
+
type: 'minor',
|
|
22
|
+
base: 2,
|
|
23
|
+
index: 3
|
|
24
|
+
}, {
|
|
25
|
+
type: 'minor',
|
|
26
|
+
base: 3,
|
|
27
|
+
index: 4
|
|
28
|
+
}, {
|
|
29
|
+
type: 'minor',
|
|
30
|
+
base: 4,
|
|
31
|
+
index: 5
|
|
32
|
+
}, {
|
|
33
|
+
type: 'minor',
|
|
34
|
+
base: 5,
|
|
35
|
+
index: 6
|
|
36
|
+
}, {
|
|
37
|
+
type: 'minor',
|
|
38
|
+
base: 6,
|
|
39
|
+
index: 7
|
|
40
|
+
}, {
|
|
41
|
+
type: 'minor',
|
|
42
|
+
base: 7,
|
|
43
|
+
index: 8
|
|
44
|
+
}, {
|
|
45
|
+
type: 'minor',
|
|
46
|
+
base: 8,
|
|
47
|
+
index: 9
|
|
48
|
+
}, {
|
|
49
|
+
type: 'major',
|
|
50
|
+
base: 9,
|
|
51
|
+
index: 10
|
|
52
|
+
}, {
|
|
53
|
+
type: 'minor',
|
|
54
|
+
base: 10,
|
|
55
|
+
index: 11
|
|
56
|
+
}]);
|
|
57
|
+
});
|
|
58
|
+
test('two', function () {
|
|
59
|
+
var result = Array.from((0, _util.makeTicks)(0, 50, 1));
|
|
60
|
+
expect(result).toEqual([{
|
|
61
|
+
type: 'major',
|
|
62
|
+
base: -1,
|
|
63
|
+
index: 0
|
|
64
|
+
}, {
|
|
65
|
+
type: 'minor',
|
|
66
|
+
base: 19,
|
|
67
|
+
index: 1
|
|
68
|
+
}, {
|
|
69
|
+
type: 'minor',
|
|
70
|
+
base: 39,
|
|
71
|
+
index: 2
|
|
72
|
+
}, {
|
|
73
|
+
type: 'minor',
|
|
74
|
+
base: 59,
|
|
75
|
+
index: 3
|
|
76
|
+
}]);
|
|
77
|
+
});
|
|
78
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
|
|
2
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(exports, "BaseLinearDisplay", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _BaseLinearDisplay.BaseLinearDisplay;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "BaseLinearDisplayComponent", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function get() {
|
|
19
|
+
return _BaseLinearDisplay.BaseLinearDisplayComponent;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "RefNameAutocomplete", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function get() {
|
|
25
|
+
return _LinearGenomeView.RefNameAutocomplete;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "SearchBox", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function get() {
|
|
31
|
+
return _LinearGenomeView.SearchBox;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "baseLinearDisplayConfigSchema", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function get() {
|
|
37
|
+
return _BaseLinearDisplay.baseLinearDisplayConfigSchema;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
exports["default"] = void 0;
|
|
41
|
+
Object.defineProperty(exports, "linearBareDisplayConfigSchemaFactory", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function get() {
|
|
44
|
+
return _LinearBareDisplay.configSchemaFactory;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "linearBasicDisplayConfigSchemaFactory", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function get() {
|
|
50
|
+
return _LinearBasicDisplay.configSchema;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, "linearBasicDisplayModelFactory", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function get() {
|
|
56
|
+
return _LinearBasicDisplay.modelFactory;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, "renderToSvg", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function get() {
|
|
62
|
+
return _LinearGenomeView.renderToSvg;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
67
|
+
|
|
68
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
69
|
+
|
|
70
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
71
|
+
|
|
72
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
73
|
+
|
|
74
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
75
|
+
|
|
76
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
77
|
+
|
|
78
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
79
|
+
|
|
80
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
81
|
+
|
|
82
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
83
|
+
|
|
84
|
+
var _react = require("react");
|
|
85
|
+
|
|
86
|
+
var _mobx = require("mobx");
|
|
87
|
+
|
|
88
|
+
var _configuration = require("@jbrowse/core/configuration");
|
|
89
|
+
|
|
90
|
+
var _models = require("@jbrowse/core/pluggableElementTypes/models");
|
|
91
|
+
|
|
92
|
+
var _TrackType = _interopRequireDefault(require("@jbrowse/core/pluggableElementTypes/TrackType"));
|
|
93
|
+
|
|
94
|
+
var _DisplayType = _interopRequireDefault(require("@jbrowse/core/pluggableElementTypes/DisplayType"));
|
|
95
|
+
|
|
96
|
+
var _ViewType = _interopRequireDefault(require("@jbrowse/core/pluggableElementTypes/ViewType"));
|
|
97
|
+
|
|
98
|
+
var _Plugin2 = _interopRequireDefault(require("@jbrowse/core/Plugin"));
|
|
99
|
+
|
|
100
|
+
var _util = require("@jbrowse/core/util");
|
|
101
|
+
|
|
102
|
+
var _LineStyle = _interopRequireDefault(require("@material-ui/icons/LineStyle"));
|
|
103
|
+
|
|
104
|
+
var _BaseLinearDisplay = require("./BaseLinearDisplay");
|
|
105
|
+
|
|
106
|
+
var _LinearBareDisplay = require("./LinearBareDisplay");
|
|
107
|
+
|
|
108
|
+
var _LinearGenomeView = require("./LinearGenomeView");
|
|
109
|
+
|
|
110
|
+
var _LinearBasicDisplay = require("./LinearBasicDisplay");
|
|
111
|
+
|
|
112
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
113
|
+
|
|
114
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
115
|
+
|
|
116
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
117
|
+
|
|
118
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
119
|
+
|
|
120
|
+
var LinearGenomeViewPlugin = /*#__PURE__*/function (_Plugin) {
|
|
121
|
+
(0, _inherits2["default"])(LinearGenomeViewPlugin, _Plugin);
|
|
122
|
+
|
|
123
|
+
var _super = _createSuper(LinearGenomeViewPlugin);
|
|
124
|
+
|
|
125
|
+
function LinearGenomeViewPlugin() {
|
|
126
|
+
var _this;
|
|
127
|
+
|
|
128
|
+
(0, _classCallCheck2["default"])(this, LinearGenomeViewPlugin);
|
|
129
|
+
|
|
130
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
131
|
+
args[_key] = arguments[_key];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
135
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "name", 'LinearGenomeViewPlugin');
|
|
136
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "exports", {
|
|
137
|
+
BaseLinearDisplayComponent: _BaseLinearDisplay.BaseLinearDisplayComponent,
|
|
138
|
+
BaseLinearDisplay: _BaseLinearDisplay.BaseLinearDisplay,
|
|
139
|
+
baseLinearDisplayConfigSchema: _BaseLinearDisplay.baseLinearDisplayConfigSchema
|
|
140
|
+
});
|
|
141
|
+
return _this;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
(0, _createClass2["default"])(LinearGenomeViewPlugin, [{
|
|
145
|
+
key: "install",
|
|
146
|
+
value: function install(pluginManager) {
|
|
147
|
+
pluginManager.addTrackType(function () {
|
|
148
|
+
var configSchema = (0, _configuration.ConfigurationSchema)('FeatureTrack', {}, {
|
|
149
|
+
baseConfiguration: (0, _models.createBaseTrackConfig)(pluginManager),
|
|
150
|
+
explicitIdentifier: 'trackId'
|
|
151
|
+
});
|
|
152
|
+
return new _TrackType["default"]({
|
|
153
|
+
name: 'FeatureTrack',
|
|
154
|
+
configSchema: configSchema,
|
|
155
|
+
stateModel: (0, _models.createBaseTrackModel)(pluginManager, 'FeatureTrack', configSchema)
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
pluginManager.addTrackType(function () {
|
|
159
|
+
var configSchema = (0, _configuration.ConfigurationSchema)('BasicTrack', {}, {
|
|
160
|
+
baseConfiguration: (0, _models.createBaseTrackConfig)(pluginManager),
|
|
161
|
+
explicitIdentifier: 'trackId'
|
|
162
|
+
});
|
|
163
|
+
return new _TrackType["default"]({
|
|
164
|
+
name: 'BasicTrack',
|
|
165
|
+
configSchema: configSchema,
|
|
166
|
+
stateModel: (0, _models.createBaseTrackModel)(pluginManager, 'BasicTrack', configSchema)
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
pluginManager.addDisplayType(function () {
|
|
170
|
+
var configSchema = (0, _LinearBareDisplay.configSchemaFactory)(pluginManager);
|
|
171
|
+
return new _DisplayType["default"]({
|
|
172
|
+
name: 'LinearBareDisplay',
|
|
173
|
+
configSchema: configSchema,
|
|
174
|
+
stateModel: (0, _LinearBareDisplay.stateModelFactory)(configSchema),
|
|
175
|
+
trackType: 'BasicTrack',
|
|
176
|
+
viewType: 'LinearGenomeView',
|
|
177
|
+
ReactComponent: _BaseLinearDisplay.BaseLinearDisplayComponent
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
pluginManager.addDisplayType(function () {
|
|
181
|
+
var configSchema = (0, _LinearBasicDisplay.configSchema)(pluginManager);
|
|
182
|
+
return new _DisplayType["default"]({
|
|
183
|
+
name: 'LinearBasicDisplay',
|
|
184
|
+
configSchema: configSchema,
|
|
185
|
+
stateModel: (0, _LinearBasicDisplay.modelFactory)(configSchema),
|
|
186
|
+
trackType: 'FeatureTrack',
|
|
187
|
+
viewType: 'LinearGenomeView',
|
|
188
|
+
ReactComponent: _BaseLinearDisplay.BaseLinearDisplayComponent
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
pluginManager.addViewType(function () {
|
|
192
|
+
return new _ViewType["default"]({
|
|
193
|
+
name: 'LinearGenomeView',
|
|
194
|
+
stateModel: (0, _LinearGenomeView.stateModelFactory)(pluginManager),
|
|
195
|
+
ReactComponent: /*#__PURE__*/(0, _react.lazy)(function () {
|
|
196
|
+
return Promise.resolve().then(function () {
|
|
197
|
+
return _interopRequireWildcard(require('./LinearGenomeView/components/LinearGenomeView'));
|
|
198
|
+
});
|
|
199
|
+
})
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
pluginManager.addToExtensionPoint('LaunchView-LinearGenomeView',
|
|
203
|
+
/*#__PURE__*/
|
|
204
|
+
// @ts-ignore
|
|
205
|
+
function () {
|
|
206
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_ref) {
|
|
207
|
+
var session, assembly, loc, _ref$tracks, tracks, assemblyManager, view, asm, idsNotFound;
|
|
208
|
+
|
|
209
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
210
|
+
while (1) {
|
|
211
|
+
switch (_context.prev = _context.next) {
|
|
212
|
+
case 0:
|
|
213
|
+
session = _ref.session, assembly = _ref.assembly, loc = _ref.loc, _ref$tracks = _ref.tracks, tracks = _ref$tracks === void 0 ? [] : _ref$tracks;
|
|
214
|
+
assemblyManager = session.assemblyManager;
|
|
215
|
+
view = session.addView('LinearGenomeView', {});
|
|
216
|
+
_context.next = 5;
|
|
217
|
+
return (0, _mobx.when)(function () {
|
|
218
|
+
return !!view.volatileWidth;
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
case 5:
|
|
222
|
+
if (assembly) {
|
|
223
|
+
_context.next = 7;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
throw new Error('No assembly provided when launching linear genome view');
|
|
228
|
+
|
|
229
|
+
case 7:
|
|
230
|
+
_context.next = 9;
|
|
231
|
+
return assemblyManager.waitForAssembly(assembly);
|
|
232
|
+
|
|
233
|
+
case 9:
|
|
234
|
+
asm = _context.sent;
|
|
235
|
+
|
|
236
|
+
if (asm) {
|
|
237
|
+
_context.next = 12;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
throw new Error("Assembly \"".concat(assembly, "\" not found when launching linear genome view"));
|
|
242
|
+
|
|
243
|
+
case 12:
|
|
244
|
+
view.navToLocString(loc, assembly);
|
|
245
|
+
idsNotFound = [];
|
|
246
|
+
tracks.forEach(function (track) {
|
|
247
|
+
try {
|
|
248
|
+
view.showTrack(track);
|
|
249
|
+
} catch (e) {
|
|
250
|
+
if ("".concat(e).match('Could not resolve identifier')) {
|
|
251
|
+
idsNotFound.push(track);
|
|
252
|
+
} else {
|
|
253
|
+
throw e;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
if (!idsNotFound.length) {
|
|
259
|
+
_context.next = 17;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
throw new Error("Could not resolve identifiers: ".concat(idsNotFound.join(',')));
|
|
264
|
+
|
|
265
|
+
case 17:
|
|
266
|
+
case "end":
|
|
267
|
+
return _context.stop();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}, _callee);
|
|
271
|
+
}));
|
|
272
|
+
|
|
273
|
+
return function (_x) {
|
|
274
|
+
return _ref2.apply(this, arguments);
|
|
275
|
+
};
|
|
276
|
+
}());
|
|
277
|
+
}
|
|
278
|
+
}, {
|
|
279
|
+
key: "configure",
|
|
280
|
+
value: function configure(pluginManager) {
|
|
281
|
+
if ((0, _util.isAbstractMenuManager)(pluginManager.rootModel)) {
|
|
282
|
+
pluginManager.rootModel.appendToSubMenu(['Add'], {
|
|
283
|
+
label: 'Linear genome view',
|
|
284
|
+
icon: _LineStyle["default"],
|
|
285
|
+
onClick: function onClick(session) {
|
|
286
|
+
session.addView('LinearGenomeView', {});
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}]);
|
|
292
|
+
return LinearGenomeViewPlugin;
|
|
293
|
+
}(_Plugin2["default"]);
|
|
294
|
+
|
|
295
|
+
exports["default"] = LinearGenomeViewPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-linear-genome-view",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "JBrowse 2 linear genome view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -18,15 +18,12 @@
|
|
|
18
18
|
"distMain": "dist/index.js",
|
|
19
19
|
"srcMain": "src/index.ts",
|
|
20
20
|
"main": "dist/index.js",
|
|
21
|
-
"distModule": "dist/plugin-linear-genome-view.esm.js",
|
|
22
|
-
"module": "dist/plugin-linear-genome-view.esm.js",
|
|
23
21
|
"files": [
|
|
24
22
|
"dist",
|
|
25
23
|
"src"
|
|
26
24
|
],
|
|
27
25
|
"scripts": {
|
|
28
|
-
"
|
|
29
|
-
"build": "tsdx build",
|
|
26
|
+
"build": "babel src --root-mode upward --out-dir dist --extensions .ts,.js,.tsx,.jsx",
|
|
30
27
|
"test": "cd ../..; jest plugins/linear-genome-view",
|
|
31
28
|
"prepublishOnly": "yarn test",
|
|
32
29
|
"prepack": "yarn build; yarn useDist",
|
|
@@ -44,8 +41,7 @@
|
|
|
44
41
|
"is-object": "^1.0.1",
|
|
45
42
|
"json-stable-stringify": "^1.0.1",
|
|
46
43
|
"normalize-wheel": "^1.0.1",
|
|
47
|
-
"react-popper": "^2.0.0"
|
|
48
|
-
"react-sizeme": "^3.0.2"
|
|
44
|
+
"react-popper": "^2.0.0"
|
|
49
45
|
},
|
|
50
46
|
"peerDependencies": {
|
|
51
47
|
"@jbrowse/core": "^1.0.0",
|
|
@@ -61,5 +57,5 @@
|
|
|
61
57
|
"publishConfig": {
|
|
62
58
|
"access": "public"
|
|
63
59
|
},
|
|
64
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "cc13844074d11881d211342a6a7eea113561b70b"
|
|
65
61
|
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
isAbortException,
|
|
9
9
|
getContainingView,
|
|
10
10
|
getSession,
|
|
11
|
+
getViewParams,
|
|
11
12
|
isSelectionContainer,
|
|
12
13
|
isSessionModelWithWidgets,
|
|
13
14
|
} from '@jbrowse/core/util'
|
|
@@ -623,6 +624,7 @@ export const BaseLinearDisplay = types
|
|
|
623
624
|
return rendererType.renderInClient(rpcManager, {
|
|
624
625
|
...renderArgs,
|
|
625
626
|
...renderProps,
|
|
627
|
+
viewParams: getViewParams(self, true),
|
|
626
628
|
exportSVG: opts,
|
|
627
629
|
})
|
|
628
630
|
}),
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import React from 'react'
|
|
2
3
|
import { types, getParent, isAlive, cast, Instance } from 'mobx-state-tree'
|
|
3
4
|
import { readConfObject } from '@jbrowse/core/configuration'
|
|
4
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
assembleLocString,
|
|
7
|
+
getSession,
|
|
8
|
+
getContainingDisplay,
|
|
9
|
+
getViewParams,
|
|
10
|
+
makeAbortableReaction,
|
|
11
|
+
Feature,
|
|
12
|
+
} from '@jbrowse/core/util'
|
|
5
13
|
import { Region } from '@jbrowse/core/util/types/mst'
|
|
6
14
|
import {
|
|
7
15
|
AbstractDisplayModel,
|
|
8
16
|
isRetryException,
|
|
9
17
|
} from '@jbrowse/core/util/types'
|
|
10
|
-
import React from 'react'
|
|
11
18
|
|
|
12
|
-
import {
|
|
13
|
-
assembleLocString,
|
|
14
|
-
makeAbortableReaction,
|
|
15
|
-
getSession,
|
|
16
|
-
getContainingDisplay,
|
|
17
|
-
} from '@jbrowse/core/util'
|
|
18
19
|
import {
|
|
19
20
|
getTrackAssemblyNames,
|
|
20
21
|
getRpcSessionId,
|
|
@@ -296,6 +297,7 @@ async function renderBlockEffect(
|
|
|
296
297
|
await rendererType.renderInClient(rpcManager, {
|
|
297
298
|
...renderArgs,
|
|
298
299
|
...renderProps,
|
|
300
|
+
viewParams: getViewParams(self),
|
|
299
301
|
signal,
|
|
300
302
|
})
|
|
301
303
|
return {
|
|
@@ -61,7 +61,7 @@ function SetMaxHeightDlg(props: {
|
|
|
61
61
|
<DialogContent className={classes.root}>
|
|
62
62
|
<Typography>
|
|
63
63
|
Set max height for the track. For example, you can increase this if
|
|
64
|
-
the layout says
|
|
64
|
+
the layout says "Max height reached"
|
|
65
65
|
</Typography>
|
|
66
66
|
<TextField
|
|
67
67
|
value={max}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { lazy } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getConf,
|
|
4
|
+
ConfigurationReference,
|
|
5
|
+
AnyConfigurationSchemaType,
|
|
6
|
+
} from '@jbrowse/core/configuration'
|
|
3
7
|
import { getSession } from '@jbrowse/core/util'
|
|
4
8
|
import { MenuItem } from '@jbrowse/core/ui'
|
|
5
|
-
import VisibilityIcon from '@material-ui/icons/Visibility'
|
|
6
9
|
import { types, getEnv, Instance } from 'mobx-state-tree'
|
|
7
|
-
|
|
10
|
+
|
|
11
|
+
// icons
|
|
12
|
+
import VisibilityIcon from '@material-ui/icons/Visibility'
|
|
13
|
+
|
|
14
|
+
// locals
|
|
8
15
|
import { BaseLinearDisplay } from '../BaseLinearDisplay'
|
|
9
16
|
|
|
10
17
|
const SetMaxHeightDlg = lazy(() => import('./components/SetMaxHeight'))
|
|
@@ -29,31 +36,23 @@ const stateModelFactory = (configSchema: AnyConfigurationSchemaType) =>
|
|
|
29
36
|
},
|
|
30
37
|
|
|
31
38
|
get showLabels() {
|
|
32
|
-
|
|
33
|
-
return self.trackShowLabels !== undefined
|
|
34
|
-
? self.trackShowLabels
|
|
35
|
-
: showLabels
|
|
39
|
+
return self.trackShowLabels ?? getConf(self, ['renderer', 'showLabels'])
|
|
36
40
|
},
|
|
37
41
|
|
|
38
42
|
get showDescriptions() {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
return (
|
|
44
|
+
self.trackShowDescriptions ??
|
|
45
|
+
getConf(self, ['renderer', 'showLabels'])
|
|
46
|
+
)
|
|
43
47
|
},
|
|
44
48
|
|
|
45
49
|
get maxHeight() {
|
|
46
|
-
|
|
47
|
-
return self.trackMaxHeight !== undefined
|
|
48
|
-
? self.trackMaxHeight
|
|
49
|
-
: maxHeight
|
|
50
|
+
return self.trackMaxHeight ?? getConf(self, ['renderer', 'maxHeight'])
|
|
50
51
|
},
|
|
51
52
|
|
|
52
53
|
get displayMode() {
|
|
53
54
|
const displayMode = getConf(self, ['renderer', 'displayMode'])
|
|
54
|
-
return self.trackDisplayMode
|
|
55
|
-
? self.trackDisplayMode
|
|
56
|
-
: displayMode
|
|
55
|
+
return self.trackDisplayMode ?? displayMode
|
|
57
56
|
},
|
|
58
57
|
get rendererConfig() {
|
|
59
58
|
const configBlob = getConf(self, ['renderer']) || {}
|