@jbrowse/plugin-legacy-jbrowse 1.6.9 → 1.7.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/JBrowse1Connection/configSchema.d.ts +2 -2
- package/dist/JBrowse1Connection/configSchema.js +30 -0
- package/dist/JBrowse1Connection/index.d.ts +2 -2
- package/dist/JBrowse1Connection/index.js +23 -0
- package/dist/JBrowse1Connection/jb1ConfigLoad.d.ts +36 -36
- package/dist/JBrowse1Connection/jb1ConfigLoad.js +555 -0
- package/dist/JBrowse1Connection/jb1ConfigParse.d.ts +11 -11
- package/dist/JBrowse1Connection/jb1ConfigParse.js +476 -0
- package/dist/JBrowse1Connection/jb1ToJb2.d.ts +47 -47
- package/dist/JBrowse1Connection/jb1ToJb2.js +556 -0
- package/dist/JBrowse1Connection/model.d.ts +15 -4
- package/dist/JBrowse1Connection/model.js +58 -0
- package/dist/JBrowse1Connection/types.d.ts +91 -91
- package/dist/JBrowse1Connection/types.js +5 -0
- package/dist/JBrowse1Connection/util.d.ts +26 -26
- package/dist/JBrowse1Connection/util.js +177 -0
- package/dist/JBrowse1TextSeachAdapter/HttpMap.d.ts +39 -39
- package/dist/JBrowse1TextSeachAdapter/HttpMap.js +350 -0
- package/dist/JBrowse1TextSeachAdapter/HttpMap.test.js +118 -0
- package/dist/JBrowse1TextSeachAdapter/JBrowse1TextSearchAdapter.d.ts +33 -33
- package/dist/JBrowse1TextSeachAdapter/JBrowse1TextSearchAdapter.js +191 -0
- package/dist/JBrowse1TextSeachAdapter/JBrowse1TextSearchAdapter.test.js +98 -0
- package/dist/JBrowse1TextSeachAdapter/configSchema.d.ts +2 -2
- package/dist/JBrowse1TextSeachAdapter/configSchema.js +35 -0
- package/dist/JBrowse1TextSeachAdapter/index.d.ts +2 -2
- package/dist/JBrowse1TextSeachAdapter/index.js +23 -0
- package/dist/NCListAdapter/NCListAdapter.d.ts +31 -31
- package/dist/NCListAdapter/NCListAdapter.js +237 -0
- package/dist/NCListAdapter/NCListAdapter.test.js +108 -0
- package/dist/NCListAdapter/NCListFeature.d.ts +31 -31
- package/dist/NCListAdapter/NCListFeature.js +142 -0
- package/dist/NCListAdapter/configSchema.d.ts +2 -2
- package/dist/NCListAdapter/configSchema.js +27 -0
- package/dist/NCListAdapter/index.d.ts +1 -1
- package/dist/NCListAdapter/index.js +15 -0
- package/dist/declare.d.js +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +122 -6
- package/dist/index.test.js +44 -0
- package/package.json +5 -7
- package/src/JBrowse1Connection/jb1ConfigLoad.ts +1 -1
- package/dist/index.test.d.ts +0 -1
- package/dist/plugin-legacy-jbrowse.cjs.development.js +0 -3567
- package/dist/plugin-legacy-jbrowse.cjs.development.js.map +0 -1
- package/dist/plugin-legacy-jbrowse.cjs.production.min.js +0 -2
- package/dist/plugin-legacy-jbrowse.cjs.production.min.js.map +0 -1
- package/dist/plugin-legacy-jbrowse.esm.js +0 -3561
- package/dist/plugin-legacy-jbrowse.esm.js.map +0 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
6
|
+
|
|
7
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
|
+
|
|
9
|
+
var _fs = require("fs");
|
|
10
|
+
|
|
11
|
+
var _path = _interopRequireDefault(require("path"));
|
|
12
|
+
|
|
13
|
+
var _url = require("url");
|
|
14
|
+
|
|
15
|
+
var _operators = require("rxjs/operators");
|
|
16
|
+
|
|
17
|
+
var _NCListAdapter = _interopRequireDefault(require("./NCListAdapter"));
|
|
18
|
+
|
|
19
|
+
var _configSchema = _interopRequireDefault(require("./configSchema"));
|
|
20
|
+
|
|
21
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
22
|
+
|
|
23
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
24
|
+
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
26
|
+
|
|
27
|
+
test('adapter can fetch features from ensembl_genes test set', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
28
|
+
var rootTemplate, args, adapter, features, featuresArray, featuresJsonArray, _iterator, _step, feature;
|
|
29
|
+
|
|
30
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
31
|
+
while (1) {
|
|
32
|
+
switch (_context.prev = _context.next) {
|
|
33
|
+
case 0:
|
|
34
|
+
rootTemplate = _path["default"].join(__dirname, '..', '..', 'test_data', 'ensembl_genes', '{refseq}', 'trackData.json').replace(/\\/g, '\\\\');
|
|
35
|
+
_context.next = 3;
|
|
36
|
+
return _fs.promises.stat(rootTemplate.replace('{refseq}', '21'));
|
|
37
|
+
|
|
38
|
+
case 3:
|
|
39
|
+
// will throw if doesnt exist
|
|
40
|
+
args = {
|
|
41
|
+
refNames: [],
|
|
42
|
+
rootUrlTemplate: {
|
|
43
|
+
uri: decodeURI(new _url.URL("file://".concat(rootTemplate)).href),
|
|
44
|
+
locationType: 'UriLocation'
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
adapter = new _NCListAdapter["default"](_configSchema["default"].create(args));
|
|
48
|
+
features = adapter.getFeatures({
|
|
49
|
+
assemblyName: 'volvox',
|
|
50
|
+
refName: '21',
|
|
51
|
+
start: 34960388,
|
|
52
|
+
end: 35960388
|
|
53
|
+
});
|
|
54
|
+
_context.next = 8;
|
|
55
|
+
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
56
|
+
|
|
57
|
+
case 8:
|
|
58
|
+
featuresArray = _context.sent;
|
|
59
|
+
expect(featuresArray[0].get('refName')).toBe('21');
|
|
60
|
+
expect(featuresArray[0].id()).toBe("test-21,0,0,19,22,0");
|
|
61
|
+
featuresJsonArray = featuresArray.map(function (f) {
|
|
62
|
+
return f.toJSON();
|
|
63
|
+
});
|
|
64
|
+
expect(featuresJsonArray.length).toEqual(94);
|
|
65
|
+
_iterator = _createForOfIteratorHelper(featuresJsonArray);
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
69
|
+
feature = _step.value;
|
|
70
|
+
expect(feature).toMatchSnapshot({
|
|
71
|
+
uniqueId: expect.any(String)
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
} catch (err) {
|
|
75
|
+
_iterator.e(err);
|
|
76
|
+
} finally {
|
|
77
|
+
_iterator.f();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_context.t0 = expect;
|
|
81
|
+
_context.next = 18;
|
|
82
|
+
return adapter.hasDataForRefName('ctgA');
|
|
83
|
+
|
|
84
|
+
case 18:
|
|
85
|
+
_context.t1 = _context.sent;
|
|
86
|
+
(0, _context.t0)(_context.t1).toBe(false);
|
|
87
|
+
_context.t2 = expect;
|
|
88
|
+
_context.next = 23;
|
|
89
|
+
return adapter.hasDataForRefName('21');
|
|
90
|
+
|
|
91
|
+
case 23:
|
|
92
|
+
_context.t3 = _context.sent;
|
|
93
|
+
(0, _context.t2)(_context.t3).toBe(true);
|
|
94
|
+
_context.t4 = expect;
|
|
95
|
+
_context.next = 28;
|
|
96
|
+
return adapter.hasDataForRefName('20');
|
|
97
|
+
|
|
98
|
+
case 28:
|
|
99
|
+
_context.t5 = _context.sent;
|
|
100
|
+
(0, _context.t4)(_context.t5).toBe(false);
|
|
101
|
+
|
|
102
|
+
case 30:
|
|
103
|
+
case "end":
|
|
104
|
+
return _context.stop();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, _callee);
|
|
108
|
+
})));
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { Feature, SimpleFeatureSerialized } from '@jbrowse/core/util/simpleFeature';
|
|
2
|
-
/**
|
|
3
|
-
* wrapper to adapt nclist features to act like jbrowse 2 features
|
|
4
|
-
*/
|
|
5
|
-
export default class NCListFeature implements Feature {
|
|
6
|
-
private ncFeature;
|
|
7
|
-
private parentHandle?;
|
|
8
|
-
private uniqueId;
|
|
9
|
-
constructor(ncFeature: any, parent?: Feature, id?: string);
|
|
10
|
-
set(): void;
|
|
11
|
-
jb2TagToJb1Tag(tag: string): string;
|
|
12
|
-
jb1TagToJb2Tag(tag: string): string;
|
|
13
|
-
get(attrName: string): any;
|
|
14
|
-
/**
|
|
15
|
-
* Get an array listing which data keys are present in this feature.
|
|
16
|
-
*/
|
|
17
|
-
tags(): string[];
|
|
18
|
-
/**
|
|
19
|
-
* Get the unique ID of this feature.
|
|
20
|
-
*/
|
|
21
|
-
id(): string;
|
|
22
|
-
/**
|
|
23
|
-
* Get this feature's parent feature, or undefined if none.
|
|
24
|
-
*/
|
|
25
|
-
parent(): Feature | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Get an array of child features, or undefined if none.
|
|
28
|
-
*/
|
|
29
|
-
children(): Feature[] | undefined;
|
|
30
|
-
toJSON(): SimpleFeatureSerialized;
|
|
31
|
-
}
|
|
1
|
+
import { Feature, SimpleFeatureSerialized } from '@jbrowse/core/util/simpleFeature';
|
|
2
|
+
/**
|
|
3
|
+
* wrapper to adapt nclist features to act like jbrowse 2 features
|
|
4
|
+
*/
|
|
5
|
+
export default class NCListFeature implements Feature {
|
|
6
|
+
private ncFeature;
|
|
7
|
+
private parentHandle?;
|
|
8
|
+
private uniqueId;
|
|
9
|
+
constructor(ncFeature: any, parent?: Feature, id?: string);
|
|
10
|
+
set(): void;
|
|
11
|
+
jb2TagToJb1Tag(tag: string): string;
|
|
12
|
+
jb1TagToJb2Tag(tag: string): string;
|
|
13
|
+
get(attrName: string): any;
|
|
14
|
+
/**
|
|
15
|
+
* Get an array listing which data keys are present in this feature.
|
|
16
|
+
*/
|
|
17
|
+
tags(): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Get the unique ID of this feature.
|
|
20
|
+
*/
|
|
21
|
+
id(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get this feature's parent feature, or undefined if none.
|
|
24
|
+
*/
|
|
25
|
+
parent(): Feature | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Get an array of child features, or undefined if none.
|
|
28
|
+
*/
|
|
29
|
+
children(): Feature[] | undefined;
|
|
30
|
+
toJSON(): SimpleFeatureSerialized;
|
|
31
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var jb2ToJb1 = {
|
|
17
|
+
refName: 'seq_id'
|
|
18
|
+
};
|
|
19
|
+
var jb1ToJb2 = {
|
|
20
|
+
seq_id: 'refName'
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* wrapper to adapt nclist features to act like jbrowse 2 features
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var NCListFeature = /*#__PURE__*/function () {
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
function NCListFeature(ncFeature, parent, id) {
|
|
29
|
+
(0, _classCallCheck2["default"])(this, NCListFeature);
|
|
30
|
+
this.ncFeature = ncFeature;
|
|
31
|
+
(0, _defineProperty2["default"])(this, "parentHandle", void 0);
|
|
32
|
+
(0, _defineProperty2["default"])(this, "uniqueId", void 0);
|
|
33
|
+
this.uniqueId = id || ncFeature.id();
|
|
34
|
+
this.parentHandle = parent;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
(0, _createClass2["default"])(NCListFeature, [{
|
|
38
|
+
key: "set",
|
|
39
|
+
value: function set() {
|
|
40
|
+
throw new Error('not implemented');
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
key: "jb2TagToJb1Tag",
|
|
44
|
+
value: function jb2TagToJb1Tag(tag) {
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
var mapped = jb2ToJb1[tag] || tag;
|
|
47
|
+
return mapped.toLowerCase();
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "jb1TagToJb2Tag",
|
|
51
|
+
value: function jb1TagToJb2Tag(tag) {
|
|
52
|
+
var t = tag.toLowerCase(); // @ts-ignore
|
|
53
|
+
|
|
54
|
+
var mapped = jb1ToJb2[t] || t;
|
|
55
|
+
return mapped;
|
|
56
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
+
|
|
58
|
+
}, {
|
|
59
|
+
key: "get",
|
|
60
|
+
value: function get(attrName) {
|
|
61
|
+
var _this = this;
|
|
62
|
+
|
|
63
|
+
var attr = this.ncFeature.get(this.jb2TagToJb1Tag(attrName));
|
|
64
|
+
|
|
65
|
+
if (attr && attrName === 'subfeatures') {
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
|
+
return attr.map(function (subfeature) {
|
|
68
|
+
return new NCListFeature(subfeature, _this);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return attr;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get an array listing which data keys are present in this feature.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
}, {
|
|
79
|
+
key: "tags",
|
|
80
|
+
value: function tags() {
|
|
81
|
+
var _this2 = this;
|
|
82
|
+
|
|
83
|
+
return this.ncFeature.tags().map(function (t) {
|
|
84
|
+
return _this2.jb1TagToJb2Tag(t);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get the unique ID of this feature.
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
}, {
|
|
92
|
+
key: "id",
|
|
93
|
+
value: function id() {
|
|
94
|
+
return this.uniqueId;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get this feature's parent feature, or undefined if none.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
}, {
|
|
101
|
+
key: "parent",
|
|
102
|
+
value: function parent() {
|
|
103
|
+
return this.parentHandle;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get an array of child features, or undefined if none.
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
}, {
|
|
110
|
+
key: "children",
|
|
111
|
+
value: function children() {
|
|
112
|
+
return this.get('subfeatures');
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
key: "toJSON",
|
|
116
|
+
value: function toJSON() {
|
|
117
|
+
var _this3 = this;
|
|
118
|
+
|
|
119
|
+
var data = {
|
|
120
|
+
uniqueId: this.id()
|
|
121
|
+
};
|
|
122
|
+
this.ncFeature.tags().forEach(function (tag) {
|
|
123
|
+
var mappedTag = _this3.jb1TagToJb2Tag(tag);
|
|
124
|
+
|
|
125
|
+
var value = _this3.ncFeature.get(tag);
|
|
126
|
+
|
|
127
|
+
if (mappedTag === 'subfeatures') {
|
|
128
|
+
data.subfeatures = (value || []).map(function (f) {
|
|
129
|
+
// note: was new NCListFeature(f, `${this.id()}-${i}`, this).toJSON()
|
|
130
|
+
return new NCListFeature(f, _this3).toJSON();
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
data[mappedTag] = value;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
return data;
|
|
137
|
+
}
|
|
138
|
+
}]);
|
|
139
|
+
return NCListFeature;
|
|
140
|
+
}();
|
|
141
|
+
|
|
142
|
+
exports["default"] = NCListFeature;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
|
|
2
|
-
export default _default;
|
|
1
|
+
declare const _default: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _configuration = require("@jbrowse/core/configuration");
|
|
9
|
+
|
|
10
|
+
var _default = (0, _configuration.ConfigurationSchema)('NCListAdapter', {
|
|
11
|
+
rootUrlTemplate: {
|
|
12
|
+
type: 'fileLocation',
|
|
13
|
+
defaultValue: {
|
|
14
|
+
uri: '/path/to/my/{refseq}/trackData.json',
|
|
15
|
+
locationType: 'UriLocation'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
refNames: {
|
|
19
|
+
type: 'stringArray',
|
|
20
|
+
defaultValue: [],
|
|
21
|
+
description: 'List of refNames used by the NCList used for aliasing'
|
|
22
|
+
}
|
|
23
|
+
}, {
|
|
24
|
+
explicitlyTyped: true
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as configSchema } from './configSchema';
|
|
1
|
+
export { default as configSchema } from './configSchema';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "configSchema", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _configSchema["default"];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
var _configSchema = _interopRequireDefault(require("./configSchema"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
3
|
-
export default class LegacyJBrowsePlugin extends Plugin {
|
|
4
|
-
name: string;
|
|
5
|
-
install(pluginManager: PluginManager): void;
|
|
6
|
-
}
|
|
1
|
+
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
3
|
+
export default class LegacyJBrowsePlugin extends Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
install(pluginManager: PluginManager): void;
|
|
6
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,124 @@
|
|
|
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
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
|
|
16
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
+
|
|
18
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
+
|
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
24
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
+
|
|
26
|
+
var _AdapterType = _interopRequireDefault(require("@jbrowse/core/pluggableElementTypes/AdapterType"));
|
|
27
|
+
|
|
28
|
+
var _TextSearchAdapterType = _interopRequireDefault(require("@jbrowse/core/pluggableElementTypes/TextSearchAdapterType"));
|
|
29
|
+
|
|
30
|
+
var _ConnectionType = _interopRequireDefault(require("@jbrowse/core/pluggableElementTypes/ConnectionType"));
|
|
31
|
+
|
|
32
|
+
var _Plugin2 = _interopRequireDefault(require("@jbrowse/core/Plugin"));
|
|
33
|
+
|
|
34
|
+
var _NCListAdapter = require("./NCListAdapter");
|
|
35
|
+
|
|
36
|
+
var _JBrowse1TextSeachAdapter = require("./JBrowse1TextSeachAdapter");
|
|
37
|
+
|
|
38
|
+
var _tracks = require("@jbrowse/core/util/tracks");
|
|
39
|
+
|
|
40
|
+
var _JBrowse1Connection = require("./JBrowse1Connection");
|
|
41
|
+
|
|
42
|
+
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); }
|
|
43
|
+
|
|
44
|
+
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; }
|
|
45
|
+
|
|
46
|
+
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); }; }
|
|
47
|
+
|
|
48
|
+
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; } }
|
|
49
|
+
|
|
50
|
+
var LegacyJBrowsePlugin = /*#__PURE__*/function (_Plugin) {
|
|
51
|
+
(0, _inherits2["default"])(LegacyJBrowsePlugin, _Plugin);
|
|
52
|
+
|
|
53
|
+
var _super = _createSuper(LegacyJBrowsePlugin);
|
|
54
|
+
|
|
55
|
+
function LegacyJBrowsePlugin() {
|
|
56
|
+
var _this;
|
|
57
|
+
|
|
58
|
+
(0, _classCallCheck2["default"])(this, LegacyJBrowsePlugin);
|
|
59
|
+
|
|
60
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
61
|
+
args[_key] = arguments[_key];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
65
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "name", 'LegacyJBrowsePlugin');
|
|
66
|
+
return _this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
(0, _createClass2["default"])(LegacyJBrowsePlugin, [{
|
|
70
|
+
key: "install",
|
|
71
|
+
value: function install(pluginManager) {
|
|
72
|
+
pluginManager.addAdapterType(function () {
|
|
73
|
+
return new _AdapterType["default"]({
|
|
74
|
+
name: 'NCListAdapter',
|
|
75
|
+
configSchema: _NCListAdapter.configSchema,
|
|
76
|
+
getAdapterClass: function getAdapterClass() {
|
|
77
|
+
return Promise.resolve().then(function () {
|
|
78
|
+
return _interopRequireWildcard(require('./NCListAdapter/NCListAdapter'));
|
|
79
|
+
}).then(function (r) {
|
|
80
|
+
return r["default"];
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
86
|
+
return function (file, index, adapterHint) {
|
|
87
|
+
var regexGuess = /trackData.jsonz?$/i;
|
|
88
|
+
var adapterName = 'NCListAdapter';
|
|
89
|
+
var fileName = (0, _tracks.getFileName)(file);
|
|
90
|
+
|
|
91
|
+
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
92
|
+
return {
|
|
93
|
+
type: adapterName,
|
|
94
|
+
rootUrlTemplate: file
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return adapterGuesser(file, index, adapterHint);
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
pluginManager.addTextSearchAdapterType(function () {
|
|
102
|
+
return new _TextSearchAdapterType["default"]({
|
|
103
|
+
name: 'JBrowse1TextSearchAdapter',
|
|
104
|
+
configSchema: _JBrowse1TextSeachAdapter.configSchema,
|
|
105
|
+
AdapterClass: _JBrowse1TextSeachAdapter.AdapterClass,
|
|
106
|
+
description: 'A JBrowse 1 text search adapter'
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
pluginManager.addConnectionType(function () {
|
|
110
|
+
return new _ConnectionType["default"]({
|
|
111
|
+
name: 'JBrowse1Connection',
|
|
112
|
+
configSchema: _JBrowse1Connection.configSchema,
|
|
113
|
+
stateModel: (0, _JBrowse1Connection.modelFactory)(pluginManager),
|
|
114
|
+
displayName: 'JBrowse 1 Data',
|
|
115
|
+
description: 'A JBrowse 1 data directory',
|
|
116
|
+
url: '//jbrowse.org/'
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}]);
|
|
121
|
+
return LegacyJBrowsePlugin;
|
|
122
|
+
}(_Plugin2["default"]);
|
|
123
|
+
|
|
124
|
+
exports["default"] = LegacyJBrowsePlugin;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _PluginManager = _interopRequireDefault(require("@jbrowse/core/PluginManager"));
|
|
6
|
+
|
|
7
|
+
var _mobxStateTree = require("mobx-state-tree");
|
|
8
|
+
|
|
9
|
+
var _ = _interopRequireDefault(require("."));
|
|
10
|
+
|
|
11
|
+
test('plugin in a stock JBrowse', function () {
|
|
12
|
+
var originalConsoleWarn = console.warn;
|
|
13
|
+
console.warn = jest.fn();
|
|
14
|
+
var pluginManager = new _PluginManager["default"]([new _["default"]()]);
|
|
15
|
+
pluginManager.createPluggableElements();
|
|
16
|
+
pluginManager.configure();
|
|
17
|
+
console.warn = originalConsoleWarn;
|
|
18
|
+
expect(function () {
|
|
19
|
+
return pluginManager.addPlugin(new _["default"]());
|
|
20
|
+
}).toThrow(/JBrowse already configured, cannot add plugins/);
|
|
21
|
+
var NCListAdapter = pluginManager.getAdapterType('NCListAdapter');
|
|
22
|
+
var config = NCListAdapter.configSchema.create({
|
|
23
|
+
type: 'NCListAdapter'
|
|
24
|
+
});
|
|
25
|
+
expect((0, _mobxStateTree.getSnapshot)(config)).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
test('test creating a text search adapter', function () {
|
|
28
|
+
console.warn = jest.fn();
|
|
29
|
+
var pluginManager = new _PluginManager["default"]([new _["default"]()]);
|
|
30
|
+
pluginManager.createPluggableElements();
|
|
31
|
+
pluginManager.configure();
|
|
32
|
+
var JB1TextSearchAdapter = pluginManager.getTextSearchAdapterType('JBrowse1TextSearchAdapter');
|
|
33
|
+
var config = JB1TextSearchAdapter.configSchema.create({
|
|
34
|
+
type: 'JBrowse1TextSearchAdapter',
|
|
35
|
+
textSearchAdapterId: 'JBrowse1GenerateNamesAdapterTest',
|
|
36
|
+
namesIndexLocation: {
|
|
37
|
+
uri: 'names/',
|
|
38
|
+
locationType: 'UriLocation'
|
|
39
|
+
},
|
|
40
|
+
tracks: [],
|
|
41
|
+
assemblies: []
|
|
42
|
+
});
|
|
43
|
+
expect((0, _mobxStateTree.getSnapshot)(config)).toMatchSnapshot();
|
|
44
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-legacy-jbrowse",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "JBrowse 2 plugin for connecting to and reading JBrowse 1 data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -18,21 +18,19 @@
|
|
|
18
18
|
"distMain": "dist/index.js",
|
|
19
19
|
"srcMain": "src/index.ts",
|
|
20
20
|
"main": "dist/index.js",
|
|
21
|
-
"distModule": "dist/plugin-legacy-jbrowse.esm.js",
|
|
22
|
-
"module": "dist/plugin-legacy-jbrowse.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/legacy-jbrowse",
|
|
31
28
|
"prepublishOnly": "yarn test",
|
|
32
29
|
"prepack": "yarn build; yarn useDist",
|
|
33
30
|
"postpack": "yarn useSrc",
|
|
34
31
|
"useDist": "node ../../scripts/useDist.js",
|
|
35
|
-
"useSrc": "node ../../scripts/useSrc.js"
|
|
32
|
+
"useSrc": "node ../../scripts/useSrc.js",
|
|
33
|
+
"postbuild": "tsc --build tsconfig.build.json"
|
|
36
34
|
},
|
|
37
35
|
"dependencies": {
|
|
38
36
|
"@gmod/nclist": "^0.2.1",
|
|
@@ -49,5 +47,5 @@
|
|
|
49
47
|
"publishConfig": {
|
|
50
48
|
"access": "public"
|
|
51
49
|
},
|
|
52
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "09b13c85acf4ac68dd71ab23af87656c7552fdaf"
|
|
53
51
|
}
|
|
@@ -268,7 +268,7 @@ function regularizeIncludes(
|
|
|
268
268
|
})
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
271
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unnecessary-type-constraint
|
|
272
272
|
function fillTemplates<T extends any>(subconfig: T, config: Config): T {
|
|
273
273
|
if (!subconfig) {
|
|
274
274
|
return subconfig
|
package/dist/index.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|