drugflow-molstar 0.4.7 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/drugflow-molstar-0.4.9.css +1 -0
- package/build/drugflow-molstar-component-0.4.9.js +25 -0
- package/build/drugflow-molstar-plugin-0.4.9.js +2 -0
- package/build/drugflow-molstar-plugin-0.4.9.js.LICENSE.txt +39 -0
- package/lib/alphafold-transparency.js +157 -62
- package/lib/contact.d.ts +7 -14
- package/lib/contact.js +68 -72
- package/lib/custom-events.js +15 -15
- package/lib/domain-annotations/behavior.d.ts +1 -1
- package/lib/domain-annotations/behavior.js +24 -20
- package/lib/domain-annotations/color.js +22 -22
- package/lib/domain-annotations/prop.js +111 -62
- package/lib/drugflow-molstar-component-build-0.4.8.js +2 -0
- package/lib/drugflow-molstar-component-build-0.4.8.js.LICENSE.txt +24 -0
- package/lib/drugflow-molstar-component-build-0.4.9.js +2 -0
- package/lib/drugflow-molstar-component-build-0.4.9.js.LICENSE.txt +24 -0
- package/lib/helpers.d.ts +3 -3
- package/lib/helpers.js +94 -89
- package/lib/index.d.ts +902 -1
- package/lib/index.js +2814 -1875
- package/lib/labels.d.ts +1 -1
- package/lib/labels.js +34 -20
- package/lib/loci-details.js +46 -34
- package/lib/sifts-mapping.js +32 -28
- package/lib/sifts-mappings-behaviour.d.ts +1 -1
- package/lib/sifts-mappings-behaviour.js +30 -26
- package/lib/spec.js +40 -52
- package/lib/structure_contact3d.d.ts +14 -21
- package/lib/structure_contact3d.js +46 -25
- package/lib/subscribe-events.js +18 -19
- package/lib/superposition-export.js +178 -102
- package/lib/superposition-focus-representation.d.ts +2 -2
- package/lib/superposition-focus-representation.js +131 -73
- package/lib/superposition-sifts-mapping.js +150 -105
- package/lib/superposition.js +810 -495
- package/lib/ui/alphafold-superposition.d.ts +1 -1
- package/lib/ui/alphafold-superposition.js +118 -94
- package/lib/ui/alphafold-tranparency.js +43 -27
- package/lib/ui/annotation-controls.js +89 -83
- package/lib/ui/export-superposition.d.ts +0 -1
- package/lib/ui/export-superposition.js +50 -32
- package/lib/ui/pdbe-left-panel.d.ts +0 -1
- package/lib/ui/pdbe-left-panel.js +105 -82
- package/lib/ui/pdbe-screenshot-controls.js +83 -54
- package/lib/ui/pdbe-structure-controls.js +57 -34
- package/lib/ui/pdbe-viewport-controls.js +29 -23
- package/lib/ui/segment-tree.js +663 -440
- package/lib/ui/superposition-components.js +312 -208
- package/lib/ui/superposition-viewport.js +18 -11
- package/package.json +3 -3
- package/build/drugflow-molstar-0.4.7.css +0 -1
- package/build/drugflow-molstar-component-0.4.7.js +0 -25
- package/build/drugflow-molstar-plugin-0.4.7.js +0 -2
- package/build/drugflow-molstar-plugin-0.4.7.js.LICENSE.txt +0 -64
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-dom.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @license React
|
|
13
|
+
* react-jsx-runtime.production.min.js
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the MIT license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @license React
|
|
23
|
+
* react.production.min.js
|
|
24
|
+
*
|
|
25
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
26
|
+
*
|
|
27
|
+
* This source code is licensed under the MIT license found in the
|
|
28
|
+
* LICENSE file in the root directory of this source tree.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @license React
|
|
33
|
+
* scheduler.production.min.js
|
|
34
|
+
*
|
|
35
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
36
|
+
*
|
|
37
|
+
* This source code is licensed under the MIT license found in the
|
|
38
|
+
* LICENSE file in the root directory of this source tree.
|
|
39
|
+
*/
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
exports.applyAFTransparency = applyAFTransparency;
|
|
4
|
+
exports.setStructureTransparency = setStructureTransparency;
|
|
5
|
+
exports.clearStructureTransparency = clearStructureTransparency;
|
|
6
|
+
var tslib_1 = require("tslib");
|
|
7
|
+
var structure_1 = require("Molstar/mol-model/structure");
|
|
8
|
+
var transforms_1 = require("Molstar/mol-plugin-state/transforms");
|
|
9
|
+
var mol_state_1 = require("Molstar/mol-state");
|
|
10
|
+
var loci_1 = require("Molstar/mol-model/loci");
|
|
11
|
+
var transparency_1 = require("Molstar/mol-theme/transparency");
|
|
12
|
+
var builder_1 = require("Molstar/mol-script/language/builder");
|
|
13
|
+
var prop_1 = require("Molstar/extensions/model-archive/quality-assessment/prop");
|
|
14
|
+
var compiler_1 = require("Molstar/mol-script/runtime/query/compiler");
|
|
15
|
+
var structure_2 = require("Molstar/mol-model/structure");
|
|
16
|
+
var TransparencyManagerTag = 'transparency-controls';
|
|
14
17
|
function getLociByPLDDT(score, contextData) {
|
|
15
|
-
|
|
18
|
+
var queryExp = builder_1.MolScriptBuilder.struct.modifier.union([
|
|
16
19
|
builder_1.MolScriptBuilder.struct.modifier.wholeResidues([
|
|
17
20
|
builder_1.MolScriptBuilder.struct.modifier.union([
|
|
18
21
|
builder_1.MolScriptBuilder.struct.generator.atomGroups({
|
|
@@ -22,65 +25,157 @@ function getLociByPLDDT(score, contextData) {
|
|
|
22
25
|
])
|
|
23
26
|
])
|
|
24
27
|
]);
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
var query = (0, compiler_1.compile)(queryExp);
|
|
29
|
+
var sel = query(new structure_2.QueryContext(contextData));
|
|
27
30
|
return structure_2.StructureSelection.toLociWithSourceUnits(sel);
|
|
28
31
|
}
|
|
29
|
-
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
function applyAFTransparency(plugin_1, structure_3, transparency_2) {
|
|
33
|
+
return tslib_1.__awaiter(this, arguments, void 0, function (plugin, structure, transparency, pLDDT) {
|
|
34
|
+
var _this = this;
|
|
35
|
+
if (pLDDT === void 0) { pLDDT = 70; }
|
|
36
|
+
return tslib_1.__generator(this, function (_a) {
|
|
37
|
+
return [2 /*return*/, plugin.dataTransaction(function (ctx) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
38
|
+
var loci;
|
|
39
|
+
var _a;
|
|
40
|
+
return tslib_1.__generator(this, function (_b) {
|
|
41
|
+
switch (_b.label) {
|
|
42
|
+
case 0:
|
|
43
|
+
loci = getLociByPLDDT(pLDDT, (_a = structure.cell.obj) === null || _a === void 0 ? void 0 : _a.data);
|
|
44
|
+
return [4 /*yield*/, setStructureTransparency(plugin, structure.components, transparency, loci)];
|
|
45
|
+
case 1:
|
|
46
|
+
_b.sent();
|
|
47
|
+
return [2 /*return*/];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}); }, { canUndo: 'Apply Transparency' })];
|
|
51
|
+
});
|
|
52
|
+
});
|
|
34
53
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
function setStructureTransparency(plugin, components, value, loci, types) {
|
|
55
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
56
|
+
var _this = this;
|
|
57
|
+
return tslib_1.__generator(this, function (_a) {
|
|
58
|
+
switch (_a.label) {
|
|
59
|
+
case 0: return [4 /*yield*/, eachRepr(plugin, components, function (update, repr, transparencyCell) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
60
|
+
var structure, layer, bundleLayers, filtered, filtered;
|
|
61
|
+
return tslib_1.__generator(this, function (_a) {
|
|
62
|
+
if (types && types.length > 0 && !types.includes(repr.params.values.type.name))
|
|
63
|
+
return [2 /*return*/];
|
|
64
|
+
structure = repr.obj.data.sourceData;
|
|
65
|
+
if (loci_1.Loci.isEmpty(loci) || (0, loci_1.isEmptyLoci)(loci))
|
|
66
|
+
return [2 /*return*/];
|
|
67
|
+
layer = {
|
|
68
|
+
bundle: structure_1.StructureElement.Bundle.fromLoci(loci),
|
|
69
|
+
value: value,
|
|
70
|
+
};
|
|
71
|
+
if (transparencyCell) {
|
|
72
|
+
bundleLayers = tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(transparencyCell.params.values.layers), false), [layer], false);
|
|
73
|
+
filtered = getFilteredBundle(bundleLayers, structure);
|
|
74
|
+
update.to(transparencyCell).update(transparency_1.Transparency.toBundle(filtered));
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
filtered = getFilteredBundle([layer], structure);
|
|
78
|
+
update.to(repr.transform.ref)
|
|
79
|
+
.apply(transforms_1.StateTransforms.Representation.TransparencyStructureRepresentation3DFromBundle, transparency_1.Transparency.toBundle(filtered), { tags: TransparencyManagerTag });
|
|
80
|
+
}
|
|
81
|
+
return [2 /*return*/];
|
|
82
|
+
});
|
|
83
|
+
}); })];
|
|
84
|
+
case 1:
|
|
85
|
+
_a.sent();
|
|
86
|
+
return [2 /*return*/];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
57
89
|
});
|
|
58
90
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
91
|
+
function clearStructureTransparency(plugin, components, types) {
|
|
92
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
93
|
+
var _this = this;
|
|
94
|
+
return tslib_1.__generator(this, function (_a) {
|
|
95
|
+
switch (_a.label) {
|
|
96
|
+
case 0: return [4 /*yield*/, eachRepr(plugin, components, function (update, repr, transparencyCell) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
97
|
+
return tslib_1.__generator(this, function (_a) {
|
|
98
|
+
if (types && types.length > 0 && !types.includes(repr.params.values.type.name))
|
|
99
|
+
return [2 /*return*/];
|
|
100
|
+
if (transparencyCell) {
|
|
101
|
+
update.delete(transparencyCell.transform.ref);
|
|
102
|
+
}
|
|
103
|
+
return [2 /*return*/];
|
|
104
|
+
});
|
|
105
|
+
}); })];
|
|
106
|
+
case 1:
|
|
107
|
+
_a.sent();
|
|
108
|
+
return [2 /*return*/];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
67
111
|
});
|
|
68
112
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
113
|
+
function eachRepr(plugin, components, callback) {
|
|
114
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
115
|
+
var state, update, components_1, components_1_1, c, _a, _b, r, transparency, e_1_1, e_2_1;
|
|
116
|
+
var e_2, _c, e_1, _d;
|
|
117
|
+
return tslib_1.__generator(this, function (_e) {
|
|
118
|
+
switch (_e.label) {
|
|
119
|
+
case 0:
|
|
120
|
+
state = plugin.state.data;
|
|
121
|
+
update = state.build();
|
|
122
|
+
_e.label = 1;
|
|
123
|
+
case 1:
|
|
124
|
+
_e.trys.push([1, 12, 13, 14]);
|
|
125
|
+
components_1 = tslib_1.__values(components), components_1_1 = components_1.next();
|
|
126
|
+
_e.label = 2;
|
|
127
|
+
case 2:
|
|
128
|
+
if (!!components_1_1.done) return [3 /*break*/, 11];
|
|
129
|
+
c = components_1_1.value;
|
|
130
|
+
_e.label = 3;
|
|
131
|
+
case 3:
|
|
132
|
+
_e.trys.push([3, 8, 9, 10]);
|
|
133
|
+
_a = (e_1 = void 0, tslib_1.__values(c.representations)), _b = _a.next();
|
|
134
|
+
_e.label = 4;
|
|
135
|
+
case 4:
|
|
136
|
+
if (!!_b.done) return [3 /*break*/, 7];
|
|
137
|
+
r = _b.value;
|
|
138
|
+
transparency = state.select(mol_state_1.StateSelection.Generators.ofTransformer(transforms_1.StateTransforms.Representation.TransparencyStructureRepresentation3DFromBundle, r.cell.transform.ref).withTag(TransparencyManagerTag));
|
|
139
|
+
return [4 /*yield*/, callback(update, r.cell, transparency[0])];
|
|
140
|
+
case 5:
|
|
141
|
+
_e.sent();
|
|
142
|
+
_e.label = 6;
|
|
143
|
+
case 6:
|
|
144
|
+
_b = _a.next();
|
|
145
|
+
return [3 /*break*/, 4];
|
|
146
|
+
case 7: return [3 /*break*/, 10];
|
|
147
|
+
case 8:
|
|
148
|
+
e_1_1 = _e.sent();
|
|
149
|
+
e_1 = { error: e_1_1 };
|
|
150
|
+
return [3 /*break*/, 10];
|
|
151
|
+
case 9:
|
|
152
|
+
try {
|
|
153
|
+
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
|
|
154
|
+
}
|
|
155
|
+
finally { if (e_1) throw e_1.error; }
|
|
156
|
+
return [7 /*endfinally*/];
|
|
157
|
+
case 10:
|
|
158
|
+
components_1_1 = components_1.next();
|
|
159
|
+
return [3 /*break*/, 2];
|
|
160
|
+
case 11: return [3 /*break*/, 14];
|
|
161
|
+
case 12:
|
|
162
|
+
e_2_1 = _e.sent();
|
|
163
|
+
e_2 = { error: e_2_1 };
|
|
164
|
+
return [3 /*break*/, 14];
|
|
165
|
+
case 13:
|
|
166
|
+
try {
|
|
167
|
+
if (components_1_1 && !components_1_1.done && (_c = components_1.return)) _c.call(components_1);
|
|
168
|
+
}
|
|
169
|
+
finally { if (e_2) throw e_2.error; }
|
|
170
|
+
return [7 /*endfinally*/];
|
|
171
|
+
case 14: return [2 /*return*/, update.commit({ doNotUpdateCurrent: true })];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
});
|
|
80
175
|
}
|
|
81
176
|
/** filter transparency layers for given structure */
|
|
82
177
|
function getFilteredBundle(layers, structure) {
|
|
83
|
-
|
|
84
|
-
|
|
178
|
+
var transparency = transparency_1.Transparency.ofBundle(layers, structure.root);
|
|
179
|
+
var merged = transparency_1.Transparency.merge(transparency);
|
|
85
180
|
return transparency_1.Transparency.filter(merged, structure);
|
|
86
181
|
}
|
package/lib/contact.d.ts
CHANGED
|
@@ -24,12 +24,12 @@ export declare const ContactParams: {
|
|
|
24
24
|
tether: PD.BooleanParam;
|
|
25
25
|
tetherLength: PD.Numeric;
|
|
26
26
|
tetherBaseWidth: PD.Numeric;
|
|
27
|
-
attachment: PD.Select<"
|
|
28
|
-
fontFamily: PD.Select<import("
|
|
27
|
+
attachment: PD.Select<"bottom-left" | "bottom-center" | "bottom-right" | "middle-left" | "middle-center" | "middle-right" | "top-left" | "top-center" | "top-right">;
|
|
28
|
+
fontFamily: PD.Select<import("Molstar/mol-geo/geometry/text/font-atlas").FontFamily>;
|
|
29
29
|
fontQuality: PD.Select<number>;
|
|
30
|
-
fontStyle: PD.Select<import("
|
|
31
|
-
fontVariant: PD.Select<import("
|
|
32
|
-
fontWeight: PD.Select<import("
|
|
30
|
+
fontStyle: PD.Select<import("Molstar/mol-geo/geometry/text/font-atlas").FontStyle>;
|
|
31
|
+
fontVariant: PD.Select<import("Molstar/mol-geo/geometry/text/font-atlas").FontVariant>;
|
|
32
|
+
fontWeight: PD.Select<import("Molstar/mol-geo/geometry/text/font-atlas").FontWeight>;
|
|
33
33
|
alpha: PD.Numeric;
|
|
34
34
|
quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
|
|
35
35
|
material: PD.Group<PD.Normalize<{
|
|
@@ -38,22 +38,16 @@ export declare const ContactParams: {
|
|
|
38
38
|
bumpiness: number;
|
|
39
39
|
}>>;
|
|
40
40
|
clip: PD.Group<PD.Normalize<{
|
|
41
|
-
variant: import("
|
|
41
|
+
variant: import("Molstar/mol-util/clip").Clip.Variant;
|
|
42
42
|
objects: PD.Normalize<{
|
|
43
43
|
type: any;
|
|
44
44
|
invert: any;
|
|
45
45
|
position: any;
|
|
46
46
|
rotation: any;
|
|
47
47
|
scale: any;
|
|
48
|
-
transform: any;
|
|
49
48
|
}>[];
|
|
50
49
|
}>>;
|
|
51
|
-
emissive: PD.Numeric;
|
|
52
|
-
density: PD.Numeric;
|
|
53
50
|
instanceGranularity: PD.BooleanParam;
|
|
54
|
-
lod: PD.Vec3;
|
|
55
|
-
cellSize: PD.Numeric;
|
|
56
|
-
batchSize: PD.Numeric;
|
|
57
51
|
lineSizeAttenuation: PD.BooleanParam;
|
|
58
52
|
linesSize: PD.Numeric;
|
|
59
53
|
dashLength: PD.Numeric;
|
|
@@ -62,9 +56,8 @@ export declare const ContactParams: {
|
|
|
62
56
|
sizeAspectRatio: PD.Numeric;
|
|
63
57
|
doubleSided: PD.BooleanParam;
|
|
64
58
|
ignoreLight: PD.BooleanParam;
|
|
65
|
-
celShaded: PD.BooleanParam;
|
|
66
59
|
xrayShaded: PD.Select<boolean | "inverted">;
|
|
67
|
-
transparentBackfaces: PD.Select<"
|
|
60
|
+
transparentBackfaces: PD.Select<"on" | "off" | "opaque">;
|
|
68
61
|
solidInterior: PD.BooleanParam;
|
|
69
62
|
bumpFrequency: PD.Numeric;
|
|
70
63
|
bumpAmplitude: PD.Numeric;
|
package/lib/contact.js
CHANGED
|
@@ -1,59 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ContactParams = void 0;
|
|
4
|
+
exports.contactLabel = contactLabel;
|
|
5
|
+
exports.ContactRepresentation = ContactRepresentation;
|
|
6
|
+
var tslib_1 = require("tslib");
|
|
4
7
|
// contact.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
var loci_1 = require("molstar/lib/mol-model/loci");
|
|
9
|
+
var text_1 = require("molstar/lib/mol-geo/geometry/text/text");
|
|
10
|
+
var param_definition_1 = require("molstar/lib/mol-util/param-definition");
|
|
11
|
+
var names_1 = require("molstar/lib/mol-util/color/names");
|
|
12
|
+
var representation_1 = require("molstar/lib/mol-repr/shape/representation");
|
|
13
|
+
var representation_2 = require("molstar/lib/mol-repr/representation");
|
|
14
|
+
var shape_1 = require("molstar/lib/mol-model/shape");
|
|
15
|
+
var text_builder_1 = require("molstar/lib/mol-geo/geometry/text/text-builder");
|
|
16
|
+
var linear_algebra_1 = require("molstar/lib/mol-math/linear-algebra");
|
|
17
|
+
var marker_action_1 = require("molstar/lib/mol-util/marker-action");
|
|
18
|
+
var label_1 = require("molstar/lib/mol-theme/label");
|
|
19
|
+
var common_1 = require("molstar/lib/mol-repr/shape/loci/common");
|
|
20
|
+
var geometry_1 = require("molstar/lib/mol-math/geometry");
|
|
21
|
+
var cylinders_builder_1 = require("molstar/lib/mol-geo/geometry/cylinders/cylinders-builder");
|
|
22
|
+
var cylinders_1 = require("molstar/lib/mol-geo/geometry/cylinders/cylinders");
|
|
23
|
+
var label_2 = require("molstar/lib/mol-theme/label");
|
|
24
|
+
var SharedParams = {
|
|
22
25
|
unitLabel: param_definition_1.ParamDefinition.Text('\u212B', { isEssential: true }),
|
|
23
26
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
const ContactVisuals = {
|
|
38
|
-
cylinder: (ctx, getParams) => (0, representation_1.ShapeRepresentation)(getCylindersShape, cylinders_1.Cylinders.Utils, {
|
|
39
|
-
modifyState: (s) => ({ ...s, markerActions: marker_action_1.MarkerActions.Highlighting }),
|
|
40
|
-
}),
|
|
41
|
-
text: (ctx, getParams) => (0, representation_1.ShapeRepresentation)(getTextShape, text_1.Text.Utils, {
|
|
42
|
-
modifyState: (s) => ({ ...s, markerActions: marker_action_1.MarkerAction.None }),
|
|
43
|
-
}),
|
|
44
|
-
};
|
|
45
|
-
exports.ContactParams = {
|
|
46
|
-
...CylinderParams,
|
|
47
|
-
...TextParams,
|
|
48
|
-
visuals: param_definition_1.ParamDefinition.MultiSelect(['cylinder', 'text'], param_definition_1.ParamDefinition.objectToOptions(ContactVisuals)),
|
|
27
|
+
var CylinderParams = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, cylinders_1.Cylinders.Params), SharedParams), { lineSizeAttenuation: param_definition_1.ParamDefinition.Boolean(true), linesSize: param_definition_1.ParamDefinition.Numeric(0.075, { min: 0.01, max: 5, step: 0.01 }), dashLength: param_definition_1.ParamDefinition.Numeric(0.12, { min: 0.01, max: 0.2, step: 0.01 }), interactionType: param_definition_1.ParamDefinition.Text('', { isEssential: true }), cylinderColor: param_definition_1.ParamDefinition.Color(names_1.ColorNames.lightgreen, { isEssential: true }) });
|
|
28
|
+
var TextParams = tslib_1.__assign(tslib_1.__assign({}, common_1.LociLabelTextParams), SharedParams);
|
|
29
|
+
var ContactVisuals = {
|
|
30
|
+
cylinder: function (ctx, getParams) {
|
|
31
|
+
return (0, representation_1.ShapeRepresentation)(getCylindersShape, cylinders_1.Cylinders.Utils, {
|
|
32
|
+
modifyState: function (s) { return (tslib_1.__assign(tslib_1.__assign({}, s), { markerActions: marker_action_1.MarkerActions.Highlighting })); },
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
text: function (ctx, getParams) {
|
|
36
|
+
return (0, representation_1.ShapeRepresentation)(getTextShape, text_1.Text.Utils, {
|
|
37
|
+
modifyState: function (s) { return (tslib_1.__assign(tslib_1.__assign({}, s), { markerActions: marker_action_1.MarkerAction.None })); },
|
|
38
|
+
});
|
|
39
|
+
},
|
|
49
40
|
};
|
|
41
|
+
exports.ContactParams = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, CylinderParams), TextParams), { visuals: param_definition_1.ParamDefinition.MultiSelect(['cylinder', 'text'], param_definition_1.ParamDefinition.objectToOptions(ContactVisuals)) });
|
|
50
42
|
//
|
|
51
|
-
function contactLabel(pair, options
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
function contactLabel(pair, options) {
|
|
44
|
+
var _a;
|
|
45
|
+
if (options === void 0) { options = {}; }
|
|
46
|
+
var o = tslib_1.__assign(tslib_1.__assign({}, label_2.DefaultLabelOptions), options);
|
|
47
|
+
var label = (0, label_2.bundleLabel)(pair, o);
|
|
48
|
+
return "".concat((_a = o === null || o === void 0 ? void 0 : o.interactionType) !== null && _a !== void 0 ? _a : 'Distance', "</br>").concat(label);
|
|
55
49
|
}
|
|
56
|
-
exports.contactLabel = contactLabel;
|
|
57
50
|
function getContactState() {
|
|
58
51
|
return {
|
|
59
52
|
sphereA: (0, geometry_1.Sphere3D)(),
|
|
@@ -63,8 +56,8 @@ function getContactState() {
|
|
|
63
56
|
};
|
|
64
57
|
}
|
|
65
58
|
function setContactState(pair, state) {
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
var sphereA = state.sphereA, sphereB = state.sphereB, center = state.center;
|
|
60
|
+
var _a = tslib_1.__read(pair.loci, 2), lociA = _a[0], lociB = _a[1];
|
|
68
61
|
loci_1.Loci.getBoundingSphere(lociA, sphereA);
|
|
69
62
|
loci_1.Loci.getBoundingSphere(lociB, sphereB);
|
|
70
63
|
linear_algebra_1.Vec3.add(center, sphereA.center, sphereB.center);
|
|
@@ -72,19 +65,19 @@ function setContactState(pair, state) {
|
|
|
72
65
|
state.distance = linear_algebra_1.Vec3.distance(sphereA.center, sphereB.center);
|
|
73
66
|
return state;
|
|
74
67
|
}
|
|
75
|
-
|
|
68
|
+
var tmpState = getContactState();
|
|
76
69
|
function getContactName(data, unitLabel) {
|
|
77
70
|
return data.pairs.length === 1
|
|
78
|
-
?
|
|
79
|
-
unitLabel,
|
|
71
|
+
? "Contact ".concat((0, label_1.distanceLabel)(data.pairs[0], {
|
|
72
|
+
unitLabel: unitLabel,
|
|
80
73
|
measureOnly: true,
|
|
81
|
-
})
|
|
82
|
-
:
|
|
74
|
+
}))
|
|
75
|
+
: "".concat(data.pairs.length, " Contacts");
|
|
83
76
|
}
|
|
84
77
|
//
|
|
85
78
|
function buildCylinders(data, props, cylinders) {
|
|
86
|
-
|
|
87
|
-
for (
|
|
79
|
+
var builder = cylinders_builder_1.CylindersBuilder.create(128, 64, cylinders);
|
|
80
|
+
for (var i = 0, il = data.pairs.length; i < il; ++i) {
|
|
88
81
|
setContactState(data.pairs[i], tmpState);
|
|
89
82
|
// TODO: radiusScale: number, topCap: boolean, bottomCap: boolean
|
|
90
83
|
builder.addFixedLengthDashes(tmpState.sphereA.center, tmpState.sphereB.center, props.dashLength, 1, true, true, false, // interpolate parameter
|
|
@@ -93,31 +86,34 @@ function buildCylinders(data, props, cylinders) {
|
|
|
93
86
|
return builder.getCylinders();
|
|
94
87
|
}
|
|
95
88
|
function getCylindersShape(ctx, data, props, shape) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
89
|
+
var cylinders = buildCylinders(data, props, shape && shape.geometry);
|
|
90
|
+
var name = getContactName(data, props.unitLabel);
|
|
91
|
+
var getLabel = function (groupId) {
|
|
92
|
+
return contactLabel(data.pairs[groupId], props);
|
|
93
|
+
};
|
|
94
|
+
return shape_1.Shape.create(name, data, cylinders, function () { return props.cylinderColor; }, function () { return props.linesSize; }, getLabel);
|
|
100
95
|
}
|
|
101
96
|
//
|
|
102
97
|
function buildText(data, props, text) {
|
|
103
|
-
|
|
104
|
-
for (
|
|
98
|
+
var builder = text_builder_1.TextBuilder.create(props, 128, 64, text);
|
|
99
|
+
for (var i = 0, il = data.pairs.length; i < il; ++i) {
|
|
105
100
|
setContactState(data.pairs[i], tmpState);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
var center = tmpState.center, distance = tmpState.distance, sphereA = tmpState.sphereA, sphereB = tmpState.sphereB;
|
|
102
|
+
var label = props.customText || "".concat(distance.toFixed(2), " ").concat(props.unitLabel);
|
|
103
|
+
var radius = Math.max(2, sphereA.radius, sphereB.radius);
|
|
104
|
+
var scale = radius / 2;
|
|
110
105
|
builder.add(label, center[0], center[1], center[2], 1, scale, i);
|
|
111
106
|
}
|
|
112
107
|
return builder.getText();
|
|
113
108
|
}
|
|
114
109
|
function getTextShape(ctx, data, props, shape) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
var text = buildText(data, props, shape && shape.geometry);
|
|
111
|
+
var name = getContactName(data, props.unitLabel);
|
|
112
|
+
var getLabel = function (groupId) {
|
|
113
|
+
return (0, label_1.distanceLabel)(data.pairs[groupId], props);
|
|
114
|
+
};
|
|
115
|
+
return shape_1.Shape.create(name, data, text, function () { return props.textColor; }, function () { return props.textSize; }, getLabel);
|
|
119
116
|
}
|
|
120
117
|
function ContactRepresentation(ctx, getParams) {
|
|
121
118
|
return representation_2.Representation.createMulti('Contact', ctx, getParams, representation_2.Representation.StateBuilder, ContactVisuals);
|
|
122
119
|
}
|
|
123
|
-
exports.ContactRepresentation = ContactRepresentation;
|
package/lib/custom-events.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CustomEvents = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var loci_details_1 = require("./loci-details");
|
|
5
|
+
var operators_1 = require("rxjs/operators");
|
|
6
6
|
var CustomEvents;
|
|
7
7
|
(function (CustomEvents) {
|
|
8
8
|
function create(eventTypeArr) {
|
|
9
|
-
|
|
10
|
-
for (
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
var eventObj = {};
|
|
10
|
+
for (var ei = 0, el = eventTypeArr.length; ei < el; ei++) {
|
|
11
|
+
var eventType = eventTypeArr[ei];
|
|
12
|
+
var event_1 = void 0;
|
|
13
13
|
if (typeof MouseEvent == 'function') {
|
|
14
14
|
// current standard
|
|
15
|
-
|
|
15
|
+
event_1 = new MouseEvent(eventType, { 'view': window, 'bubbles': true, 'cancelable': true });
|
|
16
16
|
}
|
|
17
17
|
else if (typeof document.createEvent == 'function') {
|
|
18
18
|
// older standard
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
event_1 = document.createEvent('MouseEvents');
|
|
20
|
+
event_1.initEvent(eventType, true /* bubbles */, true /* cancelable */);
|
|
21
21
|
}
|
|
22
|
-
eventObj[eventType] =
|
|
22
|
+
eventObj[eventType] = event_1;
|
|
23
23
|
}
|
|
24
24
|
;
|
|
25
25
|
return eventObj;
|
|
@@ -33,17 +33,17 @@ var CustomEvents;
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
function add(plugin, targetElement) {
|
|
36
|
-
|
|
37
|
-
plugin.behaviors.interaction.click.subscribe((e)
|
|
36
|
+
var pdbevents = create(['PDB.molstar.click', 'PDB.molstar.mouseover', 'PDB.molstar.mouseout']);
|
|
37
|
+
plugin.behaviors.interaction.click.subscribe(function (e) {
|
|
38
38
|
if (e.button === 1 && e.current && e.current.loci.kind !== 'empty-loci') {
|
|
39
|
-
|
|
39
|
+
var evData = (0, loci_details_1.lociDetails)(e.current.loci);
|
|
40
40
|
if (evData)
|
|
41
41
|
dispatchCustomEvent(pdbevents['PDB.molstar.click'], evData, targetElement);
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
plugin.behaviors.interaction.hover.pipe((0, operators_1.debounceTime)(100)).subscribe((e)
|
|
44
|
+
plugin.behaviors.interaction.hover.pipe((0, operators_1.debounceTime)(100)).subscribe(function (e) {
|
|
45
45
|
if (e.current && e.current.loci && e.current.loci.kind !== 'empty-loci') {
|
|
46
|
-
|
|
46
|
+
var evData = (0, loci_details_1.lociDetails)(e.current.loci);
|
|
47
47
|
if (evData)
|
|
48
48
|
dispatchCustomEvent(pdbevents['PDB.molstar.mouseover'], evData, targetElement);
|
|
49
49
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PluginBehavior } from 'Molstar/mol-plugin/behavior';
|
|
2
|
-
export declare const PDBeDomainAnnotations: import("
|
|
2
|
+
export declare const PDBeDomainAnnotations: import("Molstar/mol-state").StateTransformer<PluginBehavior.Category, PluginBehavior.Behavior, {
|
|
3
3
|
autoAttach: boolean;
|
|
4
4
|
showTooltip: boolean;
|
|
5
5
|
}>;
|