@jbrowse/plugin-linear-genome-view 1.6.9 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +13 -13
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js +232 -0
- package/dist/BaseLinearDisplay/components/Block.d.ts +15 -15
- package/dist/BaseLinearDisplay/components/Block.js +86 -0
- package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +12 -12
- package/dist/BaseLinearDisplay/components/LinearBlocks.js +110 -0
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.d.ts +4 -4
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +192 -0
- package/dist/BaseLinearDisplay/index.d.ts +5 -5
- package/dist/BaseLinearDisplay/index.js +41 -0
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +227 -230
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +763 -0
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.d.ts +1 -1
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +24 -0
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +96 -96
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +328 -0
- package/dist/LinearBareDisplay/configSchema.d.ts +2 -2
- package/dist/LinearBareDisplay/configSchema.js +19 -0
- package/dist/LinearBareDisplay/index.d.ts +2 -2
- package/dist/LinearBareDisplay/index.js +21 -0
- package/dist/LinearBareDisplay/index.test.js +33 -0
- package/dist/LinearBareDisplay/model.d.ts +192 -192
- package/dist/LinearBareDisplay/model.js +44 -0
- package/dist/LinearBasicDisplay/components/SetMaxHeight.d.ts +10 -10
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js +94 -0
- package/dist/LinearBasicDisplay/configSchema.d.ts +2 -2
- package/dist/LinearBasicDisplay/configSchema.js +25 -0
- package/dist/LinearBasicDisplay/index.d.ts +2 -2
- package/dist/LinearBasicDisplay/index.js +23 -0
- package/dist/LinearBasicDisplay/model.d.ts +213 -213
- package/dist/LinearBasicDisplay/model.js +162 -0
- package/dist/LinearGenomeView/components/CenterLine.d.ts +14 -14
- package/dist/LinearGenomeView/components/CenterLine.js +80 -0
- package/dist/LinearGenomeView/components/ExportSvgDialog.d.ts +6 -6
- package/dist/LinearGenomeView/components/ExportSvgDialog.js +137 -0
- package/dist/LinearGenomeView/components/Header.d.ts +7 -7
- package/dist/LinearGenomeView/components/Header.js +144 -0
- package/dist/LinearGenomeView/components/HelpDialog.d.ts +5 -5
- package/dist/LinearGenomeView/components/HelpDialog.js +48 -0
- package/dist/LinearGenomeView/components/ImportForm.d.ts +7 -7
- package/dist/LinearGenomeView/components/ImportForm.js +330 -0
- package/dist/LinearGenomeView/components/LinearGenomeView.d.ts +7 -7
- package/dist/LinearGenomeView/components/LinearGenomeView.js +129 -0
- package/dist/LinearGenomeView/components/LinearGenomeView.test.js +234 -0
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +4 -4
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +349 -0
- package/dist/LinearGenomeView/components/MiniControls.d.ts +6 -6
- package/dist/LinearGenomeView/components/MiniControls.js +83 -0
- package/dist/LinearGenomeView/components/OverviewRubberBand.d.ts +22 -22
- package/dist/LinearGenomeView/components/OverviewRubberBand.js +310 -0
- package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +132 -124
- package/dist/LinearGenomeView/components/OverviewScaleBar.js +403 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +21 -21
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +331 -0
- package/dist/LinearGenomeView/components/RubberBand.d.ts +9 -20
- package/dist/LinearGenomeView/components/RubberBand.js +309 -0
- package/dist/LinearGenomeView/components/Ruler.d.ts +27 -27
- package/dist/LinearGenomeView/components/Ruler.js +101 -0
- package/dist/LinearGenomeView/components/ScaleBar.d.ts +401 -401
- package/dist/LinearGenomeView/components/ScaleBar.js +184 -0
- package/dist/LinearGenomeView/components/ScaleBar.test.js +180 -0
- package/dist/LinearGenomeView/components/SearchBox.d.ts +8 -8
- package/dist/LinearGenomeView/components/SearchBox.js +201 -0
- package/dist/LinearGenomeView/components/SearchResultsDialog.d.ts +8 -8
- package/dist/LinearGenomeView/components/SearchResultsDialog.js +159 -0
- package/dist/LinearGenomeView/components/SequenceDialog.d.ts +8 -8
- package/dist/LinearGenomeView/components/SequenceDialog.js +304 -0
- package/dist/LinearGenomeView/components/TrackContainer.d.ts +9 -9
- package/dist/LinearGenomeView/components/TrackContainer.js +179 -0
- package/dist/LinearGenomeView/components/TrackLabel.d.ts +44 -44
- package/dist/LinearGenomeView/components/TrackLabel.js +165 -0
- package/dist/LinearGenomeView/components/TracksContainer.d.ts +10 -10
- package/dist/LinearGenomeView/components/TracksContainer.js +214 -0
- package/dist/LinearGenomeView/components/VerticalGuides.d.ts +9 -9
- package/dist/LinearGenomeView/components/VerticalGuides.js +116 -0
- package/dist/LinearGenomeView/components/ZoomControls.d.ts +7 -7
- package/dist/LinearGenomeView/components/ZoomControls.js +92 -0
- package/dist/LinearGenomeView/components/util.d.ts +2 -2
- package/dist/LinearGenomeView/components/util.js +16 -0
- package/dist/LinearGenomeView/index.d.ts +292 -292
- package/dist/LinearGenomeView/index.js +1418 -0
- package/dist/LinearGenomeView/index.test.js +1170 -0
- package/dist/LinearGenomeView/util.d.ts +14 -14
- package/dist/LinearGenomeView/util.js +93 -0
- package/dist/LinearGenomeView/util.test.js +78 -0
- package/dist/index.d.ts +565 -565
- package/dist/index.js +293 -6
- package/package.json +6 -9
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +2 -0
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +10 -8
- package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +1 -1
- package/src/LinearBasicDisplay/model.ts +17 -18
- package/src/LinearGenomeView/components/Header.tsx +1 -1
- package/src/LinearGenomeView/components/ImportForm.tsx +10 -4
- package/src/LinearGenomeView/components/LinearGenomeView.test.js +1 -0
- package/src/LinearGenomeView/components/OverviewScaleBar.tsx +2 -2
- package/src/LinearGenomeView/components/RubberBand.tsx +14 -24
- package/src/LinearGenomeView/components/ScaleBar.test.tsx +1 -0
- package/src/LinearGenomeView/components/ScaleBar.tsx +3 -6
- package/src/LinearGenomeView/components/SequenceDialog.tsx +1 -1
- package/src/LinearGenomeView/components/TrackLabel.tsx +1 -1
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +0 -4
- package/src/LinearGenomeView/index.tsx +2 -3
- package/dist/LinearBareDisplay/index.test.d.ts +0 -1
- package/dist/LinearGenomeView/components/LinearGenomeView.test.d.ts +0 -1
- package/dist/plugin-linear-genome-view.cjs.development.js +0 -8121
- package/dist/plugin-linear-genome-view.cjs.development.js.map +0 -1
- package/dist/plugin-linear-genome-view.cjs.production.min.js +0 -2
- package/dist/plugin-linear-genome-view.cjs.production.min.js.map +0 -1
- package/dist/plugin-linear-genome-view.esm.js +0 -8105
- package/dist/plugin-linear-genome-view.esm.js.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Given a scale ( bp/px ) and minimum distances (px) between major and minor
|
|
3
|
-
* gridlines, return an object like `{ majorPitch: bp, minorPitch: bp }` giving
|
|
4
|
-
* the gridline pitches to use.
|
|
5
|
-
*/
|
|
6
|
-
export declare function chooseGridPitch(scale: number, minMajorPitchPx: number, minMinorPitchPx: number): {
|
|
7
|
-
majorPitch: number;
|
|
8
|
-
minorPitch: number;
|
|
9
|
-
};
|
|
10
|
-
export declare function makeTicks(start: number, end: number, bpPerPx: number, emitMajor?: boolean, emitMinor?: boolean): {
|
|
11
|
-
type: string;
|
|
12
|
-
base: number;
|
|
13
|
-
index: number;
|
|
14
|
-
}[];
|
|
1
|
+
/**
|
|
2
|
+
* Given a scale ( bp/px ) and minimum distances (px) between major and minor
|
|
3
|
+
* gridlines, return an object like `{ majorPitch: bp, minorPitch: bp }` giving
|
|
4
|
+
* the gridline pitches to use.
|
|
5
|
+
*/
|
|
6
|
+
export declare function chooseGridPitch(scale: number, minMajorPitchPx: number, minMinorPitchPx: number): {
|
|
7
|
+
majorPitch: number;
|
|
8
|
+
minorPitch: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function makeTicks(start: number, end: number, bpPerPx: number, emitMajor?: boolean, emitMinor?: boolean): {
|
|
11
|
+
type: string;
|
|
12
|
+
base: number;
|
|
13
|
+
index: number;
|
|
14
|
+
}[];
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.chooseGridPitch = chooseGridPitch;
|
|
7
|
+
exports.makeTicks = makeTicks;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Given a scale ( bp/px ) and minimum distances (px) between major and minor
|
|
11
|
+
* gridlines, return an object like `{ majorPitch: bp, minorPitch: bp }` giving
|
|
12
|
+
* the gridline pitches to use.
|
|
13
|
+
*/
|
|
14
|
+
function chooseGridPitch(scale, minMajorPitchPx, minMinorPitchPx) {
|
|
15
|
+
scale = Math.abs(scale);
|
|
16
|
+
var minMajorPitchBp = minMajorPitchPx * scale;
|
|
17
|
+
var majorMagnitude = parseInt(Number(minMajorPitchBp).toExponential().split(/e/i)[1], 10);
|
|
18
|
+
var majorPitch = Math.pow(10, majorMagnitude);
|
|
19
|
+
|
|
20
|
+
while (majorPitch < minMajorPitchBp) {
|
|
21
|
+
majorPitch *= 2;
|
|
22
|
+
|
|
23
|
+
if (majorPitch >= minMajorPitchBp) {
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
majorPitch *= 2.5;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
majorPitch = Math.max(majorPitch, 5);
|
|
31
|
+
var majorPitchPx = majorPitch / scale;
|
|
32
|
+
var minorPitch = 0;
|
|
33
|
+
|
|
34
|
+
if (!(majorPitch % 10) && majorPitchPx / 10 >= minMinorPitchPx) {
|
|
35
|
+
minorPitch = majorPitch / 10;
|
|
36
|
+
} else if (!(majorPitch % 5) && majorPitchPx / 5 >= minMinorPitchPx) {
|
|
37
|
+
minorPitch = majorPitch / 5;
|
|
38
|
+
} else if (!(majorPitch % 2) && majorPitchPx / 2 >= minMinorPitchPx) {
|
|
39
|
+
minorPitch = majorPitch / 2;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
majorPitch: majorPitch,
|
|
44
|
+
minorPitch: minorPitch
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function makeTicks(start, end, bpPerPx) {
|
|
49
|
+
var emitMajor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
50
|
+
var emitMinor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
51
|
+
var gridPitch = chooseGridPitch(bpPerPx, 60, 15);
|
|
52
|
+
var minBase = start;
|
|
53
|
+
var maxBase = end;
|
|
54
|
+
|
|
55
|
+
if (minBase === null || maxBase === null) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (bpPerPx < 0) {
|
|
60
|
+
;
|
|
61
|
+
var _ref = [maxBase, minBase];
|
|
62
|
+
minBase = _ref[0];
|
|
63
|
+
maxBase = _ref[1];
|
|
64
|
+
} // add 20px additional on the right and left to allow us to draw the ends
|
|
65
|
+
// of labels that lie a little outside our region
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
minBase -= Math.abs(20 * bpPerPx) - 1;
|
|
69
|
+
maxBase += Math.abs(20 * bpPerPx) + 1;
|
|
70
|
+
var iterPitch = gridPitch.minorPitch || gridPitch.majorPitch;
|
|
71
|
+
var index = 0;
|
|
72
|
+
var ticks = [];
|
|
73
|
+
|
|
74
|
+
for (var base = Math.ceil(minBase / iterPitch) * iterPitch; base < maxBase; base += iterPitch) {
|
|
75
|
+
if (emitMinor && base % (gridPitch.majorPitch * 2)) {
|
|
76
|
+
ticks.push({
|
|
77
|
+
type: 'minor',
|
|
78
|
+
base: base - 1,
|
|
79
|
+
index: index
|
|
80
|
+
});
|
|
81
|
+
index += 1;
|
|
82
|
+
} else if (emitMajor && !(base % (gridPitch.majorPitch * 2))) {
|
|
83
|
+
ticks.push({
|
|
84
|
+
type: 'major',
|
|
85
|
+
base: base - 1,
|
|
86
|
+
index: index
|
|
87
|
+
});
|
|
88
|
+
index += 1;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return ticks;
|
|
93
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _util = require("./util");
|
|
4
|
+
|
|
5
|
+
describe('tick calculation', function () {
|
|
6
|
+
test('one', function () {
|
|
7
|
+
var result = Array.from((0, _util.makeTicks)(0, 10, 0.05));
|
|
8
|
+
expect(result).toEqual([{
|
|
9
|
+
type: 'major',
|
|
10
|
+
base: -1,
|
|
11
|
+
index: 0
|
|
12
|
+
}, {
|
|
13
|
+
type: 'minor',
|
|
14
|
+
base: 0,
|
|
15
|
+
index: 1
|
|
16
|
+
}, {
|
|
17
|
+
type: 'minor',
|
|
18
|
+
base: 1,
|
|
19
|
+
index: 2
|
|
20
|
+
}, {
|
|
21
|
+
type: 'minor',
|
|
22
|
+
base: 2,
|
|
23
|
+
index: 3
|
|
24
|
+
}, {
|
|
25
|
+
type: 'minor',
|
|
26
|
+
base: 3,
|
|
27
|
+
index: 4
|
|
28
|
+
}, {
|
|
29
|
+
type: 'minor',
|
|
30
|
+
base: 4,
|
|
31
|
+
index: 5
|
|
32
|
+
}, {
|
|
33
|
+
type: 'minor',
|
|
34
|
+
base: 5,
|
|
35
|
+
index: 6
|
|
36
|
+
}, {
|
|
37
|
+
type: 'minor',
|
|
38
|
+
base: 6,
|
|
39
|
+
index: 7
|
|
40
|
+
}, {
|
|
41
|
+
type: 'minor',
|
|
42
|
+
base: 7,
|
|
43
|
+
index: 8
|
|
44
|
+
}, {
|
|
45
|
+
type: 'minor',
|
|
46
|
+
base: 8,
|
|
47
|
+
index: 9
|
|
48
|
+
}, {
|
|
49
|
+
type: 'major',
|
|
50
|
+
base: 9,
|
|
51
|
+
index: 10
|
|
52
|
+
}, {
|
|
53
|
+
type: 'minor',
|
|
54
|
+
base: 10,
|
|
55
|
+
index: 11
|
|
56
|
+
}]);
|
|
57
|
+
});
|
|
58
|
+
test('two', function () {
|
|
59
|
+
var result = Array.from((0, _util.makeTicks)(0, 50, 1));
|
|
60
|
+
expect(result).toEqual([{
|
|
61
|
+
type: 'major',
|
|
62
|
+
base: -1,
|
|
63
|
+
index: 0
|
|
64
|
+
}, {
|
|
65
|
+
type: 'minor',
|
|
66
|
+
base: 19,
|
|
67
|
+
index: 1
|
|
68
|
+
}, {
|
|
69
|
+
type: 'minor',
|
|
70
|
+
base: 39,
|
|
71
|
+
index: 2
|
|
72
|
+
}, {
|
|
73
|
+
type: 'minor',
|
|
74
|
+
base: 59,
|
|
75
|
+
index: 3
|
|
76
|
+
}]);
|
|
77
|
+
});
|
|
78
|
+
});
|