genoverse 3.2.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/.eslintrc.js +197 -0
- package/.github/workflows/test.yml +24 -0
- package/LICENSE.TXT +24 -0
- package/README.md +11 -0
- package/css/controlPanel.css +200 -0
- package/css/fileDrop.css +22 -0
- package/css/font-awesome.css +3 -0
- package/css/fullscreen.css +19 -0
- package/css/genoverse.css +466 -0
- package/css/karyotype.css +85 -0
- package/css/resizer.css +36 -0
- package/css/tooltips.css +26 -0
- package/css/trackControls.css +111 -0
- package/expanded.html +120 -0
- package/fontawesome/css/fontawesome.min.css +5 -0
- package/fontawesome/css/regular.min.css +5 -0
- package/fontawesome/css/solid.min.css +5 -0
- package/fontawesome/webfonts/fa-brands-400.ttf +0 -0
- package/fontawesome/webfonts/fa-brands-400.woff +0 -0
- package/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
- package/fontawesome/webfonts/fa-regular-400.ttf +0 -0
- package/fontawesome/webfonts/fa-regular-400.woff +0 -0
- package/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
- package/fontawesome/webfonts/fa-solid-900.ttf +0 -0
- package/fontawesome/webfonts/fa-solid-900.woff +0 -0
- package/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
- package/help.pdf +0 -0
- package/i/sort_handle.png +0 -0
- package/index.html +68 -0
- package/index.js +83 -0
- package/jest.config.js +4 -0
- package/js/Genoverse.js +1681 -0
- package/js/Track/Controller/Sequence.js +17 -0
- package/js/Track/Controller/Stranded.js +73 -0
- package/js/Track/Controller.js +620 -0
- package/js/Track/Model/File/BAM.js +44 -0
- package/js/Track/Model/File/BED.js +116 -0
- package/js/Track/Model/File/GFF.js +40 -0
- package/js/Track/Model/File/VCF.js +101 -0
- package/js/Track/Model/File/WIG.js +67 -0
- package/js/Track/Model/File.js +36 -0
- package/js/Track/Model/Gene/Ensembl.js +22 -0
- package/js/Track/Model/Gene.js +5 -0
- package/js/Track/Model/Sequence/Ensembl.js +4 -0
- package/js/Track/Model/Sequence/Fasta.js +60 -0
- package/js/Track/Model/Sequence.js +50 -0
- package/js/Track/Model/SequenceVariation.js +41 -0
- package/js/Track/Model/Stranded.js +28 -0
- package/js/Track/Model/Transcript/Ensembl.js +67 -0
- package/js/Track/Model/Transcript.js +5 -0
- package/js/Track/Model.js +303 -0
- package/js/Track/View/Gene/Ensembl.js +46 -0
- package/js/Track/View/Gene.js +6 -0
- package/js/Track/View/Sequence/Variation.js +115 -0
- package/js/Track/View/Sequence.js +63 -0
- package/js/Track/View/Transcript/Ensembl.js +12 -0
- package/js/Track/View/Transcript.js +28 -0
- package/js/Track/View.js +566 -0
- package/js/Track/library/Chromosome.js +145 -0
- package/js/Track/library/File/BAM.js +30 -0
- package/js/Track/library/File/BED.js +24 -0
- package/js/Track/library/File/BIGBED.js +47 -0
- package/js/Track/library/File/BIGWIG.js +52 -0
- package/js/Track/library/File/GFF.js +9 -0
- package/js/Track/library/File/VCF.js +71 -0
- package/js/Track/library/File/WIG.js +5 -0
- package/js/Track/library/File.js +10 -0
- package/js/Track/library/Gene.js +37 -0
- package/js/Track/library/Graph/Bar.js +235 -0
- package/js/Track/library/Graph/Line.js +296 -0
- package/js/Track/library/Graph.js +355 -0
- package/js/Track/library/HighlightRegion.js +292 -0
- package/js/Track/library/Legend.js +224 -0
- package/js/Track/library/Scalebar.js +227 -0
- package/js/Track/library/Scaleline.js +91 -0
- package/js/Track/library/Static.js +78 -0
- package/js/Track/library/dbSNP.js +142 -0
- package/js/Track.js +632 -0
- package/js/genomes/grch37.js +990 -0
- package/js/genomes/grch38.js +990 -0
- package/js/genoverse.min.js +2 -0
- package/js/genoverse.min.js.map +1 -0
- package/js/lib/BWReader.js +578 -0
- package/js/lib/Base.js +145 -0
- package/js/lib/VCFReader.js +286 -0
- package/js/lib/dalliance/js/bam.js +494 -0
- package/js/lib/dalliance/js/bin.js +185 -0
- package/js/lib/dalliance/js/das.js +749 -0
- package/js/lib/dalliance/js/utils.js +370 -0
- package/js/lib/dalliance-lib.js +3594 -0
- package/js/lib/dalliance-lib.min.js +68 -0
- package/js/lib/jDataView.js +2 -0
- package/js/lib/jParser.js +192 -0
- package/js/lib/jquery-ui.js +8 -0
- package/js/lib/jquery.js +2 -0
- package/js/lib/jquery.mousehold.js +53 -0
- package/js/lib/jquery.mousewheel.js +84 -0
- package/js/lib/jquery.tipsy.js +258 -0
- package/js/lib/rtree.js +1 -0
- package/js/plugins/controlPanel.js +395 -0
- package/js/plugins/fileDrop.js +62 -0
- package/js/plugins/focusRegion.js +12 -0
- package/js/plugins/fullscreen.js +77 -0
- package/js/plugins/karyotype.js +210 -0
- package/js/plugins/resizer.js +45 -0
- package/js/plugins/tooltips.js +94 -0
- package/js/plugins/trackControls.js +143 -0
- package/package.json +43 -0
- package/test/View/__snapshots__/render-bar-graph.test.js.snap +111 -0
- package/test/View/__snapshots__/render-blocks.test.js.snap +105 -0
- package/test/View/__snapshots__/render-chromosome.test.js.snap +5 -0
- package/test/View/__snapshots__/render-highlights.test.js.snap +73 -0
- package/test/View/__snapshots__/render-insert-variants.test.js.snap +9 -0
- package/test/View/__snapshots__/render-labels.test.js.snap +241 -0
- package/test/View/__snapshots__/render-legends.test.js.snap +13 -0
- package/test/View/__snapshots__/render-line-graph.test.js.snap +349 -0
- package/test/View/__snapshots__/render-scalebar.test.js.snap +49 -0
- package/test/View/__snapshots__/render-scaleline.test.js.snap +31 -0
- package/test/View/__snapshots__/render-sequence.test.js.snap +23 -0
- package/test/View/__snapshots__/render-stranded.test.js.snap +5 -0
- package/test/View/__snapshots__/render-transcripts.test.js.snap +193 -0
- package/test/View/render-bar-graph.test.js +87 -0
- package/test/View/render-blocks.test.js +171 -0
- package/test/View/render-chromosome.test.js +40 -0
- package/test/View/render-highlights.test.js +67 -0
- package/test/View/render-insert-variants.test.js +11 -0
- package/test/View/render-labels.test.js +266 -0
- package/test/View/render-legends.test.js +31 -0
- package/test/View/render-line-graph.test.js +169 -0
- package/test/View/render-scalebar.test.js +36 -0
- package/test/View/render-scaleline.test.js +28 -0
- package/test/View/render-sequence.test.js +49 -0
- package/test/View/render-stranded.test.js +10 -0
- package/test/View/render-transcripts.test.js +165 -0
- package/test/create-and-destroy.test.js +63 -0
- package/test/track-ordering.test.js +514 -0
- package/test/track_config/__snapshots__/config-settings.test.js.snap +23 -0
- package/test/track_config/config-settings.test.js +321 -0
- package/test/track_config/zoom-level-settings.test.js +98 -0
- package/test/utils.js +80 -0
- package/utils/createGenome.js +52 -0
- package/utils/devServer.js +36 -0
- package/utils/expandedTemplate.html +46 -0
- package/utils/git-hooks/post-commit +9 -0
- package/utils/git-hooks/pre-commit +7 -0
- package/utils/git-hooks/setup +6 -0
- package/utils/makeExpanded.js +19 -0
- package/webpack.config.js +39 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const { Genoverse, afterTest, testTrackRenderStatic } = require('../utils');
|
|
2
|
+
|
|
3
|
+
describe('Correctly render bar graph where:', () => {
|
|
4
|
+
afterEach(afterTest);
|
|
5
|
+
|
|
6
|
+
const track = { _testClass: Genoverse.Track.Graph.Bar, height: 100, margin: 0, resizable: false, rescaleableY: false };
|
|
7
|
+
const data = [
|
|
8
|
+
[ 10, 60, 20, 100, 40, 50, 0, 90, 70, 30 ],
|
|
9
|
+
[ 40, 30, 20, 50, 90, 10, 10, 80, 60, 70 ],
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
const makeFeatures = $data => $data.map(
|
|
13
|
+
(d, i) => ({ start: i + 1, end: i + 1, height: d })
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
const getTrackConf = test => ({ ...track, ...test.conf });
|
|
17
|
+
|
|
18
|
+
const features = data.map(d => makeFeatures(d));
|
|
19
|
+
|
|
20
|
+
[{
|
|
21
|
+
why : 'scale > 1',
|
|
22
|
+
conf : { width: 100, start: 1, end: 10 },
|
|
23
|
+
}, {
|
|
24
|
+
why : 'scale = 1',
|
|
25
|
+
conf : { width: 100, start: 1, end: 100 },
|
|
26
|
+
}, {
|
|
27
|
+
why : 'scale < 1, all bins of equal size',
|
|
28
|
+
conf : { width: 100, start: 1, end: 200 },
|
|
29
|
+
}, {
|
|
30
|
+
why : 'scale < 1, final bin size = 1',
|
|
31
|
+
conf : { width: 100, start: 1, end: 300 },
|
|
32
|
+
}, {
|
|
33
|
+
why : 'scale < 1, final bin is small',
|
|
34
|
+
conf : { width: 100, start: 1, end: 400 },
|
|
35
|
+
}].forEach((testSet) => {
|
|
36
|
+
describe(testSet.why, () => {
|
|
37
|
+
[
|
|
38
|
+
{ why: 'no margin', conf: { margin: 0 } },
|
|
39
|
+
{ why: 'margin', conf: { margin: 10 } },
|
|
40
|
+
{ why: 'margin top and bottom, inverted', conf: { margin: { top: 5, bottom: 20 }, invert: true } },
|
|
41
|
+
{ why: 'margin top and bottom, not inverted', conf: { margin: { top: 5, bottom: 20 }, invert: false } },
|
|
42
|
+
{ why: 'colored', conf: { margin: 0, color: 'red' } },
|
|
43
|
+
].forEach((test) => {
|
|
44
|
+
it(test.why, () => testTrackRenderStatic(features[0], getTrackConf(test), testSet.conf));
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('the graph has two datasets', () => {
|
|
48
|
+
[
|
|
49
|
+
{ why: 'coloured red and blue', conf: { margin: 0, datasets: [{ name: 1, color: 'red' }, { name: 2, color: 'blue' }] } },
|
|
50
|
+
{ why: 'one with globalAlpha set', conf: { margin: 0, datasets: [{ name: 1, color: 'red', fill: true }, { name: 2, color: 'blue', fill: true, globalAlpha: 0.5 }] } },
|
|
51
|
+
].forEach((test) => {
|
|
52
|
+
it(test.why, () => testTrackRenderStatic(
|
|
53
|
+
[
|
|
54
|
+
...features[0].map(f => ({ ...f, dataset: 1 })),
|
|
55
|
+
...features[1].map(f => ({ ...f, dataset: 2 })),
|
|
56
|
+
],
|
|
57
|
+
getTrackConf(test),
|
|
58
|
+
testSet.conf
|
|
59
|
+
));
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('yRange is set', () => {
|
|
66
|
+
const genoverseConf = { width: 100, start: 1, end: 100 };
|
|
67
|
+
const $data = [ 1, -8, 5, -5, 0, 7, -2 ];
|
|
68
|
+
const $features = makeFeatures($data);
|
|
69
|
+
|
|
70
|
+
[
|
|
71
|
+
{ why: 'with no margin', conf: { margin: 0 } },
|
|
72
|
+
{ why: 'with margin', conf: { margin: 1 } },
|
|
73
|
+
].forEach((testSet) => {
|
|
74
|
+
describe(testSet.why, () => {
|
|
75
|
+
[
|
|
76
|
+
{ why: 'yRange = [ -5, 5 ]', conf: { yRange: [ -5, 5 ], height: 10, ...testSet.conf } },
|
|
77
|
+
{ why: 'yRange = [ -1, 5 ]', conf: { yRange: [ -1, 5 ], height: 12, ...testSet.conf } },
|
|
78
|
+
{ why: 'yRange = [ 0, 1 ]', conf: { yRange: [ 0, 1 ], height: 10, ...testSet.conf } },
|
|
79
|
+
{ why: 'yRange = [ -1, 0 ]', conf: { yRange: [ -1, 0 ], height: 10, ...testSet.conf } },
|
|
80
|
+
{ why: 'yRange = [ 0.5, 7.5 ]', conf: { yRange: [ 0.5, 7.5 ], height: 70, ...testSet.conf } },
|
|
81
|
+
].forEach(
|
|
82
|
+
test => it(test.why, () => testTrackRenderStatic($features, getTrackConf(test), genoverseConf))
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
const { afterTest, testTrackRender, testTrackRenderStatic } = require('../utils');
|
|
2
|
+
|
|
3
|
+
describe('Correctly render blocks where:', () => {
|
|
4
|
+
afterEach(afterTest);
|
|
5
|
+
|
|
6
|
+
const track = { height: 50, margin: 0, featureHeight: 10, featureMargin: {} };
|
|
7
|
+
|
|
8
|
+
describe('feature heights and margins are set', () => {
|
|
9
|
+
[
|
|
10
|
+
{ why: 'default track settings' },
|
|
11
|
+
{ why: 'no feature margin', track: track },
|
|
12
|
+
{ why: 'feature margin top', track: { ...track, featureMargin: { top: 1 } } },
|
|
13
|
+
{ why: 'track margin', track: { ...track, margin: 1 } },
|
|
14
|
+
{ why: 'half feature height', track: { ...track, featureHeight: 5 } },
|
|
15
|
+
{ why: 'default feature height', track: { height: 50, margin: 0, featureMargin: {} } },
|
|
16
|
+
].forEach(
|
|
17
|
+
test => it(`with ${test.why}`, () => testTrackRenderStatic([{ start: 1, end: 10 }], test.track))
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('features are colored', () => {
|
|
22
|
+
[
|
|
23
|
+
{ why: 'all red with feature.color', track: track },
|
|
24
|
+
{ why: 'all red with track.color', track: { ...track, color: 'red' } },
|
|
25
|
+
].forEach((test) => {
|
|
26
|
+
it(test.why, () => {
|
|
27
|
+
const color = test.track.color ? undefined : 'red';
|
|
28
|
+
|
|
29
|
+
return testTrackRenderStatic([
|
|
30
|
+
{ start: 1, end: 5, color: color },
|
|
31
|
+
{ start: 6, end: 10, color: color },
|
|
32
|
+
{ start: 11, end: 15, color: color },
|
|
33
|
+
{ start: 16, end: 20, color: color },
|
|
34
|
+
], test.track);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('rgbk with feature.color', () => testTrackRenderStatic([
|
|
39
|
+
{ start: 1, end: 5, color: 'red' },
|
|
40
|
+
{ start: 6, end: 10, color: 'green' },
|
|
41
|
+
{ start: 11, end: 15, color: 'blue' },
|
|
42
|
+
{ start: 16, end: 20 },
|
|
43
|
+
], track));
|
|
44
|
+
|
|
45
|
+
it('rgbk with track.color = red', () => testTrackRenderStatic([
|
|
46
|
+
{ start: 1, end: 5 },
|
|
47
|
+
{ start: 6, end: 10, color: 'green' },
|
|
48
|
+
{ start: 11, end: 15, color: 'blue' },
|
|
49
|
+
{ start: 16, end: 20, color: 'black' },
|
|
50
|
+
], { ...track, color: 'red' }));
|
|
51
|
+
|
|
52
|
+
it('feature.color = false', () => testTrackRenderStatic([{ start: 1, end: 5, color: false }], track));
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('features have borders', () => {
|
|
56
|
+
it('with default feature.color', () => testTrackRenderStatic([{ start: 1, end: 5, borderColor: 'blue' }], track));
|
|
57
|
+
it('with feature.color = "red"', () => testTrackRenderStatic([{ start: 1, end: 5, borderColor: 'blue', color: 'red' }], track));
|
|
58
|
+
it('with feature.color = false', () => testTrackRenderStatic([{ start: 1, end: 5, borderColor: 'blue', color: false }], track));
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
track.bump = true;
|
|
62
|
+
|
|
63
|
+
describe('features are bumped (track.bump = true)', () => {
|
|
64
|
+
[
|
|
65
|
+
{ why: 'no feature margin', track: track },
|
|
66
|
+
{ why: 'feature margin top', track: { ...track, featureMargin: { top: 1 } } },
|
|
67
|
+
{ why: 'feature margin bottom', track: { ...track, featureMargin: { bottom: 1 } } },
|
|
68
|
+
{ why: 'feature margin right', track: { ...track, featureMargin: { right: 1 } } },
|
|
69
|
+
{ why: 'feature margin left (does nothing)', track: { ...track, featureMargin: { left: 1 } } },
|
|
70
|
+
{ why: 'feature margin top, bottom and right', track: { ...track, featureMargin: { top: 1, bottom: 1, right: 1 } } },
|
|
71
|
+
{ why: 'max depth', track: { ...track, featureMargin: { top: 1, bottom: 1, right: 1 }, depth: 2 } },
|
|
72
|
+
].forEach((test) => {
|
|
73
|
+
it(`with ${test.why}`, () => testTrackRenderStatic([
|
|
74
|
+
{ start: 1, end: 10 },
|
|
75
|
+
{ start: 6, end: 10 },
|
|
76
|
+
{ start: 1, end: 5 },
|
|
77
|
+
], test.track));
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('the browser is dynamic', () => {
|
|
82
|
+
describe('at chromosome start', () => {
|
|
83
|
+
it('with a single feature on first image only', () => testTrackRender([
|
|
84
|
+
{ start: 1, end: 10 },
|
|
85
|
+
], track));
|
|
86
|
+
|
|
87
|
+
it('with a feature on each (two) image', () => testTrackRender([
|
|
88
|
+
{ start: 1, end: 10 },
|
|
89
|
+
{ start: 21, end: 30 },
|
|
90
|
+
], track));
|
|
91
|
+
|
|
92
|
+
it('with a single feature spanning two images', () => testTrackRender([
|
|
93
|
+
{ start: 16, end: 25 },
|
|
94
|
+
], track));
|
|
95
|
+
|
|
96
|
+
it('with bumped features spanning two images', () => testTrackRender([
|
|
97
|
+
{ start: 1, end: 10 },
|
|
98
|
+
{ start: 6, end: 25 },
|
|
99
|
+
], track));
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
describe('in the middle of the chromosome', () => {
|
|
103
|
+
it('with a feature on each (three) image', () => testTrackRender([
|
|
104
|
+
{ start: 81, end: 90 },
|
|
105
|
+
{ start: 101, end: 110 },
|
|
106
|
+
{ start: 121, end: 130 },
|
|
107
|
+
], track, { start: 101, end: 120 }));
|
|
108
|
+
|
|
109
|
+
it('with a single feature spanning three images', () => testTrackRender([
|
|
110
|
+
{ start: 96, end: 125 },
|
|
111
|
+
], track, { start: 101, end: 120 }));
|
|
112
|
+
|
|
113
|
+
it('with bumped features spanning multiple images', () => testTrackRender([
|
|
114
|
+
{ start: 1, end: 200, color: 'red' },
|
|
115
|
+
{ start: 81, end: 90, color: 'blue' },
|
|
116
|
+
{ start: 86, end: 105, color: 'green' },
|
|
117
|
+
{ start: 88, end: 130, color: 'yellow' },
|
|
118
|
+
{ start: 103, end: 103, color: 'orange' },
|
|
119
|
+
{ start: 110, end: 110, color: 'purple' },
|
|
120
|
+
{ start: 126, end: 135, color: 'pink' },
|
|
121
|
+
{ start: 132, end: 132, color: 'black' },
|
|
122
|
+
], track, { start: 101, end: 120 }));
|
|
123
|
+
|
|
124
|
+
// bump takes precendence over y, so pink is bumped down as it overlaps with red.
|
|
125
|
+
// This probably shouldn't be the case, but mixing feature.y and track.bump is not really supported.
|
|
126
|
+
it('with bumped features and features with feature.y', () => testTrackRender([
|
|
127
|
+
{ start: 1, end: 200, color: 'red' },
|
|
128
|
+
{ start: 81, end: 90, color: 'blue', y: 2 },
|
|
129
|
+
{ start: 86, end: 105, color: 'green' },
|
|
130
|
+
{ start: 88, end: 130, color: 'yellow' },
|
|
131
|
+
{ start: 103, end: 103, color: 'orange' },
|
|
132
|
+
{ start: 110, end: 110, color: 'purple' },
|
|
133
|
+
{ start: 126, end: 135, color: 'pink', y: 0 },
|
|
134
|
+
{ start: 132, end: 132, color: 'black', y: 9 },
|
|
135
|
+
], track, { start: 101, end: 120 }));
|
|
136
|
+
|
|
137
|
+
it('with bumped features of varying heights', () => testTrackRender([
|
|
138
|
+
{ start: 1, end: 200, color: 'red' },
|
|
139
|
+
{ start: 81, end: 90, color: 'blue', height: 15 },
|
|
140
|
+
{ start: 86, end: 105, color: 'green' },
|
|
141
|
+
{ start: 88, end: 130, color: 'yellow' },
|
|
142
|
+
{ start: 103, end: 103, color: 'orange' },
|
|
143
|
+
{ start: 110, end: 110, color: 'purple' },
|
|
144
|
+
{ start: 110, end: 110, color: 'grey', height: 8 },
|
|
145
|
+
{ start: 110, end: 110, color: 'aqua', height: 5 },
|
|
146
|
+
{ start: 126, end: 135, color: 'pink', height: 20 },
|
|
147
|
+
{ start: 132, end: 132, color: 'black' },
|
|
148
|
+
], { ...track, featureMargin: { bottom: 1 } }, { start: 101, end: 120 }));
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
describe('at chromosome end', () => {
|
|
152
|
+
it('with a single feature on last image only', () => testTrackRender([
|
|
153
|
+
{ start: 981, end: 990 },
|
|
154
|
+
], track, { start: 981, end: 1000 }));
|
|
155
|
+
|
|
156
|
+
it('with a feature on each (two) image', () => testTrackRender([
|
|
157
|
+
{ start: 961, end: 970 },
|
|
158
|
+
{ start: 981, end: 990 },
|
|
159
|
+
], track, { start: 981, end: 1000 }));
|
|
160
|
+
|
|
161
|
+
it('with a single feature spanning two images', () => testTrackRender([
|
|
162
|
+
{ start: 976, end: 985 },
|
|
163
|
+
], track, { start: 981, end: 1000 }));
|
|
164
|
+
|
|
165
|
+
it('with bumped features spanning two images', () => testTrackRender([
|
|
166
|
+
{ start: 961, end: 970 },
|
|
167
|
+
{ start: 966, end: 985 },
|
|
168
|
+
], track, { start: 981, end: 1000 }));
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const { afterTest, testTrackRenderStatic } = require('../utils');
|
|
2
|
+
|
|
3
|
+
describe('Correctly render a chromosome:', () => {
|
|
4
|
+
afterEach(afterTest);
|
|
5
|
+
|
|
6
|
+
const genome = {
|
|
7
|
+
'1': {
|
|
8
|
+
size : 1000,
|
|
9
|
+
bands : [
|
|
10
|
+
{ id: 'p13', start: 1, end: 100, type: 'gpos' },
|
|
11
|
+
{ id: 'p12', start: 101, end: 250, type: 'stalk' },
|
|
12
|
+
{ id: 'p11.2', start: 251, end: 300, type: 'gneg' },
|
|
13
|
+
{ id: 'p11.1', start: 301, end: 350, type: 'acen' },
|
|
14
|
+
{ id: 'q11.1', start: 351, end: 450, type: 'acen' },
|
|
15
|
+
{ id: 'q11.21', start: 451, end: 500, type: 'gpos100' },
|
|
16
|
+
{ id: 'q11.22', start: 501, end: 600, type: 'gpos25' },
|
|
17
|
+
{ id: 'q11.23', start: 601, end: 700, type: 'gpos33' },
|
|
18
|
+
{ id: 'q12.1', start: 701, end: 800, type: 'gpos50' },
|
|
19
|
+
{ id: 'q12.2', start: 801, end: 900, type: 'gpos66' },
|
|
20
|
+
{ id: 'q12.3', start: 901, end: 1000, type: 'gvar' },
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
'2': {
|
|
24
|
+
size : 1000,
|
|
25
|
+
bands : [{ id: 'p13', start: 1, end: 1000, type: 'gpos' }],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
it('with all band types', () => testTrackRenderStatic(
|
|
30
|
+
undefined,
|
|
31
|
+
{ _testClass: Genoverse.Track.Chromosome, featureHeight: 20 },
|
|
32
|
+
{ end: genome[1].size, genome: genome, chromosomeSize: genome[1].size, width: genome[1].size }
|
|
33
|
+
));
|
|
34
|
+
|
|
35
|
+
it('with only one band', () => testTrackRenderStatic(
|
|
36
|
+
undefined,
|
|
37
|
+
{ _testClass: Genoverse.Track.Chromosome, featureHeight: 20 },
|
|
38
|
+
{ chr: 2, end: genome[2].size, genome: genome, chromosomeSize: genome[2].size, width: genome[2].size }
|
|
39
|
+
));
|
|
40
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const { afterTest, testTrackRenderStatic } = require('../utils');
|
|
2
|
+
|
|
3
|
+
describe('Correctly render highlights:', () => {
|
|
4
|
+
afterEach(afterTest);
|
|
5
|
+
|
|
6
|
+
const track = { _testClass: Genoverse.Track.HighlightRegion };
|
|
7
|
+
const defaultColors = Genoverse.Track.HighlightRegion.prototype.colors;
|
|
8
|
+
const genoverseConfig = { end: 1000, width: 1000 };
|
|
9
|
+
|
|
10
|
+
it('with a defined color', () => testTrackRenderStatic([{ start: 100, end: 200, label: 'test', color: 'red' }], track, genoverseConfig));
|
|
11
|
+
|
|
12
|
+
it('with a mixture of defined colors and no colors', () => {
|
|
13
|
+
const colors = defaultColors.concat(defaultColors[0]);
|
|
14
|
+
const features = [];
|
|
15
|
+
|
|
16
|
+
colors.splice(3, 0, 'yellow');
|
|
17
|
+
colors.splice(6, 0, 'pink');
|
|
18
|
+
|
|
19
|
+
colors.forEach((c, i) => {
|
|
20
|
+
i++;
|
|
21
|
+
|
|
22
|
+
features.push({ start: 50 * i, end: 25 + (50 * i), label: i.toString(), color: defaultColors.includes(c) ? undefined : c });
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return testTrackRenderStatic(features, track, genoverseConfig);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('where two highlights overlap', () => {
|
|
29
|
+
it('both labels are displayed', () => testTrackRenderStatic(
|
|
30
|
+
[{ start: 100, end: 500, label: 'test1', color: 'red' }, { start: 400, end: 401, label: 'test2', color: 'blue' }],
|
|
31
|
+
track,
|
|
32
|
+
genoverseConfig
|
|
33
|
+
));
|
|
34
|
+
|
|
35
|
+
it('second label is hidden', () => testTrackRenderStatic(
|
|
36
|
+
[{ start: 100, end: 200, label: 'test1', color: 'red' }, { start: 110, end: 120, label: 'test2', color: 'blue' }],
|
|
37
|
+
track,
|
|
38
|
+
genoverseConfig
|
|
39
|
+
));
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('backgrounds', () => {
|
|
43
|
+
it('overlapping highlights, completely inside region', () => testTrackRenderStatic(
|
|
44
|
+
[{ start: 100, end: 200, color: 'red' }, { start: 110, end: 120, color: 'blue' }],
|
|
45
|
+
track,
|
|
46
|
+
genoverseConfig
|
|
47
|
+
));
|
|
48
|
+
|
|
49
|
+
it('only left highlight edge inside region', () => testTrackRenderStatic(
|
|
50
|
+
[{ start: 100, end: 1500, color: 'red' }],
|
|
51
|
+
track,
|
|
52
|
+
{ start: 1000, end: 2000, chromsomeSize: 2000 }
|
|
53
|
+
));
|
|
54
|
+
|
|
55
|
+
it('only right highlight edge inside region', () => testTrackRenderStatic(
|
|
56
|
+
[{ start: 100, end: 2000, color: 'red' }],
|
|
57
|
+
track,
|
|
58
|
+
genoverseConfig
|
|
59
|
+
));
|
|
60
|
+
|
|
61
|
+
it('neither highlight edge inside region', () => testTrackRenderStatic(
|
|
62
|
+
[{ start: 100, end: 3000, color: 'red' }],
|
|
63
|
+
track,
|
|
64
|
+
{ start: 1000, end: 2000, chromsomeSize: 2000 }
|
|
65
|
+
));
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const { afterTest, testTrackRenderStatic } = require('../utils');
|
|
2
|
+
|
|
3
|
+
describe('Correctly render insert variants:', () => {
|
|
4
|
+
afterEach(afterTest);
|
|
5
|
+
|
|
6
|
+
const track = { _testClass: Genoverse.Track.dbSNP, url: false, margin: 0, featureMargin: {} };
|
|
7
|
+
|
|
8
|
+
it('when scale > 1', () => testTrackRenderStatic([{ start: 10, end: 5 }], track));
|
|
9
|
+
|
|
10
|
+
it('when scale < 1', () => testTrackRenderStatic([{ start: 100, end: 50 }], track, { end: 1000 }));
|
|
11
|
+
});
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
const { afterTest, testTrackRender, testTrackRenderStatic } = require('../utils');
|
|
2
|
+
|
|
3
|
+
describe('Correctly render labels where:', () => {
|
|
4
|
+
afterEach(afterTest);
|
|
5
|
+
|
|
6
|
+
const track = { resizable: 'auto', margin: 0, featureHeight: 15, featureMargin: {}, bump: true };
|
|
7
|
+
|
|
8
|
+
it('labels are disabled (track.labels = false)', () => testTrackRenderStatic([
|
|
9
|
+
{ start: 1, end: 10, label: 'abc' },
|
|
10
|
+
], { labels: false, ...track }));
|
|
11
|
+
|
|
12
|
+
describe('labels appear below their features (track.labels = true)', () => {
|
|
13
|
+
it('with a label shorter than its feature', () => testTrackRenderStatic([
|
|
14
|
+
{ start: 1, end: 10, label: 'abc' },
|
|
15
|
+
], track));
|
|
16
|
+
|
|
17
|
+
it('with a label longer than its feature', () => testTrackRenderStatic([
|
|
18
|
+
{ start: 1, end: 10, label: 'WWWWWWWWWW' },
|
|
19
|
+
], track));
|
|
20
|
+
|
|
21
|
+
it('with a multi-line label', () => testTrackRenderStatic([
|
|
22
|
+
{ start: 1, end: 10, label: 'abc\ndef' },
|
|
23
|
+
], track));
|
|
24
|
+
|
|
25
|
+
it('with bumped features', () => testTrackRenderStatic([
|
|
26
|
+
{ start: 1, end: 10, label: 'abc' },
|
|
27
|
+
{ start: 6, end: 6, label: 'def' },
|
|
28
|
+
], track));
|
|
29
|
+
|
|
30
|
+
it('with a multi-line label and bumped features', () => testTrackRenderStatic([
|
|
31
|
+
{ start: 1, end: 10, label: 'abc\ndef' },
|
|
32
|
+
{ start: 6, end: 6, label: 'def' },
|
|
33
|
+
], track));
|
|
34
|
+
|
|
35
|
+
it('with a label longer than its feature and bumped features', () => testTrackRenderStatic([
|
|
36
|
+
{ start: 1, end: 10, label: 'WWWWWW' },
|
|
37
|
+
{ start: 13, end: 13, label: 'abc' },
|
|
38
|
+
{ start: 14, end: 14, label: 'def' },
|
|
39
|
+
], track));
|
|
40
|
+
|
|
41
|
+
describe('with a repeated label (track.repeatLabels = true)', () => {
|
|
42
|
+
describe('where the label is shorter than its feature', () => {
|
|
43
|
+
it('and browser.scale > 1', () => testTrackRender([
|
|
44
|
+
{ start: 85, end: 128, label: 'abc' },
|
|
45
|
+
], { repeatLabels: true, ...track }, { start: 101, end: 120 }));
|
|
46
|
+
|
|
47
|
+
it('and browser.scale <= 1', () => testTrackRender([
|
|
48
|
+
{ start: 151, end: 650, label: 'abc' },
|
|
49
|
+
], { repeatLabels: true, ...track }, { start: 301, end: 500 }));
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('where the label is shorter than its feature, but not shown on the last image', () => {
|
|
53
|
+
it('and browser.scale > 1', () => testTrackRender([
|
|
54
|
+
{ start: 85, end: 127, label: 'abc' },
|
|
55
|
+
], { repeatLabels: true, ...track }, { start: 101, end: 120 }));
|
|
56
|
+
|
|
57
|
+
it('and browser.scale <= 1', () => testTrackRender([
|
|
58
|
+
{ start: 151, end: 510, label: 'abc' },
|
|
59
|
+
], { repeatLabels: true, ...track }, { start: 301, end: 500 }));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('where the label is longer than its feature', () => {
|
|
63
|
+
it('and browser.scale > 1', () => testTrackRender([
|
|
64
|
+
{ start: 85, end: 125, label: 'WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW' },
|
|
65
|
+
], { repeatLabels: true, ...track }, { start: 101, end: 120, longestLabel: 59 }));
|
|
66
|
+
|
|
67
|
+
it('and browser.scale <= 1', () => testTrackRender([
|
|
68
|
+
{ start: 151, end: 510, label: 'WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW' },
|
|
69
|
+
], { repeatLabels: true, ...track }, { start: 301, end: 500, longestLabel: 59 }));
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('labels appear overlaid on their features (track.labels = "overlay")', () => {
|
|
75
|
+
const tr = { labels: 'overlay', ...track };
|
|
76
|
+
|
|
77
|
+
it('with a label shorter than its feature', () => testTrackRenderStatic([
|
|
78
|
+
{ start: 1, end: 10, label: 'WWW', labelColor: 'white' },
|
|
79
|
+
], tr));
|
|
80
|
+
|
|
81
|
+
it('with a label longer than its feature', () => testTrackRenderStatic([
|
|
82
|
+
{ start: 1, end: 10, label: 'WWWWWWWWWW', labelColor: 'white' },
|
|
83
|
+
], tr));
|
|
84
|
+
|
|
85
|
+
it('with a multi-line label (gets joined with space)', () => testTrackRenderStatic([
|
|
86
|
+
{ start: 1, end: 10, label: 'abc\ndef', labelColor: 'white' },
|
|
87
|
+
], tr));
|
|
88
|
+
|
|
89
|
+
it('with bumped features', () => testTrackRenderStatic([
|
|
90
|
+
{ start: 1, end: 10, label: 'abc', labelColor: 'white' },
|
|
91
|
+
{ start: 6, end: 7, label: 'd', labelColor: 'white' },
|
|
92
|
+
], tr));
|
|
93
|
+
|
|
94
|
+
describe('with a repeated label (track.repeatLabels = true)', () => {
|
|
95
|
+
describe('where the label is shorter than its feature', () => {
|
|
96
|
+
it('and browser.scale > 1', () => testTrackRender([
|
|
97
|
+
{ start: 85, end: 138, label: 'abc', labelColor: 'red' },
|
|
98
|
+
], { repeatLabels: true, ...tr }, { start: 101, end: 120 }));
|
|
99
|
+
|
|
100
|
+
it('and browser.scale <= 1', () => testTrackRender([
|
|
101
|
+
{ start: 151, end: 650, label: 'abc', labelColor: 'red' },
|
|
102
|
+
], { repeatLabels: true, ...tr }, { start: 301, end: 500 }));
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe('where the label is shorter than its feature, but not shown on the last image', () => {
|
|
106
|
+
it('and browser.scale > 1', () => testTrackRender([
|
|
107
|
+
{ start: 85, end: 137, label: 'abc', labelColor: 'red' },
|
|
108
|
+
], { repeatLabels: true, ...tr }, { start: 101, end: 120 }));
|
|
109
|
+
|
|
110
|
+
it('and browser.scale <= 1', () => testTrackRender([
|
|
111
|
+
{ start: 151, end: 550, label: 'abc', labelColor: 'red' },
|
|
112
|
+
], { repeatLabels: true, ...tr }, { start: 301, end: 500 }));
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('where the label is longer than its feature', () => testTrackRender([
|
|
116
|
+
{ start: 85, end: 125, label: 'WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW', labelColor: 'white' },
|
|
117
|
+
], { repeatLabels: true, ...tr }, { start: 101, end: 120, longestLabel: 59 }));
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe('labels appear on a separate image - all labels are below all features (track.labels = "separate")', () => {
|
|
122
|
+
const tr = { labels: 'separate', ...track };
|
|
123
|
+
|
|
124
|
+
it('with bumped features and unbumped labels', () => testTrackRenderStatic([
|
|
125
|
+
{ start: 1, end: 10, label: 'abc' },
|
|
126
|
+
{ start: 6, end: 6, label: 'def' },
|
|
127
|
+
], tr));
|
|
128
|
+
|
|
129
|
+
it('with bumped features and bumped labels', () => testTrackRenderStatic([
|
|
130
|
+
{ start: 1, end: 10, label: 'WWW' },
|
|
131
|
+
{ start: 6, end: 6, label: 'abc' },
|
|
132
|
+
], tr));
|
|
133
|
+
|
|
134
|
+
it('with bumped features and bumped labels and track.depth', () => testTrackRenderStatic([
|
|
135
|
+
{ start: 1, end: 10, label: 'WWW' },
|
|
136
|
+
{ start: 6, end: 6, label: 'abc' },
|
|
137
|
+
], { depth: 1, height: 50, ...tr }));
|
|
138
|
+
|
|
139
|
+
describe('with a repeated label (track.repeatLabels = true)', () => {
|
|
140
|
+
describe('where the label is shorter than its feature', () => {
|
|
141
|
+
it('and browser.scale > 1', () => testTrackRender([
|
|
142
|
+
{ start: 85, end: 128, label: 'abc' },
|
|
143
|
+
], { repeatLabels: true, ...tr }, { start: 101, end: 120 }));
|
|
144
|
+
|
|
145
|
+
it('and browser.scale <= 1', () => testTrackRender([
|
|
146
|
+
{ start: 151, end: 650, label: 'abc' },
|
|
147
|
+
], { repeatLabels: true, ...tr }, { start: 301, end: 500 }));
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
describe('where the label is shorter than its feature, but not shown on the last image', () => {
|
|
151
|
+
it('and browser.scale > 1', () => testTrackRender([
|
|
152
|
+
{ start: 85, end: 127, label: 'abc' },
|
|
153
|
+
], { repeatLabels: true, ...tr }, { start: 101, end: 120 }));
|
|
154
|
+
|
|
155
|
+
it('and browser.scale <= 1', () => testTrackRender([
|
|
156
|
+
{ start: 151, end: 510, label: 'abc' },
|
|
157
|
+
], { repeatLabels: true, ...tr }, { start: 301, end: 500 }));
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
describe('where the label is longer than its feature', () => {
|
|
161
|
+
it('and browser.scale > 1', () => testTrackRender([
|
|
162
|
+
{ start: 85, end: 125, label: 'WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW' },
|
|
163
|
+
], { repeatLabels: true, ...tr }, { start: 101, end: 120, longestLabel: 59 }));
|
|
164
|
+
|
|
165
|
+
it('and browser.scale <= 1', () => testTrackRender([
|
|
166
|
+
{ start: 151, end: 510, label: 'WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW' },
|
|
167
|
+
], { repeatLabels: true, ...tr }, { start: 301, end: 500, longestLabel: 59 }));
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
describe('a label spans two images', () => {
|
|
173
|
+
describe('where a feature spans two images, but its label does not', () => {
|
|
174
|
+
it('with track.labels = true', () => testTrackRender([
|
|
175
|
+
{ start: 16, end: 25, label: 'a' },
|
|
176
|
+
], track));
|
|
177
|
+
|
|
178
|
+
it('with track.labels = "overlay"', () => testTrackRender([
|
|
179
|
+
{ start: 6, end: 21, label: 'a', labelColor: 'white' },
|
|
180
|
+
], { labels: 'overlay', ...track }));
|
|
181
|
+
|
|
182
|
+
it('with track.labels = "separate"', () => testTrackRender([
|
|
183
|
+
{ start: 16, end: 25, label: 'a' },
|
|
184
|
+
], { labels: 'separate', ...track }));
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
describe('where a label spans two images, but its feature does not', () => {
|
|
188
|
+
it('with track.labels = true', () => testTrackRender([
|
|
189
|
+
{ start: 19, end: 19, label: 'abcdef' },
|
|
190
|
+
], track));
|
|
191
|
+
|
|
192
|
+
it('with track.labels = "separate"', () => testTrackRender([
|
|
193
|
+
{ start: 19, end: 19, label: 'abcdef' },
|
|
194
|
+
], { labels: 'separate', ...track }));
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
describe('where both feature and label span two images', () => {
|
|
198
|
+
it('with track.labels = true', () => testTrackRender([
|
|
199
|
+
{ start: 16, end: 25, label: 'abcdef' },
|
|
200
|
+
], track));
|
|
201
|
+
|
|
202
|
+
it('with track.labels = "overlay"', () => testTrackRender([
|
|
203
|
+
{ start: 16, end: 25, label: 'abcdef', labelColor: 'white' },
|
|
204
|
+
], { labels: 'overlay', ...track }));
|
|
205
|
+
|
|
206
|
+
it('with track.labels = "separate"', () => testTrackRender([
|
|
207
|
+
{ start: 16, end: 25, label: 'abcdef' },
|
|
208
|
+
], { labels: 'separate', ...track }));
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
describe('with bumped features and labels', () => {
|
|
212
|
+
it('with track.labels = true', () => testTrackRender([
|
|
213
|
+
{ start: 16, end: 25, label: 'a' },
|
|
214
|
+
{ start: 16, end: 25, label: 'abcdef' },
|
|
215
|
+
{ start: 19, end: 19, label: 'qwerty' },
|
|
216
|
+
], track));
|
|
217
|
+
|
|
218
|
+
it('with track.labels = "overlay"', () => testTrackRender([
|
|
219
|
+
{ start: 16, end: 25, label: 'a', labelColor: 'white' },
|
|
220
|
+
{ start: 16, end: 25, label: 'abcdef', labelColor: 'white' },
|
|
221
|
+
{ start: 17, end: 19, label: 'b', labelColor: 'white' },
|
|
222
|
+
], { labels: 'overlay', ...track }));
|
|
223
|
+
|
|
224
|
+
it('with track.labels = "separate"', () => testTrackRender([
|
|
225
|
+
{ start: 16, end: 25, label: 'a' },
|
|
226
|
+
{ start: 16, end: 25, label: 'abcdef' },
|
|
227
|
+
{ start: 19, end: 19, label: 'qwerty' },
|
|
228
|
+
], { labels: 'separate', ...track }));
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
describe('labels are colored', () => {
|
|
233
|
+
it('red label with feature.labelColor', () => testTrackRenderStatic([
|
|
234
|
+
{ start: 1, end: 10, label: 'abc', labelColor: 'red' },
|
|
235
|
+
], track));
|
|
236
|
+
|
|
237
|
+
it('red label with feature.color', () => testTrackRenderStatic([
|
|
238
|
+
{ start: 1, end: 10, label: 'abc', color: 'red' },
|
|
239
|
+
], track));
|
|
240
|
+
|
|
241
|
+
it('red label with track.fontColor', () => testTrackRenderStatic([
|
|
242
|
+
{ start: 1, end: 10, label: 'abc' },
|
|
243
|
+
], { fontColor: 'red', ...track }));
|
|
244
|
+
|
|
245
|
+
it('a mixture of all three methods (order of precendence = feature.labelColor > track.fontColor > feature.color)', () => testTrackRenderStatic([
|
|
246
|
+
{ start: 1, end: 10, label: 'abc', labelColor: 'green' },
|
|
247
|
+
{ start: 1, end: 10, label: 'abc', color: 'blue' },
|
|
248
|
+
{ start: 1, end: 10, label: 'abc' },
|
|
249
|
+
], { fontColor: 'red', ...track }));
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
describe('labels might be forced to be separate', () => {
|
|
253
|
+
[
|
|
254
|
+
{ why: 'track.bump = "labels"', track: Genoverse.Track.extend({ bump: 'labels' }), expected: 'separate' },
|
|
255
|
+
{ why: 'track.depth is set', track: Genoverse.Track.extend({ depth: 1 }), expected: 'separate' },
|
|
256
|
+
{ why: 'track.bump = "labels" and track.labels = "overlay"', track: Genoverse.Track.extend({ bump: 'labels', labels: 'overlay' }), expected: 'overlay' },
|
|
257
|
+
{ why: 'track.depth is set and track.labels = "overlay"', track: Genoverse.Track.extend({ depth: 1, labels: 'overlay' }), expected: 'overlay' },
|
|
258
|
+
{ why: 'track.bump = "labels" and track.labels = false', track: Genoverse.Track.extend({ bump: 'labels', labels: false }), expected: false },
|
|
259
|
+
{ why: 'track.depth is set and track.labels = false', track: Genoverse.Track.extend({ depth: 1, labels: false }), expected: false },
|
|
260
|
+
].forEach((test) => {
|
|
261
|
+
it(`because ${test.why}`, () => {
|
|
262
|
+
expect(new Genoverse({ tracks: [ test.track ], chromosomeSize: 1000 }).tracks[0].prop('labels')).toBe(test.expected);
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const { afterTest, testTrackRenderStatic } = require('../utils');
|
|
2
|
+
|
|
3
|
+
describe('Correctly render legends:', () => {
|
|
4
|
+
afterEach(afterTest);
|
|
5
|
+
|
|
6
|
+
const track = {
|
|
7
|
+
id : 'test',
|
|
8
|
+
margin : 0,
|
|
9
|
+
featureHeight : 10,
|
|
10
|
+
featureMargin : {},
|
|
11
|
+
legend : true,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
it('multiple feature types', () => testTrackRenderStatic(
|
|
15
|
+
[{ start: 1, end: 5, color: 'red', legend: 'test1' }, { start: 6, end: 10, color: 'blue', legend: 'test2' }, { start: 11, end: 15, color: 'green', legend: 'test3' }],
|
|
16
|
+
track,
|
|
17
|
+
{ width: 1000 }
|
|
18
|
+
));
|
|
19
|
+
|
|
20
|
+
it('legends are sorted alphabetically, regardless of feature order', () => testTrackRenderStatic(
|
|
21
|
+
[{ start: 1, end: 5, color: 'red', legend: 'zzz' }, { start: 6, end: 10, color: 'blue', legend: 'aaa' }, { start: 11, end: 15, color: 'green', legend: 'bbb' }],
|
|
22
|
+
track,
|
|
23
|
+
{ width: 1000 }
|
|
24
|
+
));
|
|
25
|
+
|
|
26
|
+
it("feature doesn't have legend property", () => testTrackRenderStatic(
|
|
27
|
+
[{ start: 1, end: 5, color: 'red', legend: 'zzz' }, { start: 6, end: 10, color: 'blue', legend: 'aaa' }, { start: 11, end: 15, color: 'green' }],
|
|
28
|
+
track,
|
|
29
|
+
{ width: 1000 }
|
|
30
|
+
));
|
|
31
|
+
});
|