|
16 | 16 | }" |
17 | 17 | preserveAspectRatio="none" |
18 | 18 | > |
19 | | - <path :d="conservationPath(getConservationRange(start, end))" /> |
| 19 | + <path :d="conservationBlocks[i].path" /> |
20 | 20 | <g :transform="`scale(${1 / conservationScaleX}, 1)`"> |
21 | 21 | <text |
22 | | - v-for="(idx) in getConservationMaxCols(start, end)" |
| 22 | + v-for="(idx) in conservationBlocks[i].maxCols" |
23 | 23 | :key="`cons-max-${i}-${idx}`" |
24 | 24 | class="conservation-max" |
25 | 25 | :x="(idx + 0.5) * conservationScaleX" |
|
30 | 30 | </g> |
31 | 31 | </svg> |
32 | 32 | <!-- <SequenceLogo |
33 | | - :sequences="getEntryRanges(start, end, makeGradients=false)" |
| 33 | + :sequences="cachedEntryRanges[i]" |
34 | 34 | :alphabet="alphabet" |
35 | 35 | :lineLen="lineLen" |
36 | 36 | /> --> |
37 | | - <template v-for="({ name, aa, ss, seqStart, css }, j) in getEntryRanges(start, end)"> |
| 37 | + <template v-for="({ name, aa, ss, seqStart, css }, j) in cachedEntryRanges[i]"> |
38 | 38 | <span class="header" :title="name" :style="headerStyle(j)" @click="handleClickHeader($event, j)">{{ |
39 | 39 | name }}</span> |
40 | 40 | <div class="sequence-wrapper" :style="sequenceStyle(j)"> |
@@ -217,7 +217,7 @@ const colorsAaByPalette = { |
217 | 217 | }; |
218 | 218 |
|
219 | 219 | export default { |
220 | | - components: { SequenceLogo, SequenceLogo }, |
| 220 | + components: { SequenceLogo }, |
221 | 221 | data() { |
222 | 222 | return { |
223 | 223 | lineLen: 80, |
@@ -248,40 +248,46 @@ export default { |
248 | 248 | highlightedColumns: {type: Array}, |
249 | 249 | }, |
250 | 250 | mounted() { |
251 | | - this.resizeObserver = new ResizeObserver(debounce(this.handleResize, 100)).observe(this.$refs.msaWrapper); |
| 251 | + this.resizeObserver = new ResizeObserver(debounce(this.handleResize, 100)); |
| 252 | + this.resizeObserver.observe(this.$refs.msaWrapper); |
252 | 253 | this.handleUpdateEntries(); |
253 | 254 | this.handleResize(); |
254 | 255 | this.emitGradients(); |
255 | 256 | }, |
256 | | - updated() { |
257 | | - this.handleResize(); |
258 | | - this.emitGradients(); |
259 | | - }, |
260 | 257 | beforeDestroy() { |
261 | 258 | if (this.resizeObserver) |
262 | 259 | this.resizeObserver.disconnect(); |
263 | 260 | }, |
264 | 261 | watch: { |
265 | 262 | entries: function() { |
266 | 263 | this.handleUpdateEntries(); |
| 264 | + this.$nextTick(() => this.emitGradients()); |
| 265 | + }, |
| 266 | + colorScheme: function() { |
| 267 | + this.$nextTick(() => this.emitGradients()); |
| 268 | + }, |
| 269 | + scores: function() { |
| 270 | + this.$nextTick(() => this.emitGradients()); |
| 271 | + }, |
| 272 | + mask: function() { |
| 273 | + this.$nextTick(() => this.emitGradients()); |
267 | 274 | }, |
268 | 275 | lineLen: function() { |
269 | 276 | this.$emit("lineLen", this.lineLen); |
| 277 | + this.$nextTick(() => this.emitGradients()); |
270 | 278 | }, |
271 | 279 | }, |
272 | 280 | computed: { |
273 | | - maskCumSum() { |
274 | | - if (!this.mask) { |
275 | | - return []; |
276 | | - } |
277 | | -
|
278 | | - const result = []; |
279 | | - let sum = 0; |
280 | | - for (let i = 0; i < this.mask.length; i++) { |
281 | | - sum += this.mask[i] == 0; |
282 | | - result.push(sum); |
283 | | - } |
284 | | - return result; |
| 281 | + cachedEntryRanges() { |
| 282 | + return this.blockRanges.map(([start, end]) => |
| 283 | + this.entries.map(entry => this.getEntryRange(entry, start, end, true)) |
| 284 | + ); |
| 285 | + }, |
| 286 | + conservationBlocks() { |
| 287 | + return this.blockRanges.map(([start, end]) => ({ |
| 288 | + path: this.conservationPath(this.conservationValues.slice(start, end)), |
| 289 | + maxCols: this.getConservationMaxCols(start, end), |
| 290 | + })); |
285 | 291 | }, |
286 | 292 | beforeMaskedIndices() { |
287 | 293 | if (!this.mask) { |
|
0 commit comments