@milaboratories/multi-sequence-alignment 1.45.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 +52 -0
- package/.turbo/turbo-lint.log +12 -0
- package/.turbo/turbo-test.log +13 -0
- package/.turbo/turbo-type-check.log +6 -0
- package/dist/Consensus.vue.d.ts +9 -0
- package/dist/Consensus.vue.js +10 -0
- package/dist/Consensus.vue.js.map +1 -0
- package/dist/Consensus.vue2.js +122 -0
- package/dist/Consensus.vue2.js.map +1 -0
- package/dist/Consensus.vue3.js +9 -0
- package/dist/Consensus.vue3.js.map +1 -0
- package/dist/Legend.vue.d.ts +6 -0
- package/dist/Legend.vue.js +10 -0
- package/dist/Legend.vue.js.map +1 -0
- package/dist/Legend.vue2.js +28 -0
- package/dist/Legend.vue2.js.map +1 -0
- package/dist/Legend.vue3.js +13 -0
- package/dist/Legend.vue3.js.map +1 -0
- package/dist/MultiSequenceAlignmentView.vue.d.ts +25 -0
- package/dist/MultiSequenceAlignmentView.vue.js +10 -0
- package/dist/MultiSequenceAlignmentView.vue.js.map +1 -0
- package/dist/MultiSequenceAlignmentView.vue2.js +138 -0
- package/dist/MultiSequenceAlignmentView.vue2.js.map +1 -0
- package/dist/MultiSequenceAlignmentView.vue3.js +31 -0
- package/dist/MultiSequenceAlignmentView.vue3.js.map +1 -0
- package/dist/PhylogeneticTree.vue.d.ts +8 -0
- package/dist/PhylogeneticTree.vue.js +10 -0
- package/dist/PhylogeneticTree.vue.js.map +1 -0
- package/dist/PhylogeneticTree.vue2.js +77 -0
- package/dist/PhylogeneticTree.vue2.js.map +1 -0
- package/dist/PhylogeneticTree.vue3.js +9 -0
- package/dist/PhylogeneticTree.vue3.js.map +1 -0
- package/dist/PlMultiSequenceAlignment.vue.d.ts +71 -0
- package/dist/PlMultiSequenceAlignment.vue.js +10 -0
- package/dist/PlMultiSequenceAlignment.vue.js.map +1 -0
- package/dist/PlMultiSequenceAlignment.vue2.js +224 -0
- package/dist/PlMultiSequenceAlignment.vue2.js.map +1 -0
- package/dist/PlMultiSequenceAlignment.vue3.js +9 -0
- package/dist/PlMultiSequenceAlignment.vue3.js.map +1 -0
- package/dist/SeqLogo.vue.d.ts +8 -0
- package/dist/SeqLogo.vue.js +10 -0
- package/dist/SeqLogo.vue.js.map +1 -0
- package/dist/SeqLogo.vue2.js +127 -0
- package/dist/SeqLogo.vue2.js.map +1 -0
- package/dist/SeqLogo.vue3.js +9 -0
- package/dist/SeqLogo.vue3.js.map +1 -0
- package/dist/Toolbar.vue.d.ts +16 -0
- package/dist/Toolbar.vue.js +10 -0
- package/dist/Toolbar.vue.js.map +1 -0
- package/dist/Toolbar.vue2.js +228 -0
- package/dist/Toolbar.vue2.js.map +1 -0
- package/dist/Toolbar.vue3.js +19 -0
- package/dist/Toolbar.vue3.js.map +1 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
- package/dist/_virtual/_plugin-vue_export-helper.js.map +1 -0
- 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/cell-size.d.ts +4 -0
- package/dist/cell-size.js +8 -0
- package/dist/cell-size.js.map +1 -0
- package/dist/chemical-properties.d.ts +44 -0
- package/dist/chemical-properties.js +132 -0
- package/dist/chemical-properties.js.map +1 -0
- package/dist/data.d.ts +61 -0
- package/dist/data.js +370 -0
- package/dist/data.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/markup.d.ts +16 -0
- package/dist/markup.js +84 -0
- package/dist/markup.js.map +1 -0
- package/dist/migrations.d.ts +3 -0
- package/dist/migrations.js +24 -0
- package/dist/migrations.js.map +1 -0
- package/dist/multi-sequence-alignment.worker.d.ts +6 -0
- package/dist/node_modules/.pnpm/@milaboratories_helpers@1.12.0/node_modules/@milaboratories/helpers/dist/objects.js +33 -0
- package/dist/node_modules/.pnpm/@milaboratories_helpers@1.12.0/node_modules/@milaboratories/helpers/dist/objects.js.map +1 -0
- package/dist/phylogenetic-tree.worker.d.ts +7 -0
- package/dist/residue-counts.d.ts +2 -0
- package/dist/residue-counts.js +13 -0
- package/dist/residue-counts.js.map +1 -0
- package/dist/settings.d.ts +2 -0
- package/dist/settings.js +9 -0
- package/dist/settings.js.map +1 -0
- package/dist/types.d.ts +5 -0
- package/dist/useMiPlots.d.ts +4 -0
- package/dist/useMiPlots.js +19 -0
- package/dist/useMiPlots.js.map +1 -0
- package/eslint.config.js +66 -0
- package/package.json +45 -0
- package/src/Consensus.vue +165 -0
- package/src/Legend.vue +44 -0
- package/src/MultiSequenceAlignmentView.vue +299 -0
- package/src/PhylogeneticTree.vue +110 -0
- package/src/PlMultiSequenceAlignment.vue +314 -0
- package/src/README.md +216 -0
- package/src/SeqLogo.vue +166 -0
- package/src/Toolbar.vue +228 -0
- package/src/cell-size.ts +4 -0
- package/src/chemical-properties.ts +199 -0
- package/src/data.ts +661 -0
- package/src/index.ts +2 -0
- package/src/markup.ts +141 -0
- package/src/migrations.ts +46 -0
- package/src/multi-sequence-alignment.worker.ts +54 -0
- package/src/phylogenetic-tree.worker.ts +89 -0
- package/src/residue-counts.ts +124 -0
- package/src/settings.ts +7 -0
- package/src/types.ts +3 -0
- package/src/useMiPlots.ts +23 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cell-size.js","sources":["../src/cell-size.ts"],"sourcesContent":["export const cellSize = {\n inline: 20,\n block: 24,\n};\n"],"names":["cellSize"],"mappings":"AAAO,MAAMA,IAAW;AAAA,EACtB,QAAQ;AAAA,EACR,OAAO;AACT;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { HighlightLegend, ResidueCounts } from './types';
|
|
2
|
+
export declare function highlightByChemicalProperties({ sequences, residueCounts }: {
|
|
3
|
+
sequences: string[];
|
|
4
|
+
residueCounts: ResidueCounts;
|
|
5
|
+
}): {
|
|
6
|
+
blob: Blob;
|
|
7
|
+
legend: HighlightLegend;
|
|
8
|
+
};
|
|
9
|
+
declare const chemicalPropertiesColorScheme: {
|
|
10
|
+
hydrophobic: {
|
|
11
|
+
label: string;
|
|
12
|
+
color: string;
|
|
13
|
+
};
|
|
14
|
+
positiveCharge: {
|
|
15
|
+
label: string;
|
|
16
|
+
color: string;
|
|
17
|
+
};
|
|
18
|
+
negativeCharge: {
|
|
19
|
+
label: string;
|
|
20
|
+
color: string;
|
|
21
|
+
};
|
|
22
|
+
polar: {
|
|
23
|
+
label: string;
|
|
24
|
+
color: string;
|
|
25
|
+
};
|
|
26
|
+
cysteine: {
|
|
27
|
+
label: string;
|
|
28
|
+
color: string;
|
|
29
|
+
};
|
|
30
|
+
glycine: {
|
|
31
|
+
label: string;
|
|
32
|
+
color: string;
|
|
33
|
+
};
|
|
34
|
+
proline: {
|
|
35
|
+
label: string;
|
|
36
|
+
color: string;
|
|
37
|
+
};
|
|
38
|
+
aromatic: {
|
|
39
|
+
label: string;
|
|
40
|
+
color: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type ChemicalCategory = keyof typeof chemicalPropertiesColorScheme;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
function E({ sequences: t, residueCounts: g }) {
|
|
2
|
+
var C, h, u;
|
|
3
|
+
const i = [], c = v({
|
|
4
|
+
residueCounts: g,
|
|
5
|
+
rowCount: t.length
|
|
6
|
+
}), n = ((C = t.at(0)) == null ? void 0 : C.length) ?? 0, l = t.length;
|
|
7
|
+
for (let e = 0; e < n; e += 1)
|
|
8
|
+
for (let o = 0; o < l; o += 1) {
|
|
9
|
+
const F = t[o][e], d = (u = (h = c.at(e)) == null ? void 0 : h.find(({ residues: a }) => a.includes(F))) == null ? void 0 : u.category;
|
|
10
|
+
if (!d) continue;
|
|
11
|
+
const r = i.at(-1);
|
|
12
|
+
r && r.category === d && r.column === e && r.start + r.length === o ? r.length += 1 : i.push({ category: d, column: e, start: o, length: 1 });
|
|
13
|
+
}
|
|
14
|
+
const s = Map.groupBy(i, ({ category: e }) => e), y = new Blob(
|
|
15
|
+
(function* () {
|
|
16
|
+
var o;
|
|
17
|
+
yield `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${`0 0 ${n * 2} ${l}`}" stroke-width="2" preserveAspectRatio="none">`;
|
|
18
|
+
for (const [F, d] of s) {
|
|
19
|
+
const r = (o = P[F]) == null ? void 0 : o.color;
|
|
20
|
+
if (!r) continue;
|
|
21
|
+
yield `<path stroke="${r}" d="`;
|
|
22
|
+
let a = 0, A = 0;
|
|
23
|
+
for (const { column: m, start: b, length: f } of d)
|
|
24
|
+
yield `m${m * 2 + 1 - a},${b - A}v${f}`, a = m * 2 + 1, A = b + f;
|
|
25
|
+
yield '"/>';
|
|
26
|
+
}
|
|
27
|
+
yield "</svg>";
|
|
28
|
+
})().toArray(),
|
|
29
|
+
{ type: "image/svg+xml" }
|
|
30
|
+
), p = Object.fromEntries(
|
|
31
|
+
Object.entries(P).filter(([e]) => s.has(e))
|
|
32
|
+
);
|
|
33
|
+
return { blob: y, legend: p };
|
|
34
|
+
}
|
|
35
|
+
const v = ({ residueCounts: t, rowCount: g }) => t.map((i) => {
|
|
36
|
+
const c = /* @__PURE__ */ new Set();
|
|
37
|
+
return D.filter(
|
|
38
|
+
({ residues: n, rules: l }) => n.split("").some((s) => s in i) && (!l || l.split("").map(
|
|
39
|
+
(s) => [s, w[s]]
|
|
40
|
+
).some(([s, { residues: y, threshold: p }]) => {
|
|
41
|
+
if (c.has(s)) return !0;
|
|
42
|
+
const h = y.split("").reduce((u, e) => u + (i[e] ?? 0), 0) >= g * p;
|
|
43
|
+
return h && c.add(s), h;
|
|
44
|
+
}))
|
|
45
|
+
);
|
|
46
|
+
}), P = {
|
|
47
|
+
hydrophobic: {
|
|
48
|
+
label: "Hydrophobic",
|
|
49
|
+
color: "#99CCFF"
|
|
50
|
+
},
|
|
51
|
+
positiveCharge: {
|
|
52
|
+
label: "Positive Charged",
|
|
53
|
+
color: "#FFA2A3"
|
|
54
|
+
},
|
|
55
|
+
negativeCharge: {
|
|
56
|
+
label: "Negative Charged",
|
|
57
|
+
color: "#C1ADFF"
|
|
58
|
+
},
|
|
59
|
+
polar: {
|
|
60
|
+
label: "Polar",
|
|
61
|
+
color: "#99E099"
|
|
62
|
+
},
|
|
63
|
+
cysteine: {
|
|
64
|
+
label: "Cysteines",
|
|
65
|
+
color: "#FAAAFA"
|
|
66
|
+
},
|
|
67
|
+
glycine: {
|
|
68
|
+
label: "Glycines",
|
|
69
|
+
color: "#F7BC5D"
|
|
70
|
+
},
|
|
71
|
+
proline: {
|
|
72
|
+
label: "Prolines",
|
|
73
|
+
color: "#FFFF8F"
|
|
74
|
+
},
|
|
75
|
+
aromatic: {
|
|
76
|
+
label: "Aromatic",
|
|
77
|
+
color: "#A2F5FA"
|
|
78
|
+
}
|
|
79
|
+
}, w = {
|
|
80
|
+
"%": { residues: "WLVIMAFCYHP", threshold: 0.6 },
|
|
81
|
+
"#": { residues: "WLVIMAFCYHP", threshold: 0.8 },
|
|
82
|
+
"-": { residues: "ED", threshold: 0.5 },
|
|
83
|
+
"+": { residues: "KR", threshold: 0.6 },
|
|
84
|
+
g: { residues: "G", threshold: 0.5 },
|
|
85
|
+
n: { residues: "N", threshold: 0.5 },
|
|
86
|
+
q: { residues: "QE", threshold: 0.5 },
|
|
87
|
+
p: { residues: "P", threshold: 0.5 },
|
|
88
|
+
t: { residues: "TS", threshold: 0.5 },
|
|
89
|
+
A: { residues: "A", threshold: 0.85 },
|
|
90
|
+
C: { residues: "C", threshold: 0.85 },
|
|
91
|
+
D: { residues: "D", threshold: 0.85 },
|
|
92
|
+
E: { residues: "E", threshold: 0.85 },
|
|
93
|
+
F: { residues: "F", threshold: 0.85 },
|
|
94
|
+
G: { residues: "G", threshold: 0.85 },
|
|
95
|
+
H: { residues: "H", threshold: 0.85 },
|
|
96
|
+
I: { residues: "I", threshold: 0.85 },
|
|
97
|
+
K: { residues: "K", threshold: 0.85 },
|
|
98
|
+
L: { residues: "L", threshold: 0.85 },
|
|
99
|
+
M: { residues: "M", threshold: 0.85 },
|
|
100
|
+
N: { residues: "N", threshold: 0.85 },
|
|
101
|
+
P: { residues: "P", threshold: 0.85 },
|
|
102
|
+
Q: { residues: "Q", threshold: 0.85 },
|
|
103
|
+
R: { residues: "R", threshold: 0.85 },
|
|
104
|
+
S: { residues: "S", threshold: 0.85 },
|
|
105
|
+
T: { residues: "T", threshold: 0.85 },
|
|
106
|
+
V: { residues: "V", threshold: 0.85 },
|
|
107
|
+
W: { residues: "W", threshold: 0.85 },
|
|
108
|
+
Y: { residues: "Y", threshold: 0.85 }
|
|
109
|
+
}, D = [
|
|
110
|
+
{ residues: "G", category: "glycine", rules: "" },
|
|
111
|
+
{ residues: "P", category: "proline", rules: "" },
|
|
112
|
+
{ residues: "T", category: "polar", rules: "tST%#" },
|
|
113
|
+
{ residues: "S", category: "polar", rules: "tST#" },
|
|
114
|
+
{ residues: "N", category: "polar", rules: "nND" },
|
|
115
|
+
{ residues: "Q", category: "polar", rules: "qQE+KR" },
|
|
116
|
+
// criteria below has to go before the other criteria for C,
|
|
117
|
+
// otherwise it will never match
|
|
118
|
+
{ residues: "C", category: "cysteine", rules: "C" },
|
|
119
|
+
{ residues: "WLVIMF", category: "hydrophobic", rules: "%#ACFHILMVWYPp" },
|
|
120
|
+
// below there was an 's' rule too,
|
|
121
|
+
// but no definition of such rule was provided
|
|
122
|
+
{ residues: "A", category: "hydrophobic", rules: "%#ACFHILMVWYPpTSG" },
|
|
123
|
+
{ residues: "C", category: "hydrophobic", rules: "%#AFHILMVWYSPp" },
|
|
124
|
+
{ residues: "HY", category: "aromatic", rules: "%#ACFHILMVWYPp" },
|
|
125
|
+
{ residues: "E", category: "negativeCharge", rules: "-DEqQ" },
|
|
126
|
+
{ residues: "D", category: "negativeCharge", rules: "-DEnN" },
|
|
127
|
+
{ residues: "KR", category: "positiveCharge", rules: "+KRQ" }
|
|
128
|
+
];
|
|
129
|
+
export {
|
|
130
|
+
E as highlightByChemicalProperties
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=chemical-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chemical-properties.js","sources":["../src/chemical-properties.ts"],"sourcesContent":["import type { HighlightLegend, ResidueCounts } from './types';\n\nexport function highlightByChemicalProperties(\n { sequences, residueCounts }: {\n sequences: string[];\n residueCounts: ResidueCounts;\n },\n): { blob: Blob; legend: HighlightLegend } {\n const lines: {\n category: ChemicalCategory;\n column: number;\n start: number;\n length: number;\n }[] = [];\n const chemicalProperties = getAlignmentChemicalProperties({\n residueCounts,\n rowCount: sequences.length,\n });\n const width = sequences.at(0)?.length ?? 0;\n const height = sequences.length;\n for (let column = 0; column < width; column += 1) {\n for (let row = 0; row < height; row += 1) {\n const residue = sequences[row][column];\n const category = chemicalProperties\n .at(column)\n ?.find(({ residues }) => residues.includes(residue))\n ?.category;\n if (!category) continue;\n const lastLine = lines.at(-1);\n if (\n lastLine\n && lastLine.category === category\n && lastLine.column === column\n && lastLine.start + lastLine.length === row\n ) {\n lastLine.length += 1;\n } else {\n lines.push({ category, column, start: row, length: 1 });\n }\n }\n }\n const linesByCategory = Map.groupBy(lines, ({ category }) => category);\n const blob = new Blob(\n (function*() {\n const viewBox = `0 0 ${width * 2} ${height}`;\n yield `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"${viewBox}\" stroke-width=\"2\" preserveAspectRatio=\"none\">`;\n for (const [category, lines] of linesByCategory) {\n const color = chemicalPropertiesColorScheme[category]?.color;\n if (!color) continue;\n yield `<path stroke=\"${color}\" d=\"`;\n let x = 0, y = 0;\n for (const { column, start, length } of lines) {\n yield `m${column * 2 + 1 - x},${start - y}v${length}`;\n x = column * 2 + 1;\n y = start + length;\n }\n yield '\"/>';\n }\n yield '</svg>';\n })().toArray(),\n { type: 'image/svg+xml' },\n );\n const legend = Object.fromEntries(\n Object.entries(chemicalPropertiesColorScheme)\n .filter(([color]) => linesByCategory.has(color as ChemicalCategory)),\n );\n return { blob, legend };\n}\n\nconst getAlignmentChemicalProperties = (\n { residueCounts, rowCount }: {\n residueCounts: ResidueCounts;\n rowCount: number;\n },\n): ColumnChemicalProperties[] =>\n residueCounts.map((column) => {\n const matchedRules = new Set<string>();\n return categoryCriterion.filter(({ residues, rules }) =>\n residues.split('').some((residue) => residue in column)\n && (!rules || rules.split('').map((ruleName) =>\n [ruleName, ruleDefinitions[ruleName as RuleName]] as const,\n ).some(([ruleName, { residues, threshold }]) => {\n if (matchedRules.has(ruleName)) return true;\n const groupCount = residues.split('')\n .reduce((acc, residue) => acc + (column[residue] ?? 0), 0);\n const matches = groupCount >= rowCount * threshold;\n if (matches) matchedRules.add(ruleName);\n return matches;\n })),\n );\n });\n\ntype ColumnChemicalProperties = {\n residues: string;\n category: ChemicalCategory;\n}[];\n\nconst chemicalPropertiesColorScheme = {\n hydrophobic: {\n label: 'Hydrophobic',\n color: '#99CCFF',\n },\n positiveCharge: {\n label: 'Positive Charged',\n color: '#FFA2A3',\n },\n negativeCharge: {\n label: 'Negative Charged',\n color: '#C1ADFF',\n },\n polar: {\n label: 'Polar',\n color: '#99E099',\n },\n cysteine: {\n label: 'Cysteines',\n color: '#FAAAFA',\n },\n glycine: {\n label: 'Glycines',\n color: '#F7BC5D',\n },\n proline: {\n label: 'Prolines',\n color: '#FFFF8F',\n },\n aromatic: {\n label: 'Aromatic',\n color: '#A2F5FA',\n },\n} satisfies HighlightLegend;\n\nexport type ChemicalCategory = keyof typeof chemicalPropertiesColorScheme;\n\n/*\n * Below taken mostly from\n * https://www.rbvi.ucsf.edu/chimera/1.2065/docs/ContributedSoftware/multalignviewer/colprot.par}\n */\n\nconst ruleDefinitions = {\n '%': { residues: 'WLVIMAFCYHP', threshold: 0.6 },\n '#': { residues: 'WLVIMAFCYHP', threshold: 0.8 },\n '-': { residues: 'ED', threshold: 0.5 },\n '+': { residues: 'KR', threshold: 0.6 },\n 'g': { residues: 'G', threshold: 0.5 },\n 'n': { residues: 'N', threshold: 0.5 },\n 'q': { residues: 'QE', threshold: 0.5 },\n 'p': { residues: 'P', threshold: 0.5 },\n 't': { residues: 'TS', threshold: 0.5 },\n 'A': { residues: 'A', threshold: 0.85 },\n 'C': { residues: 'C', threshold: 0.85 },\n 'D': { residues: 'D', threshold: 0.85 },\n 'E': { residues: 'E', threshold: 0.85 },\n 'F': { residues: 'F', threshold: 0.85 },\n 'G': { residues: 'G', threshold: 0.85 },\n 'H': { residues: 'H', threshold: 0.85 },\n 'I': { residues: 'I', threshold: 0.85 },\n 'K': { residues: 'K', threshold: 0.85 },\n 'L': { residues: 'L', threshold: 0.85 },\n 'M': { residues: 'M', threshold: 0.85 },\n 'N': { residues: 'N', threshold: 0.85 },\n 'P': { residues: 'P', threshold: 0.85 },\n 'Q': { residues: 'Q', threshold: 0.85 },\n 'R': { residues: 'R', threshold: 0.85 },\n 'S': { residues: 'S', threshold: 0.85 },\n 'T': { residues: 'T', threshold: 0.85 },\n 'V': { residues: 'V', threshold: 0.85 },\n 'W': { residues: 'W', threshold: 0.85 },\n 'Y': { residues: 'Y', threshold: 0.85 },\n};\n\ntype RuleName = keyof typeof ruleDefinitions;\n\nconst categoryCriterion: Criteria[] = [\n { residues: 'G', category: 'glycine', rules: '' },\n { residues: 'P', category: 'proline', rules: '' },\n { residues: 'T', category: 'polar', rules: 'tST%#' },\n { residues: 'S', category: 'polar', rules: 'tST#' },\n { residues: 'N', category: 'polar', rules: 'nND' },\n { residues: 'Q', category: 'polar', rules: 'qQE+KR' },\n // criteria below has to go before the other criteria for C,\n // otherwise it will never match\n { residues: 'C', category: 'cysteine', rules: 'C' },\n { residues: 'WLVIMF', category: 'hydrophobic', rules: '%#ACFHILMVWYPp' },\n // below there was an 's' rule too,\n // but no definition of such rule was provided\n { residues: 'A', category: 'hydrophobic', rules: '%#ACFHILMVWYPpTSG' },\n { residues: 'C', category: 'hydrophobic', rules: '%#AFHILMVWYSPp' },\n { residues: 'HY', category: 'aromatic', rules: '%#ACFHILMVWYPp' },\n { residues: 'E', category: 'negativeCharge', rules: '-DEqQ' },\n { residues: 'D', category: 'negativeCharge', rules: '-DEnN' },\n { residues: 'KR', category: 'positiveCharge', rules: '+KRQ' },\n];\n\ntype Criteria = {\n residues: string;\n category: ChemicalCategory;\n rules: string;\n};\n"],"names":["highlightByChemicalProperties","sequences","residueCounts","_a","_b","_c","lines","chemicalProperties","getAlignmentChemicalProperties","width","height","column","row","residue","category","residues","lastLine","linesByCategory","blob","color","chemicalPropertiesColorScheme","x","y","start","length","legend","rowCount","matchedRules","categoryCriterion","rules","ruleName","ruleDefinitions","threshold","matches","acc"],"mappings":"AAEO,SAASA,EACd,EAAE,WAAAC,GAAW,eAAAC,KAI4B;AALpC,MAAAC,GAAAC,GAAAC;AAML,QAAMC,IAKA,CAAA,GACAC,IAAqBC,EAA+B;AAAA,IACxD,eAAAN;AAAA,IACA,UAAUD,EAAU;AAAA,EAAA,CACrB,GACKQ,MAAQN,IAAAF,EAAU,GAAG,CAAC,MAAd,gBAAAE,EAAiB,WAAU,GACnCO,IAAST,EAAU;AACzB,WAASU,IAAS,GAAGA,IAASF,GAAOE,KAAU;AAC7C,aAASC,IAAM,GAAGA,IAAMF,GAAQE,KAAO,GAAG;AACxC,YAAMC,IAAUZ,EAAUW,CAAG,EAAED,CAAM,GAC/BG,KAAWT,KAAAD,IAAAG,EACd,GAAGI,CAAM,MADK,gBAAAP,EAEb,KAAK,CAAC,EAAE,UAAAW,EAAA,MAAeA,EAAS,SAASF,CAAO,OAFnC,gBAAAR,EAGb;AACJ,UAAI,CAACS,EAAU;AACf,YAAME,IAAWV,EAAM,GAAG,EAAE;AAC5B,MACEU,KACGA,EAAS,aAAaF,KACtBE,EAAS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MH,IAAgC;AAAA,EACpC,EAAE,UAAU,KAAK,UAAU,WAAW,OAAO,GAAA;AAAA,EAC7C,EAAE,UAAU,KAAK,UAAU,WAAW,OAAO,GAAA;AAAA,EAC7C,EAAE,UAAU,KAAK,UAAU,SAAS,OAAO,QAAA;AAAA,EAC3C,EAAE,UAAU,KAAK,UAAU,SAAS,OAAO,OAAA;AAAA,EAC3C,EAAE,UAAU,KAAK,UAAU,SAAS,OAAO,MAAA;AAAA,EAC3C,EAAE,UAAU,KAAK,UAAU,SAAS,OAAO,SAAA;AAAA;AAAA;AAAA,EAG3C,EAAE,UAAU,KAAK,UAAU,YAAY,OAAO,IAAA;AAAA,EAC9C,EAAE,UAAU,UAAU,UAAU,eAAe,OAAO,iBAAA;AAAA;AAAA;AAAA,EAGtD,EAAE,UAAU,KAAK,UAAU,eAAe,OAAO,oBAAA;AAAA,EACjD,EAAE,UAAU,KAAK,UAAU,eAAe,OAAO,iBAAA;AAAA,EACjD,EAAE,UAAU,MAAM,UAAU,YAAY,OAAO,iBAAA;AAAA,EAC/C,EAAE,UAAU,KAAK,UAAU,kBAAkB,OAAO,QAAA;AAAA,EACpD,EAAE,UAAU,KAAK,UAAU,kBAAkB,OAAO,QAAA;AAAA,EACpD,EAAE,UAAU,MAAM,UAAU,kBAAkB,OAAO,OAAA;AACvD;"}
|
package/dist/data.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ListOptionNormalized } from '@milaboratories/uikit';
|
|
2
|
+
import { PColumnIdAndSpec, PFrameHandle, PlMultiSequenceAlignmentColorSchemeOption, PlMultiSequenceAlignmentSettings, PlSelectionModel, PObjectId, PTableColumnId } from '@platforma-sdk/model';
|
|
3
|
+
import { HighlightLegend, ResidueCounts } from './types';
|
|
4
|
+
import type * as PhylogeneticTreeWorker from './phylogenetic-tree.worker';
|
|
5
|
+
export declare const SEQUENCE_LIMIT = 1000;
|
|
6
|
+
export declare const useSequenceColumnsOptions: (paramsGetter: () => {
|
|
7
|
+
pFrame: PFrameHandle | undefined;
|
|
8
|
+
sequenceColumnPredicate: (column: PColumnIdAndSpec) => boolean;
|
|
9
|
+
}) => {
|
|
10
|
+
data: import('vue').Ref<OptionsWithDefaults<PObjectId> | undefined, OptionsWithDefaults<PObjectId> | undefined>;
|
|
11
|
+
isLoading: import('vue').Ref<boolean, boolean>;
|
|
12
|
+
error: import('vue').Ref<Error | undefined, Error | undefined>;
|
|
13
|
+
};
|
|
14
|
+
export declare const useLabelColumnsOptions: (paramsGetter: () => {
|
|
15
|
+
pFrame: PFrameHandle | undefined;
|
|
16
|
+
sequenceColumnIds: PObjectId[] | undefined;
|
|
17
|
+
}) => {
|
|
18
|
+
data: import('vue').Ref<OptionsWithDefaults<PTableColumnId> | undefined, OptionsWithDefaults<PTableColumnId> | undefined>;
|
|
19
|
+
isLoading: import('vue').Ref<boolean, boolean>;
|
|
20
|
+
error: import('vue').Ref<Error | undefined, Error | undefined>;
|
|
21
|
+
};
|
|
22
|
+
export declare const useMarkupColumnsOptions: (paramsGetter: () => {
|
|
23
|
+
pFrame: PFrameHandle | undefined;
|
|
24
|
+
sequenceColumnIds: PObjectId[] | undefined;
|
|
25
|
+
}) => {
|
|
26
|
+
data: import('vue').Ref<ListOptionNormalized<PObjectId[]>[] | undefined, ListOptionNormalized<PObjectId[]>[] | undefined>;
|
|
27
|
+
isLoading: import('vue').Ref<boolean, boolean>;
|
|
28
|
+
error: import('vue').Ref<Error | undefined, Error | undefined>;
|
|
29
|
+
};
|
|
30
|
+
export declare const useMultipleAlignmentData: (paramsGetter: () => {
|
|
31
|
+
pFrame: PFrameHandle | undefined;
|
|
32
|
+
sequenceColumnIds: PObjectId[] | undefined;
|
|
33
|
+
labelColumnIds: PTableColumnId[] | undefined;
|
|
34
|
+
selection: PlSelectionModel | undefined;
|
|
35
|
+
colorScheme: PlMultiSequenceAlignmentColorSchemeOption;
|
|
36
|
+
alignmentParams: PlMultiSequenceAlignmentSettings["alignmentParams"];
|
|
37
|
+
shouldBuildPhylogeneticTree: boolean;
|
|
38
|
+
}) => {
|
|
39
|
+
data: import('vue').Ref<MultipleAlignmentData | undefined, MultipleAlignmentData | undefined>;
|
|
40
|
+
isLoading: import('vue').Ref<boolean, boolean>;
|
|
41
|
+
error: import('vue').Ref<Error | undefined, Error | undefined>;
|
|
42
|
+
};
|
|
43
|
+
type MultipleAlignmentData = {
|
|
44
|
+
sequences: {
|
|
45
|
+
name: string;
|
|
46
|
+
rows: string[];
|
|
47
|
+
residueCounts: ResidueCounts;
|
|
48
|
+
highlightImageUrl?: string;
|
|
49
|
+
}[];
|
|
50
|
+
labels: {
|
|
51
|
+
rows: string[];
|
|
52
|
+
}[];
|
|
53
|
+
highlightLegend?: HighlightLegend;
|
|
54
|
+
phylogeneticTree?: PhylogeneticTreeWorker.TreeNodeData[];
|
|
55
|
+
exceedsLimit: boolean;
|
|
56
|
+
};
|
|
57
|
+
type OptionsWithDefaults<T> = {
|
|
58
|
+
options: ListOptionNormalized<T>[];
|
|
59
|
+
defaults: T[];
|
|
60
|
+
};
|
|
61
|
+
export {};
|
package/dist/data.js
ADDED
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { isJsonEqual as O } from "./node_modules/.pnpm/@milaboratories_helpers@1.12.0/node_modules/@milaboratories/helpers/dist/objects.js";
|
|
2
|
+
import { ensureError as T, getRawPlatformaInstance as $, readAnnotation as C, Annotation as h, canonicalizeJson as v, getAxisId as S, parseJson as A, isLabelColumn as j, matchAxisId as B, readAnnotationJson as J, isLinkerColumn as N, createRowSelectionColumn as W, pTableValue as R } from "@platforma-sdk/model";
|
|
3
|
+
import { ref as M, watch as F, onWatcherCleanup as H } from "vue";
|
|
4
|
+
import { objectHash as I } from "@platforma-sdk/ui-vue";
|
|
5
|
+
import { highlightByChemicalProperties as V } from "./chemical-properties.js";
|
|
6
|
+
import { parseMarkup as z, highlightByMarkup as Q, markupAlignedSequence as Y } from "./markup.js";
|
|
7
|
+
import { getResidueCounts as Z } from "./residue-counts.js";
|
|
8
|
+
const x = () => $().pFrameDriver, D = 1e3, we = E(
|
|
9
|
+
_
|
|
10
|
+
), ge = E(
|
|
11
|
+
G
|
|
12
|
+
), he = E(
|
|
13
|
+
K
|
|
14
|
+
), be = E(
|
|
15
|
+
X
|
|
16
|
+
);
|
|
17
|
+
async function _({ pFrame: n, sequenceColumnPredicate: r }) {
|
|
18
|
+
if (!n) return;
|
|
19
|
+
const o = (await x().listColumns(n)).values().filter((i) => r(i)).map(({ spec: i, columnId: c }) => ({
|
|
20
|
+
label: C(i, h.Label) ?? "Unlabeled column",
|
|
21
|
+
value: c
|
|
22
|
+
})).toArray(), t = o.map(({ value: i }) => i);
|
|
23
|
+
return { options: o, defaults: t };
|
|
24
|
+
}
|
|
25
|
+
async function G({ pFrame: n, sequenceColumnIds: r }) {
|
|
26
|
+
if (!n || !r) return;
|
|
27
|
+
const a = x(), e = await a.listColumns(n), o = new Map(
|
|
28
|
+
r.values().flatMap((s) => {
|
|
29
|
+
const u = e.find(({ columnId: m }) => m === s);
|
|
30
|
+
if (!u)
|
|
31
|
+
throw new Error(`Couldn't find sequence column (ID: \`${s}\`).`);
|
|
32
|
+
return u.spec.axesSpec.values().map((m) => [v(S(m)), m]);
|
|
33
|
+
})
|
|
34
|
+
), t = /* @__PURE__ */ new Map();
|
|
35
|
+
for (const [s, u] of o.entries()) {
|
|
36
|
+
const m = A(s), d = e.find(
|
|
37
|
+
({ spec: p }) => j(p) && B(m, S(p.axesSpec[0]))
|
|
38
|
+
);
|
|
39
|
+
t.set(
|
|
40
|
+
d ? v({ type: "column", id: d.columnId }) : v({ type: "axis", id: m }),
|
|
41
|
+
C(d == null ? void 0 : d.spec, h.Label) ?? C(u, h.Label) ?? "Unlabeled axis"
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
const { hits: i } = await a.findColumns(n, {
|
|
45
|
+
columnFilter: {},
|
|
46
|
+
compatibleWith: o.keys().map((s) => A(s)).toArray(),
|
|
47
|
+
strictlyCompatible: !1
|
|
48
|
+
});
|
|
49
|
+
for (const { columnId: s, spec: u } of i) {
|
|
50
|
+
const m = v({
|
|
51
|
+
type: "column",
|
|
52
|
+
id: s
|
|
53
|
+
});
|
|
54
|
+
t.has(m) || t.set(
|
|
55
|
+
m,
|
|
56
|
+
C(u, h.Label) ?? "Unlabeled column"
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
const c = t.entries().map(([s, u]) => ({ label: u, value: A(s) })).toArray(), l = c.values().filter(({ value: s }) => {
|
|
60
|
+
if (s.type === "axis") return !0;
|
|
61
|
+
const u = e.find(({ columnId: m }) => m === s.id);
|
|
62
|
+
return u && j(u.spec);
|
|
63
|
+
}).map(({ value: s }) => s).toArray();
|
|
64
|
+
return { options: c, defaults: l };
|
|
65
|
+
}
|
|
66
|
+
async function K({ pFrame: n, sequenceColumnIds: r }) {
|
|
67
|
+
if (!n || !r) return;
|
|
68
|
+
const e = await x().listColumns(n), t = r.map((c) => {
|
|
69
|
+
const l = e.find((s) => s.columnId === c);
|
|
70
|
+
if (!l)
|
|
71
|
+
throw new Error(
|
|
72
|
+
`Couldn't find sequence column (ID: \`${r[0]}\`).`
|
|
73
|
+
);
|
|
74
|
+
return l;
|
|
75
|
+
}).flatMap(
|
|
76
|
+
(c) => e.filter(
|
|
77
|
+
(l) => J(l.spec, h.Sequence.IsAnnotation) && O(c.spec.axesSpec, l.spec.axesSpec) && Object.entries(c.spec.domain ?? {}).every(([s, u]) => {
|
|
78
|
+
var m;
|
|
79
|
+
return ((m = l.spec.domain) == null ? void 0 : m[s]) === u;
|
|
80
|
+
})
|
|
81
|
+
).map((l) => ({ markupColumn: l, sequenceColumn: c }))
|
|
82
|
+
);
|
|
83
|
+
return Map.groupBy(
|
|
84
|
+
t,
|
|
85
|
+
({ markupColumn: c, sequenceColumn: l }) => {
|
|
86
|
+
const s = Object.fromEntries(
|
|
87
|
+
Object.entries(c.spec.domain ?? {}).filter(([u]) => {
|
|
88
|
+
var m;
|
|
89
|
+
return ((m = l.spec.domain) == null ? void 0 : m[u]) == null;
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
return v(s);
|
|
93
|
+
}
|
|
94
|
+
).entries().map(([c, l]) => ({
|
|
95
|
+
label: Object.values(A(c)).join(", "),
|
|
96
|
+
value: l.map(({ markupColumn: s }) => s.columnId)
|
|
97
|
+
})).toArray();
|
|
98
|
+
}
|
|
99
|
+
async function X({
|
|
100
|
+
pFrame: n,
|
|
101
|
+
sequenceColumnIds: r,
|
|
102
|
+
labelColumnIds: a,
|
|
103
|
+
selection: e,
|
|
104
|
+
colorScheme: o,
|
|
105
|
+
alignmentParams: t,
|
|
106
|
+
shouldBuildPhylogeneticTree: i
|
|
107
|
+
}, c) {
|
|
108
|
+
var q;
|
|
109
|
+
if (!n || !(r != null && r.length) || !a) return;
|
|
110
|
+
const l = await ee({
|
|
111
|
+
pFrame: n,
|
|
112
|
+
sequenceColumnIds: r,
|
|
113
|
+
labelColumnIds: a,
|
|
114
|
+
selection: e,
|
|
115
|
+
colorScheme: o
|
|
116
|
+
}), s = ((q = l.at(0)) == null ? void 0 : q.data.data.length) ?? 0;
|
|
117
|
+
if (s < 2) return;
|
|
118
|
+
const u = s > D, m = te(r, l), d = ne(a, l), p = o.type === "markup" ? re(o.columnIds, l) : void 0, b = {}, y = await Promise.all(
|
|
119
|
+
m.map(async ({ name: w, rows: f }) => ({
|
|
120
|
+
name: w,
|
|
121
|
+
rows: await ae(
|
|
122
|
+
f,
|
|
123
|
+
JSON.parse(JSON.stringify(t)),
|
|
124
|
+
c
|
|
125
|
+
)
|
|
126
|
+
}))
|
|
127
|
+
);
|
|
128
|
+
let L;
|
|
129
|
+
if (i) {
|
|
130
|
+
L = await ie(
|
|
131
|
+
y,
|
|
132
|
+
c
|
|
133
|
+
);
|
|
134
|
+
const w = L.values().filter(({ id: f }) => f >= 0).map(({ id: f }) => f).toArray();
|
|
135
|
+
for (const f of y)
|
|
136
|
+
f.rows = w.map((g) => f.rows[g]);
|
|
137
|
+
for (const f of d)
|
|
138
|
+
f.rows = w.map((g) => f.rows[g]);
|
|
139
|
+
for (const f of p ?? [])
|
|
140
|
+
f.rows = w.map((g) => f.rows[g]);
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
sequences: await Promise.all(
|
|
144
|
+
y.map(async ({ name: w, rows: f }, g) => {
|
|
145
|
+
const U = Z(f), k = oe({
|
|
146
|
+
colorScheme: o,
|
|
147
|
+
sequences: f,
|
|
148
|
+
residueCounts: U,
|
|
149
|
+
markup: p == null ? void 0 : p.at(g)
|
|
150
|
+
});
|
|
151
|
+
return k && Object.assign(b, k.legend), {
|
|
152
|
+
name: w,
|
|
153
|
+
rows: f,
|
|
154
|
+
residueCounts: U,
|
|
155
|
+
...k && {
|
|
156
|
+
highlightImageUrl: await se(k.blob)
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
})
|
|
160
|
+
),
|
|
161
|
+
labels: d,
|
|
162
|
+
...Object.keys(b).length && {
|
|
163
|
+
highlightLegend: b
|
|
164
|
+
},
|
|
165
|
+
...L && {
|
|
166
|
+
phylogeneticTree: L
|
|
167
|
+
},
|
|
168
|
+
exceedsLimit: u
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
async function ee({ pFrame: n, sequenceColumnIds: r, labelColumnIds: a, selection: e, colorScheme: o }) {
|
|
172
|
+
const t = x(), i = await t.listColumns(n), c = i.filter((p) => N(p.spec)), l = W({ selection: e });
|
|
173
|
+
let s = {
|
|
174
|
+
type: "inner",
|
|
175
|
+
entries: r.map((p) => ({
|
|
176
|
+
type: "column",
|
|
177
|
+
column: p
|
|
178
|
+
}))
|
|
179
|
+
};
|
|
180
|
+
c.length > 0 && (s = {
|
|
181
|
+
type: "outer",
|
|
182
|
+
primary: s,
|
|
183
|
+
secondary: c.map(({ columnId: p }) => ({
|
|
184
|
+
type: "column",
|
|
185
|
+
column: p
|
|
186
|
+
}))
|
|
187
|
+
}), l && (s = {
|
|
188
|
+
type: "inner",
|
|
189
|
+
entries: [
|
|
190
|
+
s,
|
|
191
|
+
{
|
|
192
|
+
type: "inlineColumn",
|
|
193
|
+
column: l
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
});
|
|
197
|
+
const u = a.flatMap((p) => p.type !== "column" ? [] : { type: "column", column: p.id });
|
|
198
|
+
if (o.type === "markup")
|
|
199
|
+
for (const p of o.columnIds)
|
|
200
|
+
u.push({ type: "column", column: p });
|
|
201
|
+
const m = Array.from(
|
|
202
|
+
new Set(
|
|
203
|
+
r.values().flatMap((p) => {
|
|
204
|
+
const b = i.find(({ columnId: y }) => y === p);
|
|
205
|
+
if (!b)
|
|
206
|
+
throw new Error(`Couldn't find sequence column (ID: ${p})`);
|
|
207
|
+
return b.spec.axesSpec.map((y) => v(S(y)));
|
|
208
|
+
})
|
|
209
|
+
)
|
|
210
|
+
).sort().map((p) => ({
|
|
211
|
+
column: { type: "axis", id: A(p) },
|
|
212
|
+
ascending: !0,
|
|
213
|
+
naAndAbsentAreLeastValues: !0
|
|
214
|
+
})), d = {
|
|
215
|
+
src: {
|
|
216
|
+
type: "outer",
|
|
217
|
+
primary: s,
|
|
218
|
+
secondary: u
|
|
219
|
+
},
|
|
220
|
+
filters: [],
|
|
221
|
+
sorting: m
|
|
222
|
+
};
|
|
223
|
+
return t.calculateTableData(
|
|
224
|
+
n,
|
|
225
|
+
JSON.parse(JSON.stringify(d)),
|
|
226
|
+
{
|
|
227
|
+
offset: 0,
|
|
228
|
+
// +1 is a hack to check whether the selection is over the limit
|
|
229
|
+
length: D + 1
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
const te = (n, r) => n.map((a) => {
|
|
234
|
+
const e = r.find(({ spec: i }) => i.id === a);
|
|
235
|
+
if (!e)
|
|
236
|
+
throw new Error(`Couldn't find sequence column (ID: \`${a}\`).`);
|
|
237
|
+
const o = C(e.spec.spec, h.Label) ?? "Unlabeled column", t = e.data.data.keys().take(D).map(
|
|
238
|
+
(i) => {
|
|
239
|
+
var c;
|
|
240
|
+
return ((c = R(e.data, i, { absent: "", na: "" })) == null ? void 0 : c.toString()) ?? "";
|
|
241
|
+
}
|
|
242
|
+
).toArray();
|
|
243
|
+
return { name: o, rows: t };
|
|
244
|
+
}), ne = (n, r) => n.map((a) => {
|
|
245
|
+
const e = r.find(({ spec: t }) => {
|
|
246
|
+
if (a.type === "axis" && t.type === "axis")
|
|
247
|
+
return O(a.id, t.id);
|
|
248
|
+
if (a.type === "column" && t.type === "column")
|
|
249
|
+
return a.id === t.id;
|
|
250
|
+
});
|
|
251
|
+
if (!e)
|
|
252
|
+
throw new Error(`Couldn't find label column (ID: \`${a}\`).`);
|
|
253
|
+
return { rows: e.data.data.keys().take(D).map(
|
|
254
|
+
(t) => {
|
|
255
|
+
var i;
|
|
256
|
+
return ((i = R(e.data, t, { absent: "", na: "" })) == null ? void 0 : i.toString()) ?? "";
|
|
257
|
+
}
|
|
258
|
+
).toArray() };
|
|
259
|
+
}), re = (n, r) => n.map((a) => {
|
|
260
|
+
const e = r.find(({ spec: i }) => i.id === a);
|
|
261
|
+
if (!e)
|
|
262
|
+
throw new Error(`Couldn't find markup column (ID: \`${a}\`).`);
|
|
263
|
+
const o = J(
|
|
264
|
+
e.spec.spec,
|
|
265
|
+
h.Sequence.Annotation.Mapping
|
|
266
|
+
) ?? {}, t = e.data.data.keys().take(D).map(
|
|
267
|
+
(i) => {
|
|
268
|
+
var c;
|
|
269
|
+
return z(
|
|
270
|
+
((c = R(e.data, i, { absent: "", na: "" })) == null ? void 0 : c.toString()) ?? ""
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
).toArray();
|
|
274
|
+
return { labels: o, rows: t };
|
|
275
|
+
}), ae = /* @__PURE__ */ (() => {
|
|
276
|
+
const n = /* @__PURE__ */ new Map();
|
|
277
|
+
return async (r, a, e) => {
|
|
278
|
+
const o = await I([r, a]);
|
|
279
|
+
let t = n.get(o);
|
|
280
|
+
return t || (t = await P(
|
|
281
|
+
new Worker(
|
|
282
|
+
new URL(
|
|
283
|
+
/* @vite-ignore */
|
|
284
|
+
"" + new URL("assets/multi-sequence-alignment.worker-Cm0gZp19.js", import.meta.url).href,
|
|
285
|
+
import.meta.url
|
|
286
|
+
),
|
|
287
|
+
{ type: "module" }
|
|
288
|
+
),
|
|
289
|
+
{ sequences: r, params: a },
|
|
290
|
+
e
|
|
291
|
+
), n.set(o, t), t);
|
|
292
|
+
};
|
|
293
|
+
})();
|
|
294
|
+
function oe({ colorScheme: n, sequences: r, residueCounts: a, markup: e }) {
|
|
295
|
+
var o;
|
|
296
|
+
if (n.type === "chemical-properties")
|
|
297
|
+
return V({ sequences: r, residueCounts: a });
|
|
298
|
+
if (n.type === "markup") {
|
|
299
|
+
if (!e)
|
|
300
|
+
throw new Error("Missing markup data.");
|
|
301
|
+
return Q({
|
|
302
|
+
markupRows: r.map((t, i) => {
|
|
303
|
+
const c = e.rows.at(i);
|
|
304
|
+
if (!c) throw new Error(`Missing markup for row ${i}.`);
|
|
305
|
+
return Y(t, c);
|
|
306
|
+
}),
|
|
307
|
+
columnCount: ((o = r.at(0)) == null ? void 0 : o.length) ?? 0,
|
|
308
|
+
labels: e.labels
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
const se = (n) => new Promise((r, a) => {
|
|
313
|
+
const e = new FileReader();
|
|
314
|
+
e.addEventListener("load", () => r(e.result)), e.addEventListener("error", () => a(e.error)), e.readAsDataURL(n);
|
|
315
|
+
}), ie = /* @__PURE__ */ (() => {
|
|
316
|
+
const n = /* @__PURE__ */ new Map();
|
|
317
|
+
return async (r, a) => {
|
|
318
|
+
var i;
|
|
319
|
+
const e = ((i = r.at(0)) == null ? void 0 : i.rows.keys().map((c) => r.map((l) => l.rows.at(c) ?? "").join("")).toArray()) ?? [], o = await I(e);
|
|
320
|
+
let t = n.get(o);
|
|
321
|
+
return t || (t = await P(
|
|
322
|
+
new Worker(
|
|
323
|
+
new URL(
|
|
324
|
+
/* @vite-ignore */
|
|
325
|
+
"" + new URL("assets/phylogenetic-tree.worker-4CrExYEo.js", import.meta.url).href,
|
|
326
|
+
import.meta.url
|
|
327
|
+
),
|
|
328
|
+
{ type: "module" }
|
|
329
|
+
),
|
|
330
|
+
e,
|
|
331
|
+
a
|
|
332
|
+
), n.set(o, t), t);
|
|
333
|
+
};
|
|
334
|
+
})(), P = (n, r, a) => new Promise((e, o) => {
|
|
335
|
+
n.addEventListener("message", ({ data: t }) => {
|
|
336
|
+
e(t), n.terminate();
|
|
337
|
+
}), n.addEventListener("error", ({ error: t, message: i }) => {
|
|
338
|
+
o(t ?? i), n.terminate();
|
|
339
|
+
}), a.addEventListener("abort", () => {
|
|
340
|
+
o(a.reason), n.terminate();
|
|
341
|
+
}), n.postMessage(r);
|
|
342
|
+
});
|
|
343
|
+
function E(n) {
|
|
344
|
+
const r = M(), a = M(!0), e = M();
|
|
345
|
+
let o;
|
|
346
|
+
return (t) => (F(t, async (i, c) => {
|
|
347
|
+
if (O(i, c)) return;
|
|
348
|
+
const l = new AbortController(), s = o = Symbol();
|
|
349
|
+
H(() => {
|
|
350
|
+
l.abort();
|
|
351
|
+
});
|
|
352
|
+
try {
|
|
353
|
+
e.value = void 0, a.value = !0;
|
|
354
|
+
const u = await n(i, l.signal);
|
|
355
|
+
s === o && (r.value = u);
|
|
356
|
+
} catch (u) {
|
|
357
|
+
console.error(u), s === o && (e.value = T(u));
|
|
358
|
+
} finally {
|
|
359
|
+
s === o && (a.value = !1);
|
|
360
|
+
}
|
|
361
|
+
}, { immediate: !0 }), { data: r, isLoading: a, error: e });
|
|
362
|
+
}
|
|
363
|
+
export {
|
|
364
|
+
D as SEQUENCE_LIMIT,
|
|
365
|
+
ge as useLabelColumnsOptions,
|
|
366
|
+
he as useMarkupColumnsOptions,
|
|
367
|
+
be as useMultipleAlignmentData,
|
|
368
|
+
we as useSequenceColumnsOptions
|
|
369
|
+
};
|
|
370
|
+
//# sourceMappingURL=data.js.map
|