drugflow-molstar 0.4.7 → 0.4.9
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.9.css +1 -0
- package/build/drugflow-molstar-component-0.4.9.js +25 -0
- package/build/drugflow-molstar-plugin-0.4.9.js +2 -0
- package/build/drugflow-molstar-plugin-0.4.9.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/drugflow-molstar-component-build-0.4.9.js +2 -0
- package/lib/drugflow-molstar-component-build-0.4.9.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/ui/segment-tree.js
CHANGED
|
@@ -1,231 +1,324 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SegmentTree = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
var operators_1 = require("rxjs/operators");
|
|
7
|
+
var commands_1 = require("Molstar/mol-plugin/commands");
|
|
8
|
+
var mol_state_1 = require("Molstar/mol-state");
|
|
9
|
+
var base_1 = require("Molstar/mol-plugin-ui/base");
|
|
10
|
+
var common_1 = require("Molstar/mol-plugin-ui/controls/common");
|
|
11
|
+
var param_definition_1 = require("Molstar/mol-util/param-definition");
|
|
12
|
+
var parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
|
|
13
|
+
var mol_state_2 = require("Molstar/mol-state");
|
|
14
|
+
var superposition_1 = require("../superposition");
|
|
15
|
+
var update_transform_1 = require("Molstar/mol-plugin-ui/state/update-transform");
|
|
16
|
+
var icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
|
|
17
|
+
var lists_1 = require("Molstar/mol-util/color/lists");
|
|
18
|
+
var color_1 = require("Molstar/mol-util/color");
|
|
19
|
+
var builder_1 = require("Molstar/mol-script/language/builder");
|
|
20
|
+
var rxjs_1 = require("rxjs");
|
|
21
|
+
var transforms_1 = require("Molstar/mol-plugin-state/transforms");
|
|
22
|
+
var superposition_2 = require("../superposition");
|
|
23
|
+
var SuperpositionTag = 'SuperpositionTransform';
|
|
24
|
+
var SegmentTree = /** @class */ (function (_super) {
|
|
25
|
+
tslib_1.__extends(SegmentTree, _super);
|
|
26
|
+
function SegmentTree() {
|
|
27
|
+
var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(arguments), false)) || this;
|
|
28
|
+
_this.getSegmentParams = function () {
|
|
29
|
+
var customState = _this.customState;
|
|
28
30
|
if (!customState.superpositionState || !customState.superpositionState.segmentData)
|
|
29
31
|
return;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
var segmentData = customState.superpositionState.segmentData;
|
|
33
|
+
var segmentArr = segmentData.map(function (segment, i) {
|
|
34
|
+
var segmentLabel = "".concat(i + 1, " ( ").concat(segment.segment_start, " - ").concat(segment.segment_end, " )");
|
|
33
35
|
return [segmentLabel, segmentLabel];
|
|
34
36
|
});
|
|
35
|
-
|
|
37
|
+
var segmentOptions = {
|
|
36
38
|
segment: param_definition_1.ParamDefinition.Select('', segmentArr, { label: 'Select Segment', description: 'Select segment to view its clusters below' })
|
|
37
39
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
var segmentIndex = customState.superpositionState.activeSegment - 1;
|
|
41
|
+
_this.setState({ segment: {
|
|
40
42
|
params: segmentOptions,
|
|
41
43
|
value: { segment: segmentArr[segmentIndex][0] }
|
|
42
44
|
} });
|
|
43
|
-
|
|
45
|
+
_this.setState({ isBusy: false });
|
|
44
46
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
_this.updateSegment = function (val) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
48
|
+
var customState, updatedParams;
|
|
49
|
+
var _this = this;
|
|
50
|
+
return tslib_1.__generator(this, function (_a) {
|
|
51
|
+
if (!this.state.segment)
|
|
52
|
+
return [2 /*return*/];
|
|
53
|
+
customState = this.customState;
|
|
54
|
+
customState.events.isBusy.next(true);
|
|
55
|
+
// Hide pervious segement structures
|
|
56
|
+
this.hideStructures(customState.superpositionState.activeSegment - 1);
|
|
57
|
+
updatedParams = tslib_1.__assign({}, this.state.segment);
|
|
58
|
+
updatedParams.value = val;
|
|
59
|
+
this.setState({ segment: updatedParams });
|
|
60
|
+
setTimeout(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
61
|
+
var updatedSegmentIndex;
|
|
62
|
+
return tslib_1.__generator(this, function (_a) {
|
|
63
|
+
switch (_a.label) {
|
|
64
|
+
case 0:
|
|
65
|
+
updatedSegmentIndex = parseInt(val.segment.split(' ')[0]);
|
|
66
|
+
customState.superpositionState.activeSegment = updatedSegmentIndex;
|
|
67
|
+
// Display current segment visible structures
|
|
68
|
+
return [4 /*yield*/, this.displayStructures(customState.superpositionState.activeSegment - 1)];
|
|
69
|
+
case 1:
|
|
70
|
+
// Display current segment visible structures
|
|
71
|
+
_a.sent();
|
|
72
|
+
customState.events.isBusy.next(false);
|
|
73
|
+
this.plugin.customState.events.segmentUpdate.next(true);
|
|
74
|
+
return [2 /*return*/];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}); }, 100);
|
|
78
|
+
return [2 /*return*/, false];
|
|
79
|
+
});
|
|
80
|
+
}); };
|
|
81
|
+
_this.hideStructures = function (segmentIndex) {
|
|
82
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
67
83
|
// clear selections
|
|
68
|
-
|
|
84
|
+
_this.plugin.managers.interactivity.lociSelects.deselectAll();
|
|
69
85
|
// clear Focus
|
|
70
|
-
|
|
86
|
+
_this.plugin.managers.structure.focus.clear();
|
|
71
87
|
// remove measurements
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
measureTypes.forEach((type)
|
|
88
|
+
var measurements = _this.plugin.managers.structure.measurement.state;
|
|
89
|
+
var measureTypes = ['labels', 'distances', 'angles', 'dihedrals'];
|
|
90
|
+
var measurementCell = void 0;
|
|
91
|
+
measureTypes.forEach(function (type) {
|
|
76
92
|
if (measurementCell)
|
|
77
93
|
return;
|
|
78
94
|
if (measurements[type][0]) {
|
|
79
|
-
measurementCell =
|
|
95
|
+
measurementCell = _this.plugin.state.data.cells.get(measurements[type][0].transform.parent);
|
|
80
96
|
}
|
|
81
97
|
});
|
|
82
98
|
if (measurementCell) {
|
|
83
|
-
commands_1.PluginCommands.State.RemoveObject(
|
|
99
|
+
commands_1.PluginCommands.State.RemoveObject(_this.plugin, { state: measurementCell.parent, ref: measurementCell.transform.parent, removeParentGhosts: true });
|
|
84
100
|
}
|
|
85
101
|
// hide structures
|
|
86
|
-
|
|
102
|
+
var customState = _this.customState;
|
|
87
103
|
customState.superpositionState.visibleRefs[segmentIndex] = [];
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
try {
|
|
105
|
+
for (var _d = tslib_1.__values(customState.superpositionState.loadedStructs[segmentIndex]), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
106
|
+
var struct = _e.value;
|
|
107
|
+
var structRef = _this.customState.superpositionState.models[struct];
|
|
108
|
+
if (structRef) {
|
|
109
|
+
var structHierarchy = _this.plugin.managers.structure.hierarchy.current.refs.get(structRef);
|
|
110
|
+
if (structHierarchy && structHierarchy.components) {
|
|
111
|
+
try {
|
|
112
|
+
for (var _f = (e_2 = void 0, tslib_1.__values(structHierarchy.components)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
113
|
+
var c = _g.value;
|
|
114
|
+
if (c && c.cell && !c.cell.state.isHidden) {
|
|
115
|
+
customState.superpositionState.visibleRefs[segmentIndex].push(c.cell.transform.ref);
|
|
116
|
+
commands_1.PluginCommands.State.ToggleVisibility(_this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
121
|
+
finally {
|
|
122
|
+
try {
|
|
123
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
124
|
+
}
|
|
125
|
+
finally { if (e_2) throw e_2.error; }
|
|
97
126
|
}
|
|
98
127
|
}
|
|
99
128
|
}
|
|
100
129
|
}
|
|
101
130
|
}
|
|
131
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
132
|
+
finally {
|
|
133
|
+
try {
|
|
134
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
135
|
+
}
|
|
136
|
+
finally { if (e_1) throw e_1.error; }
|
|
137
|
+
}
|
|
102
138
|
if (customState.superpositionState.alphafold.ref) {
|
|
103
|
-
|
|
139
|
+
var afStr = _this.plugin.managers.structure.hierarchy.current.refs.get(customState.superpositionState.alphafold.ref);
|
|
104
140
|
if (afStr && afStr.components) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
141
|
+
try {
|
|
142
|
+
for (var _h = tslib_1.__values(afStr.components), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
143
|
+
var c = _j.value;
|
|
144
|
+
if (c && c.cell && !c.cell.state.isHidden) {
|
|
145
|
+
commands_1.PluginCommands.State.ToggleVisibility(_this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
150
|
+
finally {
|
|
151
|
+
try {
|
|
152
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
108
153
|
}
|
|
154
|
+
finally { if (e_3) throw e_3.error; }
|
|
109
155
|
}
|
|
110
156
|
}
|
|
111
157
|
}
|
|
112
158
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
159
|
+
_this.displayStructures = function (segmentIndex) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
160
|
+
var customState, spState, loadStrs_1, _a, _b, ref, cell, afStr, _c, _d, c;
|
|
161
|
+
var e_4, _e, e_5, _f;
|
|
162
|
+
var _this = this;
|
|
163
|
+
return tslib_1.__generator(this, function (_g) {
|
|
164
|
+
switch (_g.label) {
|
|
165
|
+
case 0:
|
|
166
|
+
customState = this.customState;
|
|
167
|
+
spState = customState.superpositionState;
|
|
168
|
+
if (!(customState.superpositionState.visibleRefs[segmentIndex].length === 0)) return [3 /*break*/, 3];
|
|
169
|
+
loadStrs_1 = [];
|
|
170
|
+
customState.superpositionState.segmentData[segmentIndex].clusters.forEach(function (cluster) {
|
|
171
|
+
var entryList = [cluster[0]];
|
|
172
|
+
if (customState.initParams.superpositionParams && customState.initParams.superpositionParams.superposeAll) {
|
|
173
|
+
entryList = cluster;
|
|
174
|
+
}
|
|
175
|
+
entryList.forEach(function (str) {
|
|
176
|
+
var structStateId = "".concat(str.pdb_id, "_").concat(str.struct_asym_id);
|
|
177
|
+
var structRef = customState.superpositionState.models[structStateId];
|
|
178
|
+
if (structRef) {
|
|
179
|
+
var cell = _this.plugin.state.data.cells.get(structRef);
|
|
180
|
+
var isHidden = cell.state.isHidden ? true : false;
|
|
181
|
+
if (isHidden) {
|
|
182
|
+
commands_1.PluginCommands.State.ToggleVisibility(_this.plugin, { state: cell.parent, ref: structRef });
|
|
183
|
+
// PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent!, ref: cell.transform.parent });
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
loadStrs_1.push(str);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
192
|
+
if (!(loadStrs_1.length > 0)) return [3 /*break*/, 2];
|
|
193
|
+
return [4 /*yield*/, (0, superposition_1.renderSuperposition)(this.plugin, segmentIndex, loadStrs_1)];
|
|
194
|
+
case 1:
|
|
195
|
+
_g.sent();
|
|
196
|
+
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
197
|
+
_g.label = 2;
|
|
198
|
+
case 2: return [3 /*break*/, 4];
|
|
199
|
+
case 3:
|
|
200
|
+
try {
|
|
201
|
+
for (_a = tslib_1.__values(customState.superpositionState.visibleRefs[segmentIndex]), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
202
|
+
ref = _b.value;
|
|
203
|
+
cell = this.plugin.state.data.cells.get(ref);
|
|
204
|
+
if (cell && cell.state.isHidden) {
|
|
205
|
+
commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: ref });
|
|
206
|
+
}
|
|
132
207
|
}
|
|
133
208
|
}
|
|
134
|
-
|
|
135
|
-
|
|
209
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
210
|
+
finally {
|
|
211
|
+
try {
|
|
212
|
+
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
213
|
+
}
|
|
214
|
+
finally { if (e_4) throw e_4.error; }
|
|
136
215
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
for (const ref of customState.superpositionState.visibleRefs[segmentIndex]) {
|
|
147
|
-
const cell = this.plugin.state.data.cells.get(ref);
|
|
148
|
-
if (cell && cell.state.isHidden) {
|
|
149
|
-
commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref });
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
153
|
-
}
|
|
154
|
-
if (spState.alphafold.ref) {
|
|
155
|
-
(0, superposition_2.superposeAf)(this.plugin, spState.alphafold.traceOnly);
|
|
156
|
-
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
157
|
-
}
|
|
158
|
-
if (spState.alphafold.ref && spState.alphafold.visibility[segmentIndex]) {
|
|
159
|
-
const afStr = this.plugin.managers.structure.hierarchy.current.refs.get(customState.superpositionState.alphafold.ref);
|
|
160
|
-
if (afStr && afStr.components) {
|
|
161
|
-
for (const c of afStr.components) {
|
|
162
|
-
if (c && c.cell && c.cell.state.isHidden) {
|
|
163
|
-
commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
|
|
216
|
+
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
217
|
+
_g.label = 4;
|
|
218
|
+
case 4:
|
|
219
|
+
if (spState.alphafold.ref) {
|
|
220
|
+
(0, superposition_2.superposeAf)(this.plugin, spState.alphafold.traceOnly);
|
|
221
|
+
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
164
222
|
}
|
|
165
|
-
|
|
223
|
+
if (spState.alphafold.ref && spState.alphafold.visibility[segmentIndex]) {
|
|
224
|
+
afStr = this.plugin.managers.structure.hierarchy.current.refs.get(customState.superpositionState.alphafold.ref);
|
|
225
|
+
if (afStr && afStr.components) {
|
|
226
|
+
try {
|
|
227
|
+
for (_c = tslib_1.__values(afStr.components), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
228
|
+
c = _d.value;
|
|
229
|
+
if (c && c.cell && c.cell.state.isHidden) {
|
|
230
|
+
commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
235
|
+
finally {
|
|
236
|
+
try {
|
|
237
|
+
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
238
|
+
}
|
|
239
|
+
finally { if (e_5) throw e_5.error; }
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return [2 /*return*/];
|
|
166
244
|
}
|
|
167
|
-
}
|
|
168
|
-
};
|
|
245
|
+
});
|
|
246
|
+
}); };
|
|
247
|
+
return _this;
|
|
169
248
|
}
|
|
170
|
-
componentDidMount() {
|
|
171
|
-
|
|
172
|
-
|
|
249
|
+
SegmentTree.prototype.componentDidMount = function () {
|
|
250
|
+
var _this = this;
|
|
251
|
+
this.subscribe(this.plugin.customState.events.superpositionInit, function () {
|
|
252
|
+
var customState = _this.customState;
|
|
173
253
|
if (customState && !customState.superpositionError) {
|
|
174
|
-
|
|
254
|
+
_this.getSegmentParams();
|
|
175
255
|
}
|
|
176
|
-
|
|
256
|
+
_this.forceUpdate();
|
|
177
257
|
});
|
|
178
|
-
this.subscribe(this.plugin.customState.events.isBusy, (e)
|
|
179
|
-
|
|
258
|
+
this.subscribe(this.plugin.customState.events.isBusy, function (e) {
|
|
259
|
+
_this.setState({ isBusy: e });
|
|
180
260
|
if (e) {
|
|
181
|
-
commands_1.PluginCommands.Toast.Show(
|
|
261
|
+
commands_1.PluginCommands.Toast.Show(_this.plugin, {
|
|
182
262
|
title: 'Process',
|
|
183
263
|
message: 'Loading / computing large dataset!',
|
|
184
264
|
key: 'is-busy-toast'
|
|
185
265
|
});
|
|
186
266
|
}
|
|
187
267
|
else {
|
|
188
|
-
commands_1.PluginCommands.Toast.Hide(
|
|
268
|
+
commands_1.PluginCommands.Toast.Hide(_this.plugin, { key: 'is-busy-toast' });
|
|
189
269
|
}
|
|
190
270
|
});
|
|
191
|
-
this.subscribe(this.plugin.behaviors.layout.leftPanelTabName, (e)
|
|
271
|
+
this.subscribe(this.plugin.behaviors.layout.leftPanelTabName, function (e) {
|
|
192
272
|
if (e !== 'segments')
|
|
193
273
|
return;
|
|
194
|
-
|
|
195
|
-
|
|
274
|
+
_this.getSegmentParams();
|
|
275
|
+
_this.forceUpdate();
|
|
196
276
|
});
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
277
|
+
};
|
|
278
|
+
Object.defineProperty(SegmentTree.prototype, "customState", {
|
|
279
|
+
get: function () {
|
|
280
|
+
return this.plugin.customState;
|
|
281
|
+
},
|
|
282
|
+
enumerable: false,
|
|
283
|
+
configurable: true
|
|
284
|
+
});
|
|
285
|
+
SegmentTree.prototype.transform = function (s, matrix) {
|
|
286
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
287
|
+
var r, o, params, b;
|
|
288
|
+
return tslib_1.__generator(this, function (_a) {
|
|
289
|
+
switch (_a.label) {
|
|
290
|
+
case 0:
|
|
291
|
+
r = mol_state_2.StateObjectRef.resolveAndCheck(this.plugin.state.data, s);
|
|
292
|
+
if (!r)
|
|
293
|
+
return [2 /*return*/];
|
|
294
|
+
o = mol_state_2.StateSelection.findTagInSubtree(this.plugin.state.data.tree, r.transform.ref, SuperpositionTag);
|
|
295
|
+
params = {
|
|
296
|
+
transform: {
|
|
297
|
+
name: 'matrix',
|
|
298
|
+
params: { data: matrix, transpose: false }
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
b = o
|
|
302
|
+
? this.plugin.state.data.build().to(o).update(params)
|
|
303
|
+
: this.plugin.state.data.build().to(s)
|
|
304
|
+
.insert(transforms_1.StateTransforms.Model.TransformStructureConformation, params, { tags: SuperpositionTag });
|
|
305
|
+
return [4 /*yield*/, this.plugin.runTask(this.plugin.state.data.updateTree(b))];
|
|
306
|
+
case 1:
|
|
307
|
+
_a.sent();
|
|
308
|
+
return [2 /*return*/];
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
SegmentTree.prototype.render = function () {
|
|
314
|
+
var sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: "Structure clusters" });
|
|
315
|
+
var customState = this.customState;
|
|
223
316
|
if (customState && customState.initParams && !customState.initParams.superposition) {
|
|
224
317
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", { children: "Functionality unavailable!" })] });
|
|
225
318
|
}
|
|
226
319
|
else {
|
|
227
320
|
if (customState && customState.initParams && customState.initParams.superposition) {
|
|
228
|
-
sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title:
|
|
321
|
+
sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: "Structure clusters - ".concat(customState.initParams.moleculeId) });
|
|
229
322
|
if (customState.superpositionError) {
|
|
230
323
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", { style: { textAlign: 'center' }, children: customState.superpositionError })] });
|
|
231
324
|
}
|
|
@@ -235,241 +328,346 @@ class SegmentTree extends base_1.PurePluginUIComponent {
|
|
|
235
328
|
}
|
|
236
329
|
}
|
|
237
330
|
if (this.state) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title:
|
|
242
|
-
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: this.state.segment.params, values: this.state.segment.value, onChangeValues: this.updateSegment, isDisabled: this.state.isBusy }),
|
|
331
|
+
var segmentIndex_1 = parseInt(this.state.segment.value.segment.split(' ')[0]) - 1;
|
|
332
|
+
var segmentData_1 = customState.superpositionState.segmentData;
|
|
333
|
+
var fullSegmentRange = "( ".concat(segmentData_1[0].segment_start, " - ").concat(segmentData_1[segmentData_1.length - 1].segment_end, " )");
|
|
334
|
+
sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: "Structure clusters ".concat(customState.initParams.moleculeId), desc: fullSegmentRange });
|
|
335
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)(parameters_1.ParameterControls, { params: this.state.segment.params, values: this.state.segment.value, onChangeValues: this.updateSegment, isDisabled: this.state.isBusy }), segmentData_1[segmentIndex_1].clusters.map(function (c, i) { return (0, jsx_runtime_1.jsx)(ClusterNode, { cluster: c, totalClusters: segmentData_1[segmentIndex_1].clusters.length, segmentIndex: segmentIndex_1, clusterIndex: i }, "cluster-".concat(segmentIndex_1, "-").concat(i)); })] });
|
|
243
336
|
}
|
|
244
337
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
245
|
-
}
|
|
246
|
-
|
|
338
|
+
};
|
|
339
|
+
return SegmentTree;
|
|
340
|
+
}(base_1.PurePluginUIComponent));
|
|
247
341
|
exports.SegmentTree = SegmentTree;
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
this.
|
|
342
|
+
var ClusterNode = /** @class */ (function (_super) {
|
|
343
|
+
tslib_1.__extends(ClusterNode, _super);
|
|
344
|
+
function ClusterNode() {
|
|
345
|
+
var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(arguments), false)) || this;
|
|
346
|
+
_this.state = {
|
|
252
347
|
isCollapsed: false,
|
|
253
348
|
showAll: false,
|
|
254
349
|
showNone: false,
|
|
255
350
|
showSearch: false,
|
|
256
351
|
isBusy: false,
|
|
257
|
-
cluster:
|
|
352
|
+
cluster: _this.props.cluster,
|
|
258
353
|
searchText: ''
|
|
259
354
|
};
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
355
|
+
_this.inputStream = new rxjs_1.Subject();
|
|
356
|
+
_this.handleInputStream = function (inputStr) {
|
|
357
|
+
_this.setState({ searchText: inputStr });
|
|
358
|
+
var filteredRes = _this.props.cluster.filter(function (item) {
|
|
264
359
|
return item.pdb_id.toLowerCase().indexOf(inputStr.toLowerCase()) >= 0;
|
|
265
360
|
});
|
|
266
|
-
|
|
361
|
+
_this.setState({ cluster: filteredRes });
|
|
267
362
|
};
|
|
268
|
-
|
|
363
|
+
_this.toggleExpanded = function (e) {
|
|
269
364
|
e.preventDefault();
|
|
270
|
-
|
|
365
|
+
_this.setState({ isCollapsed: !_this.state.isCollapsed });
|
|
271
366
|
e.currentTarget.blur();
|
|
272
367
|
};
|
|
273
|
-
|
|
368
|
+
_this.selectAll = function (e) {
|
|
274
369
|
e.preventDefault();
|
|
275
|
-
|
|
370
|
+
_this.setState({ showAll: !_this.state.showAll, showNone: false });
|
|
276
371
|
e.currentTarget.blur();
|
|
277
372
|
};
|
|
278
|
-
|
|
373
|
+
_this.selectNone = function (e) {
|
|
279
374
|
e.preventDefault();
|
|
280
|
-
|
|
375
|
+
_this.setState({ showAll: false, showNone: !_this.state.showNone });
|
|
281
376
|
e.currentTarget.blur();
|
|
282
377
|
};
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
378
|
+
_this.applyAction = function (e) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
379
|
+
var customState, currentState;
|
|
380
|
+
var _this = this;
|
|
381
|
+
return tslib_1.__generator(this, function (_a) {
|
|
382
|
+
e.preventDefault();
|
|
383
|
+
e.currentTarget.blur();
|
|
384
|
+
customState = this.customState;
|
|
385
|
+
customState.events.isBusy.next(true);
|
|
386
|
+
currentState = tslib_1.__assign({}, this.state);
|
|
387
|
+
this.setState({ showAll: false, showNone: false });
|
|
388
|
+
setTimeout(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
389
|
+
var loadStrs, _a, _b, _c, str, structStateId, structRef, cell, isHidden, e_6_1;
|
|
390
|
+
var _d, e_6, _e, _f;
|
|
391
|
+
return tslib_1.__generator(this, function (_g) {
|
|
392
|
+
switch (_g.label) {
|
|
393
|
+
case 0:
|
|
394
|
+
loadStrs = [];
|
|
395
|
+
_g.label = 1;
|
|
396
|
+
case 1:
|
|
397
|
+
_g.trys.push([1, 9, 10, 15]);
|
|
398
|
+
_a = true, _b = tslib_1.__asyncValues(this.state.cluster);
|
|
399
|
+
_g.label = 2;
|
|
400
|
+
case 2: return [4 /*yield*/, _b.next()];
|
|
401
|
+
case 3:
|
|
402
|
+
if (!(_c = _g.sent(), _d = _c.done, !_d)) return [3 /*break*/, 8];
|
|
403
|
+
_f = _c.value;
|
|
404
|
+
_a = false;
|
|
405
|
+
str = _f;
|
|
406
|
+
structStateId = "".concat(str.pdb_id, "_").concat(str.struct_asym_id);
|
|
407
|
+
structRef = undefined;
|
|
408
|
+
if (customState && customState.superpositionState && customState.superpositionState.models[structStateId]) {
|
|
409
|
+
structRef = this.customState.superpositionState.models[structStateId];
|
|
410
|
+
}
|
|
411
|
+
if (!structRef) return [3 /*break*/, 6];
|
|
412
|
+
cell = this.plugin.state.data.cells.get(structRef);
|
|
413
|
+
if (!cell) return [3 /*break*/, 5];
|
|
414
|
+
isHidden = cell.state.isHidden ? true : false;
|
|
415
|
+
if (!((isHidden && currentState.showAll) || (!isHidden && currentState.showNone))) return [3 /*break*/, 5];
|
|
416
|
+
return [4 /*yield*/, commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: structRef })];
|
|
417
|
+
case 4:
|
|
418
|
+
_g.sent();
|
|
419
|
+
_g.label = 5;
|
|
420
|
+
case 5: return [3 /*break*/, 7];
|
|
421
|
+
case 6:
|
|
422
|
+
if (currentState.showAll)
|
|
423
|
+
loadStrs.push(str);
|
|
424
|
+
_g.label = 7;
|
|
425
|
+
case 7:
|
|
426
|
+
_a = true;
|
|
427
|
+
return [3 /*break*/, 2];
|
|
428
|
+
case 8: return [3 /*break*/, 15];
|
|
429
|
+
case 9:
|
|
430
|
+
e_6_1 = _g.sent();
|
|
431
|
+
e_6 = { error: e_6_1 };
|
|
432
|
+
return [3 /*break*/, 15];
|
|
433
|
+
case 10:
|
|
434
|
+
_g.trys.push([10, , 13, 14]);
|
|
435
|
+
if (!(!_a && !_d && (_e = _b.return))) return [3 /*break*/, 12];
|
|
436
|
+
return [4 /*yield*/, _e.call(_b)];
|
|
437
|
+
case 11:
|
|
438
|
+
_g.sent();
|
|
439
|
+
_g.label = 12;
|
|
440
|
+
case 12: return [3 /*break*/, 14];
|
|
441
|
+
case 13:
|
|
442
|
+
if (e_6) throw e_6.error;
|
|
443
|
+
return [7 /*endfinally*/];
|
|
444
|
+
case 14: return [7 /*endfinally*/];
|
|
445
|
+
case 15:
|
|
446
|
+
;
|
|
447
|
+
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
448
|
+
if (!(loadStrs.length > 0)) return [3 /*break*/, 17];
|
|
449
|
+
return [4 /*yield*/, (0, superposition_1.renderSuperposition)(this.plugin, this.props.segmentIndex, loadStrs)];
|
|
450
|
+
case 16:
|
|
451
|
+
_g.sent();
|
|
452
|
+
_g.label = 17;
|
|
453
|
+
case 17:
|
|
454
|
+
customState.events.isBusy.next(false);
|
|
455
|
+
return [2 /*return*/];
|
|
306
456
|
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
loadStrs.push(str);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
;
|
|
314
|
-
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
315
|
-
if (loadStrs.length > 0) {
|
|
316
|
-
await (0, superposition_1.renderSuperposition)(this.plugin, this.props.segmentIndex, loadStrs);
|
|
317
|
-
}
|
|
318
|
-
customState.events.isBusy.next(false);
|
|
457
|
+
});
|
|
458
|
+
}); });
|
|
459
|
+
return [2 /*return*/];
|
|
319
460
|
});
|
|
320
|
-
};
|
|
321
|
-
|
|
461
|
+
}); };
|
|
462
|
+
_this.cancelAction = function (e) {
|
|
322
463
|
e.preventDefault();
|
|
323
|
-
|
|
464
|
+
_this.setState({ showAll: false, showNone: false });
|
|
324
465
|
e.currentTarget.blur();
|
|
325
466
|
};
|
|
326
|
-
|
|
467
|
+
_this.clearSearch = function (e) {
|
|
327
468
|
e.preventDefault();
|
|
328
|
-
|
|
329
|
-
|
|
469
|
+
_this.setState({ searchText: '' });
|
|
470
|
+
_this.inputStream.next('');
|
|
330
471
|
e.currentTarget.blur();
|
|
331
472
|
};
|
|
473
|
+
return _this;
|
|
332
474
|
}
|
|
333
|
-
componentDidMount() {
|
|
334
|
-
|
|
335
|
-
|
|
475
|
+
ClusterNode.prototype.componentDidMount = function () {
|
|
476
|
+
var _this = this;
|
|
477
|
+
this.subscribe(this.plugin.customState.events.isBusy, function (e) {
|
|
478
|
+
_this.setState({ isBusy: e, showAll: false, showNone: false });
|
|
336
479
|
});
|
|
337
|
-
this.subscribe(this.inputStream.pipe((0, operators_1.debounceTime)(1000 / 24)), (e)
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
480
|
+
this.subscribe(this.inputStream.pipe((0, operators_1.debounceTime)(1000 / 24)), function (e) { return _this.handleInputStream(e); });
|
|
481
|
+
};
|
|
482
|
+
Object.defineProperty(ClusterNode.prototype, "customState", {
|
|
483
|
+
get: function () {
|
|
484
|
+
return this.plugin.customState;
|
|
485
|
+
},
|
|
486
|
+
enumerable: false,
|
|
487
|
+
configurable: true
|
|
488
|
+
});
|
|
489
|
+
ClusterNode.prototype.render = function () {
|
|
490
|
+
var _this = this;
|
|
491
|
+
var customState = this.customState;
|
|
344
492
|
if (!customState.superpositionState || !customState.superpositionState.segmentData)
|
|
345
493
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [mainRow, (this.state.showAll || this.state.showNone) && (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { className:
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
494
|
+
var expand = (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: this.state.isCollapsed ? icons_1.ArrowRightSvg : icons_1.ArrowDropDownSvg, flex: '20px', onClick: this.toggleExpanded, transparent: true, disabled: this.state.isBusy, className: 'msp-no-hover-outline' });
|
|
495
|
+
var title = "Segment ".concat(customState.superpositionState.activeSegment, " Cluster ").concat(this.props.clusterIndex + 1);
|
|
496
|
+
var label = (0, jsx_runtime_1.jsxs)(common_1.Button, { className: "msp-btn-tree-label", noOverflow: true, title: title, disabled: this.state.isBusy, children: [(0, jsx_runtime_1.jsxs)("span", { children: ["Cluster ", this.props.clusterIndex + 1] }), " ", (0, jsx_runtime_1.jsxs)("small", { children: [this.state.cluster.length < this.props.cluster.length ? "".concat(this.state.cluster.length, " / ") : '', this.props.cluster.length, " chain", this.props.cluster.length > 1 ? 's' : ''] })] });
|
|
497
|
+
var selectionControls = (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: this.selectAll, style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, disabled: this.state.isBusy, title: "Show all chains", children: "All" }), (0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CloseSvg, flex: true, onClick: this.selectNone, style: { flex: '0 0 50px', textAlign: 'center', fontSize: '80%', color: '#9cacc3', padding: 0 }, disabled: this.state.isBusy, title: "Hide all chains", children: "None" })] });
|
|
498
|
+
var mainRow = (0, jsx_runtime_1.jsxs)("div", { className: "msp-flex-row msp-tree-row", style: { marginTop: '10px' }, children: [expand, label, this.props.cluster.length > 1 && selectionControls] });
|
|
499
|
+
var searchControls = (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', marginLeft: '30px' }, children: [(0, jsx_runtime_1.jsx)("span", { className: 'msp-control-row-label', children: "Search PDB ID" }), (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-row-ctrl', children: (0, jsx_runtime_1.jsx)("input", { type: 'text', placeholder: 'Enter PDB ID..', disabled: this.state.isBusy, onChange: function (e) { return _this.inputStream.next(e.target.value); }, value: this.state.searchText, maxLength: 4 }) })] }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: icons_1.CloseSvg, flex: true, onClick: this.clearSearch, style: { flex: '0 0 24px', padding: 0 }, disabled: this.state.isBusy || this.state.searchText === '', toggleState: this.state.searchText !== '', title: 'Clear search input' })] });
|
|
500
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [mainRow, (this.state.showAll || this.state.showNone) && (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { className: "msp-control-row msp-transform-header-brand-".concat(this.state.showAll ? 'green' : 'red'), style: { display: 'flex', marginLeft: '20px', height: '35px' }, children: [(0, jsx_runtime_1.jsxs)("span", { className: 'msp-control-row-label', style: { flex: '1 1 auto', textAlign: 'left', fontSize: '85%' }, children: [this.state.showAll ? 'Display' : 'Hide', " ", this.state.cluster.length < this.props.cluster.length ? "".concat(this.state.cluster.length, " / ") : 'all ', this.props.cluster.length, " chains"] }), (0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CheckSvg, flex: true, onClick: this.applyAction, style: { flex: '0 0 60px', textAlign: 'center', fontSize: '78%', color: '#9cacc3', padding: 0, margin: '0 1px' }, title: "Apply action", children: "Apply" }), (0, jsx_runtime_1.jsx)(common_1.Button, { icon: icons_1.CloseSvg, flex: true, onClick: this.cancelAction, style: { flex: '0 0 60px', textAlign: 'center', fontSize: '78%', color: '#9cacc3', padding: 0, margin: '0 1px' }, title: "Cancel action", children: "Cancel" })] }) }), (!this.state.isCollapsed && this.props.cluster.length > 5) && searchControls, !this.state.isCollapsed && (0, jsx_runtime_1.jsx)("div", { className: 'msp-tree-updates-wrapper', style: { maxHeight: (this.props.totalClusters > 1) ? '330px' : '87%', overflowY: 'auto' }, children: this.state.cluster.map(function (s, i) { return (0, jsx_runtime_1.jsx)(StructureNode, { segmentIndex: _this.props.segmentIndex, structure: s, isRep: i === 0 ? true : false }, "str-".concat(s.pdb_id).concat(s.struct_asym_id).concat(i)); }) })] });
|
|
501
|
+
};
|
|
502
|
+
return ClusterNode;
|
|
503
|
+
}(base_1.PluginUIComponent));
|
|
504
|
+
var StructureNode = /** @class */ (function (_super) {
|
|
505
|
+
tslib_1.__extends(StructureNode, _super);
|
|
506
|
+
function StructureNode() {
|
|
507
|
+
var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(arguments), false)) || this;
|
|
508
|
+
_this.state = {
|
|
359
509
|
showControls: false,
|
|
360
510
|
isBusy: false,
|
|
361
511
|
isProcessing: false,
|
|
362
512
|
isHidden: true,
|
|
363
513
|
};
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
if (
|
|
374
|
-
|
|
514
|
+
_this.toggleVisible = function (e) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
515
|
+
var structHierarchy, _a, _b, c, currentHiddenState;
|
|
516
|
+
var e_7, _c;
|
|
517
|
+
return tslib_1.__generator(this, function (_d) {
|
|
518
|
+
switch (_d.label) {
|
|
519
|
+
case 0:
|
|
520
|
+
e.preventDefault();
|
|
521
|
+
e.currentTarget.blur();
|
|
522
|
+
this.setState({ isProcessing: true, showControls: false });
|
|
523
|
+
if (!this.ref) return [3 /*break*/, 1];
|
|
524
|
+
structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
|
|
525
|
+
if (structHierarchy && structHierarchy.components) {
|
|
526
|
+
try {
|
|
527
|
+
for (_a = tslib_1.__values(structHierarchy.components), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
528
|
+
c = _b.value;
|
|
529
|
+
currentHiddenState = c.cell.state.isHidden ? true : false;
|
|
530
|
+
if (currentHiddenState === this.state.isHidden) {
|
|
531
|
+
commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
536
|
+
finally {
|
|
537
|
+
try {
|
|
538
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
539
|
+
}
|
|
540
|
+
finally { if (e_7) throw e_7.error; }
|
|
541
|
+
}
|
|
542
|
+
this.setState({ isHidden: !this.state.isHidden });
|
|
375
543
|
}
|
|
376
|
-
|
|
377
|
-
this.
|
|
544
|
+
return [3 /*break*/, 3];
|
|
545
|
+
case 1: return [4 /*yield*/, (0, superposition_1.renderSuperposition)(this.plugin, this.props.segmentIndex, [this.props.structure])];
|
|
546
|
+
case 2:
|
|
547
|
+
_d.sent();
|
|
548
|
+
_d.label = 3;
|
|
549
|
+
case 3:
|
|
550
|
+
this.setState({ isProcessing: false });
|
|
551
|
+
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
552
|
+
return [2 /*return*/];
|
|
378
553
|
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
this.setState({ isProcessing: false });
|
|
384
|
-
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
385
|
-
};
|
|
386
|
-
this.selectAction = item => {
|
|
554
|
+
});
|
|
555
|
+
}); };
|
|
556
|
+
_this.selectAction = function (item) {
|
|
387
557
|
if (!item)
|
|
388
558
|
return;
|
|
389
|
-
|
|
390
|
-
(item
|
|
559
|
+
_this.setState({ showControls: false });
|
|
560
|
+
(item === null || item === void 0 ? void 0 : item.value)();
|
|
391
561
|
};
|
|
392
|
-
|
|
562
|
+
_this.highlight = function (e) {
|
|
393
563
|
e.preventDefault();
|
|
394
|
-
if (
|
|
395
|
-
|
|
396
|
-
commands_1.PluginCommands.Interactivity.Object.Highlight(
|
|
564
|
+
if (_this.ref) {
|
|
565
|
+
var cell = _this.plugin.state.data.cells.get(_this.ref);
|
|
566
|
+
commands_1.PluginCommands.Interactivity.Object.Highlight(_this.plugin, { state: cell.parent, ref: _this.ref });
|
|
397
567
|
}
|
|
398
568
|
e.currentTarget.blur();
|
|
399
569
|
};
|
|
400
|
-
|
|
570
|
+
_this.clearHighlight = function (e) {
|
|
401
571
|
e.preventDefault();
|
|
402
|
-
commands_1.PluginCommands.Interactivity.ClearHighlights(
|
|
572
|
+
commands_1.PluginCommands.Interactivity.ClearHighlights(_this.plugin);
|
|
403
573
|
e.currentTarget.blur();
|
|
404
574
|
};
|
|
405
|
-
|
|
575
|
+
_this.toggleControls = function (e) {
|
|
406
576
|
e.preventDefault();
|
|
407
|
-
|
|
577
|
+
_this.setState({ showControls: !_this.state.showControls });
|
|
408
578
|
e.currentTarget.blur();
|
|
409
579
|
};
|
|
580
|
+
return _this;
|
|
410
581
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
get modelCell() {
|
|
423
|
-
if (this.ref) {
|
|
424
|
-
return this.plugin.state.data.cells.get(this.ref);
|
|
425
|
-
}
|
|
426
|
-
else {
|
|
427
|
-
return undefined;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
get isAllHidden() {
|
|
431
|
-
let isHidden = true;
|
|
432
|
-
if (this.ref) {
|
|
433
|
-
const structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
|
|
434
|
-
if (structHierarchy && structHierarchy.components) {
|
|
435
|
-
for (const c of structHierarchy.components) {
|
|
436
|
-
if (c && c.cell && !c.cell.state.isHidden) {
|
|
437
|
-
isHidden = false;
|
|
438
|
-
break;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
582
|
+
Object.defineProperty(StructureNode.prototype, "customState", {
|
|
583
|
+
get: function () {
|
|
584
|
+
return this.plugin.customState;
|
|
585
|
+
},
|
|
586
|
+
enumerable: false,
|
|
587
|
+
configurable: true
|
|
588
|
+
});
|
|
589
|
+
Object.defineProperty(StructureNode.prototype, "ref", {
|
|
590
|
+
get: function () {
|
|
591
|
+
if (this.customState && this.customState.superpositionState && this.customState.superpositionState.models["".concat(this.props.structure.pdb_id, "_").concat(this.props.structure.struct_asym_id)]) {
|
|
592
|
+
return this.customState.superpositionState.models["".concat(this.props.structure.pdb_id, "_").concat(this.props.structure.struct_asym_id)];
|
|
441
593
|
}
|
|
442
594
|
else {
|
|
443
|
-
|
|
595
|
+
return undefined;
|
|
444
596
|
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
597
|
+
},
|
|
598
|
+
enumerable: false,
|
|
599
|
+
configurable: true
|
|
600
|
+
});
|
|
601
|
+
Object.defineProperty(StructureNode.prototype, "modelCell", {
|
|
602
|
+
get: function () {
|
|
603
|
+
if (this.ref) {
|
|
604
|
+
return this.plugin.state.data.cells.get(this.ref);
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
return undefined;
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
enumerable: false,
|
|
611
|
+
configurable: true
|
|
612
|
+
});
|
|
613
|
+
Object.defineProperty(StructureNode.prototype, "isAllHidden", {
|
|
614
|
+
get: function () {
|
|
615
|
+
var e_8, _a;
|
|
616
|
+
var isHidden = true;
|
|
617
|
+
if (this.ref) {
|
|
618
|
+
var structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
|
|
619
|
+
if (structHierarchy && structHierarchy.components) {
|
|
620
|
+
try {
|
|
621
|
+
for (var _b = tslib_1.__values(structHierarchy.components), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
622
|
+
var c = _c.value;
|
|
623
|
+
if (c && c.cell && !c.cell.state.isHidden) {
|
|
624
|
+
isHidden = false;
|
|
625
|
+
break;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
630
|
+
finally {
|
|
631
|
+
try {
|
|
632
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
633
|
+
}
|
|
634
|
+
finally { if (e_8) throw e_8.error; }
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
isHidden = false;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return isHidden;
|
|
642
|
+
},
|
|
643
|
+
enumerable: false,
|
|
644
|
+
configurable: true
|
|
645
|
+
});
|
|
646
|
+
StructureNode.prototype.checkRelation = function (ref) {
|
|
647
|
+
var isRelated = false;
|
|
648
|
+
var cell = this.plugin.state.data.cells.get(ref);
|
|
451
649
|
if (cell && cell.transform.parent) {
|
|
452
650
|
if (cell && cell.transform.parent === this.ref) {
|
|
453
651
|
isRelated = true;
|
|
454
652
|
}
|
|
455
653
|
else {
|
|
456
|
-
|
|
654
|
+
var pcell = this.plugin.state.data.cells.get(cell.transform.parent);
|
|
457
655
|
if (pcell && pcell.transform.parent === this.ref)
|
|
458
656
|
isRelated = true;
|
|
459
657
|
}
|
|
460
658
|
}
|
|
461
659
|
else {
|
|
462
|
-
|
|
660
|
+
var currentNodeCell = this.plugin.state.data.cells.get(this.ref);
|
|
463
661
|
if (currentNodeCell && currentNodeCell.transform.parent === cell.transform.parent) {
|
|
464
662
|
isRelated = true;
|
|
465
663
|
}
|
|
466
664
|
}
|
|
467
665
|
return isRelated;
|
|
468
|
-
}
|
|
469
|
-
is(e) {
|
|
666
|
+
};
|
|
667
|
+
StructureNode.prototype.is = function (e) {
|
|
470
668
|
if (!this.ref)
|
|
471
669
|
return false;
|
|
472
|
-
|
|
670
|
+
var isRelated = false;
|
|
473
671
|
if (this.ref && e.ref !== this.ref) {
|
|
474
672
|
isRelated = this.checkRelation(e.ref);
|
|
475
673
|
}
|
|
@@ -477,30 +675,31 @@ class StructureNode extends base_1.PluginUIComponent {
|
|
|
477
675
|
return true;
|
|
478
676
|
}
|
|
479
677
|
else {
|
|
480
|
-
|
|
678
|
+
var invalidStruct = (this.customState.superpositionState.invalidStruct.indexOf("".concat(this.props.structure.pdb_id, "_").concat(this.props.structure.struct_asym_id)) > -1) ? true : false;
|
|
481
679
|
return invalidStruct ? true : false;
|
|
482
680
|
}
|
|
483
|
-
}
|
|
484
|
-
componentDidMount() {
|
|
681
|
+
};
|
|
682
|
+
StructureNode.prototype.componentDidMount = function () {
|
|
683
|
+
var _this = this;
|
|
485
684
|
this.setState({ isHidden: this.isAllHidden });
|
|
486
|
-
this.subscribe(this.plugin.customState.events.isBusy, (e)
|
|
487
|
-
|
|
685
|
+
this.subscribe(this.plugin.customState.events.isBusy, function (e) {
|
|
686
|
+
_this.setState({ isBusy: e, showControls: false });
|
|
488
687
|
});
|
|
489
|
-
this.subscribe(this.plugin.state.events.cell.stateUpdated.pipe((0, operators_1.filter)(e
|
|
490
|
-
|
|
688
|
+
this.subscribe(this.plugin.state.events.cell.stateUpdated.pipe((0, operators_1.filter)(function (e) { return _this.is(e); }), (0, operators_1.debounceTime)(33)), function (e) {
|
|
689
|
+
_this.setState({ isHidden: _this.isAllHidden });
|
|
491
690
|
// this.forceUpdate();
|
|
492
691
|
});
|
|
493
|
-
}
|
|
494
|
-
getTagRefs(tags) {
|
|
495
|
-
|
|
496
|
-
|
|
692
|
+
};
|
|
693
|
+
StructureNode.prototype.getTagRefs = function (tags) {
|
|
694
|
+
var TagSet = new Set(tags);
|
|
695
|
+
var tree = this.plugin.state.data.tree;
|
|
497
696
|
return mol_state_2.StateSelection.findUniqueTagsInSubtree(tree, this.modelCell.transform.ref, TagSet);
|
|
498
|
-
}
|
|
499
|
-
getRandomColor() {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
697
|
+
};
|
|
698
|
+
StructureNode.prototype.getRandomColor = function () {
|
|
699
|
+
var clList = lists_1.ColorLists;
|
|
700
|
+
var spState = this.plugin.customState.superpositionState;
|
|
701
|
+
var palleteIndex = spState.colorState[this.props.segmentIndex].palleteIndex;
|
|
702
|
+
var colorIndex = spState.colorState[this.props.segmentIndex].colorIndex;
|
|
504
703
|
if (clList[spState.colorPalette[palleteIndex]].list[colorIndex + 1]) {
|
|
505
704
|
colorIndex += 1;
|
|
506
705
|
}
|
|
@@ -508,145 +707,169 @@ class StructureNode extends base_1.PluginUIComponent {
|
|
|
508
707
|
colorIndex = 0;
|
|
509
708
|
palleteIndex = spState.colorPalette[palleteIndex + 1] ? palleteIndex + 1 : 0;
|
|
510
709
|
}
|
|
511
|
-
|
|
710
|
+
var palleteName = spState.colorPalette[palleteIndex];
|
|
512
711
|
this.plugin.customState.superpositionState.colorState[this.props.segmentIndex].palleteIndex = palleteIndex;
|
|
513
712
|
this.plugin.customState.superpositionState.colorState[this.props.segmentIndex].colorIndex = colorIndex;
|
|
514
713
|
return clList[palleteName].list[colorIndex];
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
714
|
+
};
|
|
715
|
+
StructureNode.prototype.addChainRepr = function () {
|
|
716
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
717
|
+
var uniformColor1, strInstance, query, chainSel;
|
|
718
|
+
return tslib_1.__generator(this, function (_a) {
|
|
719
|
+
switch (_a.label) {
|
|
720
|
+
case 0:
|
|
721
|
+
uniformColor1 = this.getRandomColor();
|
|
722
|
+
strInstance = this.plugin.state.data.select(this.ref)[0];
|
|
723
|
+
query = builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
724
|
+
'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.label_asym_id(), this.props.structure.struct_asym_id])
|
|
725
|
+
});
|
|
726
|
+
return [4 /*yield*/, this.plugin.builders.structure.tryCreateComponentFromExpression(strInstance, query, "Chain-".concat(this.props.segmentIndex), { label: "Chain", tags: ["superposition-sel"] })];
|
|
727
|
+
case 1:
|
|
728
|
+
chainSel = _a.sent();
|
|
729
|
+
if (!chainSel) return [3 /*break*/, 3];
|
|
730
|
+
return [4 /*yield*/, this.plugin.builders.structure.representation.addRepresentation(chainSel, { type: 'cartoon', color: 'uniform', colorParams: { value: uniformColor1 } }, { tag: "superposition-visual" })];
|
|
731
|
+
case 2:
|
|
732
|
+
_a.sent();
|
|
733
|
+
_a.label = 3;
|
|
734
|
+
case 3: return [2 /*return*/];
|
|
735
|
+
}
|
|
736
|
+
});
|
|
521
737
|
});
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
}
|
|
527
|
-
updates() {
|
|
528
|
-
const structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
|
|
738
|
+
};
|
|
739
|
+
StructureNode.prototype.updates = function () {
|
|
740
|
+
var _this = this;
|
|
741
|
+
var structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
|
|
529
742
|
if (structHierarchy && structHierarchy.components) {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
structHierarchy.components.forEach((comps)
|
|
533
|
-
|
|
534
|
-
|
|
743
|
+
var representations_1 = [];
|
|
744
|
+
var showAddChainBtn_1 = true;
|
|
745
|
+
structHierarchy.components.forEach(function (comps) {
|
|
746
|
+
var gKeys = comps.key.split(',');
|
|
747
|
+
var cId1Arr = gKeys[0].split('-');
|
|
535
748
|
if (cId1Arr[2] === 'Chain')
|
|
536
|
-
|
|
749
|
+
showAddChainBtn_1 = false;
|
|
537
750
|
if (comps.representations) {
|
|
538
|
-
comps.representations.forEach((repr)
|
|
539
|
-
|
|
751
|
+
comps.representations.forEach(function (repr) {
|
|
752
|
+
representations_1.push(repr);
|
|
540
753
|
});
|
|
541
754
|
}
|
|
542
755
|
});
|
|
543
|
-
|
|
756
|
+
var customState = this.plugin.customState;
|
|
544
757
|
if (customState.initParams && customState.initParams.superpositionParams && !customState.initParams.superpositionParams.ligandView) {
|
|
545
|
-
|
|
758
|
+
showAddChainBtn_1 = false;
|
|
546
759
|
}
|
|
547
|
-
if (
|
|
548
|
-
return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-accent-offset', style: { marginLeft: '40px' }, children: [
|
|
760
|
+
if (representations_1.length > 0) {
|
|
761
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-accent-offset', style: { marginLeft: '40px' }, children: [representations_1.length > 0 && representations_1.map(function (r, i) { return (0, jsx_runtime_1.jsx)(StructureRepresentationEntry, { group: [structHierarchy], representation: r }, "".concat(r.cell.transform.ref, "-").concat(i)); }), showAddChainBtn_1 && (0, jsx_runtime_1.jsx)("div", { className: 'msp-control-group-header', style: { marginTop: '1px' }, children: (0, jsx_runtime_1.jsxs)(common_1.Button, { noOverflow: true, className: 'msp-control-button-label', title: "Click to add chain representaion", onClick: function () { return _this.addChainRepr(); }, children: ["\u00A0\u00A0Add Chain ", this.props.structure.struct_asym_id, " Representation"] }) })] });
|
|
549
762
|
}
|
|
550
763
|
}
|
|
551
764
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
552
|
-
}
|
|
553
|
-
getSubtitle() {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
765
|
+
};
|
|
766
|
+
StructureNode.prototype.getSubtitle = function () {
|
|
767
|
+
var customState = this.plugin.customState;
|
|
768
|
+
var hetList = customState.superpositionState.hets["".concat(this.props.structure.pdb_id, "_").concat(this.props.structure.struct_asym_id)];
|
|
769
|
+
var subtitle;
|
|
557
770
|
if (hetList) {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
771
|
+
var hetLimit = this.props.structure.is_representative ? 1 : 4;
|
|
772
|
+
var totalHets = hetList.length;
|
|
773
|
+
var hetStr = hetList.join(', ');
|
|
561
774
|
if (totalHets > hetLimit) {
|
|
562
775
|
hetStr = hetList.slice(0, hetLimit).join(', ');
|
|
563
|
-
hetStr +=
|
|
776
|
+
hetStr += " + ".concat(totalHets - hetLimit);
|
|
564
777
|
}
|
|
565
|
-
subtitle =
|
|
778
|
+
subtitle = " ( ".concat(hetStr, " )");
|
|
566
779
|
if (this.props.structure.is_representative)
|
|
567
|
-
subtitle =
|
|
780
|
+
subtitle = " ".concat(subtitle, " ( Representative )");
|
|
568
781
|
}
|
|
569
782
|
else if (this.props.structure.is_representative) {
|
|
570
783
|
subtitle = ' ( Representative )';
|
|
571
784
|
}
|
|
572
785
|
return subtitle;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
if (this.
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
786
|
+
};
|
|
787
|
+
Object.defineProperty(StructureNode.prototype, "panelColor", {
|
|
788
|
+
get: function () {
|
|
789
|
+
var panelColor = '#808080';
|
|
790
|
+
if (!this.state.isHidden) {
|
|
791
|
+
if (this.modelCell) {
|
|
792
|
+
var refs = this.getTagRefs(["superposition-visual", "superposition-ligand-visual"]);
|
|
793
|
+
var visualRef = refs["superposition-ligand-visual"] ? refs["superposition-ligand-visual"] : refs["superposition-visual"] ? refs["superposition-visual"] : undefined;
|
|
794
|
+
if (visualRef) {
|
|
795
|
+
var visualCell = this.plugin.state.data.cells.get(visualRef);
|
|
796
|
+
if (visualCell.params && visualCell.params.values && visualCell.params.values.colorTheme) {
|
|
797
|
+
var colorTheme = visualCell.params.values.colorTheme;
|
|
798
|
+
if (colorTheme.params && colorTheme.params.value) {
|
|
799
|
+
panelColor = "".concat(color_1.Color.toStyle(colorTheme.params.value));
|
|
800
|
+
}
|
|
801
|
+
else if (colorTheme.params && colorTheme.params.palette) {
|
|
802
|
+
var colorList1 = colorTheme.params.palette.params.list.colors;
|
|
803
|
+
panelColor = "".concat(color_1.Color.toStyle(colorList1[0]));
|
|
804
|
+
}
|
|
805
|
+
else if (colorTheme.params && colorTheme.params.list) {
|
|
806
|
+
var colorList2 = colorTheme.params.list.colors;
|
|
807
|
+
panelColor = "".concat(color_1.Color.toStyle(colorList2[0]));
|
|
808
|
+
}
|
|
594
809
|
}
|
|
595
810
|
}
|
|
596
811
|
}
|
|
597
812
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
813
|
+
return panelColor;
|
|
814
|
+
},
|
|
815
|
+
enumerable: false,
|
|
816
|
+
configurable: true
|
|
817
|
+
});
|
|
818
|
+
StructureNode.prototype.render = function () {
|
|
819
|
+
var superpositionParams = this.customState.initParams.superpositionParams;
|
|
820
|
+
var strutStateId = "".concat(this.props.structure.pdb_id, "_").concat(this.props.structure.struct_asym_id);
|
|
821
|
+
var invalidStruct = (this.customState.superpositionState.invalidStruct.indexOf(strutStateId) > -1) ? true : false;
|
|
822
|
+
var noMatrixStruct = (this.customState.superpositionState.noMatrixStruct.indexOf(strutStateId) > -1) ? true : false;
|
|
823
|
+
var subTitle = invalidStruct ? noMatrixStruct ? " Matrix not available!" : " No Ligand found!" : this.getSubtitle();
|
|
824
|
+
var strTitle = "".concat(this.props.structure.pdb_id, " chain ").concat(this.props.structure.auth_asym_id);
|
|
608
825
|
if (superpositionParams && superpositionParams.ligandView) {
|
|
609
|
-
strTitle =
|
|
826
|
+
strTitle = "".concat(this.props.structure.pdb_id, " ").concat(this.props.structure.struct_asym_id);
|
|
610
827
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
828
|
+
var label = (0, jsx_runtime_1.jsxs)(common_1.Button, { className: "msp-btn-tree-label", style: { borderLeftColor: this.panelColor }, noOverflow: true, title: strTitle, disabled: (invalidStruct || this.state.isBusy || this.state.isProcessing) ? true : false, onMouseEnter: this.highlight, onMouseLeave: this.clearHighlight, children: [(0, jsx_runtime_1.jsx)("span", { children: strTitle }), subTitle && (0, jsx_runtime_1.jsx)("small", { children: subTitle })] });
|
|
829
|
+
var expand = (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: !this.state.showControls ? icons_1.ArrowRightSvg : icons_1.ArrowDropDownSvg, flex: '20px', onClick: this.toggleControls, transparent: true, className: 'msp-no-hover-outline', disabled: (invalidStruct || this.state.isBusy || this.state.isProcessing) ? true : false });
|
|
830
|
+
var visibility = (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: this.state.isHidden ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, toggleState: false, small: true, onClick: this.toggleVisible, disabled: (invalidStruct || this.state.isBusy || this.state.isProcessing) ? true : false, title: this.state.isHidden ? "Show chain" : "Hide chain" });
|
|
831
|
+
var row = (0, jsx_runtime_1.jsxs)("div", { className: "msp-flex-row msp-tree-row", style: { marginLeft: !this.state.isHidden ? '10px' : '31px' }, children: [!this.state.isHidden && expand, label, visibility] });
|
|
615
832
|
return (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: '1px' }, children: [row, this.state.showControls && this.updates()] });
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
833
|
+
};
|
|
834
|
+
return StructureNode;
|
|
835
|
+
}(base_1.PluginUIComponent));
|
|
836
|
+
var StructureRepresentationEntry = /** @class */ (function (_super) {
|
|
837
|
+
tslib_1.__extends(StructureRepresentationEntry, _super);
|
|
838
|
+
function StructureRepresentationEntry() {
|
|
839
|
+
var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(arguments), false)) || this;
|
|
840
|
+
_this.toggleVisible = function (e) {
|
|
622
841
|
e.preventDefault();
|
|
623
842
|
e.currentTarget.blur();
|
|
624
|
-
|
|
625
|
-
commands_1.PluginCommands.State.ToggleVisibility(
|
|
843
|
+
var cell = _this.props.representation.cell;
|
|
844
|
+
commands_1.PluginCommands.State.ToggleVisibility(_this.plugin, { state: cell.parent, ref: cell.transform.parent });
|
|
626
845
|
};
|
|
846
|
+
return _this;
|
|
627
847
|
}
|
|
628
|
-
componentDidMount() {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
848
|
+
StructureRepresentationEntry.prototype.componentDidMount = function () {
|
|
849
|
+
var _this = this;
|
|
850
|
+
this.subscribe(this.plugin.state.events.cell.stateUpdated, function (e) {
|
|
851
|
+
if (mol_state_1.State.ObjectEvent.isCell(e, _this.props.representation.cell))
|
|
852
|
+
_this.forceUpdate();
|
|
632
853
|
});
|
|
633
|
-
}
|
|
634
|
-
render() {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
854
|
+
};
|
|
855
|
+
StructureRepresentationEntry.prototype.render = function () {
|
|
856
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
857
|
+
var repr = this.props.representation.cell;
|
|
858
|
+
var label = (_a = repr.obj) === null || _a === void 0 ? void 0 : _a.label;
|
|
859
|
+
if (((_b = repr.obj) === null || _b === void 0 ? void 0 : _b.data.repr) && ((_c = repr.obj) === null || _c === void 0 ? void 0 : _c.data.repr.label)) {
|
|
860
|
+
var sourceLabel = (((_d = repr.obj) === null || _d === void 0 ? void 0 : _d.data.repr.label.indexOf('[Focus]')) >= 0) ? '[Focus]' : (_e = repr.obj) === null || _e === void 0 ? void 0 : _e.data.repr.label;
|
|
861
|
+
var isLargeLabel = sourceLabel.length > 10 ? true : false;
|
|
862
|
+
sourceLabel = "".concat(isLargeLabel ? "".concat(sourceLabel.substring(0, 28), "...") : sourceLabel);
|
|
641
863
|
if (isLargeLabel) {
|
|
642
864
|
label = sourceLabel;
|
|
643
865
|
}
|
|
644
866
|
else {
|
|
645
|
-
label =
|
|
867
|
+
label = "".concat(sourceLabel, " ").concat((label && label.length < 21) ? ' - ' + label : '');
|
|
646
868
|
}
|
|
647
869
|
}
|
|
648
|
-
if (repr.obj
|
|
870
|
+
if (((_f = repr.obj) === null || _f === void 0 ? void 0 : _f.data.repr) && ((_g = repr.obj) === null || _g === void 0 ? void 0 : _g.data.repr.label) === 'Custom Selection')
|
|
649
871
|
label = 'Custom Selection';
|
|
650
|
-
return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-representation-entry', children: [repr.parent && (0, jsx_runtime_1.jsx)(common_1.ExpandGroup, { header:
|
|
651
|
-
}
|
|
652
|
-
|
|
872
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-representation-entry', children: [repr.parent && (0, jsx_runtime_1.jsx)(common_1.ExpandGroup, { header: "".concat(label || 'Representation'), noOffset: true, headerStyle: { overflow: 'hidden' }, children: (0, jsx_runtime_1.jsx)(update_transform_1.UpdateTransformControl, { state: repr.parent, transform: repr.transform, customHeader: 'none', noMargin: true }) }), (0, jsx_runtime_1.jsx)(common_1.IconButton, { svg: this.props.representation.cell.state.isHidden ? icons_1.VisibilityOffOutlinedSvg : icons_1.VisibilityOutlinedSvg, toggleState: false, onClick: this.toggleVisible, title: this.props.representation.cell.state.isHidden ? "Show representation" : "Hide representation", small: true, className: 'msp-default-bg', style: { position: 'absolute', top: 0, right: 0, lineHeight: '24px', height: '24px', textAlign: 'right', width: '32px', paddingRight: '6px', background: 'none' } })] });
|
|
873
|
+
};
|
|
874
|
+
return StructureRepresentationEntry;
|
|
875
|
+
}(base_1.PurePluginUIComponent));
|