pdbe-molstar 3.5.0 → 3.7.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/build/pdbe-molstar-component.js +2 -2
- package/build/pdbe-molstar-light.css +2 -2
- package/build/pdbe-molstar-plugin.js +2 -2
- package/build/pdbe-molstar-plugin.js.LICENSE.txt +1 -1
- package/build/pdbe-molstar.css +2 -2
- package/lib/alphafold-transparency.js +7 -8
- package/lib/extensions/complexes/coloring.d.ts +55 -0
- package/lib/extensions/complexes/coloring.js +129 -0
- package/lib/extensions/complexes/index.d.ts +70 -0
- package/lib/extensions/complexes/index.js +99 -0
- package/lib/extensions/complexes/superpose-by-biggest-chain.d.ts +15 -0
- package/lib/extensions/complexes/superpose-by-biggest-chain.js +141 -0
- package/lib/extensions/complexes/superpose-by-sequence-alignment.d.ts +10 -0
- package/lib/extensions/complexes/superpose-by-sequence-alignment.js +181 -0
- package/lib/helpers.d.ts +15 -1
- package/lib/helpers.js +119 -68
- package/lib/plugin-custom-state.d.ts +0 -2
- package/lib/sequence-color/behavior.d.ts +5 -0
- package/lib/sequence-color/behavior.js +54 -0
- package/lib/sequence-color/color.d.ts +11 -0
- package/lib/sequence-color/color.js +58 -0
- package/lib/sequence-color/prop.d.ts +38 -0
- package/lib/sequence-color/prop.js +38 -0
- package/lib/spec.d.ts +1 -1
- package/lib/styles/pdbe-molstar/_index.scss +7 -7
- package/lib/styles/pdbe-molstar-dark.scss +2 -2
- package/lib/styles/pdbe-molstar-light.scss +2 -2
- package/lib/superposition.d.ts +2 -2
- package/lib/superposition.js +41 -60
- package/lib/ui/alphafold-superposition.js +2 -2
- package/lib/ui/pdbe-viewport-controls.js +3 -4
- package/lib/ui/pdbe-viewport.d.ts +5 -1
- package/lib/ui/pdbe-viewport.js +23 -2
- package/lib/ui/split-ui/components.d.ts +1 -1
- package/lib/ui/split-ui/components.js +2 -2
- package/lib/viewer.d.ts +7 -1
- package/lib/viewer.js +27 -14
- package/package.json +3 -3
- package/lib/superposition-sifts-mapping.d.ts +0 -22
- package/lib/superposition-sifts-mapping.js +0 -153
package/lib/helpers.js
CHANGED
|
@@ -13,13 +13,17 @@ exports.distinct = distinct;
|
|
|
13
13
|
exports.groupElements = groupElements;
|
|
14
14
|
exports.createIndex = createIndex;
|
|
15
15
|
exports.nonnegativeModulo = nonnegativeModulo;
|
|
16
|
+
exports.pluginLayoutStateFromInitParams = pluginLayoutStateFromInitParams;
|
|
17
|
+
exports.getRotationMat4 = getRotationMat4;
|
|
16
18
|
const tslib_1 = require("tslib");
|
|
17
19
|
const prop_1 = require("molstar/lib/extensions/model-archive/quality-assessment/prop");
|
|
20
|
+
const linear_algebra_1 = require("molstar/lib/mol-math/linear-algebra");
|
|
18
21
|
const structure_1 = require("molstar/lib/mol-model/structure");
|
|
19
22
|
const query_1 = require("molstar/lib/mol-model/structure/query/query");
|
|
20
23
|
const transforms_1 = require("molstar/lib/mol-plugin-state/transforms");
|
|
21
24
|
const transformers_1 = require("molstar/lib/mol-plugin/behavior/dynamic/volume-streaming/transformers");
|
|
22
25
|
const commands_1 = require("molstar/lib/mol-plugin/commands");
|
|
26
|
+
const layout_1 = require("molstar/lib/mol-plugin/layout");
|
|
23
27
|
const builder_1 = require("molstar/lib/mol-script/language/builder");
|
|
24
28
|
const compiler_1 = require("molstar/lib/mol-script/runtime/query/compiler");
|
|
25
29
|
const mol_state_1 = require("molstar/lib/mol-state");
|
|
@@ -30,9 +34,12 @@ const sleep_1 = require("molstar/lib/mol-util/sleep");
|
|
|
30
34
|
const sifts_mapping_1 = require("./sifts-mapping");
|
|
31
35
|
var PDBeVolumes;
|
|
32
36
|
(function (PDBeVolumes) {
|
|
33
|
-
function mapParams(defaultParams, mapParams
|
|
37
|
+
function mapParams(defaultParams, mapParams) {
|
|
34
38
|
const pdbeParams = Object.assign({}, defaultParams);
|
|
35
|
-
|
|
39
|
+
if (mapParams === null || mapParams === void 0 ? void 0 : mapParams.defaultView) {
|
|
40
|
+
pdbeParams.defaultView = mapParams.defaultView;
|
|
41
|
+
}
|
|
42
|
+
pdbeParams.options.behaviorRef = `volume-streaming${Math.floor(Math.random() * 100)}`;
|
|
36
43
|
pdbeParams.options.emContourProvider = 'pdbe';
|
|
37
44
|
pdbeParams.options.serverUrl = 'https://www.ebi.ac.uk/pdbe/volume-server';
|
|
38
45
|
const MAIN_MAP_DEFAULTS = { opacity: 0.49, wireframe: false };
|
|
@@ -148,7 +155,7 @@ var LigandView;
|
|
|
148
155
|
LigandView.branchedQuery = branchedQuery;
|
|
149
156
|
})(LigandView || (exports.LigandView = LigandView = {}));
|
|
150
157
|
function queryParamsToMvsComponentExpressions(params) {
|
|
151
|
-
const broadcasted = broadcast(params, ['atoms', 'atom_id']);
|
|
158
|
+
const broadcasted = broadcast(params, ['atoms', 'atom_id', 'type_symbol']);
|
|
152
159
|
return broadcasted.map(item => {
|
|
153
160
|
var _a;
|
|
154
161
|
return ({
|
|
@@ -164,7 +171,7 @@ function queryParamsToMvsComponentExpressions(params) {
|
|
|
164
171
|
end_auth_seq_id: item.end_auth_residue_number,
|
|
165
172
|
label_atom_id: item.atoms,
|
|
166
173
|
auth_atom_id: undefined,
|
|
167
|
-
type_symbol:
|
|
174
|
+
type_symbol: item.type_symbol,
|
|
168
175
|
atom_id: item.atom_id,
|
|
169
176
|
atom_index: undefined,
|
|
170
177
|
label_comp_id: item.label_comp_id,
|
|
@@ -197,92 +204,108 @@ var QueryHelper;
|
|
|
197
204
|
(function (QueryHelper) {
|
|
198
205
|
function getQueryObject(params, contextData) {
|
|
199
206
|
const selections = [];
|
|
200
|
-
|
|
201
|
-
let
|
|
202
|
-
|
|
203
|
-
|
|
207
|
+
/** `undefined` means SIFTSMappingMapping has not been retrieved yet. `null` means SIFTSMappingMapping has been retrieved unsuccessfully. */
|
|
208
|
+
let _siftMappings;
|
|
209
|
+
function getSiftsMappings() {
|
|
210
|
+
var _a;
|
|
211
|
+
if (_siftMappings === undefined)
|
|
212
|
+
_siftMappings = (_a = sifts_mapping_1.SIFTSMapping.Provider.get(contextData.models[0]).value) !== null && _a !== void 0 ? _a : null;
|
|
213
|
+
return _siftMappings;
|
|
214
|
+
}
|
|
215
|
+
for (const param of params) {
|
|
216
|
+
const predicates = {
|
|
217
|
+
entity: [],
|
|
218
|
+
chain: [],
|
|
219
|
+
residue: [],
|
|
220
|
+
atom: [],
|
|
221
|
+
};
|
|
204
222
|
// entity
|
|
205
|
-
if (param.entity_id)
|
|
206
|
-
|
|
223
|
+
if (param.entity_id !== undefined) {
|
|
224
|
+
predicates.entity.push(l => structure_1.StructureProperties.entity.id(l.element) === param.entity_id);
|
|
225
|
+
}
|
|
207
226
|
// chain
|
|
208
|
-
if (param.struct_asym_id) {
|
|
209
|
-
|
|
227
|
+
if (param.struct_asym_id !== undefined) {
|
|
228
|
+
predicates.chain.push(l => structure_1.StructureProperties.chain.label_asym_id(l.element) === param.struct_asym_id);
|
|
210
229
|
}
|
|
211
|
-
|
|
212
|
-
|
|
230
|
+
if (param.auth_asym_id !== undefined) {
|
|
231
|
+
predicates.chain.push(l => structure_1.StructureProperties.chain.auth_asym_id(l.element) === param.auth_asym_id);
|
|
213
232
|
}
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
selection['residueTest'] = l => structure_1.StructureProperties.atom.label_comp_id(l.element) === param.label_comp_id;
|
|
233
|
+
// residue
|
|
234
|
+
if (param.label_comp_id !== undefined) {
|
|
235
|
+
predicates.residue.push(l => structure_1.StructureProperties.atom.label_comp_id(l.element) === param.label_comp_id);
|
|
218
236
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
if (!siftMappings || currentAccession !== param.uniprot_accession) {
|
|
222
|
-
siftMappings = sifts_mapping_1.SIFTSMapping.Provider.get(contextData.models[0]).value;
|
|
223
|
-
currentAccession = param.uniprot_accession;
|
|
224
|
-
}
|
|
225
|
-
const rI = structure_1.StructureProperties.residue.key(l.element);
|
|
226
|
-
return !!siftMappings && param.uniprot_accession === siftMappings.accession[rI] && param.uniprot_residue_number === +siftMappings.num[rI];
|
|
227
|
-
};
|
|
237
|
+
if (param.residue_number !== undefined) {
|
|
238
|
+
predicates.residue.push(l => structure_1.StructureProperties.residue.label_seq_id(l.element) === param.residue_number);
|
|
228
239
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
if (!siftMappings || currentAccession !== param.uniprot_accession) {
|
|
232
|
-
siftMappings = sifts_mapping_1.SIFTSMapping.Provider.get(contextData.models[0]).value;
|
|
233
|
-
currentAccession = param.uniprot_accession;
|
|
234
|
-
}
|
|
235
|
-
const rI = structure_1.StructureProperties.residue.key(l.element);
|
|
236
|
-
return !!siftMappings && param.uniprot_accession === siftMappings.accession[rI] && (param.start_uniprot_residue_number <= +siftMappings.num[rI] && param.end_uniprot_residue_number >= +siftMappings.num[rI]);
|
|
237
|
-
};
|
|
240
|
+
if (param.start_residue_number !== undefined) {
|
|
241
|
+
predicates.residue.push(l => structure_1.StructureProperties.residue.label_seq_id(l.element) >= param.start_residue_number);
|
|
238
242
|
}
|
|
239
|
-
|
|
240
|
-
|
|
243
|
+
if (param.end_residue_number !== undefined) {
|
|
244
|
+
predicates.residue.push(l => structure_1.StructureProperties.residue.label_seq_id(l.element) <= param.end_residue_number);
|
|
241
245
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const labelSeqId = structure_1.StructureProperties.residue.label_seq_id(l.element);
|
|
245
|
-
return labelSeqId >= param.start_residue_number && labelSeqId <= param.end_residue_number;
|
|
246
|
-
};
|
|
246
|
+
if (param.auth_seq_id !== undefined) {
|
|
247
|
+
predicates.residue.push(l => structure_1.StructureProperties.residue.auth_seq_id(l.element) === param.auth_seq_id);
|
|
247
248
|
}
|
|
248
|
-
|
|
249
|
-
|
|
249
|
+
if (param.auth_residue_number !== undefined) {
|
|
250
|
+
predicates.residue.push(l => structure_1.StructureProperties.residue.auth_seq_id(l.element) === param.auth_residue_number);
|
|
250
251
|
}
|
|
251
|
-
|
|
252
|
-
|
|
252
|
+
if (param.auth_ins_code_id !== undefined) {
|
|
253
|
+
predicates.residue.push(l => structure_1.StructureProperties.residue.pdbx_PDB_ins_code(l.element) === param.auth_ins_code_id);
|
|
253
254
|
}
|
|
254
|
-
|
|
255
|
-
|
|
255
|
+
if (param.start_auth_residue_number !== undefined) {
|
|
256
|
+
predicates.residue.push(l => structure_1.StructureProperties.residue.auth_seq_id(l.element) >= param.start_auth_residue_number);
|
|
257
|
+
if (param.start_auth_ins_code_id !== undefined) {
|
|
258
|
+
// This assumes insertion code come in alphabetical order, which is not always true (e.g. 1ucy chain A [auth L]). However, authors of such monstrosities do not deserve their structures to be displayed correctly.
|
|
259
|
+
predicates.residue.push(l => structure_1.StructureProperties.residue.auth_seq_id(l.element) > param.start_auth_residue_number || structure_1.StructureProperties.residue.pdbx_PDB_ins_code(l.element) >= param.start_auth_ins_code_id);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (param.end_auth_residue_number !== undefined) {
|
|
263
|
+
predicates.residue.push(l => structure_1.StructureProperties.residue.auth_seq_id(l.element) <= param.end_auth_residue_number);
|
|
264
|
+
if (param.end_auth_ins_code_id !== undefined) {
|
|
265
|
+
// This assumes insertion code come in alphabetical order, which is not always true (e.g. 1ucy chain A [auth L]). However, authors of such monstrosities do not deserve their structures to be displayed correctly.
|
|
266
|
+
predicates.residue.push(l => structure_1.StructureProperties.residue.auth_seq_id(l.element) < param.end_auth_residue_number || structure_1.StructureProperties.residue.pdbx_PDB_ins_code(l.element) <= param.end_auth_ins_code_id);
|
|
267
|
+
}
|
|
256
268
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
// TODO really check ins code, same for auth_seq_id, start_auth_ins_code_id, end_auth_ins_code_id
|
|
269
|
+
if (param.uniprot_accession !== undefined) {
|
|
270
|
+
predicates.residue.push(l => { var _a; return ((_a = getSiftsMappings()) === null || _a === void 0 ? void 0 : _a.accession[structure_1.StructureProperties.residue.key(l.element)]) === param.uniprot_accession; });
|
|
260
271
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const authSeqId = structure_1.StructureProperties.residue.auth_seq_id(l.element);
|
|
264
|
-
return authSeqId >= param.start_auth_residue_number && authSeqId <= param.end_auth_residue_number;
|
|
265
|
-
};
|
|
272
|
+
if (param.uniprot_residue_number !== undefined) {
|
|
273
|
+
predicates.residue.push(l => { var _a; return Number((_a = getSiftsMappings()) === null || _a === void 0 ? void 0 : _a.num[structure_1.StructureProperties.residue.key(l.element)]) === param.uniprot_residue_number; });
|
|
266
274
|
}
|
|
267
|
-
|
|
268
|
-
|
|
275
|
+
if (param.start_uniprot_residue_number !== undefined) {
|
|
276
|
+
predicates.residue.push(l => { var _a; return Number((_a = getSiftsMappings()) === null || _a === void 0 ? void 0 : _a.num[structure_1.StructureProperties.residue.key(l.element)]) >= param.start_uniprot_residue_number; });
|
|
269
277
|
}
|
|
270
|
-
|
|
278
|
+
if (param.end_uniprot_residue_number !== undefined) {
|
|
279
|
+
predicates.residue.push(l => { var _a; return Number((_a = getSiftsMappings()) === null || _a === void 0 ? void 0 : _a.num[structure_1.StructureProperties.residue.key(l.element)]) <= param.end_uniprot_residue_number; });
|
|
280
|
+
}
|
|
281
|
+
// atom
|
|
271
282
|
if (param.atoms) {
|
|
272
|
-
|
|
283
|
+
predicates.atom.push(l => param.atoms.includes(structure_1.StructureProperties.atom.label_atom_id(l.element)));
|
|
273
284
|
}
|
|
274
285
|
if (param.atom_id) {
|
|
275
|
-
|
|
286
|
+
predicates.atom.push(l => param.atom_id.includes(structure_1.StructureProperties.atom.id(l.element)));
|
|
276
287
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
288
|
+
if (param.type_symbol) {
|
|
289
|
+
predicates.atom.push(l => param.type_symbol.includes(structure_1.StructureProperties.atom.type_symbol(l.element)));
|
|
290
|
+
}
|
|
291
|
+
selections.push({
|
|
292
|
+
entityTest: predicateConjunction(predicates.entity),
|
|
293
|
+
chainTest: predicateConjunction(predicates.chain),
|
|
294
|
+
residueTest: predicateConjunction(predicates.residue),
|
|
295
|
+
atomTest: predicateConjunction(predicates.atom),
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
const atmGroupsQueries = selections.map(selection => structure_1.Queries.modifiers.union(structure_1.Queries.generators.atoms(selection)));
|
|
283
299
|
return structure_1.Queries.combinators.merge(atmGroupsQueries);
|
|
284
300
|
}
|
|
285
301
|
QueryHelper.getQueryObject = getQueryObject;
|
|
302
|
+
function predicateConjunction(predicates) {
|
|
303
|
+
if (predicates.length === 0)
|
|
304
|
+
return undefined;
|
|
305
|
+
if (predicates.length === 1)
|
|
306
|
+
return predicates[0];
|
|
307
|
+
return (x => predicates.every(pred => pred(x)));
|
|
308
|
+
}
|
|
286
309
|
function getInteractivityLoci(params, contextData) {
|
|
287
310
|
const sel = query_1.StructureQuery.run(QueryHelper.getQueryObject(params, contextData), contextData);
|
|
288
311
|
return structure_1.StructureSelection.toLociWithSourceUnits(sel);
|
|
@@ -570,3 +593,31 @@ var PluginConfigUtils;
|
|
|
570
593
|
}
|
|
571
594
|
PluginConfigUtils.getConfigValues = getConfigValues;
|
|
572
595
|
})(PluginConfigUtils || (exports.PluginConfigUtils = PluginConfigUtils = {}));
|
|
596
|
+
function pluginLayoutStateFromInitParams(initParams) {
|
|
597
|
+
return {
|
|
598
|
+
isExpanded: initParams.expanded,
|
|
599
|
+
showControls: !initParams.hideControls,
|
|
600
|
+
regionState: {
|
|
601
|
+
left: initParams.leftPanel ? 'full' : 'hidden',
|
|
602
|
+
right: initParams.rightPanel ? 'full' : 'hidden',
|
|
603
|
+
top: initParams.sequencePanel ? 'full' : 'hidden',
|
|
604
|
+
bottom: initParams.logPanel ? 'full' : 'hidden',
|
|
605
|
+
},
|
|
606
|
+
controlsDisplay: initParams.reactive ? 'reactive' : initParams.landscape ? 'landscape' : layout_1.PluginLayoutStateParams.controlsDisplay.defaultValue,
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
function getRotationMat4(view) {
|
|
610
|
+
switch (view) {
|
|
611
|
+
case 'front': return linear_algebra_1.Mat4.identity();
|
|
612
|
+
case 'back': return [-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1];
|
|
613
|
+
case 'right': return [0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1];
|
|
614
|
+
case 'left': return [0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1];
|
|
615
|
+
case 'top': return [1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1];
|
|
616
|
+
case 'bottom': return [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1];
|
|
617
|
+
default: {
|
|
618
|
+
const out = linear_algebra_1.Mat4.fromMat3((0, linear_algebra_1.Mat4)(), view);
|
|
619
|
+
out[15] = 1;
|
|
620
|
+
return out;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SymmetryOperator } from 'molstar/lib/mol-math/geometry';
|
|
2
1
|
import { Mat4 } from 'molstar/lib/mol-math/linear-algebra';
|
|
3
2
|
import { PluginContext } from 'molstar/lib/mol-plugin/context';
|
|
4
3
|
import { StateSelection, StateTransform } from 'molstar/lib/mol-state';
|
|
@@ -55,7 +54,6 @@ export interface PluginCustomState {
|
|
|
55
54
|
visibility: boolean[];
|
|
56
55
|
transforms: Mat4[];
|
|
57
56
|
rmsds: string[][];
|
|
58
|
-
coordinateSystems: (SymmetryOperator | undefined)[];
|
|
59
57
|
};
|
|
60
58
|
};
|
|
61
59
|
superpositionError?: string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PluginBehavior } from 'molstar/lib/mol-plugin/behavior';
|
|
2
|
+
/** Allows coloring residues in sequence panel */
|
|
3
|
+
export declare const SequenceColor: import("molstar/lib/mol-state").StateTransformer<PluginBehavior.Category, PluginBehavior.Behavior, {
|
|
4
|
+
autoAttach: boolean;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SequenceColor = void 0;
|
|
4
|
+
const model_1 = require("molstar/lib/mol-plugin-state/transforms/model");
|
|
5
|
+
const context_1 = require("molstar/lib/mol-plugin-ui/context");
|
|
6
|
+
const behavior_1 = require("molstar/lib/mol-plugin/behavior");
|
|
7
|
+
const param_definition_1 = require("molstar/lib/mol-util/param-definition");
|
|
8
|
+
const rxjs_1 = require("rxjs");
|
|
9
|
+
const color_1 = require("./color");
|
|
10
|
+
const prop_1 = require("./prop");
|
|
11
|
+
/** Allows coloring residues in sequence panel */
|
|
12
|
+
exports.SequenceColor = behavior_1.PluginBehavior.create({
|
|
13
|
+
name: 'sequence-color',
|
|
14
|
+
category: 'misc',
|
|
15
|
+
display: {
|
|
16
|
+
name: 'Sequence Color',
|
|
17
|
+
description: 'Sequence Color extension, allows assigning custom residue colors to be shown in the sequence panel, based on a custom structure property',
|
|
18
|
+
},
|
|
19
|
+
ctor: class extends behavior_1.PluginBehavior.Handler {
|
|
20
|
+
register() {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
this.ctx.customStructureProperties.register(prop_1.SequenceColorProperty.Provider, this.params.autoAttach);
|
|
23
|
+
if (this.ctx instanceof context_1.PluginUIContext) {
|
|
24
|
+
const customUIState = (_a = this.ctx.customUIState) !== null && _a !== void 0 ? _a : {}; // TODO remove this hack once `customUIState` is available in core Molstar
|
|
25
|
+
const theme = (_b = customUIState.experimentalSequenceColorTheme) !== null && _b !== void 0 ? _b : (customUIState.experimentalSequenceColorTheme = new rxjs_1.BehaviorSubject(undefined));
|
|
26
|
+
this.sub = this.ctx.state.events.cell.stateUpdated.subscribe(s => {
|
|
27
|
+
if (s.cell.transform.transformer === model_1.CustomStructureProperties) {
|
|
28
|
+
theme.next(color_1.CustomSequenceColorTheme.Provider);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
update(p) {
|
|
34
|
+
const updated = this.params.autoAttach !== p.autoAttach;
|
|
35
|
+
this.params.autoAttach = p.autoAttach;
|
|
36
|
+
this.ctx.customStructureProperties.setDefaultAutoAttach(prop_1.SequenceColorProperty.Provider.descriptor.name, this.params.autoAttach);
|
|
37
|
+
return updated;
|
|
38
|
+
}
|
|
39
|
+
unregister() {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
this.ctx.customStructureProperties.unregister(prop_1.SequenceColorProperty.Provider.descriptor.name);
|
|
42
|
+
(_a = this.sub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
43
|
+
this.sub = undefined;
|
|
44
|
+
if (this.ctx instanceof context_1.PluginUIContext) {
|
|
45
|
+
const customUIState = (_b = this.ctx.customUIState) !== null && _b !== void 0 ? _b : {}; // TODO remove this hack once `customUIState` is available in core Molstar
|
|
46
|
+
const theme = customUIState.experimentalSequenceColorTheme;
|
|
47
|
+
theme === null || theme === void 0 ? void 0 : theme.next(undefined);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
params: () => ({
|
|
52
|
+
autoAttach: param_definition_1.ParamDefinition.Boolean(true),
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ColorTheme } from 'molstar/lib/mol-theme/color';
|
|
2
|
+
import { ThemeDataContext } from 'molstar/lib/mol-theme/theme';
|
|
3
|
+
import { ParamDefinition as PD } from 'molstar/lib/mol-util/param-definition';
|
|
4
|
+
export declare namespace CustomSequenceColorTheme {
|
|
5
|
+
const Params: {};
|
|
6
|
+
type Params = typeof Params;
|
|
7
|
+
type Props = PD.Values<Params>;
|
|
8
|
+
function Theme(ctx: ThemeDataContext, props: Props): ColorTheme<Props>;
|
|
9
|
+
/** A thingy that is needed to register color theme "MVS Annotation" */
|
|
10
|
+
const Provider: ColorTheme.Provider<Params, 'custom-sequence-color'>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomSequenceColorTheme = void 0;
|
|
4
|
+
const selector_1 = require("molstar/lib/extensions/mvs/components/selector");
|
|
5
|
+
const structure_1 = require("molstar/lib/mol-model/structure");
|
|
6
|
+
const color_1 = require("molstar/lib/mol-util/color");
|
|
7
|
+
const param_definition_1 = require("molstar/lib/mol-util/param-definition");
|
|
8
|
+
const prop_1 = require("./prop");
|
|
9
|
+
/** Special color value meaning "no color assigned" */
|
|
10
|
+
const NoColor = (0, color_1.Color)(-1);
|
|
11
|
+
var CustomSequenceColorTheme;
|
|
12
|
+
(function (CustomSequenceColorTheme) {
|
|
13
|
+
CustomSequenceColorTheme.Params = {};
|
|
14
|
+
function Theme(ctx, props) {
|
|
15
|
+
let color = () => NoColor;
|
|
16
|
+
if (ctx.structure && !ctx.structure.isEmpty) {
|
|
17
|
+
const colorData = prop_1.SequenceColorProperty.Provider.get(ctx.structure).value;
|
|
18
|
+
if (colorData && colorData.items.length > 0) {
|
|
19
|
+
color = location => structure_1.StructureElement.Location.is(location) ? sequenceColorForLocation(colorData, location) : NoColor;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
factory: Theme,
|
|
24
|
+
granularity: 'groupInstance',
|
|
25
|
+
color: color,
|
|
26
|
+
props: props,
|
|
27
|
+
description: 'Assigns colors based on custom structure property `SequenceColorProperty`.',
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
CustomSequenceColorTheme.Theme = Theme;
|
|
31
|
+
/** A thingy that is needed to register color theme "MVS Annotation" */
|
|
32
|
+
CustomSequenceColorTheme.Provider = {
|
|
33
|
+
name: 'custom-sequence-color',
|
|
34
|
+
label: 'Custom Sequence Color',
|
|
35
|
+
category: 'Miscellaneous',
|
|
36
|
+
factory: Theme,
|
|
37
|
+
getParams: ctx => CustomSequenceColorTheme.Params,
|
|
38
|
+
defaultValues: param_definition_1.ParamDefinition.getDefaultValues(CustomSequenceColorTheme.Params),
|
|
39
|
+
isApplicable: (ctx) => !!ctx.structure,
|
|
40
|
+
};
|
|
41
|
+
})(CustomSequenceColorTheme || (exports.CustomSequenceColorTheme = CustomSequenceColorTheme = {}));
|
|
42
|
+
function sequenceColorForLocation(colorData, location) {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
var _c, _d, _e;
|
|
45
|
+
const unitCache = (_a = (_c = colorData.colorCache)[_d = location.unit.id]) !== null && _a !== void 0 ? _a : (_c[_d] = {});
|
|
46
|
+
return (_b = unitCache[_e = location.element]) !== null && _b !== void 0 ? _b : (unitCache[_e] = findSequenceColorForLocation(colorData, location));
|
|
47
|
+
}
|
|
48
|
+
function findSequenceColorForLocation(colorData, location) {
|
|
49
|
+
var _a;
|
|
50
|
+
for (let i = colorData.items.length - 1; i >= 0; i--) { // last color matters
|
|
51
|
+
const item = colorData.items[i];
|
|
52
|
+
const elements = (_a = item.elementSet) !== null && _a !== void 0 ? _a : (item.elementSet = selector_1.ElementSet.fromSelector(location.structure, item.selector));
|
|
53
|
+
if (selector_1.ElementSet.has(elements, location)) {
|
|
54
|
+
return item.color;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return NoColor;
|
|
58
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ElementSet, Selector } from 'molstar/lib/extensions/mvs/components/selector';
|
|
2
|
+
import { CustomStructureProperty } from 'molstar/lib/mol-model-props/common/custom-structure-property';
|
|
3
|
+
import { ElementIndex } from 'molstar/lib/mol-model/structure';
|
|
4
|
+
import { Color } from 'molstar/lib/mol-util/color';
|
|
5
|
+
import { ParamDefinition as PD } from 'molstar/lib/mol-util/param-definition';
|
|
6
|
+
export declare namespace SequenceColorProperty {
|
|
7
|
+
/** Parameter definition for custom structure property `SequenceColorProperty` */
|
|
8
|
+
type Params = typeof Params;
|
|
9
|
+
const Params: {
|
|
10
|
+
colors: PD.ObjectList<PD.Normalize<{
|
|
11
|
+
color: Color;
|
|
12
|
+
selector: PD.NamedParams<"all" | "polymer" | "water" | "branched" | "ligand" | "ion" | "lipid" | "protein" | "nucleic" | "non-standard" | "coarse", "static"> | PD.NamedParams<import("molstar/lib/mol-script/script").Script, "script"> | PD.NamedParams<import("molstar/lib/mol-script/language/expression").Expression, "expression"> | PD.NamedParams<import("molstar/lib/mol-model/structure/structure/element/bundle").Bundle, "bundle"> | PD.NamedParams<PD.Normalize<{
|
|
13
|
+
annotationId: string;
|
|
14
|
+
fieldName: string;
|
|
15
|
+
fieldValues: PD.NamedParams<PD.Normalize<unknown>, "all"> | PD.NamedParams<PD.Normalize<{
|
|
16
|
+
value: any;
|
|
17
|
+
}>[], "selected">;
|
|
18
|
+
}>, "annotation">;
|
|
19
|
+
}>>;
|
|
20
|
+
};
|
|
21
|
+
/** Parameter values of custom structure property `SequenceColorProperty` */
|
|
22
|
+
type Props = PD.Values<Params>;
|
|
23
|
+
/** Values of custom structure property `SequenceColorProperty` */
|
|
24
|
+
interface Data {
|
|
25
|
+
items: {
|
|
26
|
+
selector: Selector;
|
|
27
|
+
color: Color;
|
|
28
|
+
elementSet?: ElementSet;
|
|
29
|
+
}[];
|
|
30
|
+
colorCache: {
|
|
31
|
+
[unitId: number]: {
|
|
32
|
+
[elemIdx: ElementIndex]: Color;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** Provider for custom structure property `SequenceColorProperty` */
|
|
37
|
+
const Provider: CustomStructureProperty.Provider<Params, Data>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SequenceColorProperty = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const selector_1 = require("molstar/lib/extensions/mvs/components/selector");
|
|
6
|
+
const custom_structure_property_1 = require("molstar/lib/mol-model-props/common/custom-structure-property");
|
|
7
|
+
const custom_property_1 = require("molstar/lib/mol-model/custom-property");
|
|
8
|
+
const color_1 = require("molstar/lib/mol-util/color");
|
|
9
|
+
const names_1 = require("molstar/lib/mol-util/color/names");
|
|
10
|
+
const param_definition_1 = require("molstar/lib/mol-util/param-definition");
|
|
11
|
+
var SequenceColorProperty;
|
|
12
|
+
(function (SequenceColorProperty) {
|
|
13
|
+
SequenceColorProperty.Params = {
|
|
14
|
+
colors: param_definition_1.ParamDefinition.ObjectList({
|
|
15
|
+
color: param_definition_1.ParamDefinition.Color(names_1.ColorNames.grey, { description: 'Color to apply to a substructure' }),
|
|
16
|
+
selector: selector_1.SelectorParams,
|
|
17
|
+
}, obj => color_1.Color.toHexStyle(obj.color), { description: 'List of substructure-color assignments' }),
|
|
18
|
+
};
|
|
19
|
+
/** Provider for custom structure property `SequenceColorProperty` */
|
|
20
|
+
SequenceColorProperty.Provider = custom_structure_property_1.CustomStructureProperty.createProvider({
|
|
21
|
+
label: 'Sequence Color',
|
|
22
|
+
descriptor: (0, custom_property_1.CustomPropertyDescriptor)({
|
|
23
|
+
name: 'sequence-color',
|
|
24
|
+
}),
|
|
25
|
+
type: 'root',
|
|
26
|
+
defaultParams: SequenceColorProperty.Params,
|
|
27
|
+
getParams: (data) => SequenceColorProperty.Params,
|
|
28
|
+
isApplicable: (data) => data.root === data,
|
|
29
|
+
obtain: (ctx, data, props) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const fullProps = Object.assign(Object.assign({}, param_definition_1.ParamDefinition.getDefaultValues(SequenceColorProperty.Params)), props);
|
|
31
|
+
const items = fullProps.colors.map(t => ({
|
|
32
|
+
selector: t.selector,
|
|
33
|
+
color: t.color,
|
|
34
|
+
}));
|
|
35
|
+
return { value: { items, colorCache: {} } };
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
})(SequenceColorProperty || (exports.SequenceColorProperty = SequenceColorProperty = {}));
|
package/lib/spec.d.ts
CHANGED
|
@@ -123,7 +123,7 @@ export interface InitParams {
|
|
|
123
123
|
/** Hide all control panels by default (can be shown by the Toggle Controls Panel button (wrench icon)) */
|
|
124
124
|
hideControls: boolean;
|
|
125
125
|
/** Hide individual icon buttons in the top-right corner of the canvas */
|
|
126
|
-
hideCanvasControls: ('expand' | 'controlToggle' | 'controlInfo' | 'selection' | 'animation' | 'trajectory')[];
|
|
126
|
+
hideCanvasControls: ('screenshot' | 'expand' | 'controlToggle' | 'controlInfo' | 'selection' | 'animation' | 'trajectory')[];
|
|
127
127
|
/** Display Sequence panel */
|
|
128
128
|
sequencePanel: boolean;
|
|
129
129
|
/** Display Left control panel */
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
// Color constants must be imported before importing this file
|
|
4
4
|
// (from molstar/lib/mol-plugin-ui/skin/*.scss or molstar/lib/mol-plugin-ui/skin/colors/*.scss)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
@import 'molstar/lib/mol-plugin-ui/skin/base/variables.scss';
|
|
6
|
+
@use 'molstar/lib/mol-plugin-ui/skin/base/_vars.scss' as vars;
|
|
8
7
|
|
|
8
|
+
.msp-plugin {
|
|
9
9
|
::-webkit-scrollbar-thumb {
|
|
10
10
|
background-color: #80808080;
|
|
11
11
|
border-radius: 10px;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.msp-viewport-controls-panel .msp-viewport-controls-panel-controls {
|
|
25
|
-
max-height: calc(100cqh -
|
|
25
|
+
max-height: calc(100cqh - 46px - 24px - 10px); // 100cqh = viewport container, 46px = control buttons offset, 24px = header, 10px = space below
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// Avoid wraping headers in left panel help
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
float: left;
|
|
44
44
|
|
|
45
45
|
&:not(:empty) {
|
|
46
|
-
margin-right:
|
|
46
|
+
margin-right: vars.$control-spacing;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
display: flex;
|
|
53
53
|
flex-direction: column;
|
|
54
54
|
align-items: center;
|
|
55
|
-
padding-inline: calc(54px + 2 *
|
|
55
|
+
padding-inline: calc(54px + 2 * vars.$control-spacing); // 54px = PDBe logo box
|
|
56
56
|
pointer-events: none;
|
|
57
57
|
|
|
58
58
|
>* {
|
|
59
|
-
margin-top:
|
|
59
|
+
margin-top: vars.$control-spacing;
|
|
60
60
|
pointer-events: auto;
|
|
61
61
|
max-width: 100%;
|
|
62
62
|
}
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
.pdbemolstar-state-gallery-title-box {
|
|
146
146
|
width: 500px;
|
|
147
147
|
max-width: 100%;
|
|
148
|
-
background-color:
|
|
148
|
+
background-color: vars.$msp-form-control-background;
|
|
149
149
|
display: flex;
|
|
150
150
|
flex-direction: row;
|
|
151
151
|
justify-content: space-between;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
@
|
|
2
|
-
@
|
|
1
|
+
@use 'molstar/lib/mol-plugin-ui/skin/dark';
|
|
2
|
+
@use './pdbe-molstar/_index';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
@
|
|
2
|
-
@
|
|
1
|
+
@use 'molstar/lib/mol-plugin-ui/skin/light';
|
|
2
|
+
@use './pdbe-molstar/_index';
|
package/lib/superposition.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ import { ClusterMember } from './plugin-custom-state';
|
|
|
8
8
|
export declare const SuperpositionColorPalette: ColorListEntry[];
|
|
9
9
|
export declare function getNextColor(plugin: PluginContext, segmentIndex: number): ColorListEntry;
|
|
10
10
|
export declare function initSuperposition(plugin: PluginContext, completeSubject?: Subject<boolean>): Promise<void>;
|
|
11
|
-
export declare function loadAfStructure(plugin: PluginContext): Promise<string |
|
|
12
|
-
export declare function superposeAf(plugin: PluginContext, traceOnly: boolean
|
|
11
|
+
export declare function loadAfStructure(plugin: PluginContext): Promise<string | undefined>;
|
|
12
|
+
export declare function superposeAf(plugin: PluginContext, traceOnly: boolean): Promise<boolean>;
|
|
13
13
|
export declare function renderSuperposition(plugin: PluginContext, segmentIndex: number, entryList: ClusterMember[]): Promise<void>;
|
|
14
14
|
/** Apply tranformation to a structure. Only use once per structure, combining multiple transformations is not implemented. */
|
|
15
15
|
export declare function transform(plugin: PluginContext, s: StateObjectRef<PSO.Molecule.Structure>, matrix: Mat4): Promise<StateObjectSelector<PSO.Molecule.Structure, import("molstar/lib/mol-state").StateTransformer<import("molstar/lib/mol-state").StateObject<any, import("molstar/lib/mol-state").StateObject.Type<any>>, import("molstar/lib/mol-state").StateObject<any, import("molstar/lib/mol-state").StateObject.Type<any>>, any>>>;
|