genoverse 4.0.0-beta1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/dist/genoverse.js +1 -1
- package/dist/genoverse.js.map +1 -1
- package/package.json +4 -4
- package/src/js/Track/Model.js +24 -21
- package/src/js/Track.js +3 -1
- package/test/change-width.test.js +71 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genoverse",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Genoverse is a portable, customizable, back-end independent JavaScript and HTML5 based genome browser which allows the user to explore data in a dynamic and interactive manner.",
|
|
5
5
|
"main": "src/js/Genoverse.js",
|
|
6
6
|
"directories": {
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"babel-plugin-transform-amd-to-commonjs": "^1.4.0",
|
|
35
35
|
"canvas": "^2.8.0",
|
|
36
36
|
"clean-webpack-plugin": "^4.0.0",
|
|
37
|
-
"css-loader": "^6.
|
|
37
|
+
"css-loader": "^6.7.0",
|
|
38
38
|
"eslint": "^8.6.0",
|
|
39
39
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
40
40
|
"eslint-plugin-align-assignments": "^1.1.2",
|
|
41
41
|
"eslint-plugin-es": "^4.1.0",
|
|
42
42
|
"eslint-plugin-import": "^2.25.4",
|
|
43
43
|
"jest": "^27.5.1",
|
|
44
|
-
"mini-css-extract-plugin": "^2.
|
|
44
|
+
"mini-css-extract-plugin": "^2.6.0",
|
|
45
45
|
"terser-webpack-plugin": "^5.3.0",
|
|
46
|
-
"webpack": "^5.
|
|
46
|
+
"webpack": "^5.70.0",
|
|
47
47
|
"webpack-cli": "^4.9.1",
|
|
48
48
|
"webpack-dev-server": "^4.7.4"
|
|
49
49
|
},
|
package/src/js/Track/Model.js
CHANGED
|
@@ -100,7 +100,6 @@ export default Base.extend({
|
|
|
100
100
|
return deferred.resolve();
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
const model = this;
|
|
104
103
|
const bins = [];
|
|
105
104
|
const length = end - start + 1;
|
|
106
105
|
|
|
@@ -123,26 +122,30 @@ export default Base.extend({
|
|
|
123
122
|
...bins.map(
|
|
124
123
|
(bin) => {
|
|
125
124
|
const request = jQuery.ajax({
|
|
126
|
-
url :
|
|
127
|
-
data :
|
|
128
|
-
dataType :
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
url : this.parseURL(chr, bin[0], bin[1]),
|
|
126
|
+
data : this.urlParams,
|
|
127
|
+
dataType : this.dataType,
|
|
128
|
+
xhrFields : this.xhrFields,
|
|
129
|
+
}).done(
|
|
130
|
+
(data) => {
|
|
132
131
|
this.receiveData(data, chr, bin[0], bin[1]);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
132
|
+
}
|
|
133
|
+
).fail(
|
|
134
|
+
(xhr, statusText, ...args) => {
|
|
135
|
+
if (this.track?.controller?.showError) {
|
|
136
|
+
this.track.controller.showError(
|
|
137
|
+
this.showServerErrors && xhr.responseJSON?.message
|
|
138
|
+
? xhr.responseJSON.message
|
|
139
|
+
: `${statusText} while getting the data, see console for more details`,
|
|
140
|
+
[ xhr, statusText, ...args ]
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
).always(
|
|
145
|
+
() => {
|
|
146
|
+
this.dataLoading = this.dataLoading.filter(loading => request !== loading);
|
|
147
|
+
}
|
|
148
|
+
);
|
|
146
149
|
|
|
147
150
|
request.coords = [ chr, bin[0], bin[1] ]; // store actual chr, start and end on the request, in case they are needed
|
|
148
151
|
|
|
@@ -150,7 +153,7 @@ export default Base.extend({
|
|
|
150
153
|
request.done(done);
|
|
151
154
|
}
|
|
152
155
|
|
|
153
|
-
|
|
156
|
+
this.dataLoading.push(request);
|
|
154
157
|
|
|
155
158
|
return request;
|
|
156
159
|
}
|
package/src/js/Track.js
CHANGED
|
@@ -615,7 +615,9 @@ const Track = Base.extend({
|
|
|
615
615
|
},
|
|
616
616
|
|
|
617
617
|
reset: function (...args) {
|
|
618
|
-
|
|
618
|
+
if (args[0] !== 'resizing') {
|
|
619
|
+
this.setLengthMap();
|
|
620
|
+
}
|
|
619
621
|
|
|
620
622
|
Object.values(this.models).filter(model => model.url !== false).forEach(model => model.init(true));
|
|
621
623
|
Object.values(this.views).forEach(view => view.init(true));
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const { afterTest } = require('./utils');
|
|
2
|
+
|
|
3
|
+
describe('Changing width', () => {
|
|
4
|
+
afterEach(afterTest);
|
|
5
|
+
|
|
6
|
+
const genoverse = new Genoverse({
|
|
7
|
+
chr : 1,
|
|
8
|
+
start : 1,
|
|
9
|
+
end : 20,
|
|
10
|
+
chromosomeSize : 9e99,
|
|
11
|
+
width : 100,
|
|
12
|
+
tracks : [ Genoverse.Track.extend({ 10: false, model: Genoverse.Track.Model.extend({ __test: true }) }) ],
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const track = genoverse.tracks[0];
|
|
16
|
+
|
|
17
|
+
it('Initial settings are correct', () => {
|
|
18
|
+
expect(track.lengthMap.length).toBe(2);
|
|
19
|
+
expect(track.lengthMap.map(l => l[0])).toEqual([ 10, -1 ]);
|
|
20
|
+
|
|
21
|
+
expect(track.model).toEqual(track.models[10]);
|
|
22
|
+
expect(track.model.__test).toBe(undefined);
|
|
23
|
+
|
|
24
|
+
expect(genoverse.width).toBe(100);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('Settings are correct after width change', (done) => {
|
|
28
|
+
genoverse.setWidth(1000);
|
|
29
|
+
|
|
30
|
+
setTimeout( // setWidth causes tracks to be reset after a 1ms delay, which we need to wait for here
|
|
31
|
+
() => {
|
|
32
|
+
try {
|
|
33
|
+
expect(track.lengthMap.length).toBe(2);
|
|
34
|
+
expect(track.lengthMap.map(l => l[0])).toEqual([ 10, -1 ]);
|
|
35
|
+
|
|
36
|
+
expect(track.model).toEqual(track.models[10]);
|
|
37
|
+
expect(track.model.__test).toBe(undefined);
|
|
38
|
+
|
|
39
|
+
expect(genoverse.width).toBe(1000);
|
|
40
|
+
|
|
41
|
+
done();
|
|
42
|
+
} catch (e) {
|
|
43
|
+
done(e);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
100
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('Model changes correctly after width change + zoom out', (done) => {
|
|
51
|
+
genoverse.setWidth(1000);
|
|
52
|
+
|
|
53
|
+
setTimeout( // setWidth causes tracks to be reset after a 1ms delay, which we need to wait for here
|
|
54
|
+
() => {
|
|
55
|
+
genoverse.moveTo(1, 1, 5);
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
expect(genoverse.width).toBe(1000);
|
|
59
|
+
expect(genoverse.length).toBe(5);
|
|
60
|
+
expect(track.model).toEqual(track.models[-1]);
|
|
61
|
+
expect(track.model.__test).toBe(true);
|
|
62
|
+
|
|
63
|
+
done();
|
|
64
|
+
} catch (e) {
|
|
65
|
+
done(e);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
100
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
});
|