jbrowse-plugin-mafviewer 1.0.6 → 1.0.8
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/README.md +17 -2
- package/dist/BigMafAdapter/BigMafAdapter.d.ts +17 -0
- package/dist/BigMafAdapter/BigMafAdapter.js +92 -0
- package/dist/BigMafAdapter/BigMafAdapter.js.map +1 -0
- package/dist/BigMafAdapter/configSchema.d.ts +21 -0
- package/dist/BigMafAdapter/configSchema.js +28 -0
- package/dist/BigMafAdapter/configSchema.js.map +1 -0
- package/dist/BigMafAdapter/index.d.ts +2 -0
- package/dist/BigMafAdapter/index.js +11 -0
- package/dist/BigMafAdapter/index.js.map +1 -0
- package/dist/LinearMafDisplay/components/ColorLegend.d.ts +8 -0
- package/dist/LinearMafDisplay/components/ColorLegend.js +15 -0
- package/dist/LinearMafDisplay/components/ColorLegend.js.map +1 -0
- package/dist/LinearMafDisplay/components/ReactComponent.d.ts +6 -0
- package/dist/LinearMafDisplay/components/ReactComponent.js +15 -0
- package/dist/LinearMafDisplay/components/ReactComponent.js.map +1 -0
- package/dist/LinearMafDisplay/components/RectBg.d.ts +9 -0
- package/dist/LinearMafDisplay/components/RectBg.js +7 -0
- package/dist/LinearMafDisplay/components/RectBg.js.map +1 -0
- package/dist/LinearMafDisplay/components/SetRowHeight.d.ts +11 -0
- package/dist/LinearMafDisplay/components/SetRowHeight.js +36 -0
- package/dist/LinearMafDisplay/components/SetRowHeight.js.map +1 -0
- package/dist/LinearMafDisplay/components/YScaleBars.d.ts +9 -0
- package/dist/LinearMafDisplay/components/YScaleBars.js +41 -0
- package/dist/LinearMafDisplay/components/YScaleBars.js.map +1 -0
- package/dist/LinearMafDisplay/configSchema.d.ts +34 -0
- package/dist/LinearMafDisplay/configSchema.js +15 -0
- package/dist/LinearMafDisplay/configSchema.js.map +1 -0
- package/dist/LinearMafDisplay/index.d.ts +2 -0
- package/dist/LinearMafDisplay/index.js +20 -0
- package/dist/LinearMafDisplay/index.js.map +1 -0
- package/dist/LinearMafDisplay/renderSvg.d.ts +4 -0
- package/dist/LinearMafDisplay/renderSvg.js +17 -0
- package/dist/LinearMafDisplay/renderSvg.js.map +1 -0
- package/dist/LinearMafDisplay/stateModel.d.ts +364 -0
- package/dist/LinearMafDisplay/stateModel.js +176 -0
- package/dist/LinearMafDisplay/stateModel.js.map +1 -0
- package/dist/LinearMafRenderer/LinearMafRenderer.d.ts +45 -0
- package/dist/LinearMafRenderer/LinearMafRenderer.js +181 -0
- package/dist/LinearMafRenderer/LinearMafRenderer.js.map +1 -0
- package/dist/LinearMafRenderer/components/ReactComponent.d.ts +6 -0
- package/dist/LinearMafRenderer/components/ReactComponent.js +8 -0
- package/dist/LinearMafRenderer/components/ReactComponent.js.map +1 -0
- package/dist/LinearMafRenderer/configSchema.d.ts +2 -0
- package/dist/LinearMafRenderer/configSchema.js +13 -0
- package/dist/LinearMafRenderer/configSchema.js.map +1 -0
- package/dist/LinearMafRenderer/index.d.ts +2 -0
- package/dist/LinearMafRenderer/index.js +12 -0
- package/dist/LinearMafRenderer/index.js.map +1 -0
- package/dist/LinearMafRenderer/util.d.ts +10 -0
- package/dist/LinearMafRenderer/util.js +16 -0
- package/dist/LinearMafRenderer/util.js.map +1 -0
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.d.ts +5 -0
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js +111 -0
- package/dist/MafAddTrackWorkflow/AddTrackWorkflow.js.map +1 -0
- package/dist/MafAddTrackWorkflow/index.d.ts +2 -0
- package/dist/MafAddTrackWorkflow/index.js +12 -0
- package/dist/MafAddTrackWorkflow/index.js.map +1 -0
- package/dist/MafTabixAdapter/MafTabixAdapter.d.ts +17 -0
- package/dist/MafTabixAdapter/MafTabixAdapter.js +96 -0
- package/dist/MafTabixAdapter/MafTabixAdapter.js.map +1 -0
- package/dist/MafTabixAdapter/configSchema.d.ts +33 -0
- package/dist/MafTabixAdapter/configSchema.js +40 -0
- package/dist/MafTabixAdapter/configSchema.js.map +1 -0
- package/dist/MafTabixAdapter/index.d.ts +2 -0
- package/dist/MafTabixAdapter/index.js +11 -0
- package/dist/MafTabixAdapter/index.js.map +1 -0
- package/dist/MafTrack/configSchema.d.ts +79 -0
- package/dist/MafTrack/configSchema.js +15 -0
- package/dist/MafTrack/configSchema.js.map +1 -0
- package/dist/MafTrack/index.d.ts +2 -0
- package/dist/MafTrack/index.js +14 -0
- package/dist/MafTrack/index.js.map +1 -0
- package/dist/TaffyAdapter/TaffyAdapter.d.ts +16 -0
- package/dist/TaffyAdapter/TaffyAdapter.js +89 -0
- package/dist/TaffyAdapter/TaffyAdapter.js.map +1 -0
- package/dist/TaffyAdapter/configSchema.d.ts +31 -0
- package/dist/TaffyAdapter/configSchema.js +38 -0
- package/dist/TaffyAdapter/configSchema.js.map +1 -0
- package/dist/TaffyAdapter/index.d.ts +2 -0
- package/dist/TaffyAdapter/index.js +11 -0
- package/dist/TaffyAdapter/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js +4 -1
- package/dist/jbrowse-plugin-mafviewer.umd.production.min.js.map +7 -1
- package/package.json +21 -38
- package/src/BigMafAdapter/BigMafAdapter.ts +1 -2
- package/src/LinearMafDisplay/components/ColorLegend.tsx +2 -2
- package/src/LinearMafDisplay/components/SetRowHeight.tsx +9 -3
- package/src/LinearMafDisplay/components/YScaleBars.tsx +11 -3
- package/src/LinearMafDisplay/stateModel.ts +32 -2
- package/src/LinearMafRenderer/LinearMafRenderer.ts +38 -34
- package/src/LinearMafRenderer/util.ts +20 -0
- package/src/MafAddTrackWorkflow/AddTrackWorkflow.tsx +60 -22
- package/src/MafTabixAdapter/MafTabixAdapter.ts +2 -2
- package/src/TaffyAdapter/TaffyAdapter.ts +112 -0
- package/src/TaffyAdapter/configSchema.ts +44 -0
- package/src/TaffyAdapter/index.ts +15 -0
- package/src/index.ts +2 -0
- package/dist/jbrowse-plugin-mafviewer.umd.development.js +0 -1439
- package/dist/jbrowse-plugin-mafviewer.umd.development.js.map +0 -1
|
@@ -1,1439 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@jbrowse/core/Plugin'), require('@jbrowse/core/pluggableElementTypes'), require('@jbrowse/core/configuration'), require('@jbrowse/core/data_adapters/BaseAdapter'), require('mobx-state-tree'), require('@jbrowse/core/util'), require('@jbrowse/core/util/rxjs'), require('react'), require('mobx-react'), require('@mui/material'), require('@jbrowse/core/ui'), require('tss-react/mui')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@jbrowse/core/Plugin', '@jbrowse/core/pluggableElementTypes', '@jbrowse/core/configuration', '@jbrowse/core/data_adapters/BaseAdapter', 'mobx-state-tree', '@jbrowse/core/util', '@jbrowse/core/util/rxjs', 'react', 'mobx-react', '@mui/material', '@jbrowse/core/ui', 'tss-react/mui'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JBrowsePluginMafViewer = {}, global.JBrowseExports["@jbrowse/core/Plugin"], global.JBrowseExports["@jbrowse/core/pluggableElementTypes"], global.JBrowseExports["@jbrowse/core/configuration"], global.JBrowseExports["@jbrowse/core/data_adapters/BaseAdapter"], global.JBrowseExports["mobx-state-tree"], global.JBrowseExports["@jbrowse/core/util"], global.JBrowseExports["@jbrowse/core/util/rxjs"], global.JBrowseExports.react, global.JBrowseExports["mobx-react"], global.JBrowseExports["@mui/material"], global.JBrowseExports["@jbrowse/core/ui"], global.JBrowseExports["tss-react/mui"]));
|
|
5
|
-
})(this, (function (exports, Plugin, pluggableElementTypes, configuration, BaseAdapter, mobxStateTree, util, rxjs, React, mobxReact, material, ui, mui) { 'use strict';
|
|
6
|
-
|
|
7
|
-
var version = "1.0.6";
|
|
8
|
-
|
|
9
|
-
const configSchema$2 = configuration.ConfigurationSchema('BigMafAdapter', {
|
|
10
|
-
/**
|
|
11
|
-
* #slot
|
|
12
|
-
*/
|
|
13
|
-
samples: {
|
|
14
|
-
type: 'frozen',
|
|
15
|
-
description: 'string[] or {id:string,label:string,color?:string}[]',
|
|
16
|
-
defaultValue: [],
|
|
17
|
-
},
|
|
18
|
-
/**
|
|
19
|
-
* #slot
|
|
20
|
-
*/
|
|
21
|
-
bigBedLocation: {
|
|
22
|
-
type: 'fileLocation',
|
|
23
|
-
defaultValue: {
|
|
24
|
-
uri: '/path/to/my.bb',
|
|
25
|
-
locationType: 'UriLocation',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
}, { explicitlyTyped: true });
|
|
29
|
-
|
|
30
|
-
/******************************************************************************
|
|
31
|
-
Copyright (c) Microsoft Corporation.
|
|
32
|
-
|
|
33
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
34
|
-
purpose with or without fee is hereby granted.
|
|
35
|
-
|
|
36
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
37
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
38
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
39
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
40
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
41
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
42
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
43
|
-
***************************************************************************** */
|
|
44
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
45
|
-
|
|
46
|
-
var extendStatics = function(d, b) {
|
|
47
|
-
extendStatics = Object.setPrototypeOf ||
|
|
48
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
49
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
50
|
-
return extendStatics(d, b);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
function __extends(d, b) {
|
|
54
|
-
if (typeof b !== "function" && b !== null)
|
|
55
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
56
|
-
extendStatics(d, b);
|
|
57
|
-
function __() { this.constructor = d; }
|
|
58
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function __values(o) {
|
|
62
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
63
|
-
if (m) return m.call(o);
|
|
64
|
-
if (o && typeof o.length === "number") return {
|
|
65
|
-
next: function () {
|
|
66
|
-
if (o && i >= o.length) o = void 0;
|
|
67
|
-
return { value: o && o[i++], done: !o };
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function __read(o, n) {
|
|
74
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
75
|
-
if (!m) return o;
|
|
76
|
-
var i = m.call(o), r, ar = [], e;
|
|
77
|
-
try {
|
|
78
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
79
|
-
}
|
|
80
|
-
catch (error) { e = { error: error }; }
|
|
81
|
-
finally {
|
|
82
|
-
try {
|
|
83
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
84
|
-
}
|
|
85
|
-
finally { if (e) throw e.error; }
|
|
86
|
-
}
|
|
87
|
-
return ar;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function __spreadArray(to, from, pack) {
|
|
91
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
92
|
-
if (ar || !(i in from)) {
|
|
93
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
94
|
-
ar[i] = from[i];
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
101
|
-
var e = new Error(message);
|
|
102
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
function isFunction(value) {
|
|
106
|
-
return typeof value === 'function';
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function createErrorClass(createImpl) {
|
|
110
|
-
var _super = function (instance) {
|
|
111
|
-
Error.call(instance);
|
|
112
|
-
instance.stack = new Error().stack;
|
|
113
|
-
};
|
|
114
|
-
var ctorFunc = createImpl(_super);
|
|
115
|
-
ctorFunc.prototype = Object.create(Error.prototype);
|
|
116
|
-
ctorFunc.prototype.constructor = ctorFunc;
|
|
117
|
-
return ctorFunc;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
var UnsubscriptionError = createErrorClass(function (_super) {
|
|
121
|
-
return function UnsubscriptionErrorImpl(errors) {
|
|
122
|
-
_super(this);
|
|
123
|
-
this.message = errors
|
|
124
|
-
? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
|
|
125
|
-
: '';
|
|
126
|
-
this.name = 'UnsubscriptionError';
|
|
127
|
-
this.errors = errors;
|
|
128
|
-
};
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
function arrRemove(arr, item) {
|
|
132
|
-
if (arr) {
|
|
133
|
-
var index = arr.indexOf(item);
|
|
134
|
-
0 <= index && arr.splice(index, 1);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
var Subscription = (function () {
|
|
139
|
-
function Subscription(initialTeardown) {
|
|
140
|
-
this.initialTeardown = initialTeardown;
|
|
141
|
-
this.closed = false;
|
|
142
|
-
this._parentage = null;
|
|
143
|
-
this._finalizers = null;
|
|
144
|
-
}
|
|
145
|
-
Subscription.prototype.unsubscribe = function () {
|
|
146
|
-
var e_1, _a, e_2, _b;
|
|
147
|
-
var errors;
|
|
148
|
-
if (!this.closed) {
|
|
149
|
-
this.closed = true;
|
|
150
|
-
var _parentage = this._parentage;
|
|
151
|
-
if (_parentage) {
|
|
152
|
-
this._parentage = null;
|
|
153
|
-
if (Array.isArray(_parentage)) {
|
|
154
|
-
try {
|
|
155
|
-
for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
|
|
156
|
-
var parent_1 = _parentage_1_1.value;
|
|
157
|
-
parent_1.remove(this);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
161
|
-
finally {
|
|
162
|
-
try {
|
|
163
|
-
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
|
|
164
|
-
}
|
|
165
|
-
finally { if (e_1) throw e_1.error; }
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
_parentage.remove(this);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
var initialFinalizer = this.initialTeardown;
|
|
173
|
-
if (isFunction(initialFinalizer)) {
|
|
174
|
-
try {
|
|
175
|
-
initialFinalizer();
|
|
176
|
-
}
|
|
177
|
-
catch (e) {
|
|
178
|
-
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
var _finalizers = this._finalizers;
|
|
182
|
-
if (_finalizers) {
|
|
183
|
-
this._finalizers = null;
|
|
184
|
-
try {
|
|
185
|
-
for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
|
|
186
|
-
var finalizer = _finalizers_1_1.value;
|
|
187
|
-
try {
|
|
188
|
-
execFinalizer(finalizer);
|
|
189
|
-
}
|
|
190
|
-
catch (err) {
|
|
191
|
-
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
192
|
-
if (err instanceof UnsubscriptionError) {
|
|
193
|
-
errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
errors.push(err);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
202
|
-
finally {
|
|
203
|
-
try {
|
|
204
|
-
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
|
|
205
|
-
}
|
|
206
|
-
finally { if (e_2) throw e_2.error; }
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
if (errors) {
|
|
210
|
-
throw new UnsubscriptionError(errors);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
Subscription.prototype.add = function (teardown) {
|
|
215
|
-
var _a;
|
|
216
|
-
if (teardown && teardown !== this) {
|
|
217
|
-
if (this.closed) {
|
|
218
|
-
execFinalizer(teardown);
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
if (teardown instanceof Subscription) {
|
|
222
|
-
if (teardown.closed || teardown._hasParent(this)) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
teardown._addParent(this);
|
|
226
|
-
}
|
|
227
|
-
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
Subscription.prototype._hasParent = function (parent) {
|
|
232
|
-
var _parentage = this._parentage;
|
|
233
|
-
return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
|
|
234
|
-
};
|
|
235
|
-
Subscription.prototype._addParent = function (parent) {
|
|
236
|
-
var _parentage = this._parentage;
|
|
237
|
-
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
238
|
-
};
|
|
239
|
-
Subscription.prototype._removeParent = function (parent) {
|
|
240
|
-
var _parentage = this._parentage;
|
|
241
|
-
if (_parentage === parent) {
|
|
242
|
-
this._parentage = null;
|
|
243
|
-
}
|
|
244
|
-
else if (Array.isArray(_parentage)) {
|
|
245
|
-
arrRemove(_parentage, parent);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
Subscription.prototype.remove = function (teardown) {
|
|
249
|
-
var _finalizers = this._finalizers;
|
|
250
|
-
_finalizers && arrRemove(_finalizers, teardown);
|
|
251
|
-
if (teardown instanceof Subscription) {
|
|
252
|
-
teardown._removeParent(this);
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
Subscription.EMPTY = (function () {
|
|
256
|
-
var empty = new Subscription();
|
|
257
|
-
empty.closed = true;
|
|
258
|
-
return empty;
|
|
259
|
-
})();
|
|
260
|
-
return Subscription;
|
|
261
|
-
}());
|
|
262
|
-
function isSubscription(value) {
|
|
263
|
-
return (value instanceof Subscription ||
|
|
264
|
-
(value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
|
|
265
|
-
}
|
|
266
|
-
function execFinalizer(finalizer) {
|
|
267
|
-
if (isFunction(finalizer)) {
|
|
268
|
-
finalizer();
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
finalizer.unsubscribe();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
var config = {
|
|
276
|
-
onUnhandledError: null,
|
|
277
|
-
onStoppedNotification: null,
|
|
278
|
-
Promise: undefined,
|
|
279
|
-
useDeprecatedSynchronousErrorHandling: false,
|
|
280
|
-
useDeprecatedNextContext: false,
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
var timeoutProvider = {
|
|
284
|
-
setTimeout: function (handler, timeout) {
|
|
285
|
-
var args = [];
|
|
286
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
287
|
-
args[_i - 2] = arguments[_i];
|
|
288
|
-
}
|
|
289
|
-
var delegate = timeoutProvider.delegate;
|
|
290
|
-
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
|
291
|
-
return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
|
|
292
|
-
}
|
|
293
|
-
return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
294
|
-
},
|
|
295
|
-
clearTimeout: function (handle) {
|
|
296
|
-
var delegate = timeoutProvider.delegate;
|
|
297
|
-
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
|
|
298
|
-
},
|
|
299
|
-
delegate: undefined,
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
function reportUnhandledError(err) {
|
|
303
|
-
timeoutProvider.setTimeout(function () {
|
|
304
|
-
{
|
|
305
|
-
throw err;
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
function noop() { }
|
|
311
|
-
|
|
312
|
-
var Subscriber = (function (_super) {
|
|
313
|
-
__extends(Subscriber, _super);
|
|
314
|
-
function Subscriber(destination) {
|
|
315
|
-
var _this = _super.call(this) || this;
|
|
316
|
-
_this.isStopped = false;
|
|
317
|
-
if (destination) {
|
|
318
|
-
_this.destination = destination;
|
|
319
|
-
if (isSubscription(destination)) {
|
|
320
|
-
destination.add(_this);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
_this.destination = EMPTY_OBSERVER;
|
|
325
|
-
}
|
|
326
|
-
return _this;
|
|
327
|
-
}
|
|
328
|
-
Subscriber.create = function (next, error, complete) {
|
|
329
|
-
return new SafeSubscriber(next, error, complete);
|
|
330
|
-
};
|
|
331
|
-
Subscriber.prototype.next = function (value) {
|
|
332
|
-
if (this.isStopped) ;
|
|
333
|
-
else {
|
|
334
|
-
this._next(value);
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
Subscriber.prototype.error = function (err) {
|
|
338
|
-
if (this.isStopped) ;
|
|
339
|
-
else {
|
|
340
|
-
this.isStopped = true;
|
|
341
|
-
this._error(err);
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
Subscriber.prototype.complete = function () {
|
|
345
|
-
if (this.isStopped) ;
|
|
346
|
-
else {
|
|
347
|
-
this.isStopped = true;
|
|
348
|
-
this._complete();
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
Subscriber.prototype.unsubscribe = function () {
|
|
352
|
-
if (!this.closed) {
|
|
353
|
-
this.isStopped = true;
|
|
354
|
-
_super.prototype.unsubscribe.call(this);
|
|
355
|
-
this.destination = null;
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
Subscriber.prototype._next = function (value) {
|
|
359
|
-
this.destination.next(value);
|
|
360
|
-
};
|
|
361
|
-
Subscriber.prototype._error = function (err) {
|
|
362
|
-
try {
|
|
363
|
-
this.destination.error(err);
|
|
364
|
-
}
|
|
365
|
-
finally {
|
|
366
|
-
this.unsubscribe();
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
Subscriber.prototype._complete = function () {
|
|
370
|
-
try {
|
|
371
|
-
this.destination.complete();
|
|
372
|
-
}
|
|
373
|
-
finally {
|
|
374
|
-
this.unsubscribe();
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
return Subscriber;
|
|
378
|
-
}(Subscription));
|
|
379
|
-
var _bind = Function.prototype.bind;
|
|
380
|
-
function bind(fn, thisArg) {
|
|
381
|
-
return _bind.call(fn, thisArg);
|
|
382
|
-
}
|
|
383
|
-
var ConsumerObserver = (function () {
|
|
384
|
-
function ConsumerObserver(partialObserver) {
|
|
385
|
-
this.partialObserver = partialObserver;
|
|
386
|
-
}
|
|
387
|
-
ConsumerObserver.prototype.next = function (value) {
|
|
388
|
-
var partialObserver = this.partialObserver;
|
|
389
|
-
if (partialObserver.next) {
|
|
390
|
-
try {
|
|
391
|
-
partialObserver.next(value);
|
|
392
|
-
}
|
|
393
|
-
catch (error) {
|
|
394
|
-
handleUnhandledError(error);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
ConsumerObserver.prototype.error = function (err) {
|
|
399
|
-
var partialObserver = this.partialObserver;
|
|
400
|
-
if (partialObserver.error) {
|
|
401
|
-
try {
|
|
402
|
-
partialObserver.error(err);
|
|
403
|
-
}
|
|
404
|
-
catch (error) {
|
|
405
|
-
handleUnhandledError(error);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
else {
|
|
409
|
-
handleUnhandledError(err);
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
ConsumerObserver.prototype.complete = function () {
|
|
413
|
-
var partialObserver = this.partialObserver;
|
|
414
|
-
if (partialObserver.complete) {
|
|
415
|
-
try {
|
|
416
|
-
partialObserver.complete();
|
|
417
|
-
}
|
|
418
|
-
catch (error) {
|
|
419
|
-
handleUnhandledError(error);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
return ConsumerObserver;
|
|
424
|
-
}());
|
|
425
|
-
var SafeSubscriber = (function (_super) {
|
|
426
|
-
__extends(SafeSubscriber, _super);
|
|
427
|
-
function SafeSubscriber(observerOrNext, error, complete) {
|
|
428
|
-
var _this = _super.call(this) || this;
|
|
429
|
-
var partialObserver;
|
|
430
|
-
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
431
|
-
partialObserver = {
|
|
432
|
-
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
|
|
433
|
-
error: error !== null && error !== void 0 ? error : undefined,
|
|
434
|
-
complete: complete !== null && complete !== void 0 ? complete : undefined,
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
else {
|
|
438
|
-
var context_1;
|
|
439
|
-
if (_this && config.useDeprecatedNextContext) {
|
|
440
|
-
context_1 = Object.create(observerOrNext);
|
|
441
|
-
context_1.unsubscribe = function () { return _this.unsubscribe(); };
|
|
442
|
-
partialObserver = {
|
|
443
|
-
next: observerOrNext.next && bind(observerOrNext.next, context_1),
|
|
444
|
-
error: observerOrNext.error && bind(observerOrNext.error, context_1),
|
|
445
|
-
complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
else {
|
|
449
|
-
partialObserver = observerOrNext;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
_this.destination = new ConsumerObserver(partialObserver);
|
|
453
|
-
return _this;
|
|
454
|
-
}
|
|
455
|
-
return SafeSubscriber;
|
|
456
|
-
}(Subscriber));
|
|
457
|
-
function handleUnhandledError(error) {
|
|
458
|
-
{
|
|
459
|
-
reportUnhandledError(error);
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
function defaultErrorHandler(err) {
|
|
463
|
-
throw err;
|
|
464
|
-
}
|
|
465
|
-
var EMPTY_OBSERVER = {
|
|
466
|
-
closed: true,
|
|
467
|
-
next: noop,
|
|
468
|
-
error: defaultErrorHandler,
|
|
469
|
-
complete: noop,
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
function hasLift(source) {
|
|
473
|
-
return isFunction(source === null || source === void 0 ? void 0 : source.lift);
|
|
474
|
-
}
|
|
475
|
-
function operate(init) {
|
|
476
|
-
return function (source) {
|
|
477
|
-
if (hasLift(source)) {
|
|
478
|
-
return source.lift(function (liftedSource) {
|
|
479
|
-
try {
|
|
480
|
-
return init(liftedSource, this);
|
|
481
|
-
}
|
|
482
|
-
catch (err) {
|
|
483
|
-
this.error(err);
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
throw new TypeError('Unable to lift unknown Observable type');
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
|
|
492
|
-
return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
|
|
493
|
-
}
|
|
494
|
-
var OperatorSubscriber = (function (_super) {
|
|
495
|
-
__extends(OperatorSubscriber, _super);
|
|
496
|
-
function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
|
|
497
|
-
var _this = _super.call(this, destination) || this;
|
|
498
|
-
_this.onFinalize = onFinalize;
|
|
499
|
-
_this.shouldUnsubscribe = shouldUnsubscribe;
|
|
500
|
-
_this._next = onNext
|
|
501
|
-
? function (value) {
|
|
502
|
-
try {
|
|
503
|
-
onNext(value);
|
|
504
|
-
}
|
|
505
|
-
catch (err) {
|
|
506
|
-
destination.error(err);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
: _super.prototype._next;
|
|
510
|
-
_this._error = onError
|
|
511
|
-
? function (err) {
|
|
512
|
-
try {
|
|
513
|
-
onError(err);
|
|
514
|
-
}
|
|
515
|
-
catch (err) {
|
|
516
|
-
destination.error(err);
|
|
517
|
-
}
|
|
518
|
-
finally {
|
|
519
|
-
this.unsubscribe();
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
: _super.prototype._error;
|
|
523
|
-
_this._complete = onComplete
|
|
524
|
-
? function () {
|
|
525
|
-
try {
|
|
526
|
-
onComplete();
|
|
527
|
-
}
|
|
528
|
-
catch (err) {
|
|
529
|
-
destination.error(err);
|
|
530
|
-
}
|
|
531
|
-
finally {
|
|
532
|
-
this.unsubscribe();
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
: _super.prototype._complete;
|
|
536
|
-
return _this;
|
|
537
|
-
}
|
|
538
|
-
OperatorSubscriber.prototype.unsubscribe = function () {
|
|
539
|
-
var _a;
|
|
540
|
-
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
541
|
-
var closed_1 = this.closed;
|
|
542
|
-
_super.prototype.unsubscribe.call(this);
|
|
543
|
-
!closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
return OperatorSubscriber;
|
|
547
|
-
}(Subscriber));
|
|
548
|
-
|
|
549
|
-
var EmptyError = createErrorClass(function (_super) { return function EmptyErrorImpl() {
|
|
550
|
-
_super(this);
|
|
551
|
-
this.name = 'EmptyError';
|
|
552
|
-
this.message = 'no elements in sequence';
|
|
553
|
-
}; });
|
|
554
|
-
|
|
555
|
-
function firstValueFrom(source, config) {
|
|
556
|
-
var hasConfig = typeof config === 'object';
|
|
557
|
-
return new Promise(function (resolve, reject) {
|
|
558
|
-
var subscriber = new SafeSubscriber({
|
|
559
|
-
next: function (value) {
|
|
560
|
-
resolve(value);
|
|
561
|
-
subscriber.unsubscribe();
|
|
562
|
-
},
|
|
563
|
-
error: reject,
|
|
564
|
-
complete: function () {
|
|
565
|
-
if (hasConfig) {
|
|
566
|
-
resolve(config.defaultValue);
|
|
567
|
-
}
|
|
568
|
-
else {
|
|
569
|
-
reject(new EmptyError());
|
|
570
|
-
}
|
|
571
|
-
},
|
|
572
|
-
});
|
|
573
|
-
source.subscribe(subscriber);
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {
|
|
578
|
-
return function (source, subscriber) {
|
|
579
|
-
var hasState = hasSeed;
|
|
580
|
-
var state = seed;
|
|
581
|
-
var index = 0;
|
|
582
|
-
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
|
583
|
-
var i = index++;
|
|
584
|
-
state = hasState
|
|
585
|
-
?
|
|
586
|
-
accumulator(state, value, i)
|
|
587
|
-
:
|
|
588
|
-
((hasState = true), value);
|
|
589
|
-
emitOnNext && subscriber.next(state);
|
|
590
|
-
}, emitBeforeComplete &&
|
|
591
|
-
(function () {
|
|
592
|
-
hasState && subscriber.next(state);
|
|
593
|
-
subscriber.complete();
|
|
594
|
-
})));
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
function reduce(accumulator, seed) {
|
|
599
|
-
return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true));
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
var arrReducer = function (arr, value) { return (arr.push(value), arr); };
|
|
603
|
-
function toArray() {
|
|
604
|
-
return operate(function (source, subscriber) {
|
|
605
|
-
reduce(arrReducer, [])(source).subscribe(subscriber);
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
let BigMafAdapter$1 = class BigMafAdapter extends BaseAdapter.BaseFeatureDataAdapter {
|
|
610
|
-
setupP;
|
|
611
|
-
async setup() {
|
|
612
|
-
if (!this.getSubAdapter) {
|
|
613
|
-
throw new Error('no getSubAdapter available');
|
|
614
|
-
}
|
|
615
|
-
const adapter = await this.getSubAdapter({
|
|
616
|
-
...mobxStateTree.getSnapshot(this.config),
|
|
617
|
-
type: 'BigBedAdapter',
|
|
618
|
-
});
|
|
619
|
-
return {
|
|
620
|
-
adapter: adapter.dataAdapter,
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
async setupPre() {
|
|
624
|
-
if (!this.setupP) {
|
|
625
|
-
this.setupP = this.setup().catch(e => {
|
|
626
|
-
this.setupP = undefined;
|
|
627
|
-
throw e;
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
return this.setupP;
|
|
631
|
-
}
|
|
632
|
-
async getRefNames() {
|
|
633
|
-
const { adapter } = await this.setup();
|
|
634
|
-
return adapter.getRefNames();
|
|
635
|
-
}
|
|
636
|
-
async getHeader() {
|
|
637
|
-
const { adapter } = await this.setup();
|
|
638
|
-
return adapter.getHeader();
|
|
639
|
-
}
|
|
640
|
-
getFeatures(query) {
|
|
641
|
-
return rxjs.ObservableCreate(async (observer) => {
|
|
642
|
-
const { adapter } = await this.setup();
|
|
643
|
-
const features = await firstValueFrom(adapter.getFeatures(query).pipe(toArray()));
|
|
644
|
-
for (const feature of features) {
|
|
645
|
-
const maf = feature.get('mafBlock');
|
|
646
|
-
const blocks = maf.split(';');
|
|
647
|
-
let aln;
|
|
648
|
-
const alns = [];
|
|
649
|
-
const alignments = {};
|
|
650
|
-
const blocks2 = [];
|
|
651
|
-
for (const block of blocks) {
|
|
652
|
-
if (block.startsWith('s')) {
|
|
653
|
-
if (aln) {
|
|
654
|
-
alns.push(block.split(/ +/)[6]);
|
|
655
|
-
blocks2.push(block);
|
|
656
|
-
}
|
|
657
|
-
else {
|
|
658
|
-
aln = block.split(/ +/)[6];
|
|
659
|
-
alns.push(aln);
|
|
660
|
-
blocks2.push(block);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
// eslint-disable-next-line unicorn/no-for-loop
|
|
665
|
-
for (let i = 0; i < blocks2.length; i++) {
|
|
666
|
-
const elt = blocks2[i];
|
|
667
|
-
const ad = elt.split(/ +/);
|
|
668
|
-
const y = ad[1].split('.');
|
|
669
|
-
const org = y[0];
|
|
670
|
-
const chr = y[1];
|
|
671
|
-
alignments[org] = {
|
|
672
|
-
chr: chr,
|
|
673
|
-
start: +ad[1],
|
|
674
|
-
srcSize: +ad[2],
|
|
675
|
-
strand: ad[3] === '+' ? 1 : -1,
|
|
676
|
-
unknown: +ad[4],
|
|
677
|
-
data: alns[i],
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
observer.next(new util.SimpleFeature({
|
|
681
|
-
id: feature.id(),
|
|
682
|
-
data: {
|
|
683
|
-
start: feature.get('start'),
|
|
684
|
-
end: feature.get('end'),
|
|
685
|
-
refName: feature.get('refName'),
|
|
686
|
-
seq: alns[0],
|
|
687
|
-
alignments: alignments,
|
|
688
|
-
},
|
|
689
|
-
}));
|
|
690
|
-
}
|
|
691
|
-
observer.complete();
|
|
692
|
-
});
|
|
693
|
-
}
|
|
694
|
-
freeResources() { }
|
|
695
|
-
};
|
|
696
|
-
|
|
697
|
-
function BigMafAdapterF(pluginManager) {
|
|
698
|
-
return pluginManager.addAdapterType(() => new pluggableElementTypes.AdapterType({
|
|
699
|
-
name: 'BigMafAdapter',
|
|
700
|
-
AdapterClass: BigMafAdapter$1,
|
|
701
|
-
configSchema: configSchema$2,
|
|
702
|
-
}));
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
function configSchemaF$1(pluginManager) {
|
|
706
|
-
return configuration.ConfigurationSchema('MafTrack', {}, {
|
|
707
|
-
/**
|
|
708
|
-
* #baseConfiguration
|
|
709
|
-
*/
|
|
710
|
-
baseConfiguration: pluggableElementTypes.createBaseTrackConfig(pluginManager),
|
|
711
|
-
/**
|
|
712
|
-
* #identifier
|
|
713
|
-
*/
|
|
714
|
-
explicitIdentifier: 'trackId',
|
|
715
|
-
});
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
function MafTrackF(pluginManager) {
|
|
719
|
-
return pluginManager.addTrackType(() => {
|
|
720
|
-
const configSchema = configSchemaF$1(pluginManager);
|
|
721
|
-
return new pluggableElementTypes.TrackType({
|
|
722
|
-
name: 'MafTrack',
|
|
723
|
-
configSchema,
|
|
724
|
-
displayName: 'MAF track',
|
|
725
|
-
stateModel: pluggableElementTypes.createBaseTrackModel(pluginManager, 'MafTrack', configSchema),
|
|
726
|
-
});
|
|
727
|
-
});
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
function configSchemaF(pluginManager) {
|
|
731
|
-
const LinearGenomePlugin = pluginManager.getPlugin('LinearGenomeViewPlugin');
|
|
732
|
-
const { baseLinearDisplayConfigSchema } = LinearGenomePlugin.exports;
|
|
733
|
-
return configuration.ConfigurationSchema('LinearMafDisplay', {
|
|
734
|
-
/**
|
|
735
|
-
* #slot
|
|
736
|
-
*/
|
|
737
|
-
renderer: pluginManager.pluggableConfigSchemaType('renderer'),
|
|
738
|
-
}, {
|
|
739
|
-
baseConfiguration: baseLinearDisplayConfigSchema,
|
|
740
|
-
explicitlyTyped: true,
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
const useStyles$1 = mui.makeStyles()({
|
|
745
|
-
root: {
|
|
746
|
-
width: 500,
|
|
747
|
-
},
|
|
748
|
-
});
|
|
749
|
-
const SetRowHeightDialog = mobxReact.observer(function (props) {
|
|
750
|
-
const { model, handleClose } = props;
|
|
751
|
-
const { classes } = useStyles$1();
|
|
752
|
-
const [rowHeight, setRowHeight] = React.useState(`${model.rowHeight}`);
|
|
753
|
-
const [rowProportion, setRowProportion] = React.useState(`${model.rowProportion}`);
|
|
754
|
-
return (React.createElement(ui.Dialog, { open: true, onClose: handleClose, title: "Filter options" },
|
|
755
|
-
React.createElement(material.DialogContent, { className: classes.root },
|
|
756
|
-
React.createElement(material.Typography, null, "Set row height and the proportion of the row height to use for drawing each row"),
|
|
757
|
-
React.createElement(material.TextField, { value: rowHeight, onChange: event => setRowHeight(event.target.value), placeholder: "Enter row height" }),
|
|
758
|
-
React.createElement(material.TextField, { value: rowProportion, onChange: event => setRowProportion(event.target.value), placeholder: "Enter row proportion" }),
|
|
759
|
-
React.createElement(material.DialogActions, null,
|
|
760
|
-
React.createElement(material.Button, { variant: "contained", color: "primary", type: "submit", autoFocus: true, onClick: () => {
|
|
761
|
-
model.setRowProportion(+rowProportion);
|
|
762
|
-
model.setRowHeight(+rowHeight);
|
|
763
|
-
handleClose();
|
|
764
|
-
} }, "Submit"),
|
|
765
|
-
React.createElement(material.Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel")))));
|
|
766
|
-
});
|
|
767
|
-
|
|
768
|
-
function isStrs(array) {
|
|
769
|
-
return typeof array[0] === 'string';
|
|
770
|
-
}
|
|
771
|
-
/**
|
|
772
|
-
* #stateModel LinearMafDisplay
|
|
773
|
-
* extends LinearBasicDisplay
|
|
774
|
-
*/
|
|
775
|
-
function stateModelFactory(configSchema, pluginManager) {
|
|
776
|
-
const LinearGenomePlugin = pluginManager.getPlugin('LinearGenomeViewPlugin');
|
|
777
|
-
const { BaseLinearDisplay } = LinearGenomePlugin.exports;
|
|
778
|
-
return mobxStateTree.types
|
|
779
|
-
.compose('LinearMafDisplay', BaseLinearDisplay, mobxStateTree.types.model({
|
|
780
|
-
/**
|
|
781
|
-
* #property
|
|
782
|
-
*/
|
|
783
|
-
type: mobxStateTree.types.literal('LinearMafDisplay'),
|
|
784
|
-
/**
|
|
785
|
-
* #property
|
|
786
|
-
*/
|
|
787
|
-
configuration: configuration.ConfigurationReference(configSchema),
|
|
788
|
-
/**
|
|
789
|
-
* #property
|
|
790
|
-
*/
|
|
791
|
-
rowHeight: 15,
|
|
792
|
-
/**
|
|
793
|
-
* #property
|
|
794
|
-
*/
|
|
795
|
-
rowProportion: 0.8,
|
|
796
|
-
/**
|
|
797
|
-
* #property
|
|
798
|
-
*/
|
|
799
|
-
showAllLetters: false,
|
|
800
|
-
}))
|
|
801
|
-
.volatile(() => ({
|
|
802
|
-
prefersOffset: true,
|
|
803
|
-
}))
|
|
804
|
-
.actions(self => ({
|
|
805
|
-
/**
|
|
806
|
-
* #action
|
|
807
|
-
*/
|
|
808
|
-
setRowHeight(n) {
|
|
809
|
-
self.rowHeight = n;
|
|
810
|
-
},
|
|
811
|
-
/**
|
|
812
|
-
* #action
|
|
813
|
-
*/
|
|
814
|
-
setRowProportion(n) {
|
|
815
|
-
self.rowProportion = n;
|
|
816
|
-
},
|
|
817
|
-
/**
|
|
818
|
-
* #action
|
|
819
|
-
*/
|
|
820
|
-
setShowAllLetters(f) {
|
|
821
|
-
self.showAllLetters = f;
|
|
822
|
-
},
|
|
823
|
-
}))
|
|
824
|
-
.views(self => ({
|
|
825
|
-
/**
|
|
826
|
-
* #getter
|
|
827
|
-
*/
|
|
828
|
-
get samples() {
|
|
829
|
-
const r = self.adapterConfig.samples;
|
|
830
|
-
return isStrs(r)
|
|
831
|
-
? r.map(elt => ({ id: elt, label: elt, color: undefined }))
|
|
832
|
-
: r;
|
|
833
|
-
},
|
|
834
|
-
/**
|
|
835
|
-
* #getter
|
|
836
|
-
*/
|
|
837
|
-
get rendererTypeName() {
|
|
838
|
-
return 'LinearMafRenderer';
|
|
839
|
-
},
|
|
840
|
-
/**
|
|
841
|
-
* #getter
|
|
842
|
-
*/
|
|
843
|
-
get rendererConfig() {
|
|
844
|
-
const configBlob = configuration.getConf(self, ['renderer']) || {};
|
|
845
|
-
const config = configBlob;
|
|
846
|
-
return self.rendererType.configSchema.create({
|
|
847
|
-
...config,
|
|
848
|
-
type: 'LinearMafRenderer',
|
|
849
|
-
}, util.getEnv(self));
|
|
850
|
-
},
|
|
851
|
-
}))
|
|
852
|
-
.views(self => {
|
|
853
|
-
const { trackMenuItems: superTrackMenuItems, renderProps: superRenderProps, } = self;
|
|
854
|
-
return {
|
|
855
|
-
/**
|
|
856
|
-
* #method
|
|
857
|
-
*/
|
|
858
|
-
renderProps() {
|
|
859
|
-
const { showAllLetters, rendererConfig, samples, rowHeight, rowProportion, } = self;
|
|
860
|
-
return {
|
|
861
|
-
...superRenderProps(),
|
|
862
|
-
config: rendererConfig,
|
|
863
|
-
samples,
|
|
864
|
-
rowHeight,
|
|
865
|
-
rowProportion,
|
|
866
|
-
showAllLetters,
|
|
867
|
-
};
|
|
868
|
-
},
|
|
869
|
-
/**
|
|
870
|
-
* #method
|
|
871
|
-
*/
|
|
872
|
-
trackMenuItems() {
|
|
873
|
-
return [
|
|
874
|
-
...superTrackMenuItems(),
|
|
875
|
-
{
|
|
876
|
-
label: 'Set row height',
|
|
877
|
-
onClick: () => {
|
|
878
|
-
util.getSession(self).queueDialog(handleClose => [
|
|
879
|
-
SetRowHeightDialog,
|
|
880
|
-
{ model: self, handleClose },
|
|
881
|
-
]);
|
|
882
|
-
},
|
|
883
|
-
},
|
|
884
|
-
{
|
|
885
|
-
label: 'Show all letters',
|
|
886
|
-
type: 'checkbox',
|
|
887
|
-
checked: self.showAllLetters,
|
|
888
|
-
onClick: () => self.setShowAllLetters(!self.showAllLetters),
|
|
889
|
-
},
|
|
890
|
-
];
|
|
891
|
-
},
|
|
892
|
-
};
|
|
893
|
-
})
|
|
894
|
-
.actions(self => {
|
|
895
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
896
|
-
const { renderSvg: superRenderSvg } = self;
|
|
897
|
-
return {
|
|
898
|
-
/**
|
|
899
|
-
* #action
|
|
900
|
-
*/
|
|
901
|
-
async renderSvg(opts) {
|
|
902
|
-
const { renderSvg } = await Promise.resolve().then(function () { return renderSvg$1; });
|
|
903
|
-
return renderSvg(self, opts, superRenderSvg);
|
|
904
|
-
},
|
|
905
|
-
};
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
const RectBg = (props) => {
|
|
910
|
-
const { color = 'rgb(255,255,255,0.8)' } = props;
|
|
911
|
-
return React.createElement("rect", { ...props, fill: color });
|
|
912
|
-
};
|
|
913
|
-
|
|
914
|
-
const ColorLegend = mobxReact.observer(function ({ model, labelWidth, svgFontSize, }) {
|
|
915
|
-
const { samples, rowHeight } = model;
|
|
916
|
-
const canDisplayLabel = rowHeight >= 10;
|
|
917
|
-
const boxHeight = Math.min(20, rowHeight);
|
|
918
|
-
return samples ? (React.createElement(React.Fragment, null,
|
|
919
|
-
samples.map((sample, idx) => (React.createElement(RectBg, { key: `${sample.id}-${idx}`, y: idx * rowHeight, x: 0, width: labelWidth + 5, height: boxHeight, color: sample.color }))),
|
|
920
|
-
canDisplayLabel
|
|
921
|
-
? samples.map((sample, idx) => (React.createElement("text", { key: `${sample.id}-${idx}`, y: idx * rowHeight + rowHeight / 2, dominantBaseline: "middle", x: 2, fontSize: svgFontSize }, sample.label)))
|
|
922
|
-
: null)) : null;
|
|
923
|
-
});
|
|
924
|
-
|
|
925
|
-
const Wrapper = mobxReact.observer(function ({ children, model, exportSVG, }) {
|
|
926
|
-
if (exportSVG) {
|
|
927
|
-
return React.createElement(React.Fragment, null, children);
|
|
928
|
-
}
|
|
929
|
-
else {
|
|
930
|
-
const { rowHeight, samples } = model;
|
|
931
|
-
return (React.createElement("svg", { style: {
|
|
932
|
-
position: 'absolute',
|
|
933
|
-
top: 0,
|
|
934
|
-
left: 0,
|
|
935
|
-
pointerEvents: 'none',
|
|
936
|
-
height: samples.length * rowHeight,
|
|
937
|
-
width: util.getContainingView(model).width,
|
|
938
|
-
} }, children));
|
|
939
|
-
}
|
|
940
|
-
});
|
|
941
|
-
const YScaleBars = mobxReact.observer(function (props) {
|
|
942
|
-
const { model } = props;
|
|
943
|
-
const { rowHeight, samples } = model;
|
|
944
|
-
const svgFontSize = Math.min(Math.max(rowHeight, 10), 14);
|
|
945
|
-
const canDisplayLabel = rowHeight >= 10;
|
|
946
|
-
const minWidth = 20;
|
|
947
|
-
const labelWidth = Math.max(...(samples
|
|
948
|
-
.map(s => util.measureText(s.label, svgFontSize))
|
|
949
|
-
.map(width => (canDisplayLabel ? width : minWidth)) || [0]));
|
|
950
|
-
return (React.createElement(Wrapper, { ...props },
|
|
951
|
-
React.createElement(ColorLegend, { model: model, labelWidth: labelWidth, svgFontSize: svgFontSize })));
|
|
952
|
-
});
|
|
953
|
-
|
|
954
|
-
const LinearMafDisplay = mobxReact.observer(function (props) {
|
|
955
|
-
const { model } = props;
|
|
956
|
-
const { pluginManager } = util.getEnv(model);
|
|
957
|
-
const LinearGenomePlugin = pluginManager.getPlugin('LinearGenomeViewPlugin');
|
|
958
|
-
const { BaseLinearDisplayComponent } = LinearGenomePlugin.exports;
|
|
959
|
-
return (React.createElement("div", null,
|
|
960
|
-
React.createElement(BaseLinearDisplayComponent, { ...props }),
|
|
961
|
-
React.createElement(YScaleBars, { model: model })));
|
|
962
|
-
});
|
|
963
|
-
|
|
964
|
-
function LinearMafDisplayF(pluginManager) {
|
|
965
|
-
pluginManager.addDisplayType(() => {
|
|
966
|
-
const configSchema = configSchemaF(pluginManager);
|
|
967
|
-
const stateModel = stateModelFactory(configSchema, pluginManager);
|
|
968
|
-
return new pluggableElementTypes.DisplayType({
|
|
969
|
-
name: 'LinearMafDisplay',
|
|
970
|
-
configSchema,
|
|
971
|
-
stateModel,
|
|
972
|
-
ReactComponent: LinearMafDisplay,
|
|
973
|
-
viewType: 'LinearGenomeView',
|
|
974
|
-
trackType: 'MafTrack',
|
|
975
|
-
displayName: 'MAF display',
|
|
976
|
-
});
|
|
977
|
-
});
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
const configSchema$1 = configuration.ConfigurationSchema('LinearMafRenderer', {}, {
|
|
981
|
-
/**
|
|
982
|
-
* #baseConfiguration
|
|
983
|
-
*/
|
|
984
|
-
explicitlyTyped: true,
|
|
985
|
-
});
|
|
986
|
-
|
|
987
|
-
function getContrastBaseMap(theme) {
|
|
988
|
-
return Object.fromEntries(Object.entries(getColorBaseMap(theme)).map(([key, value]) => [
|
|
989
|
-
key,
|
|
990
|
-
theme.palette.getContrastText(value),
|
|
991
|
-
]));
|
|
992
|
-
}
|
|
993
|
-
function getColorBaseMap(theme) {
|
|
994
|
-
const { bases } = theme.palette;
|
|
995
|
-
return {
|
|
996
|
-
a: bases.A.main,
|
|
997
|
-
c: bases.C.main,
|
|
998
|
-
g: bases.G.main,
|
|
999
|
-
t: bases.T.main,
|
|
1000
|
-
};
|
|
1001
|
-
}
|
|
1002
|
-
function makeImageData({ ctx, renderArgs, }) {
|
|
1003
|
-
const { regions, bpPerPx, rowHeight, showAllLetters, theme: configTheme, samples, rowProportion, features, } = renderArgs;
|
|
1004
|
-
const [region] = regions;
|
|
1005
|
-
const h = rowHeight * rowProportion;
|
|
1006
|
-
const theme = ui.createJBrowseTheme(configTheme);
|
|
1007
|
-
const colorForBase = getColorBaseMap(theme);
|
|
1008
|
-
const contrastForBase = getContrastBaseMap(theme);
|
|
1009
|
-
const sampleToRowMap = new Map(samples.map((s, i) => [s.id, i]));
|
|
1010
|
-
const scale = 1 / bpPerPx;
|
|
1011
|
-
const f = 0.4;
|
|
1012
|
-
const h2 = rowHeight / 2;
|
|
1013
|
-
const hp2 = h / 2;
|
|
1014
|
-
const offset = (rowHeight - h) / 2;
|
|
1015
|
-
// sample as alignments
|
|
1016
|
-
ctx.font = 'bold 10px Courier New,monospace';
|
|
1017
|
-
for (const feature of features.values()) {
|
|
1018
|
-
const [leftPx] = util.featureSpanPx(feature, region, bpPerPx);
|
|
1019
|
-
const vals = feature.get('alignments');
|
|
1020
|
-
const seq = feature.get('seq').toLowerCase();
|
|
1021
|
-
for (const [sample, val] of Object.entries(vals)) {
|
|
1022
|
-
const origAlignment = val.data;
|
|
1023
|
-
const alignment = origAlignment.toLowerCase();
|
|
1024
|
-
const row = sampleToRowMap.get(sample);
|
|
1025
|
-
if (row === undefined) {
|
|
1026
|
-
throw new Error(`unknown sample encountered: ${sample}`);
|
|
1027
|
-
}
|
|
1028
|
-
const t = rowHeight * row;
|
|
1029
|
-
// gaps
|
|
1030
|
-
ctx.beginPath();
|
|
1031
|
-
ctx.fillStyle = 'black';
|
|
1032
|
-
for (let i = 0, o = 0; i < alignment.length; i++) {
|
|
1033
|
-
if (seq[i] !== '-') {
|
|
1034
|
-
if (alignment[i] === '-') {
|
|
1035
|
-
const l = leftPx + scale * o;
|
|
1036
|
-
ctx.moveTo(l, t + h2);
|
|
1037
|
-
ctx.lineTo(l + scale + f, t + h2);
|
|
1038
|
-
}
|
|
1039
|
-
o++;
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
ctx.stroke();
|
|
1043
|
-
if (!showAllLetters) {
|
|
1044
|
-
// matches
|
|
1045
|
-
ctx.beginPath();
|
|
1046
|
-
ctx.fillStyle = 'lightgrey';
|
|
1047
|
-
for (let i = 0, o = 0; i < alignment.length; i++) {
|
|
1048
|
-
if (seq[i] !== '-') {
|
|
1049
|
-
const c = alignment[i];
|
|
1050
|
-
const l = leftPx + scale * o;
|
|
1051
|
-
if (seq[i] === c && c !== '-') {
|
|
1052
|
-
ctx.rect(l, offset + t, scale + f, h);
|
|
1053
|
-
}
|
|
1054
|
-
o++;
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
ctx.fill();
|
|
1058
|
-
}
|
|
1059
|
-
// mismatches
|
|
1060
|
-
for (let i = 0, o = 0; i < alignment.length; i++) {
|
|
1061
|
-
const c = alignment[i];
|
|
1062
|
-
if (seq[i] !== '-') {
|
|
1063
|
-
if ((showAllLetters || seq[i] !== c) && c !== '-') {
|
|
1064
|
-
const l = leftPx + scale * o;
|
|
1065
|
-
ctx.fillStyle =
|
|
1066
|
-
colorForBase[c] ?? 'black';
|
|
1067
|
-
ctx.fillRect(l, offset + t, scale + f, h);
|
|
1068
|
-
}
|
|
1069
|
-
o++;
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
// font
|
|
1073
|
-
const charSize = { w: 10 };
|
|
1074
|
-
if (scale >= charSize.w) {
|
|
1075
|
-
for (let i = 0, o = 0; i < alignment.length; i++) {
|
|
1076
|
-
if (seq[i] !== '-') {
|
|
1077
|
-
const l = leftPx + scale * o;
|
|
1078
|
-
const offset = (scale - charSize.w) / 2 + 1;
|
|
1079
|
-
const c = alignment[i];
|
|
1080
|
-
if ((showAllLetters || seq[i] !== c) && c !== '-') {
|
|
1081
|
-
ctx.fillStyle = contrastForBase[c] ?? 'white';
|
|
1082
|
-
ctx.fillText(origAlignment[i], l + offset, hp2 + t + 3);
|
|
1083
|
-
}
|
|
1084
|
-
o++;
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
// second pass for insertions, has slightly improved look since the
|
|
1091
|
-
// insertions are always 'on top' of the other features
|
|
1092
|
-
for (const feature of features.values()) {
|
|
1093
|
-
const [leftPx] = util.featureSpanPx(feature, region, bpPerPx);
|
|
1094
|
-
const vals = feature.get('alignments');
|
|
1095
|
-
const seq = feature.get('seq').toLowerCase();
|
|
1096
|
-
for (const [sample, val] of Object.entries(vals)) {
|
|
1097
|
-
const origAlignment = val.data;
|
|
1098
|
-
const alignment = origAlignment.toLowerCase();
|
|
1099
|
-
const row = sampleToRowMap.get(sample);
|
|
1100
|
-
if (row === undefined) {
|
|
1101
|
-
throw new Error(`unknown sample encountered: ${sample}`);
|
|
1102
|
-
}
|
|
1103
|
-
const t = rowHeight * row;
|
|
1104
|
-
ctx.beginPath();
|
|
1105
|
-
ctx.fillStyle = 'purple';
|
|
1106
|
-
for (let i = 0, o = 0; i < alignment.length; i++) {
|
|
1107
|
-
let ins = '';
|
|
1108
|
-
while (seq[i] === '-') {
|
|
1109
|
-
if (alignment[i] !== '-') {
|
|
1110
|
-
ins += alignment[i];
|
|
1111
|
-
}
|
|
1112
|
-
i++;
|
|
1113
|
-
}
|
|
1114
|
-
if (ins.length > 0) {
|
|
1115
|
-
const l = leftPx + scale * o - 1;
|
|
1116
|
-
ctx.rect(l, offset + t + 1, 1, h - 1);
|
|
1117
|
-
ctx.rect(l - 2, offset + t, 5, 1);
|
|
1118
|
-
ctx.rect(l - 2, offset + t + h - 1, 5, 1);
|
|
1119
|
-
}
|
|
1120
|
-
o++;
|
|
1121
|
-
}
|
|
1122
|
-
ctx.fill();
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
class LinearMafRenderer extends pluggableElementTypes.FeatureRendererType {
|
|
1127
|
-
getExpandedRegion(region) {
|
|
1128
|
-
const { start, end } = region;
|
|
1129
|
-
const bpExpansion = 1;
|
|
1130
|
-
return {
|
|
1131
|
-
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
1132
|
-
...region,
|
|
1133
|
-
start: Math.floor(Math.max(start - bpExpansion, 0)),
|
|
1134
|
-
end: Math.ceil(end + bpExpansion),
|
|
1135
|
-
};
|
|
1136
|
-
}
|
|
1137
|
-
async render(renderProps) {
|
|
1138
|
-
const { regions, bpPerPx, samples, rowHeight } = renderProps;
|
|
1139
|
-
const [region] = regions;
|
|
1140
|
-
const height = samples.length * rowHeight + 100;
|
|
1141
|
-
const width = (region.end - region.start) / bpPerPx;
|
|
1142
|
-
const features = await this.getFeatures(renderProps);
|
|
1143
|
-
const res = await util.renderToAbstractCanvas(width, height, renderProps, ctx => makeImageData({
|
|
1144
|
-
ctx,
|
|
1145
|
-
renderArgs: {
|
|
1146
|
-
...renderProps,
|
|
1147
|
-
features,
|
|
1148
|
-
},
|
|
1149
|
-
}));
|
|
1150
|
-
const results = await super.render({
|
|
1151
|
-
...renderProps,
|
|
1152
|
-
...res,
|
|
1153
|
-
width,
|
|
1154
|
-
height,
|
|
1155
|
-
});
|
|
1156
|
-
return {
|
|
1157
|
-
...results,
|
|
1158
|
-
...res,
|
|
1159
|
-
width,
|
|
1160
|
-
height,
|
|
1161
|
-
};
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
const LinearMafRendering = mobxReact.observer(function (props) {
|
|
1166
|
-
return React.createElement(ui.PrerenderedCanvas, { ...props });
|
|
1167
|
-
});
|
|
1168
|
-
|
|
1169
|
-
function LinearMafRendererF(pluginManager) {
|
|
1170
|
-
pluginManager.addRendererType(() => new LinearMafRenderer({
|
|
1171
|
-
name: 'LinearMafRenderer',
|
|
1172
|
-
ReactComponent: LinearMafRendering,
|
|
1173
|
-
configSchema: configSchema$1,
|
|
1174
|
-
pluginManager,
|
|
1175
|
-
}));
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
const configSchema = configuration.ConfigurationSchema('MafTabixAdapter', {
|
|
1179
|
-
/**
|
|
1180
|
-
* #slot
|
|
1181
|
-
*/
|
|
1182
|
-
samples: {
|
|
1183
|
-
type: 'frozen',
|
|
1184
|
-
description: 'string[] or {id:string,label:string,color?:string}[]',
|
|
1185
|
-
defaultValue: [],
|
|
1186
|
-
},
|
|
1187
|
-
/**
|
|
1188
|
-
* #slot
|
|
1189
|
-
*/
|
|
1190
|
-
bedGzLocation: {
|
|
1191
|
-
type: 'fileLocation',
|
|
1192
|
-
defaultValue: {
|
|
1193
|
-
uri: '/path/to/my.bed.gz.tbi',
|
|
1194
|
-
locationType: 'UriLocation',
|
|
1195
|
-
},
|
|
1196
|
-
},
|
|
1197
|
-
index: configuration.ConfigurationSchema('Index', {
|
|
1198
|
-
location: {
|
|
1199
|
-
type: 'fileLocation',
|
|
1200
|
-
defaultValue: {
|
|
1201
|
-
uri: '/path/to/my.bed.gz.tbi',
|
|
1202
|
-
},
|
|
1203
|
-
},
|
|
1204
|
-
indexType: {
|
|
1205
|
-
type: 'string',
|
|
1206
|
-
defaultValue: 'TBI',
|
|
1207
|
-
},
|
|
1208
|
-
}),
|
|
1209
|
-
}, { explicitlyTyped: true });
|
|
1210
|
-
|
|
1211
|
-
class BigMafAdapter extends BaseAdapter.BaseFeatureDataAdapter {
|
|
1212
|
-
setupP;
|
|
1213
|
-
async setup() {
|
|
1214
|
-
const config = this.config;
|
|
1215
|
-
if (!this.getSubAdapter) {
|
|
1216
|
-
throw new Error('no getSubAdapter available');
|
|
1217
|
-
}
|
|
1218
|
-
const adapter = await this.getSubAdapter({
|
|
1219
|
-
...mobxStateTree.getSnapshot(config),
|
|
1220
|
-
type: 'BedTabixAdapter',
|
|
1221
|
-
});
|
|
1222
|
-
return {
|
|
1223
|
-
adapter: adapter.dataAdapter,
|
|
1224
|
-
};
|
|
1225
|
-
}
|
|
1226
|
-
async setupPre() {
|
|
1227
|
-
if (!this.setupP) {
|
|
1228
|
-
this.setupP = this.setup().catch(e => {
|
|
1229
|
-
this.setupP = undefined;
|
|
1230
|
-
throw e;
|
|
1231
|
-
});
|
|
1232
|
-
}
|
|
1233
|
-
return this.setupP;
|
|
1234
|
-
}
|
|
1235
|
-
async getRefNames() {
|
|
1236
|
-
const { adapter } = await this.setup();
|
|
1237
|
-
return adapter.getRefNames();
|
|
1238
|
-
}
|
|
1239
|
-
async getHeader() {
|
|
1240
|
-
const { adapter } = await this.setup();
|
|
1241
|
-
return adapter.getHeader();
|
|
1242
|
-
}
|
|
1243
|
-
getFeatures(query) {
|
|
1244
|
-
return rxjs.ObservableCreate(async (observer) => {
|
|
1245
|
-
const { adapter } = await this.setup();
|
|
1246
|
-
const features = await firstValueFrom(adapter.getFeatures(query).pipe(toArray()));
|
|
1247
|
-
const samples = this.getConf('samples');
|
|
1248
|
-
const sampleStrings = typeof samples[0] === 'string'
|
|
1249
|
-
? samples
|
|
1250
|
-
: samples.map(s => s.id);
|
|
1251
|
-
const sampleSet = new Set(sampleStrings);
|
|
1252
|
-
let i = 0;
|
|
1253
|
-
for (const feature of features) {
|
|
1254
|
-
const data = feature.get('field5').split(',');
|
|
1255
|
-
const alignments = {};
|
|
1256
|
-
const alns = data.map(elt => elt.split(':')[5]);
|
|
1257
|
-
for (const [j, elt] of data.entries()) {
|
|
1258
|
-
const ad = elt.split(':');
|
|
1259
|
-
const idx = ad[0].lastIndexOf('.');
|
|
1260
|
-
const org = ad[0].slice(0, idx);
|
|
1261
|
-
const last = ad[0].slice(idx + 1);
|
|
1262
|
-
const s = sampleSet.has(org)
|
|
1263
|
-
? org
|
|
1264
|
-
: sampleStrings.find(f => ad[0].startsWith(f));
|
|
1265
|
-
if (s) {
|
|
1266
|
-
alignments[s] = {
|
|
1267
|
-
chr: last,
|
|
1268
|
-
start: +ad[1],
|
|
1269
|
-
srcSize: +ad[2],
|
|
1270
|
-
strand: ad[3] === '-' ? -1 : 1,
|
|
1271
|
-
unknown: +ad[4],
|
|
1272
|
-
data: alns[j],
|
|
1273
|
-
};
|
|
1274
|
-
}
|
|
1275
|
-
else if (i < 100) {
|
|
1276
|
-
console.error(`line not processed ${ad[0]}`);
|
|
1277
|
-
i++;
|
|
1278
|
-
}
|
|
1279
|
-
else if (i > 100) {
|
|
1280
|
-
console.error('too many errors, not printing any more');
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
observer.next(new util.SimpleFeature({
|
|
1284
|
-
id: feature.id(),
|
|
1285
|
-
data: {
|
|
1286
|
-
start: feature.get('start'),
|
|
1287
|
-
end: feature.get('end'),
|
|
1288
|
-
refName: feature.get('refName'),
|
|
1289
|
-
name: feature.get('name'),
|
|
1290
|
-
score: feature.get('score'),
|
|
1291
|
-
alignments,
|
|
1292
|
-
seq: alns[0],
|
|
1293
|
-
},
|
|
1294
|
-
}));
|
|
1295
|
-
}
|
|
1296
|
-
observer.complete();
|
|
1297
|
-
});
|
|
1298
|
-
}
|
|
1299
|
-
freeResources() { }
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
function MafTabixAdapterF(pluginManager) {
|
|
1303
|
-
return pluginManager.addAdapterType(() => new pluggableElementTypes.AdapterType({
|
|
1304
|
-
name: 'MafTabixAdapter',
|
|
1305
|
-
AdapterClass: BigMafAdapter,
|
|
1306
|
-
configSchema,
|
|
1307
|
-
}));
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
const useStyles = mui.makeStyles()(theme => ({
|
|
1311
|
-
textbox: {
|
|
1312
|
-
width: '100%',
|
|
1313
|
-
},
|
|
1314
|
-
paper: {
|
|
1315
|
-
margin: theme.spacing(),
|
|
1316
|
-
padding: theme.spacing(),
|
|
1317
|
-
},
|
|
1318
|
-
submit: {
|
|
1319
|
-
marginTop: 25,
|
|
1320
|
-
marginBottom: 100,
|
|
1321
|
-
display: 'block',
|
|
1322
|
-
},
|
|
1323
|
-
}));
|
|
1324
|
-
function MultiMAFWidget({ model }) {
|
|
1325
|
-
const { classes } = useStyles();
|
|
1326
|
-
const [samples, setSamples] = React.useState('');
|
|
1327
|
-
const [loc, setLoc] = React.useState();
|
|
1328
|
-
const [indexLoc, setIndexLoc] = React.useState();
|
|
1329
|
-
const [error, setError] = React.useState();
|
|
1330
|
-
const [trackName, setTrackName] = React.useState('MAF track');
|
|
1331
|
-
const [choice, setChoice] = React.useState('BigMafAdapter');
|
|
1332
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1333
|
-
const rootModel = mobxStateTree.getRoot(model);
|
|
1334
|
-
return (React.createElement(material.Paper, { className: classes.paper },
|
|
1335
|
-
React.createElement(material.Paper, null,
|
|
1336
|
-
error ? React.createElement(ui.ErrorMessage, { error: error }) : null,
|
|
1337
|
-
React.createElement(material.FormControl, null,
|
|
1338
|
-
React.createElement(material.FormLabel, null, "File type"),
|
|
1339
|
-
React.createElement(material.RadioGroup, { value: choice, onChange: event => setChoice(event.target.value) },
|
|
1340
|
-
React.createElement(material.FormControlLabel, { value: "BigMafAdapter", control: React.createElement(material.Radio, null), checked: choice === 'BigMafAdapter', label: "bigMaf" }),
|
|
1341
|
-
React.createElement(material.FormControlLabel, { value: "MafTabixAdapter", control: React.createElement(material.Radio, null), checked: choice === 'MafTabixAdapter', label: "mafTabix" }))),
|
|
1342
|
-
choice === 'BigMafAdapter' ? (React.createElement(ui.FileSelector, { location: loc, name: "Path to bigMaf", setLocation: arg => setLoc(arg), rootModel: rootModel })) : (React.createElement(React.Fragment, null,
|
|
1343
|
-
React.createElement(ui.FileSelector, { location: loc, name: "Path to MAF tabix", setLocation: arg => setLoc(arg), rootModel: rootModel }),
|
|
1344
|
-
React.createElement(ui.FileSelector, { location: indexLoc, name: "Path to MAF tabix index", setLocation: arg => setIndexLoc(arg), rootModel: rootModel })))),
|
|
1345
|
-
React.createElement(material.TextField, { multiline: true, rows: 10, value: samples, onChange: event => setSamples(event.target.value), placeholder: 'Enter sample names from the MAF file, one per line, or JSON formatted array of samples', variant: "outlined", fullWidth: true }),
|
|
1346
|
-
React.createElement(material.TextField, { value: trackName, onChange: event => setTrackName(event.target.value), helperText: "Track name" }),
|
|
1347
|
-
React.createElement(material.Button, { variant: "contained", className: classes.submit, onClick: () => {
|
|
1348
|
-
try {
|
|
1349
|
-
const session = util.getSession(model);
|
|
1350
|
-
let sampleNames = [];
|
|
1351
|
-
try {
|
|
1352
|
-
sampleNames = JSON.parse(samples);
|
|
1353
|
-
}
|
|
1354
|
-
catch (e) {
|
|
1355
|
-
sampleNames = samples.split(/\n|\r\n|\r/);
|
|
1356
|
-
}
|
|
1357
|
-
const trackId = [
|
|
1358
|
-
`${trackName.toLowerCase().replaceAll(' ', '_')}-${Date.now()}`,
|
|
1359
|
-
`${session.adminMode ? '' : '-sessionTrack'}`,
|
|
1360
|
-
].join('');
|
|
1361
|
-
if (util.isSessionWithAddTracks(session)) {
|
|
1362
|
-
session.addTrackConf({
|
|
1363
|
-
trackId,
|
|
1364
|
-
type: 'MafTrack',
|
|
1365
|
-
name: trackName,
|
|
1366
|
-
assemblyNames: [model.assembly],
|
|
1367
|
-
adapter: choice === 'BigMafAdapter'
|
|
1368
|
-
? {
|
|
1369
|
-
type: choice,
|
|
1370
|
-
bigBedLocation: loc,
|
|
1371
|
-
samples: sampleNames,
|
|
1372
|
-
}
|
|
1373
|
-
: {
|
|
1374
|
-
type: choice,
|
|
1375
|
-
bedGzLocation: loc,
|
|
1376
|
-
index: { location: indexLoc },
|
|
1377
|
-
samples: sampleNames,
|
|
1378
|
-
},
|
|
1379
|
-
});
|
|
1380
|
-
model.view?.showTrack(trackId);
|
|
1381
|
-
}
|
|
1382
|
-
model.clearData();
|
|
1383
|
-
if (util.isSessionModelWithWidgets(session)) {
|
|
1384
|
-
session.hideWidget(model);
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
catch (e) {
|
|
1388
|
-
setError(e);
|
|
1389
|
-
}
|
|
1390
|
-
} }, "Submit")));
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
function MafAddTrackWorkflowF(pluginManager) {
|
|
1394
|
-
pluginManager.addAddTrackWorkflowType(() => new pluggableElementTypes.AddTrackWorkflowType({
|
|
1395
|
-
name: 'MAF track',
|
|
1396
|
-
ReactComponent: MultiMAFWidget,
|
|
1397
|
-
stateModel: mobxStateTree.types.model({}),
|
|
1398
|
-
}));
|
|
1399
|
-
}
|
|
1400
|
-
|
|
1401
|
-
class MafViewerPlugin extends Plugin {
|
|
1402
|
-
name = 'MafViewerPlugin';
|
|
1403
|
-
version = version;
|
|
1404
|
-
install(pluginManager) {
|
|
1405
|
-
BigMafAdapterF(pluginManager);
|
|
1406
|
-
MafTrackF(pluginManager);
|
|
1407
|
-
LinearMafDisplayF(pluginManager);
|
|
1408
|
-
LinearMafRendererF(pluginManager);
|
|
1409
|
-
MafTabixAdapterF(pluginManager);
|
|
1410
|
-
MafAddTrackWorkflowF(pluginManager);
|
|
1411
|
-
}
|
|
1412
|
-
configure(_pluginManager) { }
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
async function renderSvg(self, opts, superRenderSvg) {
|
|
1416
|
-
const { height, id } = self;
|
|
1417
|
-
const { offsetPx, width } = util.getContainingView(self);
|
|
1418
|
-
const clipid = `mafclip-${id}`;
|
|
1419
|
-
return (React.createElement(React.Fragment, null,
|
|
1420
|
-
React.createElement("defs", null,
|
|
1421
|
-
React.createElement("clipPath", { id: clipid },
|
|
1422
|
-
React.createElement("rect", { x: 0, y: 0, width: width, height: height }))),
|
|
1423
|
-
React.createElement("g", { clipPath: `url(#${clipid})` },
|
|
1424
|
-
React.createElement("g", { id: "snpcov" }, await superRenderSvg(opts)),
|
|
1425
|
-
React.createElement("g", { transform: `translate(${Math.max(-offsetPx, 0)})` },
|
|
1426
|
-
React.createElement(YScaleBars, { model: self, orientation: "left", exportSVG: true })))));
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
var renderSvg$1 = {
|
|
1430
|
-
__proto__: null,
|
|
1431
|
-
renderSvg: renderSvg
|
|
1432
|
-
};
|
|
1433
|
-
|
|
1434
|
-
exports.default = MafViewerPlugin;
|
|
1435
|
-
|
|
1436
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1437
|
-
|
|
1438
|
-
}));
|
|
1439
|
-
//# sourceMappingURL=jbrowse-plugin-mafviewer.umd.development.js.map
|