@jbrowse/core 2.0.0 → 2.1.2
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/BaseFeatureWidget/BaseFeatureDetail.d.ts +9 -3
- package/BaseFeatureWidget/BaseFeatureDetail.js +313 -581
- package/BaseFeatureWidget/SequenceFeatureDetails.js +213 -478
- package/BaseFeatureWidget/index.js +88 -126
- package/BaseFeatureWidget/types.d.ts +1 -0
- package/BaseFeatureWidget/types.js +1 -4
- package/BaseFeatureWidget/util.js +40 -75
- package/CorePlugin.js +55 -94
- package/Plugin.js +9 -34
- package/PluginLoader.js +153 -422
- package/PluginManager.d.ts +28 -33
- package/PluginManager.js +377 -666
- package/ReExports/Attributes.js +3 -10
- package/ReExports/BaseCard.js +3 -10
- package/ReExports/DataGrid.js +5 -12
- package/ReExports/FeatureDetails.js +3 -10
- package/ReExports/index.js +6 -12
- package/ReExports/list.d.ts +5 -0
- package/ReExports/list.js +271 -7
- package/ReExports/material-ui-colors.js +15 -16
- package/ReExports/modules.d.ts +11 -20
- package/ReExports/modules.js +453 -798
- package/TextSearch/BaseResults.js +51 -123
- package/TextSearch/TextSearchManager.js +66 -144
- package/assemblyManager/assembly.js +280 -555
- package/assemblyManager/assemblyConfigSchema.js +47 -64
- package/assemblyManager/assemblyManager.js +126 -272
- package/assemblyManager/index.js +9 -22
- package/configuration/configurationSchema.js +167 -203
- package/configuration/configurationSlot.js +248 -326
- package/configuration/index.js +19 -35
- package/configuration/util.js +131 -173
- package/data_adapters/BaseAdapter.d.ts +2 -2
- package/data_adapters/BaseAdapter.js +132 -521
- package/data_adapters/CytobandAdapter.js +40 -126
- package/data_adapters/dataAdapterCache.js +77 -158
- package/package.json +4 -5
- package/pluggableElementTypes/AdapterType.js +24 -79
- package/pluggableElementTypes/AddTrackWorkflowType.d.ts +17 -0
- package/pluggableElementTypes/AddTrackWorkflowType.js +20 -0
- package/pluggableElementTypes/ConnectionType.js +22 -65
- package/pluggableElementTypes/DisplayType.js +35 -82
- package/pluggableElementTypes/InternetAccountType.js +23 -64
- package/pluggableElementTypes/PluggableElementBase.js +8 -20
- package/pluggableElementTypes/RpcMethodType.js +85 -427
- package/pluggableElementTypes/TextSearchAdapterType.js +16 -55
- package/pluggableElementTypes/TrackType.js +26 -70
- package/pluggableElementTypes/ViewType.js +21 -63
- package/pluggableElementTypes/WidgetType.js +21 -64
- package/pluggableElementTypes/index.d.ts +4 -3
- package/pluggableElementTypes/index.js +42 -125
- package/pluggableElementTypes/models/BaseConnectionModelFactory.js +28 -43
- package/pluggableElementTypes/models/BaseDisplayModel.js +58 -95
- package/pluggableElementTypes/models/BaseTrackModel.js +139 -199
- package/pluggableElementTypes/models/BaseViewModel.js +24 -40
- package/pluggableElementTypes/models/InternetAccountModel.js +116 -263
- package/pluggableElementTypes/models/baseConnectionConfig.js +14 -25
- package/pluggableElementTypes/models/baseInternetAccountConfig.js +29 -38
- package/pluggableElementTypes/models/baseTrackConfig.js +106 -133
- package/pluggableElementTypes/models/index.js +21 -70
- package/pluggableElementTypes/renderers/BoxRendererType.js +132 -291
- package/pluggableElementTypes/renderers/CircularChordRendererType.js +8 -38
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +60 -192
- package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +0 -2
- package/pluggableElementTypes/renderers/FeatureRendererType.js +89 -255
- package/pluggableElementTypes/renderers/RendererType.js +31 -105
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +61 -72
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +112 -265
- package/pluggableElementTypes/renderers/index.js +19 -62
- package/pluggableElementTypes/renderers/util/serializableFilterChain.js +27 -65
- package/rpc/BaseRpcDriver.js +169 -405
- package/rpc/MainThreadRpcDriver.js +27 -150
- package/rpc/RpcManager.js +58 -159
- package/rpc/WebWorkerRpcDriver.js +54 -171
- package/rpc/configSchema.js +25 -49
- package/rpc/coreRpcMethods.d.ts +1 -3
- package/rpc/coreRpcMethods.js +221 -959
- package/rpc/remoteAbortSignals.js +46 -70
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AboutDialog.js +106 -162
- package/ui/App.js +157 -242
- package/ui/AssemblySelector.js +59 -120
- package/ui/CascadingMenu.js +101 -196
- package/ui/ColorPicker.d.ts +16 -0
- package/ui/ColorPicker.js +97 -0
- package/ui/Drawer.js +28 -61
- package/ui/DrawerWidget.js +108 -202
- package/ui/DropDownMenu.js +60 -91
- package/ui/EditableTypography.js +87 -149
- package/ui/ErrorMessage.js +41 -56
- package/ui/FactoryResetDialog.js +24 -57
- package/ui/FatalErrorDialog.js +59 -91
- package/ui/FileSelector/FileSelector.js +123 -189
- package/ui/FileSelector/LocalFileChooser.js +44 -75
- package/ui/FileSelector/UrlChooser.js +17 -38
- package/ui/FileSelector/index.js +6 -12
- package/ui/Icons.js +45 -69
- package/ui/Logo.js +57 -110
- package/ui/Menu.js +232 -354
- package/ui/PrerenderedCanvas.js +63 -87
- package/ui/ResizeHandle.js +87 -116
- package/ui/ReturnToImportFormDialog.js +32 -63
- package/ui/SanitizedHTML.js +64 -47
- package/ui/Snackbar.js +74 -101
- package/ui/SnackbarModel.js +37 -51
- package/ui/Tooltip.js +49 -76
- package/ui/ViewContainer.js +113 -196
- package/ui/colors.d.ts +10 -0
- package/ui/colors.js +78 -0
- package/ui/index.js +51 -181
- package/ui/react-colorful.d.ts +17 -0
- package/ui/react-colorful.js +455 -0
- package/ui/theme.d.ts +23 -1
- package/ui/theme.js +199 -247
- package/util/Base1DUtils.d.ts +32 -0
- package/util/Base1DUtils.js +174 -0
- package/util/Base1DViewModel.d.ts +16 -30
- package/util/Base1DViewModel.js +116 -293
- package/util/QuickLRU.js +84 -332
- package/util/TimeTraveller.d.ts +19 -0
- package/util/TimeTraveller.js +86 -0
- package/util/aborting.js +49 -127
- package/util/analytics.js +91 -154
- package/util/blockTypes.js +106 -240
- package/util/calculateDynamicBlocks.js +98 -128
- package/util/calculateStaticBlocks.js +105 -125
- package/util/color/cssColorsLevel4.js +156 -160
- package/util/color/index.js +33 -55
- package/util/compositeMap.js +49 -333
- package/util/formatFastaStrings.js +9 -14
- package/util/idMaker.js +18 -31
- package/util/index.d.ts +18 -32
- package/util/index.js +747 -1226
- package/util/io/RemoteFileWithRangeCache.js +88 -257
- package/util/io/index.js +95 -169
- package/util/jexl.js +60 -115
- package/util/jexlStrings.js +24 -29
- package/util/layouts/BaseLayout.js +1 -4
- package/util/layouts/GranularRectLayout.js +388 -555
- package/util/layouts/MultiLayout.js +41 -109
- package/util/layouts/PrecomputedLayout.js +56 -112
- package/util/layouts/PrecomputedMultiLayout.js +22 -59
- package/util/layouts/SceneGraph.js +127 -197
- package/util/layouts/index.js +29 -66
- package/util/mst-reflection.js +55 -71
- package/util/offscreenCanvasPonyfill.js +66 -134
- package/util/offscreenCanvasUtils.d.ts +2 -7
- package/util/offscreenCanvasUtils.js +49 -146
- package/util/range.js +29 -40
- package/util/rxjs.js +20 -27
- package/util/simpleFeature.js +88 -152
- package/util/stats.js +91 -151
- package/util/tracks.js +130 -173
- package/util/types/index.js +110 -179
- package/util/types/mst.js +91 -146
- package/util/types/util.js +1 -4
- package/util/when.js +54 -101
- package/BaseFeatureWidget/SequenceFeatureDetails.test.js +0 -122
- package/BaseFeatureWidget/index.test.js +0 -69
- package/TextSearch/BaseResults.test.js +0 -42
- package/configuration/configurationSchema.test.js +0 -266
- package/configuration/configurationSlot.test.js +0 -69
- package/configuration/util.test.js +0 -39
- package/data_adapters/BaseAdapter.test.js +0 -200
- package/declare.d.js +0 -1
- package/pluggableElementTypes/RpcMethodType.test.js +0 -118
- package/pluggableElementTypes/renderers/declare.d.js +0 -1
- package/pluggableElementTypes/renderers/util/serializableFilterChain.test.js +0 -20
- package/rpc/BaseRpcDriver.test.js +0 -540
- package/rpc/declaration.d.js +0 -1
- package/ui/FatalErrorDialog.test.js +0 -82
- package/ui/SanitizedHTML.test.js +0 -36
- package/ui/theme.test.js +0 -92
- package/util/Base1DViewModel.test.js +0 -130
- package/util/calculateDynamicBlocks.test.js +0 -74
- package/util/calculateStaticBlocks.test.js +0 -297
- package/util/declare.d.js +0 -1
- package/util/formatFastaStrings.test.js +0 -40
- package/util/index.test.js +0 -213
- package/util/jexlStrings.test.js +0 -48
- package/util/layouts/GranularRectLayout.test.js +0 -99
- package/util/range.test.js +0 -64
- package/util/simpleFeature.test.js +0 -34
- package/util/stats.test.js +0 -172
package/util/index.test.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
6
|
-
|
|
7
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
8
|
-
|
|
9
|
-
var _index = require("./index");
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
13
|
-
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; }
|
|
14
|
-
|
|
15
|
-
describe('parseLocString', function () {
|
|
16
|
-
var cases = [['chr1:1..200', {
|
|
17
|
-
start: 0,
|
|
18
|
-
end: 200,
|
|
19
|
-
refName: 'chr1'
|
|
20
|
-
}], ['chr1:1,000,000..2,000,000', {
|
|
21
|
-
start: 999999,
|
|
22
|
-
end: 2000000,
|
|
23
|
-
refName: 'chr1'
|
|
24
|
-
}], ['chr1:1-200', {
|
|
25
|
-
start: 0,
|
|
26
|
-
end: 200,
|
|
27
|
-
refName: 'chr1'
|
|
28
|
-
}], ['{hg19}chr1:1-200', {
|
|
29
|
-
assemblyName: 'hg19',
|
|
30
|
-
start: 0,
|
|
31
|
-
end: 200,
|
|
32
|
-
refName: 'chr1'
|
|
33
|
-
}], ['{hg19}chr1:1..200', {
|
|
34
|
-
assemblyName: 'hg19',
|
|
35
|
-
start: 0,
|
|
36
|
-
end: 200,
|
|
37
|
-
refName: 'chr1'
|
|
38
|
-
}], ['{hg19}chr1:1', {
|
|
39
|
-
assemblyName: 'hg19',
|
|
40
|
-
start: 0,
|
|
41
|
-
end: 1,
|
|
42
|
-
refName: 'chr1'
|
|
43
|
-
}], ['chr1:1', {
|
|
44
|
-
start: 0,
|
|
45
|
-
end: 1,
|
|
46
|
-
refName: 'chr1'
|
|
47
|
-
}], ['chr1:-1', {
|
|
48
|
-
start: -2,
|
|
49
|
-
end: -1,
|
|
50
|
-
refName: 'chr1'
|
|
51
|
-
}], ['chr1:-100..-1', {
|
|
52
|
-
start: -101,
|
|
53
|
-
end: -1,
|
|
54
|
-
refName: 'chr1'
|
|
55
|
-
}], ['chr1:-100--1', // weird but valid
|
|
56
|
-
{
|
|
57
|
-
start: -101,
|
|
58
|
-
end: -1,
|
|
59
|
-
refName: 'chr1'
|
|
60
|
-
}], ['chr2:1000-', {
|
|
61
|
-
refName: 'chr2',
|
|
62
|
-
start: 999
|
|
63
|
-
}], ['chr2:1,000-', {
|
|
64
|
-
refName: 'chr2',
|
|
65
|
-
start: 999
|
|
66
|
-
}], ['chr1', {
|
|
67
|
-
refName: 'chr1'
|
|
68
|
-
}], ['{hg19}chr1', {
|
|
69
|
-
assemblyName: 'hg19',
|
|
70
|
-
refName: 'chr1'
|
|
71
|
-
}]]; // test unreversed
|
|
72
|
-
|
|
73
|
-
cases.forEach(function (_ref) {
|
|
74
|
-
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
75
|
-
input = _ref2[0],
|
|
76
|
-
output = _ref2[1];
|
|
77
|
-
|
|
78
|
-
test("".concat(input), function () {
|
|
79
|
-
expect((0, _index.parseLocString)(input, function (refName) {
|
|
80
|
-
return ['chr1', 'chr2'].includes(refName);
|
|
81
|
-
})).toEqual(_objectSpread(_objectSpread({}, output), {}, {
|
|
82
|
-
reversed: false
|
|
83
|
-
}));
|
|
84
|
-
});
|
|
85
|
-
}); // test reversed
|
|
86
|
-
|
|
87
|
-
cases.forEach(function (_ref3) {
|
|
88
|
-
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
89
|
-
input = _ref4[0],
|
|
90
|
-
output = _ref4[1];
|
|
91
|
-
|
|
92
|
-
test("".concat(input), function () {
|
|
93
|
-
expect((0, _index.parseLocString)(input + '[rev]', function (refName) {
|
|
94
|
-
return ['chr1', 'chr2'].includes(refName);
|
|
95
|
-
})).toEqual(_objectSpread(_objectSpread({}, output), {}, {
|
|
96
|
-
reversed: true
|
|
97
|
-
}));
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
describe('assembleLocString', function () {
|
|
102
|
-
var cases = [[{
|
|
103
|
-
refName: 'chr1'
|
|
104
|
-
}, 'chr1'], [{
|
|
105
|
-
refName: 'chr1',
|
|
106
|
-
start: 0
|
|
107
|
-
}, 'chr1:1..'], [{
|
|
108
|
-
refName: 'chr1',
|
|
109
|
-
start: 0,
|
|
110
|
-
end: 1
|
|
111
|
-
}, 'chr1:1'], [{
|
|
112
|
-
refName: 'chr1',
|
|
113
|
-
start: 0,
|
|
114
|
-
end: 100
|
|
115
|
-
}, 'chr1:1..100'], [{
|
|
116
|
-
refName: 'chr1',
|
|
117
|
-
start: 0,
|
|
118
|
-
end: 200
|
|
119
|
-
}, 'chr1:1..200'], [{
|
|
120
|
-
refName: 'chr1',
|
|
121
|
-
start: 1000000,
|
|
122
|
-
end: 2000000
|
|
123
|
-
}, 'chr1:1,000,001..2,000,000'], [{
|
|
124
|
-
assemblyName: 'hg19',
|
|
125
|
-
refName: 'chr1',
|
|
126
|
-
start: 0,
|
|
127
|
-
end: 100
|
|
128
|
-
}, '{hg19}chr1:1..100'], [{
|
|
129
|
-
refName: 'chr1',
|
|
130
|
-
start: -2,
|
|
131
|
-
end: -1
|
|
132
|
-
}, 'chr1:-1'], [{
|
|
133
|
-
start: -100,
|
|
134
|
-
end: -1,
|
|
135
|
-
refName: 'chr1'
|
|
136
|
-
}, 'chr1:-99..-1']];
|
|
137
|
-
cases.forEach(function (_ref5) {
|
|
138
|
-
var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
|
|
139
|
-
input = _ref6[0],
|
|
140
|
-
output = _ref6[1];
|
|
141
|
-
|
|
142
|
-
test("assemble ".concat(output), function () {
|
|
143
|
-
expect((0, _index.assembleLocString)(input)).toEqual(output);
|
|
144
|
-
});
|
|
145
|
-
test("assemble and parse ".concat(output), function () {
|
|
146
|
-
expect((0, _index.parseLocString)((0, _index.assembleLocString)(input), function (refName) {
|
|
147
|
-
return refName === 'chr1' || refName === 'chr2';
|
|
148
|
-
})).toEqual(_objectSpread(_objectSpread({}, input), {}, {
|
|
149
|
-
reversed: false
|
|
150
|
-
}));
|
|
151
|
-
});
|
|
152
|
-
}); // Special case since undefined `start` will result in `start` being assumed
|
|
153
|
-
// to be `0`
|
|
154
|
-
|
|
155
|
-
var location = {
|
|
156
|
-
refName: 'chr1',
|
|
157
|
-
end: 100
|
|
158
|
-
};
|
|
159
|
-
test("assemble 'chr1:1..100'", function () {
|
|
160
|
-
expect((0, _index.assembleLocString)(location)).toEqual('chr1:1..100');
|
|
161
|
-
});
|
|
162
|
-
test('test empty assemblyName', function () {
|
|
163
|
-
var location = '{}chr1:1..100';
|
|
164
|
-
expect(function () {
|
|
165
|
-
(0, _index.parseLocString)(location, function (refName) {
|
|
166
|
-
return refName === 'chr1' || refName === 'chr2';
|
|
167
|
-
});
|
|
168
|
-
}).toThrow("no assembly name was provided in location \"".concat(location, "\""));
|
|
169
|
-
});
|
|
170
|
-
test("assemble and parse 'chr1:1..100'", function () {
|
|
171
|
-
expect((0, _index.parseLocString)((0, _index.assembleLocString)(location), function (refName) {
|
|
172
|
-
return refName === 'chr1' || refName === 'chr2';
|
|
173
|
-
})).toEqual(_objectSpread(_objectSpread({}, location), {}, {
|
|
174
|
-
start: 0,
|
|
175
|
-
reversed: false,
|
|
176
|
-
assemblyName: undefined
|
|
177
|
-
}));
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
describe('compareLocStrings', function () {
|
|
181
|
-
var cases = [['chr1:1..200', 'chr1:1-200', 0], ['chr1:1-200', '{hg19}chr1:1-200', -1], ['{hg19}chr1:1-200', 'chr1:1-200', 1], ['{hg19}chr1:1-200', '{hg19}chr1:2-200', -1]];
|
|
182
|
-
cases.forEach(function (_ref7) {
|
|
183
|
-
var _ref8 = (0, _slicedToArray2.default)(_ref7, 3),
|
|
184
|
-
input1 = _ref8[0],
|
|
185
|
-
input2 = _ref8[1],
|
|
186
|
-
output = _ref8[2];
|
|
187
|
-
|
|
188
|
-
test("".concat(input1, " ").concat(input2, " = ").concat(output), function () {
|
|
189
|
-
expect((0, _index.compareLocStrings)(input1, input2, function (refName) {
|
|
190
|
-
return refName === 'chr1' || refName === 'chr2';
|
|
191
|
-
})).toEqual(output);
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
describe('test stringify', function () {
|
|
196
|
-
var testStringify = {
|
|
197
|
-
refName: 'ctgA',
|
|
198
|
-
start: 5000,
|
|
199
|
-
end: 20000,
|
|
200
|
-
reversed: false,
|
|
201
|
-
assemblyName: 'volvox',
|
|
202
|
-
oob: false,
|
|
203
|
-
offset: 0,
|
|
204
|
-
coord: 5001,
|
|
205
|
-
index: 0
|
|
206
|
-
};
|
|
207
|
-
test('stringify refName: bp', function () {
|
|
208
|
-
expect((0, _index.stringify)({
|
|
209
|
-
coord: testStringify.offset,
|
|
210
|
-
refName: testStringify.refName
|
|
211
|
-
})).toBe('ctgA:0');
|
|
212
|
-
});
|
|
213
|
-
});
|
package/util/jexlStrings.test.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _jexlStrings = require("./jexlStrings");
|
|
6
|
-
|
|
7
|
-
var _simpleFeature = _interopRequireDefault(require("./simpleFeature"));
|
|
8
|
-
|
|
9
|
-
/* eslint-disable no-underscore-dangle */
|
|
10
|
-
describe('function string parsing', function () {
|
|
11
|
-
it('can detect a jexl expression', function () {
|
|
12
|
-
var str = 'jexl:a+b+c+5';
|
|
13
|
-
expect(str.startsWith('jexl:')).toBeTruthy();
|
|
14
|
-
});
|
|
15
|
-
it('can create a jexl expression', function () {
|
|
16
|
-
var str = 'jexl:a+b+c+5';
|
|
17
|
-
var expr = (0, _jexlStrings.stringToJexlExpression)(str);
|
|
18
|
-
expect(expr._exprStr).toEqual('a+b+c+5');
|
|
19
|
-
});
|
|
20
|
-
it('can create a jexl expression 2', function () {
|
|
21
|
-
var str = 'jexl:\na+b+c+5';
|
|
22
|
-
var expr = (0, _jexlStrings.stringToJexlExpression)(str);
|
|
23
|
-
expect(expr._exprStr).toEqual('\na+b+c+5');
|
|
24
|
-
var result = expr.evalSync({
|
|
25
|
-
a: 5,
|
|
26
|
-
b: 10,
|
|
27
|
-
c: 15
|
|
28
|
-
});
|
|
29
|
-
expect(result).toEqual(35);
|
|
30
|
-
});
|
|
31
|
-
it('can use the loaded core helper functions to access feature info', function () {
|
|
32
|
-
var feature = new _simpleFeature.default({
|
|
33
|
-
uniqueId: 'jexlFeature',
|
|
34
|
-
score: 10,
|
|
35
|
-
start: 1,
|
|
36
|
-
end: 9
|
|
37
|
-
});
|
|
38
|
-
expect((0, _jexlStrings.stringToJexlExpression)("jexl:get(feature,'score')").evalSync({
|
|
39
|
-
feature: feature
|
|
40
|
-
})).toEqual(10);
|
|
41
|
-
expect((0, _jexlStrings.stringToJexlExpression)("jexl:get(feature,'uniqueId')").evalSync({
|
|
42
|
-
feature: feature
|
|
43
|
-
})).toBe('jexlFeature');
|
|
44
|
-
expect((0, _jexlStrings.stringToJexlExpression)("jexl:get(feature,'end') - get(feature,'start') == 8").evalSync({
|
|
45
|
-
feature: feature
|
|
46
|
-
})).toBe(true);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
6
|
-
|
|
7
|
-
var _GranularRectLayout = _interopRequireDefault(require("./GranularRectLayout"));
|
|
8
|
-
|
|
9
|
-
describe('GranularRectLayout', function () {
|
|
10
|
-
it('lays out non-overlapping features end to end', function () {
|
|
11
|
-
var l = new _GranularRectLayout.default({
|
|
12
|
-
pitchX: 10,
|
|
13
|
-
pitchY: 4
|
|
14
|
-
});
|
|
15
|
-
var testRects = [['1,0', 4133, 5923, 16], ['1,1', 11299, 12389, 16], ['1,2', 21050, 22778, 16], ['1,3', 41125, 47459, 16], ['1,4', 47926, 49272, 16], ['1,5', 50240, 52495, 16], ['1,6', 53329, 56283, 16], ['1,7', 59309, 79441, 16], ['1,8', 80359, 83196, 16], ['1,9', 92147, 94188, 16], ['1,10', 96241, 103626, 16], ['1,11', 104396, 108110, 16], ['1,12', 111878, 125251, 16], ['1,13', 125747, 128085, 16], ['1,14', 131492, 132641, 16], ['1,15', 133857, 134931, 16], ['1,16', 137023, 138220, 16], ['1,17', 140703, 145668, 16], ['1,18', 146045, 147059, 16], ['1,19', 162296, 165395, 16], ['1,20', 168531, 170795, 16], ['1,21', 174812, 180475, 16], ['1,22', 184302, 188826, 16], ['1,23', 189609, 191141, 16], ['1,24', 199799, 201389, 16], ['1,25', 203436, 211345, 16], ['1,26', 212100, 212379, 16], ['1,27', 213418, 214627, 16], ['1,28', 215115, 219344, 16], ['1,29', 220067, 222525, 16], ['1,30', 223308, 228141, 16], ['1,31', 234473, 236768, 16], ['1,32', 239691, 245015, 16]];
|
|
16
|
-
|
|
17
|
-
for (var i = 0; i < testRects.length; i += 1) {
|
|
18
|
-
var top = l.addRect.apply(l, (0, _toConsumableArray2.default)(testRects[i]));
|
|
19
|
-
expect(top).toEqual(0);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
it('stacks up overlapping features', function () {
|
|
23
|
-
var l = new _GranularRectLayout.default({
|
|
24
|
-
pitchX: 10,
|
|
25
|
-
pitchY: 4
|
|
26
|
-
});
|
|
27
|
-
var testRects = [];
|
|
28
|
-
|
|
29
|
-
for (var i = 1; i <= 20; i += 1) {
|
|
30
|
-
testRects.push(["feature-".concat(i), 100 * i - 60, 100 * i + 60, 1]);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
for (var _i = 0; _i < testRects.length; _i += 1) {
|
|
34
|
-
var top = l.addRect.apply(l, (0, _toConsumableArray2.default)(testRects[_i]));
|
|
35
|
-
expect(top).toEqual(_i % 2 * 4);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
it('discards regions', function () {
|
|
39
|
-
var l = new _GranularRectLayout.default({
|
|
40
|
-
pitchX: 10,
|
|
41
|
-
pitchY: 4
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
for (var i = 0; i < 20; i += 1) {
|
|
45
|
-
var top = l.addRect("feature-".concat(i), 10000 * i + 4000, 10000 * i + 16000, 1);
|
|
46
|
-
expect(top).toEqual(i % 2 * 4);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
expect(l.bitmap[0].rowState.bits.length).toBe(34812);
|
|
50
|
-
expect(l.bitmap[1].rowState.bits.length).toBe(34812);
|
|
51
|
-
l.discardRange(190000, 220000);
|
|
52
|
-
expect(l.bitmap[0].rowState.bits.length).toBe(24802);
|
|
53
|
-
expect(l.bitmap[1].rowState.bits.length).toBe(23802);
|
|
54
|
-
l.discardRange(0, 100000);
|
|
55
|
-
expect(l.bitmap[0].rowState.bits.length).toBe(19001);
|
|
56
|
-
expect(l.bitmap[1].rowState.bits.length).toBe(23802);
|
|
57
|
-
l.discardRange(0, 220000);
|
|
58
|
-
expect(l.bitmap[0].rowState).toBeUndefined();
|
|
59
|
-
}); // see issue #486
|
|
60
|
-
|
|
61
|
-
it('tests that adding +/- pitchX fixes resolution causing errors', function () {
|
|
62
|
-
var l = new _GranularRectLayout.default({
|
|
63
|
-
pitchX: 91.21851599727707,
|
|
64
|
-
pitchY: 3
|
|
65
|
-
});
|
|
66
|
-
l.addRect('test', 2581541, 2581542, 1);
|
|
67
|
-
expect(l.serializeRegion({
|
|
68
|
-
start: 2581491,
|
|
69
|
-
end: 2818659
|
|
70
|
-
}).rectangles.test).toBeTruthy();
|
|
71
|
-
});
|
|
72
|
-
it('tests reinitializing layout due to throwing away old one', function () {
|
|
73
|
-
var spy = jest.spyOn(console, 'warn').mockImplementation(function () {});
|
|
74
|
-
var l = new _GranularRectLayout.default({
|
|
75
|
-
pitchX: 1,
|
|
76
|
-
pitchY: 1,
|
|
77
|
-
maxHeight: 600
|
|
78
|
-
});
|
|
79
|
-
l.addRect('test1', 0, 10000, 1);
|
|
80
|
-
l.addRect('test2', 1000000, 1000100, 1);
|
|
81
|
-
l.addRect('test3', 0, 10000, 1);
|
|
82
|
-
expect(l.rectangles.size).toBe(3);
|
|
83
|
-
expect(spy).toHaveBeenCalled();
|
|
84
|
-
spy.mockRestore();
|
|
85
|
-
});
|
|
86
|
-
it('tests adding a gigantic feature that fills entire row with another smaller added on top', function () {
|
|
87
|
-
var l = new _GranularRectLayout.default({
|
|
88
|
-
pitchX: 100,
|
|
89
|
-
pitchY: 1,
|
|
90
|
-
maxHeight: 600
|
|
91
|
-
});
|
|
92
|
-
expect(l.getByCoord(50000, 0)).toEqual(undefined);
|
|
93
|
-
l.addRect('test1', 0, 100000000, 1, 'feat1');
|
|
94
|
-
expect(l.getByCoord(50000, 0)).toEqual('test1');
|
|
95
|
-
l.addRect('test2', 0, 1000, 1, 'feat2');
|
|
96
|
-
expect(l.getByCoord(500, 1)).toEqual('test2');
|
|
97
|
-
expect(l.rectangles.size).toBe(2);
|
|
98
|
-
});
|
|
99
|
-
});
|
package/util/range.test.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
6
|
-
|
|
7
|
-
var _range = require("./range");
|
|
8
|
-
|
|
9
|
-
describe('insersection2', function () {
|
|
10
|
-
var testCases = [{
|
|
11
|
-
in: [1, 3, 5, 10],
|
|
12
|
-
out: []
|
|
13
|
-
}, {
|
|
14
|
-
in: [1, 1, 2, 2],
|
|
15
|
-
out: []
|
|
16
|
-
}, {
|
|
17
|
-
in: [1, 2, 1, 2],
|
|
18
|
-
out: [1, 2]
|
|
19
|
-
}, {
|
|
20
|
-
in: [1, 3, 2, 4],
|
|
21
|
-
out: [2, 3]
|
|
22
|
-
}, {
|
|
23
|
-
in: [2, 4, 1, 3],
|
|
24
|
-
out: [2, 3]
|
|
25
|
-
}, {
|
|
26
|
-
in: [2, 4, 1, 4],
|
|
27
|
-
out: [2, 4]
|
|
28
|
-
}, {
|
|
29
|
-
in: [1, 4, 2, 4],
|
|
30
|
-
out: [2, 4]
|
|
31
|
-
}, {
|
|
32
|
-
in: [1, 3, 1, 4],
|
|
33
|
-
out: [1, 3]
|
|
34
|
-
}, {
|
|
35
|
-
in: [1, 4, 1, 3],
|
|
36
|
-
out: [1, 3]
|
|
37
|
-
}, {
|
|
38
|
-
in: [2, 3, 1, 2],
|
|
39
|
-
out: []
|
|
40
|
-
}, {
|
|
41
|
-
in: [1, 2, 2, 3],
|
|
42
|
-
out: []
|
|
43
|
-
}, {
|
|
44
|
-
in: [1, 1, 1, 1],
|
|
45
|
-
out: []
|
|
46
|
-
}, {
|
|
47
|
-
in: [1, 1, 1, 2],
|
|
48
|
-
out: []
|
|
49
|
-
}, {
|
|
50
|
-
in: [1, 2, 1, 1],
|
|
51
|
-
out: []
|
|
52
|
-
}, {
|
|
53
|
-
in: [1, 3, 2, 2],
|
|
54
|
-
out: []
|
|
55
|
-
}, {
|
|
56
|
-
in: [2, 2, 1, 3],
|
|
57
|
-
out: []
|
|
58
|
-
}];
|
|
59
|
-
testCases.forEach(function (testcase) {
|
|
60
|
-
test("intersection2(".concat(testcase.in, ") -> ").concat(testcase.out), function () {
|
|
61
|
-
expect(_range.intersection2.apply(void 0, (0, _toConsumableArray2.default)(testcase.in))).toEqual(testcase.out);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _simpleFeature = _interopRequireDefault(require("./simpleFeature"));
|
|
6
|
-
|
|
7
|
-
test('can create a simple feature', function () {
|
|
8
|
-
var f = new _simpleFeature.default({
|
|
9
|
-
uniqueId: 'test',
|
|
10
|
-
start: 100,
|
|
11
|
-
end: 200
|
|
12
|
-
});
|
|
13
|
-
expect(f.id()).toEqual('test');
|
|
14
|
-
expect(f.get('start')).toEqual(100);
|
|
15
|
-
expect(f.get('end')).toEqual(200);
|
|
16
|
-
});
|
|
17
|
-
test('can create a simple with subfeatures', function () {
|
|
18
|
-
var f = new _simpleFeature.default({
|
|
19
|
-
uniqueId: 'test',
|
|
20
|
-
start: 100,
|
|
21
|
-
end: 500,
|
|
22
|
-
subfeatures: [{
|
|
23
|
-
start: 100,
|
|
24
|
-
end: 200
|
|
25
|
-
}, {
|
|
26
|
-
start: 400,
|
|
27
|
-
end: 500
|
|
28
|
-
}]
|
|
29
|
-
});
|
|
30
|
-
expect(f.id()).toEqual('test');
|
|
31
|
-
expect(f.get('start')).toEqual(100);
|
|
32
|
-
expect(f.get('end')).toEqual(500);
|
|
33
|
-
expect(f.get('subfeatures')[0].get('start')).toEqual(100);
|
|
34
|
-
});
|
package/util/stats.test.js
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
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 _simpleFeature = _interopRequireDefault(require("./simpleFeature"));
|
|
10
|
-
|
|
11
|
-
var _rxjs = require("rxjs");
|
|
12
|
-
|
|
13
|
-
var _stats = require("./stats");
|
|
14
|
-
|
|
15
|
-
test('calc std', function () {
|
|
16
|
-
var s = [1, 2, 3];
|
|
17
|
-
var sum = s.reduce(function (a, b) {
|
|
18
|
-
return a + b;
|
|
19
|
-
});
|
|
20
|
-
var sumSq = s.reduce(function (a, b) {
|
|
21
|
-
return a + b * b;
|
|
22
|
-
});
|
|
23
|
-
expect((0, _stats.calcStdFromSums)(sum, sumSq, s.length, true)).toBeCloseTo(0.8164965809); // calculated from a webapp
|
|
24
|
-
|
|
25
|
-
expect((0, _stats.calcStdFromSums)(sum, sumSq, s.length, false)).toBeCloseTo(1); // calculated from a webapp
|
|
26
|
-
|
|
27
|
-
expect((0, _stats.calcStdFromSums)(100, 100, 0)).toEqual(0); // fake thing where list "n" is 0
|
|
28
|
-
|
|
29
|
-
expect((0, _stats.calcStdFromSums)(100000, 100, 5)).toEqual(0); // fake thing where sumSq probably wrong
|
|
30
|
-
});
|
|
31
|
-
test('test rectify', function () {
|
|
32
|
-
// mean of 0 bases covered = 0
|
|
33
|
-
expect((0, _stats.rectifyStats)({
|
|
34
|
-
basesCovered: 0
|
|
35
|
-
}).scoreMean).toEqual(0);
|
|
36
|
-
var s = (0, _stats.rectifyStats)({
|
|
37
|
-
featureCount: 10,
|
|
38
|
-
scoreSum: 1000
|
|
39
|
-
});
|
|
40
|
-
expect(s.scoreMean).toEqual(100);
|
|
41
|
-
expect(s.featureCount).toEqual(10);
|
|
42
|
-
expect((0, _stats.rectifyStats)({
|
|
43
|
-
featureCount: 3,
|
|
44
|
-
scoreSum: 6,
|
|
45
|
-
scoreSumSquares: 14
|
|
46
|
-
}).scoreStdDev).toEqual(1); // calculated from a webapp about sample standard deviations
|
|
47
|
-
});
|
|
48
|
-
test('scores to stats', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
49
|
-
var ret;
|
|
50
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
51
|
-
while (1) {
|
|
52
|
-
switch (_context.prev = _context.next) {
|
|
53
|
-
case 0:
|
|
54
|
-
_context.next = 2;
|
|
55
|
-
return (0, _stats.scoresToStats)({
|
|
56
|
-
refName: 'ctgA',
|
|
57
|
-
start: 0,
|
|
58
|
-
end: 2
|
|
59
|
-
}, (0, _rxjs.from)([new _simpleFeature.default({
|
|
60
|
-
id: 1,
|
|
61
|
-
data: {
|
|
62
|
-
start: 0,
|
|
63
|
-
end: 1,
|
|
64
|
-
score: 1
|
|
65
|
-
}
|
|
66
|
-
}), new _simpleFeature.default({
|
|
67
|
-
id: 2,
|
|
68
|
-
data: {
|
|
69
|
-
start: 1,
|
|
70
|
-
end: 2,
|
|
71
|
-
score: 2
|
|
72
|
-
}
|
|
73
|
-
}), new _simpleFeature.default({
|
|
74
|
-
id: 3,
|
|
75
|
-
data: {
|
|
76
|
-
start: 2,
|
|
77
|
-
end: 3,
|
|
78
|
-
score: 3
|
|
79
|
-
}
|
|
80
|
-
})]));
|
|
81
|
-
|
|
82
|
-
case 2:
|
|
83
|
-
ret = _context.sent;
|
|
84
|
-
expect(ret.scoreMean).toEqual(2);
|
|
85
|
-
expect(ret.featureDensity).toEqual(1);
|
|
86
|
-
expect(ret.scoreMax).toEqual(3);
|
|
87
|
-
expect(ret.scoreMin).toEqual(1);
|
|
88
|
-
expect(ret.scoreStdDev).toEqual(1); // calculated from a webapp
|
|
89
|
-
|
|
90
|
-
case 8:
|
|
91
|
-
case "end":
|
|
92
|
-
return _context.stop();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}, _callee);
|
|
96
|
-
}))); // peter TODO: fix this test
|
|
97
|
-
|
|
98
|
-
test('calc per base stats', function () {
|
|
99
|
-
// one score at start
|
|
100
|
-
expect((0, _stats.calcPerBaseStats)({
|
|
101
|
-
refName: 'ctgA',
|
|
102
|
-
start: 0,
|
|
103
|
-
end: 9
|
|
104
|
-
}, [new _simpleFeature.default({
|
|
105
|
-
id: 1,
|
|
106
|
-
data: {
|
|
107
|
-
start: 0,
|
|
108
|
-
end: 1,
|
|
109
|
-
score: 10
|
|
110
|
-
}
|
|
111
|
-
})])).toEqual([10, 0, 0, 0, 0, 0, 0, 0, 0]); // multiple features
|
|
112
|
-
|
|
113
|
-
expect((0, _stats.calcPerBaseStats)({
|
|
114
|
-
refName: 'ctgA',
|
|
115
|
-
start: 0,
|
|
116
|
-
end: 9
|
|
117
|
-
}, [new _simpleFeature.default({
|
|
118
|
-
id: 1,
|
|
119
|
-
data: {
|
|
120
|
-
start: 0,
|
|
121
|
-
end: 1,
|
|
122
|
-
score: 10
|
|
123
|
-
}
|
|
124
|
-
}), new _simpleFeature.default({
|
|
125
|
-
id: 2,
|
|
126
|
-
data: {
|
|
127
|
-
start: 8,
|
|
128
|
-
end: 9,
|
|
129
|
-
score: 10
|
|
130
|
-
}
|
|
131
|
-
})])).toEqual([10, 0, 0, 0, 0, 0, 0, 0, 10]); // multiple features
|
|
132
|
-
|
|
133
|
-
expect((0, _stats.calcPerBaseStats)({
|
|
134
|
-
refName: 'ctgA',
|
|
135
|
-
start: 15,
|
|
136
|
-
end: 30
|
|
137
|
-
}, [new _simpleFeature.default({
|
|
138
|
-
id: 1,
|
|
139
|
-
data: {
|
|
140
|
-
start: 10,
|
|
141
|
-
end: 20,
|
|
142
|
-
score: 10
|
|
143
|
-
}
|
|
144
|
-
}), new _simpleFeature.default({
|
|
145
|
-
id: 2,
|
|
146
|
-
data: {
|
|
147
|
-
start: 25,
|
|
148
|
-
end: 26,
|
|
149
|
-
score: 10
|
|
150
|
-
}
|
|
151
|
-
})])).toEqual([10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0]); // feature starts before region
|
|
152
|
-
|
|
153
|
-
expect((0, _stats.calcPerBaseStats)({
|
|
154
|
-
refName: 'ctgA',
|
|
155
|
-
start: 10,
|
|
156
|
-
end: 19
|
|
157
|
-
}, [new _simpleFeature.default({
|
|
158
|
-
id: 1,
|
|
159
|
-
data: {
|
|
160
|
-
start: 5,
|
|
161
|
-
end: 15,
|
|
162
|
-
score: 10
|
|
163
|
-
}
|
|
164
|
-
}), new _simpleFeature.default({
|
|
165
|
-
id: 1,
|
|
166
|
-
data: {
|
|
167
|
-
start: 18,
|
|
168
|
-
end: 26,
|
|
169
|
-
score: 10
|
|
170
|
-
}
|
|
171
|
-
})])).toEqual([10, 10, 10, 10, 10, 0, 0, 0, 10]);
|
|
172
|
-
});
|