drugflow-molstar 0.4.7 → 0.4.8
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/drugflow-molstar-0.4.8.css +1 -0
- package/build/drugflow-molstar-component-0.4.8.js +25 -0
- package/build/drugflow-molstar-plugin-0.4.8.js +2 -0
- package/build/drugflow-molstar-plugin-0.4.8.js.LICENSE.txt +39 -0
- package/lib/alphafold-transparency.js +157 -62
- package/lib/contact.d.ts +7 -14
- package/lib/contact.js +68 -72
- package/lib/custom-events.js +15 -15
- package/lib/domain-annotations/behavior.d.ts +1 -1
- package/lib/domain-annotations/behavior.js +24 -20
- package/lib/domain-annotations/color.js +22 -22
- package/lib/domain-annotations/prop.js +111 -62
- package/lib/drugflow-molstar-component-build-0.4.8.js +2 -0
- package/lib/drugflow-molstar-component-build-0.4.8.js.LICENSE.txt +24 -0
- package/lib/helpers.d.ts +3 -3
- package/lib/helpers.js +94 -89
- package/lib/index.d.ts +902 -1
- package/lib/index.js +2814 -1875
- package/lib/labels.d.ts +1 -1
- package/lib/labels.js +34 -20
- package/lib/loci-details.js +46 -34
- package/lib/sifts-mapping.js +32 -28
- package/lib/sifts-mappings-behaviour.d.ts +1 -1
- package/lib/sifts-mappings-behaviour.js +30 -26
- package/lib/spec.js +40 -52
- package/lib/structure_contact3d.d.ts +14 -21
- package/lib/structure_contact3d.js +46 -25
- package/lib/subscribe-events.js +18 -19
- package/lib/superposition-export.js +178 -102
- package/lib/superposition-focus-representation.d.ts +2 -2
- package/lib/superposition-focus-representation.js +131 -73
- package/lib/superposition-sifts-mapping.js +150 -105
- package/lib/superposition.js +810 -495
- package/lib/ui/alphafold-superposition.d.ts +1 -1
- package/lib/ui/alphafold-superposition.js +118 -94
- package/lib/ui/alphafold-tranparency.js +43 -27
- package/lib/ui/annotation-controls.js +89 -83
- package/lib/ui/export-superposition.d.ts +0 -1
- package/lib/ui/export-superposition.js +50 -32
- package/lib/ui/pdbe-left-panel.d.ts +0 -1
- package/lib/ui/pdbe-left-panel.js +105 -82
- package/lib/ui/pdbe-screenshot-controls.js +83 -54
- package/lib/ui/pdbe-structure-controls.js +57 -34
- package/lib/ui/pdbe-viewport-controls.js +29 -23
- package/lib/ui/segment-tree.js +663 -440
- package/lib/ui/superposition-components.js +312 -208
- package/lib/ui/superposition-viewport.js +18 -11
- package/package.json +3 -3
- package/build/drugflow-molstar-0.4.7.css +0 -1
- package/build/drugflow-molstar-component-0.4.7.js +0 -25
- package/build/drugflow-molstar-plugin-0.4.7.js +0 -2
- package/build/drugflow-molstar-plugin-0.4.7.js.LICENSE.txt +0 -64
package/lib/helpers.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ModelInfo = exports.QueryHelper = exports.LigandView = exports.AlphafoldView = exports.PDBeVolumes = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var commands_1 = require("Molstar/mol-plugin/commands");
|
|
6
|
+
var builder_1 = require("Molstar/mol-script/language/builder");
|
|
7
|
+
var mol_state_1 = require("Molstar/mol-state");
|
|
8
|
+
var structure_1 = require("Molstar/mol-model/structure");
|
|
9
|
+
var transformers_1 = require("Molstar/mol-plugin/behavior/dynamic/volume-streaming/transformers");
|
|
10
|
+
var compiler_1 = require("Molstar/mol-script/runtime/query/compiler");
|
|
11
|
+
var structure_2 = require("Molstar/mol-model/structure");
|
|
12
|
+
var sifts_mapping_1 = require("./sifts-mapping");
|
|
13
|
+
var query_1 = require("Molstar/mol-model/structure/query/query");
|
|
14
|
+
var prop_1 = require("Molstar/extensions/model-archive/quality-assessment/prop");
|
|
14
15
|
var PDBeVolumes;
|
|
15
16
|
(function (PDBeVolumes) {
|
|
16
17
|
function mapParams(defaultParams, mapParams, ref) {
|
|
17
|
-
|
|
18
|
+
var pdbeParams = tslib_1.__assign({}, defaultParams);
|
|
18
19
|
pdbeParams.options.behaviorRef = 'volume-streaming' + '' + Math.floor(Math.random() * Math.floor(100));
|
|
19
20
|
pdbeParams.options.emContourProvider = 'pdbe';
|
|
20
21
|
pdbeParams.options.serverUrl = 'https://www.ebi.ac.uk/pdbe/volume-server';
|
|
@@ -47,8 +48,8 @@ var PDBeVolumes;
|
|
|
47
48
|
}
|
|
48
49
|
PDBeVolumes.displayUsibilityMessage = displayUsibilityMessage;
|
|
49
50
|
function toggle(plugin) {
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
var state = plugin.state.data;
|
|
52
|
+
var streamingState = state.select(mol_state_1.StateSelection.Generators.ofTransformer(transformers_1.CreateVolumeStreamingInfo))[0];
|
|
52
53
|
if (streamingState) {
|
|
53
54
|
commands_1.PluginCommands.State.ToggleVisibility(plugin, { state: state, ref: streamingState.transform.ref });
|
|
54
55
|
return;
|
|
@@ -59,7 +60,7 @@ var PDBeVolumes;
|
|
|
59
60
|
var AlphafoldView;
|
|
60
61
|
(function (AlphafoldView) {
|
|
61
62
|
function getLociByPLDDT(score, contextData) {
|
|
62
|
-
|
|
63
|
+
var queryExp = builder_1.MolScriptBuilder.struct.modifier.union([
|
|
63
64
|
builder_1.MolScriptBuilder.struct.modifier.wholeResidues([
|
|
64
65
|
builder_1.MolScriptBuilder.struct.modifier.union([
|
|
65
66
|
builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
@@ -69,8 +70,8 @@ var AlphafoldView;
|
|
|
69
70
|
])
|
|
70
71
|
])
|
|
71
72
|
]);
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
var query = (0, compiler_1.compile)(queryExp);
|
|
74
|
+
var sel = query(new structure_1.QueryContext(contextData));
|
|
74
75
|
return structure_1.StructureSelection.toLociWithSourceUnits(sel);
|
|
75
76
|
}
|
|
76
77
|
AlphafoldView.getLociByPLDDT = getLociByPLDDT;
|
|
@@ -78,11 +79,11 @@ var AlphafoldView;
|
|
|
78
79
|
var LigandView;
|
|
79
80
|
(function (LigandView) {
|
|
80
81
|
function query(ligandViewParams) {
|
|
81
|
-
|
|
82
|
+
var atomGroupsParams = {
|
|
82
83
|
'group-by': builder_1.MolScriptBuilder.core.str.concat([builder_1.MolScriptBuilder.struct.atomProperty.core.operatorName(), builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()])
|
|
83
84
|
};
|
|
84
85
|
// Residue Param
|
|
85
|
-
|
|
86
|
+
var residueParam;
|
|
86
87
|
if (ligandViewParams.auth_seq_id) {
|
|
87
88
|
residueParam = builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(), ligandViewParams.auth_seq_id]);
|
|
88
89
|
}
|
|
@@ -99,43 +100,43 @@ var LigandView;
|
|
|
99
100
|
atomGroupsParams['chain-test'] = builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.label_asym_id(), ligandViewParams.struct_asym_id]);
|
|
100
101
|
}
|
|
101
102
|
// Construct core query
|
|
102
|
-
|
|
103
|
+
var core = ligandViewParams.show_all ?
|
|
103
104
|
builder_1.MolScriptBuilder.struct.generator.atomGroups(atomGroupsParams) :
|
|
104
105
|
builder_1.MolScriptBuilder.struct.filter.first([
|
|
105
106
|
builder_1.MolScriptBuilder.struct.generator.atomGroups(atomGroupsParams)
|
|
106
107
|
]);
|
|
107
108
|
// Construct surroundings query
|
|
108
|
-
|
|
109
|
+
var surroundings = builder_1.MolScriptBuilder.struct.modifier.includeSurroundings({ 0: core, radius: 5, 'as-whole-residues': true });
|
|
109
110
|
return {
|
|
110
|
-
core,
|
|
111
|
-
surroundings
|
|
111
|
+
core: core,
|
|
112
|
+
surroundings: surroundings
|
|
112
113
|
};
|
|
113
114
|
}
|
|
114
115
|
LigandView.query = query;
|
|
115
116
|
function branchedQuery(params) {
|
|
116
|
-
|
|
117
|
-
params.atom_site.forEach((param)
|
|
118
|
-
|
|
117
|
+
var entityObjArray = [];
|
|
118
|
+
params.atom_site.forEach(function (param) {
|
|
119
|
+
var qEntities = {
|
|
119
120
|
'group-by': builder_1.MolScriptBuilder.core.str.concat([builder_1.MolScriptBuilder.struct.atomProperty.core.operatorName(), builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()]),
|
|
120
121
|
'residue-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(), param.auth_seq_id])
|
|
121
122
|
};
|
|
122
123
|
entityObjArray.push(qEntities);
|
|
123
124
|
});
|
|
124
|
-
|
|
125
|
-
entityObjArray.forEach((entityObj)
|
|
125
|
+
var atmGroupsQueries = [];
|
|
126
|
+
entityObjArray.forEach(function (entityObj) {
|
|
126
127
|
atmGroupsQueries.push(builder_1.MolScriptBuilder.struct.generator.atomGroups(entityObj));
|
|
127
128
|
});
|
|
128
|
-
|
|
129
|
+
var core = builder_1.MolScriptBuilder.struct.modifier.union([
|
|
129
130
|
atmGroupsQueries.length === 1
|
|
130
131
|
? atmGroupsQueries[0]
|
|
131
132
|
// Need to union before merge for fast performance
|
|
132
|
-
: builder_1.MolScriptBuilder.struct.combinator.merge(atmGroupsQueries.map(q
|
|
133
|
+
: builder_1.MolScriptBuilder.struct.combinator.merge(atmGroupsQueries.map(function (q) { return builder_1.MolScriptBuilder.struct.modifier.union([q]); }))
|
|
133
134
|
]);
|
|
134
135
|
// Construct surroundings query
|
|
135
|
-
|
|
136
|
+
var surroundings = builder_1.MolScriptBuilder.struct.modifier.includeSurroundings({ 0: core, radius: 5, 'as-whole-residues': true });
|
|
136
137
|
return {
|
|
137
|
-
core,
|
|
138
|
-
surroundings
|
|
138
|
+
core: core,
|
|
139
|
+
surroundings: surroundings
|
|
139
140
|
};
|
|
140
141
|
}
|
|
141
142
|
LigandView.branchedQuery = branchedQuery;
|
|
@@ -143,134 +144,138 @@ var LigandView;
|
|
|
143
144
|
var QueryHelper;
|
|
144
145
|
(function (QueryHelper) {
|
|
145
146
|
function getQueryObject(params, contextData) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
params.forEach(param
|
|
150
|
-
|
|
147
|
+
var selections = [];
|
|
148
|
+
var siftMappings;
|
|
149
|
+
var currentAccession;
|
|
150
|
+
params.forEach(function (param) {
|
|
151
|
+
var selection = {};
|
|
151
152
|
// entity
|
|
152
153
|
if (param.entity_id)
|
|
153
|
-
selection['entityTest'] = (l)
|
|
154
|
+
selection['entityTest'] = function (l) { return structure_1.StructureProperties.entity.id(l.element) === param.entity_id; };
|
|
154
155
|
// chain
|
|
155
156
|
if (param.struct_asym_id) {
|
|
156
|
-
selection['chainTest'] = (l)
|
|
157
|
+
selection['chainTest'] = function (l) { return structure_1.StructureProperties.chain.label_asym_id(l.element) === param.struct_asym_id; };
|
|
157
158
|
}
|
|
158
159
|
else if (param.auth_asym_id) {
|
|
159
|
-
selection['chainTest'] = (l)
|
|
160
|
+
selection['chainTest'] = function (l) { return structure_1.StructureProperties.chain.auth_asym_id(l.element) === param.auth_asym_id; };
|
|
160
161
|
}
|
|
161
162
|
if (param.group_PDB) {
|
|
162
|
-
selection['residueTest'] = (l)
|
|
163
|
+
selection['residueTest'] = function (l) { return structure_1.StructureProperties.residue.group_PDB(l.element) === param.group_PDB; };
|
|
163
164
|
}
|
|
164
165
|
// residues
|
|
165
166
|
if (param.label_comp_id) {
|
|
166
|
-
selection['residueTest'] = (l)
|
|
167
|
+
selection['residueTest'] = function (l) { return structure_1.StructureProperties.atom.label_comp_id(l.element) === param.label_comp_id; };
|
|
167
168
|
}
|
|
168
169
|
else if (param.uniprot_accession && param.uniprot_residue_number) {
|
|
169
|
-
selection['residueTest'] = (l)
|
|
170
|
+
selection['residueTest'] = function (l) {
|
|
170
171
|
if (!siftMappings || currentAccession !== param.uniprot_accession) {
|
|
171
172
|
siftMappings = sifts_mapping_1.SIFTSMapping.Provider.get(contextData.models[0]).value;
|
|
172
173
|
currentAccession = param.uniprot_accession;
|
|
173
174
|
}
|
|
174
|
-
|
|
175
|
+
var rI = structure_1.StructureProperties.residue.key(l.element);
|
|
175
176
|
return param.uniprot_accession === siftMappings.accession[rI] && param.uniprot_residue_number === +siftMappings.num[rI];
|
|
176
177
|
};
|
|
177
178
|
}
|
|
178
179
|
else if (param.uniprot_accession && param.start_uniprot_residue_number && param.end_uniprot_residue_number) {
|
|
179
|
-
selection['residueTest'] = (l)
|
|
180
|
+
selection['residueTest'] = function (l) {
|
|
180
181
|
if (!siftMappings || currentAccession !== param.uniprot_accession) {
|
|
181
182
|
siftMappings = sifts_mapping_1.SIFTSMapping.Provider.get(contextData.models[0]).value;
|
|
182
183
|
currentAccession = param.uniprot_accession;
|
|
183
184
|
}
|
|
184
|
-
|
|
185
|
+
var rI = structure_1.StructureProperties.residue.key(l.element);
|
|
185
186
|
return param.uniprot_accession === siftMappings.accession[rI] && (param.start_uniprot_residue_number <= +siftMappings.num[rI] && param.end_uniprot_residue_number >= +siftMappings.num[rI]);
|
|
186
187
|
};
|
|
187
188
|
}
|
|
188
189
|
else if (param.residue_number) {
|
|
189
|
-
selection['residueTest'] = (l)
|
|
190
|
+
selection['residueTest'] = function (l) { return structure_1.StructureProperties.residue.label_seq_id(l.element) === param.residue_number; };
|
|
190
191
|
}
|
|
191
192
|
else if ((param.start_residue_number && param.end_residue_number) && (param.end_residue_number > param.start_residue_number)) {
|
|
192
|
-
selection['residueTest'] = (l)
|
|
193
|
-
|
|
193
|
+
selection['residueTest'] = function (l) {
|
|
194
|
+
var labelSeqId = structure_1.StructureProperties.residue.label_seq_id(l.element);
|
|
194
195
|
return labelSeqId >= param.start_residue_number && labelSeqId <= param.end_residue_number;
|
|
195
196
|
};
|
|
196
197
|
}
|
|
197
198
|
else if ((param.start_residue_number && param.end_residue_number) && (param.end_residue_number === param.start_residue_number)) {
|
|
198
|
-
selection['residueTest'] = (l)
|
|
199
|
+
selection['residueTest'] = function (l) { return structure_1.StructureProperties.residue.label_seq_id(l.element) === param.start_residue_number; };
|
|
199
200
|
}
|
|
200
201
|
else if (param.auth_seq_id) {
|
|
201
|
-
selection['residueTest'] = (l)
|
|
202
|
+
selection['residueTest'] = function (l) { return structure_1.StructureProperties.residue.auth_seq_id(l.element) === param.auth_seq_id; };
|
|
202
203
|
}
|
|
203
204
|
else if (param.auth_residue_number && !param.auth_ins_code_id) {
|
|
204
|
-
selection['residueTest'] = (l)
|
|
205
|
+
selection['residueTest'] = function (l) { return structure_1.StructureProperties.residue.auth_seq_id(l.element) === param.auth_residue_number; };
|
|
205
206
|
}
|
|
206
207
|
else if (param.auth_residue_number && param.auth_ins_code_id) {
|
|
207
|
-
selection['residueTest'] = (l)
|
|
208
|
+
selection['residueTest'] = function (l) { return structure_1.StructureProperties.residue.auth_seq_id(l.element) === param.auth_residue_number; };
|
|
208
209
|
}
|
|
209
210
|
else if ((param.start_auth_residue_number && param.end_auth_residue_number) && (param.end_auth_residue_number > param.start_auth_residue_number)) {
|
|
210
|
-
selection['residueTest'] = (l)
|
|
211
|
-
|
|
211
|
+
selection['residueTest'] = function (l) {
|
|
212
|
+
var authSeqId = structure_1.StructureProperties.residue.auth_seq_id(l.element);
|
|
212
213
|
return authSeqId >= param.start_auth_residue_number && authSeqId <= param.end_auth_residue_number;
|
|
213
214
|
};
|
|
214
215
|
}
|
|
215
216
|
else if ((param.start_auth_residue_number && param.end_auth_residue_number) && (param.end_auth_residue_number === param.start_auth_residue_number)) {
|
|
216
|
-
selection['residueTest'] = (l)
|
|
217
|
+
selection['residueTest'] = function (l) { return structure_1.StructureProperties.residue.auth_seq_id(l.element) === param.start_auth_residue_number; };
|
|
217
218
|
}
|
|
218
219
|
// atoms
|
|
219
220
|
if (param.atoms) {
|
|
220
|
-
selection['atomTest'] = (l)
|
|
221
|
+
selection['atomTest'] = function (l) { return param.atoms.includes(structure_1.StructureProperties.atom.label_atom_id(l.element)); };
|
|
221
222
|
}
|
|
222
223
|
if (param.atom_id) {
|
|
223
|
-
selection['atomTest'] = (l)
|
|
224
|
+
selection['atomTest'] = function (l) { return param.atom_id.includes(structure_1.StructureProperties.atom.id(l.element)); };
|
|
224
225
|
}
|
|
225
226
|
selections.push(selection);
|
|
226
227
|
});
|
|
227
|
-
|
|
228
|
-
selections.forEach((selection)
|
|
228
|
+
var atmGroupsQueries = [];
|
|
229
|
+
selections.forEach(function (selection) {
|
|
229
230
|
atmGroupsQueries.push(structure_2.Queries.generators.atoms(selection));
|
|
230
231
|
});
|
|
231
232
|
return structure_2.Queries.combinators.merge(atmGroupsQueries);
|
|
232
233
|
}
|
|
233
234
|
QueryHelper.getQueryObject = getQueryObject;
|
|
234
235
|
function getInteractivityLoci(params, contextData) {
|
|
235
|
-
|
|
236
|
+
var sel = query_1.StructureQuery.run(QueryHelper.getQueryObject(params, contextData), contextData);
|
|
236
237
|
return structure_1.StructureSelection.toLociWithSourceUnits(sel);
|
|
237
238
|
}
|
|
238
239
|
QueryHelper.getInteractivityLoci = getInteractivityLoci;
|
|
239
240
|
function getHetLoci(queryExp, contextData) {
|
|
240
|
-
|
|
241
|
-
|
|
241
|
+
var query = (0, compiler_1.compile)(queryExp);
|
|
242
|
+
var sel = query(new structure_1.QueryContext(contextData));
|
|
242
243
|
return structure_1.StructureSelection.toLociWithSourceUnits(sel);
|
|
243
244
|
}
|
|
244
245
|
QueryHelper.getHetLoci = getHetLoci;
|
|
245
246
|
})(QueryHelper || (exports.QueryHelper = QueryHelper = {}));
|
|
246
247
|
var ModelInfo;
|
|
247
248
|
(function (ModelInfo) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
249
|
+
function get(model, structures) {
|
|
250
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
251
|
+
var residueCount, residueOffsets, chainIndex, hetNames, carbEntityCount, rI, cI, eI, entityType, comp_id;
|
|
252
|
+
return tslib_1.__generator(this, function (_a) {
|
|
253
|
+
residueCount = model.atomicHierarchy.residues._rowCount;
|
|
254
|
+
residueOffsets = model.atomicHierarchy.residueAtomSegments.offsets;
|
|
255
|
+
chainIndex = model.atomicHierarchy.chainAtomSegments.index;
|
|
256
|
+
hetNames = [];
|
|
257
|
+
carbEntityCount = 0;
|
|
258
|
+
for (rI = 0; rI < residueCount; rI++) {
|
|
259
|
+
cI = chainIndex[residueOffsets[rI]];
|
|
260
|
+
eI = model.atomicHierarchy.index.getEntityFromChain(cI);
|
|
261
|
+
entityType = model.entities.data.type.value(eI);
|
|
262
|
+
if (entityType !== 'non-polymer' && entityType !== 'branched')
|
|
263
|
+
continue;
|
|
264
|
+
comp_id = model.atomicHierarchy.atoms.label_comp_id.value(residueOffsets[rI]);
|
|
265
|
+
if (entityType === 'branched') {
|
|
266
|
+
carbEntityCount++;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
if (hetNames.indexOf(comp_id) === -1)
|
|
270
|
+
hetNames.push(comp_id);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return [2 /*return*/, {
|
|
274
|
+
hetNames: hetNames,
|
|
275
|
+
carbEntityCount: carbEntityCount
|
|
276
|
+
}];
|
|
277
|
+
});
|
|
278
|
+
});
|
|
274
279
|
}
|
|
275
280
|
ModelInfo.get = get;
|
|
276
281
|
})(ModelInfo || (exports.ModelInfo = ModelInfo = {}));
|