@jbrowse/core 1.7.11 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BaseFeatureWidget/BaseFeatureDetail.d.ts +20 -4
- package/BaseFeatureWidget/BaseFeatureDetail.js +313 -558
- package/BaseFeatureWidget/SequenceFeatureDetails.js +213 -473
- package/BaseFeatureWidget/index.d.ts +2 -2
- package/BaseFeatureWidget/index.js +88 -124
- 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 +84 -117
- package/PluginManager.js +377 -666
- package/ReExports/Attributes.d.ts +2 -0
- package/ReExports/Attributes.js +5 -0
- package/ReExports/BaseCard.d.ts +2 -0
- package/ReExports/BaseCard.js +5 -0
- package/ReExports/DataGrid.d.ts +2 -0
- package/ReExports/DataGrid.js +6 -0
- package/ReExports/FeatureDetails.d.ts +2 -0
- package/ReExports/FeatureDetails.js +5 -0
- package/ReExports/index.js +6 -12
- package/ReExports/list.d.ts +5 -0
- package/ReExports/list.js +271 -7
- package/ReExports/material-ui-colors.d.ts +1 -19
- package/ReExports/material-ui-colors.js +16 -158
- package/ReExports/modules.d.ts +68 -109
- package/ReExports/modules.js +455 -244
- package/TextSearch/BaseResults.js +51 -123
- package/TextSearch/TextSearchManager.d.ts +3 -1
- package/TextSearch/TextSearchManager.js +66 -144
- package/assemblyManager/assembly.js +280 -554
- package/assemblyManager/assemblyConfigSchema.js +47 -64
- package/assemblyManager/assemblyManager.d.ts +12 -10
- package/assemblyManager/assemblyManager.js +126 -270
- 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.d.ts +1 -1
- 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 +16 -18
- 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.d.ts +10 -10
- package/pluggableElementTypes/models/BaseDisplayModel.js +58 -95
- package/pluggableElementTypes/models/BaseTrackModel.d.ts +1 -1
- package/pluggableElementTypes/models/BaseTrackModel.js +139 -200
- 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.d.ts +2 -2
- 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 +107 -158
- package/ui/App.js +157 -261
- package/ui/AssemblySelector.d.ts +1 -1
- package/ui/AssemblySelector.js +59 -115
- package/ui/CascadingMenu.js +100 -199
- package/ui/ColorPicker.d.ts +16 -0
- package/ui/ColorPicker.js +97 -0
- package/ui/Drawer.js +28 -58
- package/ui/DrawerWidget.js +109 -209
- package/ui/DropDownMenu.d.ts +0 -8
- package/ui/DropDownMenu.js +60 -97
- package/ui/EditableTypography.d.ts +1 -1
- package/ui/EditableTypography.js +87 -155
- package/ui/ErrorMessage.js +41 -66
- 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 -71
- package/ui/FileSelector/UrlChooser.js +17 -38
- package/ui/FileSelector/index.js +6 -12
- package/ui/Icons.d.ts +1 -1
- package/ui/Icons.js +45 -69
- package/ui/Logo.js +57 -110
- package/ui/Menu.d.ts +1 -1
- package/ui/Menu.js +232 -355
- package/ui/PrerenderedCanvas.js +63 -78
- package/ui/ResizeHandle.js +87 -114
- package/ui/ReturnToImportFormDialog.js +32 -59
- package/ui/SanitizedHTML.js +63 -52
- package/ui/Snackbar.js +74 -99
- package/ui/SnackbarModel.js +37 -51
- package/ui/Tooltip.d.ts +3 -1
- package/ui/Tooltip.js +49 -74
- package/ui/ViewContainer.js +113 -183
- 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 +279 -131
- package/ui/theme.js +197 -225
- package/util/Base1DUtils.d.ts +32 -0
- package/util/Base1DUtils.js +174 -0
- package/util/Base1DViewModel.d.ts +16 -37
- package/util/Base1DViewModel.js +116 -295
- 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 -39
- package/util/index.js +743 -1236
- 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 -557
- package/util/layouts/MultiLayout.js +41 -109
- package/util/layouts/PrecomputedLayout.js +56 -114
- 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 -171
- package/util/types/index.d.ts +3 -3
- package/util/types/index.js +110 -179
- package/util/types/mst.d.ts +3 -3
- package/util/types/mst.js +91 -142
- 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 -51
- 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 -111
- 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/ui/theme.test.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _theme = require("./theme");
|
|
4
|
-
|
|
5
|
-
describe('theme utils', function () {
|
|
6
|
-
it('can create a default theme', function () {
|
|
7
|
-
var theme = (0, _theme.createJBrowseTheme)();
|
|
8
|
-
expect(theme.palette.primary.main).toEqual('#0D233F');
|
|
9
|
-
expect(theme.palette.secondary.main).toEqual('#721E63');
|
|
10
|
-
expect(theme.palette.tertiary.main).toEqual('#135560');
|
|
11
|
-
expect(theme.palette.quaternary.main).toEqual('#FFB11D');
|
|
12
|
-
});
|
|
13
|
-
it('allows overriding primary and secondary colors', function () {
|
|
14
|
-
var theme = (0, _theme.createJBrowseTheme)({
|
|
15
|
-
palette: {
|
|
16
|
-
primary: {
|
|
17
|
-
main: '#888888'
|
|
18
|
-
},
|
|
19
|
-
secondary: {
|
|
20
|
-
main: 'rgb(137,137,137)'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
expect(theme.palette.primary.main).toEqual('#888888');
|
|
25
|
-
expect(theme.palette.secondary.main).toEqual('rgb(137,137,137)');
|
|
26
|
-
});
|
|
27
|
-
it('allows overriding tertiary and quaternary colors', function () {
|
|
28
|
-
var theme = (0, _theme.createJBrowseTheme)({
|
|
29
|
-
palette: {
|
|
30
|
-
tertiary: {
|
|
31
|
-
main: '#888'
|
|
32
|
-
},
|
|
33
|
-
quaternary: {
|
|
34
|
-
main: 'hsl(0,0,54)'
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
expect(theme.palette.tertiary.main).toEqual('#888');
|
|
39
|
-
expect(theme.palette.tertiary.light).toBeTruthy();
|
|
40
|
-
expect(theme.palette.quaternary.main).toEqual('hsl(0,0,54)');
|
|
41
|
-
expect(theme.palette.quaternary.dark).toBeTruthy();
|
|
42
|
-
});
|
|
43
|
-
it('allows customizing spacing', function () {
|
|
44
|
-
var defaultTheme = (0, _theme.createJBrowseTheme)();
|
|
45
|
-
expect(defaultTheme.spacing(1)).toBe(4);
|
|
46
|
-
var biggerSpacingTheme = (0, _theme.createJBrowseTheme)({
|
|
47
|
-
spacing: 16
|
|
48
|
-
});
|
|
49
|
-
expect(biggerSpacingTheme.spacing(1)).toBe(16);
|
|
50
|
-
});
|
|
51
|
-
it('allows adding a custom override', function () {
|
|
52
|
-
var _theme$overrides;
|
|
53
|
-
|
|
54
|
-
var muiPaperStyle = {
|
|
55
|
-
root: {
|
|
56
|
-
backgroundColor: 'green'
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
var theme = (0, _theme.createJBrowseTheme)({
|
|
60
|
-
overrides: {
|
|
61
|
-
MuiPaper: muiPaperStyle
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
expect((_theme$overrides = theme.overrides) === null || _theme$overrides === void 0 ? void 0 : _theme$overrides.MuiPaper).toEqual(muiPaperStyle);
|
|
65
|
-
expect(Object.keys(theme.overrides || {}).length).toBe(10);
|
|
66
|
-
});
|
|
67
|
-
it('allows modifying a default override', function () {
|
|
68
|
-
var _theme$overrides2;
|
|
69
|
-
|
|
70
|
-
var muiButtonStyle = {
|
|
71
|
-
textSecondary: {
|
|
72
|
-
color: 'orange'
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
var theme = (0, _theme.createJBrowseTheme)({
|
|
76
|
-
overrides: {
|
|
77
|
-
MuiButton: muiButtonStyle
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
expect((_theme$overrides2 = theme.overrides) === null || _theme$overrides2 === void 0 ? void 0 : _theme$overrides2.MuiButton).toEqual(muiButtonStyle);
|
|
81
|
-
expect(Object.keys(theme.overrides || {}).length).toBe(9);
|
|
82
|
-
});
|
|
83
|
-
it('allows adding a custom prop', function () {
|
|
84
|
-
var _theme$props;
|
|
85
|
-
|
|
86
|
-
var muiPaperProps = {
|
|
87
|
-
variant: 'outlined'
|
|
88
|
-
};
|
|
89
|
-
var theme = (0, _theme.createJBrowseTheme)({
|
|
90
|
-
props: {
|
|
91
|
-
MuiPaper: muiPaperProps
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
expect((_theme$props = theme.props) === null || _theme$props === void 0 ? void 0 : _theme$props.MuiPaper).toEqual(muiPaperProps);
|
|
95
|
-
expect(Object.keys(theme.props || {}).length).toBe(18);
|
|
96
|
-
});
|
|
97
|
-
it('allows modifying a prop override', function () {
|
|
98
|
-
var _theme$props2;
|
|
99
|
-
|
|
100
|
-
var muiButtonProps = {
|
|
101
|
-
size: 'medium'
|
|
102
|
-
};
|
|
103
|
-
var theme = (0, _theme.createJBrowseTheme)({
|
|
104
|
-
props: {
|
|
105
|
-
MuiButton: muiButtonProps
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
expect((_theme$props2 = theme.props) === null || _theme$props2 === void 0 ? void 0 : _theme$props2.MuiButton).toEqual(muiButtonProps);
|
|
109
|
-
expect(Object.keys(theme.props || {}).length).toBe(17);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _Base1DViewModel = _interopRequireDefault(require("./Base1DViewModel"));
|
|
6
|
-
|
|
7
|
-
test('create Base1DView and set displayedRegions', function () {
|
|
8
|
-
var model = _Base1DViewModel.default.create({
|
|
9
|
-
bpPerPx: 1,
|
|
10
|
-
offsetPx: 0
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
model.setDisplayedRegions([{
|
|
14
|
-
assemblyName: 'volvox',
|
|
15
|
-
refName: 'ctgA',
|
|
16
|
-
start: 0,
|
|
17
|
-
end: 40000
|
|
18
|
-
}, {
|
|
19
|
-
assemblyName: 'volvox',
|
|
20
|
-
refName: 'ctgB',
|
|
21
|
-
start: 0,
|
|
22
|
-
end: 3000
|
|
23
|
-
}]);
|
|
24
|
-
model.setVolatileWidth(800);
|
|
25
|
-
expect(model.width).toBe(800);
|
|
26
|
-
model.setBpPerPx(2);
|
|
27
|
-
expect(model.bpPerPx).toBe(2);
|
|
28
|
-
expect(model.displayedRegions).toBeTruthy();
|
|
29
|
-
});
|
|
30
|
-
test('Able to set bpPerPx, width and calculate widths', function () {
|
|
31
|
-
var model = _Base1DViewModel.default.create({
|
|
32
|
-
bpPerPx: 0,
|
|
33
|
-
offsetPx: 0
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
model.setDisplayedRegions([{
|
|
37
|
-
assemblyName: 'volvox',
|
|
38
|
-
refName: 'ctgA',
|
|
39
|
-
start: 0,
|
|
40
|
-
end: 40000
|
|
41
|
-
}, {
|
|
42
|
-
assemblyName: 'volvox',
|
|
43
|
-
refName: 'ctgB',
|
|
44
|
-
start: 600,
|
|
45
|
-
end: 3000
|
|
46
|
-
}]);
|
|
47
|
-
model.setVolatileWidth(800);
|
|
48
|
-
expect(model.width).toBe(800);
|
|
49
|
-
model.setBpPerPx(1);
|
|
50
|
-
expect(model.bpPerPx).toBe(1); // 40000 + (3000 - 600 = 2400) = 42400
|
|
51
|
-
|
|
52
|
-
expect(model.totalBp).toEqual(42400); // 40000 + (3000 - 600 = 2400) = 42400 / 1 (bpPerPx) = 42400
|
|
53
|
-
|
|
54
|
-
expect(model.displayedRegionsTotalPx).toEqual(42400);
|
|
55
|
-
expect(model.interRegionPaddingWidth).toEqual(0);
|
|
56
|
-
expect(model.minimumBlockWidth).toEqual(0);
|
|
57
|
-
});
|
|
58
|
-
test('Able to set and showAll Regions', function () {
|
|
59
|
-
var model = _Base1DViewModel.default.create({
|
|
60
|
-
bpPerPx: 0,
|
|
61
|
-
offsetPx: 0
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
model.setDisplayedRegions([{
|
|
65
|
-
assemblyName: 'volvox',
|
|
66
|
-
refName: 'ctgA',
|
|
67
|
-
start: 0,
|
|
68
|
-
end: 40000
|
|
69
|
-
}, {
|
|
70
|
-
assemblyName: 'volvox',
|
|
71
|
-
refName: 'ctgB',
|
|
72
|
-
start: 600,
|
|
73
|
-
end: 3000
|
|
74
|
-
}]);
|
|
75
|
-
model.setVolatileWidth(800);
|
|
76
|
-
expect(model.width).toBe(800);
|
|
77
|
-
model.setBpPerPx(1);
|
|
78
|
-
expect(model.bpPerPx).toBe(1); // 400 is expected because the bpPerPx is set to 1
|
|
79
|
-
|
|
80
|
-
expect(model.pxToBp(400).offset).toEqual(400);
|
|
81
|
-
model.showAllRegions(); // offset is equal to zero after making a call to showAllRegions
|
|
82
|
-
|
|
83
|
-
expect(model.offsetPx).toEqual(0); // bpPerPx should now equal totalbp 42400 / width 800
|
|
84
|
-
|
|
85
|
-
expect(model.bpPerPx).toEqual(53);
|
|
86
|
-
});
|
|
87
|
-
test('Navigate to displayedRegions', function () {
|
|
88
|
-
var model = _Base1DViewModel.default.create({
|
|
89
|
-
bpPerPx: 0,
|
|
90
|
-
offsetPx: 0
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
model.setDisplayedRegions([{
|
|
94
|
-
assemblyName: 'volvox',
|
|
95
|
-
refName: 'ctgA',
|
|
96
|
-
start: 0,
|
|
97
|
-
end: 40000
|
|
98
|
-
}]);
|
|
99
|
-
model.setVolatileWidth(800);
|
|
100
|
-
expect(model.width).toBe(800);
|
|
101
|
-
model.showAllRegions(); // totalBp 40000 / 800 = 50
|
|
102
|
-
|
|
103
|
-
expect(model.bpPerPx).toBe(50);
|
|
104
|
-
model.moveTo({
|
|
105
|
-
start: 0,
|
|
106
|
-
end: 40000,
|
|
107
|
-
offset: 5000,
|
|
108
|
-
index: 0
|
|
109
|
-
}, {
|
|
110
|
-
start: 0,
|
|
111
|
-
end: 40000,
|
|
112
|
-
offset: 15000,
|
|
113
|
-
index: 0
|
|
114
|
-
}); // 15000 - 5000 = 1000 / 800
|
|
115
|
-
// zooming To newBpPerPx 12.5
|
|
116
|
-
// the offset is now 5000 start / bpPerPx = 400
|
|
117
|
-
|
|
118
|
-
expect(model.offsetPx).toEqual(400); // previous bpPerPx was calculated to be 12.5 ...
|
|
119
|
-
// zooming in should be 12.5 / 2 = 6.25
|
|
120
|
-
|
|
121
|
-
model.zoomIn();
|
|
122
|
-
expect(model.bpPerPx).toEqual(6.25);
|
|
123
|
-
model.zoomOut();
|
|
124
|
-
expect(model.bpPerPx).toEqual(12.5); // lets scroll back to zero since we moved to bp 5000
|
|
125
|
-
|
|
126
|
-
model.scroll(-400); // offsetPx should be 0 because we have old offsetPx of 400
|
|
127
|
-
// clamp takes 400 + -400 then clamping returns 0
|
|
128
|
-
|
|
129
|
-
expect(model.offsetPx).toEqual(0);
|
|
130
|
-
});
|
|
@@ -1,74 +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 _calculateDynamicBlocks = _interopRequireDefault(require("./calculateDynamicBlocks"));
|
|
8
|
-
|
|
9
|
-
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; }
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
13
|
-
var ctgA = {
|
|
14
|
-
assemblyName: 'test',
|
|
15
|
-
refName: 'ctgA',
|
|
16
|
-
start: 0,
|
|
17
|
-
end: 50000
|
|
18
|
-
};
|
|
19
|
-
test('one', function () {
|
|
20
|
-
expect((0, _calculateDynamicBlocks.default)({
|
|
21
|
-
offsetPx: 0,
|
|
22
|
-
width: 200,
|
|
23
|
-
displayedRegions: [ctgA],
|
|
24
|
-
bpPerPx: 1,
|
|
25
|
-
minimumBlockWidth: 20,
|
|
26
|
-
interRegionPaddingWidth: 2
|
|
27
|
-
}).getBlocks()).toMatchSnapshot();
|
|
28
|
-
});
|
|
29
|
-
test('two', function () {
|
|
30
|
-
expect((0, _calculateDynamicBlocks.default)({
|
|
31
|
-
offsetPx: 0,
|
|
32
|
-
width: 200,
|
|
33
|
-
displayedRegions: [_objectSpread(_objectSpread({}, ctgA), {}, {
|
|
34
|
-
reversed: true
|
|
35
|
-
})],
|
|
36
|
-
bpPerPx: 1,
|
|
37
|
-
minimumBlockWidth: 20,
|
|
38
|
-
interRegionPaddingWidth: 2
|
|
39
|
-
}).getBlocks()).toMatchSnapshot();
|
|
40
|
-
});
|
|
41
|
-
test('three', function () {
|
|
42
|
-
expect((0, _calculateDynamicBlocks.default)({
|
|
43
|
-
offsetPx: -100,
|
|
44
|
-
width: 200,
|
|
45
|
-
displayedRegions: [_objectSpread(_objectSpread({}, ctgA), {}, {
|
|
46
|
-
reversed: true
|
|
47
|
-
})],
|
|
48
|
-
bpPerPx: 1,
|
|
49
|
-
minimumBlockWidth: 20,
|
|
50
|
-
interRegionPaddingWidth: 2
|
|
51
|
-
}).getBlocks()).toMatchSnapshot();
|
|
52
|
-
});
|
|
53
|
-
test('four', function () {
|
|
54
|
-
expect((0, _calculateDynamicBlocks.default)({
|
|
55
|
-
offsetPx: -100,
|
|
56
|
-
width: 350,
|
|
57
|
-
displayedRegions: [ctgA],
|
|
58
|
-
bpPerPx: 1,
|
|
59
|
-
minimumBlockWidth: 20,
|
|
60
|
-
interRegionPaddingWidth: 2
|
|
61
|
-
}).getBlocks()).toMatchSnapshot();
|
|
62
|
-
});
|
|
63
|
-
test('five', function () {
|
|
64
|
-
expect((0, _calculateDynamicBlocks.default)({
|
|
65
|
-
offsetPx: 521,
|
|
66
|
-
width: 927,
|
|
67
|
-
displayedRegions: [_objectSpread(_objectSpread({}, ctgA), {}, {
|
|
68
|
-
reversed: false
|
|
69
|
-
})],
|
|
70
|
-
bpPerPx: 0.05,
|
|
71
|
-
minimumBlockWidth: 20,
|
|
72
|
-
interRegionPaddingWidth: 2
|
|
73
|
-
}).getBlocks()).toMatchSnapshot();
|
|
74
|
-
});
|
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _calculateStaticBlocks = _interopRequireDefault(require("./calculateStaticBlocks"));
|
|
6
|
-
|
|
7
|
-
describe('block calculation', function () {
|
|
8
|
-
it('can calculate some blocks 1', function () {
|
|
9
|
-
var blocks1 = (0, _calculateStaticBlocks.default)({
|
|
10
|
-
bpPerPx: 1,
|
|
11
|
-
width: 800,
|
|
12
|
-
offsetPx: 0,
|
|
13
|
-
displayedRegions: [{
|
|
14
|
-
assemblyName: 'test',
|
|
15
|
-
refName: 'ctgA',
|
|
16
|
-
start: 0,
|
|
17
|
-
end: 10000
|
|
18
|
-
}],
|
|
19
|
-
minimumBlockWidth: 20,
|
|
20
|
-
interRegionPaddingWidth: 2
|
|
21
|
-
});
|
|
22
|
-
var blocks2 = (0, _calculateStaticBlocks.default)({
|
|
23
|
-
bpPerPx: 1,
|
|
24
|
-
width: 800,
|
|
25
|
-
offsetPx: 0,
|
|
26
|
-
displayedRegions: [{
|
|
27
|
-
assemblyName: 'test',
|
|
28
|
-
refName: 'ctgA',
|
|
29
|
-
start: 0,
|
|
30
|
-
end: 10000
|
|
31
|
-
}],
|
|
32
|
-
minimumBlockWidth: 20,
|
|
33
|
-
interRegionPaddingWidth: 2
|
|
34
|
-
});
|
|
35
|
-
expect(blocks1).toMatchSnapshot();
|
|
36
|
-
expect(blocks1).toEqual(blocks2);
|
|
37
|
-
});
|
|
38
|
-
it('can calculate some blocks 2', function () {
|
|
39
|
-
var blocks = (0, _calculateStaticBlocks.default)({
|
|
40
|
-
bpPerPx: 1,
|
|
41
|
-
width: 800,
|
|
42
|
-
offsetPx: 30,
|
|
43
|
-
displayedRegions: [{
|
|
44
|
-
assemblyName: 'test',
|
|
45
|
-
refName: 'ctgA',
|
|
46
|
-
start: 0,
|
|
47
|
-
end: 100
|
|
48
|
-
}, {
|
|
49
|
-
assemblyName: 'test',
|
|
50
|
-
refName: 'ctgB',
|
|
51
|
-
start: 100,
|
|
52
|
-
end: 200
|
|
53
|
-
}],
|
|
54
|
-
minimumBlockWidth: 20,
|
|
55
|
-
interRegionPaddingWidth: 2
|
|
56
|
-
});
|
|
57
|
-
expect(blocks).toMatchSnapshot();
|
|
58
|
-
});
|
|
59
|
-
it('can calculate some blocks (should be empty because offscreen to the right)', function () {
|
|
60
|
-
var blockSet = (0, _calculateStaticBlocks.default)({
|
|
61
|
-
bpPerPx: 1,
|
|
62
|
-
width: 800,
|
|
63
|
-
offsetPx: 2000,
|
|
64
|
-
displayedRegions: [{
|
|
65
|
-
assemblyName: 'test',
|
|
66
|
-
refName: 'ctgA',
|
|
67
|
-
start: 0,
|
|
68
|
-
end: 100
|
|
69
|
-
}, {
|
|
70
|
-
assemblyName: 'test',
|
|
71
|
-
refName: 'ctgB',
|
|
72
|
-
start: 100,
|
|
73
|
-
end: 200
|
|
74
|
-
}],
|
|
75
|
-
minimumBlockWidth: 20,
|
|
76
|
-
interRegionPaddingWidth: 2
|
|
77
|
-
});
|
|
78
|
-
expect(blockSet.getBlocks()).toEqual([]);
|
|
79
|
-
});
|
|
80
|
-
it('can calculate some blocks (should be empty because offscreen to the left)', function () {
|
|
81
|
-
var blockSet = (0, _calculateStaticBlocks.default)({
|
|
82
|
-
bpPerPx: 1,
|
|
83
|
-
width: 800,
|
|
84
|
-
offsetPx: -2000,
|
|
85
|
-
displayedRegions: [{
|
|
86
|
-
assemblyName: 'test',
|
|
87
|
-
refName: 'ctgA',
|
|
88
|
-
start: 0,
|
|
89
|
-
end: 100
|
|
90
|
-
}, {
|
|
91
|
-
assemblyName: 'test',
|
|
92
|
-
refName: 'ctgB',
|
|
93
|
-
start: 100,
|
|
94
|
-
end: 200
|
|
95
|
-
}],
|
|
96
|
-
minimumBlockWidth: 20,
|
|
97
|
-
interRegionPaddingWidth: 2
|
|
98
|
-
});
|
|
99
|
-
expect(blockSet.getBlocks()).toEqual([]);
|
|
100
|
-
});
|
|
101
|
-
it('can calculate some blocks 5', function () {
|
|
102
|
-
var blocks = (0, _calculateStaticBlocks.default)({
|
|
103
|
-
bpPerPx: 1,
|
|
104
|
-
width: 800,
|
|
105
|
-
offsetPx: 5000,
|
|
106
|
-
displayedRegions: [{
|
|
107
|
-
assemblyName: 'test',
|
|
108
|
-
refName: 'ctgA',
|
|
109
|
-
start: 0,
|
|
110
|
-
end: 10000
|
|
111
|
-
}, {
|
|
112
|
-
assemblyName: 'test',
|
|
113
|
-
refName: 'ctgB',
|
|
114
|
-
start: 100,
|
|
115
|
-
end: 10000
|
|
116
|
-
}],
|
|
117
|
-
minimumBlockWidth: 20,
|
|
118
|
-
interRegionPaddingWidth: 2
|
|
119
|
-
});
|
|
120
|
-
expect(blocks).toMatchSnapshot();
|
|
121
|
-
});
|
|
122
|
-
it('can calculate some blocks 6', function () {
|
|
123
|
-
var blockSet = (0, _calculateStaticBlocks.default)({
|
|
124
|
-
bpPerPx: 1,
|
|
125
|
-
width: 800,
|
|
126
|
-
offsetPx: 0,
|
|
127
|
-
displayedRegions: [{
|
|
128
|
-
assemblyName: 'test',
|
|
129
|
-
refName: 'ctgA',
|
|
130
|
-
start: 0,
|
|
131
|
-
end: 200
|
|
132
|
-
}, {
|
|
133
|
-
assemblyName: 'test',
|
|
134
|
-
refName: 'ctgB',
|
|
135
|
-
start: 0,
|
|
136
|
-
end: 1000
|
|
137
|
-
}],
|
|
138
|
-
minimumBlockWidth: 20,
|
|
139
|
-
interRegionPaddingWidth: 2
|
|
140
|
-
});
|
|
141
|
-
expect(blockSet).toMatchSnapshot();
|
|
142
|
-
expect(blockSet.blocks[1].offsetPx).toBe(0);
|
|
143
|
-
});
|
|
144
|
-
it('can calculate some blocks 7', function () {
|
|
145
|
-
var blocks = (0, _calculateStaticBlocks.default)({
|
|
146
|
-
bpPerPx: 1,
|
|
147
|
-
width: 800,
|
|
148
|
-
offsetPx: 801,
|
|
149
|
-
displayedRegions: [{
|
|
150
|
-
assemblyName: 'test',
|
|
151
|
-
refName: 'ctgA',
|
|
152
|
-
start: 0,
|
|
153
|
-
end: 200
|
|
154
|
-
}, {
|
|
155
|
-
assemblyName: 'test',
|
|
156
|
-
refName: 'ctgB',
|
|
157
|
-
start: 0,
|
|
158
|
-
end: 1000
|
|
159
|
-
}],
|
|
160
|
-
minimumBlockWidth: 20,
|
|
161
|
-
interRegionPaddingWidth: 2
|
|
162
|
-
});
|
|
163
|
-
expect(blocks).toMatchSnapshot();
|
|
164
|
-
});
|
|
165
|
-
it('can calculate some blocks 8', function () {
|
|
166
|
-
var blocks = (0, _calculateStaticBlocks.default)({
|
|
167
|
-
bpPerPx: 1,
|
|
168
|
-
width: 800,
|
|
169
|
-
offsetPx: 1600,
|
|
170
|
-
displayedRegions: [{
|
|
171
|
-
assemblyName: 'test',
|
|
172
|
-
refName: 'ctgA',
|
|
173
|
-
start: 0,
|
|
174
|
-
end: 200
|
|
175
|
-
}, {
|
|
176
|
-
assemblyName: 'test',
|
|
177
|
-
refName: 'ctgB',
|
|
178
|
-
start: 0,
|
|
179
|
-
end: 10000000
|
|
180
|
-
}],
|
|
181
|
-
minimumBlockWidth: 20,
|
|
182
|
-
interRegionPaddingWidth: 2
|
|
183
|
-
});
|
|
184
|
-
expect(blocks).toMatchSnapshot();
|
|
185
|
-
});
|
|
186
|
-
it('can calculate some blocks 9', function () {
|
|
187
|
-
var blockSet = (0, _calculateStaticBlocks.default)({
|
|
188
|
-
width: 800,
|
|
189
|
-
offsetPx: 1069,
|
|
190
|
-
bpPerPx: 2,
|
|
191
|
-
displayedRegions: [{
|
|
192
|
-
assemblyName: 'test',
|
|
193
|
-
refName: 'ctgA',
|
|
194
|
-
start: 0,
|
|
195
|
-
end: 50000
|
|
196
|
-
}, {
|
|
197
|
-
assemblyName: 'test',
|
|
198
|
-
refName: 'ctgB',
|
|
199
|
-
start: 0,
|
|
200
|
-
end: 300
|
|
201
|
-
}],
|
|
202
|
-
minimumBlockWidth: 20,
|
|
203
|
-
interRegionPaddingWidth: 2
|
|
204
|
-
});
|
|
205
|
-
expect(blockSet).toMatchSnapshot();
|
|
206
|
-
});
|
|
207
|
-
it('can calculate some blocks 10', function () {
|
|
208
|
-
var blockSet = (0, _calculateStaticBlocks.default)({
|
|
209
|
-
width: 800,
|
|
210
|
-
offsetPx: 0,
|
|
211
|
-
bpPerPx: 0.05,
|
|
212
|
-
displayedRegions: [{
|
|
213
|
-
assemblyName: 'test',
|
|
214
|
-
refName: 'ctgA',
|
|
215
|
-
start: 100,
|
|
216
|
-
end: 200
|
|
217
|
-
}, {
|
|
218
|
-
assemblyName: 'test',
|
|
219
|
-
refName: 'ctgA',
|
|
220
|
-
start: 300,
|
|
221
|
-
end: 400
|
|
222
|
-
}],
|
|
223
|
-
minimumBlockWidth: 20,
|
|
224
|
-
interRegionPaddingWidth: 2
|
|
225
|
-
}); // console.log(JSON.stringify(blockSet.blocks, null, ' '))
|
|
226
|
-
|
|
227
|
-
expect(blockSet.blocks[1].offsetPx).toBe(0);
|
|
228
|
-
expect(blockSet.blocks).toMatchSnapshot();
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
describe('reverse block calculation', function () {
|
|
232
|
-
test('1', function () {
|
|
233
|
-
var blocks = (0, _calculateStaticBlocks.default)({
|
|
234
|
-
bpPerPx: 1,
|
|
235
|
-
width: 800,
|
|
236
|
-
offsetPx: 0,
|
|
237
|
-
displayedRegions: [{
|
|
238
|
-
assemblyName: 'test',
|
|
239
|
-
refName: 'ctgA',
|
|
240
|
-
start: 0,
|
|
241
|
-
end: 10000,
|
|
242
|
-
reversed: true
|
|
243
|
-
}],
|
|
244
|
-
minimumBlockWidth: 20,
|
|
245
|
-
interRegionPaddingWidth: 2
|
|
246
|
-
});
|
|
247
|
-
expect(blocks).toMatchSnapshot();
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
describe('reversed displayed regions', function () {
|
|
251
|
-
test('without elided region', function () {
|
|
252
|
-
var blocks = (0, _calculateStaticBlocks.default)({
|
|
253
|
-
bpPerPx: 1,
|
|
254
|
-
width: 800,
|
|
255
|
-
offsetPx: 0,
|
|
256
|
-
displayedRegions: [{
|
|
257
|
-
assemblyName: 'test',
|
|
258
|
-
refName: 'ctgA',
|
|
259
|
-
start: 100,
|
|
260
|
-
end: 200,
|
|
261
|
-
reversed: true
|
|
262
|
-
}, {
|
|
263
|
-
assemblyName: 'test',
|
|
264
|
-
refName: 'ctgA',
|
|
265
|
-
start: 500,
|
|
266
|
-
end: 600,
|
|
267
|
-
reversed: true
|
|
268
|
-
}],
|
|
269
|
-
minimumBlockWidth: 20,
|
|
270
|
-
interRegionPaddingWidth: 2
|
|
271
|
-
});
|
|
272
|
-
expect(blocks).toMatchSnapshot();
|
|
273
|
-
});
|
|
274
|
-
test('with elided region', function () {
|
|
275
|
-
var blocks = (0, _calculateStaticBlocks.default)({
|
|
276
|
-
bpPerPx: 1,
|
|
277
|
-
width: 800,
|
|
278
|
-
offsetPx: 0,
|
|
279
|
-
minimumBlockWidth: 2,
|
|
280
|
-
displayedRegions: [{
|
|
281
|
-
assemblyName: 'test',
|
|
282
|
-
refName: 'ctgA',
|
|
283
|
-
start: 0,
|
|
284
|
-
end: 1,
|
|
285
|
-
reversed: true
|
|
286
|
-
}, {
|
|
287
|
-
assemblyName: 'test',
|
|
288
|
-
refName: 'ctgA',
|
|
289
|
-
start: 0,
|
|
290
|
-
end: 10000,
|
|
291
|
-
reversed: true
|
|
292
|
-
}],
|
|
293
|
-
interRegionPaddingWidth: 2
|
|
294
|
-
}, true, true, 1, 800);
|
|
295
|
-
expect(blocks).toMatchSnapshot();
|
|
296
|
-
});
|
|
297
|
-
});
|
package/util/declare.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _formatFastaStrings = require("./formatFastaStrings");
|
|
4
|
-
|
|
5
|
-
describe('formatting seqChunks and strings into Fasta format', function () {
|
|
6
|
-
var small = 'cattgttgcg';
|
|
7
|
-
var medium = 'cattgttgcggagttgaacaACGGCATTAGGAACACTTCCGTCTCtcacttttatacgattatgattggttctttagcct';
|
|
8
|
-
var large = 'cattgttgcggagttgaacaACGGCATTAGGAACACTTCCGTCTCtcacttttatacgattatgattggttctttagcctt';
|
|
9
|
-
it('sequence length is less than 80 characters', function () {
|
|
10
|
-
var formattedSmallFasta = (0, _formatFastaStrings.formatFastaLines)(small);
|
|
11
|
-
expect(formattedSmallFasta).toMatchSnapshot();
|
|
12
|
-
});
|
|
13
|
-
it('sequence length is 80 characters', function () {
|
|
14
|
-
var formattedMediumFasta = (0, _formatFastaStrings.formatFastaLines)(medium);
|
|
15
|
-
expect(formattedMediumFasta).toMatchSnapshot();
|
|
16
|
-
});
|
|
17
|
-
it('sequence length is more than 80 characters', function () {
|
|
18
|
-
var formattedLargeFasta = (0, _formatFastaStrings.formatFastaLines)(large);
|
|
19
|
-
expect(formattedLargeFasta).toMatchSnapshot();
|
|
20
|
-
});
|
|
21
|
-
it('formats headers and sequence', function () {
|
|
22
|
-
var chunks = [{
|
|
23
|
-
header: 'ctgA:1-10',
|
|
24
|
-
seq: small
|
|
25
|
-
}, {
|
|
26
|
-
header: 'ctgB:1-81',
|
|
27
|
-
seq: large
|
|
28
|
-
}];
|
|
29
|
-
var formattedFastaFile = (0, _formatFastaStrings.formatSeqFasta)(chunks);
|
|
30
|
-
/*
|
|
31
|
-
>ctgA:1-10
|
|
32
|
-
cattgttgcg
|
|
33
|
-
>ctgB:1-81
|
|
34
|
-
cattgttgcggagttgaacaACGGCATTAGGAACACTTCCGTCTCtcacttttatacgattatgattggttctttagcct
|
|
35
|
-
t
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
expect(formattedFastaFile).toMatchSnapshot();
|
|
39
|
-
});
|
|
40
|
-
});
|