@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
package/src/Toolbar.vue
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { isJsonEqual } from '@milaboratories/helpers';
|
|
3
|
+
import {
|
|
4
|
+
type ListOptionNormalized,
|
|
5
|
+
PlBtnGhost,
|
|
6
|
+
PlBtnPrimary,
|
|
7
|
+
PlBtnSecondary,
|
|
8
|
+
PlCheckbox,
|
|
9
|
+
PlDropdown,
|
|
10
|
+
PlDropdownMulti,
|
|
11
|
+
PlNumberField,
|
|
12
|
+
PlSlideModal,
|
|
13
|
+
} from '@milaboratories/uikit';
|
|
14
|
+
import type {
|
|
15
|
+
PlMultiSequenceAlignmentColorSchemeOption as ColorSchemeOption,
|
|
16
|
+
PlMultiSequenceAlignmentSettings as Settings,
|
|
17
|
+
PlMultiSequenceAlignmentWidget,
|
|
18
|
+
PObjectId,
|
|
19
|
+
PTableColumnId,
|
|
20
|
+
} from '@platforma-sdk/model';
|
|
21
|
+
import { computed, ref, useCssModule, watchEffect } from 'vue';
|
|
22
|
+
import { defaultSettings } from './settings';
|
|
23
|
+
|
|
24
|
+
const props = defineProps<{
|
|
25
|
+
settings: Settings;
|
|
26
|
+
sequenceColumnOptions: ListOptionNormalized<PObjectId>[] | undefined;
|
|
27
|
+
labelColumnOptions: ListOptionNormalized<PTableColumnId>[] | undefined;
|
|
28
|
+
colorSchemeOptions: ListOptionNormalized<ColorSchemeOption>[];
|
|
29
|
+
}>();
|
|
30
|
+
|
|
31
|
+
const emit = defineEmits<{
|
|
32
|
+
updateSettings: [Partial<Settings>];
|
|
33
|
+
export: [];
|
|
34
|
+
}>();
|
|
35
|
+
|
|
36
|
+
const classes = useCssModule();
|
|
37
|
+
|
|
38
|
+
const settingsOpen = ref(false);
|
|
39
|
+
|
|
40
|
+
function updateSetting<K extends keyof Settings>(
|
|
41
|
+
key: K,
|
|
42
|
+
value: Settings[K] | undefined,
|
|
43
|
+
) {
|
|
44
|
+
emit('updateSettings', { [key]: value });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function toggleWidget(
|
|
48
|
+
widget: PlMultiSequenceAlignmentWidget,
|
|
49
|
+
checked: boolean,
|
|
50
|
+
) {
|
|
51
|
+
updateSetting(
|
|
52
|
+
'widgets',
|
|
53
|
+
checked
|
|
54
|
+
? [...props.settings.widgets, widget]
|
|
55
|
+
: props.settings.widgets.filter((w) => widget !== w),
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const alignmentParams = ref({ ...props.settings.alignmentParams });
|
|
60
|
+
watchEffect(() => {
|
|
61
|
+
alignmentParams.value = { ...props.settings.alignmentParams };
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const alignmentParamsChangesPending = computed(() =>
|
|
65
|
+
!isJsonEqual(props.settings.alignmentParams, alignmentParams.value),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const canResetAlignmentParams = computed(() =>
|
|
69
|
+
!isJsonEqual(props.settings.alignmentParams, defaultSettings.alignmentParams),
|
|
70
|
+
);
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<template>
|
|
74
|
+
<div :class="classes.container">
|
|
75
|
+
<div :class="classes.line">
|
|
76
|
+
<div :class="classes.section">
|
|
77
|
+
<PlDropdownMulti
|
|
78
|
+
label="Sequence Columns"
|
|
79
|
+
:model-value="props.settings.sequenceColumnIds ?? []"
|
|
80
|
+
:options="props.sequenceColumnOptions"
|
|
81
|
+
clearable
|
|
82
|
+
@update:model-value="event => updateSetting('sequenceColumnIds', event)"
|
|
83
|
+
/>
|
|
84
|
+
<PlDropdownMulti
|
|
85
|
+
:model-value="props.settings.labelColumnIds ?? []"
|
|
86
|
+
label="Label Columns"
|
|
87
|
+
:options="props.labelColumnOptions"
|
|
88
|
+
clearable
|
|
89
|
+
@update:model-value="event => updateSetting('labelColumnIds', event)"
|
|
90
|
+
/>
|
|
91
|
+
<PlDropdown
|
|
92
|
+
:model-value="props.settings.colorScheme"
|
|
93
|
+
label="Color Scheme"
|
|
94
|
+
:options="props.colorSchemeOptions"
|
|
95
|
+
@update:model-value="event => updateSetting('colorScheme', event)"
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
<div :class="classes.buttons">
|
|
99
|
+
<PlBtnGhost icon="settings" @click.stop="settingsOpen = true">
|
|
100
|
+
Settings
|
|
101
|
+
</PlBtnGhost>
|
|
102
|
+
<PlBtnGhost icon="export" @click.stop="emit('export')">
|
|
103
|
+
Export
|
|
104
|
+
</PlBtnGhost>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
<div :class="classes.line">
|
|
108
|
+
<div :class="classes.section">
|
|
109
|
+
<PlCheckbox
|
|
110
|
+
:model-value="props.settings.widgets.includes('seqLogo')"
|
|
111
|
+
@update:model-value="event => toggleWidget('seqLogo', event)"
|
|
112
|
+
>
|
|
113
|
+
Seq logo
|
|
114
|
+
</PlCheckbox>
|
|
115
|
+
<PlCheckbox
|
|
116
|
+
:model-value="props.settings.widgets.includes('consensus')"
|
|
117
|
+
@update:model-value="event => toggleWidget('consensus', event)"
|
|
118
|
+
>
|
|
119
|
+
Consensus
|
|
120
|
+
</PlCheckbox>
|
|
121
|
+
<PlCheckbox :model-value="false" disabled>Navigator</PlCheckbox>
|
|
122
|
+
<PlCheckbox
|
|
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)"
|
|
132
|
+
>
|
|
133
|
+
Legend
|
|
134
|
+
</PlCheckbox>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
<PlSlideModal v-model="settingsOpen">
|
|
139
|
+
<template #title>Settings</template>
|
|
140
|
+
<PlNumberField
|
|
141
|
+
v-model="alignmentParams.gpo"
|
|
142
|
+
label="Gap open penalty"
|
|
143
|
+
:step="0.1"
|
|
144
|
+
@keyup.enter="updateSetting('alignmentParams', alignmentParams)"
|
|
145
|
+
>
|
|
146
|
+
<template #tooltip>
|
|
147
|
+
Penalty score assigned to the introduction of a gap in the alignment
|
|
148
|
+
</template>
|
|
149
|
+
</PlNumberField>
|
|
150
|
+
<PlNumberField
|
|
151
|
+
v-model="alignmentParams.gpe"
|
|
152
|
+
label="Gap extension penalty"
|
|
153
|
+
:step="0.1"
|
|
154
|
+
@keyup.enter="updateSetting('alignmentParams', alignmentParams)"
|
|
155
|
+
>
|
|
156
|
+
<template #tooltip>
|
|
157
|
+
Penalty score assigned to each additional residue added to an existing
|
|
158
|
+
gap
|
|
159
|
+
</template>
|
|
160
|
+
</PlNumberField>
|
|
161
|
+
<PlNumberField
|
|
162
|
+
v-model="alignmentParams.tgpe"
|
|
163
|
+
label="Terminal gap extension penalty"
|
|
164
|
+
:step="0.1"
|
|
165
|
+
@keyup.enter="updateSetting('alignmentParams', alignmentParams)"
|
|
166
|
+
>
|
|
167
|
+
<template #tooltip>
|
|
168
|
+
Penalty score assigned to extending gaps at the ends of sequences
|
|
169
|
+
</template>
|
|
170
|
+
</PlNumberField>
|
|
171
|
+
<div
|
|
172
|
+
v-if="alignmentParamsChangesPending"
|
|
173
|
+
:class="classes.pendingChanges"
|
|
174
|
+
>
|
|
175
|
+
<PlBtnPrimary @click="updateSetting('alignmentParams', alignmentParams)">
|
|
176
|
+
Apply
|
|
177
|
+
</PlBtnPrimary>
|
|
178
|
+
<PlBtnGhost @click="alignmentParams = props.settings.alignmentParams">
|
|
179
|
+
Cancel
|
|
180
|
+
</PlBtnGhost>
|
|
181
|
+
</div>
|
|
182
|
+
<PlBtnSecondary
|
|
183
|
+
v-if="canResetAlignmentParams"
|
|
184
|
+
:class="classes.resetButton"
|
|
185
|
+
icon="reverse"
|
|
186
|
+
@click="updateSetting('alignmentParams', undefined)"
|
|
187
|
+
>
|
|
188
|
+
Reset to Default
|
|
189
|
+
</PlBtnSecondary>
|
|
190
|
+
</PlSlideModal>
|
|
191
|
+
</template>
|
|
192
|
+
|
|
193
|
+
<style module>
|
|
194
|
+
.container {
|
|
195
|
+
display: flex;
|
|
196
|
+
flex-direction: column;
|
|
197
|
+
gap: 24px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.line {
|
|
201
|
+
display: flex;
|
|
202
|
+
justify-content: space-between;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.section {
|
|
206
|
+
display: flex;
|
|
207
|
+
flex-wrap: wrap;
|
|
208
|
+
gap: 24px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.buttons {
|
|
212
|
+
display: flex;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.pendingChanges {
|
|
216
|
+
display: flex;
|
|
217
|
+
button {
|
|
218
|
+
min-width: 160px;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.resetButton {
|
|
223
|
+
margin-block-start: auto;
|
|
224
|
+
span {
|
|
225
|
+
text-transform: none;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
</style>
|
package/src/cell-size.ts
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import type { HighlightLegend, ResidueCounts } from './types';
|
|
2
|
+
|
|
3
|
+
export function highlightByChemicalProperties(
|
|
4
|
+
{ sequences, residueCounts }: {
|
|
5
|
+
sequences: string[];
|
|
6
|
+
residueCounts: ResidueCounts;
|
|
7
|
+
},
|
|
8
|
+
): { blob: Blob; legend: HighlightLegend } {
|
|
9
|
+
const lines: {
|
|
10
|
+
category: ChemicalCategory;
|
|
11
|
+
column: number;
|
|
12
|
+
start: number;
|
|
13
|
+
length: number;
|
|
14
|
+
}[] = [];
|
|
15
|
+
const chemicalProperties = getAlignmentChemicalProperties({
|
|
16
|
+
residueCounts,
|
|
17
|
+
rowCount: sequences.length,
|
|
18
|
+
});
|
|
19
|
+
const width = sequences.at(0)?.length ?? 0;
|
|
20
|
+
const height = sequences.length;
|
|
21
|
+
for (let column = 0; column < width; column += 1) {
|
|
22
|
+
for (let row = 0; row < height; row += 1) {
|
|
23
|
+
const residue = sequences[row][column];
|
|
24
|
+
const category = chemicalProperties
|
|
25
|
+
.at(column)
|
|
26
|
+
?.find(({ residues }) => residues.includes(residue))
|
|
27
|
+
?.category;
|
|
28
|
+
if (!category) continue;
|
|
29
|
+
const lastLine = lines.at(-1);
|
|
30
|
+
if (
|
|
31
|
+
lastLine
|
|
32
|
+
&& lastLine.category === category
|
|
33
|
+
&& lastLine.column === column
|
|
34
|
+
&& lastLine.start + lastLine.length === row
|
|
35
|
+
) {
|
|
36
|
+
lastLine.length += 1;
|
|
37
|
+
} else {
|
|
38
|
+
lines.push({ category, column, start: row, length: 1 });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const linesByCategory = Map.groupBy(lines, ({ category }) => category);
|
|
43
|
+
const blob = new Blob(
|
|
44
|
+
(function*() {
|
|
45
|
+
const viewBox = `0 0 ${width * 2} ${height}`;
|
|
46
|
+
yield `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewBox}" stroke-width="2" preserveAspectRatio="none">`;
|
|
47
|
+
for (const [category, lines] of linesByCategory) {
|
|
48
|
+
const color = chemicalPropertiesColorScheme[category]?.color;
|
|
49
|
+
if (!color) continue;
|
|
50
|
+
yield `<path stroke="${color}" d="`;
|
|
51
|
+
let x = 0, y = 0;
|
|
52
|
+
for (const { column, start, length } of lines) {
|
|
53
|
+
yield `m${column * 2 + 1 - x},${start - y}v${length}`;
|
|
54
|
+
x = column * 2 + 1;
|
|
55
|
+
y = start + length;
|
|
56
|
+
}
|
|
57
|
+
yield '"/>';
|
|
58
|
+
}
|
|
59
|
+
yield '</svg>';
|
|
60
|
+
})().toArray(),
|
|
61
|
+
{ type: 'image/svg+xml' },
|
|
62
|
+
);
|
|
63
|
+
const legend = Object.fromEntries(
|
|
64
|
+
Object.entries(chemicalPropertiesColorScheme)
|
|
65
|
+
.filter(([color]) => linesByCategory.has(color as ChemicalCategory)),
|
|
66
|
+
);
|
|
67
|
+
return { blob, legend };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const getAlignmentChemicalProperties = (
|
|
71
|
+
{ residueCounts, rowCount }: {
|
|
72
|
+
residueCounts: ResidueCounts;
|
|
73
|
+
rowCount: number;
|
|
74
|
+
},
|
|
75
|
+
): ColumnChemicalProperties[] =>
|
|
76
|
+
residueCounts.map((column) => {
|
|
77
|
+
const matchedRules = new Set<string>();
|
|
78
|
+
return categoryCriterion.filter(({ residues, rules }) =>
|
|
79
|
+
residues.split('').some((residue) => residue in column)
|
|
80
|
+
&& (!rules || rules.split('').map((ruleName) =>
|
|
81
|
+
[ruleName, ruleDefinitions[ruleName as RuleName]] as const,
|
|
82
|
+
).some(([ruleName, { residues, threshold }]) => {
|
|
83
|
+
if (matchedRules.has(ruleName)) return true;
|
|
84
|
+
const groupCount = residues.split('')
|
|
85
|
+
.reduce((acc, residue) => acc + (column[residue] ?? 0), 0);
|
|
86
|
+
const matches = groupCount >= rowCount * threshold;
|
|
87
|
+
if (matches) matchedRules.add(ruleName);
|
|
88
|
+
return matches;
|
|
89
|
+
})),
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
type ColumnChemicalProperties = {
|
|
94
|
+
residues: string;
|
|
95
|
+
category: ChemicalCategory;
|
|
96
|
+
}[];
|
|
97
|
+
|
|
98
|
+
const chemicalPropertiesColorScheme = {
|
|
99
|
+
hydrophobic: {
|
|
100
|
+
label: 'Hydrophobic',
|
|
101
|
+
color: '#99CCFF',
|
|
102
|
+
},
|
|
103
|
+
positiveCharge: {
|
|
104
|
+
label: 'Positive Charged',
|
|
105
|
+
color: '#FFA2A3',
|
|
106
|
+
},
|
|
107
|
+
negativeCharge: {
|
|
108
|
+
label: 'Negative Charged',
|
|
109
|
+
color: '#C1ADFF',
|
|
110
|
+
},
|
|
111
|
+
polar: {
|
|
112
|
+
label: 'Polar',
|
|
113
|
+
color: '#99E099',
|
|
114
|
+
},
|
|
115
|
+
cysteine: {
|
|
116
|
+
label: 'Cysteines',
|
|
117
|
+
color: '#FAAAFA',
|
|
118
|
+
},
|
|
119
|
+
glycine: {
|
|
120
|
+
label: 'Glycines',
|
|
121
|
+
color: '#F7BC5D',
|
|
122
|
+
},
|
|
123
|
+
proline: {
|
|
124
|
+
label: 'Prolines',
|
|
125
|
+
color: '#FFFF8F',
|
|
126
|
+
},
|
|
127
|
+
aromatic: {
|
|
128
|
+
label: 'Aromatic',
|
|
129
|
+
color: '#A2F5FA',
|
|
130
|
+
},
|
|
131
|
+
} satisfies HighlightLegend;
|
|
132
|
+
|
|
133
|
+
export type ChemicalCategory = keyof typeof chemicalPropertiesColorScheme;
|
|
134
|
+
|
|
135
|
+
/*
|
|
136
|
+
* Below taken mostly from
|
|
137
|
+
* https://www.rbvi.ucsf.edu/chimera/1.2065/docs/ContributedSoftware/multalignviewer/colprot.par}
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
const ruleDefinitions = {
|
|
141
|
+
'%': { residues: 'WLVIMAFCYHP', threshold: 0.6 },
|
|
142
|
+
'#': { residues: 'WLVIMAFCYHP', threshold: 0.8 },
|
|
143
|
+
'-': { residues: 'ED', threshold: 0.5 },
|
|
144
|
+
'+': { residues: 'KR', threshold: 0.6 },
|
|
145
|
+
'g': { residues: 'G', threshold: 0.5 },
|
|
146
|
+
'n': { residues: 'N', threshold: 0.5 },
|
|
147
|
+
'q': { residues: 'QE', threshold: 0.5 },
|
|
148
|
+
'p': { residues: 'P', threshold: 0.5 },
|
|
149
|
+
't': { residues: 'TS', threshold: 0.5 },
|
|
150
|
+
'A': { residues: 'A', threshold: 0.85 },
|
|
151
|
+
'C': { residues: 'C', threshold: 0.85 },
|
|
152
|
+
'D': { residues: 'D', threshold: 0.85 },
|
|
153
|
+
'E': { residues: 'E', threshold: 0.85 },
|
|
154
|
+
'F': { residues: 'F', threshold: 0.85 },
|
|
155
|
+
'G': { residues: 'G', threshold: 0.85 },
|
|
156
|
+
'H': { residues: 'H', threshold: 0.85 },
|
|
157
|
+
'I': { residues: 'I', threshold: 0.85 },
|
|
158
|
+
'K': { residues: 'K', threshold: 0.85 },
|
|
159
|
+
'L': { residues: 'L', threshold: 0.85 },
|
|
160
|
+
'M': { residues: 'M', threshold: 0.85 },
|
|
161
|
+
'N': { residues: 'N', threshold: 0.85 },
|
|
162
|
+
'P': { residues: 'P', threshold: 0.85 },
|
|
163
|
+
'Q': { residues: 'Q', threshold: 0.85 },
|
|
164
|
+
'R': { residues: 'R', threshold: 0.85 },
|
|
165
|
+
'S': { residues: 'S', threshold: 0.85 },
|
|
166
|
+
'T': { residues: 'T', threshold: 0.85 },
|
|
167
|
+
'V': { residues: 'V', threshold: 0.85 },
|
|
168
|
+
'W': { residues: 'W', threshold: 0.85 },
|
|
169
|
+
'Y': { residues: 'Y', threshold: 0.85 },
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
type RuleName = keyof typeof ruleDefinitions;
|
|
173
|
+
|
|
174
|
+
const categoryCriterion: Criteria[] = [
|
|
175
|
+
{ residues: 'G', category: 'glycine', rules: '' },
|
|
176
|
+
{ residues: 'P', category: 'proline', rules: '' },
|
|
177
|
+
{ residues: 'T', category: 'polar', rules: 'tST%#' },
|
|
178
|
+
{ residues: 'S', category: 'polar', rules: 'tST#' },
|
|
179
|
+
{ residues: 'N', category: 'polar', rules: 'nND' },
|
|
180
|
+
{ residues: 'Q', category: 'polar', rules: 'qQE+KR' },
|
|
181
|
+
// criteria below has to go before the other criteria for C,
|
|
182
|
+
// otherwise it will never match
|
|
183
|
+
{ residues: 'C', category: 'cysteine', rules: 'C' },
|
|
184
|
+
{ residues: 'WLVIMF', category: 'hydrophobic', rules: '%#ACFHILMVWYPp' },
|
|
185
|
+
// below there was an 's' rule too,
|
|
186
|
+
// but no definition of such rule was provided
|
|
187
|
+
{ residues: 'A', category: 'hydrophobic', rules: '%#ACFHILMVWYPpTSG' },
|
|
188
|
+
{ residues: 'C', category: 'hydrophobic', rules: '%#AFHILMVWYSPp' },
|
|
189
|
+
{ residues: 'HY', category: 'aromatic', rules: '%#ACFHILMVWYPp' },
|
|
190
|
+
{ residues: 'E', category: 'negativeCharge', rules: '-DEqQ' },
|
|
191
|
+
{ residues: 'D', category: 'negativeCharge', rules: '-DEnN' },
|
|
192
|
+
{ residues: 'KR', category: 'positiveCharge', rules: '+KRQ' },
|
|
193
|
+
];
|
|
194
|
+
|
|
195
|
+
type Criteria = {
|
|
196
|
+
residues: string;
|
|
197
|
+
category: ChemicalCategory;
|
|
198
|
+
rules: string;
|
|
199
|
+
};
|