@platforma-sdk/ui-vue 1.45.34 → 1.45.36

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.
Files changed (150) hide show
  1. package/.turbo/turbo-build.log +216 -222
  2. package/.turbo/turbo-type-check.log +1 -1
  3. package/CHANGELOG.md +16 -0
  4. package/dist/AgGridVue/useAgGridOptions.js +2 -3
  5. package/dist/AgGridVue/useAgGridOptions.js.map +1 -1
  6. package/dist/components/{PlMultiSequenceAlignment/Legend.vue.d.ts → PlAdvancedFilter/OperandButton.vue.d.ts} +4 -2
  7. package/dist/components/{PlMultiSequenceAlignment/Toolbar.vue.js → PlAdvancedFilter/OperandButton.vue.js} +3 -3
  8. package/dist/components/PlAdvancedFilter/OperandButton.vue.js.map +1 -0
  9. package/dist/components/PlAdvancedFilter/OperandButton.vue2.js +25 -0
  10. package/dist/components/PlAdvancedFilter/OperandButton.vue2.js.map +1 -0
  11. package/dist/components/PlAdvancedFilter/OperandButton.vue3.js +13 -0
  12. package/dist/components/PlAdvancedFilter/OperandButton.vue3.js.map +1 -0
  13. package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue.d.ts +39 -0
  14. package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue.js +10 -0
  15. package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue.js.map +1 -0
  16. package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue2.js +199 -0
  17. package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue2.js.map +1 -0
  18. package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue3.js +17 -0
  19. package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue3.js.map +1 -0
  20. package/dist/components/PlAdvancedFilter/SingleFilter.vue.d.ts +37 -0
  21. package/dist/components/{PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue.js → PlAdvancedFilter/SingleFilter.vue.js} +3 -3
  22. package/dist/components/PlAdvancedFilter/SingleFilter.vue.js.map +1 -0
  23. package/dist/components/PlAdvancedFilter/SingleFilter.vue2.js +306 -0
  24. package/dist/components/PlAdvancedFilter/SingleFilter.vue2.js.map +1 -0
  25. package/dist/components/PlAdvancedFilter/SingleFilter.vue3.js +35 -0
  26. package/dist/components/PlAdvancedFilter/SingleFilter.vue3.js.map +1 -0
  27. package/dist/components/PlAdvancedFilter/constants.d.ts +4 -0
  28. package/dist/components/PlAdvancedFilter/constants.js +41 -0
  29. package/dist/components/PlAdvancedFilter/constants.js.map +1 -0
  30. package/dist/components/PlAdvancedFilter/index.d.ts +1 -0
  31. package/dist/components/PlAdvancedFilter/types.d.ts +57 -0
  32. package/dist/components/PlAdvancedFilter/types.js +8 -0
  33. package/dist/components/PlAdvancedFilter/types.js.map +1 -0
  34. package/dist/components/PlAdvancedFilter/utils.js +150 -0
  35. package/dist/components/PlAdvancedFilter/utils.js.map +1 -0
  36. package/dist/components/PlAgDataTable/PlAgRowCount.vue.js +7 -8
  37. package/dist/components/PlAgDataTable/PlAgRowCount.vue.js.map +1 -1
  38. package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.js +9 -10
  39. package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.js.map +1 -1
  40. package/dist/components/PlAgRowNumHeader.vue.js +2 -3
  41. package/dist/components/PlAgRowNumHeader.vue.js.map +1 -1
  42. package/dist/index.js +32 -32
  43. package/dist/lib.d.ts +1 -1
  44. package/package.json +6 -7
  45. package/src/components/PlAdvancedFilter/OperandButton.vue +53 -0
  46. package/src/components/PlAdvancedFilter/PlAdvancedFilter.vue +209 -0
  47. package/src/components/PlAdvancedFilter/SingleFilter.vue +425 -0
  48. package/src/components/PlAdvancedFilter/constants.ts +42 -0
  49. package/src/components/PlAdvancedFilter/index.ts +1 -0
  50. package/src/components/PlAdvancedFilter/types.ts +77 -0
  51. package/src/components/PlAdvancedFilter/utils.ts +215 -0
  52. package/src/lib.ts +2 -2
  53. package/dist/assets/multi-sequence-alignment.worker-Cm0gZp19.js +0 -6
  54. package/dist/assets/multi-sequence-alignment.worker-Cm0gZp19.js.map +0 -1
  55. package/dist/assets/phylogenetic-tree.worker-4CrExYEo.js +0 -5
  56. package/dist/assets/phylogenetic-tree.worker-4CrExYEo.js.map +0 -1
  57. package/dist/components/PlMultiSequenceAlignment/Consensus.vue.d.ts +0 -9
  58. package/dist/components/PlMultiSequenceAlignment/Consensus.vue.js +0 -10
  59. package/dist/components/PlMultiSequenceAlignment/Consensus.vue.js.map +0 -1
  60. package/dist/components/PlMultiSequenceAlignment/Consensus.vue2.js +0 -122
  61. package/dist/components/PlMultiSequenceAlignment/Consensus.vue2.js.map +0 -1
  62. package/dist/components/PlMultiSequenceAlignment/Consensus.vue3.js +0 -9
  63. package/dist/components/PlMultiSequenceAlignment/Consensus.vue3.js.map +0 -1
  64. package/dist/components/PlMultiSequenceAlignment/Legend.vue.js +0 -10
  65. package/dist/components/PlMultiSequenceAlignment/Legend.vue.js.map +0 -1
  66. package/dist/components/PlMultiSequenceAlignment/Legend.vue2.js +0 -28
  67. package/dist/components/PlMultiSequenceAlignment/Legend.vue2.js.map +0 -1
  68. package/dist/components/PlMultiSequenceAlignment/Legend.vue3.js +0 -13
  69. package/dist/components/PlMultiSequenceAlignment/Legend.vue3.js.map +0 -1
  70. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue.d.ts +0 -25
  71. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue.js +0 -10
  72. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue.js.map +0 -1
  73. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue2.js +0 -138
  74. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue2.js.map +0 -1
  75. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue3.js +0 -31
  76. package/dist/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue3.js.map +0 -1
  77. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue.d.ts +0 -8
  78. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue.js +0 -10
  79. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue.js.map +0 -1
  80. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue2.js +0 -77
  81. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue2.js.map +0 -1
  82. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue3.js +0 -9
  83. package/dist/components/PlMultiSequenceAlignment/PhylogeneticTree.vue3.js.map +0 -1
  84. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue.d.ts +0 -71
  85. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue.js.map +0 -1
  86. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue2.js +0 -224
  87. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue2.js.map +0 -1
  88. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue3.js +0 -9
  89. package/dist/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue3.js.map +0 -1
  90. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue.d.ts +0 -8
  91. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue.js +0 -10
  92. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue.js.map +0 -1
  93. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue2.js +0 -127
  94. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue2.js.map +0 -1
  95. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue3.js +0 -9
  96. package/dist/components/PlMultiSequenceAlignment/SeqLogo.vue3.js.map +0 -1
  97. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue.d.ts +0 -16
  98. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue.js.map +0 -1
  99. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue2.js +0 -228
  100. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue2.js.map +0 -1
  101. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue3.js +0 -19
  102. package/dist/components/PlMultiSequenceAlignment/Toolbar.vue3.js.map +0 -1
  103. package/dist/components/PlMultiSequenceAlignment/cell-size.d.ts +0 -4
  104. package/dist/components/PlMultiSequenceAlignment/cell-size.js +0 -8
  105. package/dist/components/PlMultiSequenceAlignment/cell-size.js.map +0 -1
  106. package/dist/components/PlMultiSequenceAlignment/chemical-properties.d.ts +0 -44
  107. package/dist/components/PlMultiSequenceAlignment/chemical-properties.js +0 -132
  108. package/dist/components/PlMultiSequenceAlignment/chemical-properties.js.map +0 -1
  109. package/dist/components/PlMultiSequenceAlignment/data.d.ts +0 -61
  110. package/dist/components/PlMultiSequenceAlignment/data.js +0 -370
  111. package/dist/components/PlMultiSequenceAlignment/data.js.map +0 -1
  112. package/dist/components/PlMultiSequenceAlignment/index.d.ts +0 -1
  113. package/dist/components/PlMultiSequenceAlignment/markup.d.ts +0 -16
  114. package/dist/components/PlMultiSequenceAlignment/markup.js +0 -84
  115. package/dist/components/PlMultiSequenceAlignment/markup.js.map +0 -1
  116. package/dist/components/PlMultiSequenceAlignment/migrations.d.ts +0 -3
  117. package/dist/components/PlMultiSequenceAlignment/migrations.js +0 -24
  118. package/dist/components/PlMultiSequenceAlignment/migrations.js.map +0 -1
  119. package/dist/components/PlMultiSequenceAlignment/multi-sequence-alignment.worker.d.ts +0 -6
  120. package/dist/components/PlMultiSequenceAlignment/phylogenetic-tree.worker.d.ts +0 -7
  121. package/dist/components/PlMultiSequenceAlignment/residue-counts.d.ts +0 -2
  122. package/dist/components/PlMultiSequenceAlignment/residue-counts.js +0 -13
  123. package/dist/components/PlMultiSequenceAlignment/residue-counts.js.map +0 -1
  124. package/dist/components/PlMultiSequenceAlignment/settings.d.ts +0 -2
  125. package/dist/components/PlMultiSequenceAlignment/settings.js +0 -9
  126. package/dist/components/PlMultiSequenceAlignment/settings.js.map +0 -1
  127. package/dist/components/PlMultiSequenceAlignment/types.d.ts +0 -5
  128. package/dist/components/PlMultiSequenceAlignment/useMiPlots.d.ts +0 -4
  129. package/dist/components/PlMultiSequenceAlignment/useMiPlots.js +0 -19
  130. package/dist/components/PlMultiSequenceAlignment/useMiPlots.js.map +0 -1
  131. package/src/components/PlMultiSequenceAlignment/Consensus.vue +0 -165
  132. package/src/components/PlMultiSequenceAlignment/Legend.vue +0 -44
  133. package/src/components/PlMultiSequenceAlignment/MultiSequenceAlignmentView.vue +0 -299
  134. package/src/components/PlMultiSequenceAlignment/PhylogeneticTree.vue +0 -110
  135. package/src/components/PlMultiSequenceAlignment/PlMultiSequenceAlignment.vue +0 -314
  136. package/src/components/PlMultiSequenceAlignment/README.md +0 -216
  137. package/src/components/PlMultiSequenceAlignment/SeqLogo.vue +0 -166
  138. package/src/components/PlMultiSequenceAlignment/Toolbar.vue +0 -228
  139. package/src/components/PlMultiSequenceAlignment/cell-size.ts +0 -4
  140. package/src/components/PlMultiSequenceAlignment/chemical-properties.ts +0 -199
  141. package/src/components/PlMultiSequenceAlignment/data.ts +0 -661
  142. package/src/components/PlMultiSequenceAlignment/index.ts +0 -1
  143. package/src/components/PlMultiSequenceAlignment/markup.ts +0 -141
  144. package/src/components/PlMultiSequenceAlignment/migrations.ts +0 -46
  145. package/src/components/PlMultiSequenceAlignment/multi-sequence-alignment.worker.ts +0 -54
  146. package/src/components/PlMultiSequenceAlignment/phylogenetic-tree.worker.ts +0 -89
  147. package/src/components/PlMultiSequenceAlignment/residue-counts.ts +0 -124
  148. package/src/components/PlMultiSequenceAlignment/settings.ts +0 -7
  149. package/src/components/PlMultiSequenceAlignment/types.ts +0 -3
  150. package/src/components/PlMultiSequenceAlignment/useMiPlots.ts +0 -23
@@ -1,141 +0,0 @@
1
- import type { HighlightLegend } from './types';
2
-
3
- export type Markup = { id: string; start: number; length: number }[];
4
-
5
- export function parseMarkup(row: string): Markup {
6
- return Array.from(row.matchAll(
7
- /(?<id>[^:]*):(?<start>[0-9A-Za-z]*)(?:\+(?<length>[0-9A-Za-z]*))?\|?/g,
8
- )).map((match) => {
9
- const matchGroups = match.groups as {
10
- id: string;
11
- start: string;
12
- length: string | undefined;
13
- };
14
- const start = Number.parseInt(matchGroups.start, 36);
15
- const length = matchGroups.length
16
- ? Number.parseInt(matchGroups.length, 36)
17
- : 0;
18
- return {
19
- id: matchGroups.id,
20
- start,
21
- length,
22
- };
23
- });
24
- }
25
-
26
- export function markupAlignedSequence(
27
- alignedSequence: string,
28
- markup: Markup,
29
- ): Markup {
30
- const indexMap = alignedSequence.split('').reduce<number[]>(
31
- (acc, char, index) => {
32
- if (char !== '-') acc.push(index);
33
- return acc;
34
- },
35
- [],
36
- );
37
- const adjusted = markup.map((segment) => {
38
- const start = indexMap[segment.start];
39
- const end = indexMap[segment.start + segment.length - 1] + 1;
40
- return {
41
- id: segment.id,
42
- start: start,
43
- length: end - start,
44
- };
45
- });
46
- return adjusted;
47
- }
48
-
49
- export function highlightByMarkup(
50
- { markupRows, columnCount, labels }: {
51
- markupRows: Markup[];
52
- columnCount: number;
53
- labels: Record<string, string>;
54
- },
55
- ): { blob: Blob; legend: HighlightLegend } {
56
- const linesById: Map<string, {
57
- row: number;
58
- start: number;
59
- length: number;
60
- }[]> = new Map();
61
- for (const [row, markup] of markupRows.entries()) {
62
- for (const { id, start, length } of markup) {
63
- let bucket = linesById.get(id);
64
- if (!bucket) linesById.set(id, bucket = []);
65
- bucket.push({ row, start, length });
66
- }
67
- }
68
- const legend: HighlightLegend = Object.fromEntries(
69
- Object.entries(labels)
70
- .map(([id, label], index) =>
71
- [
72
- id,
73
- {
74
- label,
75
- color: markupColors[index % markupColors.length],
76
- },
77
- ] as const,
78
- )
79
- .filter(([id]) => linesById.has(id)),
80
- );
81
- const blob = new Blob(
82
- (function*() {
83
- const viewBox = `0 0 ${columnCount} ${markupRows.length * 2}`;
84
- yield `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewBox}" stroke-width="2" preserveAspectRatio="none">`;
85
- for (const [id, lines] of linesById) {
86
- const { color } = legend[id];
87
- yield `<path stroke="${color}" d="`;
88
- let x = 0, y = 0;
89
- for (const { row, start, length } of lines) {
90
- yield `m${start - x},${row * 2 + 1 - y}h${length}`;
91
- x = start + length;
92
- y = row * 2 + 1;
93
- }
94
- yield '"/>';
95
- }
96
- yield '</svg>';
97
- })().toArray(),
98
- { type: 'image/svg+xml' },
99
- );
100
- return { blob, legend };
101
- }
102
-
103
- const markupColors = [
104
- '#E5F2FF',
105
- '#FFE8E8',
106
- '#F0EBFF',
107
- '#FFFFE3',
108
- '#E5F7E5',
109
- '#FEEAFE',
110
- '#FDEED6',
111
- '#E8FDFE',
112
- '#CCDFF2',
113
- '#F2CCCD',
114
- '#D5CCF2',
115
- '#F2F2CC',
116
- '#CCF2CC',
117
- '#F2CCF2',
118
- '#EFDDBF',
119
- '#DEEEEF',
120
- ];
121
-
122
- if (import.meta.vitest) {
123
- const { test, expect } = import.meta.vitest;
124
- test('annotateAlignedRow', () => {
125
- const alignedSequence
126
- = 'EVRLVESGGALVQPGGSLRLSCVAASGFTFINNWVTWVRQAPGKGLEWVANIKEDGSQKYYVDSVKGRFTISRDNAEKSVYLQMSSLRVDDTAVYYCAR------------GRAV----D---QWGQGTLVTVSS';
127
- // 0 10 20 30 40 50 60 70 80 90 100 110 120 130
128
- // EVRLVESGGALVQPGGSLRLSCVAASGFTFINNWVTWVRQAPGKGLEWVANIKEDGSQKYYVDSVKGRFTISRDNAEKSVYLQMSSLRVDDTAVYYCARGRAVDQWGQGTLVTVSS
129
- const markup = [
130
- { id: '1', start: 0, length: 99 },
131
- { id: '2', start: 99, length: 3 },
132
- { id: '3', start: 102, length: 14 },
133
- ];
134
- const alignedMarkup = markupAlignedSequence(alignedSequence, markup);
135
- expect(alignedMarkup).toEqual([
136
- { id: '1', start: 0, length: 99 },
137
- { id: '2', start: 111, length: 3 },
138
- { id: '3', start: 114, length: 21 },
139
- ]);
140
- });
141
- }
@@ -1,46 +0,0 @@
1
- import {
2
- type CanonicalizedJson,
3
- parseJson,
4
- type PlMultiSequenceAlignmentModel,
5
- type PTableColumnId,
6
- } from '@platforma-sdk/model';
7
- import { type Ref } from 'vue';
8
-
9
- const latestVersion = 2;
10
-
11
- export function runMigrations(model: Ref<PlMultiSequenceAlignmentModel>) {
12
- const currentVersion = getCurrentVersion(model.value);
13
- try {
14
- if (currentVersion < 1) {
15
- const oldLabelColumnIds = model.value.labelColumnIds as unknown as
16
- | CanonicalizedJson<PTableColumnId>[]
17
- | undefined;
18
- if (oldLabelColumnIds) {
19
- model.value.labelColumnIds = oldLabelColumnIds
20
- .map((id) => parseJson(id));
21
- }
22
- }
23
- if (currentVersion < 2) {
24
- if (model.value.colorScheme?.type === 'markup') {
25
- delete model.value.colorScheme;
26
- }
27
- }
28
- } catch (error) {
29
- console.error(error);
30
- model.value = {};
31
- } finally {
32
- model.value.version = latestVersion;
33
- }
34
- }
35
-
36
- /**
37
- * If a model has a version, return it.
38
- * If it doesn't, but contains anything at all, that's version 0,
39
- * which is a pre-versioning version.
40
- * Otherwise, emtpy model is treated as the latest model.
41
- */
42
- function getCurrentVersion(model: PlMultiSequenceAlignmentModel) {
43
- if (model.version !== undefined) return model.version;
44
- if (Object.keys(model).length) return 0;
45
- return latestVersion;
46
- }
@@ -1,54 +0,0 @@
1
- import kalign from '@milaboratories/biowasm-tools/kalign';
2
- import type { PlMultiSequenceAlignmentSettings } from '@platforma-sdk/model';
3
-
4
- addEventListener(
5
- 'message',
6
- async ({ data }: MessageEvent<RequestMessage>) => {
7
- try {
8
- postMessage(await onMessage(data));
9
- } catch (error) {
10
- reportError(error);
11
- }
12
- },
13
- );
14
-
15
- export type RequestMessage = {
16
- sequences: string[];
17
- params: PlMultiSequenceAlignmentSettings['alignmentParams'];
18
- };
19
-
20
- export type ResponseMessage = string[];
21
-
22
- async function onMessage(
23
- { sequences, params }: RequestMessage,
24
- ): Promise<ResponseMessage> {
25
- if (sequences.length < 2) {
26
- throw new Error(
27
- 'Cannot run multiple sequences alignment on less than 2 sequences.',
28
- );
29
- }
30
- const input = sequences
31
- .map((sequence, index) => `>${index}\n${sequence}`)
32
- .join('\n');
33
- const output = await kalign(input, params);
34
- return parseKalignOutput(output);
35
- }
36
-
37
- function parseKalignOutput(output: string): string[] {
38
- const result: string[] = [];
39
- let index = -1;
40
- for (let line of output.split('\n')) {
41
- line = line.trim();
42
- if (!line) {
43
- continue;
44
- }
45
- if (line.startsWith('>')) {
46
- index += 1;
47
- continue;
48
- }
49
- if (index >= 0) {
50
- result[index] = (result[index] ?? '').concat(line);
51
- }
52
- }
53
- return result;
54
- }
@@ -1,89 +0,0 @@
1
- import rapidnj from '@milaboratories/biowasm-tools/rapidnj';
2
-
3
- addEventListener(
4
- 'message',
5
- async ({ data }: MessageEvent<RequestMessage>) => {
6
- try {
7
- postMessage(await onMessage(data));
8
- } catch (error) {
9
- reportError(error);
10
- }
11
- },
12
- );
13
-
14
- export type RequestMessage = string[];
15
-
16
- export type ResponseMessage = TreeNodeData[];
17
-
18
- async function onMessage(sequences: RequestMessage): Promise<ResponseMessage> {
19
- if (sequences.length < 2) {
20
- throw new Error(
21
- 'Cannot build phylogenetic tree for less than 2 sequences.',
22
- );
23
- }
24
- const input = sequences
25
- .map((sequence, index) => `>${index}\n${sequence}`)
26
- .join('\n');
27
- const output = await rapidnj(input);
28
- return Array.from(parseRapidnjOutput(output));
29
- }
30
-
31
- function parseRapidnjOutput(input: string) {
32
- let prevIndex = 0;
33
- const root = new TreeNode();
34
- let node = root;
35
- let virtualId = -1;
36
- for (const match of input.matchAll(/[(,);]/g)) {
37
- const [token] = match;
38
- const [id, length] = input.slice(prevIndex, match.index).split(':');
39
- if (id) node.id = Number(id.slice(1, -1));
40
- if (length) node.length = Number(length);
41
- node.id ??= virtualId--;
42
- switch (token) {
43
- case '(':
44
- node = node.newChild();
45
- break;
46
- case ',':
47
- node = node.parent!.newChild();
48
- break;
49
- case ')':
50
- node = node.parent!;
51
- break;
52
- case ';':
53
- return root;
54
- }
55
- prevIndex = match.index + 1;
56
- }
57
- throw new Error('Missing semicolon.');
58
- }
59
-
60
- class TreeNode {
61
- id?: number;
62
- length?: number;
63
- parent?: TreeNode;
64
- children?: TreeNode[];
65
-
66
- newChild(): TreeNode {
67
- const node = new TreeNode();
68
- node.parent = this;
69
- (this.children ??= []).push(node);
70
- return node;
71
- }
72
-
73
- *[Symbol.iterator](): Generator<TreeNodeData> {
74
- if (this.id === undefined) {
75
- throw new Error('Node ID cannot be undefined.');
76
- }
77
- const result: TreeNodeData = { id: this.id };
78
- if (this.length !== undefined) result.length = this.length;
79
- if (this.parent) result.parentId = this.parent.id;
80
- yield result;
81
- for (const child of this.children ?? []) yield * child;
82
- }
83
- }
84
-
85
- export interface TreeNodeData {
86
- id: number;
87
- length?: number;
88
- parentId?: number;
89
- }
@@ -1,124 +0,0 @@
1
- import type { ResidueCounts } from './types';
2
-
3
- export function getResidueCounts(
4
- alignedSequences: string[],
5
- ): ResidueCounts {
6
- const columns: ResidueCounts = [];
7
- for (const sequence of alignedSequences) {
8
- for (const [columnIndex, residue] of sequence.split('').entries()) {
9
- const column = columns[columnIndex] ??= {};
10
- column[residue] = (column[residue] ?? 0) + 1;
11
- }
12
- }
13
- return columns;
14
- }
15
-
16
- if (import.meta.vitest) {
17
- const { test, expect } = import.meta.vitest;
18
-
19
- test('getAlignmentStats', () => {
20
- const alignedSequences = [
21
- 'GKGDPKKPRG-KMSSYAFFVQTSREEHKKKHPDASVNFSEFSKKCSERWKTMSAKEKGKFEDMAKADKARYEREMKTY-IPPKGE---------',
22
- '-----MQDRV-KRPMNAFIVWSRDQRRKMALENPRMRNSEISKQLGYQWKMLTEAEKWPFFQEAQKLQAMHREKYPNYKYRPRRKAKMLPK---',
23
- 'MKKLKKHPDFPKKPLTPYFRFFMEKRAKYAKLHPEMSNLDLTKILSKKYKELPEKKKMKYIQDFQREKQ-EFERNLARFREDHPDLIQNAKK--',
24
- '-----MHI---KKPLNAFMLYMKEMRANVVAESTLKESAAINQILGRRWHALSREEQAKYYELARKERQLHMQLYPGWSARDNYGKKKKRKREK',
25
- ];
26
-
27
- expect(getResidueCounts(alignedSequences)).toEqual([
28
- { '-': 2, 'G': 1, 'M': 1 },
29
- { '-': 2, 'K': 2 },
30
- { '-': 2, 'G': 1, 'K': 1 },
31
- { '-': 2, 'D': 1, 'L': 1 },
32
- { '-': 2, 'K': 1, 'P': 1 },
33
- { K: 2, M: 2 },
34
- { H: 2, K: 1, Q: 1 },
35
- { D: 1, I: 1, P: 2 },
36
- { '-': 1, 'D': 1, 'R': 2 },
37
- { '-': 1, 'F': 1, 'G': 1, 'V': 1 },
38
- { '-': 3, 'P': 1 },
39
- { K: 4 },
40
- { K: 2, M: 1, R: 1 },
41
- { P: 3, S: 1 },
42
- { L: 2, M: 1, S: 1 },
43
- { N: 2, T: 1, Y: 1 },
44
- { A: 3, P: 1 },
45
- { F: 3, Y: 1 },
46
- { F: 2, I: 1, M: 1 },
47
- { L: 1, R: 1, V: 2 },
48
- { F: 1, Q: 1, W: 1, Y: 1 },
49
- { F: 1, M: 1, S: 1, T: 1 },
50
- { K: 1, M: 1, R: 1, S: 1 },
51
- { D: 1, E: 2, R: 1 },
52
- { E: 1, K: 1, M: 1, Q: 1 },
53
- { E: 1, R: 3 },
54
- { A: 2, H: 1, R: 1 },
55
- { K: 3, N: 1 },
56
- { K: 1, M: 1, V: 1, Y: 1 },
57
- { A: 2, K: 1, V: 1 },
58
- { A: 1, H: 1, K: 1, L: 1 },
59
- { E: 2, L: 1, P: 1 },
60
- { D: 1, H: 1, N: 1, S: 1 },
61
- { A: 1, P: 2, T: 1 },
62
- { E: 1, L: 1, R: 1, S: 1 },
63
- { K: 1, M: 2, V: 1 },
64
- { E: 1, N: 1, R: 1, S: 1 },
65
- { F: 1, N: 2, S: 1 },
66
- { A: 1, L: 1, S: 2 },
67
- { A: 1, D: 1, E: 2 },
68
- { F: 1, I: 2, L: 1 },
69
- { N: 1, S: 2, T: 1 },
70
- { K: 3, Q: 1 },
71
- { I: 2, K: 1, Q: 1 },
72
- { C: 1, L: 3 },
73
- { G: 2, S: 2 },
74
- { E: 1, K: 1, R: 1, Y: 1 },
75
- { K: 1, Q: 1, R: 2 },
76
- { W: 3, Y: 1 },
77
- { H: 1, K: 3 },
78
- { A: 1, E: 1, M: 1, T: 1 },
79
- { L: 3, M: 1 },
80
- { P: 1, S: 2, T: 1 },
81
- { A: 1, E: 2, R: 1 },
82
- { A: 1, E: 1, K: 2 },
83
- { E: 3, K: 1 },
84
- { K: 3, Q: 1 },
85
- { A: 1, G: 1, M: 1, W: 1 },
86
- { K: 3, P: 1 },
87
- { F: 2, Y: 2 },
88
- { E: 1, F: 1, I: 1, Y: 1 },
89
- { D: 1, E: 1, Q: 2 },
90
- { D: 1, E: 1, L: 1, M: 1 },
91
- { A: 3, F: 1 },
92
- { K: 1, Q: 2, R: 1 },
93
- { A: 1, K: 2, R: 1 },
94
- { D: 1, E: 2, L: 1 },
95
- { K: 2, Q: 1, R: 1 },
96
- { A: 2, Q: 2 },
97
- { '-': 1, 'L': 1, 'M': 1, 'R': 1 },
98
- { E: 1, H: 2, Y: 1 },
99
- { E: 1, F: 1, M: 1, R: 1 },
100
- { E: 2, Q: 1, R: 1 },
101
- { E: 1, K: 1, L: 1, R: 1 },
102
- { M: 1, N: 1, Y: 2 },
103
- { K: 1, L: 1, P: 2 },
104
- { A: 1, G: 1, N: 1, T: 1 },
105
- { R: 1, W: 1, Y: 2 },
106
- { '-': 1, 'F': 1, 'K': 1, 'S': 1 },
107
- { A: 1, I: 1, R: 1, Y: 1 },
108
- { E: 1, P: 1, R: 2 },
109
- { D: 2, P: 2 },
110
- { H: 1, K: 1, N: 1, R: 1 },
111
- { G: 1, P: 1, R: 1, Y: 1 },
112
- { D: 1, E: 1, G: 1, K: 1 },
113
- { '-': 1, 'A': 1, 'K': 1, 'L': 1 },
114
- { '-': 1, 'I': 1, 'K': 2 },
115
- { '-': 1, 'K': 1, 'M': 1, 'Q': 1 },
116
- { '-': 1, 'K': 1, 'L': 1, 'N': 1 },
117
- { '-': 1, 'A': 1, 'P': 1, 'R': 1 },
118
- { '-': 1, 'K': 3 },
119
- { '-': 2, 'K': 1, 'R': 1 },
120
- { '-': 3, 'E': 1 },
121
- { '-': 3, 'K': 1 },
122
- ]);
123
- });
124
- }
@@ -1,7 +0,0 @@
1
- import type { PlMultiSequenceAlignmentSettings } from '@platforma-sdk/model';
2
-
3
- export const defaultSettings: PlMultiSequenceAlignmentSettings = {
4
- colorScheme: { type: 'chemical-properties' },
5
- widgets: ['seqLogo', 'consensus', 'legend'],
6
- alignmentParams: { gpo: 5.5, gpe: 2.0, tgpe: 1.0 },
7
- };
@@ -1,3 +0,0 @@
1
- export type HighlightLegend = Record<string, { label: string; color: string }>;
2
-
3
- export type ResidueCounts = Record<string, number>[];
@@ -1,23 +0,0 @@
1
- import { ensureError } from '@platforma-sdk/model';
2
- import { onMounted, shallowRef } from 'vue';
3
-
4
- export function useMiPlots() {
5
- const load = async () => {
6
- const { MiPlots } = await import('@milaboratories/miplots4');
7
- return MiPlots;
8
- };
9
-
10
- const miplots = shallowRef<Awaited<ReturnType<typeof load>>>();
11
-
12
- const error = shallowRef<Error>();
13
-
14
- onMounted(async () => {
15
- try {
16
- miplots.value = await load();
17
- } catch (err) {
18
- error.value = ensureError(err);
19
- }
20
- });
21
-
22
- return { miplots, error };
23
- }