genoverse 4.0.0 → 4.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/genoverse.js +1 -1
- package/dist/genoverse.js.map +1 -1
- package/package.json +1 -1
- package/src/js/Track/Model.js +17 -16
- 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.1",
|
|
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": {
|
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,28 @@ 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
|
+
}).then(
|
|
130
|
+
(data) => {
|
|
132
131
|
this.receiveData(data, chr, bin[0], bin[1]);
|
|
133
|
-
}
|
|
134
|
-
|
|
132
|
+
}
|
|
133
|
+
).catch(
|
|
134
|
+
(xhr, statusText, ...args) => {
|
|
135
135
|
this.track.controller.showError(
|
|
136
|
-
this.showServerErrors &&
|
|
136
|
+
this.showServerErrors && xhr.responseJSON?.message
|
|
137
137
|
? xhr.responseJSON.message
|
|
138
138
|
: `${statusText} while getting the data, see console for more details`,
|
|
139
139
|
[ xhr, statusText, ...args ]
|
|
140
140
|
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
}
|
|
142
|
+
).always(
|
|
143
|
+
() => {
|
|
144
|
+
this.dataLoading = this.dataLoading.filter(loading => request !== loading);
|
|
145
|
+
}
|
|
146
|
+
);
|
|
146
147
|
|
|
147
148
|
request.coords = [ chr, bin[0], bin[1] ]; // store actual chr, start and end on the request, in case they are needed
|
|
148
149
|
|
|
@@ -150,7 +151,7 @@ export default Base.extend({
|
|
|
150
151
|
request.done(done);
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
|
|
154
|
+
this.dataLoading.push(request);
|
|
154
155
|
|
|
155
156
|
return request;
|
|
156
157
|
}
|
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
|
+
});
|