@jbrowse/plugin-linear-genome-view 1.7.10 → 2.0.1
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/BaseLinearDisplay/components/BaseLinearDisplay.js +119 -139
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -0
- package/dist/BaseLinearDisplay/components/Block.js +53 -74
- package/dist/BaseLinearDisplay/components/Block.js.map +1 -0
- package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +11 -1
- package/dist/BaseLinearDisplay/components/LinearBlocks.js +64 -103
- package/dist/BaseLinearDisplay/components/LinearBlocks.js.map +1 -0
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +145 -175
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -0
- package/dist/BaseLinearDisplay/components/Tooltip.js +109 -116
- package/dist/BaseLinearDisplay/components/Tooltip.js.map +1 -0
- package/dist/BaseLinearDisplay/index.js +13 -40
- package/dist/BaseLinearDisplay/index.js.map +1 -0
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +20 -15
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +605 -684
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -0
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +15 -22
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -0
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +7 -8
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +266 -312
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -0
- package/dist/LinearBareDisplay/configSchema.js +11 -17
- package/dist/LinearBareDisplay/configSchema.js.map +1 -0
- package/dist/LinearBareDisplay/index.js +7 -20
- package/dist/LinearBareDisplay/index.js.map +1 -0
- package/dist/LinearBareDisplay/model.d.ts +16 -14
- package/dist/LinearBareDisplay/model.js +36 -42
- package/dist/LinearBareDisplay/model.js.map +1 -0
- package/dist/LinearBasicDisplay/components/SetMaxHeight.d.ts +1 -1
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js +76 -85
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -0
- package/dist/LinearBasicDisplay/configSchema.js +15 -23
- package/dist/LinearBasicDisplay/configSchema.js.map +1 -0
- package/dist/LinearBasicDisplay/index.js +10 -22
- package/dist/LinearBasicDisplay/index.js.map +1 -0
- package/dist/LinearBasicDisplay/model.d.ts +20 -15
- package/dist/LinearBasicDisplay/model.js +180 -159
- package/dist/LinearBasicDisplay/model.js.map +1 -0
- package/dist/LinearGenomeView/components/CenterLine.d.ts +2 -8
- package/dist/LinearGenomeView/components/CenterLine.js +60 -74
- package/dist/LinearGenomeView/components/CenterLine.js.map +1 -0
- package/dist/LinearGenomeView/components/ExportSvgDialog.js +141 -141
- package/dist/LinearGenomeView/components/ExportSvgDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/Gridlines.d.ts +8 -0
- package/dist/LinearGenomeView/components/Gridlines.js +78 -0
- package/dist/LinearGenomeView/components/Gridlines.js.map +1 -0
- package/dist/LinearGenomeView/components/Header.js +70 -126
- package/dist/LinearGenomeView/components/Header.js.map +1 -0
- package/dist/LinearGenomeView/components/HelpDialog.d.ts +0 -1
- package/dist/LinearGenomeView/components/HelpDialog.js +62 -44
- package/dist/LinearGenomeView/components/HelpDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/ImportForm.js +223 -320
- package/dist/LinearGenomeView/components/ImportForm.js.map +1 -0
- package/dist/LinearGenomeView/components/LinearGenomeView.js +64 -124
- package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -0
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +198 -337
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -0
- package/dist/LinearGenomeView/components/MiniControls.js +64 -78
- package/dist/LinearGenomeView/components/MiniControls.js.map +1 -0
- package/dist/LinearGenomeView/components/OverviewRubberBand.js +229 -293
- package/dist/LinearGenomeView/components/OverviewRubberBand.js.map +1 -0
- package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +24 -8
- package/dist/LinearGenomeView/components/OverviewScaleBar.js +277 -365
- package/dist/LinearGenomeView/components/OverviewScaleBar.js.map +1 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +1 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +237 -324
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -0
- package/dist/LinearGenomeView/components/RubberBand.js +228 -296
- package/dist/LinearGenomeView/components/RubberBand.js.map +1 -0
- package/dist/LinearGenomeView/components/Ruler.js +45 -90
- package/dist/LinearGenomeView/components/Ruler.js.map +1 -0
- package/dist/LinearGenomeView/components/ScaleBar.d.ts +8 -403
- package/dist/LinearGenomeView/components/ScaleBar.js +121 -172
- package/dist/LinearGenomeView/components/ScaleBar.js.map +1 -0
- package/dist/LinearGenomeView/components/SearchBox.js +158 -205
- package/dist/LinearGenomeView/components/SearchBox.js.map +1 -0
- package/dist/LinearGenomeView/components/SearchResultsDialog.d.ts +0 -1
- package/dist/LinearGenomeView/components/SearchResultsDialog.js +105 -150
- package/dist/LinearGenomeView/components/SearchResultsDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/SequenceDialog.js +219 -272
- package/dist/LinearGenomeView/components/SequenceDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/TrackContainer.js +116 -156
- package/dist/LinearGenomeView/components/TrackContainer.js.map +1 -0
- package/dist/LinearGenomeView/components/TrackLabel.d.ts +6 -42
- package/dist/LinearGenomeView/components/TrackLabel.js +115 -134
- package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -0
- package/dist/LinearGenomeView/components/TracksContainer.d.ts +1 -1
- package/dist/LinearGenomeView/components/TracksContainer.js +172 -199
- package/dist/LinearGenomeView/components/TracksContainer.js.map +1 -0
- package/dist/LinearGenomeView/components/ZoomControls.js +72 -87
- package/dist/LinearGenomeView/components/ZoomControls.js.map +1 -0
- package/dist/LinearGenomeView/components/util.d.ts +12 -0
- package/dist/LinearGenomeView/components/util.js +95 -13
- package/dist/LinearGenomeView/components/util.js.map +1 -0
- package/dist/LinearGenomeView/index.d.ts +64 -77
- package/dist/LinearGenomeView/index.js +1035 -1412
- package/dist/LinearGenomeView/index.js.map +1 -0
- package/dist/LinearGenomeView/util.js +76 -83
- package/dist/LinearGenomeView/util.js.map +1 -0
- package/dist/index.d.ts +101 -51
- package/dist/index.js +225 -295
- package/dist/index.js.map +1 -0
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +9 -0
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +68 -0
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -0
- package/esm/BaseLinearDisplay/components/Block.d.ts +15 -0
- package/esm/BaseLinearDisplay/components/Block.js +46 -0
- package/esm/BaseLinearDisplay/components/Block.js.map +1 -0
- package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +22 -0
- package/esm/BaseLinearDisplay/components/LinearBlocks.js +62 -0
- package/esm/BaseLinearDisplay/components/LinearBlocks.js.map +1 -0
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.d.ts +4 -0
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +113 -0
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -0
- package/esm/BaseLinearDisplay/components/Tooltip.d.ts +8 -0
- package/esm/BaseLinearDisplay/components/Tooltip.js +64 -0
- package/esm/BaseLinearDisplay/components/Tooltip.js.map +1 -0
- package/esm/BaseLinearDisplay/index.d.ts +5 -0
- package/esm/BaseLinearDisplay/index.js +4 -0
- package/esm/BaseLinearDisplay/index.js.map +1 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +232 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +541 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -0
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.d.ts +1 -0
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +14 -0
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +96 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +225 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -0
- package/esm/LinearBareDisplay/configSchema.d.ts +2 -0
- package/esm/LinearBareDisplay/configSchema.js +9 -0
- package/esm/LinearBareDisplay/configSchema.js.map +1 -0
- package/esm/LinearBareDisplay/index.d.ts +2 -0
- package/esm/LinearBareDisplay/index.js +3 -0
- package/esm/LinearBareDisplay/index.js.map +1 -0
- package/esm/LinearBareDisplay/model.d.ts +194 -0
- package/esm/LinearBareDisplay/model.js +28 -0
- package/esm/LinearBareDisplay/model.js.map +1 -0
- package/esm/LinearBasicDisplay/components/SetMaxHeight.d.ts +10 -0
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js +40 -0
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -0
- package/esm/LinearBasicDisplay/configSchema.d.ts +2 -0
- package/esm/LinearBasicDisplay/configSchema.js +14 -0
- package/esm/LinearBasicDisplay/configSchema.js.map +1 -0
- package/esm/LinearBasicDisplay/index.d.ts +2 -0
- package/esm/LinearBasicDisplay/index.js +3 -0
- package/esm/LinearBasicDisplay/index.js.map +1 -0
- package/esm/LinearBasicDisplay/model.d.ts +218 -0
- package/esm/LinearBasicDisplay/model.js +127 -0
- package/esm/LinearBasicDisplay/model.js.map +1 -0
- package/esm/LinearGenomeView/components/CenterLine.d.ts +8 -0
- package/esm/LinearGenomeView/components/CenterLine.js +40 -0
- package/esm/LinearGenomeView/components/CenterLine.js.map +1 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +6 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.js +52 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/Gridlines.d.ts +8 -0
- package/esm/LinearGenomeView/components/Gridlines.js +71 -0
- package/esm/LinearGenomeView/components/Gridlines.js.map +1 -0
- package/esm/LinearGenomeView/components/Header.d.ts +7 -0
- package/esm/LinearGenomeView/components/Header.js +81 -0
- package/esm/LinearGenomeView/components/Header.js.map +1 -0
- package/esm/LinearGenomeView/components/HelpDialog.d.ts +4 -0
- package/esm/LinearGenomeView/components/HelpDialog.js +58 -0
- package/esm/LinearGenomeView/components/HelpDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/ImportForm.d.ts +7 -0
- package/esm/LinearGenomeView/components/ImportForm.js +141 -0
- package/esm/LinearGenomeView/components/ImportForm.js.map +1 -0
- package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +7 -0
- package/esm/LinearGenomeView/components/LinearGenomeView.js +67 -0
- package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +4 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +132 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -0
- package/esm/LinearGenomeView/components/MiniControls.d.ts +6 -0
- package/esm/LinearGenomeView/components/MiniControls.js +25 -0
- package/esm/LinearGenomeView/components/MiniControls.js.map +1 -0
- package/esm/LinearGenomeView/components/OverviewRubberBand.d.ts +22 -0
- package/esm/LinearGenomeView/components/OverviewRubberBand.js +197 -0
- package/esm/LinearGenomeView/components/OverviewRubberBand.js.map +1 -0
- package/esm/LinearGenomeView/components/OverviewScaleBar.d.ts +148 -0
- package/esm/LinearGenomeView/components/OverviewScaleBar.js +287 -0
- package/esm/LinearGenomeView/components/OverviewScaleBar.js.map +1 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.d.ts +22 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js +136 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -0
- package/esm/LinearGenomeView/components/RubberBand.d.ts +9 -0
- package/esm/LinearGenomeView/components/RubberBand.js +197 -0
- package/esm/LinearGenomeView/components/RubberBand.js.map +1 -0
- package/esm/LinearGenomeView/components/Ruler.d.ts +27 -0
- package/esm/LinearGenomeView/components/Ruler.js +50 -0
- package/esm/LinearGenomeView/components/Ruler.js.map +1 -0
- package/esm/LinearGenomeView/components/ScaleBar.d.ts +10 -0
- package/esm/LinearGenomeView/components/ScaleBar.js +112 -0
- package/esm/LinearGenomeView/components/ScaleBar.js.map +1 -0
- package/esm/LinearGenomeView/components/SearchBox.d.ts +8 -0
- package/esm/LinearGenomeView/components/SearchBox.js +94 -0
- package/esm/LinearGenomeView/components/SearchBox.js.map +1 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.d.ts +7 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.js +107 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/SequenceDialog.d.ts +8 -0
- package/esm/LinearGenomeView/components/SequenceDialog.js +147 -0
- package/esm/LinearGenomeView/components/SequenceDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/TrackContainer.d.ts +9 -0
- package/esm/LinearGenomeView/components/TrackContainer.js +109 -0
- package/esm/LinearGenomeView/components/TrackContainer.js.map +1 -0
- package/esm/LinearGenomeView/components/TrackLabel.d.ts +8 -0
- package/esm/LinearGenomeView/components/TrackLabel.js +89 -0
- package/esm/LinearGenomeView/components/TrackLabel.js.map +1 -0
- package/{dist/LinearGenomeView/components/VerticalGuides.d.ts → esm/LinearGenomeView/components/TracksContainer.d.ts} +4 -3
- package/esm/LinearGenomeView/components/TracksContainer.js +142 -0
- package/esm/LinearGenomeView/components/TracksContainer.js.map +1 -0
- package/esm/LinearGenomeView/components/ZoomControls.d.ts +7 -0
- package/esm/LinearGenomeView/components/ZoomControls.js +32 -0
- package/esm/LinearGenomeView/components/ZoomControls.js.map +1 -0
- package/esm/LinearGenomeView/components/util.d.ts +14 -0
- package/esm/LinearGenomeView/components/util.js +17 -0
- package/esm/LinearGenomeView/components/util.js.map +1 -0
- package/esm/LinearGenomeView/index.d.ts +275 -0
- package/esm/LinearGenomeView/index.js +978 -0
- package/esm/LinearGenomeView/index.js.map +1 -0
- package/esm/LinearGenomeView/util.d.ts +14 -0
- package/esm/LinearGenomeView/util.js +62 -0
- package/esm/LinearGenomeView/util.js.map +1 -0
- package/esm/index.d.ts +615 -0
- package/esm/index.js +127 -0
- package/esm/index.js.map +1 -0
- package/package.json +22 -15
- package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +4 -3
- package/src/BaseLinearDisplay/components/Block.tsx +5 -5
- package/src/BaseLinearDisplay/components/LinearBlocks.tsx +4 -4
- package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +7 -8
- package/src/BaseLinearDisplay/components/Tooltip.tsx +14 -4
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +6 -4
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +1 -1
- package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +10 -7
- package/src/LinearBasicDisplay/model.ts +21 -15
- package/src/LinearGenomeView/components/CenterLine.tsx +6 -11
- package/src/LinearGenomeView/components/ExportSvgDialog.tsx +5 -5
- package/src/LinearGenomeView/components/{VerticalGuides.tsx → Gridlines.tsx} +9 -11
- package/src/LinearGenomeView/components/Header.tsx +13 -18
- package/src/LinearGenomeView/components/HelpDialog.tsx +5 -5
- package/src/LinearGenomeView/components/ImportForm.tsx +24 -37
- package/src/LinearGenomeView/components/LinearGenomeView.test.js +16 -6
- package/src/LinearGenomeView/components/LinearGenomeView.tsx +4 -3
- package/src/LinearGenomeView/components/MiniControls.tsx +29 -40
- package/src/LinearGenomeView/components/OverviewRubberBand.tsx +20 -29
- package/src/LinearGenomeView/components/OverviewScaleBar.tsx +100 -89
- package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +13 -44
- package/src/LinearGenomeView/components/RubberBand.tsx +12 -18
- package/src/LinearGenomeView/components/Ruler.tsx +5 -11
- package/src/LinearGenomeView/components/ScaleBar.tsx +23 -27
- package/src/LinearGenomeView/components/SearchBox.tsx +22 -32
- package/src/LinearGenomeView/components/SearchResultsDialog.tsx +7 -7
- package/src/LinearGenomeView/components/SequenceDialog.tsx +10 -10
- package/src/LinearGenomeView/components/TrackContainer.tsx +12 -12
- package/src/LinearGenomeView/components/TrackLabel.tsx +21 -31
- package/src/LinearGenomeView/components/TracksContainer.tsx +10 -15
- package/src/LinearGenomeView/components/ZoomControls.tsx +12 -13
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +500 -547
- package/src/LinearGenomeView/components/util.ts +43 -0
- package/src/LinearGenomeView/index.test.ts +14 -36
- package/src/LinearGenomeView/index.tsx +390 -564
- package/src/index.ts +1 -1
- package/dist/LinearBareDisplay/index.test.js +0 -33
- package/dist/LinearGenomeView/components/LinearGenomeView.test.js +0 -234
- package/dist/LinearGenomeView/components/ScaleBar.test.js +0 -180
- package/dist/LinearGenomeView/components/VerticalGuides.js +0 -116
- package/dist/LinearGenomeView/index.test.js +0 -1187
- package/dist/LinearGenomeView/util.test.js +0 -78
|
@@ -1,1187 +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 _configuration = require("@jbrowse/core/configuration");
|
|
10
|
-
|
|
11
|
-
var _DisplayType = _interopRequireDefault(require("@jbrowse/core/pluggableElementTypes/DisplayType"));
|
|
12
|
-
|
|
13
|
-
var _models = require("@jbrowse/core/pluggableElementTypes/models");
|
|
14
|
-
|
|
15
|
-
var _TrackType = _interopRequireDefault(require("@jbrowse/core/pluggableElementTypes/TrackType"));
|
|
16
|
-
|
|
17
|
-
var _PluginManager = _interopRequireDefault(require("@jbrowse/core/PluginManager"));
|
|
18
|
-
|
|
19
|
-
var _mobxStateTree = require("mobx-state-tree");
|
|
20
|
-
|
|
21
|
-
var _ = require(".");
|
|
22
|
-
|
|
23
|
-
var _2 = require("..");
|
|
24
|
-
|
|
25
|
-
var _LinearBareDisplay = require("../LinearBareDisplay");
|
|
26
|
-
|
|
27
|
-
var _hg38DisplayedRegions = _interopRequireDefault(require("./hg38DisplayedRegions.json"));
|
|
28
|
-
|
|
29
|
-
var _volvoxDisplayedRegions = _interopRequireDefault(require("./volvoxDisplayedRegions.json"));
|
|
30
|
-
|
|
31
|
-
// use initializer function to avoid having console.warn jest.fn in a global
|
|
32
|
-
function initialize() {
|
|
33
|
-
console.warn = jest.fn(); // a stub linear genome view state model that only accepts base track types.
|
|
34
|
-
// used in unit tests.
|
|
35
|
-
|
|
36
|
-
var stubManager = new _PluginManager.default();
|
|
37
|
-
stubManager.addTrackType(function () {
|
|
38
|
-
var configSchema = (0, _configuration.ConfigurationSchema)('BasicTrack', {}, {
|
|
39
|
-
baseConfiguration: (0, _models.createBaseTrackConfig)(stubManager),
|
|
40
|
-
explicitIdentifier: 'trackId'
|
|
41
|
-
});
|
|
42
|
-
return new _TrackType.default({
|
|
43
|
-
name: 'BasicTrack',
|
|
44
|
-
configSchema: configSchema,
|
|
45
|
-
stateModel: (0, _models.createBaseTrackModel)(stubManager, 'BasicTrack', configSchema)
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
stubManager.addDisplayType(function () {
|
|
49
|
-
var configSchema = (0, _configuration.ConfigurationSchema)('LinearBareDisplay', {}, {
|
|
50
|
-
explicitlyTyped: true
|
|
51
|
-
});
|
|
52
|
-
return new _DisplayType.default({
|
|
53
|
-
name: 'LinearBareDisplay',
|
|
54
|
-
configSchema: configSchema,
|
|
55
|
-
stateModel: (0, _LinearBareDisplay.stateModelFactory)(configSchema),
|
|
56
|
-
trackType: 'BasicTrack',
|
|
57
|
-
viewType: 'LinearGenomeView',
|
|
58
|
-
ReactComponent: _2.BaseLinearDisplayComponent
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
stubManager.createPluggableElements();
|
|
62
|
-
stubManager.configure();
|
|
63
|
-
|
|
64
|
-
var Assembly = _mobxStateTree.types.model({}).volatile(function () {
|
|
65
|
-
return {
|
|
66
|
-
regions: _volvoxDisplayedRegions.default
|
|
67
|
-
};
|
|
68
|
-
}).views(function () {
|
|
69
|
-
return {
|
|
70
|
-
getCanonicalRefName: function getCanonicalRefName(refName) {
|
|
71
|
-
if (refName === 'contigA') {
|
|
72
|
-
return 'ctgA';
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return refName;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
var AssemblyManager = _mobxStateTree.types.model({
|
|
81
|
-
assemblies: _mobxStateTree.types.map(Assembly)
|
|
82
|
-
}).actions(function (self) {
|
|
83
|
-
return {
|
|
84
|
-
isValidRefName: function isValidRefName(str) {
|
|
85
|
-
return str === 'ctgA' || str === 'ctgB';
|
|
86
|
-
},
|
|
87
|
-
get: function get(str) {
|
|
88
|
-
return self.assemblies.get(str);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
var LinearGenomeModel = (0, _.stateModelFactory)(stubManager);
|
|
94
|
-
|
|
95
|
-
var Session = _mobxStateTree.types.model({
|
|
96
|
-
name: 'testSession',
|
|
97
|
-
rpcManager: 'rpcManagerExists',
|
|
98
|
-
view: _mobxStateTree.types.maybe(LinearGenomeModel),
|
|
99
|
-
configuration: _mobxStateTree.types.map(_mobxStateTree.types.string),
|
|
100
|
-
assemblyManager: _mobxStateTree.types.optional(AssemblyManager, {
|
|
101
|
-
assemblies: {
|
|
102
|
-
volvox: {
|
|
103
|
-
regions: _volvoxDisplayedRegions.default
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
}).actions(function (self) {
|
|
108
|
-
return {
|
|
109
|
-
setView: function setView(view) {
|
|
110
|
-
self.view = view;
|
|
111
|
-
return view;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
return {
|
|
117
|
-
Session: Session,
|
|
118
|
-
LinearGenomeModel: LinearGenomeModel,
|
|
119
|
-
Assembly: Assembly
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
test('can instantiate a mostly empty model and read a default configuration value', function () {
|
|
124
|
-
var _initialize = initialize(),
|
|
125
|
-
Session = _initialize.Session,
|
|
126
|
-
LinearGenomeModel = _initialize.LinearGenomeModel;
|
|
127
|
-
|
|
128
|
-
var model = Session.create({
|
|
129
|
-
configuration: {}
|
|
130
|
-
}).setView(LinearGenomeModel.create({
|
|
131
|
-
type: 'LinearGenomeView',
|
|
132
|
-
tracks: [{
|
|
133
|
-
name: 'foo track',
|
|
134
|
-
type: 'BasicTrack'
|
|
135
|
-
}]
|
|
136
|
-
}));
|
|
137
|
-
expect(model.tracks[0]).toBeTruthy();
|
|
138
|
-
expect(model.trackSelectorType).toBe('hierarchical');
|
|
139
|
-
});
|
|
140
|
-
test('can instantiate a model that lets you navigate', function () {
|
|
141
|
-
var _initialize2 = initialize(),
|
|
142
|
-
Session = _initialize2.Session,
|
|
143
|
-
LinearGenomeModel = _initialize2.LinearGenomeModel;
|
|
144
|
-
|
|
145
|
-
var session = Session.create({
|
|
146
|
-
configuration: {}
|
|
147
|
-
});
|
|
148
|
-
var model = session.setView(LinearGenomeModel.create({
|
|
149
|
-
id: 'test1',
|
|
150
|
-
type: 'LinearGenomeView',
|
|
151
|
-
tracks: [{
|
|
152
|
-
name: 'foo track',
|
|
153
|
-
type: 'BasicTrack'
|
|
154
|
-
}]
|
|
155
|
-
}));
|
|
156
|
-
model.setWidth(800);
|
|
157
|
-
model.setDisplayedRegions([{
|
|
158
|
-
assemblyName: 'volvox',
|
|
159
|
-
start: 0,
|
|
160
|
-
end: 10000,
|
|
161
|
-
refName: 'ctgA'
|
|
162
|
-
}]);
|
|
163
|
-
expect(model.maxBpPerPx).toBeCloseTo(13.888);
|
|
164
|
-
model.setNewView(0.02, 0);
|
|
165
|
-
expect(model.scaleBarHeight).toEqual(20); // header height 20 + area where polygons get drawn has height of 48
|
|
166
|
-
|
|
167
|
-
expect(model.headerHeight).toEqual(68); // TODO: figure out how to better test height
|
|
168
|
-
// expect(model.height).toBe(191)
|
|
169
|
-
// test some sanity values from zooming around
|
|
170
|
-
|
|
171
|
-
model.setNewView(0.02, 0);
|
|
172
|
-
expect(model.pxToBp(10).offset).toEqual(0.2);
|
|
173
|
-
model.setNewView(0.1, 0);
|
|
174
|
-
expect(model.pxToBp(100).offset).toEqual(10);
|
|
175
|
-
model.setNewView(1, 0);
|
|
176
|
-
expect(model.pxToBp(100).offset).toEqual(100);
|
|
177
|
-
model.setNewView(10, 0);
|
|
178
|
-
expect(model.pxToBp(100).offset).toEqual(1000);
|
|
179
|
-
model.horizontallyFlip(); // this is actually the same in reverse mode, the offset is a representation of linear bp offset not actual bp
|
|
180
|
-
|
|
181
|
-
model.setNewView(0.02, 0);
|
|
182
|
-
expect(model.pxToBp(10).offset).toEqual(0.2);
|
|
183
|
-
model.setNewView(0.1, 0);
|
|
184
|
-
expect(model.pxToBp(100).offset).toEqual(10);
|
|
185
|
-
model.setNewView(1, 0);
|
|
186
|
-
expect(model.pxToBp(100).offset).toEqual(100);
|
|
187
|
-
model.setNewView(10, 0);
|
|
188
|
-
expect(model.pxToBp(100).offset).toEqual(1000);
|
|
189
|
-
});
|
|
190
|
-
test('can instantiate a model that has multiple displayed regions', function () {
|
|
191
|
-
var _initialize3 = initialize(),
|
|
192
|
-
Session = _initialize3.Session,
|
|
193
|
-
LinearGenomeModel = _initialize3.LinearGenomeModel;
|
|
194
|
-
|
|
195
|
-
var session = Session.create({
|
|
196
|
-
configuration: {}
|
|
197
|
-
});
|
|
198
|
-
var model = session.setView(LinearGenomeModel.create({
|
|
199
|
-
id: 'test2',
|
|
200
|
-
type: 'LinearGenomeView',
|
|
201
|
-
tracks: [{
|
|
202
|
-
name: 'foo track',
|
|
203
|
-
type: 'BasicTrack'
|
|
204
|
-
}]
|
|
205
|
-
}));
|
|
206
|
-
model.setWidth(800);
|
|
207
|
-
model.setDisplayedRegions([{
|
|
208
|
-
assemblyName: 'volvox',
|
|
209
|
-
start: 0,
|
|
210
|
-
end: 10000,
|
|
211
|
-
refName: 'ctgA'
|
|
212
|
-
}, {
|
|
213
|
-
assemblyName: 'volvox',
|
|
214
|
-
start: 0,
|
|
215
|
-
end: 10000,
|
|
216
|
-
refName: 'ctgB'
|
|
217
|
-
}]);
|
|
218
|
-
expect(model.maxBpPerPx).toBeCloseTo(27.777);
|
|
219
|
-
model.setNewView(0.02, 0);
|
|
220
|
-
expect(model.offsetPx).toEqual(0);
|
|
221
|
-
model.moveTo({
|
|
222
|
-
index: 0,
|
|
223
|
-
offset: 100
|
|
224
|
-
}, {
|
|
225
|
-
index: 0,
|
|
226
|
-
offset: 200
|
|
227
|
-
});
|
|
228
|
-
expect(model.offsetPx).toEqual(800);
|
|
229
|
-
model.moveTo({
|
|
230
|
-
index: 0,
|
|
231
|
-
offset: 9950
|
|
232
|
-
}, {
|
|
233
|
-
index: 1,
|
|
234
|
-
offset: 50
|
|
235
|
-
});
|
|
236
|
-
expect(model.offsetPx).toEqual(79401);
|
|
237
|
-
});
|
|
238
|
-
test('can instantiate a model that tests navTo/moveTo', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
239
|
-
var _initialize4, Session, LinearGenomeModel, session, width, model;
|
|
240
|
-
|
|
241
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
242
|
-
while (1) {
|
|
243
|
-
switch (_context.prev = _context.next) {
|
|
244
|
-
case 0:
|
|
245
|
-
_initialize4 = initialize(), Session = _initialize4.Session, LinearGenomeModel = _initialize4.LinearGenomeModel;
|
|
246
|
-
session = Session.create({
|
|
247
|
-
configuration: {}
|
|
248
|
-
});
|
|
249
|
-
width = 800;
|
|
250
|
-
model = session.setView(LinearGenomeModel.create({
|
|
251
|
-
id: 'test3',
|
|
252
|
-
type: 'LinearGenomeView',
|
|
253
|
-
tracks: [{
|
|
254
|
-
name: 'foo track',
|
|
255
|
-
type: 'BasicTrack'
|
|
256
|
-
}]
|
|
257
|
-
}));
|
|
258
|
-
model.setWidth(width);
|
|
259
|
-
model.setDisplayedRegions([{
|
|
260
|
-
assemblyName: 'volvox',
|
|
261
|
-
start: 0,
|
|
262
|
-
end: 10000,
|
|
263
|
-
refName: 'ctgA'
|
|
264
|
-
}, {
|
|
265
|
-
assemblyName: 'volvox',
|
|
266
|
-
start: 0,
|
|
267
|
-
end: 10000,
|
|
268
|
-
refName: 'ctgB'
|
|
269
|
-
}]);
|
|
270
|
-
expect(model.maxBpPerPx).toBeCloseTo(27.7777);
|
|
271
|
-
model.navTo({
|
|
272
|
-
refName: 'ctgA',
|
|
273
|
-
start: 0,
|
|
274
|
-
end: 100
|
|
275
|
-
});
|
|
276
|
-
expect(model.offsetPx).toBe(0);
|
|
277
|
-
expect(model.bpPerPx).toBe(0.125);
|
|
278
|
-
model.navTo({
|
|
279
|
-
refName: 'ctgA'
|
|
280
|
-
});
|
|
281
|
-
expect(model.offsetPx).toBe(0);
|
|
282
|
-
expect(model.bpPerPx).toBe(12.5);
|
|
283
|
-
model.navTo({
|
|
284
|
-
refName: 'contigA',
|
|
285
|
-
start: 0,
|
|
286
|
-
end: 100
|
|
287
|
-
});
|
|
288
|
-
expect(model.offsetPx).toBe(0);
|
|
289
|
-
expect(model.bpPerPx).toBe(0.125);
|
|
290
|
-
expect(function () {
|
|
291
|
-
return model.navTo({
|
|
292
|
-
refName: 'ctgA',
|
|
293
|
-
start: 200,
|
|
294
|
-
end: 100
|
|
295
|
-
});
|
|
296
|
-
}).toThrow('start "201" is greater than end "100"');
|
|
297
|
-
expect(function () {
|
|
298
|
-
return model.navTo({
|
|
299
|
-
refName: 'ctgDoesNotExist',
|
|
300
|
-
start: 0,
|
|
301
|
-
end: 100
|
|
302
|
-
});
|
|
303
|
-
}).toThrow('could not find a region with refName "ctgDoesNotExist"');
|
|
304
|
-
expect(function () {
|
|
305
|
-
return model.navTo({
|
|
306
|
-
refName: 'ctgA',
|
|
307
|
-
end: 20100
|
|
308
|
-
});
|
|
309
|
-
}).toThrow('could not find a region with refName "ctgA" that contained an end position 20100');
|
|
310
|
-
expect(function () {
|
|
311
|
-
return model.navTo({
|
|
312
|
-
refName: 'ctgA',
|
|
313
|
-
start: 20000
|
|
314
|
-
});
|
|
315
|
-
}).toThrow('could not find a region with refName "ctgA" that contained a start position 20001');
|
|
316
|
-
expect(function () {
|
|
317
|
-
return model.navTo({
|
|
318
|
-
refName: 'ctgA',
|
|
319
|
-
start: 20000,
|
|
320
|
-
end: 20100
|
|
321
|
-
});
|
|
322
|
-
}).toThrow('could not find a region that completely contained "ctgA:20,001..20,100"');
|
|
323
|
-
expect(function () {
|
|
324
|
-
return model.navTo({
|
|
325
|
-
refName: 'ctgA',
|
|
326
|
-
start: 0,
|
|
327
|
-
end: 20000
|
|
328
|
-
});
|
|
329
|
-
}).toThrow('could not find a region that completely contained "ctgA:1..20,000"');
|
|
330
|
-
|
|
331
|
-
case 22:
|
|
332
|
-
case "end":
|
|
333
|
-
return _context.stop();
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}, _callee);
|
|
337
|
-
})));
|
|
338
|
-
test('can navToMultiple', function () {
|
|
339
|
-
var _initialize5 = initialize(),
|
|
340
|
-
Session = _initialize5.Session,
|
|
341
|
-
LinearGenomeModel = _initialize5.LinearGenomeModel;
|
|
342
|
-
|
|
343
|
-
var session = Session.create({
|
|
344
|
-
configuration: {}
|
|
345
|
-
});
|
|
346
|
-
var width = 800;
|
|
347
|
-
var model = session.setView(LinearGenomeModel.create({
|
|
348
|
-
id: 'testNavToMultiple',
|
|
349
|
-
type: 'LinearGenomeView'
|
|
350
|
-
}));
|
|
351
|
-
model.setWidth(width);
|
|
352
|
-
model.setDisplayedRegions([{
|
|
353
|
-
assemblyName: 'volvox',
|
|
354
|
-
refName: 'ctgA',
|
|
355
|
-
start: 0,
|
|
356
|
-
end: 10000
|
|
357
|
-
}, {
|
|
358
|
-
assemblyName: 'volvox',
|
|
359
|
-
refName: 'ctgB',
|
|
360
|
-
start: 0,
|
|
361
|
-
end: 10000
|
|
362
|
-
}, {
|
|
363
|
-
assemblyName: 'volvox',
|
|
364
|
-
refName: 'ctgC',
|
|
365
|
-
start: 0,
|
|
366
|
-
end: 10000
|
|
367
|
-
}, {
|
|
368
|
-
assemblyName: 'volvox',
|
|
369
|
-
refName: 'ctgA',
|
|
370
|
-
start: 0,
|
|
371
|
-
end: 10000
|
|
372
|
-
}, {
|
|
373
|
-
assemblyName: 'volvox',
|
|
374
|
-
refName: 'ctgC',
|
|
375
|
-
start: 0,
|
|
376
|
-
end: 10000
|
|
377
|
-
}]);
|
|
378
|
-
model.navToMultiple([{
|
|
379
|
-
refName: 'ctgA',
|
|
380
|
-
start: 0,
|
|
381
|
-
end: 10000
|
|
382
|
-
}]);
|
|
383
|
-
expect(model.offsetPx).toBe(0);
|
|
384
|
-
expect(model.bpPerPx).toBe(12.5);
|
|
385
|
-
model.navToMultiple([{
|
|
386
|
-
refName: 'ctgA',
|
|
387
|
-
start: 5000,
|
|
388
|
-
end: 10000
|
|
389
|
-
}, {
|
|
390
|
-
refName: 'ctgB',
|
|
391
|
-
start: 0,
|
|
392
|
-
end: 5000
|
|
393
|
-
}]);
|
|
394
|
-
expect(model.offsetPx).toBe(399);
|
|
395
|
-
expect(model.bpPerPx).toBeCloseTo(12.531);
|
|
396
|
-
model.navToMultiple([{
|
|
397
|
-
refName: 'ctgA',
|
|
398
|
-
start: 5000,
|
|
399
|
-
end: 10000
|
|
400
|
-
}, {
|
|
401
|
-
refName: 'ctgB',
|
|
402
|
-
start: 0,
|
|
403
|
-
end: 10000
|
|
404
|
-
}, {
|
|
405
|
-
refName: 'ctgC',
|
|
406
|
-
start: 0,
|
|
407
|
-
end: 5000
|
|
408
|
-
}]);
|
|
409
|
-
expect(model.offsetPx).toBe(199);
|
|
410
|
-
expect(model.bpPerPx).toBeCloseTo(25.126);
|
|
411
|
-
model.navToMultiple([{
|
|
412
|
-
refName: 'ctgA',
|
|
413
|
-
start: 5000,
|
|
414
|
-
end: 10000
|
|
415
|
-
}, {
|
|
416
|
-
refName: 'ctgC',
|
|
417
|
-
start: 0,
|
|
418
|
-
end: 5000
|
|
419
|
-
}]);
|
|
420
|
-
expect(model.offsetPx).toBe(2799);
|
|
421
|
-
expect(model.bpPerPx).toBeCloseTo(12.531);
|
|
422
|
-
});
|
|
423
|
-
describe('Zoom to selected displayed regions', function () {
|
|
424
|
-
var _initialize6 = initialize(),
|
|
425
|
-
Session = _initialize6.Session,
|
|
426
|
-
LinearGenomeModel = _initialize6.LinearGenomeModel;
|
|
427
|
-
|
|
428
|
-
var model;
|
|
429
|
-
var largestBpPerPx;
|
|
430
|
-
beforeEach(function () {
|
|
431
|
-
var session = Session.create({
|
|
432
|
-
configuration: {}
|
|
433
|
-
});
|
|
434
|
-
var width = 800;
|
|
435
|
-
model = session.setView(LinearGenomeModel.create({
|
|
436
|
-
id: 'testZoomToDisplayed',
|
|
437
|
-
type: 'LinearGenomeView'
|
|
438
|
-
}));
|
|
439
|
-
model.setWidth(width);
|
|
440
|
-
model.setDisplayedRegions([{
|
|
441
|
-
assemblyName: 'volvox',
|
|
442
|
-
refName: 'ctgA',
|
|
443
|
-
start: 5000,
|
|
444
|
-
end: 20000
|
|
445
|
-
}, {
|
|
446
|
-
assemblyName: 'volvox',
|
|
447
|
-
refName: 'ctgA',
|
|
448
|
-
start: 30000,
|
|
449
|
-
end: 40000
|
|
450
|
-
}, {
|
|
451
|
-
assemblyName: 'volvox',
|
|
452
|
-
refName: 'ctgB',
|
|
453
|
-
start: 0,
|
|
454
|
-
end: 3000
|
|
455
|
-
}]);
|
|
456
|
-
});
|
|
457
|
-
it('can select whole region', function () {
|
|
458
|
-
// should have no offset and largest bpPerPx
|
|
459
|
-
expect(model.offsetPx).toBe(0);
|
|
460
|
-
expect(model.bpPerPx).toEqual(1); // 'ctgA' 15000 bp+ 'ctgA' 10000 bp+ 'ctgB' 3000 bp = 28000 totalbp
|
|
461
|
-
|
|
462
|
-
expect(model.totalBp).toEqual(28000);
|
|
463
|
-
model.zoomToDisplayedRegions({
|
|
464
|
-
start: 5000,
|
|
465
|
-
index: 0,
|
|
466
|
-
end: 20000,
|
|
467
|
-
coord: 5001,
|
|
468
|
-
offset: 0,
|
|
469
|
-
refName: 'ctgA'
|
|
470
|
-
}, {
|
|
471
|
-
start: 0,
|
|
472
|
-
index: 2,
|
|
473
|
-
coord: 1,
|
|
474
|
-
end: 3000,
|
|
475
|
-
offset: 1,
|
|
476
|
-
refName: 'ctgB'
|
|
477
|
-
});
|
|
478
|
-
largestBpPerPx = model.bpPerPx;
|
|
479
|
-
expect(model.offsetPx).toEqual(0);
|
|
480
|
-
expect(model.bpPerPx).toBeCloseTo(31.408);
|
|
481
|
-
});
|
|
482
|
-
it('can select if start and end object are swapped', function () {
|
|
483
|
-
// should be same results as above test
|
|
484
|
-
model.zoomToDisplayedRegions({
|
|
485
|
-
start: 0,
|
|
486
|
-
index: 2,
|
|
487
|
-
coord: 1,
|
|
488
|
-
end: 3000,
|
|
489
|
-
offset: 1,
|
|
490
|
-
refName: 'ctgB'
|
|
491
|
-
}, {
|
|
492
|
-
start: 5000,
|
|
493
|
-
index: 0,
|
|
494
|
-
end: 20000,
|
|
495
|
-
coord: 5001,
|
|
496
|
-
offset: 0,
|
|
497
|
-
refName: 'ctgA'
|
|
498
|
-
});
|
|
499
|
-
expect(model.offsetPx).toEqual(0);
|
|
500
|
-
expect(model.bpPerPx).toBeCloseTo(31.408);
|
|
501
|
-
});
|
|
502
|
-
it('can select over one refSeq', function () {
|
|
503
|
-
model.zoomToDisplayedRegions({
|
|
504
|
-
start: 5000,
|
|
505
|
-
index: 0,
|
|
506
|
-
end: 20000,
|
|
507
|
-
coord: 5001,
|
|
508
|
-
offset: 0,
|
|
509
|
-
refName: 'ctgA'
|
|
510
|
-
}, {
|
|
511
|
-
start: 5000,
|
|
512
|
-
index: 0,
|
|
513
|
-
coord: 10000,
|
|
514
|
-
end: 20000,
|
|
515
|
-
offset: 5000,
|
|
516
|
-
refName: 'ctgA'
|
|
517
|
-
});
|
|
518
|
-
expect(model.offsetPx).toEqual(0); // 10000 - 5000 = 5000 / 800 = 6.25
|
|
519
|
-
|
|
520
|
-
expect(model.bpPerPx).toEqual(6.25);
|
|
521
|
-
expect(model.bpPerPx).toBeLessThan(largestBpPerPx);
|
|
522
|
-
});
|
|
523
|
-
it('can select one region with start or end outside of displayed region', function () {
|
|
524
|
-
model.zoomToDisplayedRegions({
|
|
525
|
-
start: 5000,
|
|
526
|
-
index: 0,
|
|
527
|
-
end: 20000,
|
|
528
|
-
coord: 4999,
|
|
529
|
-
offset: -1,
|
|
530
|
-
refName: 'ctgA'
|
|
531
|
-
}, {
|
|
532
|
-
start: 5000,
|
|
533
|
-
index: 0,
|
|
534
|
-
end: 20000,
|
|
535
|
-
coord: 19000,
|
|
536
|
-
offset: 19000,
|
|
537
|
-
refName: 'ctgA'
|
|
538
|
-
}); // offsetPx is still 0 since we are starting from the first coord
|
|
539
|
-
|
|
540
|
-
expect(model.offsetPx).toBe(0); // endOffset 19000 - (-1) = 19001 / 800 = zoomTo(23.75)
|
|
541
|
-
|
|
542
|
-
expect(model.bpPerPx).toBeCloseTo(23.75);
|
|
543
|
-
expect(model.bpPerPx).toBeLessThan(largestBpPerPx);
|
|
544
|
-
});
|
|
545
|
-
it('can select over two regions in the same reference sequence', function () {
|
|
546
|
-
model.setWidth(800);
|
|
547
|
-
model.showAllRegions();
|
|
548
|
-
expect(model.bpPerPx).toBeCloseTo(38.8888); // totalBp = 28000 / 1000 = 28 as maxBpPerPx
|
|
549
|
-
|
|
550
|
-
model.zoomToDisplayedRegions({
|
|
551
|
-
start: 5000,
|
|
552
|
-
index: 0,
|
|
553
|
-
end: 20000,
|
|
554
|
-
offset: 5000,
|
|
555
|
-
refName: 'ctgA'
|
|
556
|
-
}, {
|
|
557
|
-
start: 0,
|
|
558
|
-
index: 2,
|
|
559
|
-
end: 3000,
|
|
560
|
-
offset: 2000,
|
|
561
|
-
refName: 'ctgB'
|
|
562
|
-
}); // 22000 / 792 (width - interRegionPadding) = 27.78
|
|
563
|
-
|
|
564
|
-
expect(model.bpPerPx).toBeCloseTo(27.78, 0); // offset 5000 / bpPerPx (because that is the starting) = 180.5
|
|
565
|
-
|
|
566
|
-
expect(model.offsetPx).toBe(181);
|
|
567
|
-
expect(model.bpPerPx).toBeLessThan(largestBpPerPx);
|
|
568
|
-
});
|
|
569
|
-
it('can navigate to overlapping regions with a region between', function () {
|
|
570
|
-
model.setDisplayedRegions([{
|
|
571
|
-
assemblyName: 'volvox',
|
|
572
|
-
refName: 'ctgA',
|
|
573
|
-
start: 5000,
|
|
574
|
-
end: 20000
|
|
575
|
-
}, {
|
|
576
|
-
assemblyName: 'volvox',
|
|
577
|
-
refName: 'ctgB',
|
|
578
|
-
start: 0,
|
|
579
|
-
end: 3000
|
|
580
|
-
}, {
|
|
581
|
-
assemblyName: 'volvox',
|
|
582
|
-
refName: 'ctgA',
|
|
583
|
-
start: 0,
|
|
584
|
-
end: 35000
|
|
585
|
-
}]);
|
|
586
|
-
model.setWidth(800);
|
|
587
|
-
model.showAllRegions(); // totalBp 15000 + 3000 + 35000 = 53000
|
|
588
|
-
// then 53000 / (width*0.9) = 73.6111
|
|
589
|
-
|
|
590
|
-
expect(model.bpPerPx).toBeCloseTo(73.61111);
|
|
591
|
-
model.zoomToDisplayedRegions({
|
|
592
|
-
start: 5000,
|
|
593
|
-
coord: 15000,
|
|
594
|
-
index: 0,
|
|
595
|
-
end: 20000,
|
|
596
|
-
offset: 10000,
|
|
597
|
-
refName: 'ctgA'
|
|
598
|
-
}, {
|
|
599
|
-
start: 0,
|
|
600
|
-
coord: 15000,
|
|
601
|
-
index: 2,
|
|
602
|
-
end: 35000,
|
|
603
|
-
offset: 15000,
|
|
604
|
-
refName: 'ctgA'
|
|
605
|
-
});
|
|
606
|
-
expect(model.offsetPx).toBe(346); // 5000 + 3000 + 15000 / 792
|
|
607
|
-
|
|
608
|
-
expect(model.bpPerPx).toBeCloseTo(29.04, 0);
|
|
609
|
-
expect(model.bpPerPx).toBeLessThan(53);
|
|
610
|
-
});
|
|
611
|
-
});
|
|
612
|
-
test('can instantiate a model that >2 regions', function () {
|
|
613
|
-
var _initialize7 = initialize(),
|
|
614
|
-
Session = _initialize7.Session,
|
|
615
|
-
LinearGenomeModel = _initialize7.LinearGenomeModel;
|
|
616
|
-
|
|
617
|
-
var session = Session.create({
|
|
618
|
-
configuration: {}
|
|
619
|
-
});
|
|
620
|
-
var width = 800;
|
|
621
|
-
var model = session.setView(LinearGenomeModel.create({
|
|
622
|
-
id: 'test4',
|
|
623
|
-
type: 'LinearGenomeView',
|
|
624
|
-
tracks: [{
|
|
625
|
-
name: 'foo track',
|
|
626
|
-
type: 'BasicTrack'
|
|
627
|
-
}]
|
|
628
|
-
}));
|
|
629
|
-
model.setWidth(width);
|
|
630
|
-
model.setDisplayedRegions([{
|
|
631
|
-
assemblyName: 'volvox',
|
|
632
|
-
start: 0,
|
|
633
|
-
end: 10000,
|
|
634
|
-
refName: 'ctgA'
|
|
635
|
-
}, {
|
|
636
|
-
assemblyName: 'volvox',
|
|
637
|
-
start: 0,
|
|
638
|
-
end: 10000,
|
|
639
|
-
refName: 'ctgB'
|
|
640
|
-
}, {
|
|
641
|
-
assemblyName: 'volvox',
|
|
642
|
-
start: 0,
|
|
643
|
-
end: 10000,
|
|
644
|
-
refName: 'ctgC'
|
|
645
|
-
}]);
|
|
646
|
-
model.moveTo({
|
|
647
|
-
index: 0,
|
|
648
|
-
offset: 100
|
|
649
|
-
}, {
|
|
650
|
-
index: 2,
|
|
651
|
-
offset: 100
|
|
652
|
-
});
|
|
653
|
-
model.setNewView(1, 0); // extending in the minus gives us first displayed region
|
|
654
|
-
|
|
655
|
-
expect(model.pxToBp(-5000).refName).toEqual('ctgA');
|
|
656
|
-
expect(model.pxToBp(5000).refName).toEqual('ctgA');
|
|
657
|
-
expect(model.pxToBp(15000).refName).toEqual('ctgB');
|
|
658
|
-
expect(model.pxToBp(25000).refName).toEqual('ctgC'); // extending past gives us the last displayed region
|
|
659
|
-
|
|
660
|
-
expect(model.pxToBp(35000).refName).toEqual('ctgC');
|
|
661
|
-
model.setDisplayName('Volvox view');
|
|
662
|
-
expect(model.displayName).toBe('Volvox view');
|
|
663
|
-
model.moveTo({
|
|
664
|
-
refName: 'ctgA',
|
|
665
|
-
index: 0,
|
|
666
|
-
offset: 0,
|
|
667
|
-
start: 0,
|
|
668
|
-
end: 10000
|
|
669
|
-
}, {
|
|
670
|
-
refName: 'ctgC',
|
|
671
|
-
index: 2,
|
|
672
|
-
offset: 0,
|
|
673
|
-
start: 0,
|
|
674
|
-
end: 10000
|
|
675
|
-
});
|
|
676
|
-
model.moveTo({
|
|
677
|
-
refName: 'ctgB',
|
|
678
|
-
index: 1,
|
|
679
|
-
offset: 0,
|
|
680
|
-
start: 0,
|
|
681
|
-
end: 10000
|
|
682
|
-
}, {
|
|
683
|
-
refName: 'ctgC',
|
|
684
|
-
index: 2,
|
|
685
|
-
offset: 0,
|
|
686
|
-
start: 0,
|
|
687
|
-
end: 10000
|
|
688
|
-
});
|
|
689
|
-
expect(model.offsetPx).toEqual(10000 / model.bpPerPx + 2);
|
|
690
|
-
expect(model.displayedRegionsTotalPx).toEqual(30000 / model.bpPerPx);
|
|
691
|
-
model.showAllRegions();
|
|
692
|
-
expect(model.offsetPx).toEqual(-40);
|
|
693
|
-
expect(model.bpToPx({
|
|
694
|
-
refName: 'ctgA',
|
|
695
|
-
coord: 100
|
|
696
|
-
})).toEqual({
|
|
697
|
-
index: 0,
|
|
698
|
-
offsetPx: Math.round(100 / model.bpPerPx)
|
|
699
|
-
});
|
|
700
|
-
expect(model.bpToPx({
|
|
701
|
-
refName: 'ctgB',
|
|
702
|
-
coord: 100
|
|
703
|
-
})).toEqual({
|
|
704
|
-
index: 1,
|
|
705
|
-
offsetPx: Math.round(10100 / model.bpPerPx) + model.interRegionPaddingWidth
|
|
706
|
-
});
|
|
707
|
-
});
|
|
708
|
-
test('can perform bpToPx in a way that makes sense on things that happen outside', function () {
|
|
709
|
-
var _initialize8 = initialize(),
|
|
710
|
-
Session = _initialize8.Session,
|
|
711
|
-
LinearGenomeModel = _initialize8.LinearGenomeModel;
|
|
712
|
-
|
|
713
|
-
var session = Session.create({
|
|
714
|
-
configuration: {}
|
|
715
|
-
});
|
|
716
|
-
var width = 800;
|
|
717
|
-
var model = session.setView(LinearGenomeModel.create({
|
|
718
|
-
id: 'test5',
|
|
719
|
-
type: 'LinearGenomeView',
|
|
720
|
-
tracks: [{
|
|
721
|
-
name: 'foo track',
|
|
722
|
-
type: 'BasicTrack'
|
|
723
|
-
}]
|
|
724
|
-
}));
|
|
725
|
-
model.setWidth(width);
|
|
726
|
-
model.setDisplayedRegions([{
|
|
727
|
-
assemblyName: 'volvox',
|
|
728
|
-
start: 1000,
|
|
729
|
-
end: 2000,
|
|
730
|
-
refName: 'ctgA',
|
|
731
|
-
reversed: true
|
|
732
|
-
}]);
|
|
733
|
-
expect(model.bpToPx({
|
|
734
|
-
refName: 'ctgA',
|
|
735
|
-
coord: 500
|
|
736
|
-
})).toBe(undefined);
|
|
737
|
-
expect(model.pxToBp(-1).coord).toEqual(2002);
|
|
738
|
-
expect(model.pxToBp(100).offset).toEqual(100);
|
|
739
|
-
expect(model.pxToBp(100).coord).toEqual(1901); // testing bpToPx and pxToBp when region is reversed
|
|
740
|
-
// coordinate is out of bounds
|
|
741
|
-
|
|
742
|
-
expect(model.bpToPx({
|
|
743
|
-
refName: 'ctgA',
|
|
744
|
-
coord: 0
|
|
745
|
-
})).toEqual(undefined);
|
|
746
|
-
expect(model.bpToPx({
|
|
747
|
-
refName: 'ctgA',
|
|
748
|
-
coord: 2001
|
|
749
|
-
})).toEqual(undefined); // offset here should be 500 because coord 1500 - 1000 start = 500
|
|
750
|
-
|
|
751
|
-
expect(model.bpToPx({
|
|
752
|
-
refName: 'ctgA',
|
|
753
|
-
coord: 1500
|
|
754
|
-
})).toEqual({
|
|
755
|
-
index: 0,
|
|
756
|
-
offsetPx: 500
|
|
757
|
-
});
|
|
758
|
-
expect(model.pxToBp(-1).oob).toEqual(true);
|
|
759
|
-
model.centerAt(1500, 'ctgA', 0);
|
|
760
|
-
expect(model.bpPerPx).toEqual(1);
|
|
761
|
-
expect(model.offsetPx).toEqual(100);
|
|
762
|
-
model.toggleHeader();
|
|
763
|
-
expect(model.hideHeader).toEqual(true);
|
|
764
|
-
model.toggleHeader();
|
|
765
|
-
model.toggleHeaderOverview();
|
|
766
|
-
expect(model.hideHeaderOverview).toEqual(true);
|
|
767
|
-
model.toggleHeaderOverview();
|
|
768
|
-
model.setError(Error('pxToBp failed to map to a region'));
|
|
769
|
-
expect("".concat(model.error)).toEqual('Error: pxToBp failed to map to a region');
|
|
770
|
-
}); // determined objectively by looking at
|
|
771
|
-
// http://localhost:3000/?config=test_data%2Fconfig_demo.json&session=share-Se2K5q_Jog&password=qT9on
|
|
772
|
-
//
|
|
773
|
-
// this test is important because interregionpadding blocks outside the current
|
|
774
|
-
// view should not be taken into account
|
|
775
|
-
|
|
776
|
-
test('can perform pxToBp on human genome things with ellided blocks (zoomed in)', function () {
|
|
777
|
-
var _initialize9 = initialize(),
|
|
778
|
-
Session = _initialize9.Session,
|
|
779
|
-
LinearGenomeModel = _initialize9.LinearGenomeModel;
|
|
780
|
-
|
|
781
|
-
var session = Session.create({
|
|
782
|
-
configuration: {}
|
|
783
|
-
});
|
|
784
|
-
var model = session.setView(LinearGenomeModel.create({
|
|
785
|
-
id: 'test6',
|
|
786
|
-
type: 'LinearGenomeView',
|
|
787
|
-
tracks: [{
|
|
788
|
-
name: 'foo track',
|
|
789
|
-
type: 'BasicTrack'
|
|
790
|
-
}]
|
|
791
|
-
}));
|
|
792
|
-
var width = 800;
|
|
793
|
-
model.setWidth(width);
|
|
794
|
-
model.setDisplayedRegions(_hg38DisplayedRegions.default);
|
|
795
|
-
model.setNewView(6359.273152497633, 503862);
|
|
796
|
-
expect(model.pxToBp(0).refName).toBe('Y');
|
|
797
|
-
expect(model.pxToBp(400).refName).toBe('Y');
|
|
798
|
-
expect(model.pxToBp(800).refName).toBe('Y_KI270740v1_random');
|
|
799
|
-
}); // determined objectively from looking at http://localhost:3000/?config=test_data%2Fconfig_demo.json&session=share-TUJdqKI2c9&password=01tan
|
|
800
|
-
//
|
|
801
|
-
// this tests some places on hg38 when zoomed to whole genome, so inter-region
|
|
802
|
-
// padding blocks and elided blocks matter
|
|
803
|
-
|
|
804
|
-
test('can perform pxToBp on human genome things with ellided blocks (zoomed out)', function () {
|
|
805
|
-
var _initialize10 = initialize(),
|
|
806
|
-
Session = _initialize10.Session,
|
|
807
|
-
LinearGenomeModel = _initialize10.LinearGenomeModel;
|
|
808
|
-
|
|
809
|
-
var session = Session.create({
|
|
810
|
-
configuration: {}
|
|
811
|
-
});
|
|
812
|
-
var model = session.setView(LinearGenomeModel.create({
|
|
813
|
-
id: 'test6',
|
|
814
|
-
type: 'LinearGenomeView',
|
|
815
|
-
tracks: [{
|
|
816
|
-
name: 'foo track',
|
|
817
|
-
type: 'BasicTrack'
|
|
818
|
-
}]
|
|
819
|
-
}));
|
|
820
|
-
var width = 800;
|
|
821
|
-
model.setWidth(width);
|
|
822
|
-
model.setDisplayedRegions(_hg38DisplayedRegions.default);
|
|
823
|
-
model.setNewView(3209286.105, -225.5083315372467); // chr1 to the left
|
|
824
|
-
|
|
825
|
-
expect(model.pxToBp(0).refName).toBe('1');
|
|
826
|
-
expect(model.pxToBp(0).oob).toBeTruthy(); // chr10 in the middle, tests a specific coord but should just be probably
|
|
827
|
-
// somewhat around here
|
|
828
|
-
|
|
829
|
-
expect(model.pxToBp(800).coord).toBe(111057351);
|
|
830
|
-
expect(model.pxToBp(800).refName).toBe('10'); // chrX after an ellided block, this tests a specific coord but should just be
|
|
831
|
-
// probably somewhat around here
|
|
832
|
-
|
|
833
|
-
expect(model.pxToBp(1228).coord).toBe(99349155);
|
|
834
|
-
expect(model.pxToBp(1228).refName).toBe('X'); // chrY_random at the end
|
|
835
|
-
|
|
836
|
-
expect(model.pxToBp(1500).refName).toBe('Y_KI270740v1_random');
|
|
837
|
-
expect(model.pxToBp(1500).oob).toBeTruthy();
|
|
838
|
-
});
|
|
839
|
-
test('can showAllRegionsInAssembly', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
840
|
-
var _initialize11, Session, LinearGenomeModel, session, width, model;
|
|
841
|
-
|
|
842
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
843
|
-
while (1) {
|
|
844
|
-
switch (_context2.prev = _context2.next) {
|
|
845
|
-
case 0:
|
|
846
|
-
_initialize11 = initialize(), Session = _initialize11.Session, LinearGenomeModel = _initialize11.LinearGenomeModel;
|
|
847
|
-
session = Session.create({
|
|
848
|
-
configuration: {}
|
|
849
|
-
});
|
|
850
|
-
width = 800;
|
|
851
|
-
model = session.setView(LinearGenomeModel.create({
|
|
852
|
-
id: 'test4',
|
|
853
|
-
type: 'LinearGenomeView',
|
|
854
|
-
tracks: [{
|
|
855
|
-
name: 'foo track',
|
|
856
|
-
type: 'BasicTrack'
|
|
857
|
-
}]
|
|
858
|
-
}));
|
|
859
|
-
model.setWidth(width);
|
|
860
|
-
model.showAllRegionsInAssembly('volvox');
|
|
861
|
-
expect(model.displayedRegions.map(function (reg) {
|
|
862
|
-
return reg.refName;
|
|
863
|
-
})).toEqual(['ctgA', 'ctgB']);
|
|
864
|
-
|
|
865
|
-
case 7:
|
|
866
|
-
case "end":
|
|
867
|
-
return _context2.stop();
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
}, _callee2);
|
|
871
|
-
})));
|
|
872
|
-
describe('Get Sequence for selected displayed regions', function () {
|
|
873
|
-
var _initialize12 = initialize(),
|
|
874
|
-
Session = _initialize12.Session,
|
|
875
|
-
LinearGenomeModel = _initialize12.LinearGenomeModel;
|
|
876
|
-
/* the start of all the results should be +1
|
|
877
|
-
the sequence dialog then handles converting from 1-based closed to interbase
|
|
878
|
-
*/
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
var model;
|
|
882
|
-
beforeEach(function () {
|
|
883
|
-
var session = Session.create({
|
|
884
|
-
configuration: {}
|
|
885
|
-
});
|
|
886
|
-
var width = 800;
|
|
887
|
-
model = session.setView(LinearGenomeModel.create({
|
|
888
|
-
id: 'testGetSequenceSelectedRegions',
|
|
889
|
-
type: 'LinearGenomeView'
|
|
890
|
-
}));
|
|
891
|
-
model.setWidth(width);
|
|
892
|
-
model.setDisplayedRegions([{
|
|
893
|
-
assemblyName: 'volvox',
|
|
894
|
-
refName: 'ctgA',
|
|
895
|
-
start: 0,
|
|
896
|
-
end: 50001
|
|
897
|
-
}, {
|
|
898
|
-
assemblyName: 'volvox',
|
|
899
|
-
refName: 'ctgB',
|
|
900
|
-
start: 0,
|
|
901
|
-
end: 6079
|
|
902
|
-
}]);
|
|
903
|
-
});
|
|
904
|
-
it('can select whole region and handles both offsets being oob', function () {
|
|
905
|
-
model.setDisplayedRegions([{
|
|
906
|
-
assemblyName: 'volvox',
|
|
907
|
-
refName: 'ctgA',
|
|
908
|
-
start: 0,
|
|
909
|
-
end: 800
|
|
910
|
-
}]);
|
|
911
|
-
model.setOffsets({
|
|
912
|
-
refName: 'ctgA',
|
|
913
|
-
index: 0,
|
|
914
|
-
offset: -10,
|
|
915
|
-
start: 0,
|
|
916
|
-
end: 800,
|
|
917
|
-
coord: -10,
|
|
918
|
-
reversed: false,
|
|
919
|
-
assemblyName: 'volvox',
|
|
920
|
-
oob: true
|
|
921
|
-
}, {
|
|
922
|
-
refName: 'ctgA',
|
|
923
|
-
index: 0,
|
|
924
|
-
offset: 810,
|
|
925
|
-
start: 0,
|
|
926
|
-
end: 800,
|
|
927
|
-
coord: 810,
|
|
928
|
-
reversed: false,
|
|
929
|
-
assemblyName: 'volvox',
|
|
930
|
-
oob: true
|
|
931
|
-
});
|
|
932
|
-
var singleRegion = model.getSelectedRegions(model.leftOffset, model.rightOffset);
|
|
933
|
-
expect(singleRegion.length).toEqual(1);
|
|
934
|
-
expect(singleRegion[0].start).toEqual(0);
|
|
935
|
-
expect(singleRegion[0].end).toEqual(800);
|
|
936
|
-
});
|
|
937
|
-
it('handles when start or end offsets are out of bounds of displayed regions', function () {
|
|
938
|
-
model.setOffsets({
|
|
939
|
-
refName: 'ctgA',
|
|
940
|
-
start: 0,
|
|
941
|
-
end: 50001,
|
|
942
|
-
reversed: false,
|
|
943
|
-
assemblyName: 'volvox',
|
|
944
|
-
oob: true,
|
|
945
|
-
coord: -8,
|
|
946
|
-
offset: -8.77999706864357,
|
|
947
|
-
index: 0
|
|
948
|
-
}, {
|
|
949
|
-
refName: 'ctgA',
|
|
950
|
-
start: 0,
|
|
951
|
-
end: 50001,
|
|
952
|
-
reversed: false,
|
|
953
|
-
assemblyName: 'volvox',
|
|
954
|
-
oob: true,
|
|
955
|
-
coord: -4,
|
|
956
|
-
offset: -4.12999706864357,
|
|
957
|
-
index: 0
|
|
958
|
-
});
|
|
959
|
-
var outOfBounds = model.getSelectedRegions(model.leftOffset, model.rightOffset);
|
|
960
|
-
expect(outOfBounds.length).toEqual(0);
|
|
961
|
-
});
|
|
962
|
-
it('selects multiple regions with a region in between', function () {
|
|
963
|
-
model.setDisplayedRegions([{
|
|
964
|
-
assemblyName: 'volvox',
|
|
965
|
-
refName: 'ctgA',
|
|
966
|
-
start: 0,
|
|
967
|
-
end: 500
|
|
968
|
-
}, {
|
|
969
|
-
assemblyName: 'volvox',
|
|
970
|
-
refName: 'ctgB',
|
|
971
|
-
start: 0,
|
|
972
|
-
end: 3000
|
|
973
|
-
}, {
|
|
974
|
-
assemblyName: 'volvox',
|
|
975
|
-
refName: 'ctgA',
|
|
976
|
-
start: 0,
|
|
977
|
-
end: 200
|
|
978
|
-
}]);
|
|
979
|
-
model.setWidth(800);
|
|
980
|
-
model.showAllRegions(); // created by console logging getSelectedRegion's arguments after manually
|
|
981
|
-
// setting up this test case in the browser
|
|
982
|
-
|
|
983
|
-
model.setOffsets({
|
|
984
|
-
refName: 'ctgA',
|
|
985
|
-
start: 0,
|
|
986
|
-
end: 500,
|
|
987
|
-
reversed: false,
|
|
988
|
-
assemblyName: 'volvox',
|
|
989
|
-
oob: false,
|
|
990
|
-
offset: 200,
|
|
991
|
-
coord: 200,
|
|
992
|
-
index: 0
|
|
993
|
-
}, {
|
|
994
|
-
refName: 'ctgA',
|
|
995
|
-
start: 0,
|
|
996
|
-
end: 200,
|
|
997
|
-
reversed: false,
|
|
998
|
-
assemblyName: 'volvox',
|
|
999
|
-
oob: false,
|
|
1000
|
-
offset: 100,
|
|
1001
|
-
coord: 100,
|
|
1002
|
-
index: 2
|
|
1003
|
-
});
|
|
1004
|
-
var overlapping = model.getSelectedRegions(model.leftOffset, model.rightOffset);
|
|
1005
|
-
expect(overlapping.length).toEqual(3);
|
|
1006
|
-
expect(overlapping[0].start).toEqual(200);
|
|
1007
|
-
expect(overlapping[0].end).toEqual(500);
|
|
1008
|
-
expect(overlapping[1].start).toEqual(0);
|
|
1009
|
-
expect(overlapping[1].end).toEqual(3000);
|
|
1010
|
-
expect(overlapping[2].start).toEqual(0);
|
|
1011
|
-
expect(overlapping[2].end).toEqual(110);
|
|
1012
|
-
});
|
|
1013
|
-
it('can select over two regions in diff reference sequence', function () {
|
|
1014
|
-
model.setDisplayedRegions([{
|
|
1015
|
-
assemblyName: 'volvox',
|
|
1016
|
-
refName: 'ctgA',
|
|
1017
|
-
start: 0,
|
|
1018
|
-
end: 50001
|
|
1019
|
-
}, {
|
|
1020
|
-
assemblyName: 'volvox',
|
|
1021
|
-
refName: 'ctgB',
|
|
1022
|
-
start: 0,
|
|
1023
|
-
end: 6079
|
|
1024
|
-
}]);
|
|
1025
|
-
model.setOffsets({
|
|
1026
|
-
refName: 'ctgA',
|
|
1027
|
-
index: 0,
|
|
1028
|
-
offset: 49998,
|
|
1029
|
-
start: 0,
|
|
1030
|
-
end: 50001,
|
|
1031
|
-
coord: 49999,
|
|
1032
|
-
reversed: false,
|
|
1033
|
-
assemblyName: 'volvox',
|
|
1034
|
-
oob: false
|
|
1035
|
-
}, {
|
|
1036
|
-
refName: 'ctgB',
|
|
1037
|
-
index: 1,
|
|
1038
|
-
offset: 9,
|
|
1039
|
-
start: 0,
|
|
1040
|
-
end: 6079,
|
|
1041
|
-
coord: 10,
|
|
1042
|
-
reversed: false,
|
|
1043
|
-
assemblyName: 'volvox',
|
|
1044
|
-
oob: false
|
|
1045
|
-
});
|
|
1046
|
-
var multipleRegions = model.getSelectedRegions(model.leftOffset, model.rightOffset);
|
|
1047
|
-
expect(multipleRegions.length).toEqual(2);
|
|
1048
|
-
expect(multipleRegions[0].start).toEqual(49998);
|
|
1049
|
-
expect(multipleRegions[0].end).toEqual(50001);
|
|
1050
|
-
expect(multipleRegions[1].start).toEqual(0);
|
|
1051
|
-
expect(multipleRegions[1].end).toEqual(9);
|
|
1052
|
-
});
|
|
1053
|
-
it('can handle horizontally flipped regions', function () {
|
|
1054
|
-
model.setDisplayedRegions([{
|
|
1055
|
-
assemblyName: 'volvox',
|
|
1056
|
-
refName: 'ctgA',
|
|
1057
|
-
start: 0,
|
|
1058
|
-
end: 50001,
|
|
1059
|
-
reversed: true
|
|
1060
|
-
}]);
|
|
1061
|
-
var hfRegion = model.getSelectedRegions({
|
|
1062
|
-
refName: 'ctgA',
|
|
1063
|
-
start: 0,
|
|
1064
|
-
end: 50001,
|
|
1065
|
-
reversed: true,
|
|
1066
|
-
assemblyName: 'volvox',
|
|
1067
|
-
oob: false,
|
|
1068
|
-
offset: 1.03696711063385,
|
|
1069
|
-
coord: 50000,
|
|
1070
|
-
index: 0
|
|
1071
|
-
}, {
|
|
1072
|
-
refName: 'ctgA',
|
|
1073
|
-
start: 0,
|
|
1074
|
-
end: 50001,
|
|
1075
|
-
reversed: true,
|
|
1076
|
-
assemblyName: 'volvox',
|
|
1077
|
-
oob: false,
|
|
1078
|
-
offset: 3.93696711063385,
|
|
1079
|
-
coord: 49998,
|
|
1080
|
-
index: 0
|
|
1081
|
-
});
|
|
1082
|
-
expect(hfRegion.length).toEqual(1);
|
|
1083
|
-
expect(hfRegion[0].start).toEqual(49997);
|
|
1084
|
-
expect(hfRegion[0].end).toEqual(50000);
|
|
1085
|
-
});
|
|
1086
|
-
});
|
|
1087
|
-
test('navToLocString with human assembly', function () {
|
|
1088
|
-
var _initialize13 = initialize(),
|
|
1089
|
-
LinearGenomeModel = _initialize13.LinearGenomeModel;
|
|
1090
|
-
|
|
1091
|
-
var HumanAssembly = _mobxStateTree.types.model({}).volatile(function () {
|
|
1092
|
-
return {
|
|
1093
|
-
regions: _hg38DisplayedRegions.default
|
|
1094
|
-
};
|
|
1095
|
-
}).views(function () {
|
|
1096
|
-
return {
|
|
1097
|
-
getCanonicalRefName: function getCanonicalRefName(refName) {
|
|
1098
|
-
return refName.replace('chr', '');
|
|
1099
|
-
}
|
|
1100
|
-
};
|
|
1101
|
-
});
|
|
1102
|
-
|
|
1103
|
-
var AssemblyManager = _mobxStateTree.types.model({
|
|
1104
|
-
assemblies: _mobxStateTree.types.map(HumanAssembly)
|
|
1105
|
-
}).actions(function (self) {
|
|
1106
|
-
return {
|
|
1107
|
-
isValidRefName: function isValidRefName(str) {
|
|
1108
|
-
return !str.includes(':');
|
|
1109
|
-
},
|
|
1110
|
-
get: function get(str) {
|
|
1111
|
-
return self.assemblies.get(str);
|
|
1112
|
-
}
|
|
1113
|
-
};
|
|
1114
|
-
});
|
|
1115
|
-
|
|
1116
|
-
var HumanSession = _mobxStateTree.types.model({
|
|
1117
|
-
name: 'testSession',
|
|
1118
|
-
rpcManager: 'rpcManagerExists',
|
|
1119
|
-
configuration: _mobxStateTree.types.map(_mobxStateTree.types.string),
|
|
1120
|
-
assemblyManager: AssemblyManager,
|
|
1121
|
-
view: LinearGenomeModel
|
|
1122
|
-
});
|
|
1123
|
-
|
|
1124
|
-
var model = HumanSession.create({
|
|
1125
|
-
configuration: {},
|
|
1126
|
-
assemblyManager: {
|
|
1127
|
-
assemblies: {
|
|
1128
|
-
hg38: {
|
|
1129
|
-
regions: _hg38DisplayedRegions.default
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
},
|
|
1133
|
-
view: {
|
|
1134
|
-
type: 'LinearGenomeView'
|
|
1135
|
-
}
|
|
1136
|
-
});
|
|
1137
|
-
model.view.setWidth(800);
|
|
1138
|
-
model.view.setDisplayedRegions(_hg38DisplayedRegions.default.slice(0, 1));
|
|
1139
|
-
model.view.navToLocString('2');
|
|
1140
|
-
expect(model.view.bpPerPx).toBe(_hg38DisplayedRegions.default[1].end / model.view.width);
|
|
1141
|
-
model.view.navToLocString('chr3');
|
|
1142
|
-
expect(model.view.bpPerPx).toBe(_hg38DisplayedRegions.default[2].end / model.view.width);
|
|
1143
|
-
model.view.navToLocString('chr3:1,000,000,000-1,100,000,000');
|
|
1144
|
-
expect(model.view.bpPerPx).toBe(0.02);
|
|
1145
|
-
expect(model.view.offsetPx).toBe(9914777550);
|
|
1146
|
-
model.view.navToLocString('chr3:-1,100,000,000..-1,000,000,000');
|
|
1147
|
-
});
|
|
1148
|
-
test('multi region', function () {
|
|
1149
|
-
var _initialize14 = initialize(),
|
|
1150
|
-
Session = _initialize14.Session,
|
|
1151
|
-
LinearGenomeModel = _initialize14.LinearGenomeModel;
|
|
1152
|
-
|
|
1153
|
-
var model = Session.create({
|
|
1154
|
-
configuration: {}
|
|
1155
|
-
}).setView(LinearGenomeModel.create({
|
|
1156
|
-
type: 'LinearGenomeView',
|
|
1157
|
-
tracks: [{
|
|
1158
|
-
name: 'foo track',
|
|
1159
|
-
type: 'BasicTrack'
|
|
1160
|
-
}]
|
|
1161
|
-
}));
|
|
1162
|
-
model.setWidth(800);
|
|
1163
|
-
model.setDisplayedRegions(_volvoxDisplayedRegions.default.slice(0, 1));
|
|
1164
|
-
model.navToLocString('ctgA ctgB');
|
|
1165
|
-
expect(model.displayedRegions[0].refName).toBe('ctgA');
|
|
1166
|
-
expect(model.displayedRegions[1].refName).toBe('ctgB');
|
|
1167
|
-
});
|
|
1168
|
-
test('space separated locstring', function () {
|
|
1169
|
-
var _initialize15 = initialize(),
|
|
1170
|
-
Session = _initialize15.Session,
|
|
1171
|
-
LinearGenomeModel = _initialize15.LinearGenomeModel;
|
|
1172
|
-
|
|
1173
|
-
var model = Session.create({
|
|
1174
|
-
configuration: {}
|
|
1175
|
-
}).setView(LinearGenomeModel.create({
|
|
1176
|
-
type: 'LinearGenomeView',
|
|
1177
|
-
tracks: [{
|
|
1178
|
-
name: 'foo track',
|
|
1179
|
-
type: 'BasicTrack'
|
|
1180
|
-
}]
|
|
1181
|
-
}));
|
|
1182
|
-
model.setWidth(800);
|
|
1183
|
-
model.setDisplayedRegions(_volvoxDisplayedRegions.default.slice(0, 1));
|
|
1184
|
-
model.navToLocString('ctgA 0 100');
|
|
1185
|
-
expect(model.offsetPx).toBe(0);
|
|
1186
|
-
expect(model.bpPerPx).toBe(0.125);
|
|
1187
|
-
});
|