|
196 | 196 | </v-card> |
197 | 197 | <v-card pa-2> |
198 | 198 | <MSAView |
199 | | - :entries="msaViewEntries" |
| 199 | + :entries="msaEntries" |
200 | 200 | :scores="msaViewScores" |
201 | 201 | :alnLen="alnLen" |
202 | 202 | :alphabet="alphabet" |
@@ -399,12 +399,33 @@ export default { |
399 | 399 | previewColumn: -1, |
400 | 400 | selectedColumns: [], |
401 | 401 | showViewerCondition: false, |
| 402 | + msaEntries: [], |
402 | 403 | } |
403 | 404 | }, |
404 | 405 | watch: { |
405 | 406 | matchRatio: debounce(function() { |
406 | 407 | this.handleUpdateMatchRatio(); |
407 | 408 | }, 400), |
| 409 | + mask: { |
| 410 | + handler(n, o) { |
| 411 | + if (this.msaEntries.length > 0 |
| 412 | + && (o.length == 0 || !n.every((v, i) => v === o[i]))) { |
| 413 | + this.msaEntries.forEach(( v, i ) => { |
| 414 | + v.aa = "" |
| 415 | + v.ss = "" |
| 416 | +
|
| 417 | + for (let j = 0; j < n.length; j++) { |
| 418 | + if (n[j] === 1) { |
| 419 | + v.aa += this.entries[i].aa[j] |
| 420 | + v.ss += this.entries[i].ss[j] |
| 421 | + } |
| 422 | + } |
| 423 | + }) |
| 424 | + } |
| 425 | + }, |
| 426 | + immediate: false, |
| 427 | + deep: true, |
| 428 | + }, |
408 | 429 | }, |
409 | 430 | beforeMount() { |
410 | 431 | const parseSuffix = (suffix) => { |
@@ -456,23 +477,41 @@ export default { |
456 | 477 | } |
457 | 478 | return {chains: chains, resns: resns} |
458 | 479 | } |
459 | | -
|
| 480 | + |
460 | 481 | this.handleUpdateMatchRatio(); |
461 | 482 | |
462 | 483 | for (let entry of this.entries) { |
463 | 484 | if (/-_-_-_/.test(entry.name)) { |
464 | 485 | entry.suffix = entry.name.split("-_-_-_")[1]; |
465 | 486 | } |
466 | 487 | const parsed = parseSuffix(entry.suffix) |
467 | | -
|
| 488 | + |
468 | 489 | entry.offsets = chainToOffset(parsed) |
469 | | -
|
| 490 | + |
470 | 491 | const obj = indexToChainAndOrigResn(entry.aa, parsed) |
471 | 492 | entry.chains = obj.chains |
472 | 493 | entry.resns = obj.resns |
473 | 494 | |
474 | 495 | entry.name = tryFixName(entry.name) |
475 | 496 | } |
| 497 | + |
| 498 | + this.msaEntries = this.entries.map(entry => { |
| 499 | + const copy = { |
| 500 | + name: entry.name, |
| 501 | + aa: entry.aa, |
| 502 | + ss: entry.ss, |
| 503 | + offsets: entry.offsets, |
| 504 | + chains: entry.chains, |
| 505 | + suffix: entry.suffix, |
| 506 | + } |
| 507 | + // for (let i = 0; i < this.mask.length; i++) { |
| 508 | + // if (this.mask[i] === 1) { |
| 509 | + // copy.aa += entry.aa[i]; |
| 510 | + // copy.ss += entry.ss[i]; |
| 511 | + // } |
| 512 | + // } |
| 513 | + return copy; |
| 514 | + }) |
476 | 515 | }, |
477 | 516 | mounted() { |
478 | 517 | window.addEventListener("scroll", this.handleScroll); |
@@ -512,26 +551,6 @@ export default { |
512 | 551 | structureViewerEntries() { |
513 | 552 | return this.structureViewerSelection.map(index => this.entries[index]); |
514 | 553 | }, |
515 | | - msaViewEntries() { |
516 | | - const entries = this.entries.map(entry => { |
517 | | - const copy = { |
518 | | - name: entry.name, |
519 | | - aa: "", |
520 | | - ss: "", |
521 | | - offsets: entry.offsets, |
522 | | - chains: entry.chains, |
523 | | - suffix: entry.suffix, |
524 | | - } |
525 | | - for (let i = 0; i < this.mask.length; i++) { |
526 | | - if (this.mask[i] === 1) { |
527 | | - copy.aa += entry.aa[i]; |
528 | | - copy.ss += entry.ss[i]; |
529 | | - } |
530 | | - } |
531 | | - return copy; |
532 | | - }) |
533 | | - return entries |
534 | | - }, |
535 | 554 | msaViewScores() { |
536 | 555 | return this.scores.filter((_, index) => this.mask[index] === 1); |
537 | 556 | }, |
|
0 commit comments