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/superposition.js
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderSuperposition = exports.superposeAf = exports.loadAfStructure = exports.initSuperposition = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var structure_1 = require("Molstar/mol-model/structure");
|
|
4
|
+
const linear_algebra_1 = require("Molstar/mol-math/linear-algebra");
|
|
5
|
+
const builder_1 = require("Molstar/mol-script/language/builder");
|
|
6
|
+
const mol_state_1 = require("Molstar/mol-state");
|
|
7
|
+
const transforms_1 = require("Molstar/mol-plugin-state/transforms");
|
|
8
|
+
const assets_1 = require("Molstar/mol-util/assets");
|
|
9
|
+
const helpers_1 = require("./helpers");
|
|
10
|
+
const lists_1 = require("Molstar/mol-util/color/lists");
|
|
11
|
+
const color_1 = require("Molstar/mol-util/color/color");
|
|
12
|
+
const script_1 = require("Molstar/mol-script/script");
|
|
13
|
+
const mol_task_1 = require("Molstar/mol-task");
|
|
14
|
+
const superposition_sifts_mapping_1 = require("./superposition-sifts-mapping");
|
|
15
|
+
const alphafold_transparency_1 = require("./alphafold-transparency");
|
|
16
|
+
const structure_1 = require("Molstar/mol-model/structure");
|
|
18
17
|
function getRandomColor(plugin, segmentIndex) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const clList = lists_1.ColorLists;
|
|
19
|
+
const spState = plugin.customState.superpositionState;
|
|
20
|
+
let palleteIndex = spState.colorState[segmentIndex].palleteIndex;
|
|
21
|
+
let colorIndex = spState.colorState[segmentIndex].colorIndex;
|
|
23
22
|
if (clList[spState.colorPalette[palleteIndex]].list[colorIndex + 1]) {
|
|
24
23
|
colorIndex += 1;
|
|
25
24
|
}
|
|
@@ -27,598 +26,418 @@ function getRandomColor(plugin, segmentIndex) {
|
|
|
27
26
|
colorIndex = 0;
|
|
28
27
|
palleteIndex = spState.colorPalette[palleteIndex + 1] ? palleteIndex + 1 : 0;
|
|
29
28
|
}
|
|
30
|
-
|
|
29
|
+
const palleteName = spState.colorPalette[palleteIndex];
|
|
31
30
|
plugin.customState.superpositionState.colorState[segmentIndex].palleteIndex = palleteIndex;
|
|
32
31
|
plugin.customState.superpositionState.colorState[segmentIndex].colorIndex = colorIndex;
|
|
33
32
|
return clList[palleteName].list[colorIndex];
|
|
34
33
|
}
|
|
35
|
-
function initSuperposition(plugin) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
clusters = segmentData[segmentIndex].clusters;
|
|
106
|
-
clusters.forEach(function (cluster, clusterIndex) {
|
|
107
|
-
// Validate for cluster index if provided in superPositionParams
|
|
108
|
-
if (clusterIndexs && clusterIndexs.indexOf(clusterIndex) === -1)
|
|
109
|
-
return;
|
|
110
|
-
// Add respresentative structure to the list
|
|
111
|
-
if (superpositionParams && superpositionParams.superposeAll) {
|
|
112
|
-
entryList = entryList.concat(cluster);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
entryList.push(cluster[0]);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
return [4 /*yield*/, renderSuperposition(plugin, segmentIndex, entryList)];
|
|
119
|
-
case 5:
|
|
120
|
-
_a.sent();
|
|
121
|
-
return [2 /*return*/];
|
|
122
|
-
}
|
|
123
|
-
});
|
|
34
|
+
async function initSuperposition(plugin) {
|
|
35
|
+
await plugin.clear();
|
|
36
|
+
const customState = plugin.customState;
|
|
37
|
+
const superpositionParams = customState.initParams.superpositionParams;
|
|
38
|
+
plugin.customState.superpositionState = {
|
|
39
|
+
models: {},
|
|
40
|
+
entries: {},
|
|
41
|
+
refMaps: {},
|
|
42
|
+
segmentData: void 0,
|
|
43
|
+
matrixData: {},
|
|
44
|
+
activeSegment: 0,
|
|
45
|
+
loadedStructs: [],
|
|
46
|
+
visibleRefs: [],
|
|
47
|
+
invalidStruct: [],
|
|
48
|
+
noMatrixStruct: [],
|
|
49
|
+
hets: {},
|
|
50
|
+
colorPalette: ['dark-2', 'red-yellow-green', 'paired', 'set-1', 'accent', 'set-2', 'rainbow'],
|
|
51
|
+
colorState: [],
|
|
52
|
+
alphafold: {
|
|
53
|
+
apiData: {
|
|
54
|
+
cif: '',
|
|
55
|
+
pae: '',
|
|
56
|
+
length: 0
|
|
57
|
+
},
|
|
58
|
+
length: 0,
|
|
59
|
+
ref: '',
|
|
60
|
+
traceOnly: true,
|
|
61
|
+
visibility: [],
|
|
62
|
+
transforms: [],
|
|
63
|
+
rmsds: [],
|
|
64
|
+
coordinateSystems: []
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
// Get segment and cluster information for the given uniprot accession
|
|
68
|
+
await getSegmentData(plugin);
|
|
69
|
+
const segmentData = plugin.customState.superpositionState.segmentData;
|
|
70
|
+
if (!segmentData)
|
|
71
|
+
return;
|
|
72
|
+
// Load Matrix Data
|
|
73
|
+
await getMatrixData(plugin);
|
|
74
|
+
if (!plugin.customState.superpositionState.segmentData)
|
|
75
|
+
return;
|
|
76
|
+
const afStrUrls = await getAfUrl(plugin, customState.initParams.moleculeId);
|
|
77
|
+
if (afStrUrls)
|
|
78
|
+
customState.superpositionState.alphafold.apiData = afStrUrls;
|
|
79
|
+
segmentData.forEach(() => {
|
|
80
|
+
plugin.customState.superpositionState.loadedStructs.push([]);
|
|
81
|
+
plugin.customState.superpositionState.visibleRefs.push([]);
|
|
82
|
+
plugin.customState.superpositionState.colorState.push({ palleteIndex: 0, colorIndex: -1 });
|
|
83
|
+
});
|
|
84
|
+
// Set segment and cluster details from superPositionParams
|
|
85
|
+
const segmentIndex = (superpositionParams && superpositionParams.segment) ? superpositionParams.segment - 1 : 0;
|
|
86
|
+
plugin.customState.superpositionState.activeSegment = segmentIndex + 1;
|
|
87
|
+
const clusterIndexs = (superpositionParams && superpositionParams.cluster) ? superpositionParams.cluster : void 0;
|
|
88
|
+
// Emit segment API data load event
|
|
89
|
+
plugin.customState.events.superpositionInit.next(true);
|
|
90
|
+
// Get entry list to load matrix data
|
|
91
|
+
let entryList = [];
|
|
92
|
+
const clusters = segmentData[segmentIndex].clusters;
|
|
93
|
+
clusters.forEach((cluster, clusterIndex) => {
|
|
94
|
+
// Validate for cluster index if provided in superPositionParams
|
|
95
|
+
if (clusterIndexs && clusterIndexs.indexOf(clusterIndex) === -1)
|
|
96
|
+
return;
|
|
97
|
+
// Add respresentative structure to the list
|
|
98
|
+
if (superpositionParams && superpositionParams.superposeAll) {
|
|
99
|
+
entryList = entryList.concat(cluster);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
entryList.push(cluster[0]);
|
|
103
|
+
}
|
|
124
104
|
});
|
|
105
|
+
await renderSuperposition(plugin, segmentIndex, entryList);
|
|
125
106
|
}
|
|
126
107
|
exports.initSuperposition = initSuperposition;
|
|
127
108
|
function createCarbVisLabel(carbLigNamesAndCount) {
|
|
128
|
-
|
|
129
|
-
for (
|
|
130
|
-
compList.push(
|
|
109
|
+
const compList = [];
|
|
110
|
+
for (const carbCompId in carbLigNamesAndCount) {
|
|
111
|
+
compList.push(`${carbCompId} (${carbLigNamesAndCount[carbCompId]})`);
|
|
131
112
|
}
|
|
132
113
|
return compList.join(', ');
|
|
133
114
|
}
|
|
134
|
-
function getAfUrl(plugin, accession) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return [4 /*yield*/, plugin.fetch({ url: "https://alphafold.ebi.ac.uk/api/prediction/".concat(accession), type: 'json' }).runInContext(ctx)];
|
|
147
|
-
case 1:
|
|
148
|
-
apiResponse = _a.sent();
|
|
149
|
-
if (apiResponse && (apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse[0].bcifUrl)) {
|
|
150
|
-
apiData = {
|
|
151
|
-
cif: apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse[0].cifUrl,
|
|
152
|
-
pae: apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse[0].paeImageUrl,
|
|
153
|
-
length: apiResponse === null || apiResponse === void 0 ? void 0 : apiResponse[0].uniprotEnd
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
return [3 /*break*/, 3];
|
|
157
|
-
case 2:
|
|
158
|
-
e_1 = _a.sent();
|
|
159
|
-
return [3 /*break*/, 3];
|
|
160
|
-
case 3: return [2 /*return*/];
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
}); }))];
|
|
164
|
-
case 1:
|
|
165
|
-
_a.sent();
|
|
166
|
-
return [2 /*return*/, apiData];
|
|
115
|
+
async function getAfUrl(plugin, accession) {
|
|
116
|
+
let apiResponse;
|
|
117
|
+
let apiData;
|
|
118
|
+
await plugin.runTask(mol_task_1.Task.create('Get AlphaFold URL', async (ctx) => {
|
|
119
|
+
try {
|
|
120
|
+
apiResponse = await plugin.fetch({ url: `https://alphafold.ebi.ac.uk/api/prediction/${accession}`, type: 'json' }).runInContext(ctx);
|
|
121
|
+
if (apiResponse && apiResponse?.[0].bcifUrl) {
|
|
122
|
+
apiData = {
|
|
123
|
+
cif: apiResponse?.[0].cifUrl,
|
|
124
|
+
pae: apiResponse?.[0].paeImageUrl,
|
|
125
|
+
length: apiResponse?.[0].uniprotEnd
|
|
126
|
+
};
|
|
167
127
|
}
|
|
168
|
-
}
|
|
169
|
-
|
|
128
|
+
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
// console.warn(e);
|
|
131
|
+
}
|
|
132
|
+
}));
|
|
133
|
+
return apiData;
|
|
170
134
|
}
|
|
171
|
-
function loadAfStructure(plugin) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return [4 /*yield*/, plugin.builders.structure.tryCreateComponentStatic(strInstance, 'polymer', { label: "AlphaFold Structure", tags: ["alphafold-chain", "superposition-sel"] })];
|
|
188
|
-
case 2:
|
|
189
|
-
chainSel = _a.sent();
|
|
190
|
-
if (!chainSel) return [3 /*break*/, 4];
|
|
191
|
-
return [4 /*yield*/, plugin.builders.structure.representation.addRepresentation(chainSel, { type: 'putty', color: 'plddt-confidence', size: 'uniform', sizeParams: { value: 1.5 } }, { tag: "af-superposition-visual" })];
|
|
192
|
-
case 3:
|
|
193
|
-
_a.sent();
|
|
194
|
-
return [2 /*return*/, strInstance === null || strInstance === void 0 ? void 0 : strInstance.ref];
|
|
195
|
-
case 4: return [2 /*return*/, false];
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
});
|
|
135
|
+
async function loadAfStructure(plugin) {
|
|
136
|
+
const customState = plugin.customState;
|
|
137
|
+
const { structure } = await loadStructure(plugin, customState.superpositionState.alphafold.apiData.cif, 'mmcif', false);
|
|
138
|
+
const strInstance = structure;
|
|
139
|
+
if (!strInstance)
|
|
140
|
+
return false;
|
|
141
|
+
// Store Refs in state
|
|
142
|
+
const spState = plugin.customState.superpositionState;
|
|
143
|
+
spState.alphafold.ref = strInstance?.ref;
|
|
144
|
+
spState.models[`AF-${customState.initParams.moleculeId}`] = strInstance?.ref;
|
|
145
|
+
const chainSel = await plugin.builders.structure.tryCreateComponentStatic(strInstance, 'polymer', { label: `AlphaFold Structure`, tags: [`alphafold-chain`, `superposition-sel`] });
|
|
146
|
+
if (chainSel) {
|
|
147
|
+
await plugin.builders.structure.representation.addRepresentation(chainSel, { type: 'putty', color: 'plddt-confidence', size: 'uniform', sizeParams: { value: 1.5 } }, { tag: `af-superposition-visual` });
|
|
148
|
+
return strInstance?.ref;
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
199
151
|
}
|
|
200
152
|
exports.loadAfStructure = loadAfStructure;
|
|
201
|
-
function superposeAf(plugin, traceOnly, segmentIndex) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
entries = alignWithoutPlddt.entries;
|
|
245
|
-
}
|
|
246
|
-
if (entries && entries[0]) {
|
|
247
|
-
mappingResult_1.push(entries[0]);
|
|
248
|
-
coordinateSystems_1.push((_c = (_b = (_a = input[0]) === null || _a === void 0 ? void 0 : _a.transform) === null || _b === void 0 ? void 0 : _b.cell.obj) === null || _c === void 0 ? void 0 : _c.data.coordinateSystem);
|
|
249
|
-
var totalMappings = mappingResult_1.length;
|
|
250
|
-
if (totalMappings === 1 || entries[0].transform.rmsd < minRmsd_1) {
|
|
251
|
-
minRmsd_1 = entries[0].transform.rmsd;
|
|
252
|
-
minIndex_1 = totalMappings === 1 ? 0 : mappingResult_1.length - 1;
|
|
253
|
-
}
|
|
254
|
-
rmsdList_1.push("".concat(cluster[0].pdb_id, " chain ").concat(cluster[0].struct_asym_id, ":").concat(entries[0].transform.rmsd.toFixed(2)));
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
if (failedPairs.length > 0)
|
|
258
|
-
failedPairsResult_1.push(failedPairs);
|
|
259
|
-
if (zeroOverlapPairs.length > 0)
|
|
260
|
-
zeroOverlapPairsResult_1.push(zeroOverlapPairs);
|
|
261
|
-
// rmsdList.push(`${cluster[0].pdb_id} ${cluster[0].struct_asym_id}:-`)
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
// console.log(failedPairsResult);
|
|
267
|
-
// console.log(zeroOverlapPairsResult);
|
|
268
|
-
if (mappingResult_1.length > 0) {
|
|
269
|
-
spState.alphafold.visibility[segmentNum] = true;
|
|
270
|
-
spState.alphafold.transforms[segmentNum] = mappingResult_1[minIndex_1].transform.bTransform;
|
|
271
|
-
spState.alphafold.coordinateSystems[segmentNum] = coordinateSystems_1[minIndex_1];
|
|
272
|
-
spState.alphafold.rmsds[segmentNum] = rmsdList_1.sort(function (a, b) { return parseFloat(a.split(':')[1]) - parseFloat(b.split(':')[1]); });
|
|
153
|
+
async function superposeAf(plugin, traceOnly, segmentIndex) {
|
|
154
|
+
const customState = plugin.customState;
|
|
155
|
+
if (!customState.superpositionState || !customState.superpositionState.segmentData)
|
|
156
|
+
return;
|
|
157
|
+
const spState = customState.superpositionState;
|
|
158
|
+
// Load AF structure
|
|
159
|
+
const afStrRef = spState.alphafold.ref || await loadAfStructure(plugin);
|
|
160
|
+
if (!afStrRef)
|
|
161
|
+
return;
|
|
162
|
+
const afStr = plugin.managers.structure.hierarchy.current.refs.get(afStrRef);
|
|
163
|
+
const segmentNum = segmentIndex ? segmentIndex : spState.activeSegment - 1;
|
|
164
|
+
if (!spState.alphafold.transforms[segmentNum]) {
|
|
165
|
+
// Create representative list
|
|
166
|
+
const mappingResult = [];
|
|
167
|
+
const coordinateSystems = [];
|
|
168
|
+
const failedPairsResult = [];
|
|
169
|
+
const zeroOverlapPairsResult = [];
|
|
170
|
+
let minRmsd = 0;
|
|
171
|
+
let minIndex = 0;
|
|
172
|
+
let rmsdList = [];
|
|
173
|
+
const segmentClusters = spState.segmentData[segmentNum].clusters;
|
|
174
|
+
segmentClusters.forEach((cluster) => {
|
|
175
|
+
const modelRef = spState.models[`${cluster[0].pdb_id}_${cluster[0].struct_asym_id}`];
|
|
176
|
+
if (modelRef) {
|
|
177
|
+
const structHierarchy = plugin.managers.structure.hierarchy.current.refs.get(modelRef);
|
|
178
|
+
if (structHierarchy) {
|
|
179
|
+
const input = [structHierarchy.components[0], afStr];
|
|
180
|
+
const structures = input.map(s => s.cell.obj?.data);
|
|
181
|
+
let { entries, failedPairs, zeroOverlapPairs } = (0, superposition_sifts_mapping_1.alignAndSuperposeWithSIFTSMapping)(structures, { traceOnly,
|
|
182
|
+
includeResidueTest: loc => structure_1.StructureProperties.atom.B_iso_or_equiv(loc) > 70,
|
|
183
|
+
applyTestIndex: [1]
|
|
184
|
+
});
|
|
185
|
+
if (entries.length === 0 || (entries && entries[0] && entries[0].transform.rmsd.toFixed(1) === '0.0')) {
|
|
186
|
+
const alignWithoutPlddt = (0, superposition_sifts_mapping_1.alignAndSuperposeWithSIFTSMapping)(structures, { traceOnly });
|
|
187
|
+
entries = alignWithoutPlddt.entries;
|
|
188
|
+
}
|
|
189
|
+
if (entries && entries[0]) {
|
|
190
|
+
mappingResult.push(entries[0]);
|
|
191
|
+
coordinateSystems.push(input[0]?.transform?.cell.obj?.data.coordinateSystem);
|
|
192
|
+
const totalMappings = mappingResult.length;
|
|
193
|
+
if (totalMappings === 1 || entries[0].transform.rmsd < minRmsd) {
|
|
194
|
+
minRmsd = entries[0].transform.rmsd;
|
|
195
|
+
minIndex = totalMappings === 1 ? 0 : mappingResult.length - 1;
|
|
273
196
|
}
|
|
197
|
+
rmsdList.push(`${cluster[0].pdb_id} chain ${cluster[0].struct_asym_id}:${entries[0].transform.rmsd.toFixed(2)}`);
|
|
274
198
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
199
|
+
else {
|
|
200
|
+
if (failedPairs.length > 0)
|
|
201
|
+
failedPairsResult.push(failedPairs);
|
|
202
|
+
if (zeroOverlapPairs.length > 0)
|
|
203
|
+
zeroOverlapPairsResult.push(zeroOverlapPairs);
|
|
204
|
+
// rmsdList.push(`${cluster[0].pdb_id} ${cluster[0].struct_asym_id}:-`)
|
|
205
|
+
}
|
|
206
|
+
}
|
|
280
207
|
}
|
|
281
208
|
});
|
|
282
|
-
|
|
209
|
+
// console.log(failedPairsResult);
|
|
210
|
+
// console.log(zeroOverlapPairsResult);
|
|
211
|
+
if (mappingResult.length > 0) {
|
|
212
|
+
spState.alphafold.visibility[segmentNum] = true;
|
|
213
|
+
spState.alphafold.transforms[segmentNum] = mappingResult[minIndex].transform.bTransform;
|
|
214
|
+
spState.alphafold.coordinateSystems[segmentNum] = coordinateSystems[minIndex];
|
|
215
|
+
spState.alphafold.rmsds[segmentNum] = rmsdList.sort((a, b) => parseFloat(a.split(':')[1]) - parseFloat(b.split(':')[1]));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
await afTransform(plugin, afStr.cell, spState.alphafold.transforms[segmentNum], spState.alphafold.coordinateSystems[segmentNum]);
|
|
219
|
+
(0, alphafold_transparency_1.applyAFTransparency)(plugin, afStr, 0.8, 70);
|
|
220
|
+
return true;
|
|
283
221
|
}
|
|
284
222
|
exports.superposeAf = superposeAf;
|
|
285
|
-
function renderSuperposition(plugin, segmentIndex, entryList) {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
223
|
+
async function renderSuperposition(plugin, segmentIndex, entryList) {
|
|
224
|
+
const customState = plugin.customState;
|
|
225
|
+
const superpositionParams = customState.initParams.superpositionParams;
|
|
226
|
+
let busyFlagOn = false;
|
|
227
|
+
if (entryList.length > 1) {
|
|
228
|
+
busyFlagOn = true;
|
|
229
|
+
customState.events.isBusy.next(true);
|
|
230
|
+
}
|
|
231
|
+
// Load Coordinates and render respresentations
|
|
232
|
+
return plugin.dataTransaction(async () => {
|
|
233
|
+
const spState = plugin.customState.superpositionState;
|
|
234
|
+
for await (const s of entryList) {
|
|
235
|
+
// validate matrix availability
|
|
236
|
+
if (!spState.matrixData[`${s.pdb_id}_${s.auth_asym_id}`]) {
|
|
237
|
+
spState.noMatrixStruct.push(`${s.pdb_id}_${s.struct_asym_id}`);
|
|
238
|
+
spState.invalidStruct.push(`${s.pdb_id}_${s.struct_asym_id}`);
|
|
239
|
+
continue;
|
|
296
240
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
spState.refMaps[ligandExp.ref] = "".concat(s.pdb_id, "_").concat(s.struct_asym_id);
|
|
420
|
-
invalidStruct = false;
|
|
421
|
-
_h.label = 23;
|
|
422
|
-
case 23: return [3 /*break*/, 19];
|
|
423
|
-
case 24: return [3 /*break*/, 31];
|
|
424
|
-
case 25:
|
|
425
|
-
e_2_1 = _h.sent();
|
|
426
|
-
e_2 = { error: e_2_1 };
|
|
427
|
-
return [3 /*break*/, 31];
|
|
428
|
-
case 26:
|
|
429
|
-
_h.trys.push([26, , 29, 30]);
|
|
430
|
-
if (!(hets_1_1 && !hets_1_1.done && (_g = hets_1.return))) return [3 /*break*/, 28];
|
|
431
|
-
return [4 /*yield*/, _g.call(hets_1)];
|
|
432
|
-
case 27:
|
|
433
|
-
_h.sent();
|
|
434
|
-
_h.label = 28;
|
|
435
|
-
case 28: return [3 /*break*/, 30];
|
|
436
|
-
case 29:
|
|
437
|
-
if (e_2) throw e_2.error;
|
|
438
|
-
return [7 /*endfinally*/];
|
|
439
|
-
case 30: return [7 /*endfinally*/];
|
|
440
|
-
case 31:
|
|
441
|
-
carbEntityCount = hetInfo ? hetInfo.carbEntityCount : 0;
|
|
442
|
-
if (!(carbEntityCount > 0)) return [3 /*break*/, 38];
|
|
443
|
-
return [4 /*yield*/, getCarbPolymerDetailsFromApi(plugin, s.pdb_id)];
|
|
444
|
-
case 32:
|
|
445
|
-
allCarbPolymers = _h.sent();
|
|
446
|
-
polymerChainWithSurroundings = builder_1.MolScriptBuilder.struct.modifier.includeSurroundings({
|
|
447
|
-
0: builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
448
|
-
'entity-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.ammp('entityType'), 'polymer']),
|
|
449
|
-
'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(), s.auth_asym_id]),
|
|
450
|
-
'group-by': builder_1.MolScriptBuilder.core.str.concat([builder_1.MolScriptBuilder.struct.atomProperty.core.operatorName(), builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()])
|
|
451
|
-
}),
|
|
452
|
-
radius: 5,
|
|
453
|
-
'as-whole-residues': true
|
|
454
|
-
});
|
|
455
|
-
i = 0;
|
|
456
|
-
_i = 0, _c = allCarbPolymers.branchedChains;
|
|
457
|
-
_h.label = 33;
|
|
458
|
-
case 33:
|
|
459
|
-
if (!(_i < _c.length)) return [3 /*break*/, 38];
|
|
460
|
-
carbEntityChainId = _c[_i];
|
|
461
|
-
carbEntityChain = builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
462
|
-
'entity-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.ammp('entityType'), 'branched']),
|
|
463
|
-
'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(), carbEntityChainId]),
|
|
464
|
-
'group-by': builder_1.MolScriptBuilder.core.str.concat([builder_1.MolScriptBuilder.struct.atomProperty.core.operatorName(), builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()])
|
|
465
|
-
});
|
|
466
|
-
carbEntityChainInVicinity = builder_1.MolScriptBuilder.struct.filter.intersectedBy({
|
|
467
|
-
0: polymerChainWithSurroundings,
|
|
468
|
-
by: carbEntityChain
|
|
469
|
-
});
|
|
470
|
-
data = (plugin.state.data.select(strInstance.ref)[0].obj).data;
|
|
471
|
-
carbChainSel = script_1.Script.getStructureSelection(carbEntityChainInVicinity, data);
|
|
472
|
-
if (!(carbChainSel && carbChainSel.kind === 'sequence')) return [3 /*break*/, 36];
|
|
473
|
-
carbLigands = [];
|
|
474
|
-
carbLigNamesAndCount = {};
|
|
475
|
-
carbLigList = [];
|
|
476
|
-
for (_d = 0, _e = allCarbPolymers.branchedLigands[i]; _d < _e.length; _d++) {
|
|
477
|
-
carbLigs = _e[_d];
|
|
478
|
-
ligResDetails = carbLigs.split('-');
|
|
479
|
-
carbLigands.push(builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(), +ligResDetails[1]]));
|
|
480
|
-
if (carbLigNamesAndCount[ligResDetails[0]]) {
|
|
481
|
-
carbLigNamesAndCount[ligResDetails[0]]++;
|
|
482
|
-
}
|
|
483
|
-
else {
|
|
484
|
-
carbLigNamesAndCount[ligResDetails[0]] = 1;
|
|
485
|
-
}
|
|
486
|
-
carbLigList.push(ligResDetails[0]);
|
|
487
|
-
}
|
|
488
|
-
carbVisLabel = createCarbVisLabel(carbLigNamesAndCount);
|
|
489
|
-
branchedEntity = builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
490
|
-
'entity-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.ammp('entityType'), 'branched']),
|
|
491
|
-
'group-by': builder_1.MolScriptBuilder.core.str.concat([builder_1.MolScriptBuilder.struct.atomProperty.core.operatorName(), builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()]),
|
|
492
|
-
'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(), carbEntityChainId]),
|
|
493
|
-
'residue-test': builder_1.MolScriptBuilder.core.logic.or(carbLigands)
|
|
494
|
-
});
|
|
495
|
-
labelTagParams = { label: "".concat(carbVisLabel), tags: ["superposition-carb-sel"] };
|
|
496
|
-
return [4 /*yield*/, plugin.builders.structure.tryCreateComponentFromExpression(strInstance, branchedEntity, "".concat(carbLigList.join('-'), "-").concat(segmentIndex), labelTagParams)];
|
|
497
|
-
case 34:
|
|
498
|
-
ligandExp = _h.sent();
|
|
499
|
-
if (!ligandExp) return [3 /*break*/, 36];
|
|
500
|
-
return [4 /*yield*/, plugin.builders.structure.representation.addRepresentation(ligandExp, { type: 'carbohydrate' }, { tag: "superposition-carb-visual" })];
|
|
501
|
-
case 35:
|
|
502
|
-
_h.sent();
|
|
503
|
-
spState.refMaps[ligandExp.ref] = "".concat(s.pdb_id, "_").concat(s.struct_asym_id);
|
|
504
|
-
invalidStruct = false;
|
|
505
|
-
_h.label = 36;
|
|
506
|
-
case 36:
|
|
507
|
-
i++;
|
|
508
|
-
_h.label = 37;
|
|
509
|
-
case 37:
|
|
510
|
-
_i++;
|
|
511
|
-
return [3 /*break*/, 33];
|
|
512
|
-
case 38:
|
|
513
|
-
if (invalidStruct) {
|
|
514
|
-
spState.invalidStruct.push("".concat(s.pdb_id, "_").concat(s.struct_asym_id));
|
|
515
|
-
loadedStructIndex = spState.loadedStructs[segmentIndex].indexOf("".concat(s.pdb_id, "_").concat(s.struct_asym_id));
|
|
516
|
-
if (loadedStructIndex > -1)
|
|
517
|
-
spState.loadedStructs[segmentIndex].splice(loadedStructIndex, 1);
|
|
518
|
-
// remove downloaded data
|
|
519
|
-
if (clearOnFail) {
|
|
520
|
-
// const m = plugin.state.data.select(modelRef)[0];
|
|
521
|
-
// const t = plugin.state.data.select(m.transform.parent)[0];
|
|
522
|
-
// const d = plugin.state.data.select(t.transform.parent)[0];
|
|
523
|
-
// PluginCommands.State.RemoveObject(plugin, { state: d.parent!, ref: d.transform.parent, removeParentGhosts: true });
|
|
524
|
-
}
|
|
241
|
+
spState.loadedStructs[segmentIndex].push(`${s.pdb_id}_${s.struct_asym_id}`);
|
|
242
|
+
// Set Coordinate server url
|
|
243
|
+
let strUrl = `${customState.initParams.pdbeUrl}model-server/v1/${s.pdb_id}/atoms?auth_asym_id=${s.auth_asym_id}&encoding=${customState.initParams.encoding}`;
|
|
244
|
+
if (superpositionParams && superpositionParams.ligandView)
|
|
245
|
+
strUrl = `https://www.ebi.ac.uk/pdbe/entry-files/download/${s.pdb_id}.bcif`;
|
|
246
|
+
// Load Data
|
|
247
|
+
let strInstance;
|
|
248
|
+
let modelRef;
|
|
249
|
+
let clearOnFail = true;
|
|
250
|
+
if (superpositionParams && superpositionParams.ligandView && spState.entries[s.pdb_id]) {
|
|
251
|
+
const polymerInstance = plugin.state.data.select(spState.entries[s.pdb_id])[0];
|
|
252
|
+
modelRef = polymerInstance.transform.parent;
|
|
253
|
+
const modelInstance = plugin.state.data.select(modelRef)[0];
|
|
254
|
+
strInstance = await plugin.builders.structure.createStructure(modelInstance, { name: 'model', params: {} });
|
|
255
|
+
clearOnFail = false;
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
const isBinary = customState.initParams.encoding === 'bcif' ? true : false;
|
|
259
|
+
const { model, structure } = await loadStructure(plugin, strUrl, 'mmcif', isBinary);
|
|
260
|
+
strInstance = structure;
|
|
261
|
+
modelRef = model.ref;
|
|
262
|
+
}
|
|
263
|
+
if (!strInstance)
|
|
264
|
+
continue;
|
|
265
|
+
// Store Refs in state
|
|
266
|
+
if (!spState.models[`${s.pdb_id}_${s.struct_asym_id}`])
|
|
267
|
+
spState.models[`${s.pdb_id}_${s.struct_asym_id}`] = strInstance?.ref;
|
|
268
|
+
if (superpositionParams && superpositionParams.ligandView && !spState.entries[s.pdb_id])
|
|
269
|
+
spState.entries[s.pdb_id] = strInstance?.ref;
|
|
270
|
+
// Apply tranform matrix
|
|
271
|
+
const matrix = linear_algebra_1.Mat4.ofRows(plugin.customState.superpositionState.matrixData[`${s.pdb_id}_${s.auth_asym_id}`].matrix);
|
|
272
|
+
await transform(plugin, strInstance, matrix);
|
|
273
|
+
// Create representations
|
|
274
|
+
let chainSel;
|
|
275
|
+
if ((superpositionParams && superpositionParams.ligandView) && s.is_representative) {
|
|
276
|
+
const uniformColor1 = getRandomColor(plugin, segmentIndex); // random color
|
|
277
|
+
chainSel = await plugin.builders.structure.tryCreateComponentFromExpression(strInstance, chainSelection(s.struct_asym_id), `Chain-${segmentIndex}`, { label: `Chain`, tags: [`superposition-sel`] });
|
|
278
|
+
if (chainSel) {
|
|
279
|
+
await plugin.builders.structure.representation.addRepresentation(chainSel, { type: 'putty', color: 'uniform', colorParams: { value: uniformColor1 }, size: 'uniform' }, { tag: `superposition-visual` });
|
|
280
|
+
spState.refMaps[chainSel.ref] = `${s.pdb_id}_${s.struct_asym_id}`;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
else if ((superpositionParams && superpositionParams.ligandView) && !s.is_representative) {
|
|
284
|
+
// Do nothing
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
const uniformColor2 = getRandomColor(plugin, segmentIndex); // random color
|
|
288
|
+
chainSel = await plugin.builders.structure.tryCreateComponentStatic(strInstance, 'polymer', { label: `Chain`, tags: [`Chain-${segmentIndex}`, `superposition-sel`] });
|
|
289
|
+
if (chainSel) {
|
|
290
|
+
await plugin.builders.structure.representation.addRepresentation(chainSel, { type: 'putty', color: 'uniform', colorParams: { value: uniformColor2 }, size: 'uniform' }, { tag: `superposition-visual` });
|
|
291
|
+
spState.refMaps[chainSel.ref] = `${s.pdb_id}_${s.struct_asym_id}`;
|
|
292
|
+
}
|
|
293
|
+
// // const addTooltipUpdate = plugin.state.behaviors.build().to(BestDatabaseSequenceMapping.id).update(BestDatabaseSequenceMapping, (old: any) => { old.showTooltip = true; });
|
|
294
|
+
// // await plugin.runTask(plugin.state.behaviors.updateTree(addTooltipUpdate));
|
|
295
|
+
// BestDatabaseSequenceMapping
|
|
296
|
+
// console.log(plugin.state.data.select(modelRef)[0])
|
|
297
|
+
}
|
|
298
|
+
let invalidStruct = chainSel ? false : true;
|
|
299
|
+
if (superpositionParams && superpositionParams.ligandView) {
|
|
300
|
+
const state = plugin.state.data;
|
|
301
|
+
const hetInfo = await getLigandNamesFromModelData(plugin, state, modelRef);
|
|
302
|
+
const hets = hetInfo ? hetInfo.hetNames : [];
|
|
303
|
+
// const interactingHets = [];
|
|
304
|
+
if (hets && hets.length > 0) {
|
|
305
|
+
for await (const het of hets) {
|
|
306
|
+
const ligand = builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
307
|
+
'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(), s.auth_asym_id]),
|
|
308
|
+
'residue-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.label_comp_id(), het]),
|
|
309
|
+
'group-by': builder_1.MolScriptBuilder.core.str.concat([builder_1.MolScriptBuilder.struct.atomProperty.core.operatorName(), builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()])
|
|
310
|
+
});
|
|
311
|
+
let labelTagParams = { label: `${het}`, tags: [`superposition-ligand-sel`] };
|
|
312
|
+
let hetColor = color_1.Color.fromRgb(253, 3, 253);
|
|
313
|
+
if (superpositionParams && superpositionParams.ligandColor) {
|
|
314
|
+
const { r, g, b } = superpositionParams.ligandColor;
|
|
315
|
+
hetColor = color_1.Color.fromRgb(r, g, b);
|
|
316
|
+
}
|
|
317
|
+
const ligandExp = await plugin.builders.structure.tryCreateComponentFromExpression(strInstance, ligand, `${het}-${segmentIndex}`, labelTagParams);
|
|
318
|
+
if (ligandExp) {
|
|
319
|
+
await plugin.builders.structure.representation.addRepresentation(ligandExp, { type: 'ball-and-stick', color: 'uniform', colorParams: { value: hetColor } }, { tag: `superposition-ligand-visual` });
|
|
320
|
+
spState.refMaps[ligandExp.ref] = `${s.pdb_id}_${s.struct_asym_id}`;
|
|
321
|
+
invalidStruct = false;
|
|
322
|
+
// interactingHets.push(het);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const carbEntityCount = hetInfo ? hetInfo.carbEntityCount : 0;
|
|
327
|
+
if (carbEntityCount > 0) {
|
|
328
|
+
// Get Carbohydrate Polymers details from PDBe API
|
|
329
|
+
const allCarbPolymers = await getCarbPolymerDetailsFromApi(plugin, s.pdb_id);
|
|
330
|
+
// Polymer chain + surroundings query
|
|
331
|
+
const polymerChainWithSurroundings = builder_1.MolScriptBuilder.struct.modifier.includeSurroundings({
|
|
332
|
+
0: builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
333
|
+
'entity-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.ammp('entityType'), 'polymer']),
|
|
334
|
+
'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(), s.auth_asym_id]),
|
|
335
|
+
'group-by': builder_1.MolScriptBuilder.core.str.concat([builder_1.MolScriptBuilder.struct.atomProperty.core.operatorName(), builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()])
|
|
336
|
+
}),
|
|
337
|
+
radius: 5,
|
|
338
|
+
'as-whole-residues': true
|
|
339
|
+
});
|
|
340
|
+
let i = 0;
|
|
341
|
+
for (const carbEntityChainId of allCarbPolymers.branchedChains) {
|
|
342
|
+
const carbEntityChain = builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
343
|
+
'entity-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.ammp('entityType'), 'branched']),
|
|
344
|
+
'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(), carbEntityChainId]),
|
|
345
|
+
'group-by': builder_1.MolScriptBuilder.core.str.concat([builder_1.MolScriptBuilder.struct.atomProperty.core.operatorName(), builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()])
|
|
346
|
+
});
|
|
347
|
+
const carbEntityChainInVicinity = builder_1.MolScriptBuilder.struct.filter.intersectedBy({
|
|
348
|
+
0: polymerChainWithSurroundings,
|
|
349
|
+
by: carbEntityChain
|
|
350
|
+
});
|
|
351
|
+
const data = (plugin.state.data.select(strInstance.ref)[0].obj).data;
|
|
352
|
+
const carbChainSel = script_1.Script.getStructureSelection(carbEntityChainInVicinity, data);
|
|
353
|
+
if (carbChainSel && carbChainSel.kind === 'sequence') {
|
|
354
|
+
// console.log(carbEntityChainId + ' chain present in 5 A radius');
|
|
355
|
+
const carbLigands = [];
|
|
356
|
+
const carbLigNamesAndCount = {};
|
|
357
|
+
const carbLigList = [];
|
|
358
|
+
for (const carbLigs of allCarbPolymers.branchedLigands[i]) {
|
|
359
|
+
const ligResDetails = carbLigs.split('-');
|
|
360
|
+
carbLigands.push(builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(), +ligResDetails[1]]));
|
|
361
|
+
if (carbLigNamesAndCount[ligResDetails[0]]) {
|
|
362
|
+
carbLigNamesAndCount[ligResDetails[0]]++;
|
|
525
363
|
}
|
|
526
364
|
else {
|
|
527
|
-
|
|
365
|
+
carbLigNamesAndCount[ligResDetails[0]] = 1;
|
|
528
366
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
if (e_3) throw e_3.error;
|
|
546
|
-
return [7 /*endfinally*/];
|
|
547
|
-
case 46: return [7 /*endfinally*/];
|
|
548
|
-
case 47:
|
|
549
|
-
if (busyFlagOn) {
|
|
550
|
-
busyFlagOn = false;
|
|
551
|
-
customState.events.isBusy.next(false);
|
|
552
|
-
}
|
|
553
|
-
return [2 /*return*/];
|
|
367
|
+
carbLigList.push(ligResDetails[0]);
|
|
368
|
+
}
|
|
369
|
+
const carbVisLabel = createCarbVisLabel(carbLigNamesAndCount);
|
|
370
|
+
const branchedEntity = builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
371
|
+
'entity-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.ammp('entityType'), 'branched']),
|
|
372
|
+
'group-by': builder_1.MolScriptBuilder.core.str.concat([builder_1.MolScriptBuilder.struct.atomProperty.core.operatorName(), builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()]),
|
|
373
|
+
'chain-test': builder_1.MolScriptBuilder.core.rel.eq([builder_1.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(), carbEntityChainId]),
|
|
374
|
+
'residue-test': builder_1.MolScriptBuilder.core.logic.or(carbLigands)
|
|
375
|
+
});
|
|
376
|
+
let labelTagParams = { label: `${carbVisLabel}`, tags: [`superposition-carb-sel`] };
|
|
377
|
+
const ligandExp = await plugin.builders.structure.tryCreateComponentFromExpression(strInstance, branchedEntity, `${carbLigList.join('-')}-${segmentIndex}`, labelTagParams);
|
|
378
|
+
if (ligandExp) {
|
|
379
|
+
await plugin.builders.structure.representation.addRepresentation(ligandExp, { type: 'carbohydrate' }, { tag: `superposition-carb-visual` });
|
|
380
|
+
spState.refMaps[ligandExp.ref] = `${s.pdb_id}_${s.struct_asym_id}`;
|
|
381
|
+
invalidStruct = false;
|
|
382
|
+
}
|
|
554
383
|
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
if (!cell || !cell.obj)
|
|
570
|
-
return [2 /*return*/, void 0];
|
|
571
|
-
model = cell.obj.data;
|
|
572
|
-
if (!model)
|
|
573
|
-
return [2 /*return*/];
|
|
574
|
-
structures = [];
|
|
575
|
-
for (_i = 0, _b = plugin.managers.structure.hierarchy.selection.structures; _i < _b.length; _i++) {
|
|
576
|
-
s = _b[_i];
|
|
577
|
-
structure = (_a = s.cell.obj) === null || _a === void 0 ? void 0 : _a.data;
|
|
578
|
-
if (structure)
|
|
579
|
-
structures.push(structure);
|
|
384
|
+
i++;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
if (invalidStruct) {
|
|
388
|
+
spState.invalidStruct.push(`${s.pdb_id}_${s.struct_asym_id}`);
|
|
389
|
+
const loadedStructIndex = spState.loadedStructs[segmentIndex].indexOf(`${s.pdb_id}_${s.struct_asym_id}`);
|
|
390
|
+
if (loadedStructIndex > -1)
|
|
391
|
+
spState.loadedStructs[segmentIndex].splice(loadedStructIndex, 1);
|
|
392
|
+
// remove downloaded data
|
|
393
|
+
if (clearOnFail) {
|
|
394
|
+
// const m = plugin.state.data.select(modelRef)[0];
|
|
395
|
+
// const t = plugin.state.data.select(m.transform.parent)[0];
|
|
396
|
+
// const d = plugin.state.data.select(t.transform.parent)[0];
|
|
397
|
+
// PluginCommands.State.RemoveObject(plugin, { state: d.parent!, ref: d.transform.parent, removeParentGhosts: true });
|
|
580
398
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
// if(interactingHets.length > 0) spState.hets[`${s.pdb_id}_${s.struct_asym_id}`] = interactingHets;
|
|
402
|
+
}
|
|
585
403
|
}
|
|
586
|
-
}
|
|
404
|
+
}
|
|
405
|
+
if (busyFlagOn) {
|
|
406
|
+
busyFlagOn = false;
|
|
407
|
+
customState.events.isBusy.next(false);
|
|
408
|
+
}
|
|
587
409
|
});
|
|
588
410
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
});
|
|
411
|
+
exports.renderSuperposition = renderSuperposition;
|
|
412
|
+
async function getLigandNamesFromModelData(plugin, state, modelRef) {
|
|
413
|
+
const cell = state.select(modelRef)[0];
|
|
414
|
+
if (!cell || !cell.obj)
|
|
415
|
+
return void 0;
|
|
416
|
+
const model = cell.obj.data;
|
|
417
|
+
if (!model)
|
|
418
|
+
return;
|
|
419
|
+
const structures = [];
|
|
420
|
+
for (const s of plugin.managers.structure.hierarchy.selection.structures) {
|
|
421
|
+
const structure = s.cell.obj?.data;
|
|
422
|
+
if (structure)
|
|
423
|
+
structures.push(structure);
|
|
424
|
+
}
|
|
425
|
+
const info = await helpers_1.ModelInfo.get(model, structures);
|
|
426
|
+
return info;
|
|
427
|
+
}
|
|
428
|
+
async function loadStructure(plugin, url, format, isBinary) {
|
|
429
|
+
try {
|
|
430
|
+
const data = await plugin.builders.data.download({ url: assets_1.Asset.Url(url), isBinary: isBinary });
|
|
431
|
+
const trajectory = await plugin.builders.structure.parseTrajectory(data, format);
|
|
432
|
+
const model = await plugin.builders.structure.createModel(trajectory);
|
|
433
|
+
const modelProperties = await plugin.builders.structure.insertModelProperties(model);
|
|
434
|
+
const structure = await plugin.builders.structure.createStructure(modelProperties || model, { name: 'model', params: {} });
|
|
435
|
+
await plugin.builders.structure.insertStructureProperties(structure);
|
|
436
|
+
return { data, trajectory, model, structure };
|
|
437
|
+
}
|
|
438
|
+
catch (e) {
|
|
439
|
+
return { structure: void 0 };
|
|
440
|
+
}
|
|
622
441
|
}
|
|
623
442
|
function chainSelection(struct_asym_id) {
|
|
624
443
|
return builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
@@ -626,169 +445,114 @@ function chainSelection(struct_asym_id) {
|
|
|
626
445
|
});
|
|
627
446
|
}
|
|
628
447
|
function transform(plugin, s, matrix) {
|
|
629
|
-
|
|
448
|
+
const b = plugin.state.data.build().to(s)
|
|
630
449
|
.insert(transforms_1.StateTransforms.Model.TransformStructureConformation, { transform: { name: 'matrix', params: { data: matrix, transpose: false } } });
|
|
631
450
|
return plugin.runTask(plugin.state.data.updateTree(b));
|
|
632
451
|
}
|
|
633
|
-
function afTransform(plugin, s, matrix, coordinateSystem) {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
return
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
b = o
|
|
653
|
-
? plugin.state.data.build().to(o).update(params)
|
|
654
|
-
: plugin.state.data.build().to(s)
|
|
655
|
-
.insert(transforms_1.StateTransforms.Model.TransformStructureConformation, params, { tags: 'SuperpositionTransform' });
|
|
656
|
-
return [4 /*yield*/, plugin.runTask(plugin.state.data.updateTree(b))];
|
|
657
|
-
case 1:
|
|
658
|
-
_a.sent();
|
|
659
|
-
return [2 /*return*/];
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
});
|
|
452
|
+
async function afTransform(plugin, s, matrix, coordinateSystem) {
|
|
453
|
+
const r = mol_state_1.StateObjectRef.resolveAndCheck(plugin.state.data, s);
|
|
454
|
+
if (!r)
|
|
455
|
+
return;
|
|
456
|
+
const o = plugin.state.data.selectQ(q => q.byRef(r.transform.ref).subtree().withTransformer(transforms_1.StateTransforms.Model.TransformStructureConformation))[0];
|
|
457
|
+
const transform = coordinateSystem && !linear_algebra_1.Mat4.isIdentity(coordinateSystem.matrix)
|
|
458
|
+
? linear_algebra_1.Mat4.mul((0, linear_algebra_1.Mat4)(), coordinateSystem.matrix, matrix)
|
|
459
|
+
: matrix;
|
|
460
|
+
const params = {
|
|
461
|
+
transform: {
|
|
462
|
+
name: 'matrix',
|
|
463
|
+
params: { data: transform, transpose: false }
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
const b = o
|
|
467
|
+
? plugin.state.data.build().to(o).update(params)
|
|
468
|
+
: plugin.state.data.build().to(s)
|
|
469
|
+
.insert(transforms_1.StateTransforms.Model.TransformStructureConformation, params, { tags: 'SuperpositionTransform' });
|
|
470
|
+
await plugin.runTask(plugin.state.data.updateTree(b));
|
|
663
471
|
}
|
|
664
|
-
function getMatrixData(plugin) {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
clusterRecData = _a.sent();
|
|
681
|
-
if (clusterRecData && clusterRecData.data) {
|
|
682
|
-
plugin.customState.superpositionState.matrixData = clusterRecData.data;
|
|
683
|
-
}
|
|
684
|
-
return [3 /*break*/, 4];
|
|
685
|
-
case 3:
|
|
686
|
-
e_5 = _a.sent();
|
|
687
|
-
customState['superpositionError'] = "Matrix data not available for ".concat(matrixAccession);
|
|
688
|
-
plugin.customState.events.superpositionInit.next(true); // Emit segment API data load event
|
|
689
|
-
return [3 /*break*/, 4];
|
|
690
|
-
case 4: return [2 /*return*/];
|
|
691
|
-
}
|
|
692
|
-
});
|
|
693
|
-
});
|
|
472
|
+
async function getMatrixData(plugin) {
|
|
473
|
+
const customState = plugin.customState;
|
|
474
|
+
const matrixAccession = customState.initParams.superpositionParams.matrixAccession ? customState.initParams.superpositionParams.matrixAccession : customState.initParams.moleculeId;
|
|
475
|
+
const clusterRecUrlStr = `${customState.initParams.pdbeUrl}static/superpose/matrices/${matrixAccession}`;
|
|
476
|
+
const assetManager = plugin.managers.asset;
|
|
477
|
+
const clusterRecUrl = assets_1.Asset.getUrlAsset(assetManager, clusterRecUrlStr);
|
|
478
|
+
try {
|
|
479
|
+
const clusterRecData = await plugin.runTask(assetManager.resolve(clusterRecUrl, 'json', false));
|
|
480
|
+
if (clusterRecData && clusterRecData.data) {
|
|
481
|
+
plugin.customState.superpositionState.matrixData = clusterRecData.data;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
catch (e) {
|
|
485
|
+
customState['superpositionError'] = `Matrix data not available for ${matrixAccession}`;
|
|
486
|
+
plugin.customState.events.superpositionInit.next(true); // Emit segment API data load event
|
|
487
|
+
}
|
|
694
488
|
}
|
|
695
|
-
function getSegmentData(plugin) {
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
if (result && result.data) {
|
|
712
|
-
customState.superpositionState.segmentData = result.data[customState.initParams.moleculeId];
|
|
713
|
-
}
|
|
714
|
-
return [3 /*break*/, 4];
|
|
715
|
-
case 3:
|
|
716
|
-
e_6 = _a.sent();
|
|
717
|
-
customState['superpositionError'] = "Superposition data not available for ".concat(customState.initParams.moleculeId);
|
|
718
|
-
plugin.customState.events.superpositionInit.next(true); // Emit segment API data load event
|
|
719
|
-
return [3 /*break*/, 4];
|
|
720
|
-
case 4: return [2 /*return*/];
|
|
721
|
-
}
|
|
722
|
-
});
|
|
723
|
-
});
|
|
489
|
+
async function getSegmentData(plugin) {
|
|
490
|
+
const customState = plugin.customState;
|
|
491
|
+
// Get Data
|
|
492
|
+
const segmentsUrl = `${customState.initParams.pdbeUrl}graph-api/uniprot/superposition/${customState.initParams.moleculeId}`;
|
|
493
|
+
const assetManager = plugin.managers.asset;
|
|
494
|
+
const url = assets_1.Asset.getUrlAsset(assetManager, segmentsUrl);
|
|
495
|
+
try {
|
|
496
|
+
const result = await plugin.runTask(assetManager.resolve(url, 'json', false));
|
|
497
|
+
if (result && result.data) {
|
|
498
|
+
customState.superpositionState.segmentData = result.data[customState.initParams.moleculeId];
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
catch (e) {
|
|
502
|
+
customState['superpositionError'] = `Superposition data not available for ${customState.initParams.moleculeId}`;
|
|
503
|
+
plugin.customState.events.superpositionInit.next(true); // Emit segment API data load event
|
|
504
|
+
}
|
|
724
505
|
}
|
|
725
506
|
function getChainLigands(carbEntity) {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
for (
|
|
732
|
-
|
|
733
|
-
labelValueArr.push("".concat(chemComp.chem_comp_id, " (").concat(chemComp.count, ")"));
|
|
507
|
+
const ligandChain = [];
|
|
508
|
+
const ligandLabels = [];
|
|
509
|
+
const ligands = [];
|
|
510
|
+
const labelValueArr = [];
|
|
511
|
+
let ligNameStr = '';
|
|
512
|
+
for (const chemComp of carbEntity.chem_comp_list) {
|
|
513
|
+
labelValueArr.push(`${chemComp.chem_comp_id} (${chemComp.count})`);
|
|
734
514
|
}
|
|
735
515
|
ligNameStr = labelValueArr.join(', ');
|
|
736
|
-
for (
|
|
737
|
-
var chain = _c[_b];
|
|
516
|
+
for (const chain of carbEntity.chains) {
|
|
738
517
|
ligandChain.push(chain.chain_id);
|
|
739
518
|
ligandLabels.push(ligNameStr);
|
|
740
|
-
|
|
741
|
-
for (
|
|
742
|
-
var residue = _e[_d];
|
|
519
|
+
const chainLigands = [];
|
|
520
|
+
for (const residue of chain.residues) {
|
|
743
521
|
chainLigands.push(residue.chem_comp_id + '-' + residue.residue_number);
|
|
744
522
|
}
|
|
745
523
|
ligands.push(chainLigands);
|
|
746
524
|
}
|
|
747
525
|
return {
|
|
748
|
-
ligands
|
|
749
|
-
ligandChain
|
|
750
|
-
ligandLabels
|
|
526
|
+
ligands,
|
|
527
|
+
ligandChain,
|
|
528
|
+
ligandLabels
|
|
751
529
|
};
|
|
752
530
|
}
|
|
753
|
-
function getCarbPolymerDetailsFromApi(plugin, pdb_id) {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
result = _a.sent();
|
|
772
|
-
if (result && result.data) {
|
|
773
|
-
carbEntities = result.data[pdb_id];
|
|
774
|
-
for (_i = 0, carbEntities_1 = carbEntities; _i < carbEntities_1.length; _i++) {
|
|
775
|
-
carbEntity = carbEntities_1[_i];
|
|
776
|
-
carbLigData = getChainLigands(carbEntity);
|
|
777
|
-
branchedLigands = branchedLigands.concat(carbLigData.ligands);
|
|
778
|
-
branchedChains = branchedChains.concat(carbLigData.ligandChain);
|
|
779
|
-
branchedlabels = branchedlabels.concat(carbLigData.ligandLabels);
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
return [3 /*break*/, 4];
|
|
783
|
-
case 3:
|
|
784
|
-
e_7 = _a.sent();
|
|
785
|
-
return [3 /*break*/, 4];
|
|
786
|
-
case 4: return [2 /*return*/, {
|
|
787
|
-
branchedChains: branchedChains,
|
|
788
|
-
branchedLigands: branchedLigands,
|
|
789
|
-
branchedlabels: branchedlabels
|
|
790
|
-
}];
|
|
531
|
+
async function getCarbPolymerDetailsFromApi(plugin, pdb_id) {
|
|
532
|
+
const customState = plugin.customState;
|
|
533
|
+
// Get Data
|
|
534
|
+
const apiUrl = `${customState.initParams.pdbeUrl}api/pdb/entry/carbohydrate_polymer/${pdb_id}`;
|
|
535
|
+
const assetManager = plugin.managers.asset;
|
|
536
|
+
const url = assets_1.Asset.getUrlAsset(assetManager, apiUrl);
|
|
537
|
+
let branchedLigands = [];
|
|
538
|
+
let branchedChains = [];
|
|
539
|
+
let branchedlabels = [];
|
|
540
|
+
try {
|
|
541
|
+
const result = await plugin.runTask(assetManager.resolve(url, 'json', false));
|
|
542
|
+
if (result && result.data) {
|
|
543
|
+
const carbEntities = result.data[pdb_id];
|
|
544
|
+
for (const carbEntity of carbEntities) {
|
|
545
|
+
const carbLigData = getChainLigands(carbEntity);
|
|
546
|
+
branchedLigands = branchedLigands.concat(carbLigData.ligands);
|
|
547
|
+
branchedChains = branchedChains.concat(carbLigData.ligandChain);
|
|
548
|
+
branchedlabels = branchedlabels.concat(carbLigData.ligandLabels);
|
|
791
549
|
}
|
|
792
|
-
}
|
|
793
|
-
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
catch (e) { }
|
|
553
|
+
return {
|
|
554
|
+
branchedChains,
|
|
555
|
+
branchedLigands,
|
|
556
|
+
branchedlabels
|
|
557
|
+
};
|
|
794
558
|
}
|