Skip to content

Commit bb1b2af

Browse files
committed
Refactored msaViewEntries to msaEntries in MSA.vue
1 parent 611c36f commit bb1b2af

2 files changed

Lines changed: 49 additions & 28 deletions

File tree

frontend/MSA.vue

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
</v-card>
197197
<v-card pa-2>
198198
<MSAView
199-
:entries="msaViewEntries"
199+
:entries="msaEntries"
200200
:scores="msaViewScores"
201201
:alnLen="alnLen"
202202
:alphabet="alphabet"
@@ -399,12 +399,33 @@ export default {
399399
previewColumn: -1,
400400
selectedColumns: [],
401401
showViewerCondition: false,
402+
msaEntries: [],
402403
}
403404
},
404405
watch: {
405406
matchRatio: debounce(function() {
406407
this.handleUpdateMatchRatio();
407408
}, 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+
},
408429
},
409430
beforeMount() {
410431
const parseSuffix = (suffix) => {
@@ -456,23 +477,41 @@ export default {
456477
}
457478
return {chains: chains, resns: resns}
458479
}
459-
480+
460481
this.handleUpdateMatchRatio();
461482
462483
for (let entry of this.entries) {
463484
if (/-_-_-_/.test(entry.name)) {
464485
entry.suffix = entry.name.split("-_-_-_")[1];
465486
}
466487
const parsed = parseSuffix(entry.suffix)
467-
488+
468489
entry.offsets = chainToOffset(parsed)
469-
490+
470491
const obj = indexToChainAndOrigResn(entry.aa, parsed)
471492
entry.chains = obj.chains
472493
entry.resns = obj.resns
473494
474495
entry.name = tryFixName(entry.name)
475496
}
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+
})
476515
},
477516
mounted() {
478517
window.addEventListener("scroll", this.handleScroll);
@@ -512,26 +551,6 @@ export default {
512551
structureViewerEntries() {
513552
return this.structureViewerSelection.map(index => this.entries[index]);
514553
},
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-
},
535554
msaViewScores() {
536555
return this.scores.filter((_, index) => this.mask[index] === 1);
537556
},

frontend/SelectToSendPanelFoldMason.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ export default {
9999
type: Array,
100100
default: () => {[]},
101101
},
102-
selectedCounts: 0,
103102
},
104103
// mounted() {
105104
// console.log(this.entries, this.targetIndex);
@@ -216,6 +215,9 @@ export default {
216215
},
217216
},
218217
computed: {
218+
selectedCounts() {
219+
return this.resnoStr.length
220+
},
219221
selectionBannerContent() {
220222
if (this.targetIndex < 0) {
221223
return 'No selection'
@@ -288,7 +290,7 @@ export default {
288290
return (str + t).padEnd(69, ' ') + '\n'
289291
},
290292
motifStr() {
291-
if (this.selectedCounts == 0) {
293+
if (this.selectedColumns.length == 0) {
292294
return ""
293295
} else {
294296
return this.resnoStr
@@ -302,8 +304,8 @@ export default {
302304
}
303305
},
304306
resnoStr() {
305-
if (this.selectedCounts == 0) {
306-
return ""
307+
if (this.selectedColumns.length == 0) {
308+
return []
307309
} else {
308310
return getResidueIndices
309311
(this.entries[this.targetIndex].aa,

0 commit comments

Comments
 (0)