@platforma-sdk/ui-vue 1.42.53 → 1.43.0
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/.turbo/turbo-build.log +213 -207
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +14 -0
- package/dist/AgGridVue/useAgGridOptions.js +2 -3
- package/dist/AgGridVue/useAgGridOptions.js.map +1 -1
- package/dist/assets/multi-sequence-alignment.worker-Cm0gZp19.js +6 -0
- package/dist/assets/multi-sequence-alignment.worker-Cm0gZp19.js.map +1 -0
- package/dist/assets/phylogenetic-tree.worker-4CrExYEo.js +5 -0
- package/dist/assets/phylogenetic-tree.worker-4CrExYEo.js.map +1 -0
- package/dist/components/PlAgDataTable/PlAgRowCount.vue.js +2 -3
- package/dist/components/PlAgDataTable/PlAgRowCount.vue.js.map +1 -1
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.js +11 -12
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.js.map +1 -1
- package/dist/components/PlAgRowNumHeader.vue.js +8 -9
- package/dist/components/PlAgRowNumHeader.vue.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/Consensus.vue.d.ts +1 -0
- package/dist/components/PlMultiSequenceAlignment/Consensus.vue2.js +48 -46
- package/dist/components/PlMultiSequenceAlignment/Consensus.vue2.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/Consensus.vue3.js +5 -7
- package/dist/components/PlMultiSequenceAlignment/Consensus.vue3.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/Legend.vue2.js +14 -13
- package/dist/components/PlMultiSequenceAlignment/Legend.vue2.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/Legend.vue3.js +9 -8
- package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue.d.ts +16 -9
- package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue2.js +117 -85
- package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue2.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue3.js +25 -18
- package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue3.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue.d.ts +8 -0
- package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue.js +10 -0
- package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue.js.map +1 -0
- package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue2.js +77 -0
- package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue2.js.map +1 -0
- package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue3.js +9 -0
- package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue3.js.map +1 -0
- package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue.d.ts +26 -18
- package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue2.js +119 -120
- package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue2.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue.js +7 -124
- package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue2.js +124 -2
- package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue2.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue3.js +9 -0
- package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue3.js.map +1 -0
- package/dist/components/PlMultiSequenceAlignment/Toolbar.vue2.js +90 -90
- package/dist/components/PlMultiSequenceAlignment/Toolbar.vue2.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/Toolbar.vue3.js +9 -7
- package/dist/components/PlMultiSequenceAlignment/cell-size.d.ts +4 -0
- package/dist/components/PlMultiSequenceAlignment/cell-size.js +8 -0
- package/dist/components/PlMultiSequenceAlignment/cell-size.js.map +1 -0
- package/dist/components/PlMultiSequenceAlignment/data.d.ts +15 -10
- package/dist/components/PlMultiSequenceAlignment/data.js +309 -202
- package/dist/components/PlMultiSequenceAlignment/data.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/markup.js +9 -7
- package/dist/components/PlMultiSequenceAlignment/markup.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/migrations.js +15 -13
- package/dist/components/PlMultiSequenceAlignment/migrations.js.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/multi-sequence-alignment.worker.d.ts +6 -0
- package/dist/components/PlMultiSequenceAlignment/phylogenetic-tree.worker.d.ts +7 -0
- package/dist/components/PlMultiSequenceAlignment/settings.js +3 -4
- package/dist/components/PlMultiSequenceAlignment/settings.js.map +1 -1
- package/dist/index.js +25 -27
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +1 -2
- package/package.json +6 -6
- package/src/components/PlMultiSequenceAlignment/Consensus.vue +38 -39
- package/src/components/PlMultiSequenceAlignment/Legend.vue +9 -9
- package/src/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue +222 -126
- package/src/components/PlMultiSequenceAlignment/PhylogeneticTree.vue +110 -0
- package/src/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue +28 -22
- package/src/components/PlMultiSequenceAlignment/SeqLogo.vue +77 -69
- package/src/components/PlMultiSequenceAlignment/Toolbar.vue +47 -39
- package/src/components/PlMultiSequenceAlignment/cell-size.ts +4 -0
- package/src/components/PlMultiSequenceAlignment/data.ts +361 -149
- package/src/components/PlMultiSequenceAlignment/markup.ts +10 -8
- package/src/components/PlMultiSequenceAlignment/migrations.ts +6 -1
- package/src/components/PlMultiSequenceAlignment/multi-sequence-alignment.worker.ts +54 -0
- package/src/components/PlMultiSequenceAlignment/phylogenetic-tree.worker.ts +89 -0
- package/src/components/PlMultiSequenceAlignment/settings.ts +1 -2
- package/src/lib.ts +1 -3
- package/dist/components/PlMultiSequenceAlignment/multi-sequence-alignment.d.ts +0 -7
- package/dist/components/PlMultiSequenceAlignment/multi-sequence-alignment.js +0 -51
- package/dist/components/PlMultiSequenceAlignment/multi-sequence-alignment.js.map +0 -1
- package/src/components/PlMultiSequenceAlignment/multi-sequence-alignment.ts +0 -101
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type {
|
|
3
|
+
ChartInterface,
|
|
4
|
+
DataByColumns,
|
|
5
|
+
Settings,
|
|
6
|
+
} from '@milaboratories/miplots4';
|
|
7
|
+
import { PlAlert } from '@milaboratories/uikit';
|
|
8
|
+
import {
|
|
9
|
+
computed,
|
|
10
|
+
onBeforeUnmount,
|
|
11
|
+
shallowRef,
|
|
12
|
+
useCssModule,
|
|
13
|
+
useTemplateRef,
|
|
14
|
+
watchEffect,
|
|
15
|
+
} from 'vue';
|
|
16
|
+
import { cellSize } from './cell-size';
|
|
17
|
+
import type { TreeNodeData } from './phylogenetic-tree.worker';
|
|
18
|
+
import { useMiPlots } from './useMiPlots';
|
|
19
|
+
|
|
20
|
+
const props = defineProps<{
|
|
21
|
+
tree: TreeNodeData[];
|
|
22
|
+
}>();
|
|
23
|
+
|
|
24
|
+
const classes = useCssModule();
|
|
25
|
+
|
|
26
|
+
const plotEl = useTemplateRef('plotEl');
|
|
27
|
+
|
|
28
|
+
const settings: Settings = {
|
|
29
|
+
type: 'dendro',
|
|
30
|
+
title: { show: false, name: '' },
|
|
31
|
+
size: {
|
|
32
|
+
width: 149,
|
|
33
|
+
minCellHeight: cellSize.block,
|
|
34
|
+
maxCellHeight: cellSize.block,
|
|
35
|
+
marginLeft: 1,
|
|
36
|
+
marginRight: 0,
|
|
37
|
+
marginTop: 0,
|
|
38
|
+
marginBottom: 0,
|
|
39
|
+
},
|
|
40
|
+
mode: 'normal',
|
|
41
|
+
leavesMode: 'alignLeavesToLine',
|
|
42
|
+
leavesOrder: 'indexAsc',
|
|
43
|
+
legend: { show: false },
|
|
44
|
+
id: {
|
|
45
|
+
type: 'column',
|
|
46
|
+
value: 'nodeId',
|
|
47
|
+
},
|
|
48
|
+
parentId: {
|
|
49
|
+
type: 'column',
|
|
50
|
+
value: 'parentId',
|
|
51
|
+
},
|
|
52
|
+
height: {
|
|
53
|
+
type: 'column',
|
|
54
|
+
value: 'distance',
|
|
55
|
+
},
|
|
56
|
+
showNodes: false,
|
|
57
|
+
showNodesLabels: false,
|
|
58
|
+
showLeavesLabels: false,
|
|
59
|
+
rootPosition: 'left',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const data = computed<DataByColumns>(() => {
|
|
63
|
+
const nodeId: number[] = [];
|
|
64
|
+
const parentId: (number | null)[] = [];
|
|
65
|
+
const distance: number[] = [];
|
|
66
|
+
for (const node of props.tree) {
|
|
67
|
+
nodeId.push(node.id);
|
|
68
|
+
parentId.push(node.parentId ?? null);
|
|
69
|
+
distance.push(node.length ?? 0);
|
|
70
|
+
}
|
|
71
|
+
return ({
|
|
72
|
+
type: 'columns',
|
|
73
|
+
id: `phylogeneticTree-${crypto.randomUUID()}`,
|
|
74
|
+
values: { nodeId, parentId, distance },
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const { miplots, error } = useMiPlots();
|
|
79
|
+
|
|
80
|
+
const plot = shallowRef<ChartInterface>();
|
|
81
|
+
|
|
82
|
+
watchEffect(async () => {
|
|
83
|
+
if (!plotEl.value || !miplots.value) return;
|
|
84
|
+
if (!plot.value) {
|
|
85
|
+
plot.value = miplots.value.newPlot(data.value, settings);
|
|
86
|
+
plot.value.mount(plotEl.value);
|
|
87
|
+
} else {
|
|
88
|
+
plot.value.updateSettingsAndData(data.value, settings);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
onBeforeUnmount(() => {
|
|
93
|
+
plot.value?.unmount();
|
|
94
|
+
});
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
<template>
|
|
98
|
+
<PlAlert v-if="error" type="error">
|
|
99
|
+
{{ error.message }}
|
|
100
|
+
</PlAlert>
|
|
101
|
+
<div v-else ref="plotEl" :class="classes.container" />
|
|
102
|
+
</template>
|
|
103
|
+
|
|
104
|
+
<style module>
|
|
105
|
+
.container {
|
|
106
|
+
svg {
|
|
107
|
+
display: block;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
</style>
|
|
@@ -17,12 +17,14 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
computed,
|
|
19
19
|
onBeforeMount,
|
|
20
|
+
onUnmounted,
|
|
20
21
|
reactive,
|
|
22
|
+
useCssModule,
|
|
21
23
|
useTemplateRef,
|
|
22
24
|
watchEffect,
|
|
23
25
|
} from 'vue';
|
|
24
26
|
import {
|
|
25
|
-
|
|
27
|
+
SEQUENCE_LIMIT,
|
|
26
28
|
useLabelColumnsOptions,
|
|
27
29
|
useMarkupColumnsOptions,
|
|
28
30
|
useMultipleAlignmentData,
|
|
@@ -62,6 +64,8 @@ const props = defineProps<{
|
|
|
62
64
|
readonly selection?: PlSelectionModel;
|
|
63
65
|
}>();
|
|
64
66
|
|
|
67
|
+
const classes = useCssModule();
|
|
68
|
+
|
|
65
69
|
const sequenceColumns = reactive(useSequenceColumnsOptions(() => ({
|
|
66
70
|
pFrame: props.pFrame,
|
|
67
71
|
sequenceColumnPredicate: props.sequenceColumnPredicate,
|
|
@@ -84,6 +88,7 @@ const multipleAlignmentData = reactive(useMultipleAlignmentData(() => ({
|
|
|
84
88
|
selection: props.selection,
|
|
85
89
|
colorScheme: settings.colorScheme,
|
|
86
90
|
alignmentParams: settings.alignmentParams,
|
|
91
|
+
shouldBuildPhylogeneticTree: settings.widgets.includes('tree'),
|
|
87
92
|
})));
|
|
88
93
|
|
|
89
94
|
const formatNumber = new Intl.NumberFormat('en').format;
|
|
@@ -104,7 +109,7 @@ const colorSchemeOptions = computed<
|
|
|
104
109
|
label,
|
|
105
110
|
value: {
|
|
106
111
|
type: 'markup' as const,
|
|
107
|
-
|
|
112
|
+
columnIds: value,
|
|
108
113
|
},
|
|
109
114
|
})),
|
|
110
115
|
],
|
|
@@ -167,15 +172,15 @@ watchEffect(() => {
|
|
|
167
172
|
settingsToReset.push('labelColumnIds');
|
|
168
173
|
}
|
|
169
174
|
|
|
170
|
-
const
|
|
171
|
-
? settings.colorScheme.
|
|
175
|
+
const markupColumnIds = settings.colorScheme?.type === 'markup'
|
|
176
|
+
? settings.colorScheme.columnIds
|
|
172
177
|
: undefined;
|
|
173
178
|
|
|
174
179
|
if (
|
|
175
180
|
!markupColumns.isLoading
|
|
176
|
-
&&
|
|
181
|
+
&& markupColumnIds
|
|
177
182
|
&& (markupColumns.data ?? []).every(
|
|
178
|
-
({ value }) => !isJsonEqual(value,
|
|
183
|
+
({ value }) => !isJsonEqual(value, markupColumnIds),
|
|
179
184
|
)
|
|
180
185
|
) {
|
|
181
186
|
settingsToReset.push('colorScheme');
|
|
@@ -243,6 +248,10 @@ async function exportPdf() {
|
|
|
243
248
|
}
|
|
244
249
|
}
|
|
245
250
|
}
|
|
251
|
+
|
|
252
|
+
onUnmounted(() => {
|
|
253
|
+
multipleAlignmentData.data = undefined;
|
|
254
|
+
});
|
|
246
255
|
</script>
|
|
247
256
|
|
|
248
257
|
<template>
|
|
@@ -258,8 +267,7 @@ async function exportPdf() {
|
|
|
258
267
|
{{ error }}
|
|
259
268
|
</PlAlert>
|
|
260
269
|
<PlAlert
|
|
261
|
-
v-else-if="!multipleAlignmentData.isLoading
|
|
262
|
-
&& (multipleAlignmentData.data?.sequences ?? []).length < 2"
|
|
270
|
+
v-else-if="!multipleAlignmentData.isLoading && !multipleAlignmentData.data"
|
|
263
271
|
type="warn"
|
|
264
272
|
icon
|
|
265
273
|
>
|
|
@@ -274,25 +282,23 @@ async function exportPdf() {
|
|
|
274
282
|
label="Visualization is limited"
|
|
275
283
|
>
|
|
276
284
|
MSA visualization supports {{ formatNumber(2) }} to
|
|
277
|
-
{{ formatNumber(
|
|
278
|
-
{{ formatNumber(
|
|
285
|
+
{{ formatNumber(SEQUENCE_LIMIT) }} sequences. Only the first
|
|
286
|
+
{{ formatNumber(SEQUENCE_LIMIT) }} will be displayed.
|
|
279
287
|
</PlAlert>
|
|
280
288
|
<PlSplash
|
|
281
289
|
type="transparent"
|
|
282
|
-
:class="
|
|
290
|
+
:class="classes.splash"
|
|
283
291
|
:loading="multipleAlignmentData.isLoading"
|
|
284
292
|
>
|
|
285
|
-
<
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
/>
|
|
295
|
-
</template>
|
|
293
|
+
<MultiSequenceAlignmentView
|
|
294
|
+
v-if="multipleAlignmentData.data"
|
|
295
|
+
ref="msa"
|
|
296
|
+
:sequences="multipleAlignmentData.data.sequences"
|
|
297
|
+
:labels="multipleAlignmentData.data.labels"
|
|
298
|
+
:highlight-legend="multipleAlignmentData.data.highlightLegend"
|
|
299
|
+
:phylogenetic-tree="multipleAlignmentData.data.phylogeneticTree"
|
|
300
|
+
:widgets="settings.widgets"
|
|
301
|
+
/>
|
|
296
302
|
</PlSplash>
|
|
297
303
|
</template>
|
|
298
304
|
</template>
|
|
@@ -9,16 +9,20 @@ import {
|
|
|
9
9
|
computed,
|
|
10
10
|
onBeforeUnmount,
|
|
11
11
|
shallowRef,
|
|
12
|
+
useCssModule,
|
|
12
13
|
useTemplateRef,
|
|
13
14
|
watchEffect,
|
|
14
15
|
} from 'vue';
|
|
16
|
+
import { cellSize } from './cell-size';
|
|
15
17
|
import type { ResidueCounts } from './types';
|
|
16
18
|
import { useMiPlots } from './useMiPlots';
|
|
17
19
|
|
|
18
|
-
const
|
|
20
|
+
const props = defineProps<{
|
|
19
21
|
residueCounts: ResidueCounts;
|
|
20
22
|
}>();
|
|
21
23
|
|
|
24
|
+
const classes = useCssModule();
|
|
25
|
+
|
|
22
26
|
const plotEl = useTemplateRef('plotEl');
|
|
23
27
|
|
|
24
28
|
const palette = {
|
|
@@ -59,84 +63,80 @@ const residueColors = {
|
|
|
59
63
|
Z: palette.black,
|
|
60
64
|
};
|
|
61
65
|
|
|
62
|
-
const settings = computed
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
66
|
+
const settings = computed(() => ({
|
|
67
|
+
type: 'discrete',
|
|
68
|
+
title: {
|
|
69
|
+
name: '',
|
|
70
|
+
show: false,
|
|
71
|
+
},
|
|
72
|
+
size: {
|
|
73
|
+
width: props.residueCounts.length * cellSize.inline,
|
|
74
|
+
height: 80,
|
|
75
|
+
innerOffset: 0,
|
|
76
|
+
outerOffset: 0,
|
|
77
|
+
},
|
|
78
|
+
frame: {
|
|
79
|
+
type: 'empty',
|
|
80
|
+
},
|
|
81
|
+
xAxis: {
|
|
82
|
+
title: '',
|
|
83
|
+
showGrid: false,
|
|
84
|
+
showTicks: false,
|
|
85
|
+
hiddenLabels: true,
|
|
86
|
+
},
|
|
87
|
+
yAxis: {
|
|
88
|
+
title: '',
|
|
89
|
+
showGrid: false,
|
|
90
|
+
showTicks: false,
|
|
91
|
+
hiddenLabels: true,
|
|
92
|
+
},
|
|
93
|
+
y: {
|
|
94
|
+
type: 'column',
|
|
95
|
+
value: 'countKey',
|
|
96
|
+
},
|
|
97
|
+
primaryGrouping: {
|
|
98
|
+
columnName: {
|
|
91
99
|
type: 'column',
|
|
92
|
-
value: '
|
|
100
|
+
value: 'columnKey',
|
|
93
101
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
secondaryGrouping: {
|
|
101
|
-
columnName: {
|
|
102
|
-
type: 'column',
|
|
103
|
-
value: 'residueKey',
|
|
104
|
-
},
|
|
102
|
+
},
|
|
103
|
+
secondaryGrouping: {
|
|
104
|
+
columnName: {
|
|
105
|
+
type: 'column',
|
|
106
|
+
value: 'residueKey',
|
|
105
107
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
});
|
|
108
|
+
},
|
|
109
|
+
layers: [{
|
|
110
|
+
type: 'logo',
|
|
111
|
+
aes: { fillColor: residueColors },
|
|
112
|
+
}],
|
|
113
|
+
} satisfies Settings));
|
|
112
114
|
|
|
113
|
-
const data = computed<DataByColumns>(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
for (const [
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
residueKey.push(residue);
|
|
124
|
-
}
|
|
115
|
+
const data = computed<DataByColumns>(() => {
|
|
116
|
+
const countKey: number[] = [];
|
|
117
|
+
const columnKey: number[] = [];
|
|
118
|
+
const residueKey: string[] = [];
|
|
119
|
+
for (const [columnIndex, column] of props.residueCounts.entries()) {
|
|
120
|
+
for (const [residue, count] of Object.entries(column)) {
|
|
121
|
+
if (residue === '-') continue;
|
|
122
|
+
countKey.push(count);
|
|
123
|
+
columnKey.push(columnIndex);
|
|
124
|
+
residueKey.push(residue);
|
|
125
125
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
);
|
|
126
|
+
}
|
|
127
|
+
return ({
|
|
128
|
+
type: 'columns',
|
|
129
|
+
id: `seq-logo-${crypto.randomUUID()}`,
|
|
130
|
+
values: { countKey, columnKey, residueKey },
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
133
|
|
|
134
134
|
const { miplots, error } = useMiPlots();
|
|
135
135
|
|
|
136
136
|
const plot = shallowRef<ChartInterface>();
|
|
137
137
|
|
|
138
138
|
watchEffect(async () => {
|
|
139
|
-
if (!
|
|
139
|
+
if (!plotEl.value || !miplots.value) return;
|
|
140
140
|
if (!plot.value) {
|
|
141
141
|
plot.value = miplots.value.newPlot(data.value, settings.value);
|
|
142
142
|
plot.value.mount(plotEl.value);
|
|
@@ -154,5 +154,13 @@ onBeforeUnmount(() => {
|
|
|
154
154
|
<PlAlert v-if="error" type="error">
|
|
155
155
|
{{ error.message }}
|
|
156
156
|
</PlAlert>
|
|
157
|
-
<div v-else ref="plotEl" />
|
|
157
|
+
<div v-else ref="plotEl" :class="classes.container" />
|
|
158
158
|
</template>
|
|
159
|
+
|
|
160
|
+
<style module>
|
|
161
|
+
.container {
|
|
162
|
+
svg {
|
|
163
|
+
display: block;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
</style>
|
|
@@ -14,13 +14,14 @@ import {
|
|
|
14
14
|
import type {
|
|
15
15
|
PlMultiSequenceAlignmentColorSchemeOption as ColorSchemeOption,
|
|
16
16
|
PlMultiSequenceAlignmentSettings as Settings,
|
|
17
|
+
PlMultiSequenceAlignmentWidget,
|
|
17
18
|
PObjectId,
|
|
18
19
|
PTableColumnId,
|
|
19
20
|
} from '@platforma-sdk/model';
|
|
20
|
-
import { computed, ref, watchEffect } from 'vue';
|
|
21
|
-
import {
|
|
21
|
+
import { computed, ref, useCssModule, watchEffect } from 'vue';
|
|
22
|
+
import { defaultSettings } from './settings';
|
|
22
23
|
|
|
23
|
-
const
|
|
24
|
+
const props = defineProps<{
|
|
24
25
|
settings: Settings;
|
|
25
26
|
sequenceColumnOptions: ListOptionNormalized<PObjectId>[] | undefined;
|
|
26
27
|
labelColumnOptions: ListOptionNormalized<PTableColumnId>[] | undefined;
|
|
@@ -32,6 +33,8 @@ const emit = defineEmits<{
|
|
|
32
33
|
export: [];
|
|
33
34
|
}>();
|
|
34
35
|
|
|
36
|
+
const classes = useCssModule();
|
|
37
|
+
|
|
35
38
|
const settingsOpen = ref(false);
|
|
36
39
|
|
|
37
40
|
function updateSetting<K extends keyof Settings>(
|
|
@@ -42,85 +45,90 @@ function updateSetting<K extends keyof Settings>(
|
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
function toggleWidget(
|
|
45
|
-
widget:
|
|
48
|
+
widget: PlMultiSequenceAlignmentWidget,
|
|
46
49
|
checked: boolean,
|
|
47
50
|
) {
|
|
48
51
|
updateSetting(
|
|
49
52
|
'widgets',
|
|
50
53
|
checked
|
|
51
|
-
? [...settings.widgets, widget]
|
|
52
|
-
: settings.widgets.filter((w) => widget !== w),
|
|
54
|
+
? [...props.settings.widgets, widget]
|
|
55
|
+
: props.settings.widgets.filter((w) => widget !== w),
|
|
53
56
|
);
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
const alignmentParams = ref({ ...settings.alignmentParams });
|
|
59
|
+
const alignmentParams = ref({ ...props.settings.alignmentParams });
|
|
57
60
|
watchEffect(() => {
|
|
58
|
-
alignmentParams.value = { ...settings.alignmentParams };
|
|
61
|
+
alignmentParams.value = { ...props.settings.alignmentParams };
|
|
59
62
|
});
|
|
60
63
|
|
|
61
64
|
const alignmentParamsChangesPending = computed(() =>
|
|
62
|
-
!isJsonEqual(settings.alignmentParams, alignmentParams.value),
|
|
65
|
+
!isJsonEqual(props.settings.alignmentParams, alignmentParams.value),
|
|
63
66
|
);
|
|
64
67
|
|
|
65
68
|
const canResetAlignmentParams = computed(() =>
|
|
66
|
-
!isJsonEqual(settings.alignmentParams,
|
|
69
|
+
!isJsonEqual(props.settings.alignmentParams, defaultSettings.alignmentParams),
|
|
67
70
|
);
|
|
68
71
|
</script>
|
|
69
72
|
|
|
70
73
|
<template>
|
|
71
|
-
<div :class="
|
|
72
|
-
<div :class="
|
|
73
|
-
<div :class="
|
|
74
|
+
<div :class="classes.container">
|
|
75
|
+
<div :class="classes.line">
|
|
76
|
+
<div :class="classes.section">
|
|
74
77
|
<PlDropdownMulti
|
|
75
78
|
label="Sequence Columns"
|
|
76
|
-
:model-value="settings.sequenceColumnIds ?? []"
|
|
77
|
-
:options="sequenceColumnOptions"
|
|
79
|
+
:model-value="props.settings.sequenceColumnIds ?? []"
|
|
80
|
+
:options="props.sequenceColumnOptions"
|
|
78
81
|
clearable
|
|
79
|
-
@update:model-value="updateSetting('sequenceColumnIds',
|
|
82
|
+
@update:model-value="event => updateSetting('sequenceColumnIds', event)"
|
|
80
83
|
/>
|
|
81
84
|
<PlDropdownMulti
|
|
82
|
-
:model-value="settings.labelColumnIds ?? []"
|
|
85
|
+
:model-value="props.settings.labelColumnIds ?? []"
|
|
83
86
|
label="Label Columns"
|
|
84
|
-
:options="labelColumnOptions"
|
|
87
|
+
:options="props.labelColumnOptions"
|
|
85
88
|
clearable
|
|
86
|
-
@update:model-value="updateSetting('labelColumnIds',
|
|
89
|
+
@update:model-value="event => updateSetting('labelColumnIds', event)"
|
|
87
90
|
/>
|
|
88
91
|
<PlDropdown
|
|
89
|
-
:model-value="settings.colorScheme"
|
|
92
|
+
:model-value="props.settings.colorScheme"
|
|
90
93
|
label="Color Scheme"
|
|
91
|
-
:options="colorSchemeOptions"
|
|
92
|
-
@update:model-value="updateSetting('colorScheme',
|
|
94
|
+
:options="props.colorSchemeOptions"
|
|
95
|
+
@update:model-value="event => updateSetting('colorScheme', event)"
|
|
93
96
|
/>
|
|
94
97
|
</div>
|
|
95
|
-
<div :class="
|
|
98
|
+
<div :class="classes.buttons">
|
|
96
99
|
<PlBtnGhost icon="settings" @click.stop="settingsOpen = true">
|
|
97
100
|
Settings
|
|
98
101
|
</PlBtnGhost>
|
|
99
|
-
<PlBtnGhost icon="export" @click.stop="
|
|
102
|
+
<PlBtnGhost icon="export" @click.stop="emit('export')">
|
|
100
103
|
Export
|
|
101
104
|
</PlBtnGhost>
|
|
102
105
|
</div>
|
|
103
106
|
</div>
|
|
104
|
-
<div :class="
|
|
105
|
-
<div :class="
|
|
107
|
+
<div :class="classes.line">
|
|
108
|
+
<div :class="classes.section">
|
|
106
109
|
<PlCheckbox
|
|
107
|
-
:model-value="settings.widgets.includes('seqLogo')"
|
|
108
|
-
@update:model-value="toggleWidget('seqLogo',
|
|
110
|
+
:model-value="props.settings.widgets.includes('seqLogo')"
|
|
111
|
+
@update:model-value="event => toggleWidget('seqLogo', event)"
|
|
109
112
|
>
|
|
110
113
|
Seq logo
|
|
111
114
|
</PlCheckbox>
|
|
112
115
|
<PlCheckbox
|
|
113
|
-
:model-value="settings.widgets.includes('consensus')"
|
|
114
|
-
@update:model-value="toggleWidget('consensus',
|
|
116
|
+
:model-value="props.settings.widgets.includes('consensus')"
|
|
117
|
+
@update:model-value="event => toggleWidget('consensus', event)"
|
|
115
118
|
>
|
|
116
119
|
Consensus
|
|
117
120
|
</PlCheckbox>
|
|
118
121
|
<PlCheckbox :model-value="false" disabled>Navigator</PlCheckbox>
|
|
119
|
-
<PlCheckbox :model-value="false" disabled>Tree</PlCheckbox>
|
|
120
122
|
<PlCheckbox
|
|
121
|
-
:model-value="settings.widgets.includes('
|
|
122
|
-
:
|
|
123
|
-
|
|
123
|
+
:model-value="props.settings.widgets.includes('tree')"
|
|
124
|
+
@update:model-value="event => toggleWidget('tree', event)"
|
|
125
|
+
>
|
|
126
|
+
Tree
|
|
127
|
+
</PlCheckbox>
|
|
128
|
+
<PlCheckbox
|
|
129
|
+
:model-value="props.settings.widgets.includes('legend')"
|
|
130
|
+
:disabled="props.settings.colorScheme.type === 'no-color'"
|
|
131
|
+
@update:model-value="event => toggleWidget('legend', event)"
|
|
124
132
|
>
|
|
125
133
|
Legend
|
|
126
134
|
</PlCheckbox>
|
|
@@ -162,18 +170,18 @@ const canResetAlignmentParams = computed(() =>
|
|
|
162
170
|
</PlNumberField>
|
|
163
171
|
<div
|
|
164
172
|
v-if="alignmentParamsChangesPending"
|
|
165
|
-
:class="
|
|
173
|
+
:class="classes.pendingChanges"
|
|
166
174
|
>
|
|
167
175
|
<PlBtnPrimary @click="updateSetting('alignmentParams', alignmentParams)">
|
|
168
176
|
Apply
|
|
169
177
|
</PlBtnPrimary>
|
|
170
|
-
<PlBtnGhost @click="alignmentParams = settings.alignmentParams">
|
|
178
|
+
<PlBtnGhost @click="alignmentParams = props.settings.alignmentParams">
|
|
171
179
|
Cancel
|
|
172
180
|
</PlBtnGhost>
|
|
173
181
|
</div>
|
|
174
182
|
<PlBtnSecondary
|
|
175
183
|
v-if="canResetAlignmentParams"
|
|
176
|
-
:class="
|
|
184
|
+
:class="classes.resetButton"
|
|
177
185
|
icon="reverse"
|
|
178
186
|
@click="updateSetting('alignmentParams', undefined)"
|
|
179
187
|
>
|
|
@@ -204,14 +212,14 @@ const canResetAlignmentParams = computed(() =>
|
|
|
204
212
|
display: flex;
|
|
205
213
|
}
|
|
206
214
|
|
|
207
|
-
.
|
|
215
|
+
.pendingChanges {
|
|
208
216
|
display: flex;
|
|
209
217
|
button {
|
|
210
218
|
min-width: 160px;
|
|
211
219
|
}
|
|
212
220
|
}
|
|
213
221
|
|
|
214
|
-
.
|
|
222
|
+
.resetButton {
|
|
215
223
|
margin-block-start: auto;
|
|
216
224
|
span {
|
|
217
225
|
text-transform: none;
|