drugflow-molstar 0.3.77 → 0.4.1
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.1.css +1 -0
- package/build/drugflow-molstar-component-0.4.1.js +25 -0
- package/build/drugflow-molstar-plugin-0.4.1.js +2 -0
- package/build/drugflow-molstar-plugin-0.4.1.js.LICENSE.txt +64 -0
- package/lib/alphafold-transparency.js +58 -125
- package/lib/contact.d.ts +15 -6
- package/lib/contact.js +71 -66
- package/lib/custom-events.js +16 -16
- package/lib/domain-annotations/behavior.js +20 -24
- package/lib/domain-annotations/color.d.ts +1 -1
- package/lib/domain-annotations/color.js +23 -22
- package/lib/domain-annotations/prop.d.ts +3 -3
- package/lib/domain-annotations/prop.js +54 -76
- package/lib/drugflow-molstar-component-build-0.3.78.js +2 -0
- package/lib/drugflow-molstar-component-build-0.4.1.js +2 -0
- package/lib/helpers.d.ts +4 -4
- package/lib/helpers.js +94 -99
- package/lib/index.js +1785 -2608
- package/lib/labels.d.ts +1 -1
- package/lib/labels.js +20 -23
- package/lib/loci-details.d.ts +2 -2
- package/lib/loci-details.js +26 -29
- package/lib/sifts-mapping.js +30 -34
- package/lib/sifts-mappings-behaviour.js +26 -30
- package/lib/spec.d.ts +1 -1
- package/lib/spec.js +50 -38
- package/lib/structure_contact3d.d.ts +13 -4
- package/lib/structure_contact3d.js +25 -46
- package/lib/subscribe-events.js +17 -17
- package/lib/superposition-export.js +100 -144
- package/lib/superposition-focus-representation.d.ts +1 -1
- package/lib/superposition-focus-representation.js +74 -112
- package/lib/superposition-sifts-mapping.d.ts +1 -1
- package/lib/superposition-sifts-mapping.js +56 -62
- package/lib/superposition.d.ts +2 -2
- package/lib/superposition.js +490 -726
- package/lib/ui/alphafold-superposition.d.ts +8 -9
- package/lib/ui/alphafold-superposition.js +96 -120
- package/lib/ui/alphafold-tranparency.d.ts +1 -2
- package/lib/ui/alphafold-tranparency.js +27 -43
- package/lib/ui/annotation-controls.d.ts +2 -3
- package/lib/ui/annotation-controls.js +81 -87
- package/lib/ui/export-superposition.js +33 -51
- package/lib/ui/pdbe-left-panel.d.ts +3 -3
- package/lib/ui/pdbe-left-panel.js +82 -106
- package/lib/ui/pdbe-screenshot-controls.d.ts +1 -1
- package/lib/ui/pdbe-screenshot-controls.js +54 -83
- package/lib/ui/pdbe-structure-controls.d.ts +4 -5
- package/lib/ui/pdbe-structure-controls.js +34 -57
- package/lib/ui/pdbe-viewport-controls.d.ts +1 -2
- package/lib/ui/pdbe-viewport-controls.js +23 -29
- package/lib/ui/segment-tree.d.ts +1 -2
- package/lib/ui/segment-tree.js +438 -590
- package/lib/ui/superposition-components.d.ts +1 -2
- package/lib/ui/superposition-components.js +196 -266
- package/lib/ui/superposition-viewport.d.ts +1 -2
- package/lib/ui/superposition-viewport.js +11 -18
- package/package.json +7 -4
- package/build/drugflow-molstar-0.3.62.css +0 -1
- package/build/drugflow-molstar-0.3.77.css +0 -1
- package/build/drugflow-molstar-component-0.3.62.js +0 -25
- package/build/drugflow-molstar-component-0.3.77.js +0 -25
- package/build/drugflow-molstar-light.css +0 -1
- package/build/drugflow-molstar-plugin-0.3.62.js +0 -2
- package/build/drugflow-molstar-plugin-0.3.62.js.LICENSE.txt +0 -39
- package/build/drugflow-molstar-plugin-0.3.77.js +0 -2
- package/build/drugflow-molstar-plugin-0.3.77.js.LICENSE.txt +0 -39
- package/lib/drugflow-molstar-component-build-0.1.2.js +0 -4268
- package/lib/drugflow-molstar-component-build-0.1.2.js.map +0 -1
- package/lib/drugflow-molstar-component-build-0.1.3.js +0 -2
- package/lib/drugflow-molstar-component-build-0.1.4.js +0 -2
- package/lib/drugflow-molstar-component-build-0.1.4.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.1.5.js +0 -2
- package/lib/drugflow-molstar-component-build-0.1.5.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.1.6.js +0 -2
- package/lib/drugflow-molstar-component-build-0.1.6.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.2.10.js +0 -2
- package/lib/drugflow-molstar-component-build-0.2.10.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.2.2.js +0 -2
- package/lib/drugflow-molstar-component-build-0.2.2.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.2.3.js +0 -2
- package/lib/drugflow-molstar-component-build-0.2.3.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.2.4.js +0 -2
- package/lib/drugflow-molstar-component-build-0.2.4.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.2.5.js +0 -2
- package/lib/drugflow-molstar-component-build-0.2.5.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.2.6.js +0 -2
- package/lib/drugflow-molstar-component-build-0.2.6.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.2.7.js +0 -2
- package/lib/drugflow-molstar-component-build-0.2.7.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.2.9.js +0 -2
- package/lib/drugflow-molstar-component-build-0.2.9.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.1.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.1.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.10.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.10.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.11.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.11.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.12.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.12.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.13.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.13.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.14.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.14.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.15.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.15.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.16.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.16.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.17.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.17.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.18.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.18.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.19.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.19.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.2.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.2.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.20.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.20.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.21.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.21.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.22.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.22.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.23.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.23.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.24.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.24.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.25.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.25.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.26.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.26.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.27.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.27.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.28.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.28.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.29.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.29.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.3.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.3.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.30.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.30.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.31.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.31.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.32.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.32.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.33.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.33.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.34.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.34.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.35.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.35.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.36.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.36.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.37.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.37.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.38.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.38.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.39.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.39.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.4.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.4.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.40.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.40.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.41.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.41.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.42.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.42.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.43.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.43.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.44.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.44.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.46.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.46.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.47.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.47.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.48.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.48.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.49.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.49.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.5.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.5.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.50.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.50.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.51.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.51.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.52.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.52.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.53.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.53.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.54.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.54.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.55.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.55.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.56.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.56.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.57.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.57.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.58.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.58.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.59.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.59.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.6.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.6.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.60.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.60.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.61.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.61.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.62.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.62.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.63.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.63.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.64.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.64.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.65.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.65.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.66.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.66.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.67.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.67.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.68.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.68.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.69.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.69.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.7.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.7.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.70.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.70.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.71.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.71.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.72.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.72.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.73.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.73.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.74.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.74.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.75.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.75.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.76.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.76.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.77.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.77.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.8.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.8.js.LICENSE.txt +0 -24
- package/lib/drugflow-molstar-component-build-0.3.9.js +0 -2
- package/lib/drugflow-molstar-component-build-0.3.9.js.LICENSE.txt +0 -24
- package/lib/index2.d.ts +0 -1
- package/lib/index2.js +0 -1369
- package/lib/pdbe-molstar-component-build-3.1.2.js +0 -2
- package/lib/pdbe-molstar-component-build-3.1.2.js.LICENSE.txt +0 -24
- /package/lib/{drugflow-molstar-component-build-0.1.2.js.LICENSE.txt → drugflow-molstar-component-build-0.3.78.js.LICENSE.txt} +0 -0
- /package/lib/{drugflow-molstar-component-build-0.1.3.js.LICENSE.txt → drugflow-molstar-component-build-0.4.1.js.LICENSE.txt} +0 -0
package/lib/ui/segment-tree.js
CHANGED
|
@@ -1,602 +1,475 @@
|
|
|
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
|
-
|
|
28
|
-
_this.getSegmentParams = function () {
|
|
29
|
-
var customState = _this.customState;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const commands_1 = require("Molstar/mol-plugin/commands");
|
|
7
|
+
const mol_state_1 = require("Molstar/mol-state");
|
|
8
|
+
const base_1 = require("Molstar/mol-plugin-ui/base");
|
|
9
|
+
const common_1 = require("Molstar/mol-plugin-ui/controls/common");
|
|
10
|
+
const param_definition_1 = require("Molstar/mol-util/param-definition");
|
|
11
|
+
const parameters_1 = require("Molstar/mol-plugin-ui/controls/parameters");
|
|
12
|
+
const mol_state_2 = require("Molstar/mol-state");
|
|
13
|
+
const superposition_1 = require("../superposition");
|
|
14
|
+
const update_transform_1 = require("Molstar/mol-plugin-ui/state/update-transform");
|
|
15
|
+
const icons_1 = require("Molstar/mol-plugin-ui/controls/icons");
|
|
16
|
+
const lists_1 = require("Molstar/mol-util/color/lists");
|
|
17
|
+
const color_1 = require("Molstar/mol-util/color");
|
|
18
|
+
const builder_1 = require("Molstar/mol-script/language/builder");
|
|
19
|
+
const rxjs_1 = require("rxjs");
|
|
20
|
+
const transforms_1 = require("Molstar/mol-plugin-state/transforms");
|
|
21
|
+
const superposition_2 = require("../superposition");
|
|
22
|
+
const SuperpositionTag = 'SuperpositionTransform';
|
|
23
|
+
class SegmentTree extends base_1.PurePluginUIComponent {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.getSegmentParams = () => {
|
|
27
|
+
const customState = this.customState;
|
|
30
28
|
if (!customState.superpositionState || !customState.superpositionState.segmentData)
|
|
31
29
|
return;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
const segmentData = customState.superpositionState.segmentData;
|
|
31
|
+
const segmentArr = segmentData.map((segment, i) => {
|
|
32
|
+
const segmentLabel = `${i + 1} ( ${segment.segment_start} - ${segment.segment_end} )`;
|
|
35
33
|
return [segmentLabel, segmentLabel];
|
|
36
34
|
});
|
|
37
|
-
|
|
35
|
+
const segmentOptions = {
|
|
38
36
|
segment: param_definition_1.ParamDefinition.Select('', segmentArr, { label: 'Select Segment', description: 'Select segment to view its clusters below' })
|
|
39
37
|
};
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
const segmentIndex = customState.superpositionState.activeSegment - 1;
|
|
39
|
+
this.setState({ segment: {
|
|
42
40
|
params: segmentOptions,
|
|
43
41
|
value: { segment: segmentArr[segmentIndex][0] }
|
|
44
42
|
} });
|
|
45
|
-
|
|
43
|
+
this.setState({ isBusy: false });
|
|
46
44
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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) {
|
|
45
|
+
this.updateSegment = async (val) => {
|
|
46
|
+
if (!this.state.segment)
|
|
47
|
+
return;
|
|
48
|
+
const customState = this.customState;
|
|
49
|
+
customState.events.isBusy.next(true);
|
|
50
|
+
// Hide pervious segement structures
|
|
51
|
+
this.hideStructures(customState.superpositionState.activeSegment - 1);
|
|
52
|
+
// Set current segment params
|
|
53
|
+
const updatedParams = { ...this.state.segment };
|
|
54
|
+
updatedParams.value = val;
|
|
55
|
+
this.setState({ segment: updatedParams });
|
|
56
|
+
setTimeout(async () => {
|
|
57
|
+
const updatedSegmentIndex = parseInt(val.segment.split(' ')[0]);
|
|
58
|
+
customState.superpositionState.activeSegment = updatedSegmentIndex;
|
|
59
|
+
// Display current segment visible structures
|
|
60
|
+
await this.displayStructures(customState.superpositionState.activeSegment - 1);
|
|
61
|
+
customState.events.isBusy.next(false);
|
|
62
|
+
this.plugin.customState.events.segmentUpdate.next(true);
|
|
63
|
+
}, 100);
|
|
64
|
+
return false;
|
|
65
|
+
};
|
|
66
|
+
this.hideStructures = (segmentIndex) => {
|
|
82
67
|
// clear selections
|
|
83
|
-
|
|
68
|
+
this.plugin.managers.interactivity.lociSelects.deselectAll();
|
|
84
69
|
// clear Focus
|
|
85
|
-
|
|
70
|
+
this.plugin.managers.structure.focus.clear();
|
|
86
71
|
// remove measurements
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
measureTypes.forEach(
|
|
72
|
+
const measurements = this.plugin.managers.structure.measurement.state;
|
|
73
|
+
const measureTypes = ['labels', 'distances', 'angles', 'dihedrals'];
|
|
74
|
+
let measurementCell = void 0;
|
|
75
|
+
measureTypes.forEach((type) => {
|
|
91
76
|
if (measurementCell)
|
|
92
77
|
return;
|
|
93
78
|
if (measurements[type][0]) {
|
|
94
|
-
measurementCell =
|
|
79
|
+
measurementCell = this.plugin.state.data.cells.get(measurements[type][0].transform.parent);
|
|
95
80
|
}
|
|
96
81
|
});
|
|
97
82
|
if (measurementCell) {
|
|
98
|
-
commands_1.PluginCommands.State.RemoveObject(
|
|
83
|
+
commands_1.PluginCommands.State.RemoveObject(this.plugin, { state: measurementCell.parent, ref: measurementCell.transform.parent, removeParentGhosts: true });
|
|
99
84
|
}
|
|
100
85
|
// hide structures
|
|
101
|
-
|
|
86
|
+
const customState = this.customState;
|
|
102
87
|
customState.superpositionState.visibleRefs[segmentIndex] = [];
|
|
103
|
-
for (
|
|
104
|
-
|
|
105
|
-
var structRef = _this.customState.superpositionState.models[struct];
|
|
88
|
+
for (const struct of customState.superpositionState.loadedStructs[segmentIndex]) {
|
|
89
|
+
const structRef = this.customState.superpositionState.models[struct];
|
|
106
90
|
if (structRef) {
|
|
107
|
-
|
|
91
|
+
const structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(structRef);
|
|
108
92
|
if (structHierarchy && structHierarchy.components) {
|
|
109
|
-
for (
|
|
110
|
-
var c = _c[_b];
|
|
93
|
+
for (const c of structHierarchy.components) {
|
|
111
94
|
if (c && c.cell && !c.cell.state.isHidden) {
|
|
112
95
|
customState.superpositionState.visibleRefs[segmentIndex].push(c.cell.transform.ref);
|
|
113
|
-
commands_1.PluginCommands.State.ToggleVisibility(
|
|
96
|
+
commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
|
|
114
97
|
}
|
|
115
98
|
}
|
|
116
99
|
}
|
|
117
100
|
}
|
|
118
101
|
}
|
|
119
102
|
if (customState.superpositionState.alphafold.ref) {
|
|
120
|
-
|
|
103
|
+
const afStr = this.plugin.managers.structure.hierarchy.current.refs.get(customState.superpositionState.alphafold.ref);
|
|
121
104
|
if (afStr && afStr.components) {
|
|
122
|
-
for (
|
|
123
|
-
var c = _e[_d];
|
|
105
|
+
for (const c of afStr.components) {
|
|
124
106
|
if (c && c.cell && !c.cell.state.isHidden) {
|
|
125
|
-
commands_1.PluginCommands.State.ToggleVisibility(
|
|
107
|
+
commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
|
|
126
108
|
}
|
|
127
109
|
}
|
|
128
110
|
}
|
|
129
111
|
}
|
|
130
112
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
var cell = _this.plugin.state.data.cells.get(structRef);
|
|
151
|
-
var isHidden = cell.state.isHidden ? true : false;
|
|
152
|
-
if (isHidden) {
|
|
153
|
-
commands_1.PluginCommands.State.ToggleVisibility(_this.plugin, { state: cell.parent, ref: structRef });
|
|
154
|
-
// PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent!, ref: cell.transform.parent });
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
loadStrs_1.push(str);
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
163
|
-
if (!(loadStrs_1.length > 0)) return [3 /*break*/, 2];
|
|
164
|
-
return [4 /*yield*/, (0, superposition_1.renderSuperposition)(this.plugin, segmentIndex, loadStrs_1)];
|
|
165
|
-
case 1:
|
|
166
|
-
_d.sent();
|
|
167
|
-
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
168
|
-
_d.label = 2;
|
|
169
|
-
case 2: return [3 /*break*/, 4];
|
|
170
|
-
case 3:
|
|
171
|
-
for (_i = 0, _a = customState.superpositionState.visibleRefs[segmentIndex]; _i < _a.length; _i++) {
|
|
172
|
-
ref = _a[_i];
|
|
173
|
-
cell = this.plugin.state.data.cells.get(ref);
|
|
174
|
-
if (cell && cell.state.isHidden) {
|
|
175
|
-
commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: ref });
|
|
113
|
+
this.displayStructures = async (segmentIndex) => {
|
|
114
|
+
const customState = this.customState;
|
|
115
|
+
const spState = customState.superpositionState;
|
|
116
|
+
if (customState.superpositionState.visibleRefs[segmentIndex].length === 0) {
|
|
117
|
+
let loadStrs = [];
|
|
118
|
+
customState.superpositionState.segmentData[segmentIndex].clusters.forEach((cluster) => {
|
|
119
|
+
let entryList = [cluster[0]];
|
|
120
|
+
if (customState.initParams.superpositionParams && customState.initParams.superpositionParams.superposeAll) {
|
|
121
|
+
entryList = cluster;
|
|
122
|
+
}
|
|
123
|
+
entryList.forEach((str) => {
|
|
124
|
+
const structStateId = `${str.pdb_id}_${str.struct_asym_id}`;
|
|
125
|
+
const structRef = customState.superpositionState.models[structStateId];
|
|
126
|
+
if (structRef) {
|
|
127
|
+
const cell = this.plugin.state.data.cells.get(structRef);
|
|
128
|
+
const isHidden = cell.state.isHidden ? true : false;
|
|
129
|
+
if (isHidden) {
|
|
130
|
+
commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: structRef });
|
|
131
|
+
// PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent!, ref: cell.transform.parent });
|
|
176
132
|
}
|
|
177
133
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
case 4:
|
|
181
|
-
if (spState.alphafold.ref) {
|
|
182
|
-
(0, superposition_2.superposeAf)(this.plugin, spState.alphafold.traceOnly);
|
|
183
|
-
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
134
|
+
else {
|
|
135
|
+
loadStrs.push(str);
|
|
184
136
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
140
|
+
if (loadStrs.length > 0) {
|
|
141
|
+
await (0, superposition_1.renderSuperposition)(this.plugin, segmentIndex, loadStrs);
|
|
142
|
+
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
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 });
|
|
195
164
|
}
|
|
196
|
-
|
|
165
|
+
}
|
|
197
166
|
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return _this;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
201
169
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
var customState = _this.customState;
|
|
170
|
+
componentDidMount() {
|
|
171
|
+
this.subscribe(this.plugin.customState.events.superpositionInit, () => {
|
|
172
|
+
const customState = this.customState;
|
|
206
173
|
if (customState && !customState.superpositionError) {
|
|
207
|
-
|
|
174
|
+
this.getSegmentParams();
|
|
208
175
|
}
|
|
209
|
-
|
|
176
|
+
this.forceUpdate();
|
|
210
177
|
});
|
|
211
|
-
this.subscribe(this.plugin.customState.events.isBusy,
|
|
212
|
-
|
|
178
|
+
this.subscribe(this.plugin.customState.events.isBusy, (e) => {
|
|
179
|
+
this.setState({ isBusy: e });
|
|
213
180
|
if (e) {
|
|
214
|
-
commands_1.PluginCommands.Toast.Show(
|
|
181
|
+
commands_1.PluginCommands.Toast.Show(this.plugin, {
|
|
215
182
|
title: 'Process',
|
|
216
183
|
message: 'Loading / computing large dataset!',
|
|
217
184
|
key: 'is-busy-toast'
|
|
218
185
|
});
|
|
219
186
|
}
|
|
220
187
|
else {
|
|
221
|
-
commands_1.PluginCommands.Toast.Hide(
|
|
188
|
+
commands_1.PluginCommands.Toast.Hide(this.plugin, { key: 'is-busy-toast' });
|
|
222
189
|
}
|
|
223
190
|
});
|
|
224
|
-
this.subscribe(this.plugin.behaviors.layout.leftPanelTabName,
|
|
191
|
+
this.subscribe(this.plugin.behaviors.layout.leftPanelTabName, (e) => {
|
|
225
192
|
if (e !== 'segments')
|
|
226
193
|
return;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
});
|
|
230
|
-
};
|
|
231
|
-
Object.defineProperty(SegmentTree.prototype, "customState", {
|
|
232
|
-
get: function () {
|
|
233
|
-
return this.plugin.customState;
|
|
234
|
-
},
|
|
235
|
-
enumerable: false,
|
|
236
|
-
configurable: true
|
|
237
|
-
});
|
|
238
|
-
SegmentTree.prototype.transform = function (s, matrix) {
|
|
239
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
240
|
-
var r, o, params, b;
|
|
241
|
-
return tslib_1.__generator(this, function (_a) {
|
|
242
|
-
switch (_a.label) {
|
|
243
|
-
case 0:
|
|
244
|
-
r = mol_state_2.StateObjectRef.resolveAndCheck(this.plugin.state.data, s);
|
|
245
|
-
if (!r)
|
|
246
|
-
return [2 /*return*/];
|
|
247
|
-
o = mol_state_2.StateSelection.findTagInSubtree(this.plugin.state.data.tree, r.transform.ref, SuperpositionTag);
|
|
248
|
-
params = {
|
|
249
|
-
transform: {
|
|
250
|
-
name: 'matrix',
|
|
251
|
-
params: { data: matrix, transpose: false }
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
b = o
|
|
255
|
-
? this.plugin.state.data.build().to(o).update(params)
|
|
256
|
-
: this.plugin.state.data.build().to(s)
|
|
257
|
-
.insert(transforms_1.StateTransforms.Model.TransformStructureConformation, params, { tags: SuperpositionTag });
|
|
258
|
-
return [4 /*yield*/, this.plugin.runTask(this.plugin.state.data.updateTree(b))];
|
|
259
|
-
case 1:
|
|
260
|
-
_a.sent();
|
|
261
|
-
return [2 /*return*/];
|
|
262
|
-
}
|
|
263
|
-
});
|
|
194
|
+
this.getSegmentParams();
|
|
195
|
+
this.forceUpdate();
|
|
264
196
|
});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
197
|
+
}
|
|
198
|
+
get customState() {
|
|
199
|
+
return this.plugin.customState;
|
|
200
|
+
}
|
|
201
|
+
async transform(s, matrix) {
|
|
202
|
+
const r = mol_state_2.StateObjectRef.resolveAndCheck(this.plugin.state.data, s);
|
|
203
|
+
if (!r)
|
|
204
|
+
return;
|
|
205
|
+
// TODO should find any TransformStructureConformation decorator instance
|
|
206
|
+
const o = mol_state_2.StateSelection.findTagInSubtree(this.plugin.state.data.tree, r.transform.ref, SuperpositionTag);
|
|
207
|
+
const params = {
|
|
208
|
+
transform: {
|
|
209
|
+
name: 'matrix',
|
|
210
|
+
params: { data: matrix, transpose: false }
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
// TODO add .insertOrUpdate to StateBuilder?
|
|
214
|
+
const b = o
|
|
215
|
+
? this.plugin.state.data.build().to(o).update(params)
|
|
216
|
+
: this.plugin.state.data.build().to(s)
|
|
217
|
+
.insert(transforms_1.StateTransforms.Model.TransformStructureConformation, params, { tags: SuperpositionTag });
|
|
218
|
+
await this.plugin.runTask(this.plugin.state.data.updateTree(b));
|
|
219
|
+
}
|
|
220
|
+
render() {
|
|
221
|
+
let sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: `Structure clusters` });
|
|
222
|
+
const customState = this.customState;
|
|
269
223
|
if (customState && customState.initParams && !customState.initParams.superposition) {
|
|
270
224
|
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", { children: "Functionality unavailable!" })] });
|
|
271
225
|
}
|
|
272
226
|
else {
|
|
273
227
|
if (customState && customState.initParams && customState.initParams.superposition) {
|
|
274
|
-
sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title:
|
|
228
|
+
sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: `Structure clusters - ${customState.initParams.moleculeId}` });
|
|
275
229
|
if (customState.superpositionError) {
|
|
276
|
-
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div",
|
|
230
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", { style: { textAlign: 'center' }, children: customState.superpositionError })] });
|
|
277
231
|
}
|
|
278
232
|
else if (!customState.superpositionState || !customState.superpositionState.segmentData) {
|
|
279
|
-
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div",
|
|
233
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [sectionHeader, (0, jsx_runtime_1.jsx)("div", { style: { textAlign: 'center' }, children: "Loading Segment Data!" })] });
|
|
280
234
|
}
|
|
281
235
|
}
|
|
282
236
|
}
|
|
283
237
|
if (this.state) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title:
|
|
288
|
-
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 }),
|
|
238
|
+
const segmentIndex = parseInt(this.state.segment.value.segment.split(' ')[0]) - 1;
|
|
239
|
+
const segmentData = customState.superpositionState.segmentData;
|
|
240
|
+
const fullSegmentRange = `( ${segmentData[0].segment_start} - ${segmentData[segmentData.length - 1].segment_end} )`;
|
|
241
|
+
sectionHeader = (0, jsx_runtime_1.jsx)(common_1.SectionHeader, { title: `Structure clusters ${customState.initParams.moleculeId}`, desc: fullSegmentRange });
|
|
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 }), segmentData[segmentIndex].clusters.map((c, i) => (0, jsx_runtime_1.jsx)(ClusterNode, { cluster: c, totalClusters: segmentData[segmentIndex].clusters.length, segmentIndex: segmentIndex, clusterIndex: i }, `cluster-${segmentIndex}-${i}`))] });
|
|
289
243
|
}
|
|
290
244
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
}(base_1.PurePluginUIComponent));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
294
247
|
exports.SegmentTree = SegmentTree;
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
_this.state = {
|
|
248
|
+
class ClusterNode extends base_1.PluginUIComponent {
|
|
249
|
+
constructor() {
|
|
250
|
+
super(...arguments);
|
|
251
|
+
this.state = {
|
|
300
252
|
isCollapsed: false,
|
|
301
253
|
showAll: false,
|
|
302
254
|
showNone: false,
|
|
303
255
|
showSearch: false,
|
|
304
256
|
isBusy: false,
|
|
305
|
-
cluster:
|
|
257
|
+
cluster: this.props.cluster,
|
|
306
258
|
searchText: ''
|
|
307
259
|
};
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
260
|
+
this.inputStream = new rxjs_1.Subject();
|
|
261
|
+
this.handleInputStream = (inputStr) => {
|
|
262
|
+
this.setState({ searchText: inputStr });
|
|
263
|
+
const filteredRes = this.props.cluster.filter((item) => {
|
|
312
264
|
return item.pdb_id.toLowerCase().indexOf(inputStr.toLowerCase()) >= 0;
|
|
313
265
|
});
|
|
314
|
-
|
|
266
|
+
this.setState({ cluster: filteredRes });
|
|
315
267
|
};
|
|
316
|
-
|
|
268
|
+
this.toggleExpanded = (e) => {
|
|
317
269
|
e.preventDefault();
|
|
318
|
-
|
|
270
|
+
this.setState({ isCollapsed: !this.state.isCollapsed });
|
|
319
271
|
e.currentTarget.blur();
|
|
320
272
|
};
|
|
321
|
-
|
|
273
|
+
this.selectAll = (e) => {
|
|
322
274
|
e.preventDefault();
|
|
323
|
-
|
|
275
|
+
this.setState({ showAll: !this.state.showAll, showNone: false });
|
|
324
276
|
e.currentTarget.blur();
|
|
325
277
|
};
|
|
326
|
-
|
|
278
|
+
this.selectNone = (e) => {
|
|
327
279
|
e.preventDefault();
|
|
328
|
-
|
|
280
|
+
this.setState({ showAll: false, showNone: !this.state.showNone });
|
|
329
281
|
e.currentTarget.blur();
|
|
330
282
|
};
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
case 3:
|
|
355
|
-
if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 8];
|
|
356
|
-
str = _b.value;
|
|
357
|
-
structStateId = "".concat(str.pdb_id, "_").concat(str.struct_asym_id);
|
|
358
|
-
structRef = undefined;
|
|
359
|
-
if (customState && customState.superpositionState && customState.superpositionState.models[structStateId]) {
|
|
360
|
-
structRef = this.customState.superpositionState.models[structStateId];
|
|
361
|
-
}
|
|
362
|
-
if (!structRef) return [3 /*break*/, 6];
|
|
363
|
-
cell = this.plugin.state.data.cells.get(structRef);
|
|
364
|
-
if (!cell) return [3 /*break*/, 5];
|
|
365
|
-
isHidden = cell.state.isHidden ? true : false;
|
|
366
|
-
if (!((isHidden && currentState.showAll) || (!isHidden && currentState.showNone))) return [3 /*break*/, 5];
|
|
367
|
-
return [4 /*yield*/, commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: structRef })];
|
|
368
|
-
case 4:
|
|
369
|
-
_d.sent();
|
|
370
|
-
_d.label = 5;
|
|
371
|
-
case 5: return [3 /*break*/, 7];
|
|
372
|
-
case 6:
|
|
373
|
-
if (currentState.showAll)
|
|
374
|
-
loadStrs.push(str);
|
|
375
|
-
_d.label = 7;
|
|
376
|
-
case 7: return [3 /*break*/, 2];
|
|
377
|
-
case 8: return [3 /*break*/, 15];
|
|
378
|
-
case 9:
|
|
379
|
-
e_1_1 = _d.sent();
|
|
380
|
-
e_1 = { error: e_1_1 };
|
|
381
|
-
return [3 /*break*/, 15];
|
|
382
|
-
case 10:
|
|
383
|
-
_d.trys.push([10, , 13, 14]);
|
|
384
|
-
if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 12];
|
|
385
|
-
return [4 /*yield*/, _c.call(_a)];
|
|
386
|
-
case 11:
|
|
387
|
-
_d.sent();
|
|
388
|
-
_d.label = 12;
|
|
389
|
-
case 12: return [3 /*break*/, 14];
|
|
390
|
-
case 13:
|
|
391
|
-
if (e_1) throw e_1.error;
|
|
392
|
-
return [7 /*endfinally*/];
|
|
393
|
-
case 14: return [7 /*endfinally*/];
|
|
394
|
-
case 15:
|
|
395
|
-
;
|
|
396
|
-
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
397
|
-
if (!(loadStrs.length > 0)) return [3 /*break*/, 17];
|
|
398
|
-
return [4 /*yield*/, (0, superposition_1.renderSuperposition)(this.plugin, this.props.segmentIndex, loadStrs)];
|
|
399
|
-
case 16:
|
|
400
|
-
_d.sent();
|
|
401
|
-
_d.label = 17;
|
|
402
|
-
case 17:
|
|
403
|
-
customState.events.isBusy.next(false);
|
|
404
|
-
return [2 /*return*/];
|
|
283
|
+
this.applyAction = async (e) => {
|
|
284
|
+
e.preventDefault();
|
|
285
|
+
e.currentTarget.blur();
|
|
286
|
+
const customState = this.customState;
|
|
287
|
+
customState.events.isBusy.next(true);
|
|
288
|
+
const currentState = { ...this.state };
|
|
289
|
+
this.setState({ showAll: false, showNone: false });
|
|
290
|
+
setTimeout(async () => {
|
|
291
|
+
let loadStrs = [];
|
|
292
|
+
for await (const str of this.state.cluster) {
|
|
293
|
+
const structStateId = `${str.pdb_id}_${str.struct_asym_id}`;
|
|
294
|
+
let structRef = undefined;
|
|
295
|
+
if (customState && customState.superpositionState && customState.superpositionState.models[structStateId]) {
|
|
296
|
+
structRef = this.customState.superpositionState.models[structStateId];
|
|
297
|
+
}
|
|
298
|
+
if (structRef) {
|
|
299
|
+
const cell = this.plugin.state.data.cells.get(structRef);
|
|
300
|
+
if (cell) {
|
|
301
|
+
const isHidden = cell.state.isHidden ? true : false;
|
|
302
|
+
if ((isHidden && currentState.showAll) || (!isHidden && currentState.showNone)) {
|
|
303
|
+
await commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: structRef });
|
|
304
|
+
// await PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent!, ref: cell.transform.parent });
|
|
305
|
+
}
|
|
405
306
|
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
if (currentState.showAll)
|
|
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);
|
|
409
319
|
});
|
|
410
|
-
}
|
|
411
|
-
|
|
320
|
+
};
|
|
321
|
+
this.cancelAction = (e) => {
|
|
412
322
|
e.preventDefault();
|
|
413
|
-
|
|
323
|
+
this.setState({ showAll: false, showNone: false });
|
|
414
324
|
e.currentTarget.blur();
|
|
415
325
|
};
|
|
416
|
-
|
|
326
|
+
this.clearSearch = (e) => {
|
|
417
327
|
e.preventDefault();
|
|
418
|
-
|
|
419
|
-
|
|
328
|
+
this.setState({ searchText: '' });
|
|
329
|
+
this.inputStream.next('');
|
|
420
330
|
e.currentTarget.blur();
|
|
421
331
|
};
|
|
422
|
-
return _this;
|
|
423
332
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
_this.setState({ isBusy: e, showAll: false, showNone: false });
|
|
333
|
+
componentDidMount() {
|
|
334
|
+
this.subscribe(this.plugin.customState.events.isBusy, (e) => {
|
|
335
|
+
this.setState({ isBusy: e, showAll: false, showNone: false });
|
|
428
336
|
});
|
|
429
|
-
this.subscribe(this.inputStream.pipe((0, operators_1.debounceTime)(1000 / 24)),
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
configurable: true
|
|
437
|
-
});
|
|
438
|
-
ClusterNode.prototype.render = function () {
|
|
439
|
-
var _this = this;
|
|
440
|
-
var customState = this.customState;
|
|
337
|
+
this.subscribe(this.inputStream.pipe((0, operators_1.debounceTime)(1000 / 24)), (e) => this.handleInputStream(e));
|
|
338
|
+
}
|
|
339
|
+
get customState() {
|
|
340
|
+
return this.plugin.customState;
|
|
341
|
+
}
|
|
342
|
+
render() {
|
|
343
|
+
const customState = this.customState;
|
|
441
344
|
if (!customState.superpositionState || !customState.superpositionState.segmentData)
|
|
442
345
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
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",
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
457
|
-
_this.state = {
|
|
346
|
+
const 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' });
|
|
347
|
+
const title = `Segment ${customState.superpositionState.activeSegment} Cluster ${this.props.clusterIndex + 1}`;
|
|
348
|
+
const 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 ? `${this.state.cluster.length} / ` : '', this.props.cluster.length, " chain", this.props.cluster.length > 1 ? 's' : ''] })] });
|
|
349
|
+
const 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" })] });
|
|
350
|
+
const 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] });
|
|
351
|
+
const 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: e => 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' })] });
|
|
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: `msp-control-row msp-transform-header-brand-${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 ? `${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((s, i) => (0, jsx_runtime_1.jsx)(StructureNode, { segmentIndex: this.props.segmentIndex, structure: s, isRep: i === 0 ? true : false }, `str-${s.pdb_id}${s.struct_asym_id}${i}`)) })] });
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
class StructureNode extends base_1.PluginUIComponent {
|
|
356
|
+
constructor() {
|
|
357
|
+
super(...arguments);
|
|
358
|
+
this.state = {
|
|
458
359
|
showControls: false,
|
|
459
360
|
isBusy: false,
|
|
460
361
|
isProcessing: false,
|
|
461
362
|
isHidden: true,
|
|
462
363
|
};
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
for (_i = 0, _a = structHierarchy.components; _i < _a.length; _i++) {
|
|
475
|
-
c = _a[_i];
|
|
476
|
-
currentHiddenState = c.cell.state.isHidden ? true : false;
|
|
477
|
-
if (currentHiddenState === this.state.isHidden) {
|
|
478
|
-
commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
this.setState({ isHidden: !this.state.isHidden });
|
|
364
|
+
this.toggleVisible = async (e) => {
|
|
365
|
+
e.preventDefault();
|
|
366
|
+
e.currentTarget.blur();
|
|
367
|
+
this.setState({ isProcessing: true, showControls: false });
|
|
368
|
+
if (this.ref) {
|
|
369
|
+
const structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
|
|
370
|
+
if (structHierarchy && structHierarchy.components) {
|
|
371
|
+
for (const c of structHierarchy.components) {
|
|
372
|
+
const currentHiddenState = c.cell.state.isHidden ? true : false;
|
|
373
|
+
if (currentHiddenState === this.state.isHidden) {
|
|
374
|
+
commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: c.cell.parent, ref: c.cell.transform.ref });
|
|
482
375
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
case 2:
|
|
486
|
-
_b.sent();
|
|
487
|
-
_b.label = 3;
|
|
488
|
-
case 3:
|
|
489
|
-
this.setState({ isProcessing: false });
|
|
490
|
-
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
491
|
-
return [2 /*return*/];
|
|
376
|
+
}
|
|
377
|
+
this.setState({ isHidden: !this.state.isHidden });
|
|
492
378
|
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
await (0, superposition_1.renderSuperposition)(this.plugin, this.props.segmentIndex, [this.props.structure]);
|
|
382
|
+
}
|
|
383
|
+
this.setState({ isProcessing: false });
|
|
384
|
+
commands_1.PluginCommands.Camera.Reset(this.plugin);
|
|
385
|
+
};
|
|
386
|
+
this.selectAction = item => {
|
|
496
387
|
if (!item)
|
|
497
388
|
return;
|
|
498
|
-
|
|
499
|
-
(item
|
|
389
|
+
this.setState({ showControls: false });
|
|
390
|
+
(item?.value)();
|
|
500
391
|
};
|
|
501
|
-
|
|
392
|
+
this.highlight = (e) => {
|
|
502
393
|
e.preventDefault();
|
|
503
|
-
if (
|
|
504
|
-
|
|
505
|
-
commands_1.PluginCommands.Interactivity.Object.Highlight(
|
|
394
|
+
if (this.ref) {
|
|
395
|
+
const cell = this.plugin.state.data.cells.get(this.ref);
|
|
396
|
+
commands_1.PluginCommands.Interactivity.Object.Highlight(this.plugin, { state: cell.parent, ref: this.ref });
|
|
506
397
|
}
|
|
507
398
|
e.currentTarget.blur();
|
|
508
399
|
};
|
|
509
|
-
|
|
400
|
+
this.clearHighlight = (e) => {
|
|
510
401
|
e.preventDefault();
|
|
511
|
-
commands_1.PluginCommands.Interactivity.ClearHighlights(
|
|
402
|
+
commands_1.PluginCommands.Interactivity.ClearHighlights(this.plugin);
|
|
512
403
|
e.currentTarget.blur();
|
|
513
404
|
};
|
|
514
|
-
|
|
405
|
+
this.toggleControls = (e) => {
|
|
515
406
|
e.preventDefault();
|
|
516
|
-
|
|
407
|
+
this.setState({ showControls: !this.state.showControls });
|
|
517
408
|
e.currentTarget.blur();
|
|
518
409
|
};
|
|
519
|
-
return _this;
|
|
520
410
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
enumerable: false,
|
|
550
|
-
configurable: true
|
|
551
|
-
});
|
|
552
|
-
Object.defineProperty(StructureNode.prototype, "isAllHidden", {
|
|
553
|
-
get: function () {
|
|
554
|
-
var isHidden = true;
|
|
555
|
-
if (this.ref) {
|
|
556
|
-
var structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
|
|
557
|
-
if (structHierarchy && structHierarchy.components) {
|
|
558
|
-
for (var _i = 0, _a = structHierarchy.components; _i < _a.length; _i++) {
|
|
559
|
-
var c = _a[_i];
|
|
560
|
-
if (c && c.cell && !c.cell.state.isHidden) {
|
|
561
|
-
isHidden = false;
|
|
562
|
-
break;
|
|
563
|
-
}
|
|
411
|
+
get customState() {
|
|
412
|
+
return this.plugin.customState;
|
|
413
|
+
}
|
|
414
|
+
get ref() {
|
|
415
|
+
if (this.customState && this.customState.superpositionState && this.customState.superpositionState.models[`${this.props.structure.pdb_id}_${this.props.structure.struct_asym_id}`]) {
|
|
416
|
+
return this.customState.superpositionState.models[`${this.props.structure.pdb_id}_${this.props.structure.struct_asym_id}`];
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
return undefined;
|
|
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;
|
|
564
439
|
}
|
|
565
440
|
}
|
|
566
|
-
else {
|
|
567
|
-
isHidden = false;
|
|
568
|
-
}
|
|
569
441
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
442
|
+
else {
|
|
443
|
+
isHidden = false;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return isHidden;
|
|
447
|
+
}
|
|
448
|
+
checkRelation(ref) {
|
|
449
|
+
let isRelated = false;
|
|
450
|
+
const cell = this.plugin.state.data.cells.get(ref);
|
|
578
451
|
if (cell && cell.transform.parent) {
|
|
579
452
|
if (cell && cell.transform.parent === this.ref) {
|
|
580
453
|
isRelated = true;
|
|
581
454
|
}
|
|
582
455
|
else {
|
|
583
|
-
|
|
456
|
+
const pcell = this.plugin.state.data.cells.get(cell.transform.parent);
|
|
584
457
|
if (pcell && pcell.transform.parent === this.ref)
|
|
585
458
|
isRelated = true;
|
|
586
459
|
}
|
|
587
460
|
}
|
|
588
461
|
else {
|
|
589
|
-
|
|
462
|
+
const currentNodeCell = this.plugin.state.data.cells.get(this.ref);
|
|
590
463
|
if (currentNodeCell && currentNodeCell.transform.parent === cell.transform.parent) {
|
|
591
464
|
isRelated = true;
|
|
592
465
|
}
|
|
593
466
|
}
|
|
594
467
|
return isRelated;
|
|
595
|
-
}
|
|
596
|
-
|
|
468
|
+
}
|
|
469
|
+
is(e) {
|
|
597
470
|
if (!this.ref)
|
|
598
471
|
return false;
|
|
599
|
-
|
|
472
|
+
let isRelated = false;
|
|
600
473
|
if (this.ref && e.ref !== this.ref) {
|
|
601
474
|
isRelated = this.checkRelation(e.ref);
|
|
602
475
|
}
|
|
@@ -604,31 +477,30 @@ var StructureNode = /** @class */ (function (_super) {
|
|
|
604
477
|
return true;
|
|
605
478
|
}
|
|
606
479
|
else {
|
|
607
|
-
|
|
480
|
+
const invalidStruct = (this.customState.superpositionState.invalidStruct.indexOf(`${this.props.structure.pdb_id}_${this.props.structure.struct_asym_id}`) > -1) ? true : false;
|
|
608
481
|
return invalidStruct ? true : false;
|
|
609
482
|
}
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
var _this = this;
|
|
483
|
+
}
|
|
484
|
+
componentDidMount() {
|
|
613
485
|
this.setState({ isHidden: this.isAllHidden });
|
|
614
|
-
this.subscribe(this.plugin.customState.events.isBusy,
|
|
615
|
-
|
|
486
|
+
this.subscribe(this.plugin.customState.events.isBusy, (e) => {
|
|
487
|
+
this.setState({ isBusy: e, showControls: false });
|
|
616
488
|
});
|
|
617
|
-
this.subscribe(this.plugin.state.events.cell.stateUpdated.pipe((0, operators_1.filter)(
|
|
618
|
-
|
|
489
|
+
this.subscribe(this.plugin.state.events.cell.stateUpdated.pipe((0, operators_1.filter)(e => this.is(e)), (0, operators_1.debounceTime)(33)), e => {
|
|
490
|
+
this.setState({ isHidden: this.isAllHidden });
|
|
619
491
|
// this.forceUpdate();
|
|
620
492
|
});
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
493
|
+
}
|
|
494
|
+
getTagRefs(tags) {
|
|
495
|
+
const TagSet = new Set(tags);
|
|
496
|
+
const tree = this.plugin.state.data.tree;
|
|
625
497
|
return mol_state_2.StateSelection.findUniqueTagsInSubtree(tree, this.modelCell.transform.ref, TagSet);
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
498
|
+
}
|
|
499
|
+
getRandomColor() {
|
|
500
|
+
const clList = lists_1.ColorLists;
|
|
501
|
+
const spState = this.plugin.customState.superpositionState;
|
|
502
|
+
let palleteIndex = spState.colorState[this.props.segmentIndex].palleteIndex;
|
|
503
|
+
let colorIndex = spState.colorState[this.props.segmentIndex].colorIndex;
|
|
632
504
|
if (clList[spState.colorPalette[palleteIndex]].list[colorIndex + 1]) {
|
|
633
505
|
colorIndex += 1;
|
|
634
506
|
}
|
|
@@ -636,169 +508,145 @@ var StructureNode = /** @class */ (function (_super) {
|
|
|
636
508
|
colorIndex = 0;
|
|
637
509
|
palleteIndex = spState.colorPalette[palleteIndex + 1] ? palleteIndex + 1 : 0;
|
|
638
510
|
}
|
|
639
|
-
|
|
511
|
+
const palleteName = spState.colorPalette[palleteIndex];
|
|
640
512
|
this.plugin.customState.superpositionState.colorState[this.props.segmentIndex].palleteIndex = palleteIndex;
|
|
641
513
|
this.plugin.customState.superpositionState.colorState[this.props.segmentIndex].colorIndex = colorIndex;
|
|
642
514
|
return clList[palleteName].list[colorIndex];
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
case 0:
|
|
650
|
-
uniformColor1 = this.getRandomColor();
|
|
651
|
-
strInstance = this.plugin.state.data.select(this.ref)[0];
|
|
652
|
-
query = builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
653
|
-
'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.label_asym_id(), this.props.structure.struct_asym_id])
|
|
654
|
-
});
|
|
655
|
-
return [4 /*yield*/, this.plugin.builders.structure.tryCreateComponentFromExpression(strInstance, query, "Chain-".concat(this.props.segmentIndex), { label: "Chain", tags: ["superposition-sel"] })];
|
|
656
|
-
case 1:
|
|
657
|
-
chainSel = _a.sent();
|
|
658
|
-
if (!chainSel) return [3 /*break*/, 3];
|
|
659
|
-
return [4 /*yield*/, this.plugin.builders.structure.representation.addRepresentation(chainSel, { type: 'cartoon', color: 'uniform', colorParams: { value: uniformColor1 } }, { tag: "superposition-visual" })];
|
|
660
|
-
case 2:
|
|
661
|
-
_a.sent();
|
|
662
|
-
_a.label = 3;
|
|
663
|
-
case 3: return [2 /*return*/];
|
|
664
|
-
}
|
|
665
|
-
});
|
|
515
|
+
}
|
|
516
|
+
async addChainRepr() {
|
|
517
|
+
const uniformColor1 = this.getRandomColor();
|
|
518
|
+
const strInstance = this.plugin.state.data.select(this.ref)[0];
|
|
519
|
+
const query = builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
520
|
+
'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.label_asym_id(), this.props.structure.struct_asym_id])
|
|
666
521
|
});
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
522
|
+
const chainSel = await this.plugin.builders.structure.tryCreateComponentFromExpression(strInstance, query, `Chain-${this.props.segmentIndex}`, { label: `Chain`, tags: [`superposition-sel`] });
|
|
523
|
+
if (chainSel) {
|
|
524
|
+
await this.plugin.builders.structure.representation.addRepresentation(chainSel, { type: 'cartoon', color: 'uniform', colorParams: { value: uniformColor1 } }, { tag: `superposition-visual` });
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
updates() {
|
|
528
|
+
const structHierarchy = this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);
|
|
671
529
|
if (structHierarchy && structHierarchy.components) {
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
structHierarchy.components.forEach(
|
|
675
|
-
|
|
676
|
-
|
|
530
|
+
const representations = [];
|
|
531
|
+
let showAddChainBtn = true;
|
|
532
|
+
structHierarchy.components.forEach((comps) => {
|
|
533
|
+
const gKeys = comps.key.split(',');
|
|
534
|
+
const cId1Arr = gKeys[0].split('-');
|
|
677
535
|
if (cId1Arr[2] === 'Chain')
|
|
678
|
-
|
|
536
|
+
showAddChainBtn = false;
|
|
679
537
|
if (comps.representations) {
|
|
680
|
-
comps.representations.forEach(
|
|
681
|
-
|
|
538
|
+
comps.representations.forEach((repr) => {
|
|
539
|
+
representations.push(repr);
|
|
682
540
|
});
|
|
683
541
|
}
|
|
684
542
|
});
|
|
685
|
-
|
|
543
|
+
const customState = this.plugin.customState;
|
|
686
544
|
if (customState.initParams && customState.initParams.superpositionParams && !customState.initParams.superpositionParams.ligandView) {
|
|
687
|
-
|
|
545
|
+
showAddChainBtn = false;
|
|
688
546
|
}
|
|
689
|
-
if (
|
|
690
|
-
return (0, jsx_runtime_1.jsxs)("div",
|
|
547
|
+
if (representations.length > 0) {
|
|
548
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-accent-offset', style: { marginLeft: '40px' }, children: [representations.length > 0 && representations.map((r, i) => (0, jsx_runtime_1.jsx)(StructureRepresentationEntry, { group: [structHierarchy], representation: r }, `${r.cell.transform.ref}-${i}`)), showAddChainBtn && (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: () => this.addChainRepr(), children: ["\u00A0\u00A0Add Chain ", this.props.structure.struct_asym_id, " Representation"] }) })] });
|
|
691
549
|
}
|
|
692
550
|
}
|
|
693
551
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
552
|
+
}
|
|
553
|
+
getSubtitle() {
|
|
554
|
+
const customState = this.plugin.customState;
|
|
555
|
+
const hetList = customState.superpositionState.hets[`${this.props.structure.pdb_id}_${this.props.structure.struct_asym_id}`];
|
|
556
|
+
let subtitle;
|
|
699
557
|
if (hetList) {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
558
|
+
const hetLimit = this.props.structure.is_representative ? 1 : 4;
|
|
559
|
+
const totalHets = hetList.length;
|
|
560
|
+
let hetStr = hetList.join(', ');
|
|
703
561
|
if (totalHets > hetLimit) {
|
|
704
562
|
hetStr = hetList.slice(0, hetLimit).join(', ');
|
|
705
|
-
hetStr +=
|
|
563
|
+
hetStr += ` + ${totalHets - hetLimit}`;
|
|
706
564
|
}
|
|
707
|
-
subtitle =
|
|
565
|
+
subtitle = ` ( ${hetStr} )`;
|
|
708
566
|
if (this.props.structure.is_representative)
|
|
709
|
-
subtitle =
|
|
567
|
+
subtitle = ` ${subtitle} ( Representative )`;
|
|
710
568
|
}
|
|
711
569
|
else if (this.props.structure.is_representative) {
|
|
712
570
|
subtitle = ' ( Representative )';
|
|
713
571
|
}
|
|
714
572
|
return subtitle;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
if (
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
panelColor = "".concat(color_1.Color.toStyle(colorList2[0]));
|
|
737
|
-
}
|
|
573
|
+
}
|
|
574
|
+
get panelColor() {
|
|
575
|
+
let panelColor = '#808080';
|
|
576
|
+
if (!this.state.isHidden) {
|
|
577
|
+
if (this.modelCell) {
|
|
578
|
+
const refs = this.getTagRefs([`superposition-visual`, `superposition-ligand-visual`]);
|
|
579
|
+
const visualRef = refs[`superposition-ligand-visual`] ? refs[`superposition-ligand-visual`] : refs[`superposition-visual`] ? refs[`superposition-visual`] : undefined;
|
|
580
|
+
if (visualRef) {
|
|
581
|
+
const visualCell = this.plugin.state.data.cells.get(visualRef);
|
|
582
|
+
if (visualCell.params && visualCell.params.values && visualCell.params.values.colorTheme) {
|
|
583
|
+
const colorTheme = visualCell.params.values.colorTheme;
|
|
584
|
+
if (colorTheme.params && colorTheme.params.value) {
|
|
585
|
+
panelColor = `${color_1.Color.toStyle(colorTheme.params.value)}`;
|
|
586
|
+
}
|
|
587
|
+
else if (colorTheme.params && colorTheme.params.palette) {
|
|
588
|
+
const colorList1 = colorTheme.params.palette.params.list.colors;
|
|
589
|
+
panelColor = `${color_1.Color.toStyle(colorList1[0])}`;
|
|
590
|
+
}
|
|
591
|
+
else if (colorTheme.params && colorTheme.params.list) {
|
|
592
|
+
const colorList2 = colorTheme.params.list.colors;
|
|
593
|
+
panelColor = `${color_1.Color.toStyle(colorList2[0])}`;
|
|
738
594
|
}
|
|
739
595
|
}
|
|
740
596
|
}
|
|
741
597
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
var subTitle = invalidStruct ? noMatrixStruct ? " Matrix not available!" : " No Ligand found!" : this.getSubtitle();
|
|
753
|
-
var strTitle = "".concat(this.props.structure.pdb_id, " chain ").concat(this.props.structure.auth_asym_id);
|
|
598
|
+
}
|
|
599
|
+
return panelColor;
|
|
600
|
+
}
|
|
601
|
+
render() {
|
|
602
|
+
const superpositionParams = this.customState.initParams.superpositionParams;
|
|
603
|
+
const strutStateId = `${this.props.structure.pdb_id}_${this.props.structure.struct_asym_id}`;
|
|
604
|
+
const invalidStruct = (this.customState.superpositionState.invalidStruct.indexOf(strutStateId) > -1) ? true : false;
|
|
605
|
+
const noMatrixStruct = (this.customState.superpositionState.noMatrixStruct.indexOf(strutStateId) > -1) ? true : false;
|
|
606
|
+
const subTitle = invalidStruct ? noMatrixStruct ? ` Matrix not available!` : ` No Ligand found!` : this.getSubtitle();
|
|
607
|
+
let strTitle = `${this.props.structure.pdb_id} chain ${this.props.structure.auth_asym_id}`;
|
|
754
608
|
if (superpositionParams && superpositionParams.ligandView) {
|
|
755
|
-
strTitle =
|
|
609
|
+
strTitle = `${this.props.structure.pdb_id} ${this.props.structure.struct_asym_id}`;
|
|
756
610
|
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
return (0, jsx_runtime_1.jsxs)("div",
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
769
|
-
_this.toggleVisible = function (e) {
|
|
611
|
+
const 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 })] });
|
|
612
|
+
const 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 });
|
|
613
|
+
const 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` });
|
|
614
|
+
const 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
|
+
return (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: '1px' }, children: [row, this.state.showControls && this.updates()] });
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
class StructureRepresentationEntry extends base_1.PurePluginUIComponent {
|
|
619
|
+
constructor() {
|
|
620
|
+
super(...arguments);
|
|
621
|
+
this.toggleVisible = (e) => {
|
|
770
622
|
e.preventDefault();
|
|
771
623
|
e.currentTarget.blur();
|
|
772
|
-
|
|
773
|
-
commands_1.PluginCommands.State.ToggleVisibility(
|
|
624
|
+
const cell = this.props.representation.cell;
|
|
625
|
+
commands_1.PluginCommands.State.ToggleVisibility(this.plugin, { state: cell.parent, ref: cell.transform.parent });
|
|
774
626
|
};
|
|
775
|
-
return _this;
|
|
776
627
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
_this.forceUpdate();
|
|
628
|
+
componentDidMount() {
|
|
629
|
+
this.subscribe(this.plugin.state.events.cell.stateUpdated, e => {
|
|
630
|
+
if (mol_state_1.State.ObjectEvent.isCell(e, this.props.representation.cell))
|
|
631
|
+
this.forceUpdate();
|
|
782
632
|
});
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
sourceLabel = "".concat(isLargeLabel ? "".concat(sourceLabel.substring(0, 28), "...") : sourceLabel);
|
|
633
|
+
}
|
|
634
|
+
render() {
|
|
635
|
+
const repr = this.props.representation.cell;
|
|
636
|
+
let label = repr.obj?.label;
|
|
637
|
+
if (repr.obj?.data.repr && repr.obj?.data.repr.label) {
|
|
638
|
+
let sourceLabel = (repr.obj?.data.repr.label.indexOf('[Focus]') >= 0) ? '[Focus]' : repr.obj?.data.repr.label;
|
|
639
|
+
const isLargeLabel = sourceLabel.length > 10 ? true : false;
|
|
640
|
+
sourceLabel = `${isLargeLabel ? `${sourceLabel.substring(0, 28)}...` : sourceLabel}`;
|
|
792
641
|
if (isLargeLabel) {
|
|
793
642
|
label = sourceLabel;
|
|
794
643
|
}
|
|
795
644
|
else {
|
|
796
|
-
label =
|
|
645
|
+
label = `${sourceLabel} ${(label && label.length < 21) ? ' - ' + label : ''}`;
|
|
797
646
|
}
|
|
798
647
|
}
|
|
799
|
-
if (
|
|
648
|
+
if (repr.obj?.data.repr && repr.obj?.data.repr.label === 'Custom Selection')
|
|
800
649
|
label = 'Custom Selection';
|
|
801
|
-
return (0, jsx_runtime_1.jsxs)("div",
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
}(base_1.PurePluginUIComponent));
|
|
650
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: 'msp-representation-entry', children: [repr.parent && (0, jsx_runtime_1.jsx)(common_1.ExpandGroup, { header: `${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' } })] });
|
|
651
|
+
}
|
|
652
|
+
}
|