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/index2.js
DELETED
|
@@ -1,1369 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var spec_1 = require("./spec");
|
|
5
|
-
var commands_1 = require("Molstar/mol-plugin/commands");
|
|
6
|
-
var mol_state_1 = require("Molstar/mol-state");
|
|
7
|
-
var loci_1 = require("Molstar/mol-model/loci");
|
|
8
|
-
var rx_event_helper_1 = require("Molstar/mol-util/rx-event-helper");
|
|
9
|
-
var helpers_1 = require("./helpers");
|
|
10
|
-
var pdbe_structure_controls_1 = require("./ui/pdbe-structure-controls");
|
|
11
|
-
var pdbe_viewport_controls_1 = require("./ui/pdbe-viewport-controls");
|
|
12
|
-
var mol_state_2 = require("Molstar/mol-state");
|
|
13
|
-
var structure_focus_representation_1 = require("Molstar/mol-plugin/behavior/dynamic/selection/structure-focus-representation");
|
|
14
|
-
var spec_2 = require("Molstar/mol-plugin/spec");
|
|
15
|
-
var transformers_1 = require("Molstar/mol-plugin/behavior/dynamic/volume-streaming/transformers");
|
|
16
|
-
var structure_representation_params_1 = require("Molstar/mol-plugin-state/helpers/structure-representation-params");
|
|
17
|
-
var subscribe_events_1 = require("./subscribe-events");
|
|
18
|
-
var pdbe_left_panel_1 = require("./ui/pdbe-left-panel");
|
|
19
|
-
var superposition_1 = require("./superposition");
|
|
20
|
-
var custom_events_1 = require("./custom-events");
|
|
21
|
-
var assets_1 = require("Molstar/mol-util/assets");
|
|
22
|
-
var config_1 = require("Molstar/mol-plugin/config");
|
|
23
|
-
var color_1 = require("Molstar/mol-util/color/color");
|
|
24
|
-
var component_1 = require("Molstar/mol-plugin-state/manager/structure/component");
|
|
25
|
-
var param_definition_1 = require("Molstar/mol-util/param-definition");
|
|
26
|
-
var behavior_1 = require("./domain-annotations/behavior");
|
|
27
|
-
var pdbe_1 = require("Molstar/extensions/pdbe");
|
|
28
|
-
var behavior_2 = require("Molstar/extensions/model-archive/quality-assessment/behavior");
|
|
29
|
-
var structure_overpaint_1 = require("Molstar/mol-plugin-state/helpers/structure-overpaint");
|
|
30
|
-
var superposition_focus_representation_1 = require("./superposition-focus-representation");
|
|
31
|
-
var superposition_viewport_1 = require("./ui/superposition-viewport");
|
|
32
|
-
var representation_1 = require("Molstar/mol-plugin/behavior/dynamic/representation");
|
|
33
|
-
var camera_1 = require("molstar/lib/mol-plugin/behavior/dynamic/camera");
|
|
34
|
-
var mp4_export_1 = require("Molstar/extensions/mp4-export");
|
|
35
|
-
var geo_export_1 = require("Molstar/extensions/geo-export");
|
|
36
|
-
var element_symbol_1 = require("Molstar/mol-theme/color/element-symbol");
|
|
37
|
-
var model_index_1 = require("Molstar/mol-plugin-state/animation/built-in/model-index");
|
|
38
|
-
var camera_spin_1 = require("Molstar/mol-plugin-state/animation/built-in/camera-spin");
|
|
39
|
-
var state_snapshots_1 = require("Molstar/mol-plugin-state/animation/built-in/state-snapshots");
|
|
40
|
-
var state_interpolation_1 = require("Molstar/mol-plugin-state/animation/built-in/state-interpolation");
|
|
41
|
-
var spin_structure_1 = require("Molstar/mol-plugin-state/animation/built-in/spin-structure");
|
|
42
|
-
var camera_rock_1 = require("Molstar/mol-plugin-state/animation/built-in/camera-rock");
|
|
43
|
-
var assembly_unwind_1 = require("Molstar/mol-plugin-state/animation/built-in/assembly-unwind");
|
|
44
|
-
var builder_1 = require("molstar/lib/mol-script/language/builder");
|
|
45
|
-
var names_1 = require("molstar/lib/mol-util/color/names");
|
|
46
|
-
var units_visual_1 = require("molstar/lib/mol-repr/structure/units-visual");
|
|
47
|
-
var param_definition_2 = require("molstar/lib/mol-util/param-definition");
|
|
48
|
-
var representation_2 = require("molstar/lib/mol-repr/structure/representation");
|
|
49
|
-
var structure_selection_query_1 = require("molstar/lib/mol-plugin-state/helpers/structure-selection-query");
|
|
50
|
-
var representation_3 = require("molstar/lib/mol-repr/representation");
|
|
51
|
-
var box_1 = require("molstar/lib/mol-geo/geometry/mesh/builder/box");
|
|
52
|
-
var mesh_builder_1 = require("molstar/lib/mol-geo/geometry/mesh/mesh-builder");
|
|
53
|
-
var linear_algebra_1 = require("molstar/lib/mol-math/linear-algebra");
|
|
54
|
-
var int_1 = require("molstar/lib/mol-data/int");
|
|
55
|
-
var location_iterator_1 = require("molstar/lib/mol-geo/util/location-iterator");
|
|
56
|
-
var location_1 = require("molstar/lib/mol-model/location");
|
|
57
|
-
var loci_2 = require("molstar/lib/mol-model/loci");
|
|
58
|
-
var structure_1 = require("molstar/lib/mol-model/structure");
|
|
59
|
-
var mol_task_1 = require("molstar/lib/mol-task");
|
|
60
|
-
var state_1 = require("molstar/lib/mol-plugin/behavior/static/state");
|
|
61
|
-
var transforms_1 = require("molstar/lib/mol-plugin-state/transforms");
|
|
62
|
-
// import { StateBuilder} from 'molstar/lib/mol-state'
|
|
63
|
-
// import { Download } from 'molstar/lib/mol-plugin-state/transforms/data'
|
|
64
|
-
require('Molstar/mol-plugin-ui/skin/dark.scss');
|
|
65
|
-
var PDBeMolstarPlugin = /** @class */ (function () {
|
|
66
|
-
function PDBeMolstarPlugin() {
|
|
67
|
-
var _this = this;
|
|
68
|
-
this._ev = rx_event_helper_1.RxEventHelper.create();
|
|
69
|
-
this.events = {
|
|
70
|
-
loadComplete: this._ev()
|
|
71
|
-
};
|
|
72
|
-
this.assemblyRef = '';
|
|
73
|
-
this.isHighlightColorUpdated = false;
|
|
74
|
-
this.isSelectedColorUpdated = false;
|
|
75
|
-
this.get_quick_querys = function (structure, pdb_string) {
|
|
76
|
-
var ligand_queries = _this.get_ligand_queries(pdb_string);
|
|
77
|
-
var chain_queries = _this.get_chain_queries(pdb_string);
|
|
78
|
-
var pocket_queries = _this.get_pocket_queries(ligand_queries, 5);
|
|
79
|
-
var water = structure_selection_query_1.StructureSelectionQueries.water;
|
|
80
|
-
return {
|
|
81
|
-
ligands: ligand_queries,
|
|
82
|
-
chains: chain_queries,
|
|
83
|
-
pockets: pocket_queries,
|
|
84
|
-
water: [water]
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
this.get_pocket_queries = function (ligand_queries, radius) {
|
|
88
|
-
// 同名的ligand_query会被合并
|
|
89
|
-
var queries = [];
|
|
90
|
-
for (var i = 0; i < ligand_queries.length; i++) {
|
|
91
|
-
var label = _this.get_ligand_query_name(ligand_queries[i]);
|
|
92
|
-
var core = builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
93
|
-
'residue-test': builder_1.MolScriptBuilder.core.set.has([builder_1.MolScriptBuilder.set.apply(builder_1.MolScriptBuilder, [label]), builder_1.MolScriptBuilder.ammp('auth_comp_id')])
|
|
94
|
-
});
|
|
95
|
-
var surrounding = builder_1.MolScriptBuilder.struct.modifier.union([
|
|
96
|
-
builder_1.MolScriptBuilder.struct.modifier.exceptBy({
|
|
97
|
-
0: builder_1.MolScriptBuilder.struct.modifier.includeSurroundings({
|
|
98
|
-
0: core,
|
|
99
|
-
radius: radius,
|
|
100
|
-
'as-whole-residues': true
|
|
101
|
-
}),
|
|
102
|
-
by: core
|
|
103
|
-
})
|
|
104
|
-
]);
|
|
105
|
-
var ligand_expand_q = (0, structure_selection_query_1.StructureSelectionQuery)('Surrounding Residues (5 \u212B) of ' + label, surrounding, {
|
|
106
|
-
description: 'Select residues within 5 \u212B of ' + label,
|
|
107
|
-
category: structure_selection_query_1.StructureSelectionCategory.Manipulate,
|
|
108
|
-
referencesCurrent: true
|
|
109
|
-
});
|
|
110
|
-
queries.push({ query: ligand_expand_q, expression: surrounding, label: label });
|
|
111
|
-
}
|
|
112
|
-
return queries;
|
|
113
|
-
};
|
|
114
|
-
this.ownResidueQuery = function (chain_name, residue_name_list, residue_id, category, priority) {
|
|
115
|
-
if (priority === void 0) {
|
|
116
|
-
priority = 0;
|
|
117
|
-
}
|
|
118
|
-
var description = '[' + residue_name_list[0] + ']|' + chain_name + ':' + residue_name_list[0] + ':' + residue_id;
|
|
119
|
-
return (0, structure_selection_query_1.StructureSelectionQuery)(description, builder_1.MolScriptBuilder.struct.modifier.union([
|
|
120
|
-
builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
121
|
-
'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.ammp('auth_asym_id'), chain_name]),
|
|
122
|
-
'residue-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.ammp('auth_seq_id'), Number(residue_id)])
|
|
123
|
-
// 'residue-test-comp': MS.core.set.has([MS.set.apply(MS, residue_name_list), MS.ammp('auth_comp_id')])
|
|
124
|
-
})
|
|
125
|
-
]), { category: category, priority: priority, description: description });
|
|
126
|
-
};
|
|
127
|
-
this.applyVisualParams = function () {
|
|
128
|
-
var TagRefs = {
|
|
129
|
-
'structure-component-static-polymer': 'polymer',
|
|
130
|
-
'structure-component-static-ligand': 'het',
|
|
131
|
-
'structure-component-static-branched': 'carbs',
|
|
132
|
-
'structure-component-static-water': 'water',
|
|
133
|
-
'structure-component-static-coarse': 'coarse',
|
|
134
|
-
'non-standard': 'nonStandard'
|
|
135
|
-
};
|
|
136
|
-
var componentGroups = _this.plugin.managers.structure.hierarchy.currentComponentGroups;
|
|
137
|
-
componentGroups.forEach(function (compGrp) {
|
|
138
|
-
var _a;
|
|
139
|
-
var compGrpIndex = compGrp.length - 1;
|
|
140
|
-
var key = compGrp[compGrpIndex].key;
|
|
141
|
-
var rm = false;
|
|
142
|
-
if (key && _this.initParams.hideStructure) {
|
|
143
|
-
var structType = TagRefs[key];
|
|
144
|
-
if (structType && ((_a = _this.initParams.hideStructure) === null || _a === void 0 ? void 0 : _a.indexOf(structType)) > -1)
|
|
145
|
-
rm = true;
|
|
146
|
-
}
|
|
147
|
-
if (rm) {
|
|
148
|
-
_this.plugin.managers.structure.hierarchy.remove([compGrp[compGrpIndex]]);
|
|
149
|
-
}
|
|
150
|
-
if (!rm && _this.initParams.visualStyle) {
|
|
151
|
-
if (compGrp[compGrpIndex] && compGrp[compGrpIndex].representations) {
|
|
152
|
-
compGrp[compGrpIndex].representations.forEach(function (rep) {
|
|
153
|
-
var currentParams = (0, structure_representation_params_1.createStructureRepresentationParams)(_this.plugin, void 0, { type: _this.initParams.visualStyle });
|
|
154
|
-
_this.plugin.managers.structure.component.updateRepresentations([compGrp[compGrpIndex]], rep, currentParams);
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
this.canvas = {
|
|
161
|
-
toggleControls: function (isVisible) {
|
|
162
|
-
if (typeof isVisible === 'undefined')
|
|
163
|
-
isVisible = !_this.plugin.layout.state.showControls;
|
|
164
|
-
commands_1.PluginCommands.Layout.Update(_this.plugin, { state: { showControls: isVisible } });
|
|
165
|
-
},
|
|
166
|
-
toggleExpanded: function (isExpanded) {
|
|
167
|
-
if (typeof isExpanded === 'undefined')
|
|
168
|
-
isExpanded = !_this.plugin.layout.state.isExpanded;
|
|
169
|
-
commands_1.PluginCommands.Layout.Update(_this.plugin, { state: { isExpanded: isExpanded } });
|
|
170
|
-
},
|
|
171
|
-
setBgColor: function (color) {
|
|
172
|
-
if (!color)
|
|
173
|
-
return;
|
|
174
|
-
_this.canvas.applySettings({ color: color });
|
|
175
|
-
},
|
|
176
|
-
applySettings: function (settings) {
|
|
177
|
-
if (!settings)
|
|
178
|
-
return;
|
|
179
|
-
var rendererParams = {};
|
|
180
|
-
if (settings.color)
|
|
181
|
-
rendererParams['backgroundColor'] = color_1.Color.fromRgb(settings.color.r, settings.color.g, settings.color.b);
|
|
182
|
-
if (settings.lighting)
|
|
183
|
-
rendererParams['style'] = { name: settings.lighting };
|
|
184
|
-
var renderer = _this.plugin.canvas3d.props.renderer;
|
|
185
|
-
commands_1.PluginCommands.Canvas3D.SetSettings(_this.plugin, { settings: { renderer: tslib_1.__assign(tslib_1.__assign({}, renderer), rendererParams) } });
|
|
186
|
-
},
|
|
187
|
-
toggleSelect: function (isSelect) {
|
|
188
|
-
_this.plugin.selectionMode = !isSelect;
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
this.visual = {
|
|
192
|
-
highlight: function (params) {
|
|
193
|
-
var loci = _this.getLociForParams(params.data, params.structureNumber);
|
|
194
|
-
if (loci_1.Loci.isEmpty(loci))
|
|
195
|
-
return;
|
|
196
|
-
if (params.color) {
|
|
197
|
-
_this.visual.setColor({ highlight: params.color });
|
|
198
|
-
}
|
|
199
|
-
_this.plugin.managers.interactivity.lociHighlights.highlightOnly({ loci: loci });
|
|
200
|
-
if (params.focus)
|
|
201
|
-
_this.plugin.managers.camera.focusLoci(loci);
|
|
202
|
-
},
|
|
203
|
-
clearHighlight: function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
204
|
-
return tslib_1.__generator(this, function (_a) {
|
|
205
|
-
this.plugin.managers.interactivity.lociHighlights.highlightOnly({ loci: loci_1.EmptyLoci });
|
|
206
|
-
if (this.isHighlightColorUpdated)
|
|
207
|
-
this.visual.reset({ highlightColor: true });
|
|
208
|
-
return [2 /*return*/];
|
|
209
|
-
});
|
|
210
|
-
}); },
|
|
211
|
-
hideSelect: function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
212
|
-
var sel, components, _i, sel_1, s;
|
|
213
|
-
return tslib_1.__generator(this, function (_a) {
|
|
214
|
-
switch (_a.label) {
|
|
215
|
-
case 0:
|
|
216
|
-
sel = this.plugin.managers.structure.hierarchy.getStructuresWithSelection();
|
|
217
|
-
components = [];
|
|
218
|
-
for (_i = 0, sel_1 = sel; _i < sel_1.length; _i++) {
|
|
219
|
-
s = sel_1[_i];
|
|
220
|
-
components.push.apply(components, s.components);
|
|
221
|
-
}
|
|
222
|
-
if (components.length === 0)
|
|
223
|
-
return [2 /*return*/];
|
|
224
|
-
return [4 /*yield*/, this.plugin.managers.structure.component.modifyByCurrentSelection(components, 'subtract')];
|
|
225
|
-
case 1:
|
|
226
|
-
_a.sent();
|
|
227
|
-
return [2 /*return*/];
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
}); },
|
|
231
|
-
showSelect: function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
232
|
-
var sel, components, _i, sel_1, s;
|
|
233
|
-
return tslib_1.__generator(this, function (_a) {
|
|
234
|
-
switch (_a.label) {
|
|
235
|
-
case 0:
|
|
236
|
-
sel = this.plugin.managers.structure.hierarchy.getStructuresWithSelection();
|
|
237
|
-
console.log('sel', sel);
|
|
238
|
-
console.log('sele', this.plugin.managers.structure.hierarchy.selection);
|
|
239
|
-
components = [];
|
|
240
|
-
for (_i = 0, sel_1 = sel; _i < sel_1.length; _i++) {
|
|
241
|
-
s = sel_1[_i];
|
|
242
|
-
components.push.apply(components, s.components);
|
|
243
|
-
}
|
|
244
|
-
if (components.length === 0)
|
|
245
|
-
return [2 /*return*/];
|
|
246
|
-
return [4 /*yield*/, this.plugin.managers.structure.component.modifyByCurrentSelection(components, 'union')];
|
|
247
|
-
case 1:
|
|
248
|
-
_a.sent();
|
|
249
|
-
return [2 /*return*/];
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
}); },
|
|
253
|
-
changeProps: function (val) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
254
|
-
return tslib_1.__generator(this, function (_a) {
|
|
255
|
-
//todo 切换选中粒度
|
|
256
|
-
this.plugin.managers.interactivity.setProps({ granularity: val });
|
|
257
|
-
return [2 /*return*/];
|
|
258
|
-
});
|
|
259
|
-
}); },
|
|
260
|
-
select: function (params) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
261
|
-
var _a, _b, param, loci, repr, defaultParams, defaultValues, values, structures, updatedStructureData, comps, lastCompsIndex, recentRepComp, uniformColor, e_1_1;
|
|
262
|
-
var e_1, _c;
|
|
263
|
-
return tslib_1.__generator(this, function (_d) {
|
|
264
|
-
switch (_d.label) {
|
|
265
|
-
case 0:
|
|
266
|
-
_d.trys.push([0, 7, 8, 13]);
|
|
267
|
-
_a = tslib_1.__asyncValues(params.data);
|
|
268
|
-
_d.label = 1;
|
|
269
|
-
case 1: return [4 /*yield*/, _a.next()];
|
|
270
|
-
case 2:
|
|
271
|
-
if (!(_b = _d.sent(), !_b.done)) return [3 /*break*/, 6];
|
|
272
|
-
param = _b.value;
|
|
273
|
-
loci = this.getLociForParams([param], params.structureNumber);
|
|
274
|
-
if (loci_1.Loci.isEmpty(loci))
|
|
275
|
-
return [2 /*return*/];
|
|
276
|
-
// set default selection color to minimise change display
|
|
277
|
-
// this.visual.setColor({select: param.color ? param.color : { r:255, g:112, b:3}});
|
|
278
|
-
// apply selection
|
|
279
|
-
this.plugin.managers.interactivity.lociSelects.select({ loci: loci });
|
|
280
|
-
if (!(param.sideChain || param.representation)) return [3 /*break*/, 4];
|
|
281
|
-
repr = 'ball-and-stick';
|
|
282
|
-
if (param.representation)
|
|
283
|
-
repr = param.representation;
|
|
284
|
-
defaultParams = component_1.StructureComponentManager.getAddParams(this.plugin, { allowNone: false, hideSelection: true, checkExisting: true });
|
|
285
|
-
defaultValues = param_definition_1.ParamDefinition.getDefaultValues(defaultParams);
|
|
286
|
-
defaultValues.options = { label: 'selection-by-script', checkExisting: params.structureNumber ? false : true };
|
|
287
|
-
values = tslib_1.__assign(tslib_1.__assign({}, defaultValues), { representation: repr });
|
|
288
|
-
structures = this.plugin.managers.structure.hierarchy.getStructuresWithSelection();
|
|
289
|
-
return [4 /*yield*/, this.plugin.managers.structure.component.add(values, structures)];
|
|
290
|
-
case 3:
|
|
291
|
-
_d.sent();
|
|
292
|
-
// Apply uniform theme
|
|
293
|
-
if (param.representationColor) {
|
|
294
|
-
updatedStructureData = this.plugin.managers.structure.hierarchy.current.structures;
|
|
295
|
-
if (params.structureNumber) {
|
|
296
|
-
updatedStructureData = [this.plugin.managers.structure.hierarchy.current.structures[params.structureNumber - 1]];
|
|
297
|
-
}
|
|
298
|
-
comps = updatedStructureData[0].components;
|
|
299
|
-
lastCompsIndex = comps.length - 1;
|
|
300
|
-
recentRepComp = [comps[lastCompsIndex]];
|
|
301
|
-
uniformColor = param.representationColor ? this.normalizeColor(param.representationColor) : color_1.Color.fromRgb(255, 112, 3);
|
|
302
|
-
this.plugin.managers.structure.component.updateRepresentationsTheme(recentRepComp, { color: 'uniform', colorParams: { value: uniformColor } });
|
|
303
|
-
}
|
|
304
|
-
params.addedRepr = true;
|
|
305
|
-
_d.label = 4;
|
|
306
|
-
case 4:
|
|
307
|
-
// focus loci
|
|
308
|
-
if (param.focus)
|
|
309
|
-
this.plugin.managers.camera.focusLoci(loci);
|
|
310
|
-
_d.label = 5;
|
|
311
|
-
case 5: return [3 /*break*/, 1];
|
|
312
|
-
case 6: return [3 /*break*/, 13];
|
|
313
|
-
case 7:
|
|
314
|
-
e_1_1 = _d.sent();
|
|
315
|
-
e_1 = { error: e_1_1 };
|
|
316
|
-
return [3 /*break*/, 13];
|
|
317
|
-
case 8:
|
|
318
|
-
_d.trys.push([8, , 11, 12]);
|
|
319
|
-
if (!(_b && !_b.done && (_c = _a.return))) return [3 /*break*/, 10];
|
|
320
|
-
return [4 /*yield*/, _c.call(_a)];
|
|
321
|
-
case 9:
|
|
322
|
-
_d.sent();
|
|
323
|
-
_d.label = 10;
|
|
324
|
-
case 10: return [3 /*break*/, 12];
|
|
325
|
-
case 11:
|
|
326
|
-
if (e_1) throw e_1.error;
|
|
327
|
-
return [7 /*endfinally*/];
|
|
328
|
-
case 12: return [7 /*endfinally*/];
|
|
329
|
-
case 13:
|
|
330
|
-
// reset selection color
|
|
331
|
-
this.visual.reset({ selectColor: true });
|
|
332
|
-
// save selection params to optimise clear
|
|
333
|
-
this.selectedParams = params;
|
|
334
|
-
return [2 /*return*/];
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
}); },
|
|
338
|
-
clearSelection: function (structureNumber) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
339
|
-
var structIndex, selReprCells, _a, _b, c, selReprCells_1, selReprCells_1_1, selReprCell, e_2_1;
|
|
340
|
-
var e_2, _c;
|
|
341
|
-
return tslib_1.__generator(this, function (_d) {
|
|
342
|
-
switch (_d.label) {
|
|
343
|
-
case 0:
|
|
344
|
-
structIndex = structureNumber ? structureNumber - 1 : 0;
|
|
345
|
-
this.plugin.managers.interactivity.lociSelects.deselectAll();
|
|
346
|
-
// reset theme to default
|
|
347
|
-
if (this.selectedParams && this.selectedParams.nonSelectedColor) {
|
|
348
|
-
this.visual.reset({ theme: true });
|
|
349
|
-
}
|
|
350
|
-
// remove overpaints
|
|
351
|
-
return [4 /*yield*/, (0, structure_overpaint_1.clearStructureOverpaint)(this.plugin, this.plugin.managers.structure.hierarchy.current.structures[structIndex].components)];
|
|
352
|
-
case 1:
|
|
353
|
-
// remove overpaints
|
|
354
|
-
_d.sent();
|
|
355
|
-
if (!(this.selectedParams && this.selectedParams.addedRepr)) return [3 /*break*/, 15];
|
|
356
|
-
selReprCells = [];
|
|
357
|
-
for (_a = 0, _b = this.plugin.managers.structure.hierarchy.current.structures[structIndex].components; _a < _b.length; _a++) {
|
|
358
|
-
c = _b[_a];
|
|
359
|
-
if (c.cell && c.cell.params && c.cell.params.values && c.cell.params.values.label === 'selection-by-script')
|
|
360
|
-
selReprCells.push(c.cell);
|
|
361
|
-
}
|
|
362
|
-
if (!(selReprCells.length > 0)) return [3 /*break*/, 15];
|
|
363
|
-
_d.label = 2;
|
|
364
|
-
case 2:
|
|
365
|
-
_d.trys.push([2, 8, 9, 14]);
|
|
366
|
-
selReprCells_1 = tslib_1.__asyncValues(selReprCells);
|
|
367
|
-
_d.label = 3;
|
|
368
|
-
case 3: return [4 /*yield*/, selReprCells_1.next()];
|
|
369
|
-
case 4:
|
|
370
|
-
if (!(selReprCells_1_1 = _d.sent(), !selReprCells_1_1.done)) return [3 /*break*/, 7];
|
|
371
|
-
selReprCell = selReprCells_1_1.value;
|
|
372
|
-
return [4 /*yield*/, commands_1.PluginCommands.State.RemoveObject(this.plugin, { state: selReprCell.parent, ref: selReprCell.transform.ref })];
|
|
373
|
-
case 5:
|
|
374
|
-
_d.sent();
|
|
375
|
-
_d.label = 6;
|
|
376
|
-
case 6: return [3 /*break*/, 3];
|
|
377
|
-
case 7: return [3 /*break*/, 14];
|
|
378
|
-
case 8:
|
|
379
|
-
e_2_1 = _d.sent();
|
|
380
|
-
e_2 = { error: e_2_1 };
|
|
381
|
-
return [3 /*break*/, 14];
|
|
382
|
-
case 9:
|
|
383
|
-
_d.trys.push([9, , 12, 13]);
|
|
384
|
-
if (!(selReprCells_1_1 && !selReprCells_1_1.done && (_c = selReprCells_1.return))) return [3 /*break*/, 11];
|
|
385
|
-
return [4 /*yield*/, _c.call(selReprCells_1)];
|
|
386
|
-
case 10:
|
|
387
|
-
_d.sent();
|
|
388
|
-
_d.label = 11;
|
|
389
|
-
case 11: return [3 /*break*/, 13];
|
|
390
|
-
case 12:
|
|
391
|
-
if (e_2) throw e_2.error;
|
|
392
|
-
return [7 /*endfinally*/];
|
|
393
|
-
case 13: return [7 /*endfinally*/];
|
|
394
|
-
case 14:
|
|
395
|
-
;
|
|
396
|
-
_d.label = 15;
|
|
397
|
-
case 15:
|
|
398
|
-
this.selectedParams = undefined;
|
|
399
|
-
return [2 /*return*/];
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
}); },
|
|
403
|
-
update: function (options, fullLoad) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
404
|
-
var param, settings, dataSource;
|
|
405
|
-
return tslib_1.__generator(this, function (_a) {
|
|
406
|
-
if (!options)
|
|
407
|
-
return [2 /*return*/];
|
|
408
|
-
// for(let param in this.initParams){
|
|
409
|
-
// if(options[param]) this.initParams[param] = options[param];
|
|
410
|
-
// }
|
|
411
|
-
this.initParams = tslib_1.__assign({}, spec_1.DefaultParams);
|
|
412
|
-
for (param in spec_1.DefaultParams) {
|
|
413
|
-
if (typeof options[param] !== 'undefined')
|
|
414
|
-
this.initParams[param] = options[param];
|
|
415
|
-
}
|
|
416
|
-
if (!this.initParams.moleculeId && !this.initParams.customData)
|
|
417
|
-
return [2 /*return*/, false];
|
|
418
|
-
if (this.initParams.customData && this.initParams.customData.url && !this.initParams.customData.format)
|
|
419
|
-
return [2 /*return*/, false];
|
|
420
|
-
this.plugin.customState.initParams = this.initParams;
|
|
421
|
-
// Set background colour
|
|
422
|
-
if (this.initParams.bgColor || this.initParams.lighting) {
|
|
423
|
-
settings = {};
|
|
424
|
-
if (this.initParams.bgColor)
|
|
425
|
-
settings.color = this.initParams.bgColor;
|
|
426
|
-
if (this.initParams.lighting)
|
|
427
|
-
settings.lighting = this.initParams.lighting;
|
|
428
|
-
this.canvas.applySettings(settings);
|
|
429
|
-
}
|
|
430
|
-
dataSource = this.getMoleculeSrcUrl();
|
|
431
|
-
if (dataSource) {
|
|
432
|
-
this.load({ url: dataSource.url, format: dataSource.format, assemblyId: this.initParams.assemblyId, isBinary: dataSource.isBinary }, fullLoad);
|
|
433
|
-
}
|
|
434
|
-
return [2 /*return*/];
|
|
435
|
-
});
|
|
436
|
-
}); },
|
|
437
|
-
visibility: function (data) {
|
|
438
|
-
if (!data)
|
|
439
|
-
return;
|
|
440
|
-
var refMap = {
|
|
441
|
-
polymer: 'structure-component-static-polymer',
|
|
442
|
-
het: 'structure-component-static-ligand',
|
|
443
|
-
water: 'structure-component-static-water',
|
|
444
|
-
carbs: 'structure-component-static-branched',
|
|
445
|
-
maps: 'volume-streaming-info'
|
|
446
|
-
};
|
|
447
|
-
for (var visual in data) {
|
|
448
|
-
var tagName = refMap[visual];
|
|
449
|
-
var componentRef = mol_state_2.StateSelection.findTagInSubtree(_this.plugin.state.data.tree, mol_state_1.StateTransform.RootRef, tagName);
|
|
450
|
-
if (componentRef) {
|
|
451
|
-
var compVisual = _this.plugin.state.data.select(componentRef)[0];
|
|
452
|
-
if (compVisual && compVisual.obj) {
|
|
453
|
-
var currentlyVisible = (compVisual.state && compVisual.state.isHidden) ? false : true;
|
|
454
|
-
if (data[visual] !== currentlyVisible) {
|
|
455
|
-
commands_1.PluginCommands.State.ToggleVisibility(_this.plugin, { state: _this.state, ref: componentRef });
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
},
|
|
461
|
-
toggleSpin: function (isSpinning, resetCamera) {
|
|
462
|
-
if (!_this.plugin.canvas3d)
|
|
463
|
-
return;
|
|
464
|
-
var trackball = _this.plugin.canvas3d.props.trackball;
|
|
465
|
-
var toggleSpinParam = trackball.animate.name === 'spin' ? { name: 'off', params: {} } : { name: 'spin', params: { speed: 1 } };
|
|
466
|
-
if (typeof isSpinning !== 'undefined') {
|
|
467
|
-
toggleSpinParam = { name: 'off', params: {} };
|
|
468
|
-
if (isSpinning)
|
|
469
|
-
toggleSpinParam = { name: 'spin', params: { speed: 1 } };
|
|
470
|
-
}
|
|
471
|
-
commands_1.PluginCommands.Canvas3D.SetSettings(_this.plugin, { settings: { trackball: tslib_1.__assign(tslib_1.__assign({}, trackball), { animate: toggleSpinParam }) } });
|
|
472
|
-
if (resetCamera)
|
|
473
|
-
commands_1.PluginCommands.Camera.Reset(_this.plugin, {});
|
|
474
|
-
},
|
|
475
|
-
focus: function (params, structureNumber) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
476
|
-
var loci;
|
|
477
|
-
return tslib_1.__generator(this, function (_a) {
|
|
478
|
-
loci = this.getLociForParams(params, structureNumber);
|
|
479
|
-
this.plugin.managers.camera.focusLoci(loci);
|
|
480
|
-
return [2 /*return*/];
|
|
481
|
-
});
|
|
482
|
-
}); },
|
|
483
|
-
setColor: function (param) {
|
|
484
|
-
if (!_this.plugin.canvas3d)
|
|
485
|
-
return;
|
|
486
|
-
var renderer = _this.plugin.canvas3d.props.renderer;
|
|
487
|
-
var rParam = {};
|
|
488
|
-
if (param.highlight)
|
|
489
|
-
rParam['highlightColor'] = _this.normalizeColor(param.highlight);
|
|
490
|
-
if (param.select)
|
|
491
|
-
rParam['selectColor'] = _this.normalizeColor(param.select);
|
|
492
|
-
commands_1.PluginCommands.Canvas3D.SetSettings(_this.plugin, { settings: { renderer: tslib_1.__assign(tslib_1.__assign({}, renderer), rParam) } });
|
|
493
|
-
if (rParam.highlightColor)
|
|
494
|
-
_this.isHighlightColorUpdated = true;
|
|
495
|
-
},
|
|
496
|
-
reset: function (params) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
497
|
-
var defaultTheme_1, componentGroups, renderer, rParam;
|
|
498
|
-
var _this = this;
|
|
499
|
-
return tslib_1.__generator(this, function (_a) {
|
|
500
|
-
switch (_a.label) {
|
|
501
|
-
case 0:
|
|
502
|
-
if (!params.camera) return [3 /*break*/, 2];
|
|
503
|
-
return [4 /*yield*/, commands_1.PluginCommands.Camera.Reset(this.plugin, { durationMs: 250 })];
|
|
504
|
-
case 1:
|
|
505
|
-
_a.sent();
|
|
506
|
-
_a.label = 2;
|
|
507
|
-
case 2:
|
|
508
|
-
if (params.theme) {
|
|
509
|
-
defaultTheme_1 = { color: this.initParams.alphafoldView ? 'plddt-confidence' : 'default' };
|
|
510
|
-
componentGroups = this.plugin.managers.structure.hierarchy.currentComponentGroups;
|
|
511
|
-
componentGroups.forEach(function (compGrp) {
|
|
512
|
-
_this.plugin.managers.structure.component.updateRepresentationsTheme(compGrp, defaultTheme_1);
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
if (params.highlightColor || params.selectColor) {
|
|
516
|
-
if (!this.plugin.canvas3d)
|
|
517
|
-
return [2 /*return*/];
|
|
518
|
-
renderer = this.plugin.canvas3d.props.renderer;
|
|
519
|
-
rParam = {};
|
|
520
|
-
if (params.highlightColor)
|
|
521
|
-
rParam['highlightColor'] = this.defaultRendererProps.highlightColor;
|
|
522
|
-
if (params.selectColor)
|
|
523
|
-
rParam['selectColor'] = this.defaultRendererProps.selectColor;
|
|
524
|
-
commands_1.PluginCommands.Canvas3D.SetSettings(this.plugin, { settings: { renderer: tslib_1.__assign(tslib_1.__assign({}, renderer), rParam) } });
|
|
525
|
-
if (rParam.highlightColor)
|
|
526
|
-
this.isHighlightColorUpdated = false;
|
|
527
|
-
}
|
|
528
|
-
return [2 /*return*/];
|
|
529
|
-
}
|
|
530
|
-
});
|
|
531
|
-
}); }
|
|
532
|
-
};
|
|
533
|
-
this.ArbitrarySphereVisuals = {
|
|
534
|
-
'arbitrary-sphere': function (ctx, getParams) { return (0, representation_2.UnitsRepresentation)('Arbitrary sphere mesh', ctx, getParams, _this.ArbitrarySphereVisual); }
|
|
535
|
-
};
|
|
536
|
-
this.ArbitrarySphereParams = tslib_1.__assign(tslib_1.__assign({}, units_visual_1.UnitsMeshParams), { x: param_definition_2.ParamDefinition.Numeric(0), y: param_definition_2.ParamDefinition.Numeric(0), z: param_definition_2.ParamDefinition.Numeric(0), l1: param_definition_2.ParamDefinition.Numeric(1), l2: param_definition_2.ParamDefinition.Numeric(1), l3: param_definition_2.ParamDefinition.Numeric(1) });
|
|
537
|
-
this.ArbitrarySphereVisual = function (materialId) {
|
|
538
|
-
return (0, units_visual_1.UnitsMeshVisual)({
|
|
539
|
-
defaultProps: param_definition_2.ParamDefinition.getDefaultValues(_this.ArbitrarySphereParams),
|
|
540
|
-
createGeometry: _this.createArbitrarySphereMesh,
|
|
541
|
-
createLocationIterator: function (structureGroup) {
|
|
542
|
-
return (0, location_iterator_1.LocationIterator)(1, structureGroup.group.units.length, 1, function () { return location_1.NullLocation; });
|
|
543
|
-
},
|
|
544
|
-
getLoci: function (pickingId, structureGroup, id) {
|
|
545
|
-
var objectId = pickingId.objectId;
|
|
546
|
-
if (objectId !== id)
|
|
547
|
-
return loci_1.EmptyLoci;
|
|
548
|
-
return (0, loci_2.DataLoci)('arbitrary-sphere-data-loci', void 0, [0], void 0, function () { return "Yo, I'm a sphere!"; });
|
|
549
|
-
},
|
|
550
|
-
eachLocation: function (loci, structureGroup, apply) {
|
|
551
|
-
if (loci.kind === 'data-loci' && loci.tag === 'arbitrary-sphere-data-loci') {
|
|
552
|
-
return apply(int_1.Interval.ofBounds(0, 1));
|
|
553
|
-
}
|
|
554
|
-
return false;
|
|
555
|
-
},
|
|
556
|
-
setUpdateState: function (state, newProps, currentProps) {
|
|
557
|
-
state.createGeometry = (newProps.x !== currentProps.x ||
|
|
558
|
-
newProps.y !== currentProps.y ||
|
|
559
|
-
newProps.z !== currentProps.z ||
|
|
560
|
-
newProps.l1 !== currentProps.l1 ||
|
|
561
|
-
newProps.l2 !== currentProps.l2 ||
|
|
562
|
-
newProps.l3 !== currentProps.l3);
|
|
563
|
-
}
|
|
564
|
-
}, materialId);
|
|
565
|
-
};
|
|
566
|
-
this.ConfalPyramidsRepresentation = function (ctx, getParams) {
|
|
567
|
-
return representation_3.Representation.createMulti('Confal Pyramids', ctx, getParams, representation_2.StructureRepresentationStateBuilder, _this.ArbitrarySphereVisuals);
|
|
568
|
-
};
|
|
569
|
-
this.ArbitrarySphereRepresentationProvider = (0, representation_2.StructureRepresentationProvider)({
|
|
570
|
-
name: 'arbitrary-sphere',
|
|
571
|
-
label: 'Arbitrary sphere',
|
|
572
|
-
description: 'Displays an arbitrary sphere at given coordinates',
|
|
573
|
-
factory: this.ConfalPyramidsRepresentation,
|
|
574
|
-
getParams: function (ctx, structure) { return param_definition_2.ParamDefinition.clone(_this.ArbitrarySphereParams); },
|
|
575
|
-
defaultValues: param_definition_2.ParamDefinition.getDefaultValues(this.ArbitrarySphereParams),
|
|
576
|
-
defaultColorTheme: { name: 'uniform' },
|
|
577
|
-
defaultSizeTheme: { name: 'uniform' },
|
|
578
|
-
isApplicable: function (structure) { return true; }
|
|
579
|
-
});
|
|
580
|
-
this.createArbitrarySphereMesh = function (ctx, unit, structure, theme, props, mesh) {
|
|
581
|
-
var mb = mesh_builder_1.MeshBuilder.createState(16, 16, mesh);
|
|
582
|
-
mb.currentGroup = 0;
|
|
583
|
-
var min = (0, linear_algebra_1.Vec3)();
|
|
584
|
-
var max = (0, linear_algebra_1.Vec3)();
|
|
585
|
-
min[0] = props.x - (props.l1 / 2);
|
|
586
|
-
min[1] = props.y - (props.l2 / 2);
|
|
587
|
-
min[2] = props.z - (props.l3 / 2);
|
|
588
|
-
max[0] = props.x + (props.l1 / 2);
|
|
589
|
-
max[1] = props.y + (props.l2 / 2);
|
|
590
|
-
max[2] = props.z + (props.l3 / 2);
|
|
591
|
-
// addSphere(mb, position, props.radius, 2)
|
|
592
|
-
(0, box_1.addBoundingBox)(mb, { min: min, max: max }, 0.1, 1, 1);
|
|
593
|
-
return mesh_builder_1.MeshBuilder.getMesh(mb);
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
PDBeMolstarPlugin.prototype.render = function (target, options) {
|
|
597
|
-
var _a;
|
|
598
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
599
|
-
var param, defaultPDBeSpec, pdbePluginSpec, _b, settings, dataSource;
|
|
600
|
-
return tslib_1.__generator(this, function (_c) {
|
|
601
|
-
switch (_c.label) {
|
|
602
|
-
case 0:
|
|
603
|
-
if (!options)
|
|
604
|
-
return [2 /*return*/];
|
|
605
|
-
this.initParams = tslib_1.__assign({}, spec_1.DefaultParams);
|
|
606
|
-
for (param in spec_1.DefaultParams) {
|
|
607
|
-
if (typeof options[param] !== 'undefined')
|
|
608
|
-
this.initParams[param] = options[param];
|
|
609
|
-
}
|
|
610
|
-
defaultPDBeSpec = (0, spec_1.DefaultPluginUISpec)();
|
|
611
|
-
pdbePluginSpec = {
|
|
612
|
-
actions: tslib_1.__spreadArray([], defaultPDBeSpec.actions || [], true),
|
|
613
|
-
behaviors: tslib_1.__spreadArray([], defaultPDBeSpec.behaviors, true),
|
|
614
|
-
animations: tslib_1.__spreadArray([], defaultPDBeSpec.animations || [], true),
|
|
615
|
-
customParamEditors: defaultPDBeSpec.customParamEditors,
|
|
616
|
-
config: defaultPDBeSpec.config
|
|
617
|
-
};
|
|
618
|
-
if (!this.initParams.ligandView && !this.initParams.superposition && this.initParams.selectInteraction) {
|
|
619
|
-
pdbePluginSpec.behaviors.push(spec_2.PluginSpec.Behavior(structure_focus_representation_1.StructureFocusRepresentation));
|
|
620
|
-
}
|
|
621
|
-
if (this.initParams.superposition) {
|
|
622
|
-
pdbePluginSpec.behaviors.push(spec_2.PluginSpec.Behavior(superposition_focus_representation_1.SuperpositionFocusRepresentation), spec_2.PluginSpec.Behavior(behavior_2.MAQualityAssessment, { autoAttach: true, showTooltip: true }));
|
|
623
|
-
}
|
|
624
|
-
// Add custom properties
|
|
625
|
-
if (this.initParams.domainAnnotation) {
|
|
626
|
-
pdbePluginSpec.behaviors.push(spec_2.PluginSpec.Behavior(behavior_1.PDBeDomainAnnotations, { autoAttach: true, showTooltip: false }));
|
|
627
|
-
}
|
|
628
|
-
if (this.initParams.validationAnnotation) {
|
|
629
|
-
pdbePluginSpec.behaviors.push(spec_2.PluginSpec.Behavior(pdbe_1.PDBeStructureQualityReport, { autoAttach: true, showTooltip: false }));
|
|
630
|
-
}
|
|
631
|
-
pdbePluginSpec.layout = {
|
|
632
|
-
initial: {
|
|
633
|
-
isExpanded: this.initParams.landscape ? false : this.initParams.expanded,
|
|
634
|
-
showControls: !this.initParams.hideControls
|
|
635
|
-
}
|
|
636
|
-
};
|
|
637
|
-
pdbePluginSpec.components = {
|
|
638
|
-
controls: {
|
|
639
|
-
left: pdbe_left_panel_1.LeftPanelControls,
|
|
640
|
-
// right: DefaultStructureTools,
|
|
641
|
-
top: 'none',
|
|
642
|
-
bottom: 'none'
|
|
643
|
-
},
|
|
644
|
-
viewport: {
|
|
645
|
-
controls: pdbe_viewport_controls_1.PDBeViewportControls,
|
|
646
|
-
view: this.initParams.superposition ? superposition_viewport_1.SuperpostionViewport : void 0
|
|
647
|
-
},
|
|
648
|
-
remoteState: 'none',
|
|
649
|
-
structureTools: this.initParams.superposition ? pdbe_structure_controls_1.PDBeSuperpositionStructureTools : this.initParams.ligandView ? pdbe_structure_controls_1.PDBeLigandViewStructureTools : pdbe_structure_controls_1.PDBeStructureTools
|
|
650
|
-
};
|
|
651
|
-
if (this.initParams.alphafoldView) {
|
|
652
|
-
pdbePluginSpec.behaviors.push(spec_2.PluginSpec.Behavior(behavior_2.MAQualityAssessment, { autoAttach: true, showTooltip: true }));
|
|
653
|
-
}
|
|
654
|
-
if (this.initParams.sequencePanel) {
|
|
655
|
-
if ((_a = pdbePluginSpec.components.controls) === null || _a === void 0 ? void 0 : _a.top)
|
|
656
|
-
delete pdbePluginSpec.components.controls.top;
|
|
657
|
-
}
|
|
658
|
-
pdbePluginSpec.config = [
|
|
659
|
-
[
|
|
660
|
-
config_1.PluginConfig.Structure.DefaultRepresentationPresetParams,
|
|
661
|
-
{
|
|
662
|
-
theme: {
|
|
663
|
-
globalName: (this.initParams.alphafoldView) ? 'plddt-confidence' : undefined,
|
|
664
|
-
carbonColor: { name: 'element-symbol', params: {} },
|
|
665
|
-
focus: {
|
|
666
|
-
name: 'element-symbol',
|
|
667
|
-
params: { carbonColor: { name: 'element-symbol', params: {} } }
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
]
|
|
672
|
-
];
|
|
673
|
-
element_symbol_1.ElementSymbolColorThemeParams.carbonColor.defaultValue = { name: 'element-symbol', params: {} };
|
|
674
|
-
// Add animation props
|
|
675
|
-
if (!this.initParams.ligandView && !this.initParams.superposition) {
|
|
676
|
-
pdbePluginSpec['animations'] = [model_index_1.AnimateModelIndex, camera_spin_1.AnimateCameraSpin, camera_rock_1.AnimateCameraRock, state_snapshots_1.AnimateStateSnapshots, assembly_unwind_1.AnimateAssemblyUnwind, spin_structure_1.AnimateStructureSpin, state_interpolation_1.AnimateStateInterpolation];
|
|
677
|
-
pdbePluginSpec.behaviors.push(spec_2.PluginSpec.Behavior(mp4_export_1.Mp4Export));
|
|
678
|
-
pdbePluginSpec.behaviors.push(spec_2.PluginSpec.Behavior(geo_export_1.GeometryExport));
|
|
679
|
-
}
|
|
680
|
-
if (this.initParams.hideCanvasControls) {
|
|
681
|
-
if (this.initParams.hideCanvasControls.indexOf('expand') > -1)
|
|
682
|
-
pdbePluginSpec.config.push([config_1.PluginConfig.Viewport.ShowExpand, false]);
|
|
683
|
-
if (this.initParams.hideCanvasControls.indexOf('selection') > -1)
|
|
684
|
-
pdbePluginSpec.config.push([config_1.PluginConfig.Viewport.ShowSelectionMode, false]);
|
|
685
|
-
if (this.initParams.hideCanvasControls.indexOf('animation') > -1)
|
|
686
|
-
pdbePluginSpec.config.push([config_1.PluginConfig.Viewport.ShowAnimation, false]);
|
|
687
|
-
}
|
|
688
|
-
;
|
|
689
|
-
if (this.initParams.landscape && pdbePluginSpec.layout && pdbePluginSpec.layout.initial)
|
|
690
|
-
pdbePluginSpec.layout.initial['controlsDisplay'] = 'landscape';
|
|
691
|
-
if (this.initParams.reactive && pdbePluginSpec.layout && pdbePluginSpec.layout.initial)
|
|
692
|
-
pdbePluginSpec.layout.initial['controlsDisplay'] = 'reactive';
|
|
693
|
-
// override default event bindings
|
|
694
|
-
if (this.initParams.selectBindings) {
|
|
695
|
-
pdbePluginSpec.behaviors.push(spec_2.PluginSpec.Behavior(representation_1.SelectLoci, { bindings: this.initParams.selectBindings }));
|
|
696
|
-
}
|
|
697
|
-
if (this.initParams.focusBindings) {
|
|
698
|
-
pdbePluginSpec.behaviors.push(spec_2.PluginSpec.Behavior(camera_1.FocusLoci, { bindings: this.initParams.focusBindings }));
|
|
699
|
-
}
|
|
700
|
-
this.targetElement = typeof target === 'string' ? document.getElementById(target) : target;
|
|
701
|
-
// Create/ Initialise Plugin
|
|
702
|
-
_b = this;
|
|
703
|
-
return [4 /*yield*/, (0, spec_1.createPluginUI)(this.targetElement, pdbePluginSpec)];
|
|
704
|
-
case 1:
|
|
705
|
-
// Create/ Initialise Plugin
|
|
706
|
-
_b.plugin = _c.sent();
|
|
707
|
-
this.plugin.customState.initParams = tslib_1.__assign({}, this.initParams);
|
|
708
|
-
this.plugin.customState.events = {
|
|
709
|
-
segmentUpdate: this._ev(),
|
|
710
|
-
superpositionInit: this._ev(),
|
|
711
|
-
isBusy: this._ev()
|
|
712
|
-
};
|
|
713
|
-
// Set background colour
|
|
714
|
-
if (this.initParams.bgColor || this.initParams.lighting) {
|
|
715
|
-
settings = {};
|
|
716
|
-
if (this.initParams.bgColor)
|
|
717
|
-
settings.color = this.initParams.bgColor;
|
|
718
|
-
if (this.initParams.lighting)
|
|
719
|
-
settings.lighting = this.initParams.lighting;
|
|
720
|
-
this.canvas.applySettings(settings);
|
|
721
|
-
}
|
|
722
|
-
// Set selection granularity
|
|
723
|
-
if (this.initParams.granularity) {
|
|
724
|
-
this.plugin.managers.interactivity.setProps({ granularity: this.initParams.granularity });
|
|
725
|
-
}
|
|
726
|
-
// Set default highlight and selection colors
|
|
727
|
-
if (this.initParams.highlightColor || this.initParams.selectColor) {
|
|
728
|
-
this.visual.setColor({ highlight: this.initParams.highlightColor, select: this.initParams.selectColor });
|
|
729
|
-
}
|
|
730
|
-
// Save renderer defaults
|
|
731
|
-
this.defaultRendererProps = tslib_1.__assign({}, this.plugin.canvas3d.props.renderer);
|
|
732
|
-
if (this.initParams.superposition) {
|
|
733
|
-
// Set left panel tab
|
|
734
|
-
this.plugin.behaviors.layout.leftPanelTabName.next('segments');
|
|
735
|
-
// Initialise superposition
|
|
736
|
-
(0, superposition_1.initSuperposition)(this.plugin);
|
|
737
|
-
}
|
|
738
|
-
else {
|
|
739
|
-
// Collapse left panel and set left panel tab to none
|
|
740
|
-
commands_1.PluginCommands.Layout.Update(this.plugin, { state: { regionState: tslib_1.__assign(tslib_1.__assign({}, this.plugin.layout.state.regionState), { left: 'collapsed' }) } });
|
|
741
|
-
this.plugin.behaviors.layout.leftPanelTabName.next('none');
|
|
742
|
-
dataSource = this.getMoleculeSrcUrl();
|
|
743
|
-
if (dataSource) {
|
|
744
|
-
this.load({ url: dataSource.url, format: dataSource.format, assemblyId: this.initParams.assemblyId, isBinary: dataSource.isBinary, pdb_string: dataSource.pdb_string });
|
|
745
|
-
}
|
|
746
|
-
// Binding to other PDB Component events
|
|
747
|
-
if (this.initParams.subscribeEvents) {
|
|
748
|
-
(0, subscribe_events_1.subscribeToComponentEvents)(this);
|
|
749
|
-
}
|
|
750
|
-
// Event handling
|
|
751
|
-
custom_events_1.CustomEvents.add(this.plugin, this.targetElement);
|
|
752
|
-
}
|
|
753
|
-
this.plugin.representation.structure.registry.add(this.ArbitrarySphereRepresentationProvider);
|
|
754
|
-
return [4 /*yield*/, this.plugin.init()];
|
|
755
|
-
case 2:
|
|
756
|
-
_c.sent();
|
|
757
|
-
return [2 /*return*/];
|
|
758
|
-
}
|
|
759
|
-
});
|
|
760
|
-
});
|
|
761
|
-
};
|
|
762
|
-
PDBeMolstarPlugin.prototype.getMoleculeSrcUrl = function () {
|
|
763
|
-
var supportedFormats = ['mmcif', 'pdb', 'sdf'];
|
|
764
|
-
var id = this.initParams.moleculeId;
|
|
765
|
-
// if(!id && !this.initParams.customData){
|
|
766
|
-
// throw new Error(`Mandatory parameters missing!`);
|
|
767
|
-
// }
|
|
768
|
-
var query = 'full';
|
|
769
|
-
var sep = '?';
|
|
770
|
-
if (this.initParams.ligandView) {
|
|
771
|
-
var queryParams = ['data_source=pdb-h'];
|
|
772
|
-
if (!this.initParams.ligandView.label_comp_id_list) {
|
|
773
|
-
if (this.initParams.ligandView.label_comp_id) {
|
|
774
|
-
queryParams.push('label_comp_id=' + this.initParams.ligandView.label_comp_id);
|
|
775
|
-
}
|
|
776
|
-
else if (this.initParams.ligandView.auth_seq_id) {
|
|
777
|
-
queryParams.push('auth_seq_id=' + this.initParams.ligandView.auth_seq_id);
|
|
778
|
-
}
|
|
779
|
-
if (this.initParams.ligandView.auth_asym_id)
|
|
780
|
-
queryParams.push('auth_asym_id=' + this.initParams.ligandView.auth_asym_id);
|
|
781
|
-
}
|
|
782
|
-
query = 'residueSurroundings?' + queryParams.join('&');
|
|
783
|
-
sep = '&';
|
|
784
|
-
}
|
|
785
|
-
var url = "".concat(this.initParams.pdbeUrl, "model-server/v1/").concat(id, "/").concat(query).concat(sep, "encoding=").concat(this.initParams.encoding).concat(this.initParams.lowPrecisionCoords ? '&lowPrecisionCoords=1' : '');
|
|
786
|
-
var isBinary = this.initParams.encoding === 'bcif' ? true : false;
|
|
787
|
-
var format = 'mmcif';
|
|
788
|
-
var pdb_string = undefined;
|
|
789
|
-
if (this.initParams.customData) {
|
|
790
|
-
if (!this.initParams.customData.url && !this.initParams.customData.pdb_string) {
|
|
791
|
-
throw new Error("Provide all custom data parameters");
|
|
792
|
-
}
|
|
793
|
-
if (!this.initParams.customData.format) {
|
|
794
|
-
throw new Error("Provide all custom data parameters");
|
|
795
|
-
}
|
|
796
|
-
url = this.initParams.customData.url;
|
|
797
|
-
format = this.initParams.customData.format;
|
|
798
|
-
if (format === 'cif' || format === 'bcif')
|
|
799
|
-
format = 'mmcif';
|
|
800
|
-
// Validate supported format
|
|
801
|
-
if (supportedFormats.indexOf(format) === -1) {
|
|
802
|
-
throw new Error("".concat(format, " not supported."));
|
|
803
|
-
}
|
|
804
|
-
pdb_string = this.initParams.customData.pdb_string;
|
|
805
|
-
isBinary = this.initParams.customData.binary ? this.initParams.customData.binary : false;
|
|
806
|
-
}
|
|
807
|
-
else {
|
|
808
|
-
console.log('no custom data');
|
|
809
|
-
return undefined;
|
|
810
|
-
}
|
|
811
|
-
return {
|
|
812
|
-
url: url,
|
|
813
|
-
format: format,
|
|
814
|
-
isBinary: isBinary,
|
|
815
|
-
pdb_string: pdb_string
|
|
816
|
-
};
|
|
817
|
-
};
|
|
818
|
-
Object.defineProperty(PDBeMolstarPlugin.prototype, "state", {
|
|
819
|
-
get: function () {
|
|
820
|
-
return this.plugin.state.data;
|
|
821
|
-
},
|
|
822
|
-
enumerable: false,
|
|
823
|
-
configurable: true
|
|
824
|
-
});
|
|
825
|
-
PDBeMolstarPlugin.prototype.add_mouse_event = function (func) {
|
|
826
|
-
this.plugin.behaviors.interaction.click.subscribe(function (e) {
|
|
827
|
-
func(e);
|
|
828
|
-
});
|
|
829
|
-
};
|
|
830
|
-
PDBeMolstarPlugin.prototype.add_shape = function (structure, params) {
|
|
831
|
-
// params: {x: -10, y: -11, z: 10, radius: 8}
|
|
832
|
-
Object.assign(params, { color: names_1.ColorNames.orange });
|
|
833
|
-
return this.plugin.builders.structure.representation.addRepresentation(structure, {
|
|
834
|
-
type: 'arbitrary-sphere',
|
|
835
|
-
typeParams: params,
|
|
836
|
-
colorParams: { value: params.color }
|
|
837
|
-
});
|
|
838
|
-
};
|
|
839
|
-
PDBeMolstarPlugin.prototype.remove_shape = function (selector) {
|
|
840
|
-
var _a, _b;
|
|
841
|
-
selector.obj.data.repr.destroy();
|
|
842
|
-
(_a = this.plugin.canvas3d) === null || _a === void 0 ? void 0 : _a.remove(selector.obj.data.repr);
|
|
843
|
-
(_b = this.plugin.canvas3d) === null || _b === void 0 ? void 0 : _b.update();
|
|
844
|
-
};
|
|
845
|
-
PDBeMolstarPlugin.prototype.get_ligand_queries = function (pdb_string) {
|
|
846
|
-
var ligand_info_list = this.parse_ligand_info(pdb_string);
|
|
847
|
-
var queries = [];
|
|
848
|
-
try {
|
|
849
|
-
for (var i = 0; i < ligand_info_list.length; i++) {
|
|
850
|
-
queries.push(this.ownResidueQuery(ligand_info_list[i].chain_name, [ligand_info_list[i].residue_name], ligand_info_list[i].residue_id, 'Ligand/Non-standard Residue', 200));
|
|
851
|
-
}
|
|
852
|
-
return queries;
|
|
853
|
-
}
|
|
854
|
-
catch (e) {
|
|
855
|
-
console.error('e', e);
|
|
856
|
-
}
|
|
857
|
-
};
|
|
858
|
-
PDBeMolstarPlugin.prototype.ownChainQuery = function (chain_name, category, priority) {
|
|
859
|
-
if (priority === void 0) {
|
|
860
|
-
priority = 0;
|
|
861
|
-
}
|
|
862
|
-
var description = chain_name;
|
|
863
|
-
var res_names = ['ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLN', 'GLU', 'GLY', 'HIS', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'VAL'];
|
|
864
|
-
return (0, structure_selection_query_1.StructureSelectionQuery)(description, builder_1.MolScriptBuilder.struct.modifier.union([
|
|
865
|
-
builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
866
|
-
'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.ammp('auth_asym_id'), chain_name]),
|
|
867
|
-
'residue-test': builder_1.MolScriptBuilder.core.set.has([builder_1.MolScriptBuilder.set.apply(builder_1.MolScriptBuilder, res_names), builder_1.MolScriptBuilder.ammp('auth_comp_id')])
|
|
868
|
-
}),
|
|
869
|
-
]), { category: category, priority: priority, description: description });
|
|
870
|
-
};
|
|
871
|
-
PDBeMolstarPlugin.prototype.get_chain_queries = function (pdb_string) {
|
|
872
|
-
var chain_info_list = this.parse_chain_info(pdb_string);
|
|
873
|
-
var queries = [];
|
|
874
|
-
try {
|
|
875
|
-
for (var i = 0; i < chain_info_list.length; i++) {
|
|
876
|
-
queries.push(this.ownChainQuery(chain_info_list[i].chain_main_name, 'Chain', 200));
|
|
877
|
-
}
|
|
878
|
-
return queries;
|
|
879
|
-
}
|
|
880
|
-
catch (e) {
|
|
881
|
-
console.error('e', e);
|
|
882
|
-
return queries;
|
|
883
|
-
}
|
|
884
|
-
};
|
|
885
|
-
PDBeMolstarPlugin.prototype.get_ligand_query_name = function (query) {
|
|
886
|
-
var label = query.label;
|
|
887
|
-
var match = label.match(/\[(.*?)\]/);
|
|
888
|
-
var extracted = match ? match[1] : null;
|
|
889
|
-
return extracted;
|
|
890
|
-
};
|
|
891
|
-
PDBeMolstarPlugin.prototype.change_repr = function (selector, params, state, comps, repr) {
|
|
892
|
-
var _a;
|
|
893
|
-
if (params === void 0) { params = undefined; }
|
|
894
|
-
if (state === void 0) { state = undefined; }
|
|
895
|
-
if (comps === void 0) { comps = undefined; }
|
|
896
|
-
if (repr === void 0) { repr = undefined; }
|
|
897
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
898
|
-
return tslib_1.__generator(this, function (_b) {
|
|
899
|
-
// let s = selector
|
|
900
|
-
console.log('s', this.plugin.managers.structure.hierarchy.current.structures, this.plugin.state);
|
|
901
|
-
// if (params) {
|
|
902
|
-
// const currentParams = createStructureRepresentationParams(this.plugin, void 0, params);
|
|
903
|
-
// await this.plugin.managers.structure.component.updateRepresentations(comps, repr, currentParams)
|
|
904
|
-
// }
|
|
905
|
-
// if (state) {
|
|
906
|
-
// s.obj.data.repr.setState(state)
|
|
907
|
-
// this.plugin.canvas3d?.update()
|
|
908
|
-
// }
|
|
909
|
-
(0, state_1.setSubtreeVisibility)(this.plugin.state.data, this.plugin.managers.structure.hierarchy.current.structures[0].components[0].cell.transform.ref, false);
|
|
910
|
-
(_a = this.plugin.canvas3d) === null || _a === void 0 ? void 0 : _a.update();
|
|
911
|
-
return [2 /*return*/];
|
|
912
|
-
});
|
|
913
|
-
});
|
|
914
|
-
};
|
|
915
|
-
PDBeMolstarPlugin.prototype.get_component_groups = function () {
|
|
916
|
-
return this.plugin.managers.structure.hierarchy.currentComponentGroups;
|
|
917
|
-
};
|
|
918
|
-
PDBeMolstarPlugin.prototype.add_repr_on_select_expression = function (structure, select_expression, label, params, comp) {
|
|
919
|
-
if (params === void 0) { params = { type: 'ball-and-stick' }; }
|
|
920
|
-
if (comp === void 0) { comp = undefined; }
|
|
921
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
922
|
-
var component, repr_selector;
|
|
923
|
-
return tslib_1.__generator(this, function (_a) {
|
|
924
|
-
switch (_a.label) {
|
|
925
|
-
case 0:
|
|
926
|
-
component = undefined;
|
|
927
|
-
if (!!comp) return [3 /*break*/, 2];
|
|
928
|
-
return [4 /*yield*/, this.plugin.builders.structure.tryCreateComponentFromExpression(structure, select_expression, label, { 'label': label })];
|
|
929
|
-
case 1:
|
|
930
|
-
component = _a.sent();
|
|
931
|
-
return [3 /*break*/, 3];
|
|
932
|
-
case 2:
|
|
933
|
-
component = comp;
|
|
934
|
-
_a.label = 3;
|
|
935
|
-
case 3: return [4 /*yield*/, this.plugin.builders.structure.representation.addRepresentation(component, params)];
|
|
936
|
-
case 4:
|
|
937
|
-
repr_selector = _a.sent();
|
|
938
|
-
return [2 /*return*/, repr_selector];
|
|
939
|
-
}
|
|
940
|
-
});
|
|
941
|
-
});
|
|
942
|
-
};
|
|
943
|
-
PDBeMolstarPlugin.prototype.highlight_and_focuson_query = function (structure, query) {
|
|
944
|
-
var _this = this;
|
|
945
|
-
var data = structure.data;
|
|
946
|
-
if (!data)
|
|
947
|
-
return;
|
|
948
|
-
this.plugin.runTask(mol_task_1.Task.create('Structure Selection', function (runtime) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
949
|
-
var selection, loci;
|
|
950
|
-
return tslib_1.__generator(this, function (_a) {
|
|
951
|
-
switch (_a.label) {
|
|
952
|
-
case 0: return [4 /*yield*/, query.getSelection(this.plugin, runtime, structure.data)];
|
|
953
|
-
case 1:
|
|
954
|
-
selection = _a.sent();
|
|
955
|
-
loci = structure_1.StructureSelection.toLociWithSourceUnits(selection);
|
|
956
|
-
this.plugin.managers.interactivity.lociHighlights.highlightOnly({ loci: loci });
|
|
957
|
-
this.plugin.managers.camera.focusLoci(loci);
|
|
958
|
-
return [2 /*return*/];
|
|
959
|
-
}
|
|
960
|
-
});
|
|
961
|
-
}); }));
|
|
962
|
-
};
|
|
963
|
-
PDBeMolstarPlugin.prototype.createLigandStructure = function (isBranched) {
|
|
964
|
-
var e_3, _a;
|
|
965
|
-
var _b;
|
|
966
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
967
|
-
var _c, _d, comp, e_3_1, structure, ligandQuery, ligandVis, ligandSurr, ligRef, cell, ligLoci;
|
|
968
|
-
var _this = this;
|
|
969
|
-
return tslib_1.__generator(this, function (_e) {
|
|
970
|
-
switch (_e.label) {
|
|
971
|
-
case 0:
|
|
972
|
-
if (this.assemblyRef === '')
|
|
973
|
-
return [2 /*return*/];
|
|
974
|
-
_e.label = 1;
|
|
975
|
-
case 1:
|
|
976
|
-
_e.trys.push([1, 7, 8, 13]);
|
|
977
|
-
_c = tslib_1.__asyncValues(this.plugin.managers.structure.hierarchy.currentComponentGroups);
|
|
978
|
-
_e.label = 2;
|
|
979
|
-
case 2: return [4 /*yield*/, _c.next()];
|
|
980
|
-
case 3:
|
|
981
|
-
if (!(_d = _e.sent(), !_d.done)) return [3 /*break*/, 6];
|
|
982
|
-
comp = _d.value;
|
|
983
|
-
return [4 /*yield*/, commands_1.PluginCommands.State.RemoveObject(this.plugin, { state: comp[0].cell.parent, ref: comp[0].cell.transform.ref, removeParentGhosts: true })];
|
|
984
|
-
case 4:
|
|
985
|
-
_e.sent();
|
|
986
|
-
_e.label = 5;
|
|
987
|
-
case 5: return [3 /*break*/, 2];
|
|
988
|
-
case 6: return [3 /*break*/, 13];
|
|
989
|
-
case 7:
|
|
990
|
-
e_3_1 = _e.sent();
|
|
991
|
-
e_3 = { error: e_3_1 };
|
|
992
|
-
return [3 /*break*/, 13];
|
|
993
|
-
case 8:
|
|
994
|
-
_e.trys.push([8, , 11, 12]);
|
|
995
|
-
if (!(_d && !_d.done && (_a = _c.return))) return [3 /*break*/, 10];
|
|
996
|
-
return [4 /*yield*/, _a.call(_c)];
|
|
997
|
-
case 9:
|
|
998
|
-
_e.sent();
|
|
999
|
-
_e.label = 10;
|
|
1000
|
-
case 10: return [3 /*break*/, 12];
|
|
1001
|
-
case 11:
|
|
1002
|
-
if (e_3) throw e_3.error;
|
|
1003
|
-
return [7 /*endfinally*/];
|
|
1004
|
-
case 12: return [7 /*endfinally*/];
|
|
1005
|
-
case 13:
|
|
1006
|
-
structure = this.state.select(this.assemblyRef)[0];
|
|
1007
|
-
if (isBranched) {
|
|
1008
|
-
ligandQuery = helpers_1.LigandView.branchedQuery((_b = this.initParams.ligandView) === null || _b === void 0 ? void 0 : _b.label_comp_id_list);
|
|
1009
|
-
}
|
|
1010
|
-
else {
|
|
1011
|
-
ligandQuery = helpers_1.LigandView.query(this.initParams.ligandView);
|
|
1012
|
-
}
|
|
1013
|
-
return [4 /*yield*/, this.plugin.builders.structure.tryCreateComponentFromExpression(structure, ligandQuery.core, 'pivot', { label: 'Ligand' })];
|
|
1014
|
-
case 14:
|
|
1015
|
-
ligandVis = _e.sent();
|
|
1016
|
-
if (!ligandVis) return [3 /*break*/, 16];
|
|
1017
|
-
return [4 /*yield*/, this.plugin.builders.structure.representation.addRepresentation(ligandVis, { type: 'ball-and-stick', color: 'element-symbol', colorParams: { carbonColor: { name: 'element-symbol', params: {} } }, size: 'uniform', sizeParams: { value: 2.5 } }, { tag: 'ligand-vis' })];
|
|
1018
|
-
case 15:
|
|
1019
|
-
_e.sent();
|
|
1020
|
-
_e.label = 16;
|
|
1021
|
-
case 16: return [4 /*yield*/, this.plugin.builders.structure.tryCreateComponentFromExpression(structure, ligandQuery.surroundings, 'rest', { label: 'Surroundings' })];
|
|
1022
|
-
case 17:
|
|
1023
|
-
ligandSurr = _e.sent();
|
|
1024
|
-
if (!ligandSurr) return [3 /*break*/, 19];
|
|
1025
|
-
return [4 /*yield*/, this.plugin.builders.structure.representation.addRepresentation(ligandSurr, { type: 'ball-and-stick', color: 'element-symbol', colorParams: { carbonColor: { name: 'element-symbol', params: {} } }, size: 'uniform', sizeParams: { value: 0.8 } })];
|
|
1026
|
-
case 18:
|
|
1027
|
-
_e.sent();
|
|
1028
|
-
_e.label = 19;
|
|
1029
|
-
case 19:
|
|
1030
|
-
ligRef = mol_state_2.StateSelection.findTagInSubtree(this.plugin.state.data.tree, mol_state_1.StateTransform.RootRef, 'ligand-vis');
|
|
1031
|
-
if (!ligRef)
|
|
1032
|
-
return [2 /*return*/];
|
|
1033
|
-
cell = this.plugin.state.data.cells.get(ligRef);
|
|
1034
|
-
if (cell) {
|
|
1035
|
-
ligLoci = cell.obj.data.repr.getLoci();
|
|
1036
|
-
this.plugin.managers.structure.focus.setFromLoci(ligLoci);
|
|
1037
|
-
setTimeout(function () {
|
|
1038
|
-
var _a;
|
|
1039
|
-
// focus-add is not handled in camera behavior, doing it here
|
|
1040
|
-
var current = (_a = _this.plugin.managers.structure.focus.current) === null || _a === void 0 ? void 0 : _a.loci;
|
|
1041
|
-
if (current)
|
|
1042
|
-
_this.plugin.managers.camera.focusLoci(current);
|
|
1043
|
-
}, 500);
|
|
1044
|
-
}
|
|
1045
|
-
return [2 /*return*/];
|
|
1046
|
-
}
|
|
1047
|
-
});
|
|
1048
|
-
});
|
|
1049
|
-
};
|
|
1050
|
-
PDBeMolstarPlugin.prototype.load = function (_a, fullLoad) {
|
|
1051
|
-
var url = _a.url, _b = _a.format, format = _b === void 0 ? 'mmcif' : _b, _c = _a.isBinary, isBinary = _c === void 0 ? false : _c, _d = _a.assemblyId, assemblyId = _d === void 0 ? '' : _d, _e = _a.pdb_string, pdb_string = _e === void 0 ? '' : _e, _f = _a.if_render, if_render = _f === void 0 ? true : _f;
|
|
1052
|
-
if (fullLoad === void 0) { fullLoad = true; }
|
|
1053
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1054
|
-
var isHetView, downloadOptions, isBranchedView, data, trajectory, _g, _h, asm, defaultMapParams, pdbeMapParams, pivotIndex, pivot;
|
|
1055
|
-
return tslib_1.__generator(this, function (_j) {
|
|
1056
|
-
switch (_j.label) {
|
|
1057
|
-
case 0:
|
|
1058
|
-
if (fullLoad)
|
|
1059
|
-
this.clear();
|
|
1060
|
-
isHetView = this.initParams.ligandView ? true : false;
|
|
1061
|
-
downloadOptions = void 0;
|
|
1062
|
-
isBranchedView = false;
|
|
1063
|
-
if (this.initParams.ligandView && this.initParams.ligandView.label_comp_id_list) {
|
|
1064
|
-
isBranchedView = true;
|
|
1065
|
-
downloadOptions = { body: JSON.stringify(this.initParams.ligandView.label_comp_id_list), headers: [['Content-type', 'application/json']] };
|
|
1066
|
-
}
|
|
1067
|
-
data = null;
|
|
1068
|
-
if (!pdb_string) return [3 /*break*/, 2];
|
|
1069
|
-
return [4 /*yield*/, this.plugin.builders.data.rawData({ data: pdb_string }, { state: { isGhost: true } })];
|
|
1070
|
-
case 1:
|
|
1071
|
-
data = _j.sent();
|
|
1072
|
-
return [3 /*break*/, 4];
|
|
1073
|
-
case 2: return [4 /*yield*/, this.plugin.builders.data.download({ url: assets_1.Asset.Url(url, downloadOptions), isBinary: isBinary }, { state: { isGhost: true } })];
|
|
1074
|
-
case 3:
|
|
1075
|
-
data = _j.sent();
|
|
1076
|
-
_j.label = 4;
|
|
1077
|
-
case 4: return [4 /*yield*/, this.plugin.builders.structure.parseTrajectory(data, format)];
|
|
1078
|
-
case 5:
|
|
1079
|
-
trajectory = _j.sent();
|
|
1080
|
-
_g = this;
|
|
1081
|
-
return [4 /*yield*/, this.plugin.builders.structure.createModel(trajectory)];
|
|
1082
|
-
case 6:
|
|
1083
|
-
_g.model = _j.sent();
|
|
1084
|
-
_h = this;
|
|
1085
|
-
return [4 /*yield*/, this.plugin.builders.structure.createStructure(this.model, { name: 'model', params: {} })];
|
|
1086
|
-
case 7:
|
|
1087
|
-
_h.structure = _j.sent();
|
|
1088
|
-
if (!if_render) return [3 /*break*/, 13];
|
|
1089
|
-
if (!!isHetView) return [3 /*break*/, 9];
|
|
1090
|
-
return [4 /*yield*/, this.plugin.builders.structure.hierarchy.applyPreset(trajectory, this.initParams.defaultPreset, {
|
|
1091
|
-
structure: assemblyId ? (assemblyId === 'preferred') ? void 0 : { name: 'assembly', params: { id: assemblyId } } : { name: 'model', params: {} },
|
|
1092
|
-
showUnitcell: false,
|
|
1093
|
-
representationPreset: 'auto'
|
|
1094
|
-
})];
|
|
1095
|
-
case 8:
|
|
1096
|
-
_j.sent();
|
|
1097
|
-
if (this.initParams.hideStructure || this.initParams.visualStyle) {
|
|
1098
|
-
this.applyVisualParams();
|
|
1099
|
-
}
|
|
1100
|
-
_j.label = 9;
|
|
1101
|
-
case 9:
|
|
1102
|
-
// show selection if param is set
|
|
1103
|
-
if (this.initParams.selection) {
|
|
1104
|
-
this.visual.select(this.initParams.selection);
|
|
1105
|
-
}
|
|
1106
|
-
if (!this.initParams.loadMaps) return [3 /*break*/, 11];
|
|
1107
|
-
if (this.assemblyRef === '')
|
|
1108
|
-
return [2 /*return*/];
|
|
1109
|
-
asm = this.state.select(this.assemblyRef)[0].obj;
|
|
1110
|
-
defaultMapParams = transformers_1.InitVolumeStreaming.createDefaultParams(asm, this.plugin);
|
|
1111
|
-
pdbeMapParams = helpers_1.PDBeVolumes.mapParams(defaultMapParams, this.initParams.mapSettings, '');
|
|
1112
|
-
if (!pdbeMapParams) return [3 /*break*/, 11];
|
|
1113
|
-
return [4 /*yield*/, this.plugin.runTask(this.state.applyAction(transformers_1.InitVolumeStreaming, pdbeMapParams, this.assemblyRef))];
|
|
1114
|
-
case 10:
|
|
1115
|
-
_j.sent();
|
|
1116
|
-
if (pdbeMapParams.method !== 'em' && !this.initParams.ligandView)
|
|
1117
|
-
helpers_1.PDBeVolumes.displayUsibilityMessage(this.plugin);
|
|
1118
|
-
_j.label = 11;
|
|
1119
|
-
case 11:
|
|
1120
|
-
if (!isHetView) return [3 /*break*/, 13];
|
|
1121
|
-
return [4 /*yield*/, this.createLigandStructure(isBranchedView)];
|
|
1122
|
-
case 12:
|
|
1123
|
-
_j.sent();
|
|
1124
|
-
_j.label = 13;
|
|
1125
|
-
case 13:
|
|
1126
|
-
pivotIndex = this.plugin.managers.structure.hierarchy.selection.structures.length - 1;
|
|
1127
|
-
pivot = this.plugin.managers.structure.hierarchy.selection.structures[pivotIndex];
|
|
1128
|
-
if (pivot && pivot.cell.parent)
|
|
1129
|
-
this.assemblyRef = pivot.cell.transform.ref;
|
|
1130
|
-
this.events.loadComplete.next(true);
|
|
1131
|
-
return [2 /*return*/];
|
|
1132
|
-
}
|
|
1133
|
-
});
|
|
1134
|
-
});
|
|
1135
|
-
};
|
|
1136
|
-
PDBeMolstarPlugin.prototype.getLociForParams = function (params, structureNumber) {
|
|
1137
|
-
var assemblyRef = this.assemblyRef;
|
|
1138
|
-
if (structureNumber) {
|
|
1139
|
-
assemblyRef = this.plugin.managers.structure.hierarchy.current.structures[structureNumber - 1].cell.transform.ref;
|
|
1140
|
-
}
|
|
1141
|
-
if (assemblyRef === '')
|
|
1142
|
-
return loci_1.EmptyLoci;
|
|
1143
|
-
var data = this.plugin.state.data.select(assemblyRef)[0].obj.data;
|
|
1144
|
-
if (!data)
|
|
1145
|
-
return loci_1.EmptyLoci;
|
|
1146
|
-
return helpers_1.QueryHelper.getInteractivityLoci(params, data);
|
|
1147
|
-
};
|
|
1148
|
-
PDBeMolstarPlugin.prototype.getLociByPLDDT = function (score, structureNumber) {
|
|
1149
|
-
var assemblyRef = this.assemblyRef;
|
|
1150
|
-
if (structureNumber) {
|
|
1151
|
-
assemblyRef = this.plugin.managers.structure.hierarchy.current.structures[structureNumber - 1].cell.transform.ref;
|
|
1152
|
-
}
|
|
1153
|
-
if (assemblyRef === '')
|
|
1154
|
-
return loci_1.EmptyLoci;
|
|
1155
|
-
var data = this.plugin.state.data.select(assemblyRef)[0].obj.data;
|
|
1156
|
-
if (!data)
|
|
1157
|
-
return loci_1.EmptyLoci;
|
|
1158
|
-
return helpers_1.AlphafoldView.getLociByPLDDT(score, data);
|
|
1159
|
-
};
|
|
1160
|
-
PDBeMolstarPlugin.prototype.normalizeColor = function (colorVal, defaultColor) {
|
|
1161
|
-
var color = color_1.Color.fromRgb(170, 170, 170);
|
|
1162
|
-
try {
|
|
1163
|
-
if (typeof colorVal.r !== 'undefined') {
|
|
1164
|
-
color = color_1.Color.fromRgb(colorVal.r, colorVal.g, colorVal.b);
|
|
1165
|
-
}
|
|
1166
|
-
else if (colorVal[0] === '#') {
|
|
1167
|
-
color = (0, color_1.Color)(Number("0x".concat(colorVal.substr(1))));
|
|
1168
|
-
}
|
|
1169
|
-
else {
|
|
1170
|
-
color = (0, color_1.Color)(colorVal);
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
catch (e) {
|
|
1174
|
-
if (defaultColor)
|
|
1175
|
-
color = defaultColor;
|
|
1176
|
-
}
|
|
1177
|
-
return color;
|
|
1178
|
-
};
|
|
1179
|
-
PDBeMolstarPlugin.prototype.getObj = function (ref) {
|
|
1180
|
-
var state = this.state;
|
|
1181
|
-
var cell = state.select(ref)[0];
|
|
1182
|
-
if (!cell || !cell.obj)
|
|
1183
|
-
return void 0;
|
|
1184
|
-
return cell.obj.data;
|
|
1185
|
-
};
|
|
1186
|
-
// private applyState(tree: StateBuilder) {
|
|
1187
|
-
// return PluginCommands.State.Update(this.plugin, { state: this.plugin.state.data, tree })
|
|
1188
|
-
// }
|
|
1189
|
-
PDBeMolstarPlugin.prototype.create_structure = function (model) {
|
|
1190
|
-
var s = this.plugin.state.data.build().to(model).apply(transforms_1.StateTransforms.Model.StructureFromModel, { type: { name: 'model', params: {} } }, { ref: 'Structure' });
|
|
1191
|
-
return s.commit({ revertOnError: true });
|
|
1192
|
-
// s.apply(StateTransforms.Model.StructureComplexElement, { type: 'atomic-sequence' }, { ref: 'Polymer' })
|
|
1193
|
-
// s.apply(StateTransforms.Model.StructureComplexElement, { type: 'atomic-het' }, { ref: 'Het' })
|
|
1194
|
-
// s.apply(StateTransforms.Model.StructureComplexElement, { type: 'water' }, { ref: 'Water' })
|
|
1195
|
-
// return s
|
|
1196
|
-
};
|
|
1197
|
-
PDBeMolstarPlugin.prototype.load_tree = function (_a, fullLoad) {
|
|
1198
|
-
var url = _a.url, _b = _a.format, format = _b === void 0 ? 'mmcif' : _b, _c = _a.isBinary, isBinary = _c === void 0 ? false : _c, _d = _a.assemblyId, assemblyId = _d === void 0 ? '' : _d, _e = _a.pdb_string, pdb_string = _e === void 0 ? '' : _e, _f = _a.if_render, if_render = _f === void 0 ? true : _f;
|
|
1199
|
-
if (fullLoad === void 0) { fullLoad = true; }
|
|
1200
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1201
|
-
var state, data, trajectory, model, structureTree;
|
|
1202
|
-
return tslib_1.__generator(this, function (_g) {
|
|
1203
|
-
switch (_g.label) {
|
|
1204
|
-
case 0:
|
|
1205
|
-
state = this.plugin.state.data;
|
|
1206
|
-
if (!fullLoad) return [3 /*break*/, 2];
|
|
1207
|
-
return [4 /*yield*/, commands_1.PluginCommands.State.RemoveObject(this.plugin, { state: state, ref: state.tree.root.ref })];
|
|
1208
|
-
case 1:
|
|
1209
|
-
_g.sent();
|
|
1210
|
-
_g.label = 2;
|
|
1211
|
-
case 2:
|
|
1212
|
-
data = null;
|
|
1213
|
-
if (!pdb_string) return [3 /*break*/, 4];
|
|
1214
|
-
return [4 /*yield*/, this.plugin.builders.data.rawData({ data: pdb_string }, { state: { isGhost: true } })];
|
|
1215
|
-
case 3:
|
|
1216
|
-
data = _g.sent();
|
|
1217
|
-
return [3 /*break*/, 6];
|
|
1218
|
-
case 4: return [4 /*yield*/, this.plugin.builders.data.download({ url: url, isBinary: isBinary }, { state: { isGhost: true } })];
|
|
1219
|
-
case 5:
|
|
1220
|
-
data = _g.sent();
|
|
1221
|
-
_g.label = 6;
|
|
1222
|
-
case 6: return [4 /*yield*/, this.plugin.builders.structure.parseTrajectory(data, format)];
|
|
1223
|
-
case 7:
|
|
1224
|
-
trajectory = _g.sent();
|
|
1225
|
-
return [4 /*yield*/, this.plugin.builders.structure.createModel(trajectory, { modelIndex: 0 })];
|
|
1226
|
-
case 8:
|
|
1227
|
-
model = _g.sent();
|
|
1228
|
-
console.log('this.model', model);
|
|
1229
|
-
return [4 /*yield*/, this.create_structure(model)];
|
|
1230
|
-
case 9:
|
|
1231
|
-
structureTree = _g.sent();
|
|
1232
|
-
console.log('structureTree', structureTree);
|
|
1233
|
-
return [2 /*return*/];
|
|
1234
|
-
}
|
|
1235
|
-
});
|
|
1236
|
-
});
|
|
1237
|
-
};
|
|
1238
|
-
PDBeMolstarPlugin.prototype.update_comp_repr = function (comp_ref, repr_ref, if_show, params) {
|
|
1239
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1240
|
-
var structure, tree;
|
|
1241
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1242
|
-
switch (_a.label) {
|
|
1243
|
-
case 0:
|
|
1244
|
-
structure = this.getObj('Structure');
|
|
1245
|
-
tree = this.visual_tree(structure, comp_ref, repr_ref, if_show, params);
|
|
1246
|
-
if (!tree) {
|
|
1247
|
-
console.log('build tree failed');
|
|
1248
|
-
return [2 /*return*/];
|
|
1249
|
-
}
|
|
1250
|
-
return [4 /*yield*/, commands_1.PluginCommands.State.Update(this.plugin, { state: this.plugin.state.data, tree: tree })];
|
|
1251
|
-
case 1:
|
|
1252
|
-
_a.sent();
|
|
1253
|
-
return [2 /*return*/];
|
|
1254
|
-
}
|
|
1255
|
-
});
|
|
1256
|
-
});
|
|
1257
|
-
};
|
|
1258
|
-
PDBeMolstarPlugin.prototype.visual_tree = function (structure, comp_ref, repr_ref, if_show, params) {
|
|
1259
|
-
var update = this.plugin.state.data.build();
|
|
1260
|
-
var root = update.to(comp_ref);
|
|
1261
|
-
if (!if_show) {
|
|
1262
|
-
root.delete(repr_ref);
|
|
1263
|
-
}
|
|
1264
|
-
else {
|
|
1265
|
-
root.applyOrUpdate(repr_ref, transforms_1.StateTransforms.Representation.StructureRepresentation3D, (0, structure_representation_params_1.createStructureRepresentationParams)(this.plugin, structure, params));
|
|
1266
|
-
}
|
|
1267
|
-
return update;
|
|
1268
|
-
};
|
|
1269
|
-
PDBeMolstarPlugin.prototype.clear = function () {
|
|
1270
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1271
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1272
|
-
this.plugin.clear();
|
|
1273
|
-
this.assemblyRef = '';
|
|
1274
|
-
this.selectedParams = void 0;
|
|
1275
|
-
this.isHighlightColorUpdated = false;
|
|
1276
|
-
this.isSelectedColorUpdated = false;
|
|
1277
|
-
return [2 /*return*/];
|
|
1278
|
-
});
|
|
1279
|
-
});
|
|
1280
|
-
};
|
|
1281
|
-
PDBeMolstarPlugin.prototype.parse_ligand_info = function (pdb_string) {
|
|
1282
|
-
// 解析所有的配体信息
|
|
1283
|
-
// chain_name
|
|
1284
|
-
// name
|
|
1285
|
-
// count
|
|
1286
|
-
var ret_list = [];
|
|
1287
|
-
var lines = pdb_string.split('\n');
|
|
1288
|
-
var ligand_dict = {};
|
|
1289
|
-
for (var _a = 0, lines_1 = lines; _a < lines_1.length; _a++) {
|
|
1290
|
-
var line = lines_1[_a];
|
|
1291
|
-
if (line.startsWith('HETATM')) {
|
|
1292
|
-
var ligand_name = line.substr(17, 3).trim();
|
|
1293
|
-
if (ligand_name === 'HOH') {
|
|
1294
|
-
continue;
|
|
1295
|
-
}
|
|
1296
|
-
var residue_id = line.substr(22, 5).trim();
|
|
1297
|
-
var chain_name = line.substr(21, 1).trim();
|
|
1298
|
-
var x = line.substr(30, 8).trim();
|
|
1299
|
-
var y = line.substr(38, 8).trim();
|
|
1300
|
-
var z = line.substr(46, 8).trim();
|
|
1301
|
-
if (ligand_dict[chain_name + ':' + ligand_name + ':' + residue_id] === undefined) {
|
|
1302
|
-
ligand_dict[chain_name + ':' + ligand_name + ':' + residue_id] = {
|
|
1303
|
-
'chain_name': chain_name,
|
|
1304
|
-
'name': chain_name + ':' + ligand_name + ':' + residue_id,
|
|
1305
|
-
'residue_name': ligand_name,
|
|
1306
|
-
'residue_id': residue_id,
|
|
1307
|
-
'count': 1,
|
|
1308
|
-
'show_option': true,
|
|
1309
|
-
'coords': [[Number(x), Number(y), Number(z)]]
|
|
1310
|
-
};
|
|
1311
|
-
}
|
|
1312
|
-
else {
|
|
1313
|
-
ligand_dict[chain_name + ':' + ligand_name + ':' + residue_id].count += 1;
|
|
1314
|
-
ligand_dict[chain_name + ':' + ligand_name + ':' + residue_id].coords.push([Number(x), Number(y), Number(z)]);
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
}
|
|
1318
|
-
for (var key in ligand_dict) {
|
|
1319
|
-
var max_min_dict = this.calc_max_min(ligand_dict[key]);
|
|
1320
|
-
ligand_dict[key]['max_min_coord'] = max_min_dict;
|
|
1321
|
-
ret_list.push(ligand_dict[key]);
|
|
1322
|
-
}
|
|
1323
|
-
return ret_list;
|
|
1324
|
-
};
|
|
1325
|
-
PDBeMolstarPlugin.prototype.parse_chain_info = function (pdb_string) {
|
|
1326
|
-
// 解析所有的链信息
|
|
1327
|
-
var lines = pdb_string.split('\n');
|
|
1328
|
-
// 获得链中的residue信息
|
|
1329
|
-
var chain_dict = {};
|
|
1330
|
-
for (var _a = 0, lines_2 = lines; _a < lines_2.length; _a++) {
|
|
1331
|
-
var line = lines_2[_a];
|
|
1332
|
-
if (line.startsWith('ATOM')) {
|
|
1333
|
-
var residue_name = line.substr(17, 3).trim();
|
|
1334
|
-
var chain_name = line.substr(21, 1).trim();
|
|
1335
|
-
if (chain_dict[chain_name] === undefined) {
|
|
1336
|
-
chain_dict[chain_name] = [];
|
|
1337
|
-
}
|
|
1338
|
-
chain_dict[chain_name].push(residue_name);
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
var ret_list = [];
|
|
1342
|
-
for (var chain_name in chain_dict) {
|
|
1343
|
-
ret_list.push({ 'chain_full_name': chain_name, 'chain_main_name': chain_name, 'chain_cont': chain_dict[chain_name] });
|
|
1344
|
-
}
|
|
1345
|
-
return ret_list;
|
|
1346
|
-
};
|
|
1347
|
-
PDBeMolstarPlugin.prototype.calc_max_min = function (ligand_dict) {
|
|
1348
|
-
var coords = ligand_dict.coords;
|
|
1349
|
-
var x_list = [];
|
|
1350
|
-
var y_list = [];
|
|
1351
|
-
var z_list = [];
|
|
1352
|
-
for (var _a = 0, coords_1 = coords; _a < coords_1.length; _a++) {
|
|
1353
|
-
var coord = coords_1[_a];
|
|
1354
|
-
x_list.push(coord[0]);
|
|
1355
|
-
y_list.push(coord[1]);
|
|
1356
|
-
z_list.push(coord[2]);
|
|
1357
|
-
}
|
|
1358
|
-
return {
|
|
1359
|
-
'max_x': Math.max.apply(Math, x_list),
|
|
1360
|
-
'min_x': Math.min.apply(Math, x_list),
|
|
1361
|
-
'max_y': Math.max.apply(Math, y_list),
|
|
1362
|
-
'min_y': Math.min.apply(Math, y_list),
|
|
1363
|
-
'max_z': Math.max.apply(Math, z_list),
|
|
1364
|
-
'min_z': Math.min.apply(Math, z_list)
|
|
1365
|
-
};
|
|
1366
|
-
};
|
|
1367
|
-
return PDBeMolstarPlugin;
|
|
1368
|
-
}());
|
|
1369
|
-
window.PDBeMolstarPlugin = PDBeMolstarPlugin;
|