drugflow-molstar 0.4.6 → 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.7.js +2 -0
- package/lib/drugflow-molstar-component-build-0.4.7.js.LICENSE.txt +24 -0
- 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 +2836 -1806
- 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.6.css +0 -1
- package/build/drugflow-molstar-component-0.4.6.js +0 -25
- package/build/drugflow-molstar-plugin-0.4.6.js +0 -2
- package/build/drugflow-molstar-plugin-0.4.6.js.LICENSE.txt +0 -64
|
@@ -1,35 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SuperpositionComponentControls = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var commands_1 = require("Molstar/mol-plugin/commands");
|
|
7
|
+
var mol_state_1 = require("Molstar/mol-state");
|
|
8
|
+
var param_definition_1 = require("Molstar/mol-util/param-definition");
|
|
9
|
+
var base_1 = require("Molstar/mol-plugin-ui/base");
|
|
10
|
+
var common_1 = require("Molstar/mol-plugin-ui/controls/common");
|
|
11
|
+
var icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
|
|
12
|
+
var parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
|
|
13
|
+
var operators_1 = require("rxjs/operators");
|
|
14
|
+
var rxjs_1 = require("rxjs");
|
|
15
|
+
var SuperpositionComponentControls = /** @class */ (function (_super) {
|
|
16
|
+
tslib_1.__extends(SuperpositionComponentControls, _super);
|
|
17
|
+
function SuperpositionComponentControls() {
|
|
18
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
19
|
+
}
|
|
20
|
+
SuperpositionComponentControls.prototype.defaultState = function () {
|
|
16
21
|
return {
|
|
17
22
|
header: 'Components',
|
|
18
23
|
isCollapsed: false,
|
|
19
24
|
isDisabled: false,
|
|
20
25
|
brand: { accent: 'blue', svg: icons_1.CubeOutlineSvg }
|
|
21
26
|
};
|
|
22
|
-
}
|
|
23
|
-
renderControls() {
|
|
27
|
+
};
|
|
28
|
+
SuperpositionComponentControls.prototype.renderControls = function () {
|
|
24
29
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(ComponentListControls, {}) });
|
|
25
|
-
}
|
|
26
|
-
|
|
30
|
+
};
|
|
31
|
+
return SuperpositionComponentControls;
|
|
32
|
+
}(base_1.CollapsableControls));
|
|
27
33
|
exports.SuperpositionComponentControls = SuperpositionComponentControls;
|
|
28
34
|
;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.
|
|
35
|
+
var ComponentListControls = /** @class */ (function (_super) {
|
|
36
|
+
tslib_1.__extends(ComponentListControls, _super);
|
|
37
|
+
function ComponentListControls() {
|
|
38
|
+
var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(arguments), false)) || this;
|
|
39
|
+
_this.state = {
|
|
33
40
|
segmentWatch: false,
|
|
34
41
|
ligSearchText: '',
|
|
35
42
|
carbSearchText: '',
|
|
@@ -40,108 +47,148 @@ class ComponentListControls extends base_1.PurePluginUIComponent {
|
|
|
40
47
|
isCarbCollapsed: false,
|
|
41
48
|
isBusy: false
|
|
42
49
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
_this.ligInputStream = new rxjs_1.Subject();
|
|
51
|
+
_this.handleLigInputStream = function (inputStr) {
|
|
52
|
+
_this.setState({ ligSearchText: inputStr });
|
|
53
|
+
var filteredRes = _this.state.componentGroups.ligGroups.filter(function (g) {
|
|
54
|
+
var gKeys = g[0].key.split(',');
|
|
55
|
+
var cId1Arr = gKeys[0].split('-');
|
|
49
56
|
return cId1Arr[2].toLowerCase().indexOf(inputStr.toLowerCase()) >= 0;
|
|
50
57
|
});
|
|
51
|
-
|
|
58
|
+
_this.setState({ ligGroups: filteredRes });
|
|
52
59
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
_this.carbInputStream = new rxjs_1.Subject();
|
|
61
|
+
_this.handleCarbInputStream = function (inputStr) {
|
|
62
|
+
_this.setState({ carbSearchText: inputStr });
|
|
63
|
+
var filteredRes = _this.state.componentGroups.carbGroups.filter(function (g) {
|
|
64
|
+
var gKeys = g[0].key.split(',');
|
|
65
|
+
var cId1Arr = gKeys[0].split('-');
|
|
59
66
|
cId1Arr.splice(0, 2);
|
|
60
67
|
cId1Arr.pop();
|
|
61
68
|
return cId1Arr.join('-').toLowerCase().indexOf(inputStr.toLowerCase()) >= 0;
|
|
62
69
|
});
|
|
63
|
-
|
|
70
|
+
_this.setState({ carbGroups: filteredRes });
|
|
64
71
|
};
|
|
65
|
-
|
|
72
|
+
_this.toggleVisible = function (e, action, type) {
|
|
66
73
|
e.preventDefault();
|
|
67
74
|
e.currentTarget.blur();
|
|
68
|
-
|
|
75
|
+
var customState = _this.plugin.customState;
|
|
69
76
|
customState.events.isBusy.next(true);
|
|
70
|
-
|
|
71
|
-
setTimeout(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
var visualEntites = (type === 'ligands') ? _this.state.ligGroups : _this.state.carbGroups;
|
|
78
|
+
setTimeout(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
79
|
+
var _a, visualEntites_1, visualEntites_1_1, visualEntity, e_1_1;
|
|
80
|
+
var _b, e_1, _c, _d;
|
|
81
|
+
return tslib_1.__generator(this, function (_e) {
|
|
82
|
+
switch (_e.label) {
|
|
83
|
+
case 0:
|
|
84
|
+
_e.trys.push([0, 5, 6, 11]);
|
|
85
|
+
_a = true, visualEntites_1 = tslib_1.__asyncValues(visualEntites);
|
|
86
|
+
_e.label = 1;
|
|
87
|
+
case 1: return [4 /*yield*/, visualEntites_1.next()];
|
|
88
|
+
case 2:
|
|
89
|
+
if (!(visualEntites_1_1 = _e.sent(), _b = visualEntites_1_1.done, !_b)) return [3 /*break*/, 4];
|
|
90
|
+
_d = visualEntites_1_1.value;
|
|
91
|
+
_a = false;
|
|
92
|
+
visualEntity = _d;
|
|
93
|
+
this.plugin.managers.structure.hierarchy.toggleVisibility(visualEntity, action);
|
|
94
|
+
_e.label = 3;
|
|
95
|
+
case 3:
|
|
96
|
+
_a = true;
|
|
97
|
+
return [3 /*break*/, 1];
|
|
98
|
+
case 4: return [3 /*break*/, 11];
|
|
99
|
+
case 5:
|
|
100
|
+
e_1_1 = _e.sent();
|
|
101
|
+
e_1 = { error: e_1_1 };
|
|
102
|
+
return [3 /*break*/, 11];
|
|
103
|
+
case 6:
|
|
104
|
+
_e.trys.push([6, , 9, 10]);
|
|
105
|
+
if (!(!_a && !_b && (_c = visualEntites_1.return))) return [3 /*break*/, 8];
|
|
106
|
+
return [4 /*yield*/, _c.call(visualEntites_1)];
|
|
107
|
+
case 7:
|
|
108
|
+
_e.sent();
|
|
109
|
+
_e.label = 8;
|
|
110
|
+
case 8: return [3 /*break*/, 10];
|
|
111
|
+
case 9:
|
|
112
|
+
if (e_1) throw e_1.error;
|
|
113
|
+
return [7 /*endfinally*/];
|
|
114
|
+
case 10: return [7 /*endfinally*/];
|
|
115
|
+
case 11:
|
|
116
|
+
;
|
|
117
|
+
customState.events.isBusy.next(false);
|
|
118
|
+
return [2 /*return*/];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}); });
|
|
78
122
|
};
|
|
79
|
-
|
|
80
|
-
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CheckSvg, flex: true, onClick: (e)
|
|
123
|
+
_this.showHideAllControls = function (type) {
|
|
124
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CheckSvg, flex: true, onClick: function (e) { return _this.toggleVisible(e, 'show', type); }, style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, title: "Show all ".concat(type), disabled: false, children: "All" }), (0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CloseSvg, flex: true, onClick: function (e) { return _this.toggleVisible(e, 'hide', type); }, style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, title: "Hide all ".concat(type), disabled: false, children: "None" })] });
|
|
81
125
|
};
|
|
82
|
-
|
|
126
|
+
_this.clearLigSearch = function (e) {
|
|
83
127
|
e.preventDefault();
|
|
84
|
-
|
|
85
|
-
|
|
128
|
+
_this.setState({ ligSearchText: '' });
|
|
129
|
+
_this.ligInputStream.next('');
|
|
86
130
|
e.currentTarget.blur();
|
|
87
131
|
};
|
|
88
|
-
|
|
132
|
+
_this.clearCarbSearch = function (e) {
|
|
89
133
|
e.preventDefault();
|
|
90
|
-
|
|
91
|
-
|
|
134
|
+
_this.setState({ carbSearchText: '' });
|
|
135
|
+
_this.carbInputStream.next('');
|
|
92
136
|
e.currentTarget.blur();
|
|
93
137
|
};
|
|
94
|
-
|
|
138
|
+
_this.collapseSection = function (e, type) {
|
|
95
139
|
e.preventDefault();
|
|
96
140
|
e.currentTarget.blur();
|
|
97
141
|
if (type === 'ligands') {
|
|
98
|
-
|
|
142
|
+
_this.setState({ isLigCollapsed: !_this.state.isLigCollapsed });
|
|
99
143
|
}
|
|
100
144
|
else {
|
|
101
|
-
|
|
145
|
+
_this.setState({ isCarbCollapsed: !_this.state.isCarbCollapsed });
|
|
102
146
|
}
|
|
103
147
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', style: { marginTop: '6px' }, children: [(0, jsx_runtime_1.jsxs)("button", { className: 'msp-form-control msp-control-button-label msp-transform-header-brand-gray', style: { textAlign: 'left' }, onClick: (e)
|
|
148
|
+
_this.sectionHeader = function (type) {
|
|
149
|
+
var showHideAllControls = (type === 'ligands') ? _this.showHideAllControls('ligands') : _this.showHideAllControls('carbohydrates');
|
|
150
|
+
var title = (type === 'ligands') ? 'Ligand' : 'Carbohydrates';
|
|
151
|
+
var visibleVisuals = (type === 'ligands') ? _this.state.ligGroups.length : _this.state.carbGroups.length;
|
|
152
|
+
var totalVisuals = (type === 'ligands') ? _this.state.componentGroups.ligGroups.length : _this.state.componentGroups.carbGroups.length;
|
|
153
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', style: { marginTop: '6px' }, children: [(0, jsx_runtime_1.jsxs)("button", { className: 'msp-form-control msp-control-button-label msp-transform-header-brand-gray', style: { textAlign: 'left' }, onClick: function (e) { return _this.collapseSection(e, type); }, children: [(0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsx)("strong", { children: title }) }), (0, jsx_runtime_1.jsxs)("small", { style: { color: '#7d91b0' }, children: [" ( ", visibleVisuals, visibleVisuals < totalVisuals ? " / ".concat(totalVisuals) : '', " )"] })] }), visibleVisuals > 1 && showHideAllControls] });
|
|
110
154
|
};
|
|
155
|
+
return _this;
|
|
111
156
|
}
|
|
112
|
-
componentDidMount() {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
157
|
+
ComponentListControls.prototype.componentDidMount = function () {
|
|
158
|
+
var _this = this;
|
|
159
|
+
this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, function () {
|
|
160
|
+
_this.categoriseGroups();
|
|
161
|
+
_this.forceUpdate();
|
|
116
162
|
});
|
|
117
|
-
this.subscribe(this.plugin.behaviors.state.isBusy, v
|
|
118
|
-
|
|
163
|
+
this.subscribe(this.plugin.behaviors.state.isBusy, function (v) {
|
|
164
|
+
_this.setState({ isBusy: v });
|
|
119
165
|
});
|
|
120
|
-
}
|
|
121
|
-
componentDidUpdate() {
|
|
122
|
-
|
|
166
|
+
};
|
|
167
|
+
ComponentListControls.prototype.componentDidUpdate = function () {
|
|
168
|
+
var _this = this;
|
|
169
|
+
var customState = this.plugin.customState;
|
|
123
170
|
if (customState.events && !this.state.segmentWatch) {
|
|
124
171
|
this.setState({ segmentWatch: true });
|
|
125
|
-
this.subscribe(customState.events.segmentUpdate, ()
|
|
126
|
-
|
|
127
|
-
|
|
172
|
+
this.subscribe(customState.events.segmentUpdate, function () {
|
|
173
|
+
_this.categoriseGroups();
|
|
174
|
+
_this.forceUpdate();
|
|
128
175
|
});
|
|
129
176
|
}
|
|
130
|
-
this.subscribe(this.ligInputStream.pipe((0, operators_1.debounceTime)(1000 / 24)), (e)
|
|
131
|
-
this.subscribe(this.carbInputStream.pipe((0, operators_1.debounceTime)(1000 / 24)), (e)
|
|
132
|
-
}
|
|
133
|
-
categoriseGroups() {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
componentGroups.forEach((g)
|
|
138
|
-
|
|
177
|
+
this.subscribe(this.ligInputStream.pipe((0, operators_1.debounceTime)(1000 / 24)), function (e) { return _this.handleLigInputStream(e); });
|
|
178
|
+
this.subscribe(this.carbInputStream.pipe((0, operators_1.debounceTime)(1000 / 24)), function (e) { return _this.handleCarbInputStream(e); });
|
|
179
|
+
};
|
|
180
|
+
ComponentListControls.prototype.categoriseGroups = function () {
|
|
181
|
+
var componentGroupsVal = { nonLigGroups: [], ligGroups: [], carbGroups: [], alphafold: [] };
|
|
182
|
+
var componentGroups = this.plugin.managers.structure.hierarchy.currentComponentGroups;
|
|
183
|
+
var customState = this.plugin.customState;
|
|
184
|
+
componentGroups.forEach(function (g) {
|
|
185
|
+
var isLigandView = false;
|
|
139
186
|
if (customState.initParams && customState.initParams.superpositionParams && customState.initParams.superpositionParams.ligandView) {
|
|
140
187
|
isLigandView = true;
|
|
141
188
|
}
|
|
142
189
|
if (isLigandView) {
|
|
143
|
-
|
|
144
|
-
|
|
190
|
+
var gKeys = g[0].key.split(',');
|
|
191
|
+
var cId1Arr = gKeys[0].split('-');
|
|
145
192
|
if (gKeys.indexOf('superposition-focus-surr-sel') === -1) {
|
|
146
193
|
if (cId1Arr[cId1Arr.length - 1] !== (customState.superpositionState.activeSegment - 1) + '')
|
|
147
194
|
return;
|
|
@@ -163,8 +210,8 @@ class ComponentListControls extends base_1.PurePluginUIComponent {
|
|
|
163
210
|
}
|
|
164
211
|
}
|
|
165
212
|
else {
|
|
166
|
-
|
|
167
|
-
if (gKeys.indexOf('superposition-focus-surr-sel') >= 0 || gKeys.indexOf(
|
|
213
|
+
var gKeys = g[0].key.split(',');
|
|
214
|
+
if (gKeys.indexOf('superposition-focus-surr-sel') >= 0 || gKeys.indexOf("Chain-".concat(customState.superpositionState.activeSegment - 1)) >= 0) {
|
|
168
215
|
componentGroupsVal.nonLigGroups.push(g);
|
|
169
216
|
}
|
|
170
217
|
else if (gKeys.indexOf('alphafold-chain') >= 0) {
|
|
@@ -173,193 +220,250 @@ class ComponentListControls extends base_1.PurePluginUIComponent {
|
|
|
173
220
|
}
|
|
174
221
|
});
|
|
175
222
|
this.setState({ componentGroups: componentGroupsVal, ligGroups: componentGroupsVal.ligGroups, carbGroups: componentGroupsVal.carbGroups, ligSearchText: '', carbSearchText: '' });
|
|
176
|
-
}
|
|
177
|
-
render() {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
223
|
+
};
|
|
224
|
+
ComponentListControls.prototype.render = function () {
|
|
225
|
+
var _this = this;
|
|
226
|
+
var ligSearchControls = (0, jsx_runtime_1.jsxs)("div", { className: 'msp-mapped-parameter-group', style: { fontSize: '90%' }, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'msp-control-row msp-transform-header-brand-gray', style: { height: '33px' }, children: [(0, jsx_runtime_1.jsx)("span", { className: 'msp-control-row-label', children: "Search Ligand" }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-row-ctrl', children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter HET code', disabled: this.state.isBusy, onChange: function (e) { return _this.ligInputStream.next(e.target.value); }, value: this.state.ligSearchText, maxLength: 3 }) })] }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearLigSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.ligSearchText === '' || this.state.isBusy, toggleState: this.state.ligSearchText !== '', title: 'Clear search input' })] });
|
|
227
|
+
var carbSearchControls = (0, jsx_runtime_1.jsxs)("div", { className: 'msp-mapped-parameter-group', style: { fontSize: '90%' }, children: [(0, jsx_runtime_1.jsxs)("div", { className: 'msp-control-row msp-transform-header-brand-gray', style: { height: '33px' }, children: [(0, jsx_runtime_1.jsx)("span", { className: 'msp-control-row-label', children: "Search Carbohydrate" }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-row-ctrl', children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter HET code', disabled: this.state.isBusy, onChange: function (e) { return _this.carbInputStream.next(e.target.value); }, value: this.state.carbSearchText, maxLength: 3 }) })] }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearCarbSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.carbSearchText === '' || this.state.isBusy, toggleState: this.state.carbSearchText !== '', title: 'Clear search input' })] });
|
|
228
|
+
var ligSectionHeader = this.sectionHeader('ligands');
|
|
229
|
+
var carbSectionHeader = this.sectionHeader('carbohydrates');
|
|
230
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(this.state.componentGroups.nonLigGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", { children: this.state.componentGroups.nonLigGroups.map(function (g) { return (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: true }, g[0].cell.transform.ref); }) }), (this.state.componentGroups.alphafold.length > 0) && (0, jsx_runtime_1.jsx)("div", { children: this.state.componentGroups.alphafold.map(function (g) { return (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: true, type: 'alphafold' }, g[0].cell.transform.ref); }) }), (this.state.componentGroups.ligGroups.length > 0) && ligSectionHeader, (!this.state.isLigCollapsed && this.state.componentGroups.ligGroups.length > 5) && ligSearchControls, (this.state.componentGroups.ligGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-offset', style: { maxHeight: '800px', overflowY: 'auto' }, children: !this.state.isLigCollapsed && this.state.ligGroups.map(function (g) { return (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: false }, g[0].cell.transform.ref); }) }), (this.state.componentGroups.carbGroups.length > 0) && carbSectionHeader, (!this.state.isCarbCollapsed && this.state.componentGroups.carbGroups.length > 5) && carbSearchControls, (this.state.componentGroups.carbGroups.length > 0) && (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-offset', style: { maxHeight: '800px', overflowY: 'auto' }, children: !this.state.isCarbCollapsed && this.state.carbGroups.map(function (g) { return (0, jsx_runtime_1.jsx)(StructureComponentGroup, { group: g, boldHeader: false }, g[0].cell.transform.ref); }) })] });
|
|
231
|
+
};
|
|
232
|
+
return ComponentListControls;
|
|
233
|
+
}(base_1.PurePluginUIComponent));
|
|
234
|
+
var StructureComponentGroup = /** @class */ (function (_super) {
|
|
235
|
+
tslib_1.__extends(StructureComponentGroup, _super);
|
|
236
|
+
function StructureComponentGroup() {
|
|
237
|
+
var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(arguments), false)) || this;
|
|
238
|
+
_this.state = {
|
|
189
239
|
action: void 0,
|
|
190
240
|
isHidden: false,
|
|
191
241
|
isBusy: false
|
|
192
242
|
};
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
243
|
+
_this.checkAllHidden = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
244
|
+
var allHidden, _a, _b, c;
|
|
245
|
+
var e_2, _c;
|
|
246
|
+
return tslib_1.__generator(this, function (_d) {
|
|
247
|
+
allHidden = true;
|
|
248
|
+
try {
|
|
249
|
+
for (_a = tslib_1.__values(this.props.group), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
250
|
+
c = _b.value;
|
|
251
|
+
if (!c.cell.state.isHidden) {
|
|
252
|
+
allHidden = false;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
199
256
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
257
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
258
|
+
finally {
|
|
259
|
+
try {
|
|
260
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
261
|
+
}
|
|
262
|
+
finally { if (e_2) throw e_2.error; }
|
|
263
|
+
}
|
|
264
|
+
if (allHidden)
|
|
265
|
+
this.setState({ isHidden: true });
|
|
266
|
+
return [2 /*return*/];
|
|
267
|
+
});
|
|
268
|
+
}); };
|
|
269
|
+
_this.toggleVisible = function (e) {
|
|
205
270
|
e.preventDefault();
|
|
206
271
|
e.currentTarget.blur();
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
-
spState.alphafold.visibility[spState.activeSegment - 1] =
|
|
272
|
+
_this.plugin.managers.structure.component.toggleVisibility(_this.props.group);
|
|
273
|
+
_this.setState({ isHidden: !_this.state.isHidden });
|
|
274
|
+
if (_this.props.type === 'alphafold') {
|
|
275
|
+
var spState = _this.plugin.customState.superpositionState;
|
|
276
|
+
spState.alphafold.visibility[spState.activeSegment - 1] = _this.state.isHidden;
|
|
212
277
|
}
|
|
213
278
|
};
|
|
214
|
-
|
|
215
|
-
|
|
279
|
+
_this.toggleAction = function () { return _this.setState({ action: _this.state.action === 'action' ? void 0 : 'action' }); };
|
|
280
|
+
_this.highlight = function (e) {
|
|
216
281
|
e.preventDefault();
|
|
217
|
-
if (!
|
|
282
|
+
if (!_this.props.group[0].cell.parent)
|
|
218
283
|
return;
|
|
219
|
-
commands_1.PluginCommands.Interactivity.Object.Highlight(
|
|
284
|
+
commands_1.PluginCommands.Interactivity.Object.Highlight(_this.plugin, { state: _this.props.group[0].cell.parent, ref: _this.props.group.map(function (c) { return c.cell.transform.ref; }) });
|
|
220
285
|
};
|
|
221
|
-
|
|
286
|
+
_this.clearHighlight = function (e) {
|
|
222
287
|
e.preventDefault();
|
|
223
|
-
commands_1.PluginCommands.Interactivity.ClearHighlights(
|
|
288
|
+
commands_1.PluginCommands.Interactivity.ClearHighlights(_this.plugin);
|
|
224
289
|
};
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
290
|
+
_this.focus = function () {
|
|
291
|
+
var e_3, _a;
|
|
292
|
+
var allHidden = true;
|
|
293
|
+
try {
|
|
294
|
+
for (var _b = tslib_1.__values(_this.props.group), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
295
|
+
var c = _c.value;
|
|
296
|
+
if (!c.cell.state.isHidden) {
|
|
297
|
+
allHidden = false;
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
303
|
+
finally {
|
|
304
|
+
try {
|
|
305
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
231
306
|
}
|
|
307
|
+
finally { if (e_3) throw e_3.error; }
|
|
232
308
|
}
|
|
233
309
|
if (allHidden) {
|
|
234
|
-
|
|
310
|
+
_this.plugin.managers.structure.hierarchy.toggleVisibility(_this.props.group, 'show');
|
|
235
311
|
}
|
|
236
|
-
|
|
312
|
+
_this.plugin.managers.camera.focusSpheres(_this.props.group, function (e) {
|
|
313
|
+
var _a;
|
|
237
314
|
if (e.cell.state.isHidden)
|
|
238
315
|
return;
|
|
239
|
-
return e.cell.obj
|
|
316
|
+
return (_a = e.cell.obj) === null || _a === void 0 ? void 0 : _a.data.boundary.sphere;
|
|
240
317
|
});
|
|
241
318
|
};
|
|
319
|
+
return _this;
|
|
242
320
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
321
|
+
Object.defineProperty(StructureComponentGroup.prototype, "pivot", {
|
|
322
|
+
get: function () {
|
|
323
|
+
return this.props.group[0];
|
|
324
|
+
},
|
|
325
|
+
enumerable: false,
|
|
326
|
+
configurable: true
|
|
327
|
+
});
|
|
328
|
+
StructureComponentGroup.prototype.componentDidMount = function () {
|
|
329
|
+
var _this = this;
|
|
247
330
|
this.checkAllHidden();
|
|
248
|
-
this.subscribe(this.plugin.state.events.cell.stateUpdated, e
|
|
331
|
+
this.subscribe(this.plugin.state.events.cell.stateUpdated, function (e) {
|
|
332
|
+
var _a, _b;
|
|
249
333
|
// if (State.ObjectEvent.isCell(e, this.pivot.cell)) this.forceUpdate();
|
|
250
|
-
if (
|
|
334
|
+
if (((_a = _this.pivot.cell.obj) === null || _a === void 0 ? void 0 : _a.label) === ((_b = e.cell.obj) === null || _b === void 0 ? void 0 : _b.label)) {
|
|
251
335
|
if (!e.cell.state.isHidden) {
|
|
252
|
-
|
|
336
|
+
_this.setState({ isHidden: false });
|
|
253
337
|
}
|
|
254
338
|
else {
|
|
255
|
-
|
|
339
|
+
_this.checkAllHidden();
|
|
256
340
|
}
|
|
257
341
|
}
|
|
258
342
|
});
|
|
259
|
-
this.subscribe(this.plugin.behaviors.state.isBusy, v
|
|
260
|
-
|
|
343
|
+
this.subscribe(this.plugin.behaviors.state.isBusy, function (v) {
|
|
344
|
+
_this.setState({ isBusy: v });
|
|
261
345
|
});
|
|
262
|
-
this.subscribe(this.plugin.customState.events.isBusy, (e)
|
|
263
|
-
|
|
346
|
+
this.subscribe(this.plugin.customState.events.isBusy, function (e) {
|
|
347
|
+
_this.setState({ isBusy: e });
|
|
264
348
|
});
|
|
265
|
-
}
|
|
266
|
-
render() {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
349
|
+
};
|
|
350
|
+
StructureComponentGroup.prototype.render = function () {
|
|
351
|
+
var _this = this;
|
|
352
|
+
var _a;
|
|
353
|
+
var component = this.pivot;
|
|
354
|
+
var cell = component.cell;
|
|
355
|
+
var label = (_a = cell.obj) === null || _a === void 0 ? void 0 : _a.label;
|
|
356
|
+
var labelEle = this.props.boldHeader ? (0, jsx_runtime_1.jsx)("strong", { children: label }) : label;
|
|
357
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: 'msp-flex-row', children: [(0, jsx_runtime_1.jsx)(common_1.Button, { noOverflow: true, className: 'msp-control-button-label', title: "".concat(label, " - Click to focus."), onClick: this.focus, style: { textAlign: 'left' }, disabled: this.state.isBusy, children: labelEle }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { disabled: this.state.isBusy, svg: this.state.isHidden ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, toggleState: false, onClick: this.toggleVisible, title: "".concat(this.state.isHidden ? 'Show' : 'Hide', " component"), small: true, className: 'msp-form-control', flex: true }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { disabled: this.state.isBusy, svg: icons_1.MoreHorizSvg, onClick: this.toggleAction, title: 'Actions', toggleState: this.state.action === 'action', className: 'msp-form-control', flex: true })] }), this.state.action === 'action' && (0, jsx_runtime_1.jsx)("div", { className: 'msp-accent-offset', children: (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: '6px' }, children: component.representations.map(function (r) { return (0, jsx_runtime_1.jsx)(StructureRepresentationEntry, { group: _this.props.group, representation: r }, r.cell.transform.ref); }) }) })] });
|
|
358
|
+
};
|
|
359
|
+
return StructureComponentGroup;
|
|
360
|
+
}(base_1.PurePluginUIComponent));
|
|
361
|
+
var StructureRepresentationEntry = /** @class */ (function (_super) {
|
|
362
|
+
tslib_1.__extends(StructureRepresentationEntry, _super);
|
|
363
|
+
function StructureRepresentationEntry() {
|
|
364
|
+
var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(arguments), false)) || this;
|
|
365
|
+
_this.state = {
|
|
278
366
|
isBusy: false,
|
|
279
367
|
clusterVal: { cluster: 'All' }
|
|
280
368
|
};
|
|
281
|
-
|
|
282
|
-
|
|
369
|
+
_this.remove = function () { return _this.plugin.managers.structure.component.removeRepresentations(_this.props.group, _this.props.representation); };
|
|
370
|
+
_this.toggleVisible = function (e) {
|
|
283
371
|
e.preventDefault();
|
|
284
372
|
e.currentTarget.blur();
|
|
285
|
-
|
|
373
|
+
_this.plugin.managers.structure.component.toggleVisibility(_this.props.group, _this.props.representation);
|
|
286
374
|
};
|
|
287
|
-
|
|
288
|
-
return
|
|
375
|
+
_this.update = function (params) {
|
|
376
|
+
return _this.updateRepresentations(_this.props.group, _this.props.representation, params);
|
|
289
377
|
};
|
|
290
|
-
|
|
291
|
-
|
|
378
|
+
_this.selectCluster = function (params) {
|
|
379
|
+
_this.setState({ clusterVal: { cluster: params.cluster } });
|
|
292
380
|
};
|
|
381
|
+
return _this;
|
|
293
382
|
}
|
|
294
|
-
componentDidMount() {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
383
|
+
StructureRepresentationEntry.prototype.componentDidMount = function () {
|
|
384
|
+
var _this = this;
|
|
385
|
+
this.subscribe(this.plugin.state.events.cell.stateUpdated, function (e) {
|
|
386
|
+
if (mol_state_1.State.ObjectEvent.isCell(e, _this.props.representation.cell))
|
|
387
|
+
_this.forceUpdate();
|
|
298
388
|
});
|
|
299
|
-
this.subscribe(this.plugin.behaviors.state.isBusy, v
|
|
300
|
-
|
|
389
|
+
this.subscribe(this.plugin.behaviors.state.isBusy, function (v) {
|
|
390
|
+
_this.setState({ isBusy: v });
|
|
301
391
|
});
|
|
302
|
-
this.subscribe(this.plugin.customState.events.isBusy, (e)
|
|
303
|
-
|
|
392
|
+
this.subscribe(this.plugin.customState.events.isBusy, function (e) {
|
|
393
|
+
_this.setState({ isBusy: e });
|
|
304
394
|
});
|
|
305
|
-
}
|
|
306
|
-
updateRepresentations(components, pivot, params) {
|
|
395
|
+
};
|
|
396
|
+
StructureRepresentationEntry.prototype.updateRepresentations = function (components, pivot, params) {
|
|
397
|
+
var e_4, _a;
|
|
398
|
+
var _b, _c, _d;
|
|
307
399
|
if (components.length === 0)
|
|
308
400
|
return Promise.resolve();
|
|
309
|
-
|
|
401
|
+
var index = components[0].representations.indexOf(pivot);
|
|
310
402
|
if (index < 0)
|
|
311
403
|
return Promise.resolve();
|
|
312
|
-
|
|
313
|
-
|
|
404
|
+
var superpositionState = this.plugin.customState.superpositionState;
|
|
405
|
+
var filteredComps = [];
|
|
314
406
|
if (this.state.clusterVal.cluster !== 'All') {
|
|
315
|
-
|
|
316
|
-
filteredComps = clusterData.map((s)
|
|
317
|
-
return
|
|
407
|
+
var clusterData = superpositionState.segmentData[superpositionState.activeSegment - 1].clusters[parseInt(this.state.clusterVal.cluster) - 1];
|
|
408
|
+
filteredComps = clusterData.map(function (s) {
|
|
409
|
+
return "".concat(s.pdb_id, "_").concat(s.struct_asym_id);
|
|
318
410
|
});
|
|
319
411
|
if (filteredComps.length === 0)
|
|
320
412
|
return;
|
|
321
413
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
const rmIndex = filteredComps.indexOf(superpositionState.refMaps[repr.cell.transform.parent]);
|
|
332
|
-
if (rmIndex === -1)
|
|
414
|
+
var update = this.plugin.state.data.build();
|
|
415
|
+
try {
|
|
416
|
+
for (var components_1 = tslib_1.__values(components), components_1_1 = components_1.next(); !components_1_1.done; components_1_1 = components_1.next()) {
|
|
417
|
+
var c = components_1_1.value;
|
|
418
|
+
// TODO: is it ok to use just the index here? Could possible lead to ugly edge cases, but perhaps not worth the trouble to "fix".
|
|
419
|
+
var repr = c.representations[index];
|
|
420
|
+
if (!repr)
|
|
421
|
+
continue;
|
|
422
|
+
if (repr.cell.transform.transformer !== pivot.cell.transform.transformer)
|
|
333
423
|
continue;
|
|
424
|
+
if (this.state.clusterVal.cluster !== 'All') {
|
|
425
|
+
var rmIndex = filteredComps.indexOf(superpositionState.refMaps[repr.cell.transform.parent]);
|
|
426
|
+
if (rmIndex === -1)
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
var updatedParams = {
|
|
430
|
+
type: params.type ? params.type : (_b = repr.cell.params) === null || _b === void 0 ? void 0 : _b.values.type,
|
|
431
|
+
colorTheme: params.colorTheme ? params.colorTheme : (_c = repr.cell.params) === null || _c === void 0 ? void 0 : _c.values.colorTheme,
|
|
432
|
+
sizeTheme: params.sizeTheme ? params.sizeTheme : (_d = repr.cell.params) === null || _d === void 0 ? void 0 : _d.values.sizeTheme
|
|
433
|
+
};
|
|
434
|
+
update.to(repr.cell).update(updatedParams);
|
|
334
435
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
436
|
+
}
|
|
437
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
438
|
+
finally {
|
|
439
|
+
try {
|
|
440
|
+
if (components_1_1 && !components_1_1.done && (_a = components_1.return)) _a.call(components_1);
|
|
441
|
+
}
|
|
442
|
+
finally { if (e_4) throw e_4.error; }
|
|
341
443
|
}
|
|
342
444
|
return update.commit({ canUndo: 'Update Representation' });
|
|
343
|
-
}
|
|
344
|
-
render() {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
445
|
+
};
|
|
446
|
+
StructureRepresentationEntry.prototype.render = function () {
|
|
447
|
+
var _a, _b, _c, _d, _e, _f;
|
|
448
|
+
var repr = this.props.representation.cell;
|
|
449
|
+
var superpositionState = this.plugin.customState.superpositionState;
|
|
450
|
+
var clusterSelectArr = [['All', 'All']];
|
|
451
|
+
superpositionState.segmentData[superpositionState.activeSegment - 1].clusters.forEach(function (c, i) {
|
|
349
452
|
clusterSelectArr.push([(i + 1) + '', (i + 1) + '']);
|
|
350
453
|
});
|
|
351
|
-
|
|
454
|
+
var clusterOptions = {
|
|
352
455
|
cluster: param_definition_1.ParamDefinition.Select('All', clusterSelectArr, { label: 'Select Cluster' })
|
|
353
456
|
};
|
|
354
|
-
|
|
355
|
-
|
|
457
|
+
var isSurrVisual = false;
|
|
458
|
+
var isAlphafold = false;
|
|
356
459
|
if (repr && repr.obj) {
|
|
357
|
-
|
|
460
|
+
var reprObj = repr.obj;
|
|
358
461
|
if (reprObj.tags && reprObj.tags.indexOf('superposition-focus-surr-repr') >= 0)
|
|
359
462
|
isSurrVisual = true;
|
|
360
463
|
if (reprObj.tags && reprObj.tags.indexOf('af-superposition-visual') >= 0)
|
|
361
464
|
isAlphafold = true;
|
|
362
465
|
}
|
|
363
|
-
return (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: repr.parent && (0, jsx_runtime_1.jsxs)("div", { children: [(clusterSelectArr.length > 2 && !isSurrVisual && !isAlphafold) && (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: clusterOptions, values: this.state.clusterVal, onChangeValues: this.selectCluster, isDisabled: this.state.isBusy }) }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { type: repr.params
|
|
364
|
-
}
|
|
365
|
-
|
|
466
|
+
return (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: repr.parent && (0, jsx_runtime_1.jsxs)("div", { children: [(clusterSelectArr.length > 2 && !isSurrVisual && !isAlphafold) && (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: clusterOptions, values: this.state.clusterVal, onChangeValues: this.selectCluster, isDisabled: this.state.isBusy }) }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { type: (_a = repr.params) === null || _a === void 0 ? void 0 : _a.definition.type }, values: { type: (_b = repr.params) === null || _b === void 0 ? void 0 : _b.values.type }, onChangeValues: this.update, isDisabled: this.state.isBusy }) }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { colorTheme: (_c = repr.params) === null || _c === void 0 ? void 0 : _c.definition.colorTheme }, values: { colorTheme: (_d = repr.params) === null || _d === void 0 ? void 0 : _d.values.colorTheme }, onChangeValues: this.update, isDisabled: this.state.isBusy }) }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-representation-entry', children: (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: { sizeTheme: (_e = repr.params) === null || _e === void 0 ? void 0 : _e.definition.sizeTheme }, values: { sizeTheme: (_f = repr.params) === null || _f === void 0 ? void 0 : _f.values.sizeTheme }, onChangeValues: this.update, isDisabled: this.state.isBusy }) })] }) });
|
|
467
|
+
};
|
|
468
|
+
return StructureRepresentationEntry;
|
|
469
|
+
}(base_1.PurePluginUIComponent));
|