@jbrowse/plugin-sequence 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/BgzipFastaAdapter/BgzipFastaAdapter.d.ts +7 -7
- package/dist/BgzipFastaAdapter/BgzipFastaAdapter.js +70 -0
- package/dist/BgzipFastaAdapter/BgzipFastaAdapter.test.js +64 -0
- package/dist/BgzipFastaAdapter/configSchema.d.ts +2 -2
- package/dist/BgzipFastaAdapter/configSchema.js +36 -0
- package/dist/BgzipFastaAdapter/index.d.ts +1 -1
- package/dist/BgzipFastaAdapter/index.js +15 -0
- package/dist/ChromSizesAdapter/ChromSizesAdapter.d.ts +19 -19
- package/dist/ChromSizesAdapter/ChromSizesAdapter.js +170 -0
- package/dist/ChromSizesAdapter/ChromSizesAdapter.test.js +46 -0
- package/dist/ChromSizesAdapter/configSchema.d.ts +2 -2
- package/dist/ChromSizesAdapter/configSchema.js +22 -0
- package/dist/ChromSizesAdapter/index.d.ts +1 -1
- package/dist/ChromSizesAdapter/index.js +15 -0
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.d.ts +21 -21
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.js +239 -0
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.test.js +245 -0
- package/dist/DivSequenceRenderer/configSchema.d.ts +2 -2
- package/dist/DivSequenceRenderer/configSchema.js +20 -0
- package/dist/DivSequenceRenderer/index.d.ts +2 -2
- package/dist/DivSequenceRenderer/index.js +23 -0
- package/dist/GCContentAdapter/GCContentAdapter.d.ts +23 -23
- package/dist/GCContentAdapter/GCContentAdapter.js +261 -0
- package/dist/GCContentAdapter/configSchema.d.ts +3 -3
- package/dist/GCContentAdapter/configSchema.js +18 -0
- package/dist/GCContentAdapter/index.d.ts +6 -6
- package/dist/GCContentAdapter/index.js +31 -0
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.d.ts +25 -25
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.js +228 -0
- package/dist/IndexedFastaAdapter/IndexedFastaAdapter.test.js +71 -0
- package/dist/IndexedFastaAdapter/configSchema.d.ts +2 -2
- package/dist/IndexedFastaAdapter/configSchema.js +29 -0
- package/dist/IndexedFastaAdapter/index.d.ts +1 -1
- package/dist/IndexedFastaAdapter/index.js +15 -0
- package/dist/LinearReferenceSequenceDisplay/configSchema.d.ts +1 -1
- package/dist/LinearReferenceSequenceDisplay/configSchema.js +18 -0
- package/dist/LinearReferenceSequenceDisplay/index.d.ts +2 -2
- package/dist/LinearReferenceSequenceDisplay/index.js +21 -0
- package/dist/LinearReferenceSequenceDisplay/model.d.ts +208 -208
- package/dist/LinearReferenceSequenceDisplay/model.js +102 -0
- package/dist/TwoBitAdapter/TwoBitAdapter.d.ts +26 -26
- package/dist/TwoBitAdapter/TwoBitAdapter.js +289 -0
- package/dist/TwoBitAdapter/TwoBitAdapter.test.js +94 -0
- package/dist/TwoBitAdapter/configSchema.d.ts +2 -2
- package/dist/TwoBitAdapter/configSchema.js +30 -0
- package/dist/TwoBitAdapter/index.d.ts +1 -1
- package/dist/TwoBitAdapter/index.js +15 -0
- package/dist/declare.d.js +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +325 -6
- package/dist/index.test.js +29 -0
- package/dist/referenceSeqTrackConfig.d.ts +2 -2
- package/dist/referenceSeqTrackConfig.js +88 -0
- package/package.json +5 -7
- package/src/index.ts +7 -8
- package/dist/DivSequenceRenderer/components/DivSequenceRendering.test.d.ts +0 -1
- package/dist/index.test.d.ts +0 -1
- package/dist/plugin-sequence.cjs.development.js +0 -2567
- package/dist/plugin-sequence.cjs.development.js.map +0 -1
- package/dist/plugin-sequence.cjs.production.min.js +0 -2
- package/dist/plugin-sequence.cjs.production.min.js.map +0 -1
- package/dist/plugin-sequence.esm.js +0 -2561
- package/dist/plugin-sequence.esm.js.map +0 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.modelFactory = modelFactory;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _mobxStateTree = require("mobx-state-tree");
|
|
13
|
+
|
|
14
|
+
var _pluginLinearGenomeView = require("@jbrowse/plugin-linear-genome-view");
|
|
15
|
+
|
|
16
|
+
var _configuration = require("@jbrowse/core/configuration");
|
|
17
|
+
|
|
18
|
+
var _util = require("@jbrowse/core/util");
|
|
19
|
+
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
+
|
|
24
|
+
function modelFactory(configSchema) {
|
|
25
|
+
return _mobxStateTree.types.compose('LinearReferenceSequenceDisplay', _pluginLinearGenomeView.BaseLinearDisplay, _mobxStateTree.types.model({
|
|
26
|
+
type: _mobxStateTree.types.literal('LinearReferenceSequenceDisplay'),
|
|
27
|
+
configuration: (0, _configuration.ConfigurationReference)(configSchema),
|
|
28
|
+
showForward: _mobxStateTree.types.optional(_mobxStateTree.types["boolean"], true),
|
|
29
|
+
showReverse: _mobxStateTree.types.optional(_mobxStateTree.types["boolean"], true),
|
|
30
|
+
showTranslation: _mobxStateTree.types.optional(_mobxStateTree.types["boolean"], true),
|
|
31
|
+
height: 180
|
|
32
|
+
})).views(function (self) {
|
|
33
|
+
var superRenderProps = self.renderProps;
|
|
34
|
+
return {
|
|
35
|
+
renderProps: function renderProps() {
|
|
36
|
+
var showForward = self.showForward,
|
|
37
|
+
showReverse = self.showReverse,
|
|
38
|
+
showTranslation = self.showTranslation;
|
|
39
|
+
return _objectSpread(_objectSpread({}, superRenderProps()), {}, {
|
|
40
|
+
rpcDriverName: self.rpcDriverName,
|
|
41
|
+
config: self.configuration.renderer,
|
|
42
|
+
showForward: showForward,
|
|
43
|
+
showReverse: showReverse,
|
|
44
|
+
showTranslation: showTranslation
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
regionCannotBeRendered: function regionCannotBeRendered() {
|
|
48
|
+
var view = (0, _util.getContainingView)(self);
|
|
49
|
+
|
|
50
|
+
if (view && view.bpPerPx >= 1) {
|
|
51
|
+
return 'Zoom in to see sequence';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return undefined;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
get rendererTypeName() {
|
|
58
|
+
return self.configuration.renderer.type;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
};
|
|
62
|
+
}).actions(function (self) {
|
|
63
|
+
return {
|
|
64
|
+
toggleShowForward: function toggleShowForward() {
|
|
65
|
+
self.showForward = !self.showForward;
|
|
66
|
+
},
|
|
67
|
+
toggleShowReverse: function toggleShowReverse() {
|
|
68
|
+
self.showReverse = !self.showReverse;
|
|
69
|
+
},
|
|
70
|
+
toggleShowTranslation: function toggleShowTranslation() {
|
|
71
|
+
self.showTranslation = !self.showTranslation;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}).views(function (self) {
|
|
75
|
+
return {
|
|
76
|
+
trackMenuItems: function trackMenuItems() {
|
|
77
|
+
return [{
|
|
78
|
+
label: 'Show forward',
|
|
79
|
+
type: 'checkbox',
|
|
80
|
+
checked: self.showForward,
|
|
81
|
+
onClick: function onClick() {
|
|
82
|
+
self.toggleShowForward();
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
label: 'Show reverse',
|
|
86
|
+
type: 'checkbox',
|
|
87
|
+
checked: self.showReverse,
|
|
88
|
+
onClick: function onClick() {
|
|
89
|
+
self.toggleShowReverse();
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
label: 'Show translation',
|
|
93
|
+
type: 'checkbox',
|
|
94
|
+
checked: self.showTranslation,
|
|
95
|
+
onClick: function onClick() {
|
|
96
|
+
self.toggleShowTranslation();
|
|
97
|
+
}
|
|
98
|
+
}];
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { BaseSequenceAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import { NoAssemblyRegion } from '@jbrowse/core/util/types';
|
|
3
|
-
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
4
|
-
import { AnyConfigurationModel } from '@jbrowse/core/configuration/configurationSchema';
|
|
5
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
6
|
-
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
7
|
-
export default class TwoBitAdapter extends BaseSequenceAdapter {
|
|
8
|
-
private twobit;
|
|
9
|
-
protected chromSizesData: Promise<Record<string, number> | undefined>;
|
|
10
|
-
private initChromSizes;
|
|
11
|
-
constructor(config: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
|
|
12
|
-
getRefNames(): Promise<string[]>;
|
|
13
|
-
getRegions(): Promise<NoAssemblyRegion[]>;
|
|
14
|
-
/**
|
|
15
|
-
* Fetch features for a certain region
|
|
16
|
-
* @param param -
|
|
17
|
-
* @returns Observable of Feature objects in the region
|
|
18
|
-
*/
|
|
19
|
-
getFeatures({ refName, start, end }: NoAssemblyRegion): import("rxjs").Observable<Feature>;
|
|
20
|
-
/**
|
|
21
|
-
* called to provide a hint that data tied to a certain region
|
|
22
|
-
* will not be needed for the forseeable future and can be purged
|
|
23
|
-
* from caches, etc
|
|
24
|
-
*/
|
|
25
|
-
freeResources(): void;
|
|
26
|
-
}
|
|
1
|
+
import { BaseSequenceAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
+
import { NoAssemblyRegion } from '@jbrowse/core/util/types';
|
|
3
|
+
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
4
|
+
import { AnyConfigurationModel } from '@jbrowse/core/configuration/configurationSchema';
|
|
5
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
6
|
+
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
7
|
+
export default class TwoBitAdapter extends BaseSequenceAdapter {
|
|
8
|
+
private twobit;
|
|
9
|
+
protected chromSizesData: Promise<Record<string, number> | undefined>;
|
|
10
|
+
private initChromSizes;
|
|
11
|
+
constructor(config: AnyConfigurationModel, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
|
|
12
|
+
getRefNames(): Promise<string[]>;
|
|
13
|
+
getRegions(): Promise<NoAssemblyRegion[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Fetch features for a certain region
|
|
16
|
+
* @param param -
|
|
17
|
+
* @returns Observable of Feature objects in the region
|
|
18
|
+
*/
|
|
19
|
+
getFeatures({ refName, start, end }: NoAssemblyRegion): import("rxjs").Observable<Feature>;
|
|
20
|
+
/**
|
|
21
|
+
* called to provide a hint that data tied to a certain region
|
|
22
|
+
* will not be needed for the forseeable future and can be purged
|
|
23
|
+
* from caches, etc
|
|
24
|
+
*/
|
|
25
|
+
freeResources(): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,289 @@
|
|
|
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 _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
+
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
20
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
21
|
+
|
|
22
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
+
|
|
24
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
+
|
|
26
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
+
|
|
28
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
+
|
|
30
|
+
var _BaseAdapter = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
31
|
+
|
|
32
|
+
var _io = require("@jbrowse/core/util/io");
|
|
33
|
+
|
|
34
|
+
var _rxjs = require("@jbrowse/core/util/rxjs");
|
|
35
|
+
|
|
36
|
+
var _simpleFeature = _interopRequireDefault(require("@jbrowse/core/util/simpleFeature"));
|
|
37
|
+
|
|
38
|
+
var _twobit = require("@gmod/twobit");
|
|
39
|
+
|
|
40
|
+
var _configuration = require("@jbrowse/core/configuration");
|
|
41
|
+
|
|
42
|
+
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); }; }
|
|
43
|
+
|
|
44
|
+
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; } }
|
|
45
|
+
|
|
46
|
+
var TwoBitAdapter = /*#__PURE__*/function (_BaseSequenceAdapter) {
|
|
47
|
+
(0, _inherits2["default"])(TwoBitAdapter, _BaseSequenceAdapter);
|
|
48
|
+
|
|
49
|
+
var _super = _createSuper(TwoBitAdapter);
|
|
50
|
+
|
|
51
|
+
function TwoBitAdapter(config, getSubAdapter, pluginManager) {
|
|
52
|
+
var _this;
|
|
53
|
+
|
|
54
|
+
(0, _classCallCheck2["default"])(this, TwoBitAdapter);
|
|
55
|
+
_this = _super.call(this, config, getSubAdapter, pluginManager);
|
|
56
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "twobit", void 0);
|
|
57
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "chromSizesData", void 0);
|
|
58
|
+
_this.chromSizesData = _this.initChromSizes();
|
|
59
|
+
_this.twobit = new _twobit.TwoBitFile({
|
|
60
|
+
filehandle: (0, _io.openLocation)((0, _configuration.readConfObject)(config, 'twoBitLocation'), _this.pluginManager)
|
|
61
|
+
});
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
(0, _createClass2["default"])(TwoBitAdapter, [{
|
|
66
|
+
key: "initChromSizes",
|
|
67
|
+
value: // the chromSizesData can be used to speed up loading since TwoBit has to do
|
|
68
|
+
// many range requests at startup to perform the getRegions request
|
|
69
|
+
function () {
|
|
70
|
+
var _initChromSizes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
71
|
+
var conf, file, data;
|
|
72
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
73
|
+
while (1) {
|
|
74
|
+
switch (_context.prev = _context.next) {
|
|
75
|
+
case 0:
|
|
76
|
+
conf = (0, _configuration.readConfObject)(this.config, 'chromSizesLocation'); // check against default and empty in case someone makes the field blank in
|
|
77
|
+
// config editor, may want better way to check "optional config slots" in
|
|
78
|
+
// future
|
|
79
|
+
|
|
80
|
+
if (!(conf.uri !== '/path/to/default.chrom.sizes' && conf.uri !== '')) {
|
|
81
|
+
_context.next = 7;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
file = (0, _io.openLocation)(conf, this.pluginManager);
|
|
86
|
+
_context.next = 5;
|
|
87
|
+
return file.readFile('utf8');
|
|
88
|
+
|
|
89
|
+
case 5:
|
|
90
|
+
data = _context.sent;
|
|
91
|
+
return _context.abrupt("return", Object.fromEntries(data === null || data === void 0 ? void 0 : data.split('\n').filter(function (line) {
|
|
92
|
+
return !!line.trim();
|
|
93
|
+
}).map(function (line) {
|
|
94
|
+
var _line$split = line.split('\t'),
|
|
95
|
+
_line$split2 = (0, _slicedToArray2["default"])(_line$split, 2),
|
|
96
|
+
name = _line$split2[0],
|
|
97
|
+
length = _line$split2[1];
|
|
98
|
+
|
|
99
|
+
return [name, +length];
|
|
100
|
+
})));
|
|
101
|
+
|
|
102
|
+
case 7:
|
|
103
|
+
return _context.abrupt("return", undefined);
|
|
104
|
+
|
|
105
|
+
case 8:
|
|
106
|
+
case "end":
|
|
107
|
+
return _context.stop();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}, _callee, this);
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
function initChromSizes() {
|
|
114
|
+
return _initChromSizes.apply(this, arguments);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return initChromSizes;
|
|
118
|
+
}()
|
|
119
|
+
}, {
|
|
120
|
+
key: "getRefNames",
|
|
121
|
+
value: function () {
|
|
122
|
+
var _getRefNames = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
123
|
+
var chromSizesData;
|
|
124
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
125
|
+
while (1) {
|
|
126
|
+
switch (_context2.prev = _context2.next) {
|
|
127
|
+
case 0:
|
|
128
|
+
_context2.next = 2;
|
|
129
|
+
return this.chromSizesData;
|
|
130
|
+
|
|
131
|
+
case 2:
|
|
132
|
+
chromSizesData = _context2.sent;
|
|
133
|
+
|
|
134
|
+
if (!chromSizesData) {
|
|
135
|
+
_context2.next = 5;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return _context2.abrupt("return", Object.keys(chromSizesData));
|
|
140
|
+
|
|
141
|
+
case 5:
|
|
142
|
+
return _context2.abrupt("return", this.twobit.getSequenceNames());
|
|
143
|
+
|
|
144
|
+
case 6:
|
|
145
|
+
case "end":
|
|
146
|
+
return _context2.stop();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}, _callee2, this);
|
|
150
|
+
}));
|
|
151
|
+
|
|
152
|
+
function getRefNames() {
|
|
153
|
+
return _getRefNames.apply(this, arguments);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return getRefNames;
|
|
157
|
+
}()
|
|
158
|
+
}, {
|
|
159
|
+
key: "getRegions",
|
|
160
|
+
value: function () {
|
|
161
|
+
var _getRegions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
162
|
+
var chromSizesData, refSizes;
|
|
163
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
164
|
+
while (1) {
|
|
165
|
+
switch (_context3.prev = _context3.next) {
|
|
166
|
+
case 0:
|
|
167
|
+
_context3.next = 2;
|
|
168
|
+
return this.chromSizesData;
|
|
169
|
+
|
|
170
|
+
case 2:
|
|
171
|
+
chromSizesData = _context3.sent;
|
|
172
|
+
|
|
173
|
+
if (!chromSizesData) {
|
|
174
|
+
_context3.next = 5;
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return _context3.abrupt("return", Object.keys(chromSizesData).map(function (refName) {
|
|
179
|
+
return {
|
|
180
|
+
refName: refName,
|
|
181
|
+
start: 0,
|
|
182
|
+
end: chromSizesData[refName]
|
|
183
|
+
};
|
|
184
|
+
}));
|
|
185
|
+
|
|
186
|
+
case 5:
|
|
187
|
+
_context3.next = 7;
|
|
188
|
+
return this.twobit.getSequenceSizes();
|
|
189
|
+
|
|
190
|
+
case 7:
|
|
191
|
+
refSizes = _context3.sent;
|
|
192
|
+
return _context3.abrupt("return", Object.keys(refSizes).map(function (refName) {
|
|
193
|
+
return {
|
|
194
|
+
refName: refName,
|
|
195
|
+
start: 0,
|
|
196
|
+
end: refSizes[refName]
|
|
197
|
+
};
|
|
198
|
+
}));
|
|
199
|
+
|
|
200
|
+
case 9:
|
|
201
|
+
case "end":
|
|
202
|
+
return _context3.stop();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}, _callee3, this);
|
|
206
|
+
}));
|
|
207
|
+
|
|
208
|
+
function getRegions() {
|
|
209
|
+
return _getRegions.apply(this, arguments);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return getRegions;
|
|
213
|
+
}()
|
|
214
|
+
/**
|
|
215
|
+
* Fetch features for a certain region
|
|
216
|
+
* @param param -
|
|
217
|
+
* @returns Observable of Feature objects in the region
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
}, {
|
|
221
|
+
key: "getFeatures",
|
|
222
|
+
value: function getFeatures(_ref) {
|
|
223
|
+
var _this2 = this;
|
|
224
|
+
|
|
225
|
+
var refName = _ref.refName,
|
|
226
|
+
start = _ref.start,
|
|
227
|
+
end = _ref.end;
|
|
228
|
+
return (0, _rxjs.ObservableCreate)( /*#__PURE__*/function () {
|
|
229
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(observer) {
|
|
230
|
+
var size, regionEnd, seq;
|
|
231
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
232
|
+
while (1) {
|
|
233
|
+
switch (_context4.prev = _context4.next) {
|
|
234
|
+
case 0:
|
|
235
|
+
_context4.next = 2;
|
|
236
|
+
return _this2.twobit.getSequenceSize(refName);
|
|
237
|
+
|
|
238
|
+
case 2:
|
|
239
|
+
size = _context4.sent;
|
|
240
|
+
regionEnd = size !== undefined ? Math.min(size, end) : end;
|
|
241
|
+
_context4.next = 6;
|
|
242
|
+
return _this2.twobit.getSequence(refName, start, regionEnd);
|
|
243
|
+
|
|
244
|
+
case 6:
|
|
245
|
+
seq = _context4.sent;
|
|
246
|
+
|
|
247
|
+
if (seq) {
|
|
248
|
+
observer.next(new _simpleFeature["default"]({
|
|
249
|
+
id: "".concat(refName, " ").concat(start, "-").concat(regionEnd),
|
|
250
|
+
data: {
|
|
251
|
+
refName: refName,
|
|
252
|
+
start: start,
|
|
253
|
+
end: regionEnd,
|
|
254
|
+
seq: seq
|
|
255
|
+
}
|
|
256
|
+
}));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
observer.complete();
|
|
260
|
+
|
|
261
|
+
case 9:
|
|
262
|
+
case "end":
|
|
263
|
+
return _context4.stop();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}, _callee4);
|
|
267
|
+
}));
|
|
268
|
+
|
|
269
|
+
return function (_x) {
|
|
270
|
+
return _ref2.apply(this, arguments);
|
|
271
|
+
};
|
|
272
|
+
}());
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* called to provide a hint that data tied to a certain region
|
|
276
|
+
* will not be needed for the forseeable future and can be purged
|
|
277
|
+
* from caches, etc
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
}, {
|
|
281
|
+
key: "freeResources",
|
|
282
|
+
value: function
|
|
283
|
+
/* { region } */
|
|
284
|
+
freeResources() {}
|
|
285
|
+
}]);
|
|
286
|
+
return TwoBitAdapter;
|
|
287
|
+
}(_BaseAdapter.BaseSequenceAdapter);
|
|
288
|
+
|
|
289
|
+
exports["default"] = TwoBitAdapter;
|
|
@@ -0,0 +1,94 @@
|
|
|
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 _operators = require("rxjs/operators");
|
|
10
|
+
|
|
11
|
+
var _TwoBitAdapter = _interopRequireDefault(require("./TwoBitAdapter"));
|
|
12
|
+
|
|
13
|
+
var _configSchema = _interopRequireDefault(require("./configSchema"));
|
|
14
|
+
|
|
15
|
+
test('adapter can fetch features from volvox.2bit', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
16
|
+
var adapter, features, featuresArray, features2, featuresArray2, features3, featuresArray3;
|
|
17
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
18
|
+
while (1) {
|
|
19
|
+
switch (_context.prev = _context.next) {
|
|
20
|
+
case 0:
|
|
21
|
+
adapter = new _TwoBitAdapter["default"](_configSchema["default"].create({
|
|
22
|
+
twoBitLocation: {
|
|
23
|
+
localPath: require.resolve('../../test_data/volvox.2bit'),
|
|
24
|
+
locationType: 'LocalPathLocation'
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
features = adapter.getFeatures({
|
|
28
|
+
refName: 'ctgA',
|
|
29
|
+
start: 0,
|
|
30
|
+
end: 20000
|
|
31
|
+
});
|
|
32
|
+
_context.next = 4;
|
|
33
|
+
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
34
|
+
|
|
35
|
+
case 4:
|
|
36
|
+
featuresArray = _context.sent;
|
|
37
|
+
expect(featuresArray).toMatchSnapshot();
|
|
38
|
+
features2 = adapter.getFeatures({
|
|
39
|
+
refName: 'ctgA',
|
|
40
|
+
start: 45000,
|
|
41
|
+
end: 55000
|
|
42
|
+
});
|
|
43
|
+
_context.next = 9;
|
|
44
|
+
return features2.pipe((0, _operators.toArray)()).toPromise();
|
|
45
|
+
|
|
46
|
+
case 9:
|
|
47
|
+
featuresArray2 = _context.sent;
|
|
48
|
+
expect(featuresArray2[0].get('end')).toBe(50001);
|
|
49
|
+
features3 = adapter.getFeatures({
|
|
50
|
+
refName: 'ctgC',
|
|
51
|
+
start: 0,
|
|
52
|
+
end: 20000
|
|
53
|
+
});
|
|
54
|
+
_context.next = 14;
|
|
55
|
+
return features3.pipe((0, _operators.toArray)()).toPromise();
|
|
56
|
+
|
|
57
|
+
case 14:
|
|
58
|
+
featuresArray3 = _context.sent;
|
|
59
|
+
expect(featuresArray3).toMatchSnapshot();
|
|
60
|
+
|
|
61
|
+
case 16:
|
|
62
|
+
case "end":
|
|
63
|
+
return _context.stop();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, _callee);
|
|
67
|
+
})));
|
|
68
|
+
test('adapter can fetch regions from with chrom.sizes', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
69
|
+
var adapter;
|
|
70
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
71
|
+
while (1) {
|
|
72
|
+
switch (_context2.prev = _context2.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
adapter = new _TwoBitAdapter["default"](_configSchema["default"].create({
|
|
75
|
+
chromSizesLocation: {
|
|
76
|
+
localPath: require.resolve('../../test_data/volvox.chrom.sizes'),
|
|
77
|
+
locationType: 'LocalPathLocation'
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
_context2.t0 = expect;
|
|
81
|
+
_context2.next = 4;
|
|
82
|
+
return adapter.getRegions();
|
|
83
|
+
|
|
84
|
+
case 4:
|
|
85
|
+
_context2.t1 = _context2.sent;
|
|
86
|
+
(0, _context2.t0)(_context2.t1).toMatchSnapshot();
|
|
87
|
+
|
|
88
|
+
case 6:
|
|
89
|
+
case "end":
|
|
90
|
+
return _context2.stop();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, _callee2);
|
|
94
|
+
})));
|
|
@@ -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,30 @@
|
|
|
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)('TwoBitAdapter', {
|
|
11
|
+
twoBitLocation: {
|
|
12
|
+
type: 'fileLocation',
|
|
13
|
+
defaultValue: {
|
|
14
|
+
uri: '/path/to/my.2bit',
|
|
15
|
+
locationType: 'UriLocation'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
chromSizesLocation: {
|
|
19
|
+
type: 'fileLocation',
|
|
20
|
+
defaultValue: {
|
|
21
|
+
uri: '/path/to/default.chrom.sizes',
|
|
22
|
+
locationType: 'UriLocation'
|
|
23
|
+
},
|
|
24
|
+
description: 'An optional chrom.sizes file can be supplied to speed up loading since parsing the twobit file can take time'
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
explicitlyTyped: true
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
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 SequencePlugin 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 SequencePlugin extends Plugin {
|
|
4
|
+
name: string;
|
|
5
|
+
install(pluginManager: PluginManager): void;
|
|
6
|
+
}
|